CVS commit: src/sys/dev/usb

2013-01-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 22 08:33:19 UTC 2013

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

Log Message:
Improve a DIAGNOSTIC so it doesn't confuse people who need more coffee,
e.g. me.


To generate a diff of this commit:
cvs rdiff -u -r1.146 -r1.147 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.146 src/sys/dev/usb/usbdi.c:1.147
--- src/sys/dev/usb/usbdi.c:1.146	Sat Jan 19 15:10:05 2013
+++ src/sys/dev/usb/usbdi.c	Tue Jan 22 08:33:18 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.146 2013/01/19 15:10:05 skrll Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.147 2013/01/22 08:33:18 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.146 2013/01/19 15:10:05 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.147 2013/01/22 08:33:18 skrll Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -798,7 +798,7 @@ usb_transfer_complete(usbd_xfer_handle x
 
 #ifdef DIAGNOSTIC
 	if (xfer-busy_free != XFER_ONQU) {
-		printf(usb_transfer_complete: xfer=%p not busy 0x%08x\n,
+		printf(usb_transfer_complete: xfer=%p not queued 0x%08x\n,
 		   xfer, xfer-busy_free);
 	}
 #endif



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

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 09:04:12 UTC 2013

Modified Files:
src/sys/arch/arm/cortex: pl310.c

Log Message:
Don't sync atomic ops.
Do sync after each range op.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/cortex/pl310.c

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

Modified files:

Index: src/sys/arch/arm/cortex/pl310.c
diff -u src/sys/arch/arm/cortex/pl310.c:1.9 src/sys/arch/arm/cortex/pl310.c:1.10
--- src/sys/arch/arm/cortex/pl310.c:1.9	Wed Nov 28 22:48:13 2012
+++ src/sys/arch/arm/cortex/pl310.c	Tue Jan 22 09:04:12 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $	*/
+/*	$NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pl310.c,v 1.9 2012/11/28 22:48:13 matt Exp $);
+__KERNEL_RCSID(0, $NetBSD: pl310.c,v 1.10 2013/01/22 09:04:12 matt Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -195,11 +195,14 @@ arml2cc_attach(device_t parent, device_t
 }
 
 static inline void
-arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val)
+arml2cc_cache_op(struct arml2cc_softc *sc, bus_size_t off, uint32_t val,
+bool wait)
 {
 	arml2cc_write_4(sc, off, val);
-	while (arml2cc_read_4(sc, off)  1) {
-		/* spin */
+	if (wait) {
+		while (arml2cc_read_4(sc, off)  1) {
+			/* spin */
+		}
 	}
 }
 
@@ -215,7 +218,7 @@ arml2cc_cache_way_op(struct arml2cc_soft
 static inline void
 arml2cc_cache_sync(struct arml2cc_softc *sc)
 {
-	arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0);
+	arml2cc_cache_op(sc, L2C_CACHE_SYNC, 0, true);
 }
 
 static inline void
@@ -294,7 +297,7 @@ arml2cc_cache_range_op(paddr_t pa, psize
 			return;
 		}
 		for (paddr_t segend = pa + seglen; pa  segend; pa += line_size) {
-			arml2cc_cache_op(sc, cache_op, pa);
+			arml2cc_cache_op(sc, cache_op, pa, false);
 		}
 		mutex_spin_exit(sc-sc_lock);
 	}
