CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:49:42 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
break long lines


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/pci/voyager/pwmclock.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/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.4 src/sys/dev/pci/voyager/pwmclock.c:1.5
--- src/sys/dev/pci/voyager/pwmclock.c:1.4	Thu Feb 23 07:37:16 2012
+++ src/sys/dev/pci/voyager/pwmclock.c	Thu Feb 23 07:49:42 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.5 2012/02/23 07:49:42 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pwmclock.c,v 1.5 2012/02/23 07:49:42 macallan Exp $");
 
 #include 
 #include 
@@ -117,7 +117,8 @@ pwmclock_wait_edge(struct pwmclock_softc
 {
 	/* clear interrupt */
 	bus_space_write_4(sc->sc_memt, sc->sc_regh, SM502_PWM1, sc->sc_reg);
-	while ((bus_space_read_4(sc->sc_memt, sc->sc_regh, SM502_PWM1) & SM502_PWM_INTR_PENDING) == 0);
+	while ((bus_space_read_4(sc->sc_memt, sc->sc_regh, SM502_PWM1) &
+	SM502_PWM_INTR_PENDING) == 0);
 	return mips3_cp0_count_read();
 }
 
@@ -138,7 +139,8 @@ pwmclock_attach(device_t parent, device_
 
 	voyager_establish_intr(parent, 22, pwmclock_intr, sc);
 	reg = voyager_set_pwm(100, 100); /* 100Hz, 10% duty cycle */
-	reg |= SM502_PWM_ENABLE | SM502_PWM_ENABLE_INTR | SM502_PWM_INTR_PENDING;
+	reg |= SM502_PWM_ENABLE | SM502_PWM_ENABLE_INTR |
+	   SM502_PWM_INTR_PENDING;
 	sc->sc_reg = reg;
 	pwmclock = sc;
 	initclocks_ptr = pwmclock_start;
@@ -155,8 +157,10 @@ pwmclock_attach(device_t parent, device_
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF("calibrating CPU timer...\n");
 	for (clk = 1; clk < 8; clk++) {
-		REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0) & ~LS2FCFG_FREQSCALE_MASK) | clk;
-		bus_space_write_4(sc->sc_memt, sc->sc_regh, SM502_PWM1, sc->sc_reg);
+		REGVAL(LS2F_CHIPCFG0) =
+		(REGVAL(LS2F_CHIPCFG0) & ~LS2FCFG_FREQSCALE_MASK) | clk;
+		bus_space_write_4(sc->sc_memt, sc->sc_regh, SM502_PWM1,
+		sc->sc_reg);
 		acc = 0;
 		last = pwmclock_wait_edge(sc);
 		for (i = 0; i < 16; i++) {
@@ -169,7 +173,8 @@ pwmclock_attach(device_t parent, device_
 	}
 #ifdef PWMCLOCK_DEBUG
 	for (clk = 1; clk < 8; clk++) {
-		aprint_normal_dev(sc->sc_dev, "%d/8: %d\n", clk + 1, sc->sc_scale[clk]);
+		aprint_normal_dev(sc->sc_dev, "%d/8: %d\n", clk + 1,
+		sc->sc_scale[clk]);
 	}
 #endif
 	sc->sc_step = 7;
@@ -180,13 +185,15 @@ pwmclock_attach(device_t parent, device_
 	&me, 
 	CTLFLAG_READWRITE, CTLTYPE_NODE, "loongson", NULL, NULL,
 	0, NULL, 0, CTL_MACHDEP, CTL_CREATE, CTL_EOL) != 0)
-		aprint_error_dev(sc->sc_dev, "couldn't create 'loongson' node\n");
-	
+		aprint_error_dev(sc->sc_dev,
+		"couldn't create 'loongson' node\n");
+
 	if (sysctl_createv(NULL, 0, NULL, 
 	&freq, 
-	CTLFLAG_READWRITE, CTLTYPE_NODE, "frequency", NULL, NULL,
-	0, NULL, 0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL) != 0)
-		aprint_error_dev(sc->sc_dev, "couldn't create 'frequency' node\n");
+	CTLFLAG_READWRITE, CTLTYPE_NODE, "frequency", NULL, NULL, 0, NULL,
+	0, CTL_MACHDEP, me->sysctl_num, CTL_CREATE, CTL_EOL) != 0)
+		aprint_error_dev(sc->sc_dev,
+		"couldn't create 'frequency' node\n");
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	&sysctl_node, 
@@ -195,7 +202,8 @@ pwmclock_attach(device_t parent, device_
 	0, sc, 0, CTL_MACHDEP, me->sysctl_num, freq->sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc->sc_dev, "couldn't create 'target' node\n");
+		aprint_error_dev(sc->sc_dev,
+		"couldn't create 'target' node\n");
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	&sysctl_node, 
@@ -204,7 +212,8 @@ pwmclock_attach(device_t parent, device_
 	1, sc, 0, CTL_MACHDEP, me->sysctl_num, freq->sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc->sc_dev, "couldn't create 'current' node\n");
+		aprint_error_dev(sc->sc_dev,
+		"couldn't create 'current' node\n");
 
 	if (sysctl_createv(NULL, 0, NULL, 
 	&sysctl_node, 
@@ -213,7 +222,8 @@ pwmclock_attach(device_t parent, device_
 	2, sc, 0, CTL_MACHDEP, me->sysctl_num, freq->sysctl_num, 
 	CTL_CREATE, CTL_EOL) == 0) {
 	} else
-		aprint_error_dev(sc->sc_dev, "couldn't create 'available' node\n");
+		aprint_error_dev(sc->sc_dev,
+		"couldn't create 'available' node\n");
 }
 
 static void
@@ -224,7 +234,8 @@ pwmclock_shutdown(void *cookie)
 	/* just in case the interrupt handler runs again after this */
 	sc->sc_step_wanted = 7;
 	/* set the clock to full speed */
-	REGVAL(LS2F_CHIPCFG0)

CVS commit: src/sys/dev/pci/voyager

2012-02-22 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Feb 23 07:37:17 UTC 2012

Modified Files:
src/sys/dev/pci/voyager: pwmclock.c

Log Message:
set the CPU clock back to full speed on shutdown
this is necessary because PMON does not touch the clock scaling register on
reboot but still reports full CPU speed which confuses the clock code


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/voyager/pwmclock.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/voyager/pwmclock.c
diff -u src/sys/dev/pci/voyager/pwmclock.c:1.3 src/sys/dev/pci/voyager/pwmclock.c:1.4
--- src/sys/dev/pci/voyager/pwmclock.c:1.3	Tue Feb 14 22:27:20 2012
+++ src/sys/dev/pci/voyager/pwmclock.c	Thu Feb 23 07:37:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $	*/
+/*	$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $	*/
 
 /*
  * Copyright (c) 2011 Michael Lorenz
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pwmclock.c,v 1.3 2012/02/14 22:27:20 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pwmclock.c,v 1.4 2012/02/23 07:37:16 macallan Exp $");
 
 #include 
 #include 
@@ -63,6 +63,7 @@ struct pwmclock_softc {
 	uint32_t sc_count;	/* should probably be 64 bit */
 	int sc_step;
 	int sc_step_wanted;
+	void *sc_shutdown_cookie;
 };
 
 static int	pwmclock_match(device_t, cfdata_t, void *);