@@ -305,6 +308,7 @@ arml2cc_sdcache_inv_range(vaddr_t va, pa
 {
 	atomic_inc_64(arml2cc_sc-sc_ev_inv.ev_count);
 	arml2cc_cache_range_op(pa, len, L2C_INV_PA);
+	arml2cc_cache_sync(arml2cc_sc);
 }
 
 static void
@@ -312,6 +316,7 @@ arml2cc_sdcache_wb_range(vaddr_t va, pad
 {
 	atomic_inc_64(arml2cc_sc-sc_ev_wb.ev_count);
 	arml2cc_cache_range_op(pa, len, L2C_CLEAN_PA);
+	arml2cc_cache_sync(arml2cc_sc);
 }
 
 static void
@@ -319,4 +324,5 @@ arml2cc_sdcache_wbinv_range(vaddr_t va, 
 {
 	atomic_inc_64(arml2cc_sc-sc_ev_wbinv.ev_count);
 	arml2cc_cache_range_op(pa, len, L2C_CLEAN_INV_PA);
+	arml2cc_cache_sync(arml2cc_sc);
 }



CVS commit: src/sys/arch/x68k

2013-01-22 Thread Tetsuya Isaki
Module Name:src
Committed By:   isaki
Date:   Tue Jan 22 11:58:40 UTC 2013

Modified Files:
src/sys/arch/x68k/dev: intiovar.h
src/sys/arch/x68k/x68k: machdep.c

Log Message:
Detect emulators (and display it on dmesg).


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x68k/dev/intiovar.h
cvs rdiff -u -r1.185 -r1.186 src/sys/arch/x68k/x68k/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/x68k/dev/intiovar.h
diff -u src/sys/arch/x68k/dev/intiovar.h:1.13 src/sys/arch/x68k/dev/intiovar.h:1.14
--- src/sys/arch/x68k/dev/intiovar.h:1.13	Thu Dec 18 05:56:42 2008
+++ src/sys/arch/x68k/dev/intiovar.h	Tue Jan 22 11:58:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: intiovar.h,v 1.13 2008/12/18 05:56:42 isaki Exp $	*/
+/*	$NetBSD: intiovar.h,v 1.14 2013/01/22 11:58:39 isaki Exp $	*/
 
 /*
  *
@@ -126,6 +126,8 @@ int intio_intr(struct frame *);
 #define INTIO_SYSPORT_KBEXIST	0x08
 #define intio_get_sysport_waitctrl() \
 	(intio_sysport[sysport_waitctrl])
+#define intio_get_sysport_sramwp() \
+	(intio_sysport[sysport_sramwp])
 #define intio_get_sysport_mpustat() \
 	(intio_sysport[sysport_mpustat])
 

Index: src/sys/arch/x68k/x68k/machdep.c
diff -u src/sys/arch/x68k/x68k/machdep.c:1.185 src/sys/arch/x68k/x68k/machdep.c:1.186
--- src/sys/arch/x68k/x68k/machdep.c:1.185	Mon Jul 30 17:19:59 2012
+++ src/sys/arch/x68k/x68k/machdep.c	Tue Jan 22 11:58:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $	*/
+/*	$NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $	*/
 
 /*
  * Copyright (c) 1988 University of Utah.
@@ -39,7 +39,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.185 2012/07/30 17:19:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: machdep.c,v 1.186 2013/01/22 11:58:39 isaki Exp $);
 
 #include opt_ddb.h
 #include opt_kgdb.h
@@ -125,6 +125,7 @@ int	maxmem;			/* max memory per process 
 
 /* prototypes for local functions */
 void	identifycpu(void);
+static int check_emulator(char *, int);
 void	initcpu(void);
 int	cpu_dumpsize(void);
 int	cpu_dump(int (*)(dev_t, daddr_t, void *, size_t), daddr_t *);
@@ -304,6 +305,7 @@ identifycpu(void)
 	/* there's alot of XXX in here... */
 	const char *cpu_type, *mach, *mmu, *fpu;
 	char clock[16];
+	char emubuf[20];
 
 	/*
 	 * check machine type constant
@@ -335,6 +337,9 @@ identifycpu(void)
 		break;
 	}
 
+	emubuf[0] = '\0';
+	check_emulator(emubuf, sizeof(emubuf));
+
 	cpuspeed = 2048 / delay_divisor;
 	sprintf(clock, %dMHz, cpuspeed);
 	switch (cputype) {
@@ -367,12 +372,60 @@ identifycpu(void)
 		fpu = fpu_descr[fputype];
 	else
 		fpu = , unknown FPU;
-	sprintf(cpu_model, X68%s (%s CPU%s%s, %s clock),
-	mach, cpu_type, mmu, fpu, clock);
+	sprintf(cpu_model, X68%s (%s CPU%s%s, %s clock)%s%s,
+	mach, cpu_type, mmu, fpu, clock,
+		emubuf[0] ?  on  : , emubuf);
 	printf(%s\n, cpu_model);
 }
 
 /*
+ * If it is an emulator, store the name in buf and return 1.
+ * Otherwise return 0.
+ */
+static int
+check_emulator(char *buf, int bufsize)
+{
+	int xm6major;
+	int xm6minor;
+	int xm6imark;
+	int xm6imajor;
+	int xm6iminor;
+
+	/* XM6 and its family */
+	intio_set_sysport_sramwp('X');
+	if (intio_get_sysport_sramwp() == '6') {
+		xm6major = intio_get_sysport_sramwp();
+		xm6minor = intio_get_sysport_sramwp();
+		xm6imark = intio_get_sysport_sramwp();
+		switch (xm6imark) {
+		case 0xff:	/* Original XM6 or unknown compatibles */
+			snprintf(buf, bufsize, XM6 v%d.%02d,
+xm6major, xm6minor);
+			break;
+
+		case 'i':	/* XM6i */
+			xm6imajor = intio_get_sysport_sramwp();
+			xm6iminor = intio_get_sysport_sramwp();
+			snprintf(buf, bufsize, XM6i v%d.%02d,
+xm6imajor, xm6iminor);
+			break;
+
+		case 'g':	/* XM6 TypeG */
+			snprintf(buf, bufsize, XM6 TypeG v%d.%02d,
+xm6major, xm6minor);
+			break;
+
+		default:	/* Other XM6 compatibles? */
+			/* XXX what should I do? */
+			return 0;
+		}
+		return 1;
+	}
+
+	return 0;
+}
+
+/*
  * machine dependent system variables.
  */
 SYSCTL_SETUP(sysctl_machdep_setup, sysctl machdep subtree setup)



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 12:04:59 UTC 2013

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

Log Message:
simplify the locking in urtwn_start


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/dev/usb/if_urtwn.c

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

Modified files:

Index: src/sys/dev/usb/if_urtwn.c
diff -u src/sys/dev/usb/if_urtwn.c:1.16 src/sys/dev/usb/if_urtwn.c:1.17
--- src/sys/dev/usb/if_urtwn.c:1.16	Mon Jan 21 23:42:45 2013
+++ src/sys/dev/usb/if_urtwn.c	Tue Jan 22 12:04:58 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_urtwn.c,v 1.16 2013/01/21 23:42:45 jmcneill Exp $	*/
+/*	$NetBSD: if_urtwn.c,v 1.17 2013/01/22 12:04:58 jmcneill Exp $	*/
 /*	$OpenBSD: if_urtwn.c,v 1.20 2011/11/26 06:39:33 ckuethe Exp $	*/
 
 /*-
@@ -22,7 +22,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_urtwn.c,v 1.16 2013/01/21 23:42:45 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_urtwn.c,v 1.17 2013/01/22 12:04:58 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -2331,22 +2331,22 @@ urtwn_start(struct ifnet *ifp)
 	data = NULL;
 	for (;;) {
 		mutex_enter(sc-sc_tx_mtx);
-		if (data == NULL) {
+		if (data == NULL  !TAILQ_EMPTY(sc-tx_free_list)) {
 			data = TAILQ_FIRST(sc-tx_free_list);
-			if (data == NULL) {
-mutex_exit(sc-sc_tx_mtx);
-ifp-if_flags |= IFF_OACTIVE;
-DPRINTFN(DBG_TX, (%s: empty tx_free_list\n,
-	 device_xname(sc-sc_dev)));
-return;
-			}
 			TAILQ_REMOVE(sc-tx_free_list, data, next);
 		}
+		mutex_exit(sc-sc_tx_mtx);
+
+		if (data == NULL) {
+			ifp-if_flags |= IFF_OACTIVE;
+			DPRINTFN(DBG_TX, (%s: empty tx_free_list\n,
+ device_xname(sc-sc_dev)));
+			return;
+		}
 
 		/* Send pending management frames first. */
 		IF_DEQUEUE(ic-ic_mgtq, m);
 		if (m != NULL) {
-			mutex_exit(sc-sc_tx_mtx);
 			ni = (void *)m-m_pkthdr.rcvif;
 			m-m_pkthdr.rcvif = NULL;
 			goto sendit;
@@ -2359,8 +2359,6 @@ urtwn_start(struct ifnet *ifp)
 		if (m == NULL)
 			break;
 
-		mutex_exit(sc-sc_tx_mtx);
-
 		if (m-m_len  (int)sizeof(*eh) 
 		(m = m_pullup(m, sizeof(*eh))) == NULL) {
 			ifp-if_oerrors++;
@@ -2398,6 +2396,7 @@ urtwn_start(struct ifnet *ifp)
 	}
 
 	/* Return the Tx buffer to the free list */
+	mutex_enter(sc-sc_tx_mtx);
 	TAILQ_INSERT_TAIL(sc-tx_free_list, data, next);
 	mutex_exit(sc-sc_tx_mtx);
 }



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 12:40:44 UTC 2013

Modified Files:
src/sys/dev/usb: auvitek_dtv.c ehci.c emdtv_dtv.c if_atu.c if_aue.c
if_axe.c if_cue.c if_otus.c if_rum.c if_run.c if_smsc.c if_udav.c
if_upgt.c if_ural.c if_url.c if_urtw.c if_urtwn.c if_zyd.c ohci.c
uaudio.c uhci.c usb.c usb_subr.c usbdi.c usbdi.h usbdivar.h

Log Message:
- Add a USBD_MPSAFE flag to usbd_open_pipe. If not set, acquire KERNEL_LOCK
  before invoking xfer callbacks on this pipe.
- Add an extra flags parameter to usb_init_task. If USBD_TASKQ_MPSAFE is not
  present, acquire KERNEL_LOCK before invoking the task callback.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/usb/auvitek_dtv.c \
src/sys/dev/usb/if_smsc.c
cvs rdiff -u -r1.202 -r1.203 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.9 -r1.10 src/sys/dev/usb/emdtv_dtv.c
cvs rdiff -u -r1.47 -r1.48 src/sys/dev/usb/if_atu.c
cvs rdiff -u -r1.129 -r1.130 src/sys/dev/usb/if_aue.c
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/usb/if_axe.c
cvs rdiff -u -r1.65 -r1.66 src/sys/dev/usb/if_cue.c
cvs rdiff -u -r1.21 -r1.22 src/sys/dev/usb/if_otus.c
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/usb/if_rum.c src/sys/dev/usb/if_url.c
cvs rdiff -u -r1.7 -r1.8 src/sys/dev/usb/if_run.c src/sys/dev/usb/if_upgt.c
cvs rdiff -u -r1.40 -r1.41 src/sys/dev/usb/if_udav.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/usb/if_ural.c
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/usb/if_urtw.c
cvs rdiff -u -r1.17 -r1.18 src/sys/dev/usb/if_urtwn.c
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/if_zyd.c
cvs rdiff -u -r1.230 -r1.231 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.133 -r1.134 src/sys/dev/usb/uaudio.c
cvs rdiff -u -r1.251 -r1.252 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.139 -r1.140 src/sys/dev/usb/usb.c
cvs rdiff -u -r1.187 -r1.188 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.147 -r1.148 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.84 -r1.85 src/sys/dev/usb/usbdi.h
cvs rdiff -u -r1.100 -r1.101 src/sys/dev/usb/usbdivar.h

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

Modified files:

Index: src/sys/dev/usb/auvitek_dtv.c
diff -u src/sys/dev/usb/auvitek_dtv.c:1.5 src/sys/dev/usb/auvitek_dtv.c:1.6
--- src/sys/dev/usb/auvitek_dtv.c:1.5	Mon Jan  9 10:57:34 2012
+++ src/sys/dev/usb/auvitek_dtv.c	Tue Jan 22 12:40:42 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $ */
+/* $NetBSD: auvitek_dtv.c,v 1.6 2013/01/22 12:40:42 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2011 Jared D. McNeill jmcne...@invisible.ca
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.5 2012/01/09 10:57:34 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: auvitek_dtv.c,v 1.6 2013/01/22 12:40:42 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -259,7 +259,7 @@ auvitek_dtv_init_pipes(struct auvitek_so
 
 	KERNEL_LOCK(1, curlwp);
 	err = usbd_open_pipe(sc-sc_bulk_iface, sc-sc_ab.ab_endpt,
-	USBD_EXCLUSIVE_USE, sc-sc_ab.ab_pipe);
+	USBD_EXCLUSIVE_USE|USBD_MPSAFE, sc-sc_ab.ab_pipe);
 	KERNEL_UNLOCK_ONE(curlwp);
 
 	if (err) {
Index: src/sys/dev/usb/if_smsc.c
diff -u src/sys/dev/usb/if_smsc.c:1.5 src/sys/dev/usb/if_smsc.c:1.6
--- src/sys/dev/usb/if_smsc.c:1.5	Sun Jan 13 15:34:03 2013
+++ src/sys/dev/usb/if_smsc.c	Tue Jan 22 12:40:43 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_smsc.c,v 1.5 2013/01/13 15:34:03 skrll Exp $	*/
+/*	$NetBSD: if_smsc.c,v 1.6 2013/01/22 12:40:43 jmcneill Exp $	*/
 
 /*	$OpenBSD: if_smsc.c,v 1.4 2012/09/27 12:38:11 jsg Exp $	*/
 /* $FreeBSD: src/sys/dev/usb/net/if_smsc.c,v 1.1 2012/08/15 04:03:55 gonzo Exp $ */
@@ -996,8 +996,8 @@ smsc_attach(device_t parent, device_t se
 		return;
 	}
 	/* Setup the endpoints for the SMSC LAN95xx device(s) */
-	usb_init_task(sc-sc_tick_task, smsc_tick_task, sc);
-	usb_init_task(sc-sc_stop_task, (void (*)(void *))smsc_stop, sc);
+	usb_init_task(sc-sc_tick_task, smsc_tick_task, sc, 0);
+	usb_init_task(sc-sc_stop_task, (void (*)(void *))smsc_stop, sc, 0);
 	mutex_init(sc-sc_mii_lock, MUTEX_DEFAULT, IPL_NONE);
 
 	err = usbd_device2interface_handle(dev, SMSC_IFACE_IDX, sc-sc_iface);

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.202 src/sys/dev/usb/ehci.c:1.203
--- src/sys/dev/usb/ehci.c:1.202	Tue Jan 15 17:45:05 2013
+++ src/sys/dev/usb/ehci.c	Tue Jan 22 12:40:42 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.202 2013/01/15 17:45:05 christos Exp $ */
+/*	$NetBSD: ehci.c,v 1.203 2013/01/22 12:40:42 jmcneill Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.202 2013/01/15 17:45:05 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: ehci.c,v 1.203 2013/01/22 12:40:42 jmcneill Exp $);
 
 #include ohci.h
 #include uhci.h
@@ -3228,7 +3228,8 @@ ehci_timeout(void *addr)
 	}
 
 	/* Execute the abort in a process context. */
-	usb_init_task(exfer-abort_task, 

CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 12:48:07 UTC 2013

Modified Files:
src/sys/dev/usb: usbdi.h

Log Message:
make USBD_TASKQ_MPSAFE the same value as USBD_MPSAFE, just in case


To generate a diff of this commit:
cvs rdiff -u -r1.85 -r1.86 src/sys/dev/usb/usbdi.h

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

Modified files:

Index: src/sys/dev/usb/usbdi.h
diff -u src/sys/dev/usb/usbdi.h:1.85 src/sys/dev/usb/usbdi.h:1.86
--- src/sys/dev/usb/usbdi.h:1.85	Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/usbdi.h	Tue Jan 22 12:48:07 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.h,v 1.85 2013/01/22 12:40:43 jmcneill Exp $	*/
+/*	$NetBSD: usbdi.h,v 1.86 2013/01/22 12:48:07 jmcneill Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -209,7 +209,7 @@ struct usb_task {
 #define	USB_TASKQ_DRIVER	1
 #define	USB_NUM_TASKQS		2
 #define	USB_TASKQ_NAMES		{usbtask-hc, usbtask-dr}
-#define	USB_TASKQ_MPSAFE	0x01
+#define	USB_TASKQ_MPSAFE	0x02
 
 void usb_add_task(usbd_device_handle, struct usb_task *, int);
 void usb_rem_task(usbd_device_handle, struct usb_task *);



CVS commit: src/sys/dev/usb

2013-01-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 22 13:03:25 UTC 2013

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

Log Message:
Remove unneeded semi-colons


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.32 src/sys/dev/usb/dwc_otg.c:1.33
--- src/sys/dev/usb/dwc_otg.c:1.32	Mon Jan 21 13:25:44 2013
+++ src/sys/dev/usb/dwc_otg.c	Tue Jan 22 13:03:25 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.32 2013/01/21 13:25:44 skrll Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.33 2013/01/22 13:03:25 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.32 2013/01/21 13:25:44 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.33 2013/01/22 13:03:25 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3696,7 +3696,7 @@ dwc_otg_setup_ctrl_chain(usbd_xfer_handl
 		done += temp.len;
 		if (temp.len)
 			temp.buf = (char *)KERNADDR(xfer-dmabuf, 0) + done;
-	};
+	}
 
 	/* Status Stage */
 	temp.buf = req;	/* XXXNH not needed */
@@ -3783,7 +3783,7 @@ dwc_otg_setup_data_chain(usbd_xfer_handl
 
 		len -= temp.len;
 		off += temp.len;
-	};
+	}
 
 	/* must have at least one frame! */
 	td = temp.td;
@@ -4079,7 +4079,7 @@ dwc_otg_standard_done(usbd_xfer_handle x
 		if (td == dxfer-td_transfer_last)
 			break;
 		td = td-obj_next;
-	};
+	}
 done:
 	dwc_otg_device_done(xfer, err);
 }



CVS commit: src/sys/dev/usb

2013-01-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Tue Jan 22 13:06:41 UTC 2013

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

Log Message:
Simplify dwc_otg_standard_done and always call dwc_host_channel_free on
the last (attempted) TD. We were leaking channels before.

Remove dwc_otg_device_done in the process.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.33 src/sys/dev/usb/dwc_otg.c:1.34
--- src/sys/dev/usb/dwc_otg.c:1.33	Tue Jan 22 13:03:25 2013
+++ src/sys/dev/usb/dwc_otg.c	Tue Jan 22 13:06:41 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.33 2013/01/22 13:03:25 skrll Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.34 2013/01/22 13:06:41 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.33 2013/01/22 13:03:25 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.34 2013/01/22 13:06:41 skrll Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -245,8 +245,6 @@ Static void		dwc_otg_worker(struct work 
 Static void		dwc_otg_rhc(void *);
 Static void		dwc_otg_vbus_interrupt(struct dwc_otg_softc *);
 Static void		dwc_otg_standard_done(usbd_xfer_handle);
-Static usbd_status	dwc_otg_standard_done_sub(usbd_xfer_handle);
-Static void		dwc_otg_device_done(usbd_xfer_handle, usbd_status);
 Static void		dwc_otg_setup_standard_chain(usbd_xfer_handle);
 Static void		dwc_otg_start_standard_chain(usbd_xfer_handle);
 
@@ -3994,120 +3992,51 @@ dwc_otg_rhc(void *addr)
 
 }
 
-Static usbd_status
-dwc_otg_standard_done_sub(usbd_xfer_handle xfer)
+Static void
+dwc_otg_standard_done(usbd_xfer_handle xfer)
 {
-	struct dwc_otg_xfer *dxfer = (struct dwc_otg_xfer *)xfer;
-	usbd_pipe_handle pipe = xfer-pipe;
+	struct dwc_otg_xfer *dxfer = DWC_OTG_XFER2DXFER(xfer);
+	struct dwc_otg_softc *sc = xfer-pipe-device-bus-hci_private;
 	struct dwc_otg_td *td;
-	uint32_t len;
-	usbd_status error;
+	usbd_status err = 0;
 
-	DPRINTFN(9, td %p\n, dxfer-td_transfer_cache);
+	DPRINTFN(13, xfer=%p endpoint=%p transfer done\n,
+	xfer, xfer-pipe-endpoint);
 
-	td = dxfer-td_transfer_cache;
+	/* reset scanner */
 
-	do {
-		xfer-actlen += td-actlen;
+	for (td = dxfer-td_transfer_first; ; td = td-obj_next) {
 
-		len = td-remainder;
+		xfer-actlen += td-actlen;
 
 		/* store last data toggle */
-		pipe-endpoint-datatoggle = td-toggle;
+		xfer-pipe-endpoint-datatoggle = td-toggle;
 
 		/* Check for transfer error */
 		if (td-error_any) {
 			/* the transfer is finished */
-			error = (td-error_stall ? USBD_STALLED : USBD_IOERROR);
-			td = NULL;
+			err = (td-error_stall ? USBD_STALLED : USBD_IOERROR);
 			break;
 		}
+
 		/* Check for short transfer */
-		if (len  0) {
-			//if (xfer-flags  USBD_SHORT_XFER_OK) {
-			if (0) {
-/* follow alt next */
-if (td-alt_next) {
-	td = td-obj_next;
-} else {
-	td = NULL;
-}
-			} else {
-/* the transfer is finished */
-td = NULL;
-			}
-			error = 0;
+		if (td-remainder  0) {
+			/* the transfer is finished */
+			err = 0;
 			break;
 		}
 
-		td = td-obj_next;
-
-		/* this USB frame is complete */
-		error = 0;
-		break;
-
-	} while (0);
-
-	/* update transfer cache */
-
-	dxfer-td_transfer_cache = td;
-
-	return error;
-}
-
-Static void
-dwc_otg_standard_done(usbd_xfer_handle xfer)
-{
-	struct dwc_otg_xfer *dxfer = DWC_OTG_XFER2DXFER(xfer);
-
-	struct dwc_otg_td *td;
-	usbd_status err = 0;
-
-	DPRINTFN(13, xfer=%p endpoint=%p transfer done\n,
-	xfer, xfer-pipe-endpoint);
-
-	/* reset scanner */
-
-	dxfer-td_transfer_cache = dxfer-td_transfer_first;
-	td = dxfer-td_transfer_first;
-
-	while (td != NULL) {
-		err = dwc_otg_standard_done_sub(xfer);
-		if (dxfer-td_transfer_cache == NULL) {
-			goto done;
-		}
+		/* this TD is complete - move onto next if more to do */
 		if (td == dxfer-td_transfer_last)
 			break;
-		td = td-obj_next;
 	}
-done:
-	dwc_otg_device_done(xfer, err);
-}
-
-
-/**
- *	dwc_otg_device_done
- *
- * NOTE: this function can be called more than one time on the
- * same USB transfer!
- **/
-Static void
-dwc_otg_device_done(usbd_xfer_handle xfer, usbd_status error)
-{
-	struct dwc_otg_xfer *dxfer = (struct dwc_otg_xfer *)xfer;
-	struct dwc_otg_softc *sc = DWC_OTG_XFER2SC(xfer);
-
-	DPRINTFN(9, xfer=%p, endpoint=%p, error=%d\n,
-	xfer, xfer-pipe-endpoint, error);
-	struct dwc_otg_td *td;
 
 	KASSERT(mutex_owned(sc-sc_intr_lock));
-	td = dxfer-td_transfer_first;
 
 	if (td != NULL)
 		dwc_otg_host_channel_free(td);
 
-	xfer-status = error;
+	xfer-status = err;
 	TAILQ_REMOVE(sc-sc_active, dxfer, xnext);
 
 	

CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 13:18:47 UTC 2013

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

Log Message:
Use usbd_setup_pipe_flags instead of usbd_setup_pipe so the supplied flags
get passed through.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/dev/usb/usbdi.c

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.148 src/sys/dev/usb/usbdi.c:1.149
--- src/sys/dev/usb/usbdi.c:1.148	Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/usbdi.c	Tue Jan 22 13:18:47 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.148 2013/01/22 12:40:43 jmcneill Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.148 2013/01/22 12:40:43 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -177,7 +177,7 @@ usbd_open_pipe_ival(usbd_interface_handl
  found:
 	if ((flags  USBD_EXCLUSIVE_USE)  ep-refcnt != 0)
 		return (USBD_IN_USE);
-	err = usbd_setup_pipe(iface-device, iface, ep, ival, p);
+	err = usbd_setup_pipe_flags(iface-device, iface, ep, ival, p, flags);
 	if (err)
 		return (err);
 	LIST_INSERT_HEAD(iface-pipes, p, next);
@@ -198,7 +198,7 @@ usbd_open_pipe_intr(usbd_interface_handl
 	DPRINTFN(3,(usbd_open_pipe_intr: address=0x%x flags=0x%x len=%d\n,
 		address, flags, len));
 
-	err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE,
+	err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE | flags,
   ipipe, ival);
 	if (err)
 		return (err);



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 13:27:59 UTC 2013

Modified Files:
src/sys/dev/usb: usbdi.c usbdi.h

Log Message:
usbd_open_pipe and usbd_open_pipe_intr take different flags! Make sure
the value of USBD_MPSAFE doesn't conflict with flags for either of them, as
it can be passed to both.


To generate a diff of this commit:
cvs rdiff -u -r1.149 -r1.150 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.86 -r1.87 src/sys/dev/usb/usbdi.h

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

Modified files:

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.149 src/sys/dev/usb/usbdi.c:1.150
--- src/sys/dev/usb/usbdi.c:1.149	Tue Jan 22 13:18:47 2013
+++ src/sys/dev/usb/usbdi.c	Tue Jan 22 13:27:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.150 2013/01/22 13:27:59 jmcneill Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.149 2013/01/22 13:18:47 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: usbdi.c,v 1.150 2013/01/22 13:27:59 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -198,7 +198,8 @@ usbd_open_pipe_intr(usbd_interface_handl
 	DPRINTFN(3,(usbd_open_pipe_intr: address=0x%x flags=0x%x len=%d\n,
 		address, flags, len));
 
-	err = usbd_open_pipe_ival(iface, address, USBD_EXCLUSIVE_USE | flags,
+	err = usbd_open_pipe_ival(iface, address,
+  USBD_EXCLUSIVE_USE | (flags  USBD_MPSAFE),
   ipipe, ival);
 	if (err)
 		return (err);

Index: src/sys/dev/usb/usbdi.h
diff -u src/sys/dev/usb/usbdi.h:1.86 src/sys/dev/usb/usbdi.h:1.87
--- src/sys/dev/usb/usbdi.h:1.86	Tue Jan 22 12:48:07 2013
+++ src/sys/dev/usb/usbdi.h	Tue Jan 22 13:27:59 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.h,v 1.86 2013/01/22 12:48:07 jmcneill Exp $	*/
+/*	$NetBSD: usbdi.h,v 1.87 2013/01/22 13:27:59 jmcneill Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -71,7 +71,7 @@ typedef void (*usbd_callback)(usbd_xfer_
 
 /* Open flags */
 #define USBD_EXCLUSIVE_USE	0x01
-#define USBD_MPSAFE		0x02
+#define USBD_MPSAFE		0x80
 
 /* Use default (specified by ep. desc.) interval on interrupt pipe */
 #define USBD_DEFAULT_INTERVAL	(-1)
@@ -209,7 +209,7 @@ struct usb_task {
 #define	USB_TASKQ_DRIVER	1
 #define	USB_NUM_TASKQS		2
 #define	USB_TASKQ_NAMES		{usbtask-hc, usbtask-dr}
-#define	USB_TASKQ_MPSAFE	0x02
+#define	USB_TASKQ_MPSAFE	0x80
 
 void usb_add_task(usbd_device_handle, struct usb_task *, int);
 void usb_rem_task(usbd_device_handle, struct usb_task *);



CVS commit: src/crypto/external/bsd/openssl

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 13:51:46 UTC 2013

Modified Files:
src/crypto/external/bsd/openssl: mkpc

Log Message:
print only the version as the full version confuses pkgconfig.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/crypto/external/bsd/openssl/mkpc

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

Modified files:

Index: src/crypto/external/bsd/openssl/mkpc
diff -u src/crypto/external/bsd/openssl/mkpc:1.1 src/crypto/external/bsd/openssl/mkpc:1.2
--- src/crypto/external/bsd/openssl/mkpc:1.1	Fri Jan 18 12:56:11 2013
+++ src/crypto/external/bsd/openssl/mkpc	Tue Jan 22 08:51:45 2013
@@ -1,9 +1,9 @@
 #!/bin/sh
-#	$NetBSD: mkpc,v 1.1 2013/01/18 17:56:11 christos Exp $
+#	$NetBSD: mkpc,v 1.2 2013/01/22 13:51:45 christos Exp $
 
 getversion() {
 	(echo '#include openssl/opensslv.h'; echo OPENSSL_VERSION_TEXT) |
-	cpp | grep OpenSSL | tr -d \
+	cpp | grep OpenSSL | cut -d ' ' -f 2
 }
 VERSION=$(getversion)
 
@@ -32,7 +32,7 @@ openssl.pc)
 esac
 
 cat  EOF  $1
-# \$NetBSD: mkpc,v 1.1 2013/01/18 17:56:11 christos Exp $
+# \$NetBSD: mkpc,v 1.2 2013/01/22 13:51:45 christos Exp $
 prefix=/usr
 exec_prefix=/usr
 libdir=/usr/lib



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 14:01:20 UTC 2013

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

Log Message:
default pipe is mpsafe, deal with it


To generate a diff of this commit:
cvs rdiff -u -r1.188 -r1.189 src/sys/dev/usb/usb_subr.c

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

Modified files:

Index: src/sys/dev/usb/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.188 src/sys/dev/usb/usb_subr.c:1.189
--- src/sys/dev/usb/usb_subr.c:1.188	Tue Jan 22 12:40:43 2013
+++ src/sys/dev/usb/usb_subr.c	Tue Jan 22 14:01:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.188 2013/01/22 12:40:43 jmcneill Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.189 2013/01/22 14:01:19 jmcneill Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: usb_subr.c,v 1.188 2013/01/22 12:40:43 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: usb_subr.c,v 1.189 2013/01/22 14:01:19 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -1171,8 +1171,8 @@ usbd_new_device(device_t parent, usbd_bu
 	dev-cookie.cookie = ++usb_cookie_no;
 
 	/* Establish the default pipe. */
-	err = usbd_setup_pipe(dev, 0, dev-def_ep, USBD_DEFAULT_INTERVAL,
-			  dev-default_pipe);
+	err = usbd_setup_pipe_flags(dev, 0, dev-def_ep, USBD_DEFAULT_INTERVAL,
+			  dev-default_pipe, USBD_MPSAFE);
 	if (err) {
 		usbd_remove_device(dev, up);
 		return (err);
@@ -1259,8 +1259,8 @@ usbd_new_device(device_t parent, usbd_bu
 
 	/* Re-establish the default pipe with the new address. */
 	usbd_kill_pipe(dev-default_pipe);
-	err = usbd_setup_pipe(dev, 0, dev-def_ep, USBD_DEFAULT_INTERVAL,
-	dev-default_pipe);
+	err = usbd_setup_pipe_flags(dev, 0, dev-def_ep, USBD_DEFAULT_INTERVAL,
+	dev-default_pipe, USBD_MPSAFE);
 	if (err) {
 		DPRINTFN(-1, (usbd_new_device: setup default pipe failed\n));
 		usbd_remove_device(dev, up);



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 14:03:20 UTC 2013

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

Log Message:
add missing flags param to usb_task_init


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/dev/usb/if_cue.c

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

Modified files:

Index: src/sys/dev/usb/if_cue.c
diff -u src/sys/dev/usb/if_cue.c:1.66 src/sys/dev/usb/if_cue.c:1.67
--- src/sys/dev/usb/if_cue.c:1.66	Tue Jan 22 12:40:42 2013
+++ src/sys/dev/usb/if_cue.c	Tue Jan 22 14:03:19 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_cue.c,v 1.66 2013/01/22 12:40:42 jmcneill Exp $	*/
+/*	$NetBSD: if_cue.c,v 1.67 2013/01/22 14:03:19 jmcneill Exp $	*/
 /*
  * Copyright (c) 1997, 1998, 1999, 2000
  *	Bill Paul wp...@ee.columbia.edu.  All rights reserved.
@@ -56,7 +56,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_cue.c,v 1.66 2013/01/22 12:40:42 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_cue.c,v 1.67 2013/01/22 14:03:19 jmcneill Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_inet.h
@@ -489,7 +489,7 @@ cue_attach(device_t parent, device_t sel
 	sc-cue_vendor = uaa-vendor;
 
 	usb_init_task(sc-cue_tick_task, cue_tick_task, sc, 0);
-	usb_init_task(sc-cue_stop_task, (void (*)(void *))cue_stop, sc);
+	usb_init_task(sc-cue_stop_task, (void (*)(void *))cue_stop, sc, 0);
 
 	err = usbd_device2interface_handle(dev, CUE_IFACE_IDX, iface);
 	if (err) {



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

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 14:03:44 UTC 2013

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

Log Message:
use usbdevices.config


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.42 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.43
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.42	Tue Jan 15 13:52:26 2013
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Tue Jan 22 14:03:43 2013
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.42 2013/01/15 13:52:26 jmcneill Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.43 2013/01/22 14:03:43 jmcneill Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -281,23 +281,11 @@ pseudo-device	wsfont
 prcm*		at obio1 addr 0x48306000 size 0x2000	# PRM Module
 
 # On-board USB
-#ohci*		at obio0 addr 0x48064400 size 0x0400 intr 76
 ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
-#usb*		at ohci?
 usb*		at ehci?
-uhub*		at usb?
-uhub*		at uhub? port ?
-umass*		at uhub? port ? configuration ? interface ?
-scsibus*	at scsi?
-sd*		at scsibus? target ? lun ?
-wd*		at umass?
-uhidev*		at uhub?
-ukbd*		at uhidev?
-ums*		at uhidev?
-wskbd*		at ukbd?
-wsmouse*	at ums?
 
-axe*		at uhub? port ? configuration ? interface ?
+include dev/usb/usbdevices.config
+
 ukphy*		at mii? phy ?
 
 # Hardware clocking and power management



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 15:19:48 UTC 2013

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

Log Message:
add USB_TASKQ_MPSAFE to usb_init_task args


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.34 src/sys/dev/usb/dwc_otg.c:1.35
--- src/sys/dev/usb/dwc_otg.c:1.34	Tue Jan 22 13:06:41 2013
+++ src/sys/dev/usb/dwc_otg.c	Tue Jan 22 15:19:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.34 2013/01/22 13:06:41 skrll Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.35 2013/01/22 15:19:48 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.34 2013/01/22 13:06:41 skrll Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.35 2013/01/22 15:19:48 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -478,7 +478,8 @@ dwc_otg_timeout(void *addr)
 	}
 
 	/* Execute the abort in a process context. */
-	usb_init_task(dxfer-abort_task, dwc_otg_timeout_task, addr);
+	usb_init_task(dxfer-abort_task, dwc_otg_timeout_task, addr,
+	USB_TASKQ_MPSAFE);
 	usb_add_task(dxfer-xfer.pipe-device, dxfer-abort_task,
 	USB_TASKQ_HC);
 }



CVS commit: src/share/man/man9

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 15:35:08 UTC 2013

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

Log Message:
document USBD_MPSAFE and USB_TASKQ_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/share/man/man9/usbdi.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/usbdi.9
diff -u src/share/man/man9/usbdi.9:1.24 src/share/man/man9/usbdi.9:1.25
--- src/share/man/man9/usbdi.9:1.24	Fri Jul 20 07:55:44 2012
+++ src/share/man/man9/usbdi.9	Tue Jan 22 15:35:08 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: usbdi.9,v 1.24 2012/07/20 07:55:44 mrg Exp $
+.\	$NetBSD: usbdi.9,v 1.25 2013/01/22 15:35:08 jmcneill Exp $
 .\
 .\ Copyright (c) 2012 Matthew R. Green
 .\ All rights reserved.
@@ -54,7 +54,7 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd July 20, 2012
+.Dd January 22, 2013
 .Dt USBDI 9
 .Os
 .Sh NAME
@@ -199,7 +199,7 @@
 .Fn usb_rem_task usbd_device_handle iface struct usb_task *task
 .Ft void
 .Fn usb_init_task struct usb_task *task void (*func)(void *) \
- void *arg
+ void *arg uint8_t flags
 .Ft const struct usb_devno *
 .Fn usb_lookup const struct usb_devno *tbl \
  u_int16_t vendor u_int16_t product
@@ -490,9 +490,12 @@ the
 .Fa address
 of this pipe and
 .Fa flags
-for this pipe which currently may be 0 or
+for this pipe which currently may be 0, or a combination of
 .Dv USBD_EXCLUSIVE_USE ,
-to enable exclusive access to this interface and address.
+to enable exclusive access to this interface and address, and
+.Dv USBD_MPSAFE ,
+to allow running transfer callbacks on this pipe without first acquiring
+.Dv kernel_lock .
 The
 .Fn usbd_open_pipe_intr
 takes additional arguments
@@ -923,9 +926,19 @@ function takes a pointer to a
 .Ft struct usb_task
 that will be initalised, a function to call for this task
 .Fa func ,
-and the argument to pass to
+the argument to pass to
 .Fa func ,
-.Fa arg .
+.Fa arg ,
+and the task flags
+.Fa flags .
+If the
+.Fa flags
+argument is
+.Dt USB_TASKQ_MPSAFE ,
+the
+.Fa func
+function will be called without first acquiring
+.Dt kernel_lock .
 .Pp
 To invoke the task callback the
 .Fn usb_add_task



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

2013-01-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 22 15:44:25 UTC 2013

Modified Files:
src/sys/arch/luna68k/dev: siotty.c spc.c timekeeper.c

Log Message:
Whitespace cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/sys/arch/luna68k/dev/siotty.c
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/luna68k/dev/spc.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/luna68k/dev/timekeeper.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/luna68k/dev/siotty.c
diff -u src/sys/arch/luna68k/dev/siotty.c:1.34 src/sys/arch/luna68k/dev/siotty.c:1.35
--- src/sys/arch/luna68k/dev/siotty.c:1.34	Sat Oct 13 06:16:18 2012
+++ src/sys/arch/luna68k/dev/siotty.c	Tue Jan 22 15:44:25 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: siotty.c,v 1.34 2012/10/13 06:16:18 tsutsui Exp $ */
+/* $NetBSD: siotty.c,v 1.35 2013/01/22 15:44:25 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: siotty.c,v 1.34 2012/10/13 06:16:18 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: siotty.c,v 1.35 2013/01/22 15:44:25 tsutsui Exp $);
 
 #include opt_ddb.h
 
@@ -59,7 +59,7 @@ __KERNEL_RCSID(0, $NetBSD: siotty.c,v 1
 
 static const uint8_t ch0_regs[6] = {
 	WR0_RSTINT,/* reset E/S interrupt */
-	WR1_RXALLS | WR1_TXENBL,	 	/* Rx per char, Tx */
+	WR1_RXALLS | WR1_TXENBL,		/* Rx per char, Tx */
 	0,	/* */
 	WR3_RX8BIT | WR3_RXENBL,		/* Rx */
 	WR4_BAUD96 | WR4_STOP1,			/* Tx/Rx */
@@ -77,7 +77,7 @@ struct siotty_softc {
 	device_t	sc_dev;
 	struct tty	*sc_tty;
 	struct sioreg	*sc_ctl;
-	u_int 		sc_flags;
+	u_int		sc_flags;
 	uint8_t		sc_wr[6];
 };
 
@@ -107,7 +107,7 @@ const struct cdevsw siotty_cdevsw = {
 	siostop, siotty, siopoll, nommap, ttykqfilter, D_TTY
 };
 
-static int 
+static int
 siotty_match(device_t parent, cfdata_t cf, void *aux)
 {
 	struct sio_attach_args *args = aux;
@@ -117,7 +117,7 @@ siotty_match(device_t parent, cfdata_t c
 	return 1;
 }
 
-static void 
+static void
 siotty_attach(device_t parent, device_t self, void *aux)
 {
 	struct sio_softc *scp = device_private(parent);
@@ -200,7 +200,7 @@ siostart(struct tty *tp)
 {
 	struct siotty_softc *sc;
 	int s, c;
- 
+
 	sc = device_lookup_private(siotty_cd, minor(tp-t_dev));
 	s = splserial();
 	if (tp-t_state  (TS_BUSY|TS_TIMEOUT|TS_TTSTOP))
@@ -222,14 +222,14 @@ siostop(struct tty *tp, int flag)
 {
 	int s;
 
-s = splserial();
-if (TS_BUSY == (tp-t_state  (TS_BUSY|TS_TTSTOP))) {
-/*
- * Device is transmitting; must stop it.
- */
+	s = splserial();
+	if (TS_BUSY == (tp-t_state  (TS_BUSY|TS_TTSTOP))) {
+		/*
+		 * Device is transmitting; must stop it.
+		 */
 		tp-t_state |= TS_FLUSH;
-}
-splx(s);
+	}
+	splx(s);
 }
 
 static int
@@ -331,7 +331,7 @@ siomctl(struct siotty_softc *sc, int con
 	sc-sc_wr[WR5] = wr5;
 	setsioreg(sc-sc_ctl, WR5, wr5);
 	val = 0;
-  done:
+ done:
 	splx(s);
 	return val;
 }
@@ -391,7 +391,7 @@ sioopen(dev_t dev, int flag, int mode, s
 		return error;
 	return (*tp-t_linesw-l_open)(dev, tp);
 }
- 
+
 int
 sioclose(dev_t dev, int flag, int mode, struct lwp *l)
 {
@@ -414,24 +414,24 @@ sioclose(dev_t dev, int flag, int mode, 
 	splx(s);
 	return ttyclose(tp);
 }
- 
+
 int
 sioread(dev_t dev, struct uio *uio, int flag)
 {
 	struct siotty_softc *sc;
 	struct tty *tp;
- 
+
 	sc = device_lookup_private(siotty_cd, minor(dev));
 	tp = sc-sc_tty;
 	return (*tp-t_linesw-l_read)(tp, uio, flag);
 }
- 
+
 int
 siowrite(dev_t dev, struct uio *uio, int flag)
 {
 	struct siotty_softc *sc;
 	struct tty *tp;
- 
+
 	sc = device_lookup_private(siotty_cd, minor(dev));
 	tp = sc-sc_tty;
 	return (*tp-t_linesw-l_write)(tp, uio, flag);
@@ -442,7 +442,7 @@ siopoll(dev_t dev, int events, struct lw
 {
 	struct siotty_softc *sc;
 	struct tty *tp;
- 
+
 	sc = device_lookup_private(siotty_cd, minor(dev));
 	tp = sc-sc_tty;
 	return ((*tp-t_linesw-l_poll)(tp, events, l));
@@ -508,7 +508,7 @@ struct tty *
 siotty(dev_t dev)
 {
 	struct siotty_softc *sc;
- 
+
 	sc = device_lookup_private(siotty_cd, minor(dev));
 	return sc-sc_tty;
 }

Index: src/sys/arch/luna68k/dev/spc.c
diff -u src/sys/arch/luna68k/dev/spc.c:1.9 src/sys/arch/luna68k/dev/spc.c:1.10
--- src/sys/arch/luna68k/dev/spc.c:1.9	Wed Jul 27 14:17:55 2011
+++ src/sys/arch/luna68k/dev/spc.c	Tue Jan 22 15:44:25 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: spc.c,v 1.9 2011/07/27 14:17:55 tsutsui Exp $ */
+/* $NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 #include sys/cdefs.h			/* RCS ID  Copyright macro defns */
 
-__KERNEL_RCSID(0, $NetBSD: spc.c,v 1.9 2011/07/27 14:17:55 tsutsui Exp $);
+__KERNEL_RCSID(0, $NetBSD: spc.c,v 1.10 2013/01/22 15:44:25 tsutsui Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -43,7 +43,7 

CVS commit: src/sys/arch/luna68k/stand/boot

2013-01-22 Thread Izumi Tsutsui
Module Name:src
Committed By:   tsutsui
Date:   Tue Jan 22 15:48:40 UTC 2013

Modified Files:
src/sys/arch/luna68k/stand/boot: Makefile autoconf.c disklabel.c
if_le.c locore.S omron_disklabel.h parse.c prf.c samachdep.h sc.c
scsireg.h sd.c

Log Message:
Whitespace cleanup.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/luna68k/stand/boot/Makefile \
src/sys/arch/luna68k/stand/boot/locore.S \
src/sys/arch/luna68k/stand/boot/samachdep.h
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/luna68k/stand/boot/autoconf.c
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/luna68k/stand/boot/disklabel.c \
src/sys/arch/luna68k/stand/boot/if_le.c \
src/sys/arch/luna68k/stand/boot/omron_disklabel.h \
src/sys/arch/luna68k/stand/boot/prf.c
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/luna68k/stand/boot/parse.c \
src/sys/arch/luna68k/stand/boot/sc.c
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/luna68k/stand/boot/scsireg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/luna68k/stand/boot/sd.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/luna68k/stand/boot/Makefile
diff -u src/sys/arch/luna68k/stand/boot/Makefile:1.8 src/sys/arch/luna68k/stand/boot/Makefile:1.9
--- src/sys/arch/luna68k/stand/boot/Makefile:1.8	Mon Jan 21 11:58:12 2013
+++ src/sys/arch/luna68k/stand/boot/Makefile	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.8 2013/01/21 11:58:12 tsutsui Exp $
+#	$NetBSD: Makefile,v 1.9 2013/01/22 15:48:40 tsutsui Exp $
 #	@(#)Makefile	8.2 (Berkeley) 8/15/93
 
 NOMAN= # defined
@@ -37,7 +37,7 @@ SRCS+=	trap.c
 SRCS+=	devopen.c
 SRCS+=	conf.c
 SRCS+=	machdep.c
-SRCS+=	getline.c parse.c 
+SRCS+=	getline.c parse.c
 SRCS+=	boot.c
 SRCS+=	cons.c prf.c awaitkey.c
 SRCS+=	romcons.c
Index: src/sys/arch/luna68k/stand/boot/locore.S
diff -u src/sys/arch/luna68k/stand/boot/locore.S:1.8 src/sys/arch/luna68k/stand/boot/locore.S:1.9
--- src/sys/arch/luna68k/stand/boot/locore.S:1.8	Mon Jan 21 11:58:12 2013
+++ src/sys/arch/luna68k/stand/boot/locore.S	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.8 2013/01/21 11:58:12 tsutsui Exp $	*/
+/*	$NetBSD: locore.S,v 1.9 2013/01/22 15:48:40 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -287,7 +287,7 @@ GLOBAL(_rtt)
 
 /*
  * Trap/interrupt vector routines
- */ 
+ */
 
 ENTRY_NOPROFILE(buserr)
 	tstl	_C_LABEL(nofault)	| device probe?
Index: src/sys/arch/luna68k/stand/boot/samachdep.h
diff -u src/sys/arch/luna68k/stand/boot/samachdep.h:1.8 src/sys/arch/luna68k/stand/boot/samachdep.h:1.9
--- src/sys/arch/luna68k/stand/boot/samachdep.h:1.8	Mon Jan 21 11:58:12 2013
+++ src/sys/arch/luna68k/stand/boot/samachdep.h	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: samachdep.h,v 1.8 2013/01/21 11:58:12 tsutsui Exp $	*/
+/*	$NetBSD: samachdep.h,v 1.9 2013/01/22 15:48:40 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1982, 1990, 1993
@@ -127,7 +127,7 @@ uint8_t *lance_eaddr(void *);
 bool lance_init(void *);
 int lance_get(void *, void *, size_t);
 bool lance_put(void *, void *, size_t);
-bool lance_end(void *); 
+bool lance_end(void *);
 int lance_intr(void);
 
 /* locore.S */

Index: src/sys/arch/luna68k/stand/boot/autoconf.c
diff -u src/sys/arch/luna68k/stand/boot/autoconf.c:1.6 src/sys/arch/luna68k/stand/boot/autoconf.c:1.7
--- src/sys/arch/luna68k/stand/boot/autoconf.c:1.6	Mon Jan 14 12:28:11 2013
+++ src/sys/arch/luna68k/stand/boot/autoconf.c	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: autoconf.c,v 1.6 2013/01/14 12:28:11 tsutsui Exp $	*/
+/*	$NetBSD: autoconf.c,v 1.7 2013/01/22 15:48:40 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -70,7 +70,7 @@
  *	@(#)autoconf.c	8.1 (Berkeley) 6/10/93
  */
 
-/* 
+/*
  * autoconf.c -- Determine mass storage and memory configuration for a machine.
  *  by A.Fujita, NOV-30-1991
  *

Index: src/sys/arch/luna68k/stand/boot/disklabel.c
diff -u src/sys/arch/luna68k/stand/boot/disklabel.c:1.2 src/sys/arch/luna68k/stand/boot/disklabel.c:1.3
--- src/sys/arch/luna68k/stand/boot/disklabel.c:1.2	Thu Jan 10 16:20:11 2013
+++ src/sys/arch/luna68k/stand/boot/disklabel.c	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: disklabel.c,v 1.2 2013/01/10 16:20:11 tsutsui Exp $	*/
+/*	$NetBSD: disklabel.c,v 1.3 2013/01/22 15:48:40 tsutsui Exp $	*/
 
 /*
  * Copyright (c) 1992 OMRON Corporation.
@@ -391,7 +391,7 @@ display(struct disklabel *lp)
 			else
 			cnputc(' ');
 			printf(- %d,
-			(pp-p_offset + 
+			(pp-p_offset +
 			pp-p_size + lp-d_secpercyl - 1) /
 			lp-d_secpercyl - 1);
 			if (pp-p_size % lp-d_secpercyl)
Index: src/sys/arch/luna68k/stand/boot/if_le.c
diff -u src/sys/arch/luna68k/stand/boot/if_le.c:1.2 src/sys/arch/luna68k/stand/boot/if_le.c:1.3
--- src/sys/arch/luna68k/stand/boot/if_le.c:1.2	Sun Jan 20 13:35:43 2013
+++ src/sys/arch/luna68k/stand/boot/if_le.c	Tue Jan 22 15:48:40 2013
@@ -1,4 +1,4 @@

CVS commit: src/share/man/man9

2013-01-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan 22 15:52:17 UTC 2013

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

Log Message:
Use correct macro.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/share/man/man9/usbdi.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/usbdi.9
diff -u src/share/man/man9/usbdi.9:1.25 src/share/man/man9/usbdi.9:1.26
--- src/share/man/man9/usbdi.9:1.25	Tue Jan 22 15:35:08 2013
+++ src/share/man/man9/usbdi.9	Tue Jan 22 15:52:17 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: usbdi.9,v 1.25 2013/01/22 15:35:08 jmcneill Exp $
+.\	$NetBSD: usbdi.9,v 1.26 2013/01/22 15:52:17 wiz Exp $
 .\
 .\ Copyright (c) 2012 Matthew R. Green
 .\ All rights reserved.
@@ -934,11 +934,11 @@ and the task flags
 If the
 .Fa flags
 argument is
-.Dt USB_TASKQ_MPSAFE ,
+.Dv USB_TASKQ_MPSAFE ,
 the
 .Fa func
 function will be called without first acquiring
-.Dt kernel_lock .
+.Dv kernel_lock .
 .Pp
 To invoke the task callback the
 .Fn usb_add_task



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 19:28:01 UTC 2013

Modified Files:
src/bin/csh: alloc.c csh.1 extern.h init.c

Log Message:
Remove alloc builtin, it did not work anyway since most modern malloc
implementation use a combination of sbrk/mmap.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/bin/csh/alloc.c
cvs rdiff -u -r1.50 -r1.51 src/bin/csh/csh.1
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/extern.h
cvs rdiff -u -r1.10 -r1.11 src/bin/csh/init.c

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

Modified files:

Index: src/bin/csh/alloc.c
diff -u src/bin/csh/alloc.c:1.12 src/bin/csh/alloc.c:1.13
--- src/bin/csh/alloc.c:1.12	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/alloc.c	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1983, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)alloc.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: alloc.c,v 1.12 2003/08/07 09:05:03 agc Exp $);
+__RCSID($NetBSD: alloc.c,v 1.13 2013/01/22 19:28:00 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -47,16 +47,11 @@ __RCSID($NetBSD: alloc.c,v 1.12 2003/08
 #include csh.h
 #include extern.h
 
-char *memtop = NULL;		/* PWP: top of current memory */
-char *membot = NULL;		/* PWP: bottom of allocatable memory */
-
 ptr_t
 Malloc(size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = malloc(n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -69,8 +64,6 @@ Realloc(ptr_t p, size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = realloc(p, n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -83,8 +76,6 @@ Calloc(size_t s, size_t n)
 {
 ptr_t ptr;
 
-if (membot == NULL)
-	memtop = membot = sbrk(0);
 if ((ptr = calloc(s, n)) == (ptr_t) 0) {
 	child++;
 	stderror(ERR_NOMEM);
@@ -98,20 +89,3 @@ Free(ptr_t p)
 if (p)
 	free(p);
 }
-
-/*
- * mstats - print out statistics about malloc
- *
- * Prints two lines of numbers, one showing the length of the free list
- * for each size category, the second showing the number of mallocs -
- * frees for each size category.
- */
-void
-/*ARGSUSED*/
-showall(Char **v, struct command *t)
-{
-memtop = (char *)sbrk(0);
-(void)fprintf(cshout, Allocated memory from 0x%lx to 0x%lx (%ld).\n,
-	(unsigned long)membot, (unsigned long)memtop, 
-	(unsigned long)(memtop - membot));
-}

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.50 src/bin/csh/csh.1:1.51
--- src/bin/csh/csh.1:1.50	Thu Mar 22 03:58:16 2012
+++ src/bin/csh/csh.1	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: csh.1,v 1.50 2012/03/22 07:58:16 wiz Exp $
+.\	$NetBSD: csh.1,v 1.51 2013/01/22 19:28:00 christos Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -1095,15 +1095,6 @@ is not allowed to be
 or
 .Ar unalias .
 .Pp
-.It Ic alloc
-Shows the amount of dynamic memory acquired, broken down into used and
-free memory.
-With an argument shows the number of free and used blocks in each size
-category.
-The categories start at size 8 and double at each step.
-This command's output may vary across system types, since
-systems other than the VAX may use a different memory allocator.
-.Pp
 .It Ic bg
 .It Ic bg \% Ns Ar job ...
 Puts the current or specified jobs into the background, continuing them

Index: src/bin/csh/extern.h
diff -u src/bin/csh/extern.h:1.25 src/bin/csh/extern.h:1.26
--- src/bin/csh/extern.h:1.25	Thu Dec 27 16:19:20 2012
+++ src/bin/csh/extern.h	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: extern.h,v 1.25 2012/12/27 21:19:20 christos Exp $ */
+/* $NetBSD: extern.h,v 1.26 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -301,7 +301,6 @@ void Free(ptr_t);
 ptr_t Malloc(size_t);
 ptr_t Realloc(ptr_t, size_t);
 ptr_t Calloc(size_t, size_t);
-void showall(Char **, struct command *);
 
 /*
  * str.c:

Index: src/bin/csh/init.c
diff -u src/bin/csh/init.c:1.10 src/bin/csh/init.c:1.11
--- src/bin/csh/init.c:1.10	Thu Aug  7 05:05:06 2003
+++ src/bin/csh/init.c	Tue Jan 22 14:28:00 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $ */
+/* $NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)init.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: init.c,v 1.10 2003/08/07 09:05:06 agc Exp $);
+__RCSID($NetBSD: init.c,v 1.11 2013/01/22 19:28:00 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -49,7 +49,6 @@ struct biltins bfunc[] =
 {
 { @, 		dolet, 		0, INF	},
 { alias, 		doalias, 	0, INF	},
-{ alloc, 		showall, 	0, 1	},
 { bg, 		dobg, 		0, INF	},
 { break, 		dobreak, 	0, 

CVS commit: src/lib/libedit

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:23:21 UTC 2013

Modified Files:
src/lib/libedit: editline.3 el.c histedit.h shlib_version

Log Message:
provide an el_init_fd function.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/lib/libedit/editline.3
cvs rdiff -u -r1.71 -r1.72 src/lib/libedit/el.c
cvs rdiff -u -r1.49 -r1.50 src/lib/libedit/histedit.h
cvs rdiff -u -r1.18 -r1.19 src/lib/libedit/shlib_version

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

Modified files:

Index: src/lib/libedit/editline.3
diff -u src/lib/libedit/editline.3:1.78 src/lib/libedit/editline.3:1.79
--- src/lib/libedit/editline.3:1.78	Thu Jan 10 11:03:06 2013
+++ src/lib/libedit/editline.3	Tue Jan 22 15:23:21 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: editline.3,v 1.78 2013/01/10 16:03:06 wiz Exp $
+.\	$NetBSD: editline.3,v 1.79 2013/01/22 20:23:21 christos Exp $
 .\
 .\ Copyright (c) 1997-2013 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -26,12 +26,13 @@
 .\ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd January 10, 2013
+.Dd January 22, 2013
 .Dt EDITLINE 3
 .Os
 .Sh NAME
 .Nm editline ,
 .Nm el_init ,
+.Nm el_init_fd ,
 .Nm el_end ,
 .Nm el_reset ,
 .Nm el_gets ,
@@ -77,6 +78,8 @@
 .In histedit.h
 .Ft EditLine *
 .Fn el_init const char *prog FILE *fin FILE *fout FILE *ferr
+.Ft EditLine *
+.Fn el_init_fd const char *prog FILE *fin FILE *fout FILE *ferr int fdin int fdout int fderr
 .Ft void
 .Fn el_end EditLine *e
 .Ft void
@@ -170,6 +173,8 @@ The line editing functions use a common 
 .Fa EditLine ,
 which is created by
 .Fn el_init
+or
+.Fn el_init_fd
 and freed by
 .Fn el_end .
 .Pp
@@ -193,11 +198,20 @@ are the input, output, and error streams
 In this documentation, references to
 .Dq the tty
 are actually to this input/output stream combination.
+.It Fn el_init_fd
+Like
+.Fn el_init
+but allows specifying file descriptors for the
+.Xr stdio 3
+corresponding streams, in case those were created with
+.Xr funopen 3 .
 .It Fn el_end
 Clean up and finish with
 .Fa e ,
 assumed to have been created with
-.Fn el_init .
+.Fn el_init
+or
+.Fn el_init_fd .
 .It Fn el_reset
 Reset the tty and the parser.
 This should be called after an error which may have upset the tty's

Index: src/lib/libedit/el.c
diff -u src/lib/libedit/el.c:1.71 src/lib/libedit/el.c:1.72
--- src/lib/libedit/el.c:1.71	Tue Sep 11 07:58:53 2012
+++ src/lib/libedit/el.c	Tue Jan 22 15:23:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: el.c,v 1.71 2012/09/11 11:58:53 christos Exp $	*/
+/*	$NetBSD: el.c,v 1.72 2013/01/22 20:23:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = @(#)el.c	8.2 (Berkeley) 1/3/94;
 #else
-__RCSID($NetBSD: el.c,v 1.71 2012/09/11 11:58:53 christos Exp $);
+__RCSID($NetBSD: el.c,v 1.72 2013/01/22 20:23:21 christos Exp $);
 #endif
 #endif /* not lint  not SCCSID */
 
@@ -60,6 +60,14 @@ __RCSID($NetBSD: el.c,v 1.71 2012/09/11
 public EditLine *
 el_init(const char *prog, FILE *fin, FILE *fout, FILE *ferr)
 {
+return el_init_fd(prog, fin, fout, ferr, fileno(fin), fileno(fout),
+	fileno(ferr));
+}
+
+public EditLine *
+el_init_fd(const char *prog, FILE *fin, FILE *fout, FILE *ferr,
+int fdin, int fdout, int fderr)
+{
 	EditLine *el = el_malloc(sizeof(*el));
 
 	if (el == NULL)
@@ -71,9 +79,9 @@ el_init(const char *prog, FILE *fin, FIL
 	el-el_outfile = fout;
 	el-el_errfile = ferr;
 
-	el-el_infd = fileno(fin);
-	el-el_outfd = fileno(fout);
-	el-el_errfd = fileno(ferr);
+	el-el_infd = fdin;
+	el-el_outfd = fdout;
+	el-el_errfd = fderr;
 
 	el-el_prog = Strdup(ct_decode_string(prog, el-el_scratch));
 	if (el-el_prog == NULL) {

Index: src/lib/libedit/histedit.h
diff -u src/lib/libedit/histedit.h:1.49 src/lib/libedit/histedit.h:1.50
--- src/lib/libedit/histedit.h:1.49	Thu May 31 09:16:39 2012
+++ src/lib/libedit/histedit.h	Tue Jan 22 15:23:21 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: histedit.h,v 1.49 2012/05/31 13:16:39 christos Exp $	*/
+/*	$NetBSD: histedit.h,v 1.50 2013/01/22 20:23:21 christos Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -84,6 +84,8 @@ typedef struct lineinfo {
  * Initialization, cleanup, and resetting
  */
 EditLine	*el_init(const char *, FILE *, FILE *, FILE *);
+EditLine	*el_init_fd(const char *, FILE *, FILE *, FILE *,
+int, int, int);
 void		 el_end(EditLine *);
 void		 el_reset(EditLine *);
 

Index: src/lib/libedit/shlib_version
diff -u src/lib/libedit/shlib_version:1.18 src/lib/libedit/shlib_version:1.19
--- src/lib/libedit/shlib_version:1.18	Sat Jan 10 22:07:48 2009
+++ src/lib/libedit/shlib_version	Tue Jan 22 15:23:21 2013
@@ -1,5 +1,5 @@
-#	$NetBSD: shlib_version,v 1.18 2009/01/11 03:07:48 christos Exp $
+#	$NetBSD: shlib_version,v 1.19 2013/01/22 20:23:21 christos Exp $
 #	Remember to update distrib/sets/lists/base/shl.* when changing
 #
 major=3
-minor=0
+minor=1



CVS commit: src/distrib/sets/lists

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:25:17 UTC 2013

Modified Files:
src/distrib/sets/lists/base: ad.mips64eb ad.mips64el md.amd64
md.sparc64 shl.mi
src/distrib/sets/lists/debug: ad.mips64eb ad.mips64el md.amd64
md.sparc64 shl.mi

Log Message:
bump libedit


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/distrib/sets/lists/base/ad.mips64eb \
src/distrib/sets/lists/base/ad.mips64el
cvs rdiff -u -r1.187 -r1.188 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.176 -r1.177 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.647 -r1.648 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.2 -r1.3 src/distrib/sets/lists/debug/ad.mips64eb \
src/distrib/sets/lists/debug/ad.mips64el
cvs rdiff -u -r1.3 -r1.4 src/distrib/sets/lists/debug/md.amd64 \
src/distrib/sets/lists/debug/md.sparc64 \
src/distrib/sets/lists/debug/shl.mi

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

Modified files:

Index: src/distrib/sets/lists/base/ad.mips64eb
diff -u src/distrib/sets/lists/base/ad.mips64eb:1.111 src/distrib/sets/lists/base/ad.mips64eb:1.112
--- src/distrib/sets/lists/base/ad.mips64eb:1.111	Thu Jan 17 17:12:52 2013
+++ src/distrib/sets/lists/base/ad.mips64eb	Tue Jan 22 15:25:16 2013
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.111 2013/01/17 22:12:52 christos Exp $
+# $NetBSD: ad.mips64eb,v 1.112 2013/01/22 20:25:16 christos Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -100,7 +100,7 @@
 ./usr/lib/64/libdwarf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libdwarf.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libedit.so.3			base-compat-shlib	compat,pic
-./usr/lib/64/libedit.so.3.0			base-compat-shlib	compat,pic
+./usr/lib/64/libedit.so.3.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libelf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libelf.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libevent.so.3			base-compat-shlib	compat,pic
@@ -414,7 +414,7 @@
 ./usr/lib/o32/libdwarf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libdwarf.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libedit.so.3			base-compat-shlib	compat,pic
-./usr/lib/o32/libedit.so.3.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libedit.so.3.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libelf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libelf.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libevent.so.3			base-compat-shlib	compat,pic
Index: src/distrib/sets/lists/base/ad.mips64el
diff -u src/distrib/sets/lists/base/ad.mips64el:1.111 src/distrib/sets/lists/base/ad.mips64el:1.112
--- src/distrib/sets/lists/base/ad.mips64el:1.111	Thu Jan 17 17:12:52 2013
+++ src/distrib/sets/lists/base/ad.mips64el	Tue Jan 22 15:25:16 2013
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.111 2013/01/17 22:12:52 christos Exp $
+# $NetBSD: ad.mips64el,v 1.112 2013/01/22 20:25:16 christos Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -98,7 +98,7 @@
 ./usr/lib/64/libdwarf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libdwarf.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libedit.so.3			base-compat-shlib	compat,pic
-./usr/lib/64/libedit.so.3.0			base-compat-shlib	compat,pic
+./usr/lib/64/libedit.so.3.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libelf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libelf.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libevent.so.3			base-compat-shlib	compat,pic
@@ -414,7 +414,7 @@
 ./usr/lib/o32/libdwarf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libdwarf.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libedit.so.3			base-compat-shlib	compat,pic
-./usr/lib/o32/libedit.so.3.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libedit.so.3.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libelf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libelf.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libevent.so.3			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.187 src/distrib/sets/lists/base/md.amd64:1.188
--- src/distrib/sets/lists/base/md.amd64:1.187	Thu Jan 17 17:12:52 2013
+++ src/distrib/sets/lists/base/md.amd64	Tue Jan 22 15:25:16 2013
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.187 2013/01/17 22:12:52 christos Exp $
+# $NetBSD: md.amd64,v 1.188 2013/01/22 20:25:16 christos Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -107,7 +107,7 @@
 ./usr/lib/i386/libdwarf.so.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libdwarf.so.0.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libedit.so.3			base-compat-shlib	compat,pic

CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:35:29 UTC 2013

Modified Files:
src/bin/csh: Makefile const.c csh.c csh.h extern.h glob.c lex.c set.c

Log Message:
Add a little libedit front end. Could be used as someone's pet project to
learn how to program. It is not enabled in the Makefile, and it states why
there.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/bin/csh/Makefile
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/const.c
cvs rdiff -u -r1.43 -r1.44 src/bin/csh/csh.c
cvs rdiff -u -r1.22 -r1.23 src/bin/csh/csh.h
cvs rdiff -u -r1.26 -r1.27 src/bin/csh/extern.h
cvs rdiff -u -r1.25 -r1.26 src/bin/csh/glob.c
cvs rdiff -u -r1.27 -r1.28 src/bin/csh/lex.c
cvs rdiff -u -r1.29 -r1.30 src/bin/csh/set.c

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

Modified files:

Index: src/bin/csh/Makefile
diff -u src/bin/csh/Makefile:1.33 src/bin/csh/Makefile:1.34
--- src/bin/csh/Makefile:1.33	Sun Aug 28 03:49:16 2011
+++ src/bin/csh/Makefile	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.33 2011/08/28 07:49:16 christos Exp $
+#	$NetBSD: Makefile,v 1.34 2013/01/22 20:35:29 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -10,6 +10,10 @@
 
 PROG=	csh
 DFLAGS=-DBUILTIN -DFILEC -DNLS -DSHORT_STRINGS
+# - Not integrated with history
+# - Does not handle escaped prompts.
+# - Does not do completion
+# DFLAGS+=-DEDIT
 CPPFLAGS+=-I${.CURDIR} -I. ${DFLAGS}
 SRCS=	alloc.c char.c const.c csh.c dir.c dol.c err.c exec.c exp.c file.c \
 	func.c glob.c hist.c init.c lex.c misc.c parse.c printf.c proc.c \
@@ -56,8 +60,13 @@ COPTS.err.c = -Wno-format-nonliteral
 COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
+.if 0
 LDADD+=-lutil
 DPADD+=${LIBUTIL}
+.elese
+LDADD+=-ledit -lutil
+DPADD+=${LIBEDIT} ${LIBUTIL}
+.endif
 
 .include bsd.prog.mk
 .include bsd.subdir.mk

Index: src/bin/csh/const.c
diff -u src/bin/csh/const.c:1.9 src/bin/csh/const.c:1.10
--- src/bin/csh/const.c:1.9	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/const.c	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: const.c,v 1.9 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $ */
 
 /*-
  * Copyright (c) 1991, 1993
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = @(#)const.c	8.1 (Berkeley) 5/31/93;
 #else
-__RCSID($NetBSD: const.c,v 1.9 2003/08/07 09:05:03 agc Exp $);
+__RCSID($NetBSD: const.c,v 1.10 2013/01/22 20:35:29 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -83,6 +83,7 @@ Char STRdot[]   = { '.', '\0' };
 Char STRdotdotsl[]	= { '.', '.', '/', '\0' };
 Char STRdotsl[]		= { '.', '/', '\0' };
 Char STRecho[]  = { 'e', 'c', 'h', 'o', '\0' };
+Char STRedit[]  = { 'e', 'd', 'i', 't', '\0' };
 Char STRequal[]		= { '=', '\0' };
 Char STRfakecom[]	= { '{', ' ', '.', '.', '.', ' ', '}', '\0' };
 Char STRfakecom1[]	= { '`', ' ', '.', '.', '.', ' ', '`', '\0' };

Index: src/bin/csh/csh.c
diff -u src/bin/csh/csh.c:1.43 src/bin/csh/csh.c:1.44
--- src/bin/csh/csh.c:1.43	Sun Jan 22 13:36:14 2012
+++ src/bin/csh/csh.c	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.c,v 1.43 2012/01/22 18:36:14 christos Exp $ */
+/* $NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT(@(#) Copyright (c) 1980, 19
 #if 0
 static char sccsid[] = @(#)csh.c	8.2 (Berkeley) 10/12/93;
 #else
-__RCSID($NetBSD: csh.c,v 1.43 2012/01/22 18:36:14 christos Exp $);
+__RCSID($NetBSD: csh.c,v 1.44 2013/01/22 20:35:29 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -105,8 +105,9 @@ static void mailchk(void);
 #ifndef _PATH_DEFPATH
 static Char **defaultpath(void);
 #endif
-
-int main(int, char *[]);
+#ifdef EDITING
+int	editing = 0;
+#endif
 
 int
 main(int argc, char *argv[])
@@ -1341,6 +1342,9 @@ printprompt(void)
 {
 Char *cp;
 
+if (editing)
+	return;
+
 if (!whyles) {
 	for (cp = value(STRprompt); *cp; cp++)
 	if (*cp == HIST)
@@ -1358,3 +1362,30 @@ printprompt(void)
 	(void)fprintf(cshout, ? );
 (void)fflush(cshout);
 }
+
+#ifdef EDIT
+char *
+printpromptstr(EditLine *elx) {
+static char pbuf[1024];
+static char qspace[] = ? ;
+Char *cp;
+size_t i;
+
+if (whyles)
+	return qspace;
+
+i = 0;
+for (cp = value(STRprompt); *cp; cp++) {
+	if (i = sizeof(pbuf))
+	break;
+	if (*cp == HIST)
+	i += snprintf(pbuf + i, sizeof(pbuf) - i, %d, eventno + 1);
+	else
+	pbuf[i++] = *cp;
+}
+if (i = sizeof(pbuf))
+	i = sizeof(pbuf) - 1;
+pbuf[i] = '\0';
+return pbuf;
+}
+#endif

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.22 src/bin/csh/csh.h:1.23
--- src/bin/csh/csh.h:1.22	Wed Nov  9 14:16:00 2011
+++ src/bin/csh/csh.h	Tue Jan 22 15:35:29 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.22 2011/11/09 19:16:00 christos Exp $ */
+/* $NetBSD: csh.h,v 1.23 

CVS commit: src/share/mk

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 20:43:17 UTC 2013

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

Log Message:
Make the libfoo.so.X.Y.debug files actually contain debug symbols if MKDEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.325 -r1.326 src/share/mk/bsd.lib.mk

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

Modified files:

Index: src/share/mk/bsd.lib.mk
diff -u src/share/mk/bsd.lib.mk:1.325 src/share/mk/bsd.lib.mk:1.326
--- src/share/mk/bsd.lib.mk:1.325	Tue Nov 13 17:30:38 2012
+++ src/share/mk/bsd.lib.mk	Tue Jan 22 15:43:17 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: bsd.lib.mk,v 1.325 2012/11/13 22:30:38 pooka Exp $
+#	$NetBSD: bsd.lib.mk,v 1.326 2013/01/22 20:43:17 christos Exp $
 #	@(#)bsd.lib.mk	8.3 (Berkeley) 4/22/94
 
 .include bsd.init.mk
@@ -47,6 +47,12 @@ CFLAGS+=${PIE_CFLAGS}
 AFLAGS+=${PIE_AFLAGS}
 .endif
 
+.if defined(MKDEBUG)  (${MKDEBUG} != no)
+# We only add -g to the shared library objects
+# because we don't currently split .a archives.
+CSHLIBFLAGS+=	-g
+.endif
+
 # Libraries that this may depend upon.
 .if defined(LIBDPLIBS)  ${MKPIC} != no# {
 .for _lib _dir in ${LIBDPLIBS}
@@ -238,7 +244,7 @@ CTFFLAGS+=	-g
 .c.pico:
 	${_MKTARGET_COMPILE}
 	${COMPILE.c} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
-.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
+.if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*) 
 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 
@@ -263,7 +269,7 @@ CTFFLAGS+=	-g
 .cc.pico .cpp.pico .cxx.pico .C.pico:
 	${_MKTARGET_COMPILE}
 	${COMPILE.cc} ${COPTS.${.IMPSRC:T}} ${CPUFLAGS.${.IMPSRC:T}} ${CPPFLAGS.${.IMPSRC:T}} ${CSHLIBFLAGS} ${.IMPSRC} -o ${.TARGET}
-.if !defined(CFLAGS) || empty(CFLAGS:M*-g*)
+.if !defined(CSHLIBFLAGS) || empty(CSHLIBFLAGS:M*-g*)
 	${OBJCOPY} ${OBJCOPYLIBFLAGS} ${.TARGET}
 .endif
 



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 20:50:04 UTC 2013

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

Log Message:
need to protect complete tailq with intr lock


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.35 src/sys/dev/usb/dwc_otg.c:1.36
--- src/sys/dev/usb/dwc_otg.c:1.35	Tue Jan 22 15:19:48 2013
+++ src/sys/dev/usb/dwc_otg.c	Tue Jan 22 20:50:04 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.35 2013/01/22 15:19:48 jmcneill Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.36 2013/01/22 20:50:04 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.35 2013/01/22 15:19:48 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.36 2013/01/22 20:50:04 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -420,11 +420,15 @@ dwc_otg_softintr(void *v)
 	DOTG_EVCNT_INCR(sc-sc_ev_soft_intr);
 
 	DPRINTF(\n);
+
+	mutex_spin_enter(sc-sc_intr_lock);
 	TAILQ_FOREACH_SAFE(dxfer, sc-sc_complete, xnext, tmp) {
 		TAILQ_REMOVE(sc-sc_complete, dxfer, xnext);
-
+		mutex_spin_exit(sc-sc_intr_lock);
 		usb_transfer_complete(dxfer-xfer);
+		mutex_spin_enter(sc-sc_intr_lock);
 	}
+	mutex_spin_exit(sc-sc_intr_lock);
 }
 
 Static void



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 21:12:32 UTC 2013

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

Log Message:
uhub is mpsafe


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 src/sys/dev/usb/uhub.c

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

Modified files:

Index: src/sys/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.121 src/sys/dev/usb/uhub.c:1.122
--- src/sys/dev/usb/uhub.c:1.121	Sat Jan  5 23:34:19 2013
+++ src/sys/dev/usb/uhub.c	Tue Jan 22 21:12:32 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.121 2013/01/05 23:34:19 christos Exp $	*/
+/*	$NetBSD: uhub.c,v 1.122 2013/01/22 21:12:32 jmcneill Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.121 2013/01/05 23:34:19 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.122 2013/01/22 21:12:32 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -259,8 +259,9 @@ uhub_attach(device_t parent, device_t se
 	sc-sc_explorepending = 1;
 
 	err = usbd_open_pipe_intr(iface, ed-bEndpointAddress,
-		  USBD_SHORT_XFER_OK, sc-sc_ipipe, sc, sc-sc_statusbuf,
-		  sc-sc_statuslen, uhub_intr, USBD_DEFAULT_INTERVAL);
+		  USBD_SHORT_XFER_OK|USBD_MPSAFE, sc-sc_ipipe, sc,
+		  sc-sc_statusbuf, sc-sc_statuslen,
+		  uhub_intr, USBD_DEFAULT_INTERVAL);
 	if (err) {
 		aprint_error_dev(self, cannot open interrupt pipe\n);
 		goto bad;



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 21:13:40 UTC 2013

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

Log Message:
umidi is mpsafe


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/dev/usb/umidi.c

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

Modified files:

Index: src/sys/dev/usb/umidi.c
diff -u src/sys/dev/usb/umidi.c:1.63 src/sys/dev/usb/umidi.c:1.64
--- src/sys/dev/usb/umidi.c:1.63	Sun Jun 10 06:15:54 2012
+++ src/sys/dev/usb/umidi.c	Tue Jan 22 21:13:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: umidi.c,v 1.63 2012/06/10 06:15:54 mrg Exp $	*/
+/*	$NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $	*/
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.63 2012/06/10 06:15:54 mrg Exp $);
+__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -513,7 +513,7 @@ alloc_pipe(struct umidi_endpoint *ep)
 	goto quit;
 	}
 	ep-next_slot = ep-buffer;
-	err = usbd_open_pipe(sc-sc_iface, ep-addr, 0, ep-pipe);
+	err = usbd_open_pipe(sc-sc_iface, ep-addr, USBD_MPSAFE, ep-pipe);
 	if (err)
 	usbd_free_xfer(ep-xfer);
 	ep-solicit_cookie = softint_establish(SOFTINT_CLOCK, out_solicit, ep);



CVS commit: src/bin/csh

2013-01-22 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Tue Jan 22 21:20:27 UTC 2013

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

Log Message:
Bump date for previous.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/bin/csh/csh.1

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

Modified files:

Index: src/bin/csh/csh.1
diff -u src/bin/csh/csh.1:1.51 src/bin/csh/csh.1:1.52
--- src/bin/csh/csh.1:1.51	Tue Jan 22 19:28:00 2013
+++ src/bin/csh/csh.1	Tue Jan 22 21:20:26 2013
@@ -1,4 +1,4 @@
-.\	$NetBSD: csh.1,v 1.51 2013/01/22 19:28:00 christos Exp $
+.\	$NetBSD: csh.1,v 1.52 2013/01/22 21:20:26 wiz Exp $
 .\
 .\ Copyright (c) 1980, 1990, 1993
 .\	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\
 .\	@(#)csh.1	8.2 (Berkeley) 1/21/94
 .\
-.Dd March 29, 2009
+.Dd January 22, 2013
 .Dt CSH 1
 .Os
 .Sh NAME



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 21:29:53 UTC 2013

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

Log Message:
since umidi and sequencer are mpsafe, mark umidi softint with SOFTINT_MPSAFE


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/dev/usb/umidi.c

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

Modified files:

Index: src/sys/dev/usb/umidi.c
diff -u src/sys/dev/usb/umidi.c:1.64 src/sys/dev/usb/umidi.c:1.65
--- src/sys/dev/usb/umidi.c:1.64	Tue Jan 22 21:13:39 2013
+++ src/sys/dev/usb/umidi.c	Tue Jan 22 21:29:53 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $	*/
+/*	$NetBSD: umidi.c,v 1.65 2013/01/22 21:29:53 jmcneill Exp $	*/
 /*
  * Copyright (c) 2001, 2012 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.64 2013/01/22 21:13:39 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: umidi.c,v 1.65 2013/01/22 21:29:53 jmcneill Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -516,7 +516,7 @@ alloc_pipe(struct umidi_endpoint *ep)
 	err = usbd_open_pipe(sc-sc_iface, ep-addr, USBD_MPSAFE, ep-pipe);
 	if (err)
 	usbd_free_xfer(ep-xfer);
-	ep-solicit_cookie = softint_establish(SOFTINT_CLOCK, out_solicit, ep);
+	ep-solicit_cookie = softint_establish(SOFTINT_CLOCK | SOFTINT_MPSAFE, out_solicit, ep);
 quit:
 	return err;
 }



CVS commit: [matt-nb6-plus] src/libexec/ld.elf_so

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 21:47:29 UTC 2013

Modified Files:
src/libexec/ld.elf_so [matt-nb6-plus]: Makefile headers.c rtld.c rtld.h
symbol.c
src/libexec/ld.elf_so/arch/arm [matt-nb6-plus]: Makefile.inc
rtld_start.S

Log Message:
Pullup from HEAD:
Add .init_array/.fini_array support (conditionalized on HAVE_INITFINI_ARRAY).


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.110.6.1 src/libexec/ld.elf_so/Makefile
cvs rdiff -u -r1.41.4.1 -r1.41.4.1.2.1 src/libexec/ld.elf_so/headers.c
cvs rdiff -u -r1.155 -r1.155.4.1 src/libexec/ld.elf_so/rtld.c
cvs rdiff -u -r1.107 -r1.107.4.1 src/libexec/ld.elf_so/rtld.h
cvs rdiff -u -r1.59 -r1.59.4.1 src/libexec/ld.elf_so/symbol.c
cvs rdiff -u -r1.11 -r1.11.46.1 src/libexec/ld.elf_so/arch/arm/Makefile.inc
cvs rdiff -u -r1.10 -r1.10.10.1 src/libexec/ld.elf_so/arch/arm/rtld_start.S

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

Modified files:

Index: src/libexec/ld.elf_so/Makefile
diff -u src/libexec/ld.elf_so/Makefile:1.110 src/libexec/ld.elf_so/Makefile:1.110.6.1
--- src/libexec/ld.elf_so/Makefile:1.110	Fri Oct  7 09:15:21 2011
+++ src/libexec/ld.elf_so/Makefile	Tue Jan 22 21:47:27 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.110 2011/10/07 09:15:21 mrg Exp $
+#	$NetBSD: Makefile,v 1.110.6.1 2013/01/22 21:47:27 matt Exp $
 #
 # NOTE: when changing ld.so, ensure that ldd still compiles.
 #
@@ -43,7 +43,7 @@ LDFLAGS+=	${${ACTIVE_CC} == clang:? -W
 LDFLAGS+=	-Wl,-static
 LDFLAGS+=	-Wl,--warn-shared-textrel
 
-CFLAGS+=	-fvisibility=hidden
+COPTS+=		-fvisibility=hidden
 
 # Adds SRCS, CPPFLAGS, LDFLAGS, etc.  Must go first so MD startup source
 # is first.
@@ -92,10 +92,10 @@ CPPFLAGS+=	-DCOMBRELOC
 #CPPFLAGS+=	-DRTLD_DEBUG
 #CPPFLAGS+=	-DRTLD_DEBUG_RELOC
 #DBG=		-g
-DBG=		-O3 -fomit-frame-pointer
+COPTS=		-O3 -fomit-frame-pointer
 
 .if ${MACHINE_ARCH} == i386 || ${MACHINE_ARCH} == x86_64
-DBG+=		-mno-3dnow -mno-mmx -mno-sse -mno-sse2 -mno-sse3
+COPTS+=		-mno-3dnow -mno-mmx -mno-sse -mno-sse2 -mno-sse3
 .endif
 
 

Index: src/libexec/ld.elf_so/headers.c
diff -u src/libexec/ld.elf_so/headers.c:1.41.4.1 src/libexec/ld.elf_so/headers.c:1.41.4.1.2.1
--- src/libexec/ld.elf_so/headers.c:1.41.4.1	Wed Aug  8 06:24:51 2012
+++ src/libexec/ld.elf_so/headers.c	Tue Jan 22 21:47:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: headers.c,v 1.41.4.1 2012/08/08 06:24:51 jdc Exp $	 */
+/*	$NetBSD: headers.c,v 1.41.4.1.2.1 2013/01/22 21:47:27 matt Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: headers.c,v 1.41.4.1 2012/08/08 06:24:51 jdc Exp $);
+__RCSID($NetBSD: headers.c,v 1.41.4.1.2.1 2013/01/22 21:47:27 matt Exp $);
 #endif /* not lint */
 
 #include err.h
@@ -227,10 +227,32 @@ _rtld_digest_dynamic(const char *execnam
 			init = dynp-d_un.d_ptr;
 			break;
 
+#ifdef HAVE_INITFINI_ARRAY
+		case DT_INIT_ARRAY:
+			obj-init_array =
+			(fptr_t *)(obj-relocbase + dynp-d_un.d_ptr);
+			break;
+
+		case DT_INIT_ARRAYSZ:
+			obj-init_arraysz = dynp-d_un.d_val / sizeof(fptr_t);
+			break;
+#endif
+
 		case DT_FINI:
 			fini = dynp-d_un.d_ptr;
 			break;
 
+#ifdef HAVE_INITFINI_ARRAY
+		case DT_FINI_ARRAY:
+			obj-fini_array =
+			(fptr_t *)(obj-relocbase + dynp-d_un.d_ptr);
+			break;
+
+		case DT_FINI_ARRAYSZ:
+			obj-fini_arraysz = dynp-d_un.d_val / sizeof(fptr_t); 
+			break;
+#endif
+
 		/*
 		 * Don't process DT_DEBUG on MIPS as the dynamic section
 		 * is mapped read-only. DT_MIPS_RLD_MAP is used instead.

Index: src/libexec/ld.elf_so/rtld.c
diff -u src/libexec/ld.elf_so/rtld.c:1.155 src/libexec/ld.elf_so/rtld.c:1.155.4.1
--- src/libexec/ld.elf_so/rtld.c:1.155	Fri Nov 25 21:27:15 2011
+++ src/libexec/ld.elf_so/rtld.c	Tue Jan 22 21:47:28 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: rtld.c,v 1.155 2011/11/25 21:27:15 joerg Exp $	 */
+/*	$NetBSD: rtld.c,v 1.155.4.1 2013/01/22 21:47:28 matt Exp $	 */
 
 /*
  * Copyright 1996 John D. Polstra.
@@ -40,7 +40,7 @@
 
 #include sys/cdefs.h
 #ifndef lint
-__RCSID($NetBSD: rtld.c,v 1.155 2011/11/25 21:27:15 joerg Exp $);
+__RCSID($NetBSD: rtld.c,v 1.155.4.1 2013/01/22 21:47:28 matt Exp $);
 #endif /* not lint */
 
 #include sys/param.h
@@ -134,13 +134,50 @@ static void _rtld_unload_object(sigset_t
 static void _rtld_unref_dag(Obj_Entry *);
 static Obj_Entry *_rtld_obj_from_addr(const void *);
 
+static inline void
+_rtld_call_initfini_function(fptr_t func, sigset_t *mask)
+{
+	_rtld_exclusive_exit(mask);
+	(*func)();
+	_rtld_exclusive_enter(mask);
+}
+
+static void
+_rtld_call_fini_function(Obj_Entry *obj, sigset_t *mask, u_int cur_objgen)
+{
+	if (obj-fini_arraysz == 0  (obj-fini == NULL || obj-fini_called)) {
+			return;
+	}
+	if (obj-fini != NULL  !obj-fini_called) {
+		dbg ((calling fini function %s at %p%s, obj-path,
+		(void *)obj-fini,
+		obj-z_initfirst ?  (DF_1_INITFIRST) : ));
+		obj-fini_called = 1; 
+		

CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Tue Jan 22 21:59:52 UTC 2013

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

Log Message:
no need for TAILQ_FOREACH_SAFE in dwc_otg_softintr


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.36 src/sys/dev/usb/dwc_otg.c:1.37
--- src/sys/dev/usb/dwc_otg.c:1.36	Tue Jan 22 20:50:04 2013
+++ src/sys/dev/usb/dwc_otg.c	Tue Jan 22 21:59:52 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.36 2013/01/22 20:50:04 jmcneill Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.37 2013/01/22 21:59:52 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.36 2013/01/22 20:50:04 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.37 2013/01/22 21:59:52 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -413,7 +413,7 @@ dwc_otg_softintr(void *v)
 {
 	struct usbd_bus *bus = v;
 	struct dwc_otg_softc *sc = bus-hci_private;
-	struct dwc_otg_xfer *dxfer, *tmp;
+	struct dwc_otg_xfer *dxfer;
 
 	KASSERT(sc-sc_bus.use_polling || mutex_owned(sc-sc_lock));
 
@@ -422,7 +422,7 @@ dwc_otg_softintr(void *v)
 	DPRINTF(\n);
 
 	mutex_spin_enter(sc-sc_intr_lock);
-	TAILQ_FOREACH_SAFE(dxfer, sc-sc_complete, xnext, tmp) {
+	while ((dxfer = TAILQ_FIRST(sc-sc_complete)) != NULL) {
 		TAILQ_REMOVE(sc-sc_complete, dxfer, xnext);
 		mutex_spin_exit(sc-sc_intr_lock);
 		usb_transfer_complete(dxfer-xfer);



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

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 22:09:44 UTC 2013

Modified Files:
src/sys/arch/x86/include: lock.h

Log Message:
Allow for non inlined definitions for RUMP


To generate a diff of this commit:
cvs rdiff -u -r1.26 -r1.27 src/sys/arch/x86/include/lock.h

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

Modified files:

Index: src/sys/arch/x86/include/lock.h
diff -u src/sys/arch/x86/include/lock.h:1.26 src/sys/arch/x86/include/lock.h:1.27
--- src/sys/arch/x86/include/lock.h:1.26	Thu Oct 11 07:12:21 2012
+++ src/sys/arch/x86/include/lock.h	Tue Jan 22 17:09:44 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.26 2012/10/11 11:12:21 apb Exp $	*/
+/*	$NetBSD: lock.h,v 1.27 2013/01/22 22:09:44 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
@@ -65,33 +65,25 @@ __cpu_simple_lock_clear(__cpu_simple_loc
 }
 
 #ifdef _HARDKERNEL
+# include machine/cpufunc.h
+# define SPINLOCK_SPIN_HOOK	/* nothing */
+# ifdef SPINLOCK_BACKOFF_HOOK
+#  undef SPINLOCK_BACKOFF_HOOK
+# endif
+# define SPINLOCK_BACKOFF_HOOK	x86_pause()
+# define SPINLOCK_INLINE
+#else /* !_HARDKERNEL */
+# define SPINLOCK_BODY
+# define SPINLOCK_INLINE static __inline __unused
+#endif /* _HARDKERNEL */
+
+SPINLOCK_INLINE void	__cpu_simple_lock_init(__cpu_simple_lock_t *);
+SPINLOCK_INLINE void	__cpu_simple_lock(__cpu_simple_lock_t *);
+SPINLOCK_INLINE int	__cpu_simple_lock_try(__cpu_simple_lock_t *);
+SPINLOCK_INLINE void	__cpu_simple_unlock(__cpu_simple_lock_t *);
 
-#include machine/cpufunc.h
-
-void	__cpu_simple_lock_init(__cpu_simple_lock_t *);
-void	__cpu_simple_lock(__cpu_simple_lock_t *);
-int	__cpu_simple_lock_try(__cpu_simple_lock_t *);
-void	__cpu_simple_unlock(__cpu_simple_lock_t *);
-
-#define	SPINLOCK_SPIN_HOOK	/* nothing */
-
-#ifdef SPINLOCK_BACKOFF_HOOK
-#undef SPINLOCK_BACKOFF_HOOK
-#endif
-#define	SPINLOCK_BACKOFF_HOOK	x86_pause()
-
-#else
-
-static __inline void __cpu_simple_lock_init(__cpu_simple_lock_t *)
-	__unused;
-static __inline void __cpu_simple_lock(__cpu_simple_lock_t *)
-	__unused;
-static __inline int __cpu_simple_lock_try(__cpu_simple_lock_t *)
-	__unused;
-static __inline void __cpu_simple_unlock(__cpu_simple_lock_t *)
-	__unused;
-
-static __inline void
+#ifdef SPINLOCK_BODY
+SPINLOCK_INLINE void
 __cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
 {
 
@@ -99,7 +91,7 @@ __cpu_simple_lock_init(__cpu_simple_lock
 	__insn_barrier();
 }
 
-static __inline int
+SPINLOCK_INLINE int
 __cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
 {
 	uint8_t val;
@@ -112,7 +104,7 @@ __cpu_simple_lock_try(__cpu_simple_lock_
 	return val == __SIMPLELOCK_UNLOCKED;
 }
 
-static __inline void
+SPINLOCK_INLINE void
 __cpu_simple_lock(__cpu_simple_lock_t *lockp)
 {
 
@@ -173,7 +165,7 @@ __cpu_simple_lock(__cpu_simple_lock_t *l
  *		reordered, however stores act as load fences, meaning that
  *		loads can not be reordered around stores.
  */
-static __inline void
+SPINLOCK_INLINE void
 __cpu_simple_unlock(__cpu_simple_lock_t *lockp)
 {
 
@@ -181,6 +173,6 @@ __cpu_simple_unlock(__cpu_simple_lock_t 
 	*lockp = __SIMPLELOCK_UNLOCKED;
 }
 
-#endif	/* _HARDKERNEL */
+#endif	/* SPINLOCK_BODY */
 
 #endif /* _X86_LOCK_H_ */



CVS commit: src/sys/rump/librump/rumpkern/arch/i386

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 22:10:22 UTC 2013

Modified Files:
src/sys/rump/librump/rumpkern/arch/i386: spinlock.c

Log Message:
use the definitions from lock.h


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/rump/librump/rumpkern/arch/i386/spinlock.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/rump/librump/rumpkern/arch/i386/spinlock.c
diff -u src/sys/rump/librump/rumpkern/arch/i386/spinlock.c:1.1 src/sys/rump/librump/rumpkern/arch/i386/spinlock.c:1.2
--- src/sys/rump/librump/rumpkern/arch/i386/spinlock.c:1.1	Mon May 31 18:31:07 2010
+++ src/sys/rump/librump/rumpkern/arch/i386/spinlock.c	Tue Jan 22 17:10:22 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: spinlock.c,v 1.1 2010/05/31 22:31:07 pooka Exp $	*/
+/*	$NetBSD: spinlock.c,v 1.2 2013/01/22 22:10:22 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2006 The NetBSD Foundation, Inc.
@@ -30,49 +30,10 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: spinlock.c,v 1.1 2010/05/31 22:31:07 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: spinlock.c,v 1.2 2013/01/22 22:10:22 christos Exp $);
 
 #define _HARDKERNEL /* XXX: non-inline prototypes */
+#define SPINLOCK_BODY
 #include x86/lock.h
 #undef _HARDKERNEL
-
-/*
- * Spinlocks, from src/sys/arch/x86/include/lock.h
- */
-void
-__cpu_simple_lock_init(__cpu_simple_lock_t *lockp)
-{
-
-	*lockp = __SIMPLELOCK_UNLOCKED;
-	__insn_barrier();
-}
-
-int
-__cpu_simple_lock_try(__cpu_simple_lock_t *lockp)
-{
-	uint8_t val;
-
-	val = __SIMPLELOCK_LOCKED;
-	__asm volatile (xchgb %0,(%2) : 
-	=r (val)
-	:0 (val), r (lockp));
-	__insn_barrier();
-	return val == __SIMPLELOCK_UNLOCKED;
-}
-
-void
-__cpu_simple_lock(__cpu_simple_lock_t *lockp)
-{
-
-	while (!__cpu_simple_lock_try(lockp))
-		/* nothing */;
-	__insn_barrier();
-}
-
-void
-__cpu_simple_unlock(__cpu_simple_lock_t *lockp)
-{
-
-	__insn_barrier();
-	*lockp = __SIMPLELOCK_UNLOCKED;
-}
+#undef SPINLOCK_BODY



CVS commit: src/bin/csh

2013-01-22 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Tue Jan 22 22:40:31 UTC 2013

Modified Files:
src/bin/csh: Makefile csh.h

Log Message:
fix compilation without -DEDIT


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/bin/csh/Makefile
cvs rdiff -u -r1.23 -r1.24 src/bin/csh/csh.h

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

Modified files:

Index: src/bin/csh/Makefile
diff -u src/bin/csh/Makefile:1.34 src/bin/csh/Makefile:1.35
--- src/bin/csh/Makefile:1.34	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/Makefile	Tue Jan 22 17:40:31 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.34 2013/01/22 20:35:29 christos Exp $
+#	$NetBSD: Makefile,v 1.35 2013/01/22 22:40:31 christos Exp $
 #	@(#)Makefile	8.1 (Berkeley) 5/31/93
 #
 # C Shell with process control; VM/UNIX VAX Makefile
@@ -61,11 +61,11 @@ COPTS.printf.c = -Wno-format-nonliteral
 COPTS.proc.c = -Wno-format-nonliteral
 
 .if 0
-LDADD+=-lutil
-DPADD+=${LIBUTIL}
-.elese
 LDADD+=-ledit -lutil
 DPADD+=${LIBEDIT} ${LIBUTIL}
+.else
+LDADD+=-lutil
+DPADD+=${LIBUTIL}
 .endif
 
 .include bsd.prog.mk

Index: src/bin/csh/csh.h
diff -u src/bin/csh/csh.h:1.23 src/bin/csh/csh.h:1.24
--- src/bin/csh/csh.h:1.23	Tue Jan 22 15:35:29 2013
+++ src/bin/csh/csh.h	Tue Jan 22 17:40:31 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: csh.h,v 1.23 2013/01/22 20:35:29 christos Exp $ */
+/* $NetBSD: csh.h,v 1.24 2013/01/22 22:40:31 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -552,7 +552,7 @@ Char **STR_environ;
 #ifdef EDIT
 #include histedit.h
 EditLine *el;
-int editing;
 #endif
+int editing;
 
 #endif /* !_CSH_H_ */



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

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 22:49:09 UTC 2013

Modified Files:
src/libexec/ld.elf_so/arch/arm: Makefile.inc

Log Message:
If you are using aapcs, you must be using INITFINI


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/libexec/ld.elf_so/arch/arm/Makefile.inc

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

Modified files:

Index: src/libexec/ld.elf_so/arch/arm/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.12 src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.13
--- src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.12	Wed Aug 15 03:46:07 2012
+++ src/libexec/ld.elf_so/arch/arm/Makefile.inc	Tue Jan 22 22:49:09 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.12 2012/08/15 03:46:07 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.13 2013/01/22 22:49:09 matt Exp $
 
 SRCS+=		rtld_start.S mdreloc.c
 
@@ -6,7 +6,8 @@ SRCS+=		rtld_start.S mdreloc.c
 CPPFLAGS+=	-fpic
 
 CPPFLAGS+=	-DELFSIZE=32
-.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb || \
+  ${CFLAGS:Mabi=aapcs} != 
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 .endif
 



CVS commit: src/lib/csu/arch/arm

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 22:49:48 UTC 2013

Modified Files:
src/lib/csu/arch/arm: Makefile.inc

Log Message:
If you are using aapcs, you must be using INITFINI


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/lib/csu/arch/arm/Makefile.inc

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

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.2 src/lib/csu/arch/arm/Makefile.inc:1.3
--- src/lib/csu/arch/arm/Makefile.inc:1.2	Sun Sep 16 13:46:49 2012
+++ src/lib/csu/arch/arm/Makefile.inc	Tue Jan 22 22:49:48 2013
@@ -1,3 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.2 2012/09/16 13:46:49 skrll Exp $
+# $NetBSD: Makefile.inc,v 1.3 2013/01/22 22:49:48 matt Exp $
 
 CPPFLAGS+=	-DELFSIZE=32
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
+|| ${CPUFLAGS:M-mabi=aapcs*} != 
+CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
+.endif



CVS commit: [matt-nb6-plus] src/lib/csu/arch/arm

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 22:56:36 UTC 2013

Modified Files:
src/lib/csu/arch/arm [matt-nb6-plus]: Makefile.inc

Log Message:
If we are using aapcs (EABI), we must be using init/fini arrays


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.1 -r1.1.10.2 src/lib/csu/arch/arm/Makefile.inc

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

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.1.10.1 src/lib/csu/arch/arm/Makefile.inc:1.1.10.2
--- src/lib/csu/arch/arm/Makefile.inc:1.1.10.1	Fri Nov 30 23:32:14 2012
+++ src/lib/csu/arch/arm/Makefile.inc	Tue Jan 22 22:56:35 2013
@@ -1,3 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.1.10.1 2012/11/30 23:32:14 matt Exp $
+# $NetBSD: Makefile.inc,v 1.1.10.2 2013/01/22 22:56:35 matt Exp $
 
 CPPFLAGS+=	-DELFSIZE=32
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
+|| ${CPUFLAGS:M-mabi=aapcs*} != 
+CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
+.endif



CVS commit: [matt-nb6-plus] src/lib/csu/common

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 22:56:58 UTC 2013

Modified Files:
src/lib/csu/common [matt-nb6-plus]: crt0-common.c

Log Message:
Pullup from HEAD:
Add support for init_array/fini_array (conditionalized on HAVE_INITFINI_ARRAY).
[This is needed for ARM EABI.]


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.7.6.1 src/lib/csu/common/crt0-common.c

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

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.7 src/lib/csu/common/crt0-common.c:1.7.6.1
--- src/lib/csu/common/crt0-common.c:1.7	Thu Jun 30 20:07:35 2011
+++ src/lib/csu/common/crt0-common.c	Tue Jan 22 22:56:58 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.7 2011/06/30 20:07:35 matt Exp $ */
+/* $NetBSD: crt0-common.c,v 1.7.6.1 2013/01/22 22:56:58 matt Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: crt0-common.c,v 1.7 2011/06/30 20:07:35 matt Exp $);
+__RCSID($NetBSD: crt0-common.c,v 1.7.6.1 2013/01/22 22:56:58 matt Exp $);
 
 #include sys/types.h
 #include sys/exec.h
@@ -49,8 +49,10 @@ __RCSID($NetBSD: crt0-common.c,v 1.7 20
 
 extern int main(int, char **, char **);
 
+#ifndef HAVE_INITFINI_ARRAY
 extern void	_init(void);
 extern void	_fini(void);
+#endif
 extern void	_libc_init(void);
 
 /*
@@ -85,6 +87,36 @@ do {		\
 	_exit(1);\
 } while (0)
 
+#ifdef HAVE_INITFINI_ARRAY
+/*
+ * If we are using INIT_ARRAY/FINI_ARRAY and we are linked statically,
+ * we have to process these instead of relying on RTLD to do it for us.
+ *
+ * Since we don't need .init or .fini sections, just code them in C
+ * to make life easier.
+ */
+extern const fptr_t init_array_start[] __weak_reference(__init_array_start);
+extern const fptr_t init_array_end[] __weak_reference(__init_array_end);
+extern const fptr_t fini_array_start[] __weak_reference(__fini_array_start);
+extern const fptr_t fini_array_end[] __weak_reference(__fini_array_end);
+
+static inline void
+_init(void)
+{
+	for (const fptr_t *f = init_array_start; f  init_array_end; f++) {
+		(*f)();
+	}
+}
+
+static void
+_fini(void)
+{
+	for (const fptr_t *f = fini_array_start; f  fini_array_end; f++) {
+		(*f)();
+	}
+}
+#endif /* HAVE_INITFINI_ARRAY */
+
 void
 ___start(void (*cleanup)(void),			/* from shared loader */
 const Obj_Entry *obj,			/* from shared loader */



CVS commit: src/lib/csu/common

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Tue Jan 22 22:57:37 UTC 2013

Modified Files:
src/lib/csu/common: crt0-common.c

Log Message:
Fix static weak (to extern weak)


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/lib/csu/common/crt0-common.c

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

Modified files:

Index: src/lib/csu/common/crt0-common.c
diff -u src/lib/csu/common/crt0-common.c:1.9 src/lib/csu/common/crt0-common.c:1.10
--- src/lib/csu/common/crt0-common.c:1.9	Mon Aug 13 02:15:35 2012
+++ src/lib/csu/common/crt0-common.c	Tue Jan 22 22:57:37 2013
@@ -1,4 +1,4 @@
-/* $NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $ */
+/* $NetBSD: crt0-common.c,v 1.10 2013/01/22 22:57:37 matt Exp $ */
 
 /*
  * Copyright (c) 1998 Christos Zoulas
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__RCSID($NetBSD: crt0-common.c,v 1.9 2012/08/13 02:15:35 matt Exp $);
+__RCSID($NetBSD: crt0-common.c,v 1.10 2013/01/22 22:57:37 matt Exp $);
 
 #include sys/types.h
 #include sys/exec.h
@@ -95,10 +95,10 @@ do {		\
  * Since we don't need .init or .fini sections, just code them in C
  * to make life easier.
  */
-static const fptr_t init_array_start[] __weak_reference(__init_array_start);
-static const fptr_t init_array_end[] __weak_reference(__init_array_end);
-static const fptr_t fini_array_start[] __weak_reference(__fini_array_start);
-static const fptr_t fini_array_end[] __weak_reference(__fini_array_end);
+extern const fptr_t init_array_start[] __weak_reference(__init_array_start);
+extern const fptr_t init_array_end[] __weak_reference(__init_array_end);
+extern const fptr_t fini_array_start[] __weak_reference(__fini_array_start);
+extern const fptr_t fini_array_end[] __weak_reference(__fini_array_end);
 
 static inline void
 _init(void)



CVS commit: [yamt-pagecache] src/sys/uvm

2013-01-22 Thread YAMAMOTO Takashi
Module Name:src
Committed By:   yamt
Date:   Wed Jan 23 00:38:02 UTC 2013

Modified Files:
src/sys/uvm [yamt-pagecache]: uvm_page_array.c

Log Message:
tweak assertions


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.6 -r1.1.2.7 src/sys/uvm/uvm_page_array.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/uvm/uvm_page_array.c
diff -u src/sys/uvm/uvm_page_array.c:1.1.2.6 src/sys/uvm/uvm_page_array.c:1.1.2.7
--- src/sys/uvm/uvm_page_array.c:1.1.2.6	Wed Aug  1 22:34:14 2012
+++ src/sys/uvm/uvm_page_array.c	Wed Jan 23 00:38:01 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: uvm_page_array.c,v 1.1.2.6 2012/08/01 22:34:14 yamt Exp $	*/
+/*	$NetBSD: uvm_page_array.c,v 1.1.2.7 2013/01/23 00:38:01 yamt Exp $	*/
 
 /*-
  * Copyright (c)2011 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uvm_page_array.c,v 1.1.2.6 2012/08/01 22:34:14 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: uvm_page_array.c,v 1.1.2.7 2013/01/23 00:38:01 yamt Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -171,15 +171,15 @@ uvm_page_array_fill(struct uvm_page_arra
 	for (i = 0; i  ar-ar_npages; i++) {
 		struct vm_page * const pg = ar-ar_pages[i];
 
-		KASSERT(pg != NULL);
-		KASSERT(pg-uobject == uobj);
+		KDASSERT(pg != NULL);
+		KDASSERT(pg-uobject == uobj);
 		if (backward) {
-			KASSERT(pg-offset = off);
-			KASSERT(i == 0 ||
+			KDASSERT(pg-offset = off);
+			KDASSERT(i == 0 ||
 			pg-offset  ar-ar_pages[i - 1]-offset);
 		} else {
-			KASSERT(pg-offset = off);
-			KASSERT(i == 0 ||
+			KDASSERT(pg-offset = off);
+			KDASSERT(i == 0 ||
 			pg-offset  ar-ar_pages[i - 1]-offset);
 		}
 	}



CVS commit: src/lib/csu/arch/arm

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 02:14:14 UTC 2013

Modified Files:
src/lib/csu/arch/arm: Makefile.inc

Log Message:
Handle CPUFLAGS being empty


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/lib/csu/arch/arm/Makefile.inc

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

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.3 src/lib/csu/arch/arm/Makefile.inc:1.4
--- src/lib/csu/arch/arm/Makefile.inc:1.3	Tue Jan 22 22:49:48 2013
+++ src/lib/csu/arch/arm/Makefile.inc	Wed Jan 23 02:14:14 2013
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.3 2013/01/22 22:49:48 matt Exp $
+# $NetBSD: Makefile.inc,v 1.4 2013/01/23 02:14:14 matt Exp $
 
 CPPFLAGS+=	-DELFSIZE=32
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
-|| ${CPUFLAGS:M-mabi=aapcs*} != 
+|| (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
 .endif



CVS commit: [matt-nb6-plus] src/lib/csu/arch/arm

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 02:14:54 UTC 2013

Modified Files:
src/lib/csu/arch/arm [matt-nb6-plus]: Makefile.inc

Log Message:
Handle CPUFLAGS being empty


To generate a diff of this commit:
cvs rdiff -u -r1.1.10.2 -r1.1.10.3 src/lib/csu/arch/arm/Makefile.inc

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

Modified files:

Index: src/lib/csu/arch/arm/Makefile.inc
diff -u src/lib/csu/arch/arm/Makefile.inc:1.1.10.2 src/lib/csu/arch/arm/Makefile.inc:1.1.10.3
--- src/lib/csu/arch/arm/Makefile.inc:1.1.10.2	Tue Jan 22 22:56:35 2013
+++ src/lib/csu/arch/arm/Makefile.inc	Wed Jan 23 02:14:54 2013
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile.inc,v 1.1.10.2 2013/01/22 22:56:35 matt Exp $
+# $NetBSD: Makefile.inc,v 1.1.10.3 2013/01/23 02:14:54 matt Exp $
 
 CPPFLAGS+=	-DELFSIZE=32
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
-|| ${CPUFLAGS:M-mabi=aapcs*} != 
+|| (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=  -DHAVE_INITFINI_ARRAY
 .endif



CVS commit: [matt-nb6-plus] src/libexec/ld.elf_so/arch/arm

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 02:15:53 UTC 2013

Modified Files:
src/libexec/ld.elf_so/arch/arm [matt-nb6-plus]: Makefile.inc

Log Message:
Handle CPUFLAGS being empty


To generate a diff of this commit:
cvs rdiff -u -r1.11.46.1 -r1.11.46.2 \
src/libexec/ld.elf_so/arch/arm/Makefile.inc

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

Modified files:

Index: src/libexec/ld.elf_so/arch/arm/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.11.46.1 src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.11.46.2
--- src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.11.46.1	Tue Jan 22 21:47:28 2013
+++ src/libexec/ld.elf_so/arch/arm/Makefile.inc	Wed Jan 23 02:15:53 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.11.46.1 2013/01/22 21:47:28 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.11.46.2 2013/01/23 02:15:53 matt Exp $
 
 SRCS+=		rtld_start.S mdreloc.c
 
@@ -6,7 +6,8 @@ SRCS+=		rtld_start.S mdreloc.c
 CPPFLAGS+=	-fpic
 
 CPPFLAGS+=	-DELFSIZE=32
-.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
+|| (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 .endif
 



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

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 02:18:50 UTC 2013

Modified Files:
src/libexec/ld.elf_so/arch/arm: Makefile.inc

Log Message:
Make sure CFLAGS is not empty.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/libexec/ld.elf_so/arch/arm/Makefile.inc

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

Modified files:

Index: src/libexec/ld.elf_so/arch/arm/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.13 src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.14
--- src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.13	Tue Jan 22 22:49:09 2013
+++ src/libexec/ld.elf_so/arch/arm/Makefile.inc	Wed Jan 23 02:18:50 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.13 2013/01/22 22:49:09 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.14 2013/01/23 02:18:50 matt Exp $
 
 SRCS+=		rtld_start.S mdreloc.c
 
@@ -6,8 +6,8 @@ SRCS+=		rtld_start.S mdreloc.c
 CPPFLAGS+=	-fpic
 
 CPPFLAGS+=	-DELFSIZE=32
-.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb || \
-  ${CFLAGS:Mabi=aapcs} != 
+.if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
+|| (!empty(CFLAGS)  ${CFLAGS:Mabi=aapcs} != )
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 .endif
 



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

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 02:31:54 UTC 2013

Modified Files:
src/libexec/ld.elf_so/arch/arm: Makefile.inc

Log Message:
Handle CPUFLAGS being empty


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/libexec/ld.elf_so/arch/arm/Makefile.inc

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

Modified files:

Index: src/libexec/ld.elf_so/arch/arm/Makefile.inc
diff -u src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.14 src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.15
--- src/libexec/ld.elf_so/arch/arm/Makefile.inc:1.14	Wed Jan 23 02:18:50 2013
+++ src/libexec/ld.elf_so/arch/arm/Makefile.inc	Wed Jan 23 02:31:54 2013
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.14 2013/01/23 02:18:50 matt Exp $
+#	$NetBSD: Makefile.inc,v 1.15 2013/01/23 02:31:54 matt Exp $
 
 SRCS+=		rtld_start.S mdreloc.c
 
@@ -7,7 +7,7 @@ CPPFLAGS+=	-fpic
 
 CPPFLAGS+=	-DELFSIZE=32
 .if ${MACHINE_ARCH} == earm || ${MACHINE_ARCH} == earmeb \
-|| (!empty(CFLAGS)  ${CFLAGS:Mabi=aapcs} != )
+|| (!empty(CPUFLAGS)  ${CPUFLAGS:M-mabi=aapcs*} != )
 CPPFLAGS+=	-DHAVE_INITFINI_ARRAY
 .endif
 



CVS commit: src/sys/dev/usb

2013-01-22 Thread Jared D. McNeill
Module Name:src
Committed By:   jmcneill
Date:   Wed Jan 23 03:32:39 UTC 2013

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

Log Message:
dwc_otg_timer: need to hold intr lock when accessing sc_active queue


To generate a diff of this commit:
cvs rdiff -u -r1.37 -r1.38 src/sys/dev/usb/dwc_otg.c

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

Modified files:

Index: src/sys/dev/usb/dwc_otg.c
diff -u src/sys/dev/usb/dwc_otg.c:1.37 src/sys/dev/usb/dwc_otg.c:1.38
--- src/sys/dev/usb/dwc_otg.c:1.37	Tue Jan 22 21:59:52 2013
+++ src/sys/dev/usb/dwc_otg.c	Wed Jan 23 03:32:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: dwc_otg.c,v 1.37 2013/01/22 21:59:52 jmcneill Exp $	*/
+/*	$NetBSD: dwc_otg.c,v 1.38 2013/01/23 03:32:39 jmcneill Exp $	*/
 
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
@@ -60,7 +60,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.37 2013/01/22 21:59:52 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: dwc_otg.c,v 1.38 2013/01/23 03:32:39 jmcneill Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -3192,14 +3192,13 @@ dwc_otg_timer(struct dwc_otg_softc *sc)
 	/* increment timer value */
 	sc-sc_tmr_val++;
 
+	mutex_spin_enter(sc-sc_intr_lock);
 	TAILQ_FOREACH(xfer, sc-sc_active, xnext) {
 		td = xfer-td_transfer_cache;
 		if (td != NULL)
 			td-did_nak = 0;
 	}
-
 	/* poll jobs */
-	mutex_spin_enter(sc-sc_intr_lock);
 	dwc_otg_interrupt_poll(sc);
 	mutex_spin_exit(sc-sc_intr_lock);
 



CVS commit: src/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 05:44:52 UTC 2013

Added Files:
src/lib/libc/arch/arm/string: strncat_naive.S

Log Message:
Add simple version of strncat for ARM.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/lib/libc/arch/arm/string/strncat_naive.S

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

Added files:

Index: src/lib/libc/arch/arm/string/strncat_naive.S
diff -u /dev/null src/lib/libc/arch/arm/string/strncat_naive.S:1.1
--- /dev/null	Wed Jan 23 05:44:52 2013
+++ src/lib/libc/arch/arm/string/strncat_naive.S	Wed Jan 23 05:44:52 2013
@@ -0,0 +1,53 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 machine/asm.h
+
+RCSID($NetBSD: strncat_naive.S,v 1.1 2013/01/23 05:44:52 matt Exp $)
+
+/* LINTSTUB: char *strncat(char *, const char *, size_t) */
+ENTRY(strncat)
+	teq	r2, #0			/* count is 0? */
+	RETc(eq)			/*   yes, just return dst */
+	mov	ip, r0			/* need to preserve r0 */
+1:	ldrb	r3, [ip], #1		/* load next byte */
+	teq	r3, #0			/* was it a NUL? */
+	bne	1b			/*   no, get next byte */
+	sub	ip, ip, #1		/* back up one to the NUL */
+2:	subs	r2, r2, #1		/* subtract 1 from the count */
+	blt	3f			/*   0? write terminating NUL */
+	ldrb	r3, [r1], #1		/* load next byte from append */
+	strb	r3, [ip], #1		/* store it */
+	teq	r3, #0			/* was it a NUL? */
+	bne	2b			/*   no, get next byte */
+	RET/* return */
+3:	mov	r3, #0			/* load a NUL */
+	strb	r3, [ip]		/* store it */
+	RET/* return */
+END(strncat)



CVS commit: src/common/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 05:46:17 UTC 2013

Added Files:
src/common/lib/libc/arch/arm/string: strcat.S strchr.S strrchr.S

Log Message:
Switch to using ARM assembly versions of strcat, strchr, strrchr.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/string/strcat.S \
src/common/lib/libc/arch/arm/string/strchr.S \
src/common/lib/libc/arch/arm/string/strrchr.S

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

Added files:

Index: src/common/lib/libc/arch/arm/string/strcat.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strcat.S:1.1
--- /dev/null	Wed Jan 23 05:46:17 2013
+++ src/common/lib/libc/arch/arm/string/strcat.S	Wed Jan 23 05:46:17 2013
@@ -0,0 +1,7 @@
+/* $NetBSD: strcat.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */
+
+#if defined(_STANDALONE)
+#include strcat_naive.S
+#else
+#include strcat_arm.S
+#endif
Index: src/common/lib/libc/arch/arm/string/strchr.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strchr.S:1.1
--- /dev/null	Wed Jan 23 05:46:17 2013
+++ src/common/lib/libc/arch/arm/string/strchr.S	Wed Jan 23 05:46:17 2013
@@ -0,0 +1,7 @@
+/* $NetBSD: strchr.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */
+
+#if defined(_STANDALONE)
+#include strchr_naive.S
+#else
+#include strchr_arm.S
+#endif
Index: src/common/lib/libc/arch/arm/string/strrchr.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strrchr.S:1.1
--- /dev/null	Wed Jan 23 05:46:17 2013
+++ src/common/lib/libc/arch/arm/string/strrchr.S	Wed Jan 23 05:46:17 2013
@@ -0,0 +1,7 @@
+/* $NetBSD: strrchr.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */
+
+#if defined(_STANDALONE)
+#include strrchr_naive.S
+#else
+#include strrchr_arm.S
+#endif



CVS commit: src/sys/dev/usb

2013-01-22 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Wed Jan 23 06:53:31 UTC 2013

Modified Files:
src/sys/dev/usb: usbdivar.h

Log Message:
Whitespace


To generate a diff of this commit:
cvs rdiff -u -r1.101 -r1.102 src/sys/dev/usb/usbdivar.h

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

Modified files:

Index: src/sys/dev/usb/usbdivar.h
diff -u src/sys/dev/usb/usbdivar.h:1.101 src/sys/dev/usb/usbdivar.h:1.102
--- src/sys/dev/usb/usbdivar.h:1.101	Tue Jan 22 12:40:44 2013
+++ src/sys/dev/usb/usbdivar.h	Wed Jan 23 06:53:30 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdivar.h,v 1.101 2013/01/22 12:40:44 jmcneill Exp $	*/
+/*	$NetBSD: usbdivar.h,v 1.102 2013/01/23 06:53:30 skrll Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -264,7 +264,7 @@ struct usbd_xfer {
 #define UXFER_ABORTWAIT	0x02	/* abort completion is being awaited. */
 	kcondvar_t		hccv; /* private use by the HC driver */
 
-struct callout timeout_handle;
+	struct callout timeout_handle;
 };
 
 void usbd_init(void);
@@ -295,9 +295,9 @@ usbd_status	usbd_setup_pipe_flags(usbd_d
   usbd_pipe_handle *pipe,
   uint8_t flags);
 usbd_status	usbd_new_device(device_t, usbd_bus_handle, int, int, int,
-struct usbd_port *);
+struct usbd_port *);
 usbd_status	usbd_reattach_device(device_t, usbd_device_handle,
- int, const int *);
+ int, const int *);
 
 void		usbd_remove_device(usbd_device_handle, struct usbd_port *);
 int		usbd_printBCD(char *, size_t, int);



CVS commit: src/common/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 06:59:55 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/string: strlen_arm.S strlen_naive.S

Log Message:
Add support for strnlen.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libc/arch/arm/string/strlen_arm.S \
src/common/lib/libc/arch/arm/string/strlen_naive.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/string/strlen_arm.S
diff -u src/common/lib/libc/arch/arm/string/strlen_arm.S:1.2 src/common/lib/libc/arch/arm/string/strlen_arm.S:1.3
--- src/common/lib/libc/arch/arm/string/strlen_arm.S:1.2	Wed Jan  9 00:01:07 2013
+++ src/common/lib/libc/arch/arm/string/strlen_arm.S	Wed Jan 23 06:59:55 2013
@@ -29,7 +29,7 @@
 
 #include machine/asm.h
 
-RCSID($NetBSD: strlen_arm.S,v 1.2 2013/01/09 00:01:07 matt Exp $)
+RCSID($NetBSD: strlen_arm.S,v 1.3 2013/01/23 06:59:55 matt Exp $)
 
 #ifdef __ARMEL__
 #define	BYTE0	0x00ff
@@ -43,16 +43,34 @@ RCSID($NetBSD: strlen_arm.S,v 1.2 2013/
 #define	BYTE3	0x00ff
 #endif
 
+#ifdef STRNLEN
+#define	FUNCNAME	strnlen
+#else
+#define	FUNCNAME	strlen
+#endif
+
 	.text
-ENTRY(strlen)
+ENTRY(FUNCNAME)
+#ifdef STRNLEN
+	push	{r4,r5}			/* save some registers */
+	add	r5, r0, r1		/* get ptr to end of string */
+	mov	r4, r1			/* save maxlen */
+#endif
 	add	ip, r0, #4		/* for the final post-inc */
 1:	tst	r0, #3			/* test for word alignment */
 	beq	.Lpre_main_loop		/*   finally word aligned */
+#ifdef STRNLEN
+	cmp	r0, r5			/* have we gone too far? */
+	beq	.Lmaxed_out		/*   yes, return maxlen */
+#endif
 	ldrb	r3, [r0], #1		/* load a byte */
 	teq	r3, #0			/* is it 0? */
 	bne	1b			/*   no, try next byte */
 	sub	ip, ip, #3		/* subtract (4 - the NUL) */
 	sub	r0, r0, ip		/* subtract start */
+#ifdef STRNLEN
+	pop	{r4, r5}		/* restore registers */
+#endif
 	RET/* return */
 .Lpre_main_loop:
 #if defined(_ARM_ARCH_7)
@@ -64,6 +82,10 @@ ENTRY(strlen)
 	orr	r1, r1, r1, lsl #16	/* move to next halfword */
 #endif /* _ARM_ARCH_6 */
 .Lmain_loop:
+#ifdef STRNLEN
+	cmp	r0, r5			/* gone too far? */
+	bge	.Lmaxed_out		/*   yes, return maxlen */
+#endif
 	ldr	r3, [r0], #4		/* load next word */
 #if defined(_ARM_ARCH_6)
 	/*
@@ -116,5 +138,17 @@ ENTRY(strlen)
 	 * the post-inc.
 	 */
 	sub	r0, r0, ip		/* subtract start to get length */
-	RET
-END(strlen)
+#ifdef STRNLEN
+	cmp	r0, r4			/* is it larger than maxlen? */
+	movgt	r0, r4			/*   yes, return maxlen */
+	pop	{r4, r5}		/* restore registers */
+#endif
+	RET/* return */
+
+#ifdef STRNLEN
+.Lmaxed_out:
+	mov	r0, r4			/* return maxlen */
+	pop	{r4, r5}		/* restore registers */
+	RET/* return */
+#endif
+END(FUNCNAME)
Index: src/common/lib/libc/arch/arm/string/strlen_naive.S
diff -u src/common/lib/libc/arch/arm/string/strlen_naive.S:1.2 src/common/lib/libc/arch/arm/string/strlen_naive.S:1.3
--- src/common/lib/libc/arch/arm/string/strlen_naive.S:1.2	Tue Jan  8 16:58:59 2013
+++ src/common/lib/libc/arch/arm/string/strlen_naive.S	Wed Jan 23 06:59:55 2013
@@ -28,8 +28,24 @@
  */
 #include machine/asm.h
 
-RCSID($NetBSD: strlen_naive.S,v 1.2 2013/01/08 16:58:59 pgoyette Exp $)
+RCSID($NetBSD: strlen_naive.S,v 1.3 2013/01/23 06:59:55 matt Exp $)
 
+#ifdef STRNLEN
+/* LINTSTUB: size_t strnlen(const char *, size_t) */
+ENTRY(strnlen)
+	add	ip, r0, #1	/* start of src + NUL */
+	add	r2, r0, r1	/* src[maxlen] */
+1:	cmp	r0, r2		/* is this of string? */
+	beq	2f		/*   yes it is */
+	ldrb	r3, [r0], #1	/* read a byte */
+	teq	r3, #0		/* is it a NUL? */
+	bne	1b		/*   no, get next byte */
+	sub	r0, r0, ip	/* get difference between start and end */
+	RET			/* return */
+2:	mov	r0, r1		/* get maxlen */
+	RET			/* return */
+END(strnlen)
+#else /* STRNLEN */
 /* LINTSTUB: size_t strlen(const char *) */
 ENTRY(strlen)
 	add	ip, r0, #1	/* start of src + NUL */
@@ -39,3 +55,4 @@ ENTRY(strlen)
 	sub	r0, r0, ip	/* return difference between start and end */
 	RET
 END(strlen)
+#endif /* !STRNLEN */



CVS commit: src/common/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 07:02:45 UTC 2013

Added Files:
src/common/lib/libc/arch/arm/string: strlcat_arm.S

Log Message:
Add ARM assembly of strlcat which is implemented using (the ARM optimized)
strnlen and strlcpy.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/string/strlcat_arm.S

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

Added files:

Index: src/common/lib/libc/arch/arm/string/strlcat_arm.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strlcat_arm.S:1.1
--- /dev/null	Wed Jan 23 07:02:45 2013
+++ src/common/lib/libc/arch/arm/string/strlcat_arm.S	Wed Jan 23 07:02:45 2013
@@ -0,0 +1,52 @@
+/*-
+ * Copyright (c) 2013 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * 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 machine/asm.h
+
+RCSID($NetBSD: strlcat_arm.S,v 1.1 2013/01/23 07:02:45 matt Exp $)
+
+/* LINTSTUB: size_t strlcat(char *, const char *, size_t) */
+ENTRY(strlcat)
+	push	{r4-r6, lr}
+	mov	r4, r0			/* save dst */
+	mov	r5, r1			/* save src */
+	mov	r6, r2			/* save siz */
+
+	mov	r1, r6			/* get siz */
+	bl	PLT_SYM(strnlen)	/* find length of dst (up to siz) */
+
+	sub	r2, r6, r0		/* get remaining space in dst */
+	mov	r1, r5			/* restore src */
+	mov	r5, r0			/* save remaining space */
+	add	r0, r0, r4		/* set start to end of dst */
+	bl	PLT_SYM(strlcpy)	/* attempt to copy src */
+	add	r0, r0, r5		/* add remaining to strlcpy return */
+	pop	{r4-r6, lr}		/* restore registers */
+	RET/* return */
+END(strlcat)



CVS commit: src/common/lib/libc/arch/arm/gen

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 07:38:20 UTC 2013

Added Files:
src/common/lib/libc/arch/arm/gen: __aeabi_idiv0.c __aeabi_ldiv0.c

Log Message:
Add EABI support routines to raise SIGFPE on integer divide by 0.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c \
src/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c

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

Added files:

Index: src/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c
diff -u /dev/null src/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c:1.1
--- /dev/null	Wed Jan 23 07:38:20 2013
+++ src/common/lib/libc/arch/arm/gen/__aeabi_idiv0.c	Wed Jan 23 07:38:19 2013
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__RCSID($NetBSD: __aeabi_idiv0.c,v 1.1 2013/01/23 07:38:19 matt Exp $);
+
+#if !defined(_KERNEL)
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/signal.h
+#include sys/siginfo.h
+#endif
+
+#include arm/aeabi.h
+
+int
+__aeabi_idiv0(int result)
+{
+#ifdef _KERNEL
+#else
+	siginfo_t info;
+	
+	memset(info, 0, sizeof info);
+	info.si_signo = SIGFPE;
+	info.si_pid = getpid();
+	info.si_uid = geteuid();
+	info.si_code = FPE_INTDIV;
+	sigqueueinfo(getpid(), info);
+#endif
+	return result;
+}
Index: src/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c
diff -u /dev/null src/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c:1.1
--- /dev/null	Wed Jan 23 07:38:20 2013
+++ src/common/lib/libc/arch/arm/gen/__aeabi_ldiv0.c	Wed Jan 23 07:38:19 2013
@@ -0,0 +1,59 @@
+/*-
+ * Copyright (c) 2012 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by Matt Thomas of 3am Software Foundry.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in the
+ *documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+ * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+__RCSID($NetBSD: __aeabi_ldiv0.c,v 1.1 2013/01/23 07:38:19 matt Exp $);
+
+#if !defined(_KERNEL)
+#include string.h
+#include unistd.h
+#include sys/types.h
+#include sys/signal.h
+#include sys/siginfo.h
+#endif
+
+#include arm/aeabi.h
+
+long long
+__aeabi_ldiv0(long long result)

CVS commit: src/common/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 07:45:47 UTC 2013

Modified Files:
src/common/lib/libc/arch/arm/string: strchr.S strrchr.S

Log Message:
Add index/rindex strong aiases.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/common/lib/libc/arch/arm/string/strchr.S \
src/common/lib/libc/arch/arm/string/strrchr.S

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

Modified files:

Index: src/common/lib/libc/arch/arm/string/strchr.S
diff -u src/common/lib/libc/arch/arm/string/strchr.S:1.1 src/common/lib/libc/arch/arm/string/strchr.S:1.2
--- src/common/lib/libc/arch/arm/string/strchr.S:1.1	Wed Jan 23 05:46:17 2013
+++ src/common/lib/libc/arch/arm/string/strchr.S	Wed Jan 23 07:45:46 2013
@@ -1,4 +1,8 @@
-/* $NetBSD: strchr.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */
+/* $NetBSD: strchr.S,v 1.2 2013/01/23 07:45:46 matt Exp $ */
+
+#include machine/asm.h
+
+STRONG_ALIAS(index, strchr)
 
 #if defined(_STANDALONE)
 #include strchr_naive.S
Index: src/common/lib/libc/arch/arm/string/strrchr.S
diff -u src/common/lib/libc/arch/arm/string/strrchr.S:1.1 src/common/lib/libc/arch/arm/string/strrchr.S:1.2
--- src/common/lib/libc/arch/arm/string/strrchr.S:1.1	Wed Jan 23 05:46:17 2013
+++ src/common/lib/libc/arch/arm/string/strrchr.S	Wed Jan 23 07:45:46 2013
@@ -1,4 +1,8 @@
-/* $NetBSD: strrchr.S,v 1.1 2013/01/23 05:46:17 matt Exp $ */
+/* $NetBSD: strrchr.S,v 1.2 2013/01/23 07:45:46 matt Exp $ */
+
+#include machine/asm.h
+
+STRONG_ALIAS(rindex, strrchr)  
 
 #if defined(_STANDALONE)
 #include strrchr_naive.S



CVS commit: src/common/lib/libc/arch/arm/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 07:56:09 UTC 2013

Added Files:
src/common/lib/libc/arch/arm/string: strlcat.S strnlen.S

Log Message:
Enable ARM assembly versions of strlcat and strnlen.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/common/lib/libc/arch/arm/string/strlcat.S \
src/common/lib/libc/arch/arm/string/strnlen.S

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

Added files:

Index: src/common/lib/libc/arch/arm/string/strlcat.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strlcat.S:1.1
--- /dev/null	Wed Jan 23 07:56:09 2013
+++ src/common/lib/libc/arch/arm/string/strlcat.S	Wed Jan 23 07:56:09 2013
@@ -0,0 +1,14 @@
+/* $NetBSD: strlcat.S,v 1.1 2013/01/23 07:56:09 matt Exp $ */
+
+#include machine/asm.h
+
+#ifdef _LIBC
+WEAK_ALIAS(strlcat, _strlcat)
+#include namespace.h
+#endif
+
+#ifdef _STANDALONE
+#include strlcat_naive.S
+#else
+#include strlcat_arm.S
+#endif
Index: src/common/lib/libc/arch/arm/string/strnlen.S
diff -u /dev/null src/common/lib/libc/arch/arm/string/strnlen.S:1.1
--- /dev/null	Wed Jan 23 07:56:09 2013
+++ src/common/lib/libc/arch/arm/string/strnlen.S	Wed Jan 23 07:56:09 2013
@@ -0,0 +1,9 @@
+/* $NetBSD: strnlen.S,v 1.1 2013/01/23 07:56:09 matt Exp $ */
+
+#define	STRNLEN
+
+#ifdef _STANDALONE
+#include strlen_naive.S
+#else
+#include strlen_arm.S
+#endif



CVS commit: src/common/lib/libc/string

2013-01-22 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Wed Jan 23 07:57:27 UTC 2013

Modified Files:
src/common/lib/libc/string: strlcat.c

Log Message:
Add a (unused) variant of strlcat that uses strnlen and strlcpy to do the work.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libc/string/strlcat.c

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

Modified files:

Index: src/common/lib/libc/string/strlcat.c
diff -u src/common/lib/libc/string/strlcat.c:1.3 src/common/lib/libc/string/strlcat.c:1.4
--- src/common/lib/libc/string/strlcat.c:1.3	Mon Jun  4 18:19:27 2007
+++ src/common/lib/libc/string/strlcat.c	Wed Jan 23 07:57:27 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: strlcat.c,v 1.3 2007/06/04 18:19:27 christos Exp $	*/
+/*	$NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $	*/
 /*	$OpenBSD: strlcat.c,v 1.10 2003/04/12 21:56:39 millert Exp $	*/
 
 /*
@@ -24,7 +24,7 @@
 
 #include sys/cdefs.h
 #if defined(LIBC_SCCS)  !defined(lint)
-__RCSID($NetBSD: strlcat.c,v 1.3 2007/06/04 18:19:27 christos Exp $);
+__RCSID($NetBSD: strlcat.c,v 1.4 2013/01/23 07:57:27 matt Exp $);
 #endif /* LIBC_SCCS and not lint */
 
 #ifdef _LIBC
@@ -55,6 +55,7 @@ __weak_alias(strlcat, _strlcat)
 size_t
 strlcat(char *dst, const char *src, size_t siz)
 {
+#if 1
 	char *d = dst;
 	const char *s = src;
 	size_t n = siz;
@@ -81,5 +82,20 @@ strlcat(char *dst, const char *src, size
 	*d = '\0';
 
 	return(dlen + (s - src));	/* count does not include NUL */
+#else
+	_DIAGASSERT(dst != NULL);
+	_DIAGASSERT(src != NULL);
+
+	/*
+	 * Find length of string in dst (maxing out at siz).
+	 */
+	size_t dlen = strnlen(dst, siz);
+
+	/*
+	 * Copy src into any remaining space in dst (truncating if needed).
+	 * Note strlcpy(dst, src, 0) returns strlen(src).
+	 */
+	return dlen + strlcpy(dst + dlen, src, siz - dlen);
+#endif
 }
 #endif