@@ -89,6 +90,8 @@ static int  pwmclock_cpuspeed_temp(SYSCT
 static int  pwmclock_cpuspeed_cur(SYSCTLFN_ARGS);
 static int  pwmclock_cpuspeed_available(SYSCTLFN_ARGS);
 
+static void pwmclock_shutdown(void *);
+
 static struct timecounter pwmclock_timecounter = {
 	get_pwmclock_timecount,	/* get_timecount */
 	0,			/* no poll_pps */
@@ -140,6 +143,15 @@ pwmclock_attach(device_t parent, device_
 	pwmclock = sc;
 	initclocks_ptr = pwmclock_start;
 
+	/*
+	 * Establish a hook so on shutdown we can set the CPU clock back to
+	 * full speed. This is necessary because PMON doesn't change the 
+	 * clock scale register on a warm boot, the MIPS clock code gets
+	 * confused if we're too slow and the loongson-specific bits run
+	 * too late in the boot process
+	 */
+	sc->sc_shutdown_cookie = shutdownhook_establish(pwmclock_shutdown, sc);
+
 	/* ok, let's see how far the cycle counter gets between interrupts */
 	DPRINTF("calibrating CPU timer...\n");
 	for (clk = 1; clk < 8; clk++) {
@@ -204,6 +216,17 @@ pwmclock_attach(device_t parent, device_
 		aprint_error_dev(sc->sc_dev, "couldn't create 'available' node\n");
 }
 
+static void
+pwmclock_shutdown(void *cookie)
+{
+	struct pwmclock_softc *sc = cookie;
+
+	/* just in case the interrupt handler runs again after this */
+	sc->sc_step_wanted = 7;
+	/* set the clock to full speed */
+	REGVAL(LS2F_CHIPCFG0) = (REGVAL(LS2F_CHIPCFG0) & ~LS2FCFG_FREQSCALE_MASK) | 7;
+}
+
 void
 pwmclock_set_speed(struct pwmclock_softc *sc, int speed)
 {



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

2012-02-22 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 23 07:30:30 UTC 2012

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
Cleanup.

 - Remove cruft from native x86 origin.
 - Remove access to privileged MSRs.
 - Cleanup stale comments.


To generate a diff of this commit:
cvs rdiff -u -r1.84 -r1.85 src/sys/arch/xen/x86/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/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.84 src/sys/arch/xen/x86/cpu.c:1.85
--- src/sys/arch/xen/x86/cpu.c:1.84	Thu Feb 23 04:10:51 2012
+++ src/sys/arch/xen/x86/cpu.c	Thu Feb 23 07:30:30 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $	*/
+/*	$NetBSD: cpu.c,v 1.85 2012/02/23 07:30:30 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.85 2012/02/23 07:30:30 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -464,7 +464,6 @@ cpu_attach_common(device_t parent, devic
 
 		/* Every processor needs to init it's own ipi h/w (similar to lapic) */
 		xen_ipi_init();
-		/* XXX: clock_init() */
 
 		/* Make sure DELAY() is initialized. */
 		DELAY(1);
@@ -477,9 +476,6 @@ cpu_attach_common(device_t parent, devic
 	case CPU_ROLE_SP:
 		atomic_or_32(&ci->ci_flags, CPUF_SP);
 		cpu_identify(ci);
-#if 0
-		x86_errata();
-#endif
 		x86_cpu_idle_init();
 
 		break;
@@ -487,9 +483,6 @@ cpu_attach_common(device_t parent, devic
 	case CPU_ROLE_BP:
 		atomic_or_32(&ci->ci_flags, CPUF_BSP);
 		cpu_identify(ci);
-#if 0
-		x86_errata();
-#endif
 		x86_cpu_idle_init();
 
 		break;
@@ -561,23 +554,6 @@ cpu_init(struct cpu_info *ci)
 {
 
 	/*
-	 * On a P6 or above, enable global TLB caching if the
-	 * hardware supports it.
-	 */
-	if (cpu_feature[0] & CPUID_PGE)
-		lcr4(rcr4() | CR4_PGE);	/* enable global TLB caching */
-
-#ifdef XXXMTRR
-	/*
-	 * On a P6 or above, initialize MTRR's if the hardware supports them.
-	 */
-	if (cpu_feature[0] & CPUID_MTRR) {
-		if ((ci->ci_flags & CPUF_AP) == 0)
-			i686_mtrr_init_first();
-		mtrr_init_cpu(ci);
-	}
-#endif
-	/*
 	 * If we have FXSAVE/FXRESTOR, use them.
 	 */
 	if (cpu_feature[0] & CPUID_FXSR) {
@@ -600,8 +576,6 @@ cpu_init(struct cpu_info *ci)
 
 	atomic_or_32(&cpus_running, ci->ci_cpumask);
 	atomic_or_32(&ci->ci_flags, CPUF_RUNNING);
-
-	/* XXX: register vcpu_register_runstate_memory_area, and figure out how to make sure this VCPU is running ? */
 }
 
 
@@ -739,15 +713,13 @@ cpu_hatch(void *v)
 	KASSERT((ci->ci_flags & CPUF_RUNNING) == 0);
 
 	pcb = lwp_getpcb(curlwp);
-	pcb->pcb_cr3 = pmap_pdirpa(pmap_kernel(), 0); /* XXX: consider using pmap_load() ? */
+	pcb->pcb_cr3 = pmap_pdirpa(pmap_kernel(), 0);
 	pcb = lwp_getpcb(ci->ci_data.cpu_idlelwp);
 
 	xen_ipi_init();
 
 	xen_initclocks();
 	
-	/* XXX: lapic_initclocks(); */
-
 #ifdef __x86_64__
 	fpuinit(ci);
 #endif
@@ -760,9 +732,6 @@ cpu_hatch(void *v)
 	s = splhigh();
 	x86_enable_intr();
 	splx(s);
-#if 0
-	x86_errata();
-#endif
 
 	aprint_debug_dev(ci->ci_dev, "running\n");
 
@@ -831,7 +800,7 @@ gdt_prepframes(paddr_t *frames, vaddr_t 
 }
 
 #ifdef __x86_64__
-extern char *ldtstore; /* XXX: Xen MP todo */
+extern char *ldtstore;
 
 static void
 xen_init_amd64_vcpuctxt(struct cpu_info *ci,
@@ -855,13 +824,11 @@ xen_init_amd64_vcpuctxt(struct cpu_info 
 
 	memset(initctx, 0, sizeof *initctx);
 
-	gdt_ents = roundup(gdt_size, PAGE_SIZE) >> PAGE_SHIFT; /* XXX: re-investigate roundup(gdt_size... ) for gdt_ents. */
+	gdt_ents = roundup(gdt_size, PAGE_SIZE) >> PAGE_SHIFT; 
 	KASSERT(gdt_ents <= 16);
 
 	gdt_prepframes(frames, (vaddr_t) ci->ci_gdt, gdt_ents);
 
-	/* XXX: The stuff in here is amd64 specific. move to mptramp.[Sc] ? */
-
 	/* Initialise the vcpu context: We use idle_loop()'s pcb context. */
 
 	l = ci->ci_data.cpu_idlelwp;
@@ -911,7 +878,7 @@ xen_init_amd64_vcpuctxt(struct cpu_info 
 	initctx->kernel_sp = pcb->pcb_rsp0;
 	initctx->ctrlreg[0] = pcb->pcb_cr0;
 	initctx->ctrlreg[1] = 0; /* "resuming" from kernel - no User cr3. */
-	initctx->ctrlreg[2] = pcb->pcb_cr2; /* XXX: */
+	initctx->ctrlreg[2] = (vaddr_t) targetrip;
 	/* 
 	 * Use pmap_kernel() L4 PD directly, until we setup the
 	 * per-cpu L4 PD in pmap_cpu_init_late()
@@ -953,7 +920,7 @@ xen_init_i386_vcpuctxt(struct cpu_info *
 
 	memset(initctx, 0, sizeof *initctx);
 
-	gdt_ents = roundup(gdt_size, PAGE_SIZE) >> PAGE_SHIFT; /* XXX: re-investigate roundup(gdt_size... ) for gdt_ents. */
+	gdt_ents = roundup(gdt_size, PAGE_SIZE) >> PAGE_SHIFT;
 	KASSERT(gdt_ents <= 16);
 
 	gdt_prepframes(frames, (vaddr_t) ci->ci_gdt, gdt_ents);
@@ -1015,7 +982,7 @@ xen_init_i386_vcpuctxt(struct cpu_info *
 	initctx->kernel_sp = pcb->pcb_esp0;
 	initctx->ctrlreg[0] = pcb->pcb_cr0;
 	initctx->ctrlreg[1] = 0; /* "resuming" from kernel - no 

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

2012-02-22 Thread Cherry G. Mathew
Module Name:src
Committed By:   cherry
Date:   Thu Feb 23 04:10:51 UTC 2012

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
cpu_load_pmap() should not be used to load pmap_kernel(), since in the
x86 model, its mappings are shared across pmaps. KASSERT() for this
and remove unused codepaths.


To generate a diff of this commit:
cvs rdiff -u -r1.83 -r1.84 src/sys/arch/xen/x86/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/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.83 src/sys/arch/xen/x86/cpu.c:1.84
--- src/sys/arch/xen/x86/cpu.c:1.83	Wed Feb 22 18:29:31 2012
+++ src/sys/arch/xen/x86/cpu.c	Thu Feb 23 04:10:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.84 2012/02/23 04:10:51 cherry Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1176,6 +1176,8 @@ x86_cpu_idle_xen(void)
 void
 cpu_load_pmap(struct pmap *pmap, struct pmap *oldpmap)
 {
+	KASSERT(pmap != pmap_kernel());
+	
 #if defined(__x86_64__) || defined(PAE)
 	struct cpu_info *ci = curcpu();
 	uint32_t cpumask = ci->ci_cpumask;
@@ -1226,14 +1228,8 @@ cpu_load_pmap(struct pmap *pmap, struct 
 			}
 		}
 
-		if (__predict_true(pmap != pmap_kernel())) {
-			xen_set_user_pgd(pmap_pdirpa(pmap, 0));
-			ci->ci_xen_current_user_pgd = pmap_pdirpa(pmap, 0);
-		}
-		else {
-			xpq_queue_pt_switch(l4_pd_ma);
-			ci->ci_xen_current_user_pgd = 0;
-		}
+		xen_set_user_pgd(pmap_pdirpa(pmap, 0));
+		ci->ci_xen_current_user_pgd = pmap_pdirpa(pmap, 0);
 
 		tlbflush();
 	}



CVS commit: [netbsd-6] src/doc

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:31:51 UTC 2012

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

Log Message:
Tickets 23, 33


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.12 -r1.1.2.13 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.12 src/doc/CHANGES-6.0:1.1.2.13
--- src/doc/CHANGES-6.0:1.1.2.12	Thu Feb 23 02:18:54 2012
+++ src/doc/CHANGES-6.0	Thu Feb 23 02:31:50 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.12 2012/02/23 02:18:54 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.13 2012/02/23 02:31:50 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -390,3 +390,14 @@ dist/openpam/modules/pam_unix/pam_unix.c
 	openpam moved to external/bsd, remove old sources.
 	[tron, ticket #20]
 
+sys/dev/raidframe/rf_reconmap.c			1.34
+sys/dev/raidframe/rf_reconstruct.c		1.118
+
+	Handle RAID5_RS correctly.
+	[oster, ticket #23]
+
+sys/arch/xen/xen/if_xennet_xenbus.c		1.59
+
+	Resolve network issue with NetBSD domU on newer Linux dom0.
+	[bouyer, ticket #33]
+



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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:30:16 UTC 2012

Modified Files:
src/sys/arch/xen/xen [netbsd-6]: if_xennet_xenbus.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #33):
sys/arch/xen/xen/if_xennet_xenbus.c: revision 1.59
Allocating a fixed, limited number of buffers for receive and sending them
to the network stack is a bad idea, because if all receive buffers sits
in socket queues, the interface receive stalls by lack of buffers.
Instead, get receive pages from a pool_cache(9). Copying to a mbuf cluser
would work too, but testings shows this has an important performance hit.
This also simplifies locking.
While there, notify the dom0 when we add some receive buffers (older
linux dom0 didn't care, but newer one do).
Problem reported and fix tested by Brian Marcotte on port-xen


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.58.2.1 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.58 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.58.2.1
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.58	Thu Feb  2 19:43:01 2012
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Thu Feb 23 02:30:16 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.58.2.1 2012/02/23 02:30:16 riz Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.58.2.1 2012/02/23 02:30:16 riz Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -148,7 +148,6 @@ int xennet_debug = 0xff;
 #endif
 
 #define GRANT_INVALID_REF -1 /* entry is free */
-#define GRANT_STACK_REF   -2 /* entry owned by the network stack */
 
 #define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
 #define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
@@ -210,6 +209,9 @@ struct xennet_xenbus_softc {
 static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
 static u_long xennet_pages[NET_RX_RING_SIZE];
 
+static pool_cache_t if_xennetrxbuf_cache;
+static int if_xennetrxbuf_cache_inited=0;
+
 static int  xennet_xenbus_match(device_t, cfdata_t, void *);
 static void xennet_xenbus_attach(device_t, device_t, void *);
 static int  xennet_xenbus_detach(device_t, int);
@@ -219,6 +221,7 @@ static void xennet_alloc_rx_buffer(struc
 static void xennet_free_rx_buffer(struct xennet_xenbus_softc *);
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
+static void xennet_rx_free_req(struct xennet_rxreq *);
 static int  xennet_handler(void *);
 static bool xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
@@ -301,6 +304,14 @@ xennet_xenbus_attach(device_t parent, de
 	sc->sc_xbusd = xa->xa_xbusd;
 	sc->sc_xbusd->xbusd_otherend_changed = xennet_backend_changed;
 
+	/* xenbus ensure 2 devices can't be probed at the same time */
+	if (if_xennetrxbuf_cache_inited == 0) {
+		if_xennetrxbuf_cache = pool_cache_init(PAGE_SIZE, 0, 0, 0,
+		"xnfrx", NULL, IPL_VM, NULL, NULL, NULL);
+		if_xennetrxbuf_cache_inited = 1;
+	}
+		
+
 	/* initialize free RX and RX request lists */
 	mutex_init(&sc->sc_tx_lock, MUTEX_DEFAULT, IPL_NET);
 	SLIST_INIT(&sc->sc_txreq_head);
@@ -316,13 +327,10 @@ xennet_xenbus_attach(device_t parent, de
 		struct xennet_rxreq *rxreq = &sc->sc_rxreqs[i];
 		rxreq->rxreq_id = i;
 		rxreq->rxreq_sc = sc;
-		rxreq->rxreq_va = uvm_km_alloc(kernel_map,
-		PAGE_SIZE, PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_ZERO);
+		rxreq->rxreq_va = (vaddr_t)pool_cache_get_paddr(
+		if_xennetrxbuf_cache, PR_WAITOK, &rxreq->rxreq_pa);
 		if (rxreq->rxreq_va == 0)
 			break;
-		if (!pmap_extract(pmap_kernel(), rxreq->rxreq_va,
-		&rxreq->rxreq_pa))
-			panic("%s: no pa for mapped va ?", device_xname(self));
 		rxreq->rxreq_gntref = GRANT_INVALID_REF;
 		SLIST_INSERT_HEAD(&sc->sc_rxreq_head, rxreq, rxreq_next);
 	}
@@ -581,7 +589,9 @@ again:
 		xenbus_dev_fatal(sc->sc_xbusd, error, "completing transaction");
 		return false;
 	}
+	mutex_enter(&sc->sc_rx_lock);
 	xennet_alloc_rx_buffer(sc);
+	mutex_exit(&sc->sc_rx_lock);
 
 	if (sc->sc_backend_status == BEST_SUSPENDED) {
 		xenbus_device_resume(sc->sc_xbusd);
@@ -675,12 +685,12 @@ xennet_alloc_rx_buffer(struct xennet_xen
 	RING_IDX i;
 	struct xennet_rxreq *req;
 	struct xen_memory_reservation reservation;
-	int s, otherend_id;
+	int s, otherend_id, notify;
 	paddr_t pfn;
 
 	otherend_id = sc->sc_xbusd->xbusd_otherend_id;
 
-	mutex_enter(&sc->sc_rx_lock);
+	KASSERT(mutex_owned(&sc->sc_rx_lock));
 	for (i = 0; sc->sc_free_rxreql != 0; i++) {
 		req  = SLIST_FIR

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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:22:05 UTC 2012

Modified Files:
src/sys/dev/raidframe [netbsd-6]: rf_reconmap.c rf_reconstruct.c

Log Message:
Pull up following revision(s) (requested by oster in ticket #23):
sys/dev/raidframe/rf_reconstruct.c: revision 1.118
sys/dev/raidframe/rf_reconmap.c: revision 1.34
comment, and effectively remove, a DIAGNOSTIC check that
is invalid for RAID5_RS.
Add logic to the main reconstruction loop to handle RAID5 with rotated
spares.  While here, observe that we were actually doing one more
stripe than we thought we were, and correct that too (it didn't matter
for non-RAID5_RS, but it definitely does for RAID5_RS).  Add some
bounds-checking at the beginning to handle the case where the number
of stripes in the set is smaller than the sliding reconstruction window.
XXX: this problem likely needs to be fixed for PARITY_DECLUSTERING too.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.33.8.1 src/sys/dev/raidframe/rf_reconmap.c
cvs rdiff -u -r1.117 -r1.117.8.1 src/sys/dev/raidframe/rf_reconstruct.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/raidframe/rf_reconmap.c
diff -u src/sys/dev/raidframe/rf_reconmap.c:1.33 src/sys/dev/raidframe/rf_reconmap.c:1.33.8.1
--- src/sys/dev/raidframe/rf_reconmap.c:1.33	Wed Aug 31 18:31:02 2011
+++ src/sys/dev/raidframe/rf_reconmap.c	Thu Feb 23 02:22:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconmap.c,v 1.33 2011/08/31 18:31:02 plunky Exp $	*/
+/*	$NetBSD: rf_reconmap.c,v 1.33.8.1 2012/02/23 02:22:05 riz Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.33 2011/08/31 18:31:02 plunky Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconmap.c,v 1.33.8.1 2012/02/23 02:22:05 riz Exp $");
 
 #include "rf_raid.h"
 #include 
@@ -157,7 +157,14 @@ rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF
 
 		/* do we need to move the queue? */
 		while (i > mapPtr->high_ru) {
+#if 0
 #ifdef DIAGNOSTIC
+			/* XXX: The check below is not valid for
+			 * RAID5_RS.  It is valid for RAID 1 and RAID 5.
+			 * The issue is that we can easily have
+			 * RU_NOTHING entries here too, and those are
+			 * quite correct.
+			 */
 			if (mapPtr->status[mapPtr->head]!=RU_ALL) {
 printf("\nraid%d: reconmap incorrect -- working on i %" PRIu64 "\n",
    raidPtr->raidid, i);
@@ -170,6 +177,7 @@ rf_ReconMapUpdate(RF_Raid_t *raidPtr, RF
 panic("reconmap incorrect");
 			} 
 #endif
+#endif
 			mapPtr->low_ru++;
 			mapPtr->high_ru++;
 			/* initialize "highest" RU status entry, which

Index: src/sys/dev/raidframe/rf_reconstruct.c
diff -u src/sys/dev/raidframe/rf_reconstruct.c:1.117 src/sys/dev/raidframe/rf_reconstruct.c:1.117.8.1
--- src/sys/dev/raidframe/rf_reconstruct.c:1.117	Fri Oct 14 09:23:30 2011
+++ src/sys/dev/raidframe/rf_reconstruct.c	Thu Feb 23 02:22:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $	*/
+/*	$NetBSD: rf_reconstruct.c,v 1.117.8.1 2012/02/23 02:22:05 riz Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -33,7 +33,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.117 2011/10/14 09:23:30 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_reconstruct.c,v 1.117.8.1 2012/02/23 02:22:05 riz Exp $");
 
 #include 
 #include 
@@ -570,6 +570,9 @@ rf_ContinueReconstructFailedDisk(RF_Raid
 	RF_ReconCtrl_t *tmp_reconctrl;
 	RF_ReconEvent_t *event;
 	RF_StripeCount_t incPSID,lastPSID,num_writes,pending_writes,prev;
+#if RF_INCLUDE_RAID5_RS > 0
+	RF_StripeCount_t startPSID,endPSID,aPSID,bPSID,offPSID;
+#endif
 	RF_ReconUnitCount_t RUsPerPU;
 	struct timeval etime, elpsd;
 	unsigned long xor_s, xor_resid_us;
@@ -622,7 +625,17 @@ rf_ContinueReconstructFailedDisk(RF_Raid
 	recon_error = 0;
 	write_error = 0;
 	pending_writes = incPSID;
-	raidPtr->reconControl->lastPSID = incPSID;
+	raidPtr->reconControl->lastPSID = incPSID - 1;
+
+	/* bounds check raidPtr->reconControl->lastPSID and
+	   pending_writes so that we don't attempt to wait for more IO
+	   than can possibly happen */
+
+	if (raidPtr->reconControl->lastPSID > lastPSID)
+		raidPtr->reconControl->lastPSID = lastPSID;
+
+	if (pending_writes > lastPSID)
+		pending_writes = lastPSID;
 
 	/* start the actual reconstruction */
 
@@ -636,6 +649,49 @@ rf_ContinueReconstructFailedDisk(RF_Raid
 		}
 
 		num_writes = 0;
+
+#if RF_INCLUDE_RAID5_RS > 0
+		/* For RAID5 with Rotated Spares we will be 'short'
+		   some number of writes since no writes will get
+		   issued for stripes where the spare is on the
+		   component being rebuilt.  Account for the shortage
+		   here so that we don't hang ind

CVS commit: [netbsd-6] src/doc

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:18:54 UTC 2012

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

Log Message:
Tickets 18-20.


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.11 -r1.1.2.12 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.11 src/doc/CHANGES-6.0:1.1.2.12
--- src/doc/CHANGES-6.0:1.1.2.11	Wed Feb 22 19:08:36 2012
+++ src/doc/CHANGES-6.0	Thu Feb 23 02:18:54 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.11 2012/02/22 19:08:36 riz Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.12 2012/02/23 02:18:54 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -188,3 +188,205 @@ sys/arch/i386/i386/machdep.c			1.719
 	Fix FPU corruption occasionally reported on Xen/MP systems.
 	[bouyer, ticket #32]
 
+doc/3RDPARTY	1.912-913 via patch
+
+	Remove stale entries and add "Location" tags that tells where
+	the source lives in the NetBSD tree.
+	[tron, ticket #18]
+
+external/bsd/flex/dist/libmain.c		1.2
+external/bsd/flex/dist/libyywrap.c		1.2
+tools/compat/Makefile1.56
+usr.bin/lex/COPYINGdelete
+usr.bin/lex/FlexLexer.hdelete
+usr.bin/lex/Makefiledelete
+usr.bin/lex/NEWSdelete
+usr.bin/lex/VERSIONdelete
+usr.bin/lex/ccl.cdelete
+usr.bin/lex/config.hdelete
+usr.bin/lex/dfa.cdelete
+usr.bin/lex/ecs.cdelete
+usr.bin/lex/flex.1delete
+usr.bin/lex/flex.skldelete
+usr.bin/lex/flexdef.hdelete
+usr.bin/lex/gen.cdelete
+usr.bin/lex/initscan.cdelete
+usr.bin/lex/libmain.cdelete
+usr.bin/lex/libyywrap.cdelete
+usr.bin/lex/main.cdelete
+usr.bin/lex/misc.cdelete
+usr.bin/lex/mkskel.shdelete
+usr.bin/lex/nfa.cdelete
+usr.bin/lex/parse.ydelete
+usr.bin/lex/scan.ldelete
+usr.bin/lex/sym.cdelete
+usr.bin/lex/tblcmp.cdelete
+usr.bin/lex/version.hdelete
+usr.bin/lex/yylex.cdelete
+
+	Remove unused lex sources.
+	[tron, ticket #19]
+
+dist/openpam/CREDITSdelete
+dist/openpam/HISTORYdelete
+dist/openpam/INSTALLdelete
+dist/openpam/LICENSEdelete
+dist/openpam/Makefile.am			delete
+dist/openpam/Makefile.in			delete
+dist/openpam/READMEdelete
+dist/openpam/RELNOTESdelete
+dist/openpam/aclocal.m4delete
+dist/openpam/autogen.shdelete
+dist/openpam/bin/Makefile.am			delete
+dist/openpam/bin/Makefile.in			delete
+dist/openpam/bin/su/Makefile.am			delete
+dist/openpam/bin/su/Makefile.in			delete
+dist/openpam/bin/su/su.c			delete
+dist/openpam/compiledelete
+dist/openpam/config.guess			delete
+dist/openpam/config.h.in			delete
+dist/openpam/config.subdelete
+dist/openpam/configuredelete
+dist/openpam/configure.ac			delete
+dist/openpam/depcompdelete
+dist/openpam/doc/Makefile.am			delete
+dist/openpam/doc/Makefile.in			delete
+dist/openpam/doc/man/Makefile.am		delete
+dist/openpam/doc/man/Makefile.in		delete
+dist/openpam/doc/man/openpam.3			delete
+dist/openpam/doc/man/openpam.man		delete
+dist/openpam/doc/man/openpam_borrow_cred.3	delete
+dist/openpam/doc/man/openpam_free_data.3	delete
+dist/openpam/doc/man/openpam_free_envlist.3	delete
+dist/openpam/doc/man/openpam_get_option.3	delete
+dist/openpam/doc/man/openpam_log.3		delete
+dist/openpam/doc/man/openpam_nullconv.3		delete
+dist/openpam/doc/man/openpam_readline.3		delete
+dist/openpam/doc/man/openpam_restore_cred.3	delete
+dist/openpam/doc/man/openpam_set_option.3	delete
+dist/openpam/doc/man/openpam_ttyconv.3		delete
+dist/openpam/doc/man/pam.3			delete
+dist/openpam/doc/man/pam.conf.5			delete
+dist/openpam/doc/man/pam.man			delete
+dist/openpam/doc/man/pam_acct_mgmt.3		delete
+dist/openpam/doc/man/pam_authenticate.3		delete
+dist/openpam/doc/man/pam_chauthtok.3		delete
+dist/openpam/doc/man/pam_close_session.3	delete
+dist/openpam/doc/man/pam_conv.3			delete
+dist/openpam/doc/man/pam_end.3			delete
+dist/openpam/doc/man/pam_error.3		delete
+dist/openpam/doc/man/pam_get_authtok.3		delete
+dist/openpam/doc/man/pam_get_data.3		delete
+dist/openpam/doc/man/pam_get_item.3		delete
+dist/openpam/doc/man/pam_get_user.3		delete
+dist/openpam/doc/man/pam_getenv.3		delete
+dist/openpam/doc/man/pam_getenvlist.3		delete
+dist/openpam/doc/man/pam_info.3			delete
+dist/openpam/doc/man/pam_open_session.3		delete
+dist/openpam/doc/man/pam_prompt.3		delete
+dist/openpam/doc/man/pam_putenv.3		delete
+dist/openpam/doc/man/pam_set_data.3		delete
+dist/openpam/doc/man/pam_set_item.3		delete
+dist/openpam/doc/man/pam_setcred.3		delete
+dist/openpam/doc/man/pam_setenv.3		delete
+dist/openpam/doc/man/pam_sm_acct_mgmt.3		delete
+dist/openpam/doc/man/pam_sm_authenticate.3	delete
+dist/openpam/doc/man/pam_sm_chauthtok.3		delete
+dist/openpam/doc/man/pam_sm_close_session.3	delete
+dist/openpam/doc/man/pam_sm_open_session.3	delete
+dist/openpam/doc/man/pam_sm_setcred.3		delete
+d

CVS commit: [netbsd-6] src/dist/openpam

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:16:52 UTC 2012

Removed Files:
src/dist/openpam [netbsd-6]: CREDITS HISTORY INSTALL LICENSE
Makefile.am Makefile.in README RELNOTES aclocal.m4 autogen.sh
compile config.guess config.h.in config.sub configure configure.ac
depcomp install-sh ltmain.sh missing
src/dist/openpam/bin [netbsd-6]: Makefile.am Makefile.in
src/dist/openpam/bin/su [netbsd-6]: Makefile.am Makefile.in su.c
src/dist/openpam/doc [netbsd-6]: Makefile.am Makefile.in
src/dist/openpam/doc/man [netbsd-6]: Makefile.am Makefile.in openpam.3
openpam.man openpam_borrow_cred.3 openpam_free_data.3
openpam_free_envlist.3 openpam_get_option.3 openpam_log.3
openpam_nullconv.3 openpam_readline.3 openpam_restore_cred.3
openpam_set_option.3 openpam_ttyconv.3 pam.3 pam.conf.5 pam.man
pam_acct_mgmt.3 pam_authenticate.3 pam_chauthtok.3
pam_close_session.3 pam_conv.3 pam_end.3 pam_error.3
pam_get_authtok.3 pam_get_data.3 pam_get_item.3 pam_get_user.3
pam_getenv.3 pam_getenvlist.3 pam_info.3 pam_open_session.3
pam_prompt.3 pam_putenv.3 pam_set_data.3 pam_set_item.3
pam_setcred.3 pam_setenv.3 pam_sm_acct_mgmt.3 pam_sm_authenticate.3
pam_sm_chauthtok.3 pam_sm_close_session.3 pam_sm_open_session.3
pam_sm_setcred.3 pam_start.3 pam_strerror.3 pam_verror.3
pam_vinfo.3 pam_vprompt.3
src/dist/openpam/include [netbsd-6]: Makefile.am Makefile.in
src/dist/openpam/include/security [netbsd-6]: Makefile.am Makefile.in
openpam.h openpam_attr.h openpam_version.h pam_appl.h
pam_constants.h pam_modules.h pam_types.h
src/dist/openpam/lib [netbsd-6]: Makefile.am Makefile.in
openpam_borrow_cred.c openpam_configure.c openpam_dispatch.c
openpam_dynamic.c openpam_findenv.c openpam_free_data.c
openpam_free_envlist.c openpam_get_option.c openpam_impl.h
openpam_load.c openpam_log.c openpam_nullconv.c openpam_readline.c
openpam_restore_cred.c openpam_set_option.c openpam_static.c
openpam_ttyconv.c pam_acct_mgmt.c pam_authenticate.c
pam_authenticate_secondary.c pam_chauthtok.c pam_close_session.c
pam_end.c pam_error.c pam_get_authtok.c pam_get_data.c
pam_get_item.c pam_get_mapped_authtok.c pam_get_mapped_username.c
pam_get_user.c pam_getenv.c pam_getenvlist.c pam_info.c
pam_open_session.c pam_prompt.c pam_putenv.c pam_set_data.c
pam_set_item.c pam_set_mapped_authtok.c pam_set_mapped_username.c
pam_setcred.c pam_setenv.c pam_sm_acct_mgmt.c pam_sm_authenticate.c
pam_sm_authenticate_secondary.c pam_sm_chauthtok.c
pam_sm_close_session.c pam_sm_get_mapped_authtok.c
pam_sm_get_mapped_username.c pam_sm_open_session.c
pam_sm_set_mapped_authtok.c pam_sm_set_mapped_username.c
pam_sm_setcred.c pam_start.c pam_strerror.c pam_verror.c
pam_vinfo.c pam_vprompt.c
src/dist/openpam/misc [netbsd-6]: gendoc.pl
src/dist/openpam/modules [netbsd-6]: Makefile.am Makefile.in
src/dist/openpam/modules/pam_deny [netbsd-6]: Makefile.am Makefile.in
pam_deny.c
src/dist/openpam/modules/pam_permit [netbsd-6]: Makefile.am Makefile.in
pam_permit.c
src/dist/openpam/modules/pam_unix [netbsd-6]: Makefile.am Makefile.in
pam_unix.c

Log Message:
Pull up following revision(s) (requested by tron in ticket #20):
dist/openpam/doc/man/pam_set_item.3: file removal
dist/openpam/lib/pam_get_item.c: file removal
dist/openpam/doc/man/openpam_free_envlist.3: file removal
dist/openpam/doc/man/pam_verror.3: file removal
dist/openpam/include/security/pam_modules.h: file removal
dist/openpam/lib/openpam_dispatch.c: file removal
dist/openpam/doc/man/pam_setenv.3: file removal
dist/openpam/doc/man/pam_error.3: file removal
dist/openpam/lib/pam_sm_authenticate_secondary.c: file removal
dist/openpam/lib/openpam_restore_cred.c: file removal
dist/openpam/config.guess: file removal
dist/openpam/include/security/openpam_version.h: file removal
dist/openpam/lib/openpam_set_option.c: file removal
dist/openpam/lib/pam_getenvlist.c: file removal
dist/openpam/lib/pam_end.c: file removal
dist/openpam/lib/pam_authenticate.c: file removal
dist/openpam/install-sh: file removal
dist/openpam/RELNOTES: file removal
dist/openpam/doc/man/openpam_borrow_cred.3: file removal
dist/openpam/include/security/Makefile.in: file removal
dist/openpam/lib/pam_putenv.c: file removal
dist/openpam/include/security/Makefile.am: file removal
dist/openpam/li

CVS commit: [netbsd-6] src

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:11:51 UTC 2012

Modified Files:
src/external/bsd/flex/dist [netbsd-6]: libmain.c libyywrap.c
src/tools/compat [netbsd-6]: Makefile
Removed Files:
src/usr.bin/lex [netbsd-6]: COPYING FlexLexer.h Makefile NEWS VERSION
ccl.c config.h dfa.c ecs.c flex.1 flex.skl flexdef.h gen.c
initscan.c libmain.c libyywrap.c main.c misc.c mkskel.sh nfa.c
parse.y scan.l sym.c tblcmp.c version.h yylex.c

Log Message:
Pull up following revision(s) (requested by tron in ticket #19):
usr.bin/lex/version.h: file removal
usr.bin/lex/main.c: file removal
usr.bin/lex/libmain.c: file removal
usr.bin/lex/COPYING: file removal
usr.bin/lex/misc.c: file removal
usr.bin/lex/Makefile: file removal
usr.bin/lex/dfa.c: file removal
tools/compat/Makefile: revision 1.56
external/bsd/flex/dist/libmain.c: revision 1.2
usr.bin/lex/flexdef.h: file removal
usr.bin/lex/flex.1: file removal
usr.bin/lex/ecs.c: file removal
usr.bin/lex/FlexLexer.h: file removal
usr.bin/lex/libyywrap.c: file removal
usr.bin/lex/config.h: file removal
usr.bin/lex/ccl.c: file removal
usr.bin/lex/NEWS: file removal
usr.bin/lex/flex.skl: file removal
usr.bin/lex/scan.l: file removal
usr.bin/lex/gen.c: file removal
usr.bin/lex/yylex.c: file removal
usr.bin/lex/VERSION: file removal
usr.bin/lex/initscan.c: file removal
usr.bin/lex/sym.c: file removal
usr.bin/lex/tblcmp.c: file removal
usr.bin/lex/nfa.c: file removal
usr.bin/lex/mkskel.sh: file removal
external/bsd/flex/dist/libyywrap.c: revision 1.2
usr.bin/lex/parse.y: file removal
this has not been used for ages.
Adjust libyywrap.c location.
fix prototypes


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.1.1.1.8.1 src/external/bsd/flex/dist/libmain.c \
src/external/bsd/flex/dist/libyywrap.c
cvs rdiff -u -r1.55 -r1.55.2.1 src/tools/compat/Makefile
cvs rdiff -u -r1.3 -r0 src/usr.bin/lex/COPYING src/usr.bin/lex/mkskel.sh
cvs rdiff -u -r1.9 -r0 src/usr.bin/lex/FlexLexer.h src/usr.bin/lex/ecs.c \
src/usr.bin/lex/tblcmp.c src/usr.bin/lex/version.h \
src/usr.bin/lex/yylex.c
cvs rdiff -u -r1.29 -r0 src/usr.bin/lex/Makefile
cvs rdiff -u -r1.4 -r0 src/usr.bin/lex/NEWS src/usr.bin/lex/config.h
cvs rdiff -u -r1.8 -r0 src/usr.bin/lex/VERSION src/usr.bin/lex/ccl.c
cvs rdiff -u -r1.12 -r0 src/usr.bin/lex/dfa.c
cvs rdiff -u -r1.16 -r0 src/usr.bin/lex/flex.1
cvs rdiff -u -r1.25 -r0 src/usr.bin/lex/flex.skl
cvs rdiff -u -r1.15 -r0 src/usr.bin/lex/flexdef.h
cvs rdiff -u -r1.18 -r0 src/usr.bin/lex/gen.c src/usr.bin/lex/initscan.c
cvs rdiff -u -r1.6 -r0 src/usr.bin/lex/libmain.c
cvs rdiff -u -r1.7 -r0 src/usr.bin/lex/libyywrap.c
cvs rdiff -u -r1.17 -r0 src/usr.bin/lex/main.c
cvs rdiff -u -r1.13 -r0 src/usr.bin/lex/misc.c src/usr.bin/lex/scan.l
cvs rdiff -u -r1.11 -r0 src/usr.bin/lex/nfa.c src/usr.bin/lex/parse.y \
src/usr.bin/lex/sym.c

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

Modified files:

Index: src/external/bsd/flex/dist/libmain.c
diff -u src/external/bsd/flex/dist/libmain.c:1.1.1.1 src/external/bsd/flex/dist/libmain.c:1.1.1.1.8.1
--- src/external/bsd/flex/dist/libmain.c:1.1.1.1	Mon Oct 26 00:26:24 2009
+++ src/external/bsd/flex/dist/libmain.c	Thu Feb 23 02:11:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: libmain.c,v 1.1.1.1 2009/10/26 00:26:24 christos Exp $	*/
+/*	$NetBSD: libmain.c,v 1.1.1.1.8.1 2012/02/23 02:11:51 riz Exp $	*/
 
 /* libmain - flex run-time support library "main" function */
 
@@ -23,13 +23,13 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 
-extern int yylex ();
+extern int yylex(void);
 
-int main (argc, argv)
- int argc;
- char   *argv[];
+int
+/*ARGSUSED*/
+main(int argc, char *argv[])
 {
-	while (yylex () != 0) ;
-
+	while (yylex() != 0)
+		continue;
 	return 0;
 }
Index: src/external/bsd/flex/dist/libyywrap.c
diff -u src/external/bsd/flex/dist/libyywrap.c:1.1.1.1 src/external/bsd/flex/dist/libyywrap.c:1.1.1.1.8.1
--- src/external/bsd/flex/dist/libyywrap.c:1.1.1.1	Mon Oct 26 00:26:24 2009
+++ src/external/bsd/flex/dist/libyywrap.c	Thu Feb 23 02:11:51 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: libyywrap.c,v 1.1.1.1 2009/10/26 00:26:24 christos Exp $	*/
+/*	$NetBSD: libyywrap.c,v 1.1.1.1.8.1 2012/02/23 02:11:51 riz Exp $	*/
 
 /* libyywrap - flex run-time support library "yywrap" function */
 
@@ -23,7 +23,9 @@
 /*  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR */
 /*  PURPOSE. */
 
-int yywrap (void)
+int yywrap(void);
+int
+yywrap(void)
 {
 	return 1;
 }

Index: src/tools/compat/Makefile
diff -u src/tools/compat/Makefile:1.55 src/tools/compat/Makefile:1.55.2.1
--- src/tools/compat/Makefile:1.55	Thu Nov  3 1

CVS commit: [netbsd-6] src/doc

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Thu Feb 23 02:09:00 UTC 2012

Modified Files:
src/doc [netbsd-6]: 3RDPARTY

Log Message:
Pull up following revision(s) (requested by tron in ticket #18):
doc/3RDPARTY: revision 1.912
doc/3RDPARTY: revision 1.913
remove stale entries: libcdk was removed 5 years ago, termcap.src between
netbsd-5 and netbsd-6
add "Location" tags which tell where the source lives in the NetBSD
tree, and fix some paths in "Notes" sections


To generate a diff of this commit:
cvs rdiff -u -r1.909.2.2 -r1.909.2.3 src/doc/3RDPARTY

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

Modified files:

Index: src/doc/3RDPARTY
diff -u src/doc/3RDPARTY:1.909.2.2 src/doc/3RDPARTY:1.909.2.3
--- src/doc/3RDPARTY:1.909.2.2	Mon Feb 20 21:41:28 2012
+++ src/doc/3RDPARTY	Thu Feb 23 02:08:59 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.909.2.2 2012/02/20 21:41:28 sborrill Exp $
+#	$NetBSD: 3RDPARTY,v 1.909.2.3 2012/02/23 02:08:59 riz Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -32,7 +32,8 @@ Archive Site:	http://www.acpica.org/down
 Home Page:	http://www.acpica.org/
 Mailing List:	de...@acpica.org
 License:	BSD-like
-Responsible:	jmcneill, jruoho
+Responsible:	jruoho
+Location:	sys/external/bsd/acpica/dist
 Notes:
 The sources were integrated into src/sys/dev/acpi/acpica/Subsystem.
 Please read src/sys/dev/acpi/acpica/README before any modification.
@@ -46,10 +47,11 @@ Home Page:	http://www.am-utils.org/
 Mailing List:	am-utils
 Responsible:	christos
 License:	BSD (4-clause)
+Location:	external/bsd/am-utils/dist
 Notes:
 Amd2netbsd script to convert to BSD make system and remove unneeded files.
 Fix symbolic links before import.
-Check src/usr.sbin/amd/include/config.h is correct after import.
+Check external/bsd/am-utils/include/config.h is correct after import.
 
 Package:	Automated Testing Framework (ATF)
 Version:	0.15
@@ -60,6 +62,7 @@ Home page:	http://www.NetBSD.org/~jmmv/a
 Mailing List:	atf-de...@netbsd.org
 Responsible:	jmmv
 License:	The NetBSD Foundation's license (BSD 2-clause)
+Location:	external/bsd/atf/dist
 Notes:
 The source files are in external/bsd/atf/dist.
 Use external/bsd/atf/prepare-import.sh to regenerate the dist/ directory.
@@ -76,8 +79,8 @@ Home Page:	none
 Mailing List:	none
 Responsible:	sam, alc
 License:	BSD-like (2 clause), ISC
+Location:	sys/external/isc/atheros_hal/dist
 Notes:
-The HAL is located in src/sys/external/isc/atheros_hal
 
 Package:	bc
 Version:	1.06
@@ -88,6 +91,7 @@ Home Page:	http://www.gnu.org/software/b
 Mailing List:	bug...@gnu.org
 Responsible:	phil, simonb
 License:	GPLv2, LGPGv2.1
+Location:	gnu/dist/bc
 Notes:
 bc includes dc, both of which are in the NetBSD tree.
 
@@ -100,6 +104,7 @@ Home Page:	http://www.isc.org/sw/bind/
 Mailing List:
 Responsible:	vixie, christos
 License:	BSD-like (2-clause)
+Location:	external/bsd/bind/dist
 Notes:
 First bind2netbsd script to import into src/external/bsd/bind/dist.
 The Makefiles in src/external/bsd/bind are not handled by the script.
@@ -116,6 +121,7 @@ Home Page:	http://www.isc.org/sw/bind/
 Mailing List:
 Responsible:	vixie, christos
 License:	BSD-like (2-clause)
+Location:	external/bsd/libbind/dist
 Notes:
 First libbind2netbsd script to import into src/external/bsd/libbind/dist.
 Then include4netbsd script to import into src/include.
@@ -140,6 +146,7 @@ Home Page:	http://www.gnu.org/software/b
 Mailing List:	bug-gnu-ut...@gnu.org
 Responsible:	thorpej, mrg
 License:	GPLv3, LGPLv3, GPLv2, LGPLv2, BSD
+Location:	external/gpl3/binutils/dist
 Notes:
 
 Package:	bozohttpd
@@ -151,9 +158,9 @@ Home Page:	http://eterna.com.au/bozohttp
 Mailing List:
 Responsible:	mrg
 License:	BSD
+Location:	libexec/httpd
 Notes:
-1. Delete "queue.h" from the distribution.
-2. Integrated as src/libexec/httpd.
+Delete "queue.h" from the distribution.
 
 Package:	bsd-family-tree
 Version:	1.116
@@ -164,6 +171,7 @@ Home Page:	http://cvsweb.freebsd.org/src
 Mailing List:
 Responsible:
 License:	See URL above.
+Location:	share/misc/bsd-family-tree
 Notes:
 
 Package:	byacc
@@ -175,6 +183,7 @@ Home Page:	http://www.invisible-island.n
 Mailing List:
 Responsible:	christos
 License:	Public Domain
+Location:	external/bsd/byacc/dist
 Notes:
 See /usr/src/external/bsd/byacc/byacc2netbsd for update instructions.
 
@@ -187,6 +196,7 @@ Home Page:	http://www.bzip.org/
 Mailing List:
 Responsible:
 License:	BSD (4-clause)
+Location:	dist/bzip2
 Notes:
 See /usr/src/dist/bzip2/bzip2netbsd for update instructions.
 
@@ -200,6 +210,7 @@ Mailing List:	bsd-loc...@haun.org
 Responsible:	tshiozak
 License:	Ambiguous. Either BSD or Perl Artistic License
 		See http://citrus.bsdclub.org/#pol_license for more info.
+Location:	lib
 Notes:
 language C multilingualization support suite using wchar_t and other standards.
 The main development playground of Citrus 

CVS commit: src/distrib

2012-02-22 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Thu Feb 23 00:22:08 UTC 2012

Modified Files:
src/distrib/evbmips/instkernel/ramdisk: Makefile
src/distrib/evbppc/ramdisk: Makefile
src/distrib/ibmnws/netboot/ramdisk: Makefile

Log Message:
Fix build failure.  Remove unknown device ttyv0.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/distrib/evbmips/instkernel/ramdisk/Makefile
cvs rdiff -u -r1.11 -r1.12 src/distrib/evbppc/ramdisk/Makefile
cvs rdiff -u -r1.9 -r1.10 src/distrib/ibmnws/netboot/ramdisk/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/evbmips/instkernel/ramdisk/Makefile
diff -u src/distrib/evbmips/instkernel/ramdisk/Makefile:1.10 src/distrib/evbmips/instkernel/ramdisk/Makefile:1.11
--- src/distrib/evbmips/instkernel/ramdisk/Makefile:1.10	Thu Feb 11 09:06:48 2010
+++ src/distrib/evbmips/instkernel/ramdisk/Makefile	Thu Feb 23 00:22:08 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.10 2010/02/11 09:06:48 roy Exp $
+#	$NetBSD: Makefile,v 1.11 2012/02/23 00:22:08 kiyohara Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -25,7 +25,7 @@ IMAGEDEPENDS=	${CRUNCHBIN} \
 		${NETBSDSRCDIR}/etc/netconfig ${DISTRIBDIR}/common/protocols \
 		${DISTRIBDIR}/common/services
 
-MAKEDEVTARGETS= std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 pty0 ttyv0
+MAKEDEVTARGETS= std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 pty0
 
 # Use stubs to eliminate some large stuff from libc
 HACKSRC=	${DISTRIBDIR}/utils/libhack

Index: src/distrib/evbppc/ramdisk/Makefile
diff -u src/distrib/evbppc/ramdisk/Makefile:1.11 src/distrib/evbppc/ramdisk/Makefile:1.12
--- src/distrib/evbppc/ramdisk/Makefile:1.11	Wed Feb  1 21:57:13 2012
+++ src/distrib/evbppc/ramdisk/Makefile	Thu Feb 23 00:22:08 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.11 2012/02/01 21:57:13 matt Exp $
+#	$NetBSD: Makefile,v 1.12 2012/02/23 00:22:08 kiyohara Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -20,7 +20,7 @@ IMAGEDEPENDS=	${CRUNCHBIN} \
 		${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \
 		${NETBSDSRCDIR}/etc/netconfig ${DISTRIBDIR}/common/protocols \
 		${DISTRIBDIR}/common/services
-MAKEDEVTARGETS=	std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 pty0 ttyv0
+MAKEDEVTARGETS=	std md0 wd0 wd1 wd2 wd3 cd0 cd1 sd0 sd1 sd2 sd3 st0 pty0
 MAKEDEVTARGETS+= ld0 ld1
 
 # Use stubs to eliminate some large stuff from libc

Index: src/distrib/ibmnws/netboot/ramdisk/Makefile
diff -u src/distrib/ibmnws/netboot/ramdisk/Makefile:1.9 src/distrib/ibmnws/netboot/ramdisk/Makefile:1.10
--- src/distrib/ibmnws/netboot/ramdisk/Makefile:1.9	Thu Feb 11 09:06:49 2010
+++ src/distrib/ibmnws/netboot/ramdisk/Makefile	Thu Feb 23 00:22:07 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.9 2010/02/11 09:06:49 roy Exp $
+#	$NetBSD: Makefile,v 1.10 2012/02/23 00:22:07 kiyohara Exp $
 
 .include 
 .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib"
@@ -15,7 +15,7 @@ CRUNCHGEN_FLAGS= -d "${DBG}"
 LISTS=		${.CURDIR}/list
 MTREECONF=	${DISTRIBDIR}/common/mtree.common
 IMAGEENDIAN=	be
-MAKEDEVTARGETS=	std md0 pty0 ttyv0
+MAKEDEVTARGETS=	std md0 pty0
 IMAGEDEPENDS=	${CRUNCHBIN} \
 		dot.profile \
 		${NETBSDSRCDIR}/etc/group ${NETBSDSRCDIR}/etc/master.passwd \



CVS commit: src/lib/libterminfo

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 23:11:20 UTC 2012

Modified Files:
src/lib/libterminfo: term.h

Log Message:
PR/46075: Asau: fix typo set_color_paid -> set_color_pair


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/lib/libterminfo/term.h

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

Modified files:

Index: src/lib/libterminfo/term.h
diff -u src/lib/libterminfo/term.h:1.10 src/lib/libterminfo/term.h:1.11
--- src/lib/libterminfo/term.h:1.10	Tue Oct  4 07:01:14 2011
+++ src/lib/libterminfo/term.h	Wed Feb 22 18:11:20 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.10 2011/10/04 11:01:14 roy Exp $ */
+/* $NetBSD: term.h,v 1.11 2012/02/22 23:11:20 christos Exp $ */
 
 /*
  * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
@@ -1012,7 +1012,7 @@ enum TISTRS{
 #define t_set_bottom_margin_parm(t)	(t)->strs[TICODE_smgbp]
 #define t_set_clock(t)			(t)->strs[TICODE_sclk]
 #define t_set_color_band(t)		(t)->strs[TICODE_setcolor]
-#define t_set_color_paid(t)		(t)->strs[TICODE_scp]
+#define t_set_color_pair(t)		(t)->strs[TICODE_scp]
 #define t_set_foreground(t)		(t)->strs[TICODE_setf]
 #define t_set_left_margin(t)		(t)->strs[TICODE_smgl]
 #define t_set_left_margin_parm(t)	(t)->strs[TICODE_smglp]
@@ -1407,7 +1407,7 @@ enum TISTRS{
 #define set_bottom_margin_parm		 t_set_bottom_margin_parm(cur_term)
 #define set_clock			 t_set_clock(cur_term)
 #define set_color_band			 t_set_color_band(cur_term)
-#define set_color_paid			 t_set_color_paid(cur_term)
+#define set_color_pair			 t_set_color_pair(cur_term)
 #define set_foreground			 t_set_foreground(cur_term)
 #define set_left_margin			 t_set_left_margin(cur_term)
 #define set_left_margin_parm		 t_set_left_margin_parm(cur_term)



CVS commit: src/sys/arch/sandpoint/sandpoint

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 22:56:44 UTC 2012

Modified Files:
src/sys/arch/sandpoint/sandpoint: satmgr.c

Log Message:
- fix an error which prevents satmgr from sending NUL bytes.
- a bit cosmetic change for IOMEGA multibyte control sequence.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/sandpoint/sandpoint/satmgr.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/sandpoint/sandpoint/satmgr.c
diff -u src/sys/arch/sandpoint/sandpoint/satmgr.c:1.15 src/sys/arch/sandpoint/sandpoint/satmgr.c:1.16
--- src/sys/arch/sandpoint/sandpoint/satmgr.c:1.15	Mon Jan 23 16:22:58 2012
+++ src/sys/arch/sandpoint/sandpoint/satmgr.c	Wed Feb 22 22:56:44 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: satmgr.c,v 1.15 2012/01/23 16:22:58 phx Exp $ */
+/* $NetBSD: satmgr.c,v 1.16 2012/02/22 22:56:44 nisimura Exp $ */
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -678,11 +678,11 @@ txintr(struct satmgr_softc *sc)
 static void
 startoutput(struct satmgr_softc *sc)
 {
-	int n, ch;
+	int n;
 
 	n = min(sc->sc_wr_cnt, 16);
-	while ((ch = *sc->sc_wr_ptr) && n-- > 0) {
-		CSR_WRITE(sc, THR, ch);
+	while (n-- > 0) {
+		CSR_WRITE(sc, THR, *sc->sc_wr_ptr);
 		if (++sc->sc_wr_ptr == sc->sc_wr_lim)
 			sc->sc_wr_ptr = &sc->sc_wr_buf[0];
 		sc->sc_wr_cnt -= 1;
@@ -933,13 +933,13 @@ iprepcmd(struct satmgr_softc *sc, int po
 	 * Construct the command packet. Values of -1 (0xff) will be
 	 * replaced later by the current values from the last status.
 	 */
-	*p++ = pow;
-	*p++ = led;
-	*p++ = rat;
-	*p++ = fan;
-	*p++ = fhi;
-	*p++ = flo;
-	*p = 7; /* host id */
+	p[0] = pow;
+	p[1] = led;
+	p[2] = rat;
+	p[3] = fan;
+	p[4] = fhi;
+	p[5] = flo;
+	p[6] = 7; /* host id */
 
 	/* synchronize transmitter, before packet can be sent */
 	callout_reset(&sc->sc_ch_sync, hz / 5, idosync, sc);



CVS commit: src/doc

2012-02-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb 22 20:59:26 UTC 2012

Modified Files:
src/doc: RESPONSIBLE

Log Message:
Cleam responsibility for NiLFS and for usermode


To generate a diff of this commit:
cvs rdiff -u -r1.96 -r1.97 src/doc/RESPONSIBLE

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

Modified files:

Index: src/doc/RESPONSIBLE
diff -u src/doc/RESPONSIBLE:1.96 src/doc/RESPONSIBLE:1.97
--- src/doc/RESPONSIBLE:1.96	Fri Feb 17 12:16:17 2012
+++ src/doc/RESPONSIBLE	Wed Feb 22 20:59:26 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: RESPONSIBLE,v 1.96 2012/02/17 12:16:17 mbalmer Exp $
+#	$NetBSD: RESPONSIBLE,v 1.97 2012/02/22 20:59:26 reinoud Exp $
 
 List of sections of the system, and who is responsible for them (or at
 least considered an expert on them).
@@ -173,6 +173,7 @@ efs		rumble
 hfs		dillo
 lfs		dholland
 msdosfs		jdolecek
+nilfs		reinoud
 nfs		fvdl
 ntfs		jdolecek
 smbfs		jdolecek
@@ -263,6 +264,7 @@ sparc		pk
 sparc64		martin, petrov
 sun2		fredette
 sun3		nathanw, jeremy
+usermode	reinoud
 vax		ragge
 x68k		nsmrtks
 xen		cl, bouyer



CVS commit: src/share/man/man4

2012-02-22 Thread Reinoud Zandijk
Module Name:src
Committed By:   reinoud
Date:   Wed Feb 22 20:21:34 UTC 2012

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

Log Message:
Fix comment in config.4 about UDF support. It was still stating UDF as a
read-only fs wich it hasn't been for quite some time! It must have slipped
trough.


To generate a diff of this commit:
cvs rdiff -u -r1.411 -r1.412 src/share/man/man4/options.4

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

Modified files:

Index: src/share/man/man4/options.4
diff -u src/share/man/man4/options.4:1.411 src/share/man/man4/options.4:1.412
--- src/share/man/man4/options.4:1.411	Fri Jan 13 16:05:16 2012
+++ src/share/man/man4/options.4	Wed Feb 22 20:21:34 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: options.4,v 1.411 2012/01/13 16:05:16 cegger Exp $
+.\"	$NetBSD: options.4,v 1.412 2012/02/22 20:21:34 reinoud Exp $
 .\"
 .\" Copyright (c) 1996
 .\" 	Perry E. Metzger.  All rights reserved.
@@ -810,10 +810,11 @@ for details.
 .It Cd file-system UDF
 .Bq Em EXPERIMENTAL
 Includes code for the UDF file system commonly found on CD and DVD
-media but also more and more on USB sticks.
-Useful primarily if you have a CD or a DVD drive, be it a read-only
-or a rewritable device.
-Currently only supports read-access.
+media but also on USB sticks.
+Currently supports read and write access upto UDF 2.01 and somewhat limited
+write support for UDF 2.50.
+It is marked experimental since there is no
+.Xr fsck_udf 8 .
 See
 .Xr mount_udf 8
 for details.



CVS commit: [netbsd-6] src/doc

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 19:08:37 UTC 2012

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

Log Message:
Tickets 16,17,22,28,29,31,32


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.10 -r1.1.2.11 src/doc/CHANGES-6.0

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

Modified files:

Index: src/doc/CHANGES-6.0
diff -u src/doc/CHANGES-6.0:1.1.2.10 src/doc/CHANGES-6.0:1.1.2.11
--- src/doc/CHANGES-6.0:1.1.2.10	Mon Feb 20 22:05:01 2012
+++ src/doc/CHANGES-6.0	Wed Feb 22 19:08:36 2012
@@ -1,4 +1,4 @@
-# $NetBSD: CHANGES-6.0,v 1.1.2.10 2012/02/20 22:05:01 sborrill Exp $
+# $NetBSD: CHANGES-6.0,v 1.1.2.11 2012/02/22 19:08:36 riz Exp $
 
 A complete list of changes from the initial NetBSD 6.0 branch on 15 Feb 2012
 until the 6.0 release:
@@ -134,3 +134,57 @@ usr.sbin/makemandb/whatis.c			1.3
 	for "whatis man".
 	[joerg, ticket #15]
 
+sys/sys/cdefs.h	1.90
+
+	Fix __restricted expansion for C++ programs.
+	[martin, ticket #16]
+
+sys/kern/kern_exec.c1.342-344
+
+	Various posix_spawn fixes.
+	[martin, ticket #17]
+
+sys/arch/macppc/stand/ofwboot/boot.c		1.27
+sys/arch/macppc/stand/ofwboot/boot.h		1.4
+sys/arch/macppc/stand/ofwboot/ofdev.c		1.26
+
+	Fix boot failure on OF 2.0 machines.
+	[tsutsui, ticket #22]
+
+sys/arch/xen/include/hypervisor.h		1.38
+sys/arch/xen/xen/clock.c			1.62
+sys/arch/xen/xen/hypervisor.c			1.61
+
+	Fix Xen 3.0 support and other Xen hypervisor-version-specific
+	fixes.  PR#45961.
+	[bouyer, ticket #28]
+
+sys/arch/x86/include/cpu.h			1.48
+sys/arch/x86/include/pmap.h			1.50
+sys/arch/x86/x86/cpu.c1.97
+sys/arch/x86/x86/pmap.c1.165,167-168
+sys/arch/xen/include/hypervisor.h		1.37
+sys/arch/xen/include/intr.h			1.34
+sys/arch/xen/x86/cpu.c1.81-82
+sys/arch/xen/x86/x86_xpmap.c			1.39
+sys/arch/xen/x86/xen_ipi.c			1.10
+sys/arch/xen/x86/xen_pmap.c			1.17
+sys/uvm/uvm_km.c1.122
+sys/uvm/uvm_kmguard.c1.10
+sys/uvm/uvm_map.c1.315
+
+	Xen MP stability fixes, including a problem initially reported in
+	PR port-xen/45975
+	[bouyer, ticket #29]
+
+sys/arch/x86/x86/pmap.c1.166
+sys/arch/xen/x86/cpu.c1.83
+
+	Get rid of "mapping already present" log messages.
+	[bouyer, ticket #31]
+
+sys/arch/i386/i386/machdep.c			1.719
+
+	Fix FPU corruption occasionally reported on Xen/MP systems.
+	[bouyer, ticket #32]
+



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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 19:07:31 UTC 2012

Modified Files:
src/sys/arch/i386/i386 [netbsd-6]: machdep.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #32):
sys/arch/i386/i386/machdep.c: revision 1.719
i386_switch_context(): mimic code in cpu_switchto() and compare pcb->pcb_fpcpu
against ci to decide if we need to turn off FPU. Fix FPU corruption, e.g.
paranoia occasionally reporting flaws on Xen/MP systems.
XXX is ci_fpused still needed at all ?


To generate a diff of this commit:
cvs rdiff -u -r1.717 -r1.717.2.1 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.717 src/sys/arch/i386/i386/machdep.c:1.717.2.1
--- src/sys/arch/i386/i386/machdep.c:1.717	Thu Jan 12 19:49:37 2012
+++ src/sys/arch/i386/i386/machdep.c	Wed Feb 22 19:07:12 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.717 2012/01/12 19:49:37 cherry Exp $	*/
+/*	$NetBSD: machdep.c,v 1.717.2.1 2012/02/22 19:07:12 riz Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717 2012/01/12 19:49:37 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.717.2.1 2012/02/22 19:07:12 riz Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -544,9 +544,8 @@ i386_switch_context(lwp_t *l)
 
 	pcb = lwp_getpcb(l);
 	ci = curcpu();
-	if (ci->ci_fpused) {
+	if (pcb->pcb_fpcpu != ci) {
 		HYPERVISOR_fpu_taskswitch(1);
-		ci->ci_fpused = 0;
 	}
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);



CVS commit: src/share/man/man9

2012-02-22 Thread Nicolas Joly
Module Name:src
Committed By:   njoly
Date:   Wed Feb 22 19:04:39 UTC 2012

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

Log Message:
Adjust cpu_switch(9) -> cpu_switchto(9) in xrefs.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/pmc.9

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

Modified files:

Index: src/share/man/man9/pmc.9
diff -u src/share/man/man9/pmc.9:1.11 src/share/man/man9/pmc.9:1.12
--- src/share/man/man9/pmc.9:1.11	Fri May 14 18:52:46 2010
+++ src/share/man/man9/pmc.9	Wed Feb 22 19:04:38 2012
@@ -1,4 +1,4 @@
-.\" $NetBSD: pmc.9,v 1.11 2010/05/14 18:52:46 jruoho Exp $
+.\" $NetBSD: pmc.9,v 1.12 2012/02/22 19:04:38 njoly Exp $
 .\"
 .\" Copyright (c) 2002, 2005 Wasabi Systems, Inc.
 .\" All rights reserved.
@@ -172,12 +172,12 @@ For example, on an ia32 architecture, it
 .It Fn pmc_save_context "struct lwp *l"
 Saves the PMC context for the current process.
 This is called just before
-.Xr cpu_switch 9 .
+.Xr cpu_switchto 9 .
 If there is kernel PMC state, it must be maintained across this call.
 .It Fn pmc_restore_context "struct lwp *l"
 Restores the PMC context for the current process.
 This is called just after
-.Xr cpu_switch 9
+.Xr cpu_switchto 9
 returns.
 If there is kernel PMC state, it must be maintained across this call.
 .It Fn pmc_enable_counter "struct lwp *l" "int ctr"



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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:59:06 UTC 2012

Modified Files:
src/sys/arch/x86/x86 [netbsd-6]: pmap.c
src/sys/arch/xen/x86 [netbsd-6]: cpu.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #31):
sys/arch/x86/x86/pmap.c: revision 1.166
sys/arch/xen/x86/cpu.c: revision 1.83
- Make pmap_write_protect() work with pmap_kernel() too ((va & L2_FRAME)
  strips the high bits of a LP64 address)
- use pmap_protect() in pmap_pdp_ctor() to remap the PDP read-only instead
  of (ab)using pmap_kenter_pa(). No more "mapping already present" on
  console with DIAGNOSTIC kernels
- make sure to zero the whole PDP (NTOPLEVEL_PDES doens't include
  high-level entries on i386 and i386PAE, reserved by Xen). Not sure
  how it has worked before
- remove an always-true test (&& pmap != pmap_kernel(); we KASSERT that
  at the function entry).
use pmap_protect() instead of pmap_kenter_pa() to remap R/O an exiting
page. This gets rid of the last "mapping already present" warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.164.2.1 -r1.164.2.2 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.80.2.1 -r1.80.2.2 src/sys/arch/xen/x86/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/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.164.2.1 src/sys/arch/x86/x86/pmap.c:1.164.2.2
--- src/sys/arch/x86/x86/pmap.c:1.164.2.1	Wed Feb 22 18:56:47 2012
+++ src/sys/arch/x86/x86/pmap.c	Wed Feb 22 18:59:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.164.2.1 2012/02/22 18:56:47 riz Exp $	*/
+/*	$NetBSD: pmap.c,v 1.164.2.2 2012/02/22 18:59:05 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.1 2012/02/22 18:56:47 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pmap.c,v 1.164.2.2 2012/02/22 18:59:05 riz Exp $");
 
 #include "opt_user_ldt.h"
 #include "opt_lockdebug.h"
@@ -1979,7 +1979,7 @@ pmap_get_ptp(struct pmap *pmap, vaddr_t 
 		pmap_pte_set(&pva[index], (pd_entry_t)
 		(pmap_pa2pte(pa) | PG_u | PG_RW | PG_V));
 #if defined(XEN) && defined(__x86_64__)
-		if(i == PTP_LEVELS && pmap != pmap_kernel()) {
+		if(i == PTP_LEVELS) {
 			/*
 			 * Update the per-cpu PD on all cpus the current
 			 * pmap is active on 
@@ -2090,8 +2090,8 @@ pmap_pdp_ctor(void *arg, void *v, int fl
 	npde * sizeof(pd_entry_t));
 
 	/* zero the rest */
-	memset(&pdir[PDIR_SLOT_KERN + npde], 0,
-	(NTOPLEVEL_PDES - (PDIR_SLOT_KERN + npde)) * sizeof(pd_entry_t));
+	memset(&pdir[PDIR_SLOT_KERN + npde], 0, (PAGE_SIZE * PDP_SIZE) -
+	(PDIR_SLOT_KERN + npde) * sizeof(pd_entry_t));
 
 	if (VM_MIN_KERNEL_ADDRESS != KERNBASE) {
 		int idx = pl_i(KERNBASE, PTP_LEVELS);
@@ -2107,11 +2107,10 @@ pmap_pdp_ctor(void *arg, void *v, int fl
 #ifdef XEN
 	s = splvm();
 	object = (vaddr_t)v;
+	pmap_protect(pmap_kernel(), object, object + (PAGE_SIZE * PDP_SIZE),
+	VM_PROT_READ);
+	pmap_update(pmap_kernel());
 	for (i = 0; i < PDP_SIZE; i++, object += PAGE_SIZE) {
-		(void) pmap_extract(pmap_kernel(), object, &pdirpa);
-		/* FIXME: This should use pmap_protect() .. */
-		pmap_kenter_pa(object, pdirpa, VM_PROT_READ, 0);
-		pmap_update(pmap_kernel());
 		/*
 		 * pin as L2/L4 page, we have to do the page with the
 		 * PDIR_SLOT_PTE entries last
@@ -2121,6 +2120,7 @@ pmap_pdp_ctor(void *arg, void *v, int fl
 			continue;
 #endif
 
+		(void) pmap_extract(pmap_kernel(), object, &pdirpa);
 #ifdef __x86_64__
 		xpq_queue_pin_l4_table(xpmap_ptom_masked(pdirpa));
 #else
@@ -3779,7 +3779,7 @@ pmap_write_protect(struct pmap *pmap, va
 		pt_entry_t *spte, *epte;
 		int i;
 
-		blockend = (va & L2_FRAME) + NBPD_L2;
+		blockend = x86_round_pdr(va + 1);
 		if (blockend > eva)
 			blockend = eva;
 

Index: src/sys/arch/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.80.2.1 src/sys/arch/xen/x86/cpu.c:1.80.2.2
--- src/sys/arch/xen/x86/cpu.c:1.80.2.1	Wed Feb 22 18:56:45 2012
+++ src/sys/arch/xen/x86/cpu.c	Wed Feb 22 18:59:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.80.2.1 2012/02/22 18:56:45 riz Exp $	*/
+/*	$NetBSD: cpu.c,v 1.80.2.2 2012/02/22 18:59:05 riz Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.80.2.1 2012/02/22 18:56:45 riz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.80.2.2 2012/02/22 18:59:05 riz Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1324,9 +1324,9 @@ pmap_cpu_init_late(struct cpu_info *ci)
 #endif /* __x86_64__ else PAE */
 
 	/* Xen wants R/O */
-	pmap_kenter_pa((vaddr_t)ci->ci_kpm_pdir, ci->ci_kpm_pdirpa,
-	VM_PROT_READ, 0);
-
+	pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_kpm_pdir,
+	(vaddr_t)ci->ci_kpm_pdir + PAGE_SIZE, VM_PROT_READ);
+	pmap_update(pmap_kernel());
 #if defined(PAE)
 	/* Initialise L3 entry 3. This mapp

CVS commit: [netbsd-6] src/sys

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:56:49 UTC 2012

Modified Files:
src/sys/arch/x86/include [netbsd-6]: cpu.h pmap.h
src/sys/arch/x86/x86 [netbsd-6]: cpu.c pmap.c
src/sys/arch/xen/include [netbsd-6]: hypervisor.h intr.h
src/sys/arch/xen/x86 [netbsd-6]: cpu.c x86_xpmap.c xen_ipi.c xen_pmap.c
src/sys/uvm [netbsd-6]: uvm_km.c uvm_kmguard.c uvm_map.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #29):
sys/arch/xen/x86/x86_xpmap.c: revision 1.39
sys/arch/xen/include/hypervisor.h: revision 1.37
sys/arch/xen/include/intr.h: revision 1.34
sys/arch/xen/x86/xen_ipi.c: revision 1.10
sys/arch/x86/x86/cpu.c: revision 1.97
sys/arch/x86/include/cpu.h: revision 1.48
sys/uvm/uvm_map.c: revision 1.315
sys/arch/x86/x86/pmap.c: revision 1.165
sys/arch/xen/x86/cpu.c: revision 1.81
sys/arch/x86/x86/pmap.c: revision 1.167
sys/arch/xen/x86/cpu.c: revision 1.82
sys/arch/x86/x86/pmap.c: revision 1.168
sys/arch/xen/x86/xen_pmap.c: revision 1.17
sys/uvm/uvm_km.c: revision 1.122
sys/uvm/uvm_kmguard.c: revision 1.10
sys/arch/x86/include/pmap.h: revision 1.50
Apply patch proposed in PR port-xen/45975 (this does not solve the exact
problem reported here but is part of the solution):
xen_kpm_sync() is not working as expected,
leading to races between CPUs.
1 the check (xpq_cpu != &x86_curcpu) is always false because we
  have different x86_curcpu symbols with different addresses in the kernel.
  Fortunably, all addresses dissaemble to the same code.
  Because of this we always use the code intended for bootstrap, which doesn't
  use cross-calls or lock.
2 once 1 above is fixed, xen_kpm_sync() will use xcalls to sync other CPUs,
  which cause it to sleep and pmap.c doesn't like that. It triggers this
  KASSERT() in pmap_unmap_ptes():
  KASSERT(pmap->pm_ncsw == curlwp->l_ncsw);
3 pmap->pm_cpus is not safe for the purpose of xen_kpm_sync(), which
  needs to know on which CPU a pmap is loaded *now*:
  pmap->pm_cpus is cleared before cpu_load_pmap() is called to switch
  to a new pmap, leaving a window where a pmap is still in a CPU's
  ci_kpm_pdir but not in pm_cpus. As a virtual CPU may be preempted
  by the hypervisor at any time, it can be large enough to let another
  CPU free the PTP and reuse it as a normal page.
To fix 2), avoid cross-calls and IPIs completely, and instead
use a mutex to update all CPU's ci_kpm_pdir from the local CPU.
It's safe because we just need to update the table page, a tlbflush IPI will
happen later. As a side effect, we don't need a different code for bootstrap,
fixing 1). The mutex added to struct cpu needs a small headers reorganisation.
to fix 3), introduce a pm_xen_ptp_cpus which is updated from
cpu_pmap_load(), whith the ci_kpm_mtx mutex held. Checking it with
ci_kpm_mtx held will avoid overwriting the wrong pmap's ci_kpm_pdir.
While there I removed the unused pmap_is_active() function;
and added some more details to DIAGNOSTIC panics.
When using uvm_km_pgremove_intrsafe() make sure mappings are removed
before returning the pages to the free pool. Otherwise, under Xen,
a page which still has a writable mapping could be allocated for
a PDP by another CPU and the hypervisor would refuse it (this is
PR port-xen/45975).
For this, move the pmap_kremove() calls inside uvm_km_pgremove_intrsafe(),
and do pmap_kremove()/uvm_pagefree() in batch of (at most) 16 entries
(as suggested by Chuck Silvers on tech-kern@, see also
http://mail-index.netbsd.org/tech-kern/2012/02/17/msg012727.html and
followups).
Avoid early use of xen_kpm_sync(); locks are not available at this time.
Don't call cpu_init() twice.
Makes LOCKDEBUG kernels boot again
Revert pmap_pte_flush() -> xpq_flush_queue() in previous.


To generate a diff of this commit:
cvs rdiff -u -r1.47 -r1.47.2.1 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.49 -r1.49.2.1 src/sys/arch/x86/include/pmap.h
cvs rdiff -u -r1.96 -r1.96.8.1 src/sys/arch/x86/x86/cpu.c
cvs rdiff -u -r1.164 -r1.164.2.1 src/sys/arch/x86/x86/pmap.c
cvs rdiff -u -r1.36.2.1 -r1.36.2.2 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.33 -r1.33.8.1 src/sys/arch/xen/include/intr.h
cvs rdiff -u -r1.80 -r1.80.2.1 src/sys/arch/xen/x86/cpu.c
cvs rdiff -u -r1.38 -r1.38.2.1 src/sys/arch/xen/x86/x86_xpmap.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/arch/xen/x86/xen_ipi.c
cvs rdiff -u -r1.16 -r1.16.2.1 src/sys/arch/xen/x86/xen_pmap.c
cvs rdiff -u -r1.120 -r1.120.2.1 src/sys/uvm/uvm_km.c
cvs rdiff -u -r1.9 -r1.9.2.1 src/sys/uvm/uvm_kmguard.c
cvs rdiff -u -r1.313 -r1.313.2.1 src/sys/uvm/uvm_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/arch/x86/include/cpu.h
diff -u src/sys/arch/x86/include/cpu.h:1.47 src/sys/arch/x86/include/cpu.h:1.47.2.1
--- src/sys/arch/x86/include/cpu.h:1.4

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

2012-02-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 22 18:54:51 UTC 2012

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

Log Message:
Allocating a fixed, limited number of buffers for receive and sending them
to the network stack is a bad idea, because if all receive buffers sits
in socket queues, the interface receive stalls by lack of buffers.
Instead, get receive pages from a pool_cache(9). Copying to a mbuf cluser
would work too, but testings shows this has an important performance hit.
This also simplifies locking.

While there, notify the dom0 when we add some receive buffers (older
linux dom0 didn't care, but newer one do).

Problem reported and fix tested by Brian Marcotte on port-xen


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/xen/xen/if_xennet_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/if_xennet_xenbus.c
diff -u src/sys/arch/xen/xen/if_xennet_xenbus.c:1.58 src/sys/arch/xen/xen/if_xennet_xenbus.c:1.59
--- src/sys/arch/xen/xen/if_xennet_xenbus.c:1.58	Thu Feb  2 19:43:01 2012
+++ src/sys/arch/xen/xen/if_xennet_xenbus.c	Wed Feb 22 18:54:51 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $  */
+/*  $NetBSD: if_xennet_xenbus.c,v 1.59 2012/02/22 18:54:51 bouyer Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -85,7 +85,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.58 2012/02/02 19:43:01 tls Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_xennet_xenbus.c,v 1.59 2012/02/22 18:54:51 bouyer Exp $");
 
 #include "opt_xen.h"
 #include "opt_nfs_boot.h"
@@ -148,7 +148,6 @@ int xennet_debug = 0xff;
 #endif
 
 #define GRANT_INVALID_REF -1 /* entry is free */
-#define GRANT_STACK_REF   -2 /* entry owned by the network stack */
 
 #define NET_TX_RING_SIZE __CONST_RING_SIZE(netif_tx, PAGE_SIZE)
 #define NET_RX_RING_SIZE __CONST_RING_SIZE(netif_rx, PAGE_SIZE)
@@ -210,6 +209,9 @@ struct xennet_xenbus_softc {
 static multicall_entry_t rx_mcl[NET_RX_RING_SIZE+1];
 static u_long xennet_pages[NET_RX_RING_SIZE];
 
+static pool_cache_t if_xennetrxbuf_cache;
+static int if_xennetrxbuf_cache_inited=0;
+
 static int  xennet_xenbus_match(device_t, cfdata_t, void *);
 static void xennet_xenbus_attach(device_t, device_t, void *);
 static int  xennet_xenbus_detach(device_t, int);
@@ -219,6 +221,7 @@ static void xennet_alloc_rx_buffer(struc
 static void xennet_free_rx_buffer(struct xennet_xenbus_softc *);
 static void xennet_tx_complete(struct xennet_xenbus_softc *);
 static void xennet_rx_mbuf_free(struct mbuf *, void *, size_t, void *);
+static void xennet_rx_free_req(struct xennet_rxreq *);
 static int  xennet_handler(void *);
 static bool xennet_talk_to_backend(struct xennet_xenbus_softc *);
 #ifdef XENNET_DEBUG_DUMP
@@ -301,6 +304,14 @@ xennet_xenbus_attach(device_t parent, de
 	sc->sc_xbusd = xa->xa_xbusd;
 	sc->sc_xbusd->xbusd_otherend_changed = xennet_backend_changed;
 
+	/* xenbus ensure 2 devices can't be probed at the same time */
+	if (if_xennetrxbuf_cache_inited == 0) {
+		if_xennetrxbuf_cache = pool_cache_init(PAGE_SIZE, 0, 0, 0,
+		"xnfrx", NULL, IPL_VM, NULL, NULL, NULL);
+		if_xennetrxbuf_cache_inited = 1;
+	}
+		
+
 	/* initialize free RX and RX request lists */
 	mutex_init(&sc->sc_tx_lock, MUTEX_DEFAULT, IPL_NET);
 	SLIST_INIT(&sc->sc_txreq_head);
@@ -316,13 +327,10 @@ xennet_xenbus_attach(device_t parent, de
 		struct xennet_rxreq *rxreq = &sc->sc_rxreqs[i];
 		rxreq->rxreq_id = i;
 		rxreq->rxreq_sc = sc;
-		rxreq->rxreq_va = uvm_km_alloc(kernel_map,
-		PAGE_SIZE, PAGE_SIZE, UVM_KMF_WIRED | UVM_KMF_ZERO);
+		rxreq->rxreq_va = (vaddr_t)pool_cache_get_paddr(
+		if_xennetrxbuf_cache, PR_WAITOK, &rxreq->rxreq_pa);
 		if (rxreq->rxreq_va == 0)
 			break;
-		if (!pmap_extract(pmap_kernel(), rxreq->rxreq_va,
-		&rxreq->rxreq_pa))
-			panic("%s: no pa for mapped va ?", device_xname(self));
 		rxreq->rxreq_gntref = GRANT_INVALID_REF;
 		SLIST_INSERT_HEAD(&sc->sc_rxreq_head, rxreq, rxreq_next);
 	}
@@ -581,7 +589,9 @@ again:
 		xenbus_dev_fatal(sc->sc_xbusd, error, "completing transaction");
 		return false;
 	}
+	mutex_enter(&sc->sc_rx_lock);
 	xennet_alloc_rx_buffer(sc);
+	mutex_exit(&sc->sc_rx_lock);
 
 	if (sc->sc_backend_status == BEST_SUSPENDED) {
 		xenbus_device_resume(sc->sc_xbusd);
@@ -675,12 +685,12 @@ xennet_alloc_rx_buffer(struct xennet_xen
 	RING_IDX i;
 	struct xennet_rxreq *req;
 	struct xen_memory_reservation reservation;
-	int s, otherend_id;
+	int s, otherend_id, notify;
 	paddr_t pfn;
 
 	otherend_id = sc->sc_xbusd->xbusd_otherend_id;
 
-	mutex_enter(&sc->sc_rx_lock);
+	KASSERT(mutex_owned(&sc->sc_rx_lock));
 	for (i = 0; sc->sc_free_rxreql != 0; i++) {
 		req  = SLIST_FIRST(&sc->sc_rxreq_head);
 		KASSERT(req != NULL);
@@ -729,7 +739,6 @@ xennet_alloc_rx_buffer(struct xennet_xen
 
 out_loop:
 	if (i == 0) {
-		

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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:48:45 UTC 2012

Modified Files:
src/sys/arch/xen/include [netbsd-6]: hypervisor.h
src/sys/arch/xen/xen [netbsd-6]: clock.c hypervisor.c

Log Message:
Pull up following revision(s) (requested by bouyer in ticket #28):
sys/arch/xen/include/hypervisor.h: revision 1.38
sys/arch/xen/xen/hypervisor.c: revision 1.61
sys/arch/xen/xen/clock.c: revision 1.62
- make xen_version globally available, with macros to access major and
  minor xen version.
- In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
  and later
Should fix PR port-xen/45961
- make xen_version globally available, with macros to access major and
  minor xen version.
- In xen_initclocks(), do a VCPUOP_stop_periodic_timer only for Xen 3.1
  and later
Should fix PR port-xen/45961


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.36.2.1 src/sys/arch/xen/include/hypervisor.h
cvs rdiff -u -r1.61 -r1.61.2.1 src/sys/arch/xen/xen/clock.c
cvs rdiff -u -r1.60 -r1.60.2.1 src/sys/arch/xen/xen/hypervisor.c

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

Modified files:

Index: src/sys/arch/xen/include/hypervisor.h
diff -u src/sys/arch/xen/include/hypervisor.h:1.36 src/sys/arch/xen/include/hypervisor.h:1.36.2.1
--- src/sys/arch/xen/include/hypervisor.h:1.36	Wed Dec  7 15:47:42 2011
+++ src/sys/arch/xen/include/hypervisor.h	Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: hypervisor.h,v 1.36 2011/12/07 15:47:42 cegger Exp $	*/
+/*	$NetBSD: hypervisor.h,v 1.36.2.1 2012/02/22 18:48:45 riz Exp $	*/
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -133,6 +133,10 @@ struct cpu_info;
 void do_hypervisor_callback(struct intrframe *regs);
 void hypervisor_enable_event(unsigned int);
 
+extern int xen_version;
+#define XEN_MAJOR(x) (((x) & 0x) >> 16)
+#define XEN_MINOR(x) ((x) & 0x)
+
 /* hypervisor_machdep.c */
 void hypervisor_send_event(struct cpu_info *, unsigned int);
 void hypervisor_unmask_event(unsigned int);

Index: src/sys/arch/xen/xen/clock.c
diff -u src/sys/arch/xen/xen/clock.c:1.61 src/sys/arch/xen/xen/clock.c:1.61.2.1
--- src/sys/arch/xen/xen/clock.c:1.61	Sun Feb 12 14:38:18 2012
+++ src/sys/arch/xen/xen/clock.c	Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: clock.c,v 1.61 2012/02/12 14:38:18 jym Exp $	*/
+/*	$NetBSD: clock.c,v 1.61.2.1 2012/02/22 18:48:45 riz Exp $	*/
 
 /*
  *
@@ -29,7 +29,7 @@
 #include "opt_xen.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.61 2012/02/12 14:38:18 jym Exp $");
+__KERNEL_RCSID(0, "$NetBSD: clock.c,v 1.61.2.1 2012/02/22 18:48:45 riz Exp $");
 
 #include 
 #include 
@@ -458,10 +458,13 @@ xen_initclocks(void)
 	 * after a while. Use the one-shot timer every NS_PER_TICK
 	 * and rearm it from the event handler.
 	 */
-	err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
- ci->ci_cpuid,
+	if (XEN_MAJOR(xen_version) > 3 || XEN_MINOR(xen_version) > 0) {
+		/* exists only on Xen 3.1 and later */
+		err = HYPERVISOR_vcpu_op(VCPUOP_stop_periodic_timer,
+	 ci->ci_cpuid,
  NULL);
-	KASSERT(err == 0);
+		KASSERT(err == 0);
+	}
 
 	err = HYPERVISOR_set_timer_op(
 	vcpu_system_time[ci->ci_cpuid] + NS_PER_TICK);

Index: src/sys/arch/xen/xen/hypervisor.c
diff -u src/sys/arch/xen/xen/hypervisor.c:1.60 src/sys/arch/xen/xen/hypervisor.c:1.60.2.1
--- src/sys/arch/xen/xen/hypervisor.c:1.60	Fri Dec  9 11:47:49 2011
+++ src/sys/arch/xen/xen/hypervisor.c	Wed Feb 22 18:48:45 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $ */
+/* $NetBSD: hypervisor.c,v 1.60.2.1 2012/02/22 18:48:45 riz Exp $ */
 
 /*
  * Copyright (c) 2005 Manuel Bouyer.
@@ -53,7 +53,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.60 2011/12/09 11:47:49 cherry Exp $");
+__KERNEL_RCSID(0, "$NetBSD: hypervisor.c,v 1.60.2.1 2012/02/22 18:48:45 riz Exp $");
 
 #include 
 #include 
@@ -169,6 +169,8 @@ struct  x86_isa_chipset x86_isa_chipset;
 #endif
 #endif
 
+int xen_version;
+
 /* power management, for save/restore */
 static bool hypervisor_suspend(device_t, const pmf_qual_t *);
 static bool hypervisor_resume(device_t, const pmf_qual_t *);
@@ -201,7 +203,6 @@ hypervisor_vcpu_print(void *aux, const c
 void
 hypervisor_attach(device_t parent, device_t self, void *aux)
 {
-	int xen_version;
 
 #if NPCI >0
 #ifdef PCI_BUS_FIXUP
@@ -213,8 +214,8 @@ hypervisor_attach(device_t parent, devic
 	xenkernfs_init();
 
 	xen_version = HYPERVISOR_xen_version(XENVER_version, NULL);
-	aprint_normal(": Xen version %d.%d\n", (xen_version & 0x) >> 16,
-	   xen_version & 0x);
+	aprint_normal(": Xen version %d.%d\n", XEN_MAJOR(xen_version),
+	   XEN_MINOR(xen_version));
 
 	xengnt_init();
 	events_init();



CVS commit: [netbsd-6] src/sys/arch/macppc/stand/ofwboot

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:45:27 UTC 2012

Modified Files:
src/sys/arch/macppc/stand/ofwboot [netbsd-6]: boot.c boot.h ofdev.c

Log Message:
Pull up following revision(s) (requested by tsutsui in ticket #22):
sys/arch/macppc/stand/ofwboot/boot.c: revision 1.27
sys/arch/macppc/stand/ofwboot/boot.h: revision 1.4
sys/arch/macppc/stand/ofwboot/ofdev.c: revision 1.26
Fix boot failure on OF 2.0 machines.
Discussed with phx@ on port-macppc@:
http://mail-index.NetBSD.org/port-macppc/2012/02/18/msg001556.html
Should be pulled up to netbsd-6.


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.26.10.1 src/sys/arch/macppc/stand/ofwboot/boot.c
cvs rdiff -u -r1.3 -r1.3.20.1 src/sys/arch/macppc/stand/ofwboot/boot.h
cvs rdiff -u -r1.25 -r1.25.2.1 src/sys/arch/macppc/stand/ofwboot/ofdev.c

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

Modified files:

Index: src/sys/arch/macppc/stand/ofwboot/boot.c
diff -u src/sys/arch/macppc/stand/ofwboot/boot.c:1.26 src/sys/arch/macppc/stand/ofwboot/boot.c:1.26.10.1
--- src/sys/arch/macppc/stand/ofwboot/boot.c:1.26	Sat Jan 22 19:19:19 2011
+++ src/sys/arch/macppc/stand/ofwboot/boot.c	Wed Feb 22 18:45:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.26 2011/01/22 19:19:19 joerg Exp $	*/
+/*	$NetBSD: boot.c,v 1.26.10.1 2012/02/22 18:45:26 riz Exp $	*/
 
 /*-
  * Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -96,8 +96,8 @@ char bootdev[MAXBOOTPATHLEN];
 char bootfile[MAXBOOTPATHLEN];
 int boothowto;
 bool floppyboot;
+int ofw_version = 0;
 
-static int ofw_version = 0;
 static const char *kernels[] = { "/netbsd", "/netbsd.gz", "/netbsd.macppc", NULL };
 
 static void

Index: src/sys/arch/macppc/stand/ofwboot/boot.h
diff -u src/sys/arch/macppc/stand/ofwboot/boot.h:1.3 src/sys/arch/macppc/stand/ofwboot/boot.h:1.3.20.1
--- src/sys/arch/macppc/stand/ofwboot/boot.h:1.3	Wed Jan 28 15:03:28 2009
+++ src/sys/arch/macppc/stand/ofwboot/boot.h	Wed Feb 22 18:45:26 2012
@@ -10,6 +10,7 @@ void main(void);
 #define MAXBOOTPATHLEN	256
 extern char bootdev[MAXBOOTPATHLEN];
 extern bool floppyboot;
+extern int ofw_version;
 
 #ifdef HAVE_CHANGEDISK_HOOK
 struct open_file;

Index: src/sys/arch/macppc/stand/ofwboot/ofdev.c
diff -u src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25 src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25.2.1
--- src/sys/arch/macppc/stand/ofwboot/ofdev.c:1.25	Wed Feb  1 21:48:22 2012
+++ src/sys/arch/macppc/stand/ofwboot/ofdev.c	Wed Feb 22 18:45:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ofdev.c,v 1.25 2012/02/01 21:48:22 matt Exp $	*/
+/*	$NetBSD: ofdev.c,v 1.25.2.1 2012/02/22 18:45:26 riz Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
@@ -425,7 +425,8 @@ devopen(struct open_file *of, const char
 		return ENXIO;
 	if (!strcmp(buf, "block") && strrchr(devname, ':') == NULL)
 		/* indicate raw partition, when missing */
-		strlcat(devname, ":0", sizeof(devname));
+		if (ofw_version >= 3)
+			strlcat(devname, ":0", sizeof(devname));
 	if ((handle = OF_open(devname)) == -1)
 		return ENXIO;
 	memset(&ofdev, 0, sizeof ofdev);



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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:43:35 UTC 2012

Modified Files:
src/sys/kern [netbsd-6]: kern_exec.c

Log Message:
Pull up following revision(s) (requested by martin in ticket #17):
sys/kern/kern_exec.c: revision 1.342
sys/kern/kern_exec.c: revision 1.343
sys/kern/kern_exec.c: revision 1.344
Posix spawn fixes:
- split the file actions allocation and freeing into separate functions
- use pnbuf
- don't play games with pointers (partially freeing stuff etc), only check
  fa and sa and free as needed using the same code.
- use copyinstr properly
- KM_SLEEP allocation can't fail
- if path allocation failed midway, we would be possibily freeing
  userland strings.
- use sizeof(*var) instead sizeof(type)
fix fae free'ing, from enami.
keep track of the original array length so we can pass it to kmem_free, from
enami


To generate a diff of this commit:
cvs rdiff -u -r1.339.2.1 -r1.339.2.2 src/sys/kern/kern_exec.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/kern_exec.c
diff -u src/sys/kern/kern_exec.c:1.339.2.1 src/sys/kern/kern_exec.c:1.339.2.2
--- src/sys/kern/kern_exec.c:1.339.2.1	Mon Feb 20 21:54:56 2012
+++ src/sys/kern/kern_exec.c	Wed Feb 22 18:43:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_exec.c,v 1.339.2.1 2012/02/20 21:54:56 sborrill Exp $	*/
+/*	$NetBSD: kern_exec.c,v 1.339.2.2 2012/02/22 18:43:35 riz Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -59,7 +59,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.339.2.1 2012/02/20 21:54:56 sborrill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_exec.c,v 1.339.2.2 2012/02/22 18:43:35 riz Exp $");
 
 #include "opt_exec.h"
 #include "opt_ktrace.h"
@@ -1955,6 +1955,70 @@ spawn_return(void *arg)
 	exit1(l, W_EXITCODE(error, SIGABRT));
 }
 
+static void
+posix_spawn_fa_free(struct posix_spawn_file_actions *fa, size_t len)
+{
+
+	for (size_t i = 0; i < len; i++) {
+		struct posix_spawn_file_actions_entry *fae = &fa->fae[i];
+		if (fae->fae_action != FAE_OPEN)
+			continue;
+		kmem_free(fae->fae_path, strlen(fae->fae_path) + 1);
+	}
+	if (fa->len)
+		kmem_free(fa->fae, sizeof(*fa->fae) * fa->len);
+	kmem_free(fa, sizeof(*fa));
+}
+
+static int
+posix_spawn_fa_alloc(struct posix_spawn_file_actions **fap,
+const struct posix_spawn_file_actions *ufa)
+{
+	struct posix_spawn_file_actions *fa;
+	struct posix_spawn_file_actions_entry *fae;
+	char *pbuf = NULL;
+	int error;
+	size_t i = 0;
+
+	fa = kmem_alloc(sizeof(*fa), KM_SLEEP);
+	error = copyin(ufa, fa, sizeof(*fa));
+	if (error) {
+		fa->fae = NULL;
+		fa->len = 0;
+		goto out;
+	}
+
+	if (fa->len == 0)
+		return 0;
+
+	size_t fal = fa->len * sizeof(*fae);
+	fae = fa->fae;
+	fa->fae = kmem_alloc(fal, KM_SLEEP);
+	error = copyin(fae, fa->fae, fal);
+	if (error)
+		goto out;
+
+	pbuf = PNBUF_GET();
+	for (; i < fa->len; i++) {
+		fae = &fa->fae[i];
+		if (fae->fae_action != FAE_OPEN)
+			continue;
+		error = copyinstr(fae->fae_path, pbuf, MAXPATHLEN, &fal);
+		if (error)
+			goto out;
+		fae->fae_path = kmem_alloc(fal, KM_SLEEP);
+		memcpy(fae->fae_path, pbuf, fal);
+	}
+	PNBUF_PUT(pbuf);
+	*fap = fa;
+	return 0;
+out:
+	if (pbuf)
+		PNBUF_PUT(pbuf);
+	posix_spawn_fa_free(fa, i);
+	return error;
+}
+
 int
 sys_posix_spawn(struct lwp *l1, const struct sys_posix_spawn_args *uap,
 register_t *retval)
@@ -1971,10 +2035,9 @@ sys_posix_spawn(struct lwp *l1, const st
 	struct proc *p1, *p2;
 	struct plimit *p1_lim;
 	struct lwp *l2;
-	int error = 0, tnprocs, count, i;
+	int error = 0, tnprocs, count;
 	struct posix_spawn_file_actions *fa = NULL;
 	struct posix_spawnattr *sa = NULL;
-	struct posix_spawn_file_actions_entry *ufa;
 	struct spawn_exec_data *spawn_data;
 	uid_t uid;
 	vaddr_t uaddr;
@@ -2013,53 +2076,18 @@ sys_posix_spawn(struct lwp *l1, const st
 
 	/* copy in file_actions struct */
 	if (SCARG(uap, file_actions) != NULL) {
-		fa = kmem_alloc(sizeof(struct posix_spawn_file_actions),
-		KM_SLEEP);
-		error = copyin(SCARG(uap, file_actions), fa,
-		sizeof(struct posix_spawn_file_actions));
-		if (error) {
-			fa->fae = NULL;
+		error = posix_spawn_fa_alloc(&fa, SCARG(uap, file_actions));
+		if (error)
 			goto error_exit;
-		}
-		if (fa->len) {
-			ufa = fa->fae;
-			fa->fae = kmem_alloc(fa->len * 
-			sizeof(struct posix_spawn_file_actions_entry),
-			KM_SLEEP);
-			error = copyin(ufa, fa->fae,
-			fa->len *
-			sizeof(struct posix_spawn_file_actions_entry));
-			if (error)
-goto error_exit;
-			for (i = 0; i < fa->len; i++) {
-if (fa->fae[i].fae_action == FAE_OPEN) {
-	char buf[PATH_MAX];
-	error = copyinstr(fa->fae[i].fae_path,
-	buf, sizeof(buf), NULL);
-	if (error)
-		break;
-	fa->fae[i].fae_path = kmem_alloc(
-	strlen(buf)+1, KM_SLEEP);
-	if (fa->fae[i].fae_path == NULL) {
-		error = ENOMEM;
-		break;
-	}
-	str

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

2012-02-22 Thread Jeff Rizzo
Module Name:src
Committed By:   riz
Date:   Wed Feb 22 18:40:05 UTC 2012

Modified Files:
src/sys/sys [netbsd-6]: cdefs.h

Log Message:
Pull up following revision(s) (requested by martin in ticket #16):
sys/sys/cdefs.h: revision 1.90
PR 46040:
If the current compiler doesn't support C99, check if it is compatible
with GCC 2.92. In that case, use the protected __restricted__ form.
In any other case, default to removing __restricted.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.89.6.1 src/sys/sys/cdefs.h

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

Modified files:

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.89 src/sys/sys/cdefs.h:1.89.6.1
--- src/sys/sys/cdefs.h:1.89	Sat Nov  5 09:27:06 2011
+++ src/sys/sys/cdefs.h	Wed Feb 22 18:40:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.89 2011/11/05 09:27:06 joerg Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.89.6.1 2012/02/22 18:40:05 riz Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -338,7 +338,9 @@
 #define	__restrict	/* delete __restrict when not supported */
 #elif __STDC_VERSION__ >= 199901L
 #define	__restrict	restrict
-#elif !__GNUC_PREREQ__(2, 92)
+#elif __GNUC_PREREQ__(2, 92)
+#define	__restrict	__restrict__
+#else
 #define	__restrict	/* delete __restrict when not supported */
 #endif
 



CVS commit: src/sys/arch/i386/i386

2012-02-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 22 18:35:26 UTC 2012

Modified Files:
src/sys/arch/i386/i386: machdep.c

Log Message:
i386_switch_context(): mimic code in cpu_switchto() and compare pcb->pcb_fpcpu
against ci to decide if we need to turn off FPU. Fix FPU corruption, e.g.
paranoia occasionally reporting flaws on Xen/MP systems.

XXX is ci_fpused still needed at all ?


To generate a diff of this commit:
cvs rdiff -u -r1.718 -r1.719 src/sys/arch/i386/i386/machdep.c

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

Modified files:

Index: src/sys/arch/i386/i386/machdep.c
diff -u src/sys/arch/i386/i386/machdep.c:1.718 src/sys/arch/i386/i386/machdep.c:1.719
--- src/sys/arch/i386/i386/machdep.c:1.718	Sun Feb 19 21:06:08 2012
+++ src/sys/arch/i386/i386/machdep.c	Wed Feb 22 18:35:26 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.718 2012/02/19 21:06:08 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.719 2012/02/22 18:35:26 bouyer Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2000, 2004, 2006, 2008, 2009
@@ -67,7 +67,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.718 2012/02/19 21:06:08 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.719 2012/02/22 18:35:26 bouyer Exp $");
 
 #include "opt_beep.h"
 #include "opt_compat_ibcs2.h"
@@ -542,9 +542,8 @@ i386_switch_context(lwp_t *l)
 
 	pcb = lwp_getpcb(l);
 	ci = curcpu();
-	if (ci->ci_fpused) {
+	if (pcb->pcb_fpcpu != ci) {
 		HYPERVISOR_fpu_taskswitch(1);
-		ci->ci_fpused = 0;
 	}
 
 	HYPERVISOR_stack_switch(GSEL(GDATA_SEL, SEL_KPL), pcb->pcb_esp0);



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

2012-02-22 Thread Manuel Bouyer
Module Name:src
Committed By:   bouyer
Date:   Wed Feb 22 18:29:32 UTC 2012

Modified Files:
src/sys/arch/xen/x86: cpu.c

Log Message:
use pmap_protect() instead of pmap_kenter_pa() to remap R/O an exiting
page. This gets rid of the last "mapping already present" warnings.


To generate a diff of this commit:
cvs rdiff -u -r1.82 -r1.83 src/sys/arch/xen/x86/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/xen/x86/cpu.c
diff -u src/sys/arch/xen/x86/cpu.c:1.82 src/sys/arch/xen/x86/cpu.c:1.83
--- src/sys/arch/xen/x86/cpu.c:1.82	Tue Feb 21 19:10:13 2012
+++ src/sys/arch/xen/x86/cpu.c	Wed Feb 22 18:29:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.c,v 1.82 2012/02/21 19:10:13 bouyer Exp $	*/
+/*	$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $	*/
 /* NetBSD: cpu.c,v 1.18 2004/02/20 17:35:01 yamt Exp  */
 
 /*-
@@ -66,7 +66,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.82 2012/02/21 19:10:13 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu.c,v 1.83 2012/02/22 18:29:31 bouyer Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1324,9 +1324,9 @@ pmap_cpu_init_late(struct cpu_info *ci)
 #endif /* __x86_64__ else PAE */
 
 	/* Xen wants R/O */
-	pmap_kenter_pa((vaddr_t)ci->ci_kpm_pdir, ci->ci_kpm_pdirpa,
-	VM_PROT_READ, 0);
-
+	pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_kpm_pdir,
+	(vaddr_t)ci->ci_kpm_pdir + PAGE_SIZE, VM_PROT_READ);
+	pmap_update(pmap_kernel());
 #if defined(PAE)
 	/* Initialise L3 entry 3. This mapping is shared across all
 	 * pmaps and is static, ie; loading a new pmap will not update
@@ -1336,8 +1336,9 @@ pmap_cpu_init_late(struct cpu_info *ci)
 	ci->ci_pae_l3_pdir[3] = xpmap_ptom_masked(ci->ci_kpm_pdirpa) | PG_k | PG_V;
 
 	/* Mark L3 R/O (Xen wants this) */
-	pmap_kenter_pa((vaddr_t)ci->ci_pae_l3_pdir, ci->ci_pae_l3_pdirpa,
-		VM_PROT_READ, 0);
+	pmap_protect(pmap_kernel(), (vaddr_t)ci->ci_pae_l3_pdir,
+	(vaddr_t)ci->ci_pae_l3_pdir + PAGE_SIZE, VM_PROT_READ);
+	pmap_update(pmap_kernel());
 
 	xpq_queue_pin_l3_table(xpmap_ptom_masked(ci->ci_pae_l3_pdirpa));
 



CVS commit: src/external/bsd/file/dist/magic/magdir

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 18:25:12 UTC 2012

Modified Files:
src/external/bsd/file/dist/magic/magdir: elf

Log Message:
Look at the proper offsets for MD info, depending on the size of the binary
32 or 64.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.3 -r1.2 src/external/bsd/file/dist/magic/magdir/elf

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

Modified files:

Index: src/external/bsd/file/dist/magic/magdir/elf
diff -u src/external/bsd/file/dist/magic/magdir/elf:1.1.1.3 src/external/bsd/file/dist/magic/magdir/elf:1.2
--- src/external/bsd/file/dist/magic/magdir/elf:1.1.1.3	Wed Feb 22 12:48:32 2012
+++ src/external/bsd/file/dist/magic/magdir/elf	Wed Feb 22 13:25:12 2012
@@ -40,9 +40,10 @@
 >>18	leshort		2		SPARC - invalid byte order,
 >>18	leshort		3		Intel 80386,
 >>18	leshort		4		Motorola
->>>36	lelong		&0x0100	68000 - invalid byte order,
->>>36	lelong		&0x0081	CPU32 - invalid byte order,
->>>36	lelong		0		68020 - invalid byte order,
+>>>4	byte		1
+36	lelong		&0x0100	68000 - invalid byte order,
+36	lelong		&0x0081	CPU32 - invalid byte order,
+36	lelong		0		68020 - invalid byte order,
 >>18	leshort		5		Motorola 88000 - invalid byte order,
 >>18	leshort		6		Intel 80486,
 >>18	leshort		7		Intel 80860,
@@ -50,9 +51,11 @@
 # The second number (#10) will be deprecated later. For now, we still
 # say something if #10 is encountered, but only gory details for #8.
 >>18	leshort		8		MIPS,
->>>36	lelong		&0x20		N32
+>>>4	byte		1
+36	lelong		&0x20		N32
 >>18	leshort		10		MIPS,
->>>36	lelong		&0x20		N32
+>>>4	byte		1
+36	lelong		&0x20		N32
 >>18	leshort		8
 # only for 32-bit
 >>>4	byte		1
@@ -80,8 +83,14 @@
 >>18	leshort		10		MIPS (deprecated),
 >>18	leshort		11		RS6000 - invalid byte order,
 >>18	leshort		15		PA-RISC - invalid byte order,
->>>50	leshort		0x0214		2.0
->>>48	leshort		&0x0008		(LP64),
+# only for 32-bit
+>>>4	byte		1
+38	leshort		0x0214		2.0
+36	leshort		&0x0008		(LP64)
+# only for 64-bit
+>>>4	byte		2
+50	leshort		0x0214		2.0
+48	leshort		&0x0008		(LP64)
 >>18	leshort		16		nCUBE,
 >>18	leshort		17		Fujitsu VPP500,
 >>18	leshort		18		SPARC32PLUS - invalid byte order,
@@ -157,7 +166,6 @@
 >>18	leshort		0x9026		Alpha (unofficial),
 >>20	lelong		0		invalid version
 >>20	lelong		1		version 1
->>36	lelong		1		MathCoPro/FPU/MAU Required
 >5	byte		2		MSB
 >>16	beshort		0		no file type,
 !:mime	application/octet-stream
@@ -177,17 +185,20 @@
 >>18	beshort		2		SPARC,
 >>18	beshort		3		Intel 80386 - invalid byte order,
 >>18	beshort		4		Motorola
->>>36	belong		&0x0100	68000,
->>>36	belong		&0x0081	CPU32,
->>>36	belong		0		68020,
+>>>4	byte		1
+36	belong		&0x0100	68000,
+36	belong		&0x0081	CPU32,
+36	belong		0		68020,
 >>18	beshort		5		Motorola 88000,
 >>18	beshort		6		Intel 80486 - invalid byte order,
 >>18	beshort		7		Intel 80860,
 # only for MIPS - see comment in little-endian section above.
 >>18	beshort		8		MIPS,
->>>36	belong		&0x20		N32
+>>>4	byte		1
+36	belong		&0x20		N32
 >>18	beshort		10		MIPS,
->>>36	belong		&0x20		N32
+>>>4	byte		1
+36	belong		&0x20		N32
 >>18	beshort		8
 # only for 32-bit
 >>>4	byte		1
@@ -215,15 +226,23 @@
 >>18	beshort		10		MIPS (deprecated),
 >>18	beshort		11		RS6000,
 >>18	beshort		15		PA-RISC
->>>50	beshort		0x0214		2.0
->>>48	beshort		&0x0008		(LP64)
+# only for 32-bit
+>>>4	byte		1
+38	beshort		0x0214		2.0
+36	beshort		&0x0008		(LP64)
+# only for 64-bit
+>>>4	byte		2
+50	beshort		0x0214		2.0
+48	beshort		&0x0008		(LP64)
 >>18	beshort		16		nCUBE,
 >>18	beshort		17		Fujitsu VPP500,
 >>18	beshort		18		SPARC32PLUS,
->>>36	belong&0x00	0x000100	V8+ Required,
->>>36	belong&0x00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>36	belong&0x00	0x000400	HaL R1 Extensions Required,
->>>36	belong&0x00	0x000800	Sun UltraSPARC3 Extensions Required,
+# only for 32-bit
+>>>4	byte		1
+36	belong&0x00	0x000100	V8+ Required,
+36	belong&0x00	0x000200	Sun UltraSPARC1 Extensions Required,
+36	belong&0x00	0x000400	HaL R1 Extensions Required,
+36	belong&0x00	0x000800	Sun UltraSPARC3 Extensions Required,
 >>18	beshort		20		PowerPC or cisco 4500,
 >>18	beshort		21		64-bit PowerPC or cisco 7500,
 >>18	beshort		22		IBM S/390,
@@ -238,12 +257,13 @@
 >>18	beshort		41		Alpha,
 >>18	beshort		42		Renesas SH,
 >>18	beshort		43		SPARC V9,
->>>48	belong&0x00	0x000200	Sun UltraSPARC1 Extensions Required,
->>>48	belong&0x00	0x000400	HaL R1 Extensions Required,
->>>48	belong&0x00	0x000800	Sun UltraSPARC3 Extensions Required,
->>>48	belong&0x3	0		total store ordering,
->>>48	belong&0x3	1		partial store ordering,
->>>48	belong&0x3	2		relaxed memory ordering,
+>>>4	byte		2
+48	belong&0x00	0x000200	Sun UltraSPARC1 Extensions Required,
+48	belong&0x00	0x000400	HaL R1 Extensions Required,
+48	belong&0x00	0x

CVS commit: src/doc

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 17:57:36 UTC 2012

Modified Files:
src/doc: 3RDPARTY CHANGES

Log Message:
new file(1)


To generate a diff of this commit:
cvs rdiff -u -r1.915 -r1.916 src/doc/3RDPARTY
cvs rdiff -u -r1.1678 -r1.1679 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/3RDPARTY
diff -u src/doc/3RDPARTY:1.915 src/doc/3RDPARTY:1.916
--- src/doc/3RDPARTY:1.915	Tue Feb 21 13:37:57 2012
+++ src/doc/3RDPARTY	Wed Feb 22 12:57:36 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: 3RDPARTY,v 1.915 2012/02/21 18:37:57 wiz Exp $
+#	$NetBSD: 3RDPARTY,v 1.916 2012/02/22 17:57:36 christos Exp $
 #
 # This file contains a list of the software that has been integrated into
 # NetBSD where we are not the primary maintainer.
@@ -326,8 +326,8 @@ No hexadecimal floating-point string con
 Only double-precision addressed at this time.
 
 Package:	file
-Version:	5.09
-Current Vers:	5.09
+Version:	5.11
+Current Vers:	5.11
 Maintainer:	Christos Zoulas 
 Archive Site:	ftp://ftp.astron.com/pub/file/
 Home Page:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1678 src/doc/CHANGES:1.1679
--- src/doc/CHANGES:1.1678	Tue Feb 21 19:15:57 2012
+++ src/doc/CHANGES	Wed Feb 22 12:57:36 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1678 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1679 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -28,3 +28,4 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	window(1): Removed from the base system in favor of tmux(1).  Use the
 		pkgsrc/misc/window package from now on.  [jmmv 20120215]
 	pkg_add(1): imported 20120221 version from pkgsrc [wiz 20120221]
+	file(1): upgraded to 5.11 [christos 20120222]



CVS commit: src/external/bsd/file/dist

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 17:53:52 UTC 2012

Modified Files:
src/external/bsd/file/dist: configure configure.ac install-sh
src/external/bsd/file/dist/doc: file.1 libmagic.3 magic.5
src/external/bsd/file/dist/magic: Makefile.am Makefile.in
src/external/bsd/file/dist/magic/magdir: archive
src/external/bsd/file/dist/src: Makefile.in apprentice.c cdf.c
cdf_time.c compress.c file.h funcs.c print.c readcdf.c softmagic.c
Removed Files:
src/external/bsd/file/dist/src: names.h

Log Message:
merge conflicts


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/configure
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/configure.ac
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/install-sh
cvs rdiff -u -r1.8 -r1.9 src/external/bsd/file/dist/doc/file.1
cvs rdiff -u -r1.9 -r1.10 src/external/bsd/file/dist/doc/libmagic.3
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/doc/magic.5
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/magic/Makefile.am
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/magic/Makefile.in
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/magic/magdir/archive
cvs rdiff -u -r1.4 -r1.5 src/external/bsd/file/dist/src/Makefile.in \
src/external/bsd/file/dist/src/compress.c \
src/external/bsd/file/dist/src/softmagic.c
cvs rdiff -u -r1.5 -r1.6 src/external/bsd/file/dist/src/apprentice.c \
src/external/bsd/file/dist/src/cdf.c \
src/external/bsd/file/dist/src/file.h
cvs rdiff -u -r1.3 -r1.4 src/external/bsd/file/dist/src/cdf_time.c \
src/external/bsd/file/dist/src/funcs.c \
src/external/bsd/file/dist/src/print.c
cvs rdiff -u -r1.1.1.2 -r0 src/external/bsd/file/dist/src/names.h
cvs rdiff -u -r1.6 -r1.7 src/external/bsd/file/dist/src/readcdf.c

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

Modified files:

Index: src/external/bsd/file/dist/configure
diff -u src/external/bsd/file/dist/configure:1.6 src/external/bsd/file/dist/configure:1.7
--- src/external/bsd/file/dist/configure:1.6	Sun Sep 25 14:18:43 2011
+++ src/external/bsd/file/dist/configure	Wed Feb 22 12:53:48 2012
@@ -1,6 +1,6 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.64 for file 5.09.
+# Generated by GNU Autoconf 2.68 for file 5.11.
 #
 # Report bugs to .
 #
@@ -698,8 +698,8 @@ MAKEFLAGS=
 # Identity of this package.
 PACKAGE_NAME='file'
 PACKAGE_TARNAME='file'
-PACKAGE_VERSION='5.09'
-PACKAGE_STRING='file 5.09'
+PACKAGE_VERSION='5.11'
+PACKAGE_STRING='file 5.11'
 PACKAGE_BUGREPORT='chris...@astron.com'
 PACKAGE_URL=''
 
@@ -1431,7 +1431,7 @@ if test "$ac_init_help" = "long"; then
   # Omit some internal or obsolete options to make the list less imposing.
   # This message is too long to be a string in the A/UX 3.1 sh.
   cat <<_ACEOF
-\`configure' configures file 5.09 to adapt to many kinds of systems.
+\`configure' configures file 5.11 to adapt to many kinds of systems.
 
 Usage: $0 [OPTION]... [VAR=VALUE]...
 
@@ -1501,7 +1501,7 @@ fi
 
 if test -n "$ac_init_help"; then
   case $ac_init_help in
- short | recursive ) echo "Configuration of file 5.09:";;
+ short | recursive ) echo "Configuration of file 5.11:";;
esac
   cat <<\_ACEOF
 
@@ -1609,8 +1609,8 @@ fi
 test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
-file configure 5.09
-generated by GNU Autoconf 2.64
+file configure 5.11
+generated by GNU Autoconf 2.68
 
 Copyright (C) 2009 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
@@ -2308,8 +2308,8 @@ cat >config.log <<_ACEOF
 This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
-It was created by file $as_me 5.09, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+It was created by file $as_me 5.11, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   $ $0 $@
 
@@ -3116,7 +3116,7 @@ fi
 
 # Define the identity of the package.
  PACKAGE='file'
- VERSION='5.09'
+ VERSION='5.11'
 
 
 cat >>confdefs.h <<_ACEOF
@@ -13477,8 +13477,8 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_wri
 # report actual input values of CONFIG_FILES etc. instead of their
 # values after options handling.
 ac_log="
-This file was extended by file $as_me 5.09, which was
-generated by GNU Autoconf 2.64.  Invocation command line was
+This file was extended by file $as_me 5.11, which was
+generated by GNU Autoconf 2.68.  Invocation command line was
 
   CONFIG_FILES= $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -13541,9 +13541,9 @@ Report bugs to ."
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_version="\\
-file config.status 5.09
-configured by $0, generated by GNU Autoconf 2.64,
-  with options \\"`$as_echo "$ac_co

CVS commit: src/sys/sys

2012-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 17:52:58 UTC 2012

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

Log Message:
Backout previous - we do not need it anymore


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/sys/cdefs.h

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

Modified files:

Index: src/sys/sys/cdefs.h
diff -u src/sys/sys/cdefs.h:1.91 src/sys/sys/cdefs.h:1.92
--- src/sys/sys/cdefs.h:1.91	Tue Feb 21 10:53:08 2012
+++ src/sys/sys/cdefs.h	Wed Feb 22 17:52:58 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: cdefs.h,v 1.91 2012/02/21 10:53:08 martin Exp $	*/
+/*	$NetBSD: cdefs.h,v 1.92 2012/02/22 17:52:58 martin Exp $	*/
 
 /*
  * Copyright (c) 1991, 1993
@@ -266,13 +266,10 @@
 #define	__BEGIN_EXTERN_C	extern "C" {
 #define	__END_EXTERN_C		}
 #define	__static_cast(x,y)	static_cast(y)
-/* C++ does not allow a __restrict modifier everywhere C99 does */
-#define	__conly_restrict
 #else
 #define	__BEGIN_EXTERN_C
 #define	__END_EXTERN_C
 #define	__static_cast(x,y)	(x)y
-#define	__conly_restrict	__restrict
 #endif
 
 #if __GNUC_PREREQ__(4, 0)



CVS commit: src

2012-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 17:51:01 UTC 2012

Modified Files:
src/include: spawn.h
src/lib/libc/gen: posix_spawnp.c

Log Message:
Use C++ compatible declaration for posix_spawn (instead of the C99 specific
posix one).


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/include/spawn.h
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/gen/posix_spawnp.c

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

Modified files:

Index: src/include/spawn.h
diff -u src/include/spawn.h:1.3 src/include/spawn.h:1.4
--- src/include/spawn.h:1.3	Tue Feb 21 10:54:07 2012
+++ src/include/spawn.h	Wed Feb 22 17:51:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: spawn.h,v 1.3 2012/02/21 10:54:07 martin Exp $	*/
+/*	$NetBSD: spawn.h,v 1.4 2012/02/22 17:51:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2008 Ed Schouten 
@@ -40,10 +40,10 @@ __BEGIN_DECLS
  */
 int posix_spawn(pid_t * __restrict, const char * __restrict,
 const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
-char * const [__conly_restrict], char * const [__conly_restrict]);
+char * const *__restrict, char * const *__restrict);
 int posix_spawnp(pid_t * __restrict, const char * __restrict,
 const posix_spawn_file_actions_t *, const posix_spawnattr_t * __restrict,
-char * const [__conly_restrict], char * const [__conly_restrict]);
+char * const *__restrict, char * const *__restrict);
 
 /*
  * File descriptor actions

Index: src/lib/libc/gen/posix_spawnp.c
diff -u src/lib/libc/gen/posix_spawnp.c:1.1 src/lib/libc/gen/posix_spawnp.c:1.2
--- src/lib/libc/gen/posix_spawnp.c:1.1	Sat Feb 11 23:31:24 2012
+++ src/lib/libc/gen/posix_spawnp.c	Wed Feb 22 17:51:01 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: posix_spawnp.c,v 1.1 2012/02/11 23:31:24 martin Exp $	*/
+/*	$NetBSD: posix_spawnp.c,v 1.2 2012/02/22 17:51:01 martin Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include 
 #if defined(LIBC_SCCS) && !defined(lint)
-__RCSID("$NetBSD: posix_spawnp.c,v 1.1 2012/02/11 23:31:24 martin Exp $");
+__RCSID("$NetBSD: posix_spawnp.c,v 1.2 2012/02/22 17:51:01 martin Exp $");
 #endif /* LIBC_SCCS and not lint */
 
 #include 
@@ -45,7 +45,7 @@ __RCSID("$NetBSD: posix_spawnp.c,v 1.1 2
 int posix_spawnp(pid_t * __restrict pid, const char * __restrict file,
 const posix_spawn_file_actions_t *fa,
 const posix_spawnattr_t * __restrict sa,
-char * const cav[__restrict], char * const env[__restrict])
+char * const *__restrict cav, char * const *__restrict env)
 {
 	char fpath[FILENAME_MAX], *last, *p;
 	char *path;



CVS commit: src/external/bsd/file/dist

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 17:48:53 UTC 2012

Update of /cvsroot/src/external/bsd/file/dist
In directory ivanova.netbsd.org:/tmp/cvs-serv4443

Log Message:
from ftp.astron.com, CDF security fixes

Status:

Vendor Tag: CHRISTOS
Release Tags:   FILE5_11

U src/external/bsd/file/dist/acinclude.m4
U src/external/bsd/file/dist/README
C src/external/bsd/file/dist/configure.ac
U src/external/bsd/file/dist/aclocal.m4
U src/external/bsd/file/dist/Makefile.am
U src/external/bsd/file/dist/Makefile.in
U src/external/bsd/file/dist/config.h.in
C src/external/bsd/file/dist/configure
U src/external/bsd/file/dist/AUTHORS
U src/external/bsd/file/dist/COPYING
U src/external/bsd/file/dist/ChangeLog
U src/external/bsd/file/dist/INSTALL
U src/external/bsd/file/dist/NEWS
U src/external/bsd/file/dist/TODO
U src/external/bsd/file/dist/compile
U src/external/bsd/file/dist/config.guess
U src/external/bsd/file/dist/config.sub
U src/external/bsd/file/dist/depcomp
C src/external/bsd/file/dist/install-sh
U src/external/bsd/file/dist/ltmain.sh
U src/external/bsd/file/dist/missing
U src/external/bsd/file/dist/MAINT
U src/external/bsd/file/dist/m4/lt~obsolete.m4
U src/external/bsd/file/dist/m4/libtool.m4
U src/external/bsd/file/dist/m4/ltoptions.m4
U src/external/bsd/file/dist/m4/ltsugar.m4
U src/external/bsd/file/dist/m4/ltversion.m4
U src/external/bsd/file/dist/src/Makefile.am
U src/external/bsd/file/dist/src/magic.h
U src/external/bsd/file/dist/src/getopt_long.c
C src/external/bsd/file/dist/src/Makefile.in
U src/external/bsd/file/dist/src/asprintf.c
U src/external/bsd/file/dist/src/getline.c
U src/external/bsd/file/dist/src/mygetopt.h
U src/external/bsd/file/dist/src/strlcat.c
U src/external/bsd/file/dist/src/strlcpy.c
U src/external/bsd/file/dist/src/vasprintf.c
U src/external/bsd/file/dist/src/magic.c
C src/external/bsd/file/dist/src/apprentice.c
C src/external/bsd/file/dist/src/softmagic.c
U src/external/bsd/file/dist/src/ascmagic.c
U src/external/bsd/file/dist/src/encoding.c
C src/external/bsd/file/dist/src/compress.c
U src/external/bsd/file/dist/src/is_tar.c
U src/external/bsd/file/dist/src/readelf.c
C src/external/bsd/file/dist/src/print.c
U src/external/bsd/file/dist/src/fsmagic.c
C src/external/bsd/file/dist/src/funcs.c
C src/external/bsd/file/dist/src/file.h
U src/external/bsd/file/dist/src/readelf.h
U src/external/bsd/file/dist/src/tar.h
C src/external/bsd/file/dist/src/cdf.c
U src/external/bsd/file/dist/src/apptype.c
U src/external/bsd/file/dist/src/file_opts.h
U src/external/bsd/file/dist/src/elfclass.h
C src/external/bsd/file/dist/src/cdf_time.c
C src/external/bsd/file/dist/src/readcdf.c
U src/external/bsd/file/dist/src/cdf.h
U src/external/bsd/file/dist/src/file.c
C src/external/bsd/file/dist/magic/Makefile.am
C src/external/bsd/file/dist/magic/Makefile.in
U src/external/bsd/file/dist/magic/Header
U src/external/bsd/file/dist/magic/Localstuff
U src/external/bsd/file/dist/magic/magdir/adventure
U src/external/bsd/file/dist/magic/magdir/acorn
U src/external/bsd/file/dist/magic/magdir/adi
U src/external/bsd/file/dist/magic/magdir/animation
U src/external/bsd/file/dist/magic/magdir/allegro
U src/external/bsd/file/dist/magic/magdir/alliant
U src/external/bsd/file/dist/magic/magdir/amanda
U src/external/bsd/file/dist/magic/magdir/amigaos
U src/external/bsd/file/dist/magic/magdir/apple
U src/external/bsd/file/dist/magic/magdir/apl
N src/external/bsd/file/dist/magic/magdir/assembler
U src/external/bsd/file/dist/magic/magdir/applix
C src/external/bsd/file/dist/magic/magdir/archive
U src/external/bsd/file/dist/magic/magdir/communications
U src/external/bsd/file/dist/magic/magdir/asterix
U src/external/bsd/file/dist/magic/magdir/att3b
U src/external/bsd/file/dist/magic/magdir/audio
U src/external/bsd/file/dist/magic/magdir/basis
U src/external/bsd/file/dist/magic/magdir/bflt
U src/external/bsd/file/dist/magic/magdir/blcr
U src/external/bsd/file/dist/magic/magdir/blender
U src/external/bsd/file/dist/magic/magdir/blit
U src/external/bsd/file/dist/magic/magdir/bout
U src/external/bsd/file/dist/magic/magdir/bsdi
U src/external/bsd/file/dist/magic/magdir/bsi
U src/external/bsd/file/dist/magic/magdir/btsnoop
U src/external/bsd/file/dist/magic/magdir/c-lang
U src/external/bsd/file/dist/magic/magdir/c64
U src/external/bsd/file/dist/magic/magdir/cad
U src/external/bsd/file/dist/magic/magdir/efi
U src/external/bsd/file/dist/magic/magdir/cafebabe
U src/external/bsd/file/dist/magic/magdir/cddb
U src/external/bsd/file/dist/magic/magdir/chord
U src/external/bsd/file/dist/magic/magdir/cisco
U src/external/bsd/file/dist/magic/magdir/citrus
U src/external/bsd/file/dist/magic/magdir/clarion
U src/external/bsd/file/dist/magic/magdir/claris
U src/external/bsd/file/dist/magic/magdir/clipper
U src/external/bsd/file/dist/magic/magdir/commands
U src/external/bsd/file/dist/magic/magdir/filesystems
U src/external/bsd/file/dist/magic/magdir/compress
U src/external/bsd/file/dist/magic/magdir/conso

CVS commit: src/external/bsd/file

2012-02-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Feb 22 17:47:25 UTC 2012

Modified Files:
src/external/bsd/file: file2netbsd

Log Message:
fix wrong variable, import command


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/external/bsd/file/file2netbsd

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

Modified files:

Index: src/external/bsd/file/file2netbsd
diff -u src/external/bsd/file/file2netbsd:1.2 src/external/bsd/file/file2netbsd:1.3
--- src/external/bsd/file/file2netbsd:1.2	Sat Oct  8 15:28:39 2011
+++ src/external/bsd/file/file2netbsd	Wed Feb 22 12:47:25 2012
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: file2netbsd,v 1.2 2011/10/08 19:28:39 christos Exp $
+#	$NetBSD: file2netbsd,v 1.3 2012/02/22 17:47:25 christos Exp $
 #
 # Copyright (c) 2003, 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -47,7 +47,7 @@ file_vers="$(awk -F', ' '/AC_INIT\(/ { p
 find "$FILE" -name .cvsignore -delete
 
 ### Remove the $'s around RCS tags
-cleantags $d
+cleantags "$FILE"
 
 ### Add NetBSD RCS Id
 find "$FILE" -type f -name '*.[chly]' -print | while read c; do
@@ -99,6 +99,6 @@ wq' | ed Makefile.in > /dev/null 2>&1
 echo done
 
 echo You can import now.  Use the following command:
-echo cvs import src/external/bsd/file/dist CHRISTOS FILE${file_vers%.*}_${file_vers#*.}
+echo cvs -d cvs.netbsd.org:/cvsroot import src/external/bsd/file/dist CHRISTOS FILE${file_vers%.*}_${file_vers#*.}
 
 exit 0



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

2012-02-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 22 16:53:46 UTC 2012

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

Log Message:
Only attempt to handle as much data as we can handle.
Per my testing, allows normal MAXPHYS on domU kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/sys/arch/xen/xen/xbd_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.55 src/sys/arch/xen/xen/xbd_xenbus.c:1.56
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.55	Wed Feb 22 16:50:46 2012
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Wed Feb 22 16:53:46 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.55 2012/02/22 16:50:46 jakllsch Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.56 2012/02/22 16:53:46 jakllsch Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.55 2012/02/22 16:50:46 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.56 2012/02/22 16:53:46 jakllsch Exp $");
 
 #include "opt_xen.h"
 
@@ -1017,7 +1017,11 @@ xbdstart(struct dk_softc *dksc, struct b
 		bcount = bp->b_bcount;
 		bp->b_resid = 0;
 	}
-	for (seg = 0, bcount = bp->b_bcount; bcount > 0;) {
+	if (bcount > XBD_MAX_XFER) {
+		bp->b_resid += bcount - XBD_MAX_XFER;
+		bcount = XBD_MAX_XFER;
+	}
+	for (seg = 0; bcount > 0;) {
 		pmap_extract_ma(pmap_kernel(), va, &ma);
 		KASSERT((ma & (XEN_BSIZE - 1)) == 0);
 		if (bcount > PAGE_SIZE - off)



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

2012-02-22 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Wed Feb 22 16:50:46 UTC 2012

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

Log Message:
Define XBD_MAX_XFER instead of using (PAGE_SIZE * 
BLKIF_MAX_SEGMENTS_PER_REQUEST) directly.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/sys/arch/xen/xen/xbd_xenbus.c

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

Modified files:

Index: src/sys/arch/xen/xen/xbd_xenbus.c
diff -u src/sys/arch/xen/xen/xbd_xenbus.c:1.54 src/sys/arch/xen/xen/xbd_xenbus.c:1.55
--- src/sys/arch/xen/xen/xbd_xenbus.c:1.54	Tue Feb 21 01:47:50 2012
+++ src/sys/arch/xen/xen/xbd_xenbus.c	Wed Feb 22 16:50:46 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: xbd_xenbus.c,v 1.54 2012/02/21 01:47:50 jakllsch Exp $  */
+/*  $NetBSD: xbd_xenbus.c,v 1.55 2012/02/22 16:50:46 jakllsch Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.54 2012/02/21 01:47:50 jakllsch Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.55 2012/02/22 16:50:46 jakllsch Exp $");
 
 #include "opt_xen.h"
 
@@ -94,6 +94,7 @@ __KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c
 #define GRANT_INVALID_REF -1
 
 #define XBD_RING_SIZE __CONST_RING_SIZE(blkif, PAGE_SIZE)
+#define XBD_MAX_XFER (PAGE_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST)
 
 #define XEN_BSHIFT  9   /* log2(XEN_BSIZE) */
 #define XEN_BSIZE   (1 << XEN_BSHIFT) 
@@ -736,8 +737,8 @@ done:
 static void
 xbdminphys(struct buf *bp)
 {
-	if (bp->b_bcount > (PAGE_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST)) {
-		bp->b_bcount = PAGE_SIZE * BLKIF_MAX_SEGMENTS_PER_REQUEST;
+	if (bp->b_bcount > XBD_MAX_XFER) {
+		bp->b_bcount = XBD_MAX_XFER;
 	}
 	minphys(bp);
 }



CVS commit: src/usr.sbin/postinstall

2012-02-22 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Feb 22 16:42:07 UTC 2012

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
quote SRC_DIR and DEST_DIR everywhere.  Also wrap some long lines.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.133 src/usr.sbin/postinstall/postinstall:1.134
--- src/usr.sbin/postinstall/postinstall:1.133	Wed Feb 22 16:27:38 2012
+++ src/usr.sbin/postinstall/postinstall	Wed Feb 22 16:42:07 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.133 2012/02/22 16:27:38 apb Exp $
+# $NetBSD: postinstall,v 1.134 2012/02/22 16:42:07 apb Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1023,7 +1023,7 @@ do_mtree()
 	if ! $SOURCEMODE; then
 		MTREE_DIR="${SRC_DIR}/etc/mtree"
 	else
-		${MAKE} -C ${SRC_DIR}/etc/mtree emit_dist_file > \
+		${MAKE} -C "${SRC_DIR}/etc/mtree" emit_dist_file > \
 		"${SCRATCHDIR}/NetBSD.dist"
 		MTREE_DIR="${SCRATCHDIR}"
 	fi
@@ -1125,7 +1125,7 @@ do_pwd_mkdb()
 	# because we don't expect "postinstall fix pwd_mkdb" to be
 	# invoked during a cross build.
 
-	set -- $(${DB} -q -Sb -Ub -To -N hash ${DEST_DIR}/etc/pwd.db \
+	set -- $(${DB} -q -Sb -Ub -To -N hash "${DEST_DIR}/etc/pwd.db" \
 		'VERSION\0')
 	case "$2" in
 	'\001\000\000\000') return 0 ;; # version 1, little-endian
@@ -1135,7 +1135,9 @@ do_pwd_mkdb()
 	if [ "${op}" = "check" ]; then
 		msg "Update format of passwd database"
 		failed=1
-	elif ! ${PWD_MKDB} -V 1 -d ${DEST_DIR:-/} ${DEST_DIR}/etc/master.passwd; then
+	elif ! ${PWD_MKDB} -V 1 -d "${DEST_DIR:-/}" \
+			"${DEST_DIR}/etc/master.passwd";
+	then
 		msg "Can't update format of passwd database"
 		failed=1
 	else
@@ -1262,11 +1264,11 @@ do_sendmail()
 	for f in /etc/mail/helpfile /etc/mail/local-host-names \
 	/etc/mail/sendmail.cf /etc/mail/submit.cf /etc/rc.d/sendmail \
 	/etc/rc.d/smmsp /usr/share/misc/sendmail.hf \
-	$(find ${DEST_DIR}/usr/share/sendmail -type f) \
-	$(find ${DEST_DIR}/usr/share/sendmail -type d) \
-	${DEST_DIR}/var/log/sendmail.st \
-	${DEST_DIR}/var/spool/clientmqueue \
-	${DEST_DIR}/var/spool/mqueue; do
+	$(find "${DEST_DIR}/usr/share/sendmail" -type f) \
+	$(find "${DEST_DIR}/usr/share/sendmail" -type d) \
+	"${DEST_DIR}/var/log/sendmail.st" \
+	"${DEST_DIR}/var/spool/clientmqueue" \
+	"${DEST_DIR}/var/spool/mqueue"; do
 		[ -e "${DEST_DIR}${f}" ] && echo "${f}"
 	done | obsolete_paths "${op}"
 	failed=$(( ${failed} + $? ))
@@ -1284,7 +1286,8 @@ do_mailerconf()
 	op="$1"
 
 	failed=0
-	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' ${DEST_DIR}/etc/mailer.conf)"
+	mta_path="$(${AWK} '/^sendmail[ \t]/{print$2}' \
+		"${DEST_DIR}/etc/mailer.conf")"
 	old_sendmail_path="/usr/libexec/sendmail/sendmail"
 	if [ "${mta_path}" = "${old_sendmail_path}" ]; then
 	if [ "$op" = check ]; then
@@ -1578,11 +1581,11 @@ do_tcpdumpchroot()
 	[ -n "$1" ] || err 3 "USAGE: do_tcpdumpchroot  fix|check"
 
 	failed=0;
-	if [ -r ${DEST_DIR}/var/chroot/tcpdump/etc/protocols ]; then
+	if [ -r "${DEST_DIR}/var/chroot/tcpdump/etc/protocols" ]; then
 		if [ "$1" = "fix" ]; then
-			rm ${DEST_DIR}/var/chroot/tcpdump/etc/protocols
+			rm "${DEST_DIR}/var/chroot/tcpdump/etc/protocols"
 			failed=$(( ${failed} + $? ))
-			rmdir  ${DEST_DIR}/var/chroot/tcpdump/etc
+			rmdir "${DEST_DIR}/var/chroot/tcpdump/etc"
 			failed=$(( ${failed} + $? ))
 		else
 			failed=1
@@ -1602,18 +1605,21 @@ do_atf()
 	op="$1"
 	failed=0
 
-	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' ${DEST_DIR}/etc/atf/common.conf \
-	>/dev/null
+	if grep '[^#]*unprivileged-user[ \t]*=.*_atf' \
+		"${DEST_DIR}/etc/atf/common.conf" >/dev/null
 	then
 		if [ "$1" = "fix" ]; then
 			sed -e \
 			"/[^#]*unprivileged-user[\ t]*=/s/_atf/_tests/" \
-			${DEST_DIR}/etc/atf/common.conf >${DEST_DIR}/etc/atf/common.conf.new
+			"${DEST_DIR}/etc/atf/common.conf"\
+			>"${DEST_DIR}/etc/atf/common.conf.new"
 			failed=$(( ${failed} + $? ))
-			mv ${DEST_DIR}/etc/atf/common.conf.new ${DEST_DIR}/etc/atf/common.conf
+			mv "${DEST_DIR}/etc/atf/common.conf.new" \
+			   "${DEST_DIR}/etc/atf/common.conf"
 			failed=$(( ${failed} + $? ))
 		else
-			msg "unprivileged-user=_atf in ${DEST_DIR}/etc/atf/common.conf" \
+			msg "unprivileged-user=_atf in" \
+			"${DEST_DIR}/etc/atf/common.conf" \
 			"should be _tests"
 			failed=1
 		fi
@@ -1668,11 +1674,13 @@ do_catpages()
 	failed=0
 	for manbase in /usr/share/man /usr/X11R6/man /usr/X11R7/man; do
 		for sec in 1 2 3 4 5 6 7 8 9; do
-			obsolete_catpages $1 ${DEST_DIR}${manbase} ${sec}
+			obsolete_catpages "$1" "${DEST_DIR}${manbase}" "${sec}"
 			failed=$(( ${failed} + $? ))
 			if [ "$1" = "fix" ]; then
-rmdir $

CVS commit: src/usr.sbin/postinstall

2012-02-22 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Wed Feb 22 16:27:39 UTC 2012

Modified Files:
src/usr.sbin/postinstall: postinstall

Log Message:
Fix a call to pwd_mkdb in the case that DEST_DIR is the empty string.


To generate a diff of this commit:
cvs rdiff -u -r1.132 -r1.133 src/usr.sbin/postinstall/postinstall

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

Modified files:

Index: src/usr.sbin/postinstall/postinstall
diff -u src/usr.sbin/postinstall/postinstall:1.132 src/usr.sbin/postinstall/postinstall:1.133
--- src/usr.sbin/postinstall/postinstall:1.132	Tue Feb 21 12:31:18 2012
+++ src/usr.sbin/postinstall/postinstall	Wed Feb 22 16:27:38 2012
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: postinstall,v 1.132 2012/02/21 12:31:18 nakayama Exp $
+# $NetBSD: postinstall,v 1.133 2012/02/22 16:27:38 apb Exp $
 #
 # Copyright (c) 2002-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1135,7 +1135,7 @@ do_pwd_mkdb()
 	if [ "${op}" = "check" ]; then
 		msg "Update format of passwd database"
 		failed=1
-	elif ! ${PWD_MKDB} -V 1 -d ${DEST_DIR} ${DEST_DIR}/etc/master.passwd; then
+	elif ! ${PWD_MKDB} -V 1 -d ${DEST_DIR:-/} ${DEST_DIR}/etc/master.passwd; then
 		msg "Can't update format of passwd database"
 		failed=1
 	else



CVS commit: src/distrib/common

2012-02-22 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Wed Feb 22 16:12:34 UTC 2012

Modified Files:
src/distrib/common: sunbootcd.sh

Log Message:
Fix typo in usage


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/distrib/common/sunbootcd.sh

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

Modified files:

Index: src/distrib/common/sunbootcd.sh
diff -u src/distrib/common/sunbootcd.sh:1.5 src/distrib/common/sunbootcd.sh:1.6
--- src/distrib/common/sunbootcd.sh:1.5	Wed Apr 30 13:10:48 2008
+++ src/distrib/common/sunbootcd.sh	Wed Feb 22 16:12:34 2012
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-# $NetBSD: sunbootcd.sh,v 1.5 2008/04/30 13:10:48 martin Exp $
+# $NetBSD: sunbootcd.sh,v 1.6 2012/02/22 16:12:34 martin Exp $
 #
 # Copyright (c) 2003 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -50,7 +50,7 @@ Usage: ${PROGNAME} fsimage sun4 [sun4c [
 	The architecture arguments must be bootable file system image
 	for that architecture, or \`-' if no entry is desired.
 	\`fsimage' is typically an iso9660 file system image, although
-	any time of file system can be used as long as the first 512
+	any type of file system can be used as long as the first 512
 	bytes of the image are not used.  \`fsimage' is modified, and
 	the additional partitions are added in order.  If the same
 	filename is used more than once for different architectures,



CVS commit: src/sys/arch/amd64/amd64

2012-02-22 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Wed Feb 22 14:12:04 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64: db_machdep.c

Log Message:
fix stack backtraces through traps.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/amd64/amd64/db_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/db_machdep.c
diff -u src/sys/arch/amd64/amd64/db_machdep.c:1.1 src/sys/arch/amd64/amd64/db_machdep.c:1.2
--- src/sys/arch/amd64/amd64/db_machdep.c:1.1	Sun Apr 10 20:36:49 2011
+++ src/sys/arch/amd64/amd64/db_machdep.c	Wed Feb 22 14:12:04 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:49 christos Exp $	*/
+/*	$NetBSD: db_machdep.c,v 1.2 2012/02/22 14:12:04 chs Exp $	*/
 
 /* 
  * Mach Operating System
@@ -26,7 +26,7 @@
  * rights to redistribute these changes.
  */
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.1 2011/04/10 20:36:49 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_machdep.c,v 1.2 2012/02/22 14:12:04 chs Exp $");
 
 #include 
 #include 
@@ -131,7 +131,7 @@ db_nextframe(long **nextframe, long **re
 	default:
 
 		/* The only argument to trap() or syscall() is the trapframe. */
-		tf = *(struct trapframe **)argp;
+		tf = (struct trapframe *)argp;
 		switch (is_trap) {
 		case TRAP:
 			(*pr)("--- trap (number %d) ---\n", tf->tf_trapno);
@@ -141,7 +141,6 @@ db_nextframe(long **nextframe, long **re
 			break;
 		case INTERRUPT:
 			(*pr)("--- interrupt ---\n");
-			tf = (struct trapframe *)argp;
 			break;
 		}
 		*ip = (db_addr_t)tf->tf_rip;



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

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:36:14 UTC 2012

Modified Files:
src/sys/arch/sandpoint/conf: ENCPP1 GENERIC SANDPOINT

Log Message:
- nuke commented-out SYMTAB_SPACE directive since this port has a
  companion bootloader which is capable of loading a plain ELF kernel
  and accompanying ELF symbol table.
- remove fxp(4) from GENERIC as no known NAS has the device.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/sandpoint/conf/ENCPP1
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/sandpoint/conf/GENERIC
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/sandpoint/conf/SANDPOINT

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/sandpoint/conf/ENCPP1
diff -u src/sys/arch/sandpoint/conf/ENCPP1:1.9 src/sys/arch/sandpoint/conf/ENCPP1:1.10
--- src/sys/arch/sandpoint/conf/ENCPP1:1.9	Tue Nov 22 21:25:34 2011
+++ src/sys/arch/sandpoint/conf/ENCPP1	Wed Feb 22 12:36:14 2012
@@ -1,4 +1,4 @@
-# $NetBSD: ENCPP1,v 1.9 2011/11/22 21:25:34 tls Exp $
+# $NetBSD: ENCPP1,v 1.10 2012/02/22 12:36:14 nisimura Exp $
 #
 # Ampro EnCorePP1 machine description file
 # 
@@ -23,7 +23,7 @@ options 	PIC_I8259
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"ENCPP1-$Revision: 1.9 $"
+#ident 		"ENCPP1-$Revision: 1.10 $"
 
 maxusers	32
 
@@ -42,7 +42,6 @@ options 	DDB
 options 	KTRACE
 #options 	PMAPCHECK
 #options 	PMAPDEBUG
-#options 	SYMTAB_SPACE=30
 #options 	USERCONF	# userconf(4) support
 #options	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel

Index: src/sys/arch/sandpoint/conf/GENERIC
diff -u src/sys/arch/sandpoint/conf/GENERIC:1.70 src/sys/arch/sandpoint/conf/GENERIC:1.71
--- src/sys/arch/sandpoint/conf/GENERIC:1.70	Sat Feb 11 12:31:47 2012
+++ src/sys/arch/sandpoint/conf/GENERIC	Wed Feb 22 12:36:14 2012
@@ -1,4 +1,4 @@
-# $NetBSD: GENERIC,v 1.70 2012/02/11 12:31:47 phx Exp $
+# $NetBSD: GENERIC,v 1.71 2012/02/22 12:36:14 nisimura Exp $
 #
 # machine description file for GENERIC NAS
 # 
@@ -22,7 +22,7 @@ include 	"arch/sandpoint/conf/std.sandpo
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"GENERIC-$Revision: 1.70 $"
+#ident 		"GENERIC-$Revision: 1.71 $"
 
 maxusers	32
 
@@ -58,7 +58,6 @@ options 	DDB
 #options 	TRAP_PANICWAIT
 #options 	PMAPCHECK
 #options 	PMAPDEBUG
-#options 	SYMTAB_SPACE=30
 options 	MSGBUFSIZE=65536
 
 #makeoptions	DEBUG="-g"
@@ -214,7 +213,6 @@ atabus* at ata?
 wd*		at atabus? drive ? flags 0x	# the drives themselves
 
 # PCI network interfaces
-fxp*	at pci? dev ? function ?	# Intel EtherExpress PRO 10+/100B
 ral*	at pci? dev ? function ?	# Ralink Technology RT25x0 802.11a/b/g
 re*	at pci? dev ? function ?	# Realtek 8139C+/8169/8169S/8110S
 skc*	at pci? dev ? function ?	# Marvell Yukon Gigabit Ethernet

Index: src/sys/arch/sandpoint/conf/SANDPOINT
diff -u src/sys/arch/sandpoint/conf/SANDPOINT:1.8 src/sys/arch/sandpoint/conf/SANDPOINT:1.9
--- src/sys/arch/sandpoint/conf/SANDPOINT:1.8	Tue Nov 22 21:25:34 2011
+++ src/sys/arch/sandpoint/conf/SANDPOINT	Wed Feb 22 12:36:14 2012
@@ -1,4 +1,4 @@
-# $NetBSD: SANDPOINT,v 1.8 2011/11/22 21:25:34 tls Exp $
+# $NetBSD: SANDPOINT,v 1.9 2012/02/22 12:36:14 nisimura Exp $
 #
 # Sandpoint X3/X2 machine description file
 # 
@@ -23,7 +23,7 @@ options 	PIC_I8259
 
 options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
-#ident 		"SANDPOINT-$Revision: 1.8 $"
+#ident 		"SANDPOINT-$Revision: 1.9 $"
 
 maxusers	32
 
@@ -44,7 +44,6 @@ options 	DDB
 options 	KTRACE
 #options 	PMAPCHECK
 #options 	PMAPDEBUG
-#options 	SYMTAB_SPACE=30
 #options 	USERCONF	# userconf(4) support
 #options	PIPE_SOCKETPAIR		# smaller, but slower pipe(2)
 options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:21:24 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: entry.S main.c

Log Message:
- detect SoC chipid value found at 0x5600'00b0.
- have brdsetup() to define SoC IOMUX in early startup. Device drivers
  are still responsible to arrange relevent registers which they use.
- some cleanup and clarification.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/evbarm/stand/boot2440/entry.S \
src/sys/arch/evbarm/stand/boot2440/main.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/evbarm/stand/boot2440/entry.S
diff -u src/sys/arch/evbarm/stand/boot2440/entry.S:1.1 src/sys/arch/evbarm/stand/boot2440/entry.S:1.2
--- src/sys/arch/evbarm/stand/boot2440/entry.S:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/entry.S	Wed Feb 22 12:21:23 2012
@@ -40,7 +40,8 @@
 #ifndef	SDRAM_START
 #define	SDRAM_START	S3C2440_SDRAM_START
 #endif
-	
+
+/* LED1/2/3/4 are manipulated by GPIO B5/6/7/8. */
 #define LED1 (1<<5)
 #define LED2 (1<<6)
 #define LED3 (1<<7)
@@ -50,7 +51,7 @@
 	.global _start
 _start:
 	/* Get arguments from boot-loader (stored in r0 and r1) */
-	adr	r2, bootloader_args
+	adr	r2, Largs
 	stmia	r2, {r0, r1}
 
 	/* Disable interrupt */
@@ -125,7 +126,7 @@ _start:
 bgt .L1
 
 	
-	adr	r2, bootloader_args
+	adr	r2, Largs
 	ldmia	r2, {r0, r1}
 
 	/* Jump to kernel code in TRUE VA */
@@ -134,11 +135,6 @@ _start:
 Lstart:
 	.word	main
 	
-	.macro clock_data  hdivn, pdivn, mdiv, pdiv, sdiv
-	.word	(\hdivn)<<1 | \pdivn
-	.word	(\mdiv)<>L1_S_SHIFT)			; \
@@ -161,6 +157,5 @@ Lcrtsetup:
 	.word	_end	/* End of BSS */
 	.word	0x30A0 /* Place stack-bottom at load-point of libsa bootloader */
 
-	.global _C_LABEL(bootloader_args)
-_C_LABEL(bootloader_args):
-	.space	8 /* Two registers */
+Largs:
+	.space	8 /* to save r0/r1 registers */
Index: src/sys/arch/evbarm/stand/boot2440/main.c
diff -u src/sys/arch/evbarm/stand/boot2440/main.c:1.1 src/sys/arch/evbarm/stand/boot2440/main.c:1.2
--- src/sys/arch/evbarm/stand/boot2440/main.c:1.1	Mon Jan 30 03:28:34 2012
+++ src/sys/arch/evbarm/stand/boot2440/main.c	Wed Feb 22 12:21:23 2012
@@ -84,6 +84,8 @@ static void time_init(uint32_t pclk);
 static void bi_init(void *addr);
 static void bi_add(void *new, int type, int size);
 static void parse_mac_address(const char *str, uint8_t *enaddr);
+static void brdsetup(void);
+static void iomux(int, const char *);
 
 extern void* dm9k_init(unsigned int tag, void *macaddr);
 
@@ -95,6 +97,7 @@ extern void netif_match(unsigned int tag
 /*  extern int sdif_init(unsigned int tag);*/
 
 /* Global variables */
+uint32_t socmodel;
 int pclk;
 struct btinfo_rootdevice	bi_rdev;
 
@@ -117,6 +120,10 @@ main(int argc, char *argv[])
 	bool kernel_loaded;
 	uint8_t enaddr[6] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
 
+	socmodel = CSR_READ(S3C2440_GPIO_BASE + GPIO_GSTATUS1);
+
+	brdsetup();
+
 	/* Give some indication that main() has been reached */
 	CLEAR_LEDS();
 	LED_ON(4);
@@ -144,6 +151,14 @@ main(int argc, char *argv[])
 	/* Let the user know we are alive */
 	printf("\n");
 	printf(">> %s boot2440, revision %s\n", bootprog_name, bootprog_rev);
+	printf("SoC model:");
+	switch (socmodel) {
+	case 0x3244:
+		printf(" S3C2440"); break;
+	case 0x32440001:
+		printf(" S3C2440A"); break;
+	}
+	printf(" (chipid %08x)\n", socmodel);
 
 	bootinfo = (void*) BOOTINFO_ADDR;
 	bi_init(bootinfo);
@@ -156,8 +171,6 @@ main(int argc, char *argv[])
 		struct btinfo_bootstring ba;
 		int j, i;
 
-		printf("Argument count: %d\n", argc);
-
 		j = 0;
 		for (i = 0; i < argc; i++) {
 			if (j == MAX_BOOT_STRING-1) {
@@ -174,9 +187,6 @@ main(int argc, char *argv[])
 j += strlen(argv[i]);
 			}
 		}
-
-		printf("Boot string: %s\n", ba.bootstring);
-
 		bi_add(&ba, BTINFO_BOOTSTRING, sizeof(ba));
 	}
 
@@ -534,3 +544,93 @@ parse_mac_address(const char *str, uint8
 		}
 	}
 }
+
+static void
+brdsetup(void)
+{
+/*
+ * MINI2440 pin usage summary
+ *
+ *  B5	output	LED1 control
+ *  B6	output	LED2 control
+ *  B7	output	LED3 control
+ *  B8	output	LED4 control
+ *  G0	EINT8	K1 button
+ *  G3	EINT11	K2 button
+ *  G5	EINT13	K3 button
+ *  G6	EINT14	K4 button
+ *  G7	EINT15	K5 button
+ *  G11	EINT19	K6 button
+ *  F7	EINT7	DM9000 interrupt
+ *  G12	EINT20	camera interrupt
+ *  G8	input	SD card presense detect
+ *  H8	input	SD write protect sense
+ *  B0	TOUT0	buzzer PWM
+ *  B1	TOUT1	LCD backlight PWM
+ *  B2	output	UDA1341 audio L3MODE
+ *  B3	output	UDA1341 audio L3DATA
+ *  B4	output	UDA1341 audio L3LOCK
+ *
+ *  A21, A11, G15, G14, G13: not used.
+ *
+ *  i   input sense
+ *  o   output control
+ *  2   function 2
+ *  3   function 3
+ *  0   output control (A only)
+ *  1   function 1 (A only)
+ *  ./x no function, not connected or don't-care
+ *  
+ * A .

CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:12:21 UTC 2012

Modified Files:
src/sys/arch/evbarm/stand/boot2440: Makefile

Log Message:
- adapt DM9000 driver name change.
- move -DLIBSA_PRINTF_WIDTH_SUPPORT to CPPFLAGS variable as SACPPFLAGS
  does not work.
- add a logic to make/remove machine/ and arm/ symlinks.
- remove redundant directives in no use.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbarm/stand/boot2440/Makefile

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/stand/boot2440/Makefile
diff -u src/sys/arch/evbarm/stand/boot2440/Makefile:1.2 src/sys/arch/evbarm/stand/boot2440/Makefile:1.3
--- src/sys/arch/evbarm/stand/boot2440/Makefile:1.2	Tue Jan 31 11:04:17 2012
+++ src/sys/arch/evbarm/stand/boot2440/Makefile	Wed Feb 22 12:12:21 2012
@@ -1,18 +1,19 @@
-#	$NetBSD: Makefile,v 1.2 2012/01/31 11:04:17 nisimura Exp $
+#	$NetBSD: Makefile,v 1.3 2012/02/22 12:12:21 nisimura Exp $
 
 S=		${.CURDIR}/../../../..
+
 PROG=		bootmini2440
-SRCS=		entry.S main.c devopen.c netif.c dev_net.c dm9k.c dev_sdmmc.c
+SRCS=		entry.S main.c devopen.c netif.c dev_net.c dm9000.c dev_sdmmc.c
 SRCS+=		s3csdi.c vers.c
 
 .include 
 
 CLEANFILES+=	vers.c ${PROG}.elf
 CFLAGS+=	-Wall -Wno-main -ffreestanding -march=armv4
-CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP 
+CPPFLAGS+=	-D_STANDALONE -DSUPPORT_DHCP -DLIBSA_PRINTF_WIDTH_SUPPORT
 CPPFLAGS+=	-DDM9000MAC="0x08,0x08,0x11,0x18,0x12,0x27" 
 CPPFLAGS+=	-DDEFAULT_BOOTFILE="ld0a:netbsd;net:"
-CPPFLAGS+=	-nostdinc -I. -I${.CURDIR} -I${.OBJDIR} -I${S} -I${S}/arch
+CPPFLAGS+=	-nostdinc -I. -I${.OBJDIR} -I${S} -I${S}/arch
 DBG=		
 
 LIBCRT0=	# nothing
@@ -28,6 +29,14 @@ BINMODE=	444
 RELOC=		0x30A0
 ENTRY=		_start
 
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN:
+	@[ -h machine ] || ln -s ${S}/arch/evbarm/include machine
+	@[ -h arm ] || ln -s ${S}/arch/arm/include arm
+.NOPATH: machine arm
+.endif
+CLEANFILES+= machine arm
+
 ### find out what to use for libkern
 KERN_AS=	library
 .include "${S}/lib/libkern/Makefile.inc"
@@ -41,7 +50,6 @@ LIBZ=		${ZLIB}
 ### find out what to use for libsa
 SA_AS=		library
 SAMISCMAKEFLAGS= SA_USE_CREAD=yes SA_USE_LOADFILE=yes
-SACPPFLAGS=	-DLIBSA_PRINTF_WIDTH_SUPPORT
 .include "${S}/lib/libsa/Makefile.inc"
 LIBSA=		${SALIB}
 
@@ -55,12 +63,4 @@ ${PROG}: ${OBJS} ${LIBSA} ${LIBZ} ${LIBK
 	${OBJS} ${LIBSA} ${LIBZ} ${LIBKERN}
 	${OBJCOPY} -S -O binary ${.TARGET}.elf ${.TARGET}
 
-
-.include 
 .include 
-
-cleandir distclean: .WAIT cleanlibdir
-
-cleanlibdir:
-	-rm -rf lib
-



CVS commit: src/sys/arch/evbarm/stand/boot2440

2012-02-22 Thread Tohru Nishimura
Module Name:src
Committed By:   nisimura
Date:   Wed Feb 22 12:08:41 UTC 2012

Added Files:
src/sys/arch/evbarm/stand/boot2440: dm9000.c
Removed Files:
src/sys/arch/evbarm/stand/boot2440: dm9k.c

Log Message:
Reimplement DM9000E driver.
- add a note about 16bit mode operation.
- make sure not to receive any mcast/bcast frames by clearing 64bit
  multicast filter hash value register.
- change the filename so as silimar to other implementations.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/stand/boot2440/dm9000.c
cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/stand/boot2440/dm9k.c

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

Added files:

Index: src/sys/arch/evbarm/stand/boot2440/dm9000.c
diff -u /dev/null src/sys/arch/evbarm/stand/boot2440/dm9000.c:1.1
--- /dev/null	Wed Feb 22 12:08:41 2012
+++ src/sys/arch/evbarm/stand/boot2440/dm9000.c	Wed Feb 22 12:08:41 2012
@@ -0,0 +1,454 @@
+/* $NetBSD: dm9000.c,v 1.1 2012/02/22 12:08:41 nisimura Exp $ */
+
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Tohru Nishimura.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+/*
+ * This DM9000 is wired as a 16bit device and manages Tx/Rx SRAM buffer
+ * in 16bit quantity.  MRCMD/MWCMD access increments buffer pointer
+ * by two regardless of r/w size.  Mixing 16/8bit access is not possible.
+ * Byte read would end up with loosing every odd indexed datum.
+ *
+ * The DM9000 CMD pin is tied with SoC LADDR2 address line.  SA9-SA4
+ * pins are hardwired to fixed decoding 0x300.  Thus address [26:3] in
+ * CS4 range 0x2000' are don't-care bits to manipulate the chip.
+ * The DM9000 INDEX port is accessed at the address b'000 while the
+ * DATA port at the address b'100.
+ *
+ * This code assumes Little endian CPU.
+ */
+
+#define NCR	0x00		/* control */
+#define  NCR_FDX	(1<<3)	/* FDX link detection report */
+#define  NCR_RST	(1<<0)	/* instruct reset, goes 0 at done */
+#define NSR	0x01		/* status */
+#define  NSR_SPEED	(1<<7)	/* 1->100M, 0->10M, when link is up */
+#define  NSR_LINKST	(1<<6)	/* 1->linkup, 0->linkdown */
+#define  NSR_TX2END	(1<<3)	/* Tx frame #2 completed */
+#define  NSR_TX1END	(1<<2)	/* Tx frame #1 completed */
+#define  NSR_RXOV	(1<<1)	/* Rx FIFO overflow detected */
+#define TCR	0x02		/* Tx control */
+#define  TCR_TXREQ	0x01	/* request to start transmit, goes 0 at done */
+#define TCR2	0x2d		/* Tx control #2 */
+#define  TCR2_ONEPM	0x10	/* send single Tx frame at a time */
+#define RCR	0x05		/* Rx control */
+#define  RCR_WTDIS	0x40	/* disable frame receipt watchdog timer */
+#define  RCR_DIS_LONG	0x20	/* discard too-long Rx frame */
+#define  RCR_DIS_CRC	0x10	/* discard CRC error Rx frame */
+#define  RCR_ALL	0x08	/* accept MCAST frames */
+#define  RCR_RUNT	0x04	/* accept runt Rx frame */
+#define  RCR_PRMSC	0x02	/* promiscous */
+#define  RCR_RXEN	0x01	/* enable frame reception */
+#define RSR	0x06		/* RX status */
+#define  RSR_MF		(1<<6)	/* bcast/mcast frame found */
+#define FCR	0x0a		/* flow control */
+#define  FCR_FLCE	0x01	/* enable Tx/Rx flow control */
+#define EPCR	0x0b		/* EEPROM and PHY control */
+#define  EP_EPOS	(1<<3)	/* 1 for PHY op, 0 for EEPROM op */
+#define  EP_ERPRR	(1<<2)	/* instruct to start read op */
+#define  EP_ERPRW	(1<<1)	/* instruct to start write op */
+#define  EP_ERRE	(1<<0)	/* 1 while operation is in progress */
+#define EPAR	0x0c		/* [7:6] for PHY#, [5:0] for addr */
+#define EPDRL	0x0d		/* EEPROM/PH