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

2012-07-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 16 06:33:05 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c

Log Message:
Make the result from SOFTIPLMASK match the comment.

"Wouldn't hurt" from matt@


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/arm/arm32/arm32_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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.77 src/sys/arch/arm/arm32/arm32_machdep.c:1.78
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.77	Mon Jul 16 06:26:43 2012
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Mon Jul 16 06:33:05 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.78 2012/07/16 06:33:05 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.78 2012/07/16 06:33:05 skrll Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -420,7 +420,7 @@ parse_mi_bootargs(char *args)
  * SOFTIPLMASK(IPL_SOFTNET)	= 0x0008
  * SOFTIPLMASK(IPL_SOFTSERIAL)	= 0x
  */
-#define	SOFTIPLMASK(ipl) (0x0f << (ipl))
+#define	SOFTIPLMASK(ipl) ((0x0f << (ipl)) & 0x0f)
 
 void softint_switch(lwp_t *, int);
 



CVS commit: src/sys/arch/arm

2012-07-15 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Jul 16 06:26:43 UTC 2012

Modified Files:
src/sys/arch/arm/arm32: arm32_machdep.c
src/sys/arch/arm/include: cpu.h

Log Message:
Fix racy softint dispatch that lead to KASSERT(si->si_active) in
softint_execute

Discussed with matt@. "Looks good to me"


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/sys/arch/arm/arm32/arm32_machdep.c
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/arm/include/cpu.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/arm/arm32/arm32_machdep.c
diff -u src/sys/arch/arm/arm32/arm32_machdep.c:1.76 src/sys/arch/arm/arm32/arm32_machdep.c:1.77
--- src/sys/arch/arm/arm32/arm32_machdep.c:1.76	Thu Jun 30 20:09:19 2011
+++ src/sys/arch/arm/arm32/arm32_machdep.c	Mon Jul 16 06:26:43 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: arm32_machdep.c,v 1.76 2011/06/30 20:09:19 wiz Exp $	*/
+/*	$NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $	*/
 
 /*
  * Copyright (c) 1994-1998 Mark Brinicombe.
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.76 2011/06/30 20:09:19 wiz Exp $");
+__KERNEL_RCSID(0, "$NetBSD: arm32_machdep.c,v 1.77 2012/07/16 06:26:43 skrll Exp $");
 
 #include "opt_modular.h"
 #include "opt_md.h"
@@ -59,11 +59,12 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_machde
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
 
+#include 
+
 #include 
 #include 
 
@@ -449,19 +450,21 @@ dosoftints(void)
 	const int opl = ci->ci_cpl;
 	const uint32_t softiplmask = SOFTIPLMASK(opl);
 
+	splhigh();
 	for (;;) {
 		u_int softints = ci->ci_softints & softiplmask;
 		KASSERT((softints != 0) == ((ci->ci_softints >> opl) != 0));
-		if (softints == 0)
+		KASSERT(opl == IPL_NONE || (softints & (1 << (opl - IPL_SOFTCLOCK))) == 0);
+		if (softints == 0) {
+			splx(opl);
 			return;
-		ci->ci_cpl = IPL_HIGH;
+		}
 #define	DOSOFTINT(n) \
-		if (softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
+		if (ci->ci_softints & (1 << (IPL_SOFT ## n - IPL_SOFTCLOCK))) { \
 			ci->ci_softints &= \
 			~(1 << (IPL_SOFT ## n - IPL_SOFTCLOCK)); \
 			softint_switch(ci->ci_softlwps[SOFTINT_ ## n], \
 			IPL_SOFT ## n); \
-			ci->ci_cpl = opl; \
 			continue; \
 		}
 		DOSOFTINT(SERIAL);

Index: src/sys/arch/arm/include/cpu.h
diff -u src/sys/arch/arm/include/cpu.h:1.63 src/sys/arch/arm/include/cpu.h:1.64
--- src/sys/arch/arm/include/cpu.h:1.63	Thu Feb 16 02:30:32 2012
+++ src/sys/arch/arm/include/cpu.h	Mon Jul 16 06:26:43 2012
@@ -247,7 +247,7 @@ struct cpu_info {
 	struct pcb *ci_curpcb;		/* current pcb */
 #ifdef __HAVE_FAST_SOFTINTS
 	lwp_t *ci_softlwps[SOFTINT_COUNT];
-	uint32_t ci_softints;
+	volatile uint32_t ci_softints;
 #endif
 #if !defined(PROCESS_ID_IS_CURLWP)
 	lwp_t *ci_curlwp;		/* current lwp */



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

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Mon Jul 16 01:52:37 UTC 2012

Modified Files:
src/sys/arch/x86/pci: amdtemp.c

Log Message:
Enable entropy gathering


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/pci/amdtemp.c

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

Modified files:

Index: src/sys/arch/x86/pci/amdtemp.c
diff -u src/sys/arch/x86/pci/amdtemp.c:1.15 src/sys/arch/x86/pci/amdtemp.c:1.16
--- src/sys/arch/x86/pci/amdtemp.c:1.15	Fri Apr 13 13:11:17 2012
+++ src/sys/arch/x86/pci/amdtemp.c	Mon Jul 16 01:52:37 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: amdtemp.c,v 1.15 2012/04/13 13:11:17 cegger Exp $ */
+/*  $NetBSD: amdtemp.c,v 1.16 2012/07/16 01:52:37 pgoyette Exp $ */
 /*  $OpenBSD: kate.c,v 1.2 2008/03/27 04:52:03 cnst Exp $   */
 
 /*
@@ -48,7 +48,7 @@
 
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.15 2012/04/13 13:11:17 cegger Exp $ ");
+__KERNEL_RCSID(0, "$NetBSD: amdtemp.c,v 1.16 2012/07/16 01:52:37 pgoyette Exp $ ");
 
 #include 
 #include 
@@ -425,6 +425,7 @@ amdtemp_k8_setup_sensors(struct amdtemp_
 	for (i = 0; i < sc->sc_numsensors; i++) {
 		sc->sc_sensor[i].units = ENVSYS_STEMP;
 		sc->sc_sensor[i].state = ENVSYS_SVALID;
+		sc->sc_sensor[i].flags = ENVSYS_FHAS_ENTROPY;
 
 		snprintf(sc->sc_sensor[i].desc, sizeof(sc->sc_sensor[i].desc),
 			"CPU%u Sensor%u", dv_unit + (i / 2), i % 2);
@@ -498,6 +499,7 @@ amdtemp_family10_setup_sensors(struct am
 	 */
 	sc->sc_sensor[0].units = ENVSYS_STEMP;
 	sc->sc_sensor[0].state = ENVSYS_SVALID;
+	sc->sc_sensor[0].flags = ENVSYS_FHAS_ENTROPY;
 
 	snprintf(sc->sc_sensor[0].desc, sizeof(sc->sc_sensor[0].desc),
 		"cpu%u temperature", dv_unit);



CVS commit: src/sys/dev/usb

2012-07-15 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Sun Jul 15 21:13:31 UTC 2012

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

Log Message:
commit my workaround for PR 46648 for now, as the more involved
fix is not ready yet:

move the clear endpoint stall async call into the task thread,
to avoid trying to call kmem_alloc() from a softint thread.

XXX ideally moving callbacks into the task thread (or perhaps
a different high priority task thread) would be better than this
workaround, once that method is working.


To generate a diff of this commit:
cvs rdiff -u -r1.182 -r1.183 src/sys/dev/usb/usb_subr.c
cvs rdiff -u -r1.138 -r1.139 src/sys/dev/usb/usbdi.c
cvs rdiff -u -r1.83 -r1.84 src/sys/dev/usb/usbdi.h
cvs rdiff -u -r1.97 -r1.98 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/usb_subr.c
diff -u src/sys/dev/usb/usb_subr.c:1.182 src/sys/dev/usb/usb_subr.c:1.183
--- src/sys/dev/usb/usb_subr.c:1.182	Sun Jun 10 06:15:54 2012
+++ src/sys/dev/usb/usb_subr.c	Sun Jul 15 21:13:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb_subr.c,v 1.182 2012/06/10 06:15:54 mrg Exp $	*/
+/*	$NetBSD: usb_subr.c,v 1.183 2012/07/15 21:13:31 mrg 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 
-__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.182 2012/06/10 06:15:54 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb_subr.c,v 1.183 2012/07/15 21:13:31 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usbverbose.h"
@@ -765,6 +765,7 @@ usbd_setup_pipe(usbd_device_handle dev, 
 		free(p, M_USB);
 		return (err);
 	}
+	usb_init_task(&p->async_task, usbd_clear_endpoint_stall_async_cb, p);
 	*pipe = p;
 	return (USBD_NORMAL_COMPLETION);
 }
@@ -779,6 +780,7 @@ usbd_kill_pipe(usbd_pipe_handle pipe)
 	usbd_lock_pipe(pipe);
 	pipe->methods->close(pipe);
 	usbd_unlock_pipe(pipe);
+	usb_rem_task(pipe->device, &pipe->async_task);
 	pipe->endpoint->refcnt--;
 	free(pipe, M_USB);
 }

Index: src/sys/dev/usb/usbdi.c
diff -u src/sys/dev/usb/usbdi.c:1.138 src/sys/dev/usb/usbdi.c:1.139
--- src/sys/dev/usb/usbdi.c:1.138	Sun Jun 10 06:15:55 2012
+++ src/sys/dev/usb/usbdi.c	Sun Jul 15 21:13:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.c,v 1.138 2012/06/10 06:15:55 mrg Exp $	*/
+/*	$NetBSD: usbdi.c,v 1.139 2012/07/15 21:13:31 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.138 2012/06/10 06:15:55 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usbdi.c,v 1.139 2012/07/15 21:13:31 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -599,12 +599,12 @@ XXX should we do this?
 	return (err);
 }
 
-usbd_status
-usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe)
+void
+usbd_clear_endpoint_stall_async_cb(void *arg)
 {
+	usbd_pipe_handle pipe = arg;
 	usbd_device_handle dev = pipe->device;
 	usb_device_request_t req;
-	usbd_status err;
 
 	pipe->methods->cleartoggle(pipe);
 
@@ -613,8 +613,14 @@ usbd_clear_endpoint_stall_async(usbd_pip
 	USETW(req.wValue, UF_ENDPOINT_HALT);
 	USETW(req.wIndex, pipe->endpoint->edesc->bEndpointAddress);
 	USETW(req.wLength, 0);
-	err = usbd_do_request_async(dev, &req, 0);
-	return (err);
+	(void)usbd_do_request_async(dev, &req, 0);
+}
+
+void
+usbd_clear_endpoint_stall_async(usbd_pipe_handle pipe)
+{
+
+	usb_add_task(pipe->device, &pipe->async_task, USB_TASKQ_DRIVER);
 }
 
 void

Index: src/sys/dev/usb/usbdi.h
diff -u src/sys/dev/usb/usbdi.h:1.83 src/sys/dev/usb/usbdi.h:1.84
--- src/sys/dev/usb/usbdi.h:1.83	Sun Jun 10 06:15:55 2012
+++ src/sys/dev/usb/usbdi.h	Sun Jul 15 21:13:31 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: usbdi.h,v 1.83 2012/06/10 06:15:55 mrg Exp $	*/
+/*	$NetBSD: usbdi.h,v 1.84 2012/07/15 21:13:31 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/usbdi.h,v 1.18 1999/11/17 22:33:49 n_hibma Exp $	*/
 
 /*
@@ -113,12 +113,12 @@ usb_endpoint_descriptor_t *usbd_interfac
 usbd_status usbd_abort_pipe(usbd_pipe_handle);
 usbd_status usbd_abort_default_pipe(usbd_device_handle);
 usbd_status usbd_clear_endpoint_stall(usbd_pipe_handle);
-usbd_status usbd_clear_endpoint_stall_async(usbd_pipe_handle);
+void usbd_clear_endpoint_stall_async(usbd_pipe_handle);
 void usbd_clear_endpoint_toggle(usbd_pipe_handle);
 usbd_status usbd_endpoint_count(usbd_interface_handle, u_int8_t *);
 usbd_status usbd_interface_count(usbd_device_handle, u_int8_t *);
 void usbd_interface2device_handle(usbd_interface_handle,
-	 usbd_device_handle *);
+  usbd_device_handle *);
 usbd_status usbd_device2interface_handle(usbd_device_handle,
 			  u_int8_t, usbd_interface_handle *);
 
@@ -188,6 +188,9 @@ typedef struct {
 void usb_desc_iter_init(usbd_device_handle, usbd_desc_iter_t *);
 const usb_descriptor_t *usb_desc_iter_next(usbd_desc_iter_t *);
 
+/* Used to clear endpoint stalls from the soft

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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 20:54:15 UTC 2012

Modified Files:
src/sys/arch/arm/omap: omap_a2x_space.c omap_a4x_space.c
omap_nobyteacc_space.c omap_space.c

Log Message:
Add stream methods


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/omap/omap_a2x_space.c \
src/sys/arch/arm/omap/omap_a4x_space.c \
src/sys/arch/arm/omap/omap_nobyteacc_space.c
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/omap/omap_space.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/omap/omap_a2x_space.c
diff -u src/sys/arch/arm/omap/omap_a2x_space.c:1.2 src/sys/arch/arm/omap/omap_a2x_space.c:1.3
--- src/sys/arch/arm/omap/omap_a2x_space.c:1.2	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap_a2x_space.c	Sun Jul 15 20:54:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap_a2x_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $ */
+/*	$NetBSD: omap_a2x_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $ */
 
 /*
  * Based on arch/arm/xscale/pxa2x0_a4x_space.c
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap_a2x_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap_a2x_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $");
 
 #include 
 #include 
@@ -130,6 +130,45 @@ struct bus_space omap_a2x_bs_tag = {
 	bs_notimpl_bs_c_2,
 	bs_notimpl_bs_c_4,
 	bs_notimpl_bs_c_8,
+
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	/* stream methods */
+	/* read (single) */
+	a2x_bs_r_1,
+	a2x_bs_r_2,
+	a2x_bs_r_4,
+	bs_notimpl_bs_r_8,
+
+	/* read multiple */
+	a2x_bs_rm_1,
+	a2x_bs_rm_2,
+	bs_notimpl_bs_rm_4,
+	bs_notimpl_bs_rm_8,
+
+	/* read region */
+	bs_notimpl_bs_rr_1,
+	bs_notimpl_bs_rr_2,
+	bs_notimpl_bs_rr_4,
+	bs_notimpl_bs_rr_8,
+
+	/* write (single) */
+	a2x_bs_w_1,
+	a2x_bs_w_2,
+	a2x_bs_w_4,
+	bs_notimpl_bs_w_8,
+
+	/* write multiple */
+	a2x_bs_wm_1,
+	a2x_bs_wm_2,
+	bs_notimpl_bs_wm_4,
+	bs_notimpl_bs_wm_8,
+
+	/* write region */
+	bs_notimpl_bs_wr_1,
+	bs_notimpl_bs_wr_2,
+	bs_notimpl_bs_wr_4,
+	bs_notimpl_bs_wr_8,
+#endif
 };
 
 
Index: src/sys/arch/arm/omap/omap_a4x_space.c
diff -u src/sys/arch/arm/omap/omap_a4x_space.c:1.2 src/sys/arch/arm/omap/omap_a4x_space.c:1.3
--- src/sys/arch/arm/omap/omap_a4x_space.c:1.2	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap_a4x_space.c	Sun Jul 15 20:54:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap_a4x_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $ */
+/*	$NetBSD: omap_a4x_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $ */
 
 /*
  * Based on arch/arm/xscale/pxa2x0_a4x_space.c
@@ -41,7 +41,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap_a4x_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap_a4x_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $");
 
 #include 
 #include 
@@ -130,6 +130,44 @@ struct bus_space omap_a4x_bs_tag = {
 	bs_notimpl_bs_c_2,
 	bs_notimpl_bs_c_4,
 	bs_notimpl_bs_c_8,
+
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	/* read (single) */
+	a4x_bs_r_1,
+	a4x_bs_r_2,
+	a4x_bs_r_4,
+	bs_notimpl_bs_r_8,
+
+	/* read multiple */
+	a4x_bs_rm_1,
+	a4x_bs_rm_2,
+	bs_notimpl_bs_rm_4,
+	bs_notimpl_bs_rm_8,
+
+	/* read region */
+	bs_notimpl_bs_rr_1,
+	bs_notimpl_bs_rr_2,
+	bs_notimpl_bs_rr_4,
+	bs_notimpl_bs_rr_8,
+
+	/* write (single) */
+	a4x_bs_w_1,
+	a4x_bs_w_2,
+	a4x_bs_w_4,
+	bs_notimpl_bs_w_8,
+
+	/* write multiple */
+	a4x_bs_wm_1,
+	a4x_bs_wm_2,
+	bs_notimpl_bs_wm_4,
+	bs_notimpl_bs_wm_8,
+
+	/* write region */
+	bs_notimpl_bs_wr_1,
+	bs_notimpl_bs_wr_2,
+	bs_notimpl_bs_wr_4,
+	bs_notimpl_bs_wr_8,
+#endif
 };
 
 
Index: src/sys/arch/arm/omap/omap_nobyteacc_space.c
diff -u src/sys/arch/arm/omap/omap_nobyteacc_space.c:1.2 src/sys/arch/arm/omap/omap_nobyteacc_space.c:1.3
--- src/sys/arch/arm/omap/omap_nobyteacc_space.c:1.2	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/omap/omap_nobyteacc_space.c	Sun Jul 15 20:54:15 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: omap_nobyteacc_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $ */
+/*	$NetBSD: omap_nobyteacc_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $ */
 
 /*
  * "nobyteacc" bus_space functions for Texas Instruments OMAP processor.
@@ -73,7 +73,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: omap_nobyteacc_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omap_nobyteacc_space.c,v 1.3 2012/07/15 20:54:15 matt Exp $");
 
 #include 
 #include 
@@ -164,5 +164,43 @@ struct bus_space nobyteacc_bs_tag = {
 	generic_armv4_bs_c_2,
 	bs_notimpl_bs_c_4,
 	bs_notimpl_bs_c_8,
+
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	/* read (single) */
+	generic_bs_r_1,
+	generic_armv4_bs_r_2,
+	generic_bs_r_4,
+	bs_notimpl_bs_r_8,
+
+	/* read multiple */
+	generic_bs_rm_1,
+	generic_armv4_bs_rm_2,
+	generic_bs_rm_4,
+	bs_notimpl_bs_rm_8,
+
+	/* read region */
+	generic_bs_rr_1,
+	generic_armv4_bs_rr_2,
+	generic_bs_rr_4,
+	bs_notimpl_bs_rr_8,
+
+	/* write (single) */
+	nobyteacc_bs_w_1, /* promote 8-b

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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 20:53:50 UTC 2012

Modified Files:
src/sys/arch/arm/marvell: mvsoc_space.c

Log Message:
Add stream methods


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/arm/marvell/mvsoc_space.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/marvell/mvsoc_space.c
diff -u src/sys/arch/arm/marvell/mvsoc_space.c:1.2 src/sys/arch/arm/marvell/mvsoc_space.c:1.3
--- src/sys/arch/arm/marvell/mvsoc_space.c:1.2	Fri Jul  1 20:30:21 2011
+++ src/sys/arch/arm/marvell/mvsoc_space.c	Sun Jul 15 20:53:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mvsoc_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $	*/
+/*	$NetBSD: mvsoc_space.c,v 1.3 2012/07/15 20:53:50 matt Exp $	*/
 /*
  * Copyright (c) 2007 KIYOHARA Takashi
  * All rights reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mvsoc_space.c,v 1.2 2011/07/01 20:30:21 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mvsoc_space.c,v 1.3 2012/07/15 20:53:50 matt Exp $");
 
 #include "opt_mvsoc.h"
 #include "mvpex.h"
@@ -49,25 +49,7 @@ bs_protos(generic);
 bs_protos(generic_armv4);
 bs_protos(bs_notimpl);
 
-#define MVSOC_BUS_SPACE_DEFAULT_FUNCS		\
-	/* mapping/unmapping */			\
-	mvsoc_bs_map,\
-	mvsoc_bs_unmap,\
-	mvsoc_bs_subregion,			\
-		\
-	/* allocation/deallocation */		\
-	mvsoc_bs_alloc,\
-	mvsoc_bs_free,\
-		\
-	/* get kernel virtual address */	\
-	mvsoc_bs_vaddr,\
-		\
-	/* mmap bus space for userland */	\
-	bs_notimpl_bs_mmap,			\
-		\
-	/* barrier */\
-	mvsoc_bs_barrier,			\
-		\
+#define MVSOC_BUS_SPACE_NORMAL_FUNCS		\
 	/* read (single) */			\
 	generic_bs_r_1,\
 	generic_armv4_bs_r_2,			\
@@ -102,7 +84,28 @@ bs_protos(bs_notimpl);
 	generic_bs_wr_1,			\
 	generic_armv4_bs_wr_2,			\
 	generic_bs_wr_4,			\
-	bs_notimpl_bs_wr_8,			\
+	bs_notimpl_bs_wr_8
+
+#define MVSOC_BUS_SPACE_DEFAULT_FUNCS		\
+	/* mapping/unmapping */			\
+	mvsoc_bs_map,\
+	mvsoc_bs_unmap,\
+	mvsoc_bs_subregion,			\
+		\
+	/* allocation/deallocation */		\
+	mvsoc_bs_alloc,\
+	mvsoc_bs_free,\
+		\
+	/* get kernel virtual address */	\
+	mvsoc_bs_vaddr,\
+		\
+	/* mmap bus space for userland */	\
+	bs_notimpl_bs_mmap,			\
+		\
+	/* barrier */\
+	mvsoc_bs_barrier,			\
+		\
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,		\
 		\
 	/* set multiple */			\
 	bs_notimpl_bs_sm_1,			\
@@ -120,14 +123,17 @@ bs_protos(bs_notimpl);
 	bs_notimpl_bs_c_1,			\
 	generic_armv4_bs_c_2,			\
 	bs_notimpl_bs_c_4,			\
-	bs_notimpl_bs_c_8,
+	bs_notimpl_bs_c_8
 
 
 struct bus_space mvsoc_bs_tag = {
 	/* cookie */
 	(void *)0,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 
 #if NMVPEX > 0
@@ -136,25 +142,37 @@ struct bus_space orion_pex0_mem_bs_tag =
 	/* cookie */
 	(void *)ORION_TAG_PEX0_MEM,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 struct bus_space orion_pex0_io_bs_tag = {
 	/* cookie */
 	(void *)ORION_TAG_PEX0_IO,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 struct bus_space orion_pex1_mem_bs_tag = {
 	/* cookie */
 	(void *)ORION_TAG_PEX1_MEM,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 struct bus_space orion_pex1_io_bs_tag = {
 	/* cookie */
 	(void *)ORION_TAG_PEX1_IO,
 
 	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 #endif
 
@@ -163,13 +181,19 @@ struct bus_space kirkwood_pex_mem_bs_tag
 	/* cookie */
 	(void *)KIRKWOOD_TAG_PEX_MEM,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 struct bus_space kirkwood_pex_io_bs_tag = {
 	/* cookie */
 	(void *)KIRKWOOD_TAG_PEX_IO,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 #endif
 #endif
@@ -180,13 +204,19 @@ struct bus_space orion_pci_mem_bs_tag = 
 	/* cookie */
 	(void *)ORION_TAG_PCI_MEM,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 struct bus_space orion_pci_io_bs_tag = {
 	/* cookie */
 	(void *)ORION_TAG_PCI_IO,
 
-	MVSOC_BUS_SPACE_DEFAULT_FUNCS
+	MVSOC_BUS_SPACE_DEFAULT_FUNCS,
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	MVSOC_BUS_SPACE_NORMAL_FUNCS,
+#endif
 };
 #endif
 #endif



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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 20:53:23 UTC 2012

Modified Files:
src/sys/arch/arm/mainbus: mainbus_io.c

Log Message:
Add stream methods


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r1.22 src/sys/arch/arm/mainbus/mainbus_io.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/mainbus/mainbus_io.c
diff -u src/sys/arch/arm/mainbus/mainbus_io.c:1.21 src/sys/arch/arm/mainbus/mainbus_io.c:1.22
--- src/sys/arch/arm/mainbus/mainbus_io.c:1.21	Fri Jul  1 20:31:39 2011
+++ src/sys/arch/arm/mainbus/mainbus_io.c	Sun Jul 15 20:53:23 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus_io.c,v 1.21 2011/07/01 20:31:39 dyoung Exp $	*/
+/*	$NetBSD: mainbus_io.c,v 1.22 2012/07/15 20:53:23 matt Exp $	*/
 
 /*
  * Copyright (c) 1997 Mark Brinicombe.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: mainbus_io.c,v 1.21 2011/07/01 20:31:39 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mainbus_io.c,v 1.22 2012/07/15 20:53:23 matt Exp $");
 
 #include 
 #include 
@@ -129,6 +129,45 @@ struct bus_space mainbus_bs_tag = {
 	bs_notimpl_bs_c_2,
 	bs_notimpl_bs_c_4,
 	bs_notimpl_bs_c_8,
+
+#ifdef __BUS_SPACE_HAS_STREAM_METHODS
+	/* stream methods */
+	/* read (single) */
+	mainbus_bs_r_1,
+	mainbus_bs_r_2,
+	mainbus_bs_r_4,
+	bs_notimpl_bs_r_8,
+
+	/* read multiple */
+	bs_notimpl_bs_rm_1,
+	mainbus_bs_rm_2,
+	bs_notimpl_bs_rm_4,
+	bs_notimpl_bs_rm_8,
+
+	/* read region */
+	bs_notimpl_bs_rr_1,
+	bs_notimpl_bs_rr_2,
+	bs_notimpl_bs_rr_4,
+	bs_notimpl_bs_rr_8,
+
+	/* write (single) */
+	mainbus_bs_w_1,
+	mainbus_bs_w_2,
+	mainbus_bs_w_4,
+	bs_notimpl_bs_w_8,
+
+	/* write multiple */
+	mainbus_bs_wm_1,
+	mainbus_bs_wm_2,
+	bs_notimpl_bs_wm_4,
+	bs_notimpl_bs_wm_8,
+
+	/* write region */
+	bs_notimpl_bs_wr_1,
+	bs_notimpl_bs_wr_2,
+	bs_notimpl_bs_wr_4,
+	bs_notimpl_bs_wr_8,
+#endif
 };
 
 /* bus space functions */



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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 20:48:53 UTC 2012

Modified Files:
src/sys/arch/arm/arm: bus_space_a2x.S bus_space_a4x.S
bus_space_asm_generic.S

Log Message:
Add byte-swap versions.
Use RET and RETc(c)
Use ENTRY_NP


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/arm/bus_space_a2x.S \
src/sys/arch/arm/arm/bus_space_a4x.S
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/arm/arm/bus_space_asm_generic.S

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/arm/bus_space_a2x.S
diff -u src/sys/arch/arm/arm/bus_space_a2x.S:1.1 src/sys/arch/arm/arm/bus_space_a2x.S:1.2
--- src/sys/arch/arm/arm/bus_space_a2x.S:1.1	Wed Jun  6 20:21:43 2012
+++ src/sys/arch/arm/arm/bus_space_a2x.S	Sun Jul 15 20:48:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_a2x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $	*/
+/*	$NetBSD: bus_space_a2x.S,v 1.2 2012/07/15 20:48:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,84 +29,134 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-#include 
+#include 
+#include 
+#include 
 
-RCSID("$NetBSD: bus_space_a2x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $")
+RCSID("$NetBSD: bus_space_a2x.S,v 1.2 2012/07/15 20:48:53 matt Exp $")
 
 /*
  * bus_space_read_[124](void *cookie, bus_space_handle_t handle,
  * bus_size_t offset);
  */
 
-ENTRY(a2x_bs_r_1)
+ENTRY_NP(a2x_bs_r_1)
 	ldrb	r0, [r1, r2, lsl #1]
-	mov	pc, lr
+	RET
+END(a2x_bs_r_1)
 
 #if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_r_2)
+ENTRY_NP(a2x_bs_r_2)
 	lsl	r2, r2, #1
 	ldrh	r0, [r1, r2]
-	mov	pc, lr
+	RET
+END(a2x_bs_r_2)
+
+ENTRY_NP(a2x_bs_r_2_swap)
+	lsl	r2, r2, #1
+	ldrh	r0, [r1, r2]
+	BSWAP16(r0, r0, r1)
+	RET
+END(a2x_bs_r_2_swap)
 #endif
 
-ENTRY(a2x_bs_r_4)
+ENTRY_NP(a2x_bs_r_4)
 	ldr	r0, [r1, r2, lsl #1]
-	mov	pc, lr
+	RET
+END(a2x_bs_r_4)
+
+ENTRY_NP(a2x_bs_r_4_swap)
+	ldr	r0, [r1, r2, lsl #1]
+	BSWAP32(r0, r0, r1)
+	RET
+END(a2x_bs_r_4_swap)
 
 /*
  * bus_space_read_multi_[124](void *cookie, bus_space_handle_t handle,
  * bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
  */
 
-ENTRY(a2x_bs_rm_1)
+ENTRY_NP(a2x_bs_rm_1)
 	lsl	r2, r2, #1
 	b	generic_bs_rm_1
+END(a2x_bs_rm_1)
 
 #if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_rm_2)
+ENTRY_NP(a2x_bs_rm_2)
 	lsl	r2, r2, #1
 	b	generic_armv4_bs_rm_2
+END(a2x_bs_rm_2)
+
+ENTRY_NP(a2x_bs_rm_2_swap)
+	lsl	r2, r2, #1
+	b	generic_armv4_bs_rm_2_swap
+END(a2x_bs_rm_2_swap)
 #endif
 
-ENTRY(a2x_bs_rm_4)
+ENTRY_NP(a2x_bs_rm_4)
 	lsl	r2, r2, #1
 	b	generic_bs_rm_4
+END(a2x_bs_rm_4)
+
+ENTRY_NP(a2x_bs_rm_4_swap)
+	lsl	r2, r2, #1
+	b	generic_bs_rm_4_swap
+END(a2x_bs_rm_4_swap)
 
 /*
  * bus_space_write_[124](void *cookie, bus_space_handle_t handle,
  * bus_size_t offset, uint{8,16,32}_t value);
  */
-ENTRY(a2x_bs_w_1)
+ENTRY_NP(a2x_bs_w_1)
 	strb	r3, [r1, r2, lsl #1]
-	mov	pc, lr
+	RET
+END(a2x_bs_w_1)
 
 #if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_w_2)
+ENTRY_NP(a2x_bs_w_2_swap)
+	BSWAP16(r3, r3, r0)
+ENTRY_NP(a2x_bs_w_2)
 	lsl	r2, r2, #1
 	strh	r3, [r1, r2]
-	mov	pc, lr
+	RET
+END(a2x_bs_w_2)
 #endif
 
-ENTRY(a2x_bs_w_4)
+ENTRY_NP(a2x_bs_w_4_swap)
+	BSWAP32(r3, r3, r0)
+ENTRY_NP(a2x_bs_w_4)
 	str	r3, [r1, r2, lsl #1]
-	mov	pc, lr
+	RET
+END(a2x_bs_w_4)
 
 /*
  * bus_space_write_multi_[124](void *cookie, bus_space_handle_t handle,
  * bus_size_t offset, uint{8,16,32}_t *data, bus_size_t count);
  */
 
-ENTRY(a2x_bs_wm_1)
+ENTRY_NP(a2x_bs_wm_1)
 	lsl	r2, r2, #1
 	b	generic_bs_wm_1
+END(a2x_bs_wm_1)
 
 #if (ARM_ARCH_4 + ARM_ARCH_5 + ARM_ARCH_6 + ARM_ARCH_7) > 0
-ENTRY(a2x_bs_wm_2)
+ENTRY_NP(a2x_bs_wm_2)
 	lsl	r2, r2, #1
 	b	generic_armv4_bs_wm_2
+END(a2x_bs_wm_2)
+
+ENTRY_NP(a2x_bs_wm_2_swap)
+	lsl	r2, r2, #1
+	b	generic_armv4_bs_wm_2_swap
+END(a2x_bs_wm_2_swap)
 #endif
 
-ENTRY(a2x_bs_wm_4)
+ENTRY_NP(a2x_bs_wm_4)
 	lsl	r2, r2, #1
 	b	generic_bs_wm_4
+END(a2x_bs_wm_1)
+
+ENTRY_NP(a2x_bs_wm_4_swap)
+	lsl	r2, r2, #1
+	b	generic_bs_wm_4_swap
+END(a2x_bs_wm_4_swap)
Index: src/sys/arch/arm/arm/bus_space_a4x.S
diff -u src/sys/arch/arm/arm/bus_space_a4x.S:1.1 src/sys/arch/arm/arm/bus_space_a4x.S:1.2
--- src/sys/arch/arm/arm/bus_space_a4x.S:1.1	Wed Jun  6 20:21:43 2012
+++ src/sys/arch/arm/arm/bus_space_a4x.S	Sun Jul 15 20:48:53 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space_a4x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $	*/
+/*	$NetBSD: bus_space_a4x.S,v 1.2 2012/07/15 20:48:53 matt Exp $	*/
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -29,84 +29,134 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include 
-#include 
+#include 
+#include 
+#include 
 
-RCSID("$NetBSD: bus_space_a4x.S,v 1.1 2012/06/06 20:21:43 skrll Exp $")
+RCSID("$NetBSD: bus_space_a4x.S,v 1.2 2012/07/15 20:48:53 matt Exp $")
 
 /*
  * bus_space_read_[124](void *cookie, bus_space_handle_t handle,
  * bus_size_t offset);

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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 20:44:20 UTC 2012

Modified Files:
src/sys/arch/arm/include: bus_funcs.h

Log Message:
s/u_int*_t/ -> uint_*_t
Add swap variants for many accessors.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/arm/include/bus_funcs.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/arm/include/bus_funcs.h
diff -u src/sys/arch/arm/include/bus_funcs.h:1.1 src/sys/arch/arm/include/bus_funcs.h:1.2
--- src/sys/arch/arm/include/bus_funcs.h:1.1	Fri Jul  1 17:09:58 2011
+++ src/sys/arch/arm/include/bus_funcs.h	Sun Jul 15 20:44:20 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_funcs.h,v 1.1 2011/07/01 17:09:58 dyoung Exp $	*/
+/*	$NetBSD: bus_funcs.h,v 1.2 2012/07/15 20:44:20 matt Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -330,150 +330,192 @@ void	__bs_c(f,_bs_barrier)(void *t, bus_
 	bus_size_t offset, bus_size_t len, int flags);
 
 #define	bs_r_1_proto(f)			\
-u_int8_t	__bs_c(f,_bs_r_1)(void *t, bus_space_handle_t bsh,	\
+uint8_t	__bs_c(f,_bs_r_1)(void *t, bus_space_handle_t bsh,	\
 		bus_size_t offset);
 
 #define	bs_r_2_proto(f)			\
-u_int16_t	__bs_c(f,_bs_r_2)(void *t, bus_space_handle_t bsh,	\
+uint16_t	__bs_c(f,_bs_r_2)(void *t, bus_space_handle_t bsh,	\
+		bus_size_t offset);	\
+uint16_t	__bs_c(f,_bs_r_2_swap)(void *t, bus_space_handle_t bsh,	\
 		bus_size_t offset);
 
 #define	bs_r_4_proto(f)			\
-u_int32_t	__bs_c(f,_bs_r_4)(void *t, bus_space_handle_t bsh,	\
+uint32_t	__bs_c(f,_bs_r_4)(void *t, bus_space_handle_t bsh,	\
+		bus_size_t offset);	\
+uint32_t	__bs_c(f,_bs_r_4_swap)(void *t, bus_space_handle_t bsh,	\
 		bus_size_t offset);
 
 #define	bs_r_8_proto(f)			\
-u_int64_t	__bs_c(f,_bs_r_8)(void *t, bus_space_handle_t bsh,	\
+uint64_t	__bs_c(f,_bs_r_8)(void *t, bus_space_handle_t bsh,	\
+		bus_size_t offset);	\
+uint64_t	__bs_c(f,_bs_r_8_swap)(void *t, bus_space_handle_t bsh,	\
 		bus_size_t offset);
 
 #define	bs_w_1_proto(f)			\
 void	__bs_c(f,_bs_w_1)(void *t, bus_space_handle_t bsh,		\
-	bus_size_t offset, u_int8_t value);
+	bus_size_t offset, uint8_t value);
 
 #define	bs_w_2_proto(f)			\
 void	__bs_c(f,_bs_w_2)(void *t, bus_space_handle_t bsh,		\
-	bus_size_t offset, u_int16_t value);
+	bus_size_t offset, uint16_t value);\
+void	__bs_c(f,_bs_w_2_swap)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint16_t value);
 
 #define	bs_w_4_proto(f)			\
 void	__bs_c(f,_bs_w_4)(void *t, bus_space_handle_t bsh,		\
-	bus_size_t offset, u_int32_t value);
+	bus_size_t offset, uint32_t value);\
+void	__bs_c(f,_bs_w_4_swap)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint32_t value);
 
 #define	bs_w_8_proto(f)			\
 void	__bs_c(f,_bs_w_8)(void *t, bus_space_handle_t bsh,		\
-	bus_size_t offset, u_int64_t value);
+	bus_size_t offset, uint64_t value);\
+void	__bs_c(f,_bs_w_8_swap)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint64_t value);
 
 #define	bs_rm_1_proto(f)		\
-void	__bs_c(f,_bs_rm_1)(void *t, bus_space_handle_t bsh,	\
-	bus_size_t offset, u_int8_t *addr, bus_size_t count);
+void	__bs_c(f,_bs_rm_1)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint8_t *addr, bus_size_t count);
 
 #define	bs_rm_2_proto(f)		\
-void	__bs_c(f,_bs_rm_2)(void *t, bus_space_handle_t bsh,	\
-	bus_size_t offset, u_int16_t *addr, bus_size_t count);
+void	__bs_c(f,_bs_rm_2)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint16_t *addr, bus_size_t count);	\
+void	__bs_c(f,_bs_rm_2_swap)(void *t, bus_space_handle_t bsh,	\
+	bus_size_t offset, uint16_t *addr, bus_size_t count);
 
 #define	bs_rm_4_proto(f)		\
-void	__bs_c(f,_bs_rm_4)(void *t, bus_space_handle_t bsh,	\
-	bus_size_t offset, u_int32_t *addr, bus_size_t count);		
+void	__bs_c(f,_bs_rm_4)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint32_t *addr, bus_size_t count);	\
+void	__bs_c(f,_bs_rm_4_swap)(void *t, bus_space_handle_t bsh,	\
+	bus_size_t offset, uint32_t *addr, bus_size_t count);
 
 #define	bs_rm_8_proto(f)		\
-void	__bs_c(f,_bs_rm_8)(void *t, bus_space_handle_t bsh,	\
-	bus_size_t offset, u_int64_t *addr, bus_size_t count);
+void	__bs_c(f,_bs_rm_8)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, uint64_t *addr, bus_size_t count);	\
+void	__bs_c(f,_bs_rm_8_swap)(void *t, bus_space_handle_t bsh,	\
+	bus_size_t offset, uint64_t *addr, bus_size_t count);
 
 #define	bs_wm_1_proto(f)		\
-void	__bs_c(f,_bs_wm_1)(void *t, bus_space_handle_t bsh,	\
-	bus_size_t offset, const u_int8_t *addr, bus_size_t count);
+void	__bs_c(f,_bs_wm_1)(void *t, bus_space_handle_t bsh,		\
+	bus_size_t offset, const uint8_t *addr, bus_size_t count);	\
 
 #define	bs_wm_2_proto(f)		\
-void	__b

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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 19:59:48 UTC 2012

Modified Files:
src/sys/arch/arm/include: byte_swap.h

Log Message:
Add BSWAP16 and BSWAP32 macros for use in assembly.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/arm/include/byte_swap.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/arm/include/byte_swap.h
diff -u src/sys/arch/arm/include/byte_swap.h:1.9 src/sys/arch/arm/include/byte_swap.h:1.10
--- src/sys/arch/arm/include/byte_swap.h:1.9	Thu Jul 12 17:23:02 2012
+++ src/sys/arch/arm/include/byte_swap.h	Sun Jul 15 19:59:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: byte_swap.h,v 1.9 2012/07/12 17:23:02 matt Exp $	*/
+/*	$NetBSD: byte_swap.h,v 1.10 2012/07/15 19:59:48 matt Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1999, 2002 The NetBSD Foundation, Inc.
@@ -32,6 +32,33 @@
 #ifndef _ARM_BYTE_SWAP_H_
 #define	_ARM_BYTE_SWAP_H_
 
+#ifdef _LOCORE
+
+#if (ARM_ARCH_6 + ARM_ARCH_7) > 0
+
+#define	BSWAP16(_src, _dst, _tmp)		\
+	rev16	_dst, _src
+#define	BSWAP32(_src, _dst, _tmp)		\
+	rev	_dst, _src
+
+#else
+
+#define	BSWAP16(_src, _dst, _tmp)		\
+	mov	_tmp, _src, ror #8		;\
+	orr	_tmp, _tmp, _tmp, lsr #16	;\
+	bic	_dst, _tmp, _tmp, lsl #16
+
+#define	BSWAP32(_src, _dst, _tmp)		\
+	eor	_tmp, _src, _src, ror #16	;\
+	bic	_tmp, _tmp, #0x00FF		;\
+	mov	_dst, _src, ror #8		;\
+	eor	_dst, _dst, _tmp, lsr #8
+
+#endif
+
+
+#else
+
 #ifdef __GNUC__
 #include 
 __BEGIN_DECLS
@@ -87,5 +114,6 @@ __byte_swap_u16_variable(uint16_t v)
 __END_DECLS
 #endif
 
+#endif	/* _LOCORE */
 
 #endif /* _ARM_BYTE_SWAP_H_ */



CVS commit: src/doc

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 15 18:38:45 UTC 2012

Modified Files:
src/doc: CHANGES

Log Message:
Note recent linking of sysmon_envsys(8) with rnd(4)


To generate a diff of this commit:
cvs rdiff -u -r1.1717 -r1.1718 src/doc/CHANGES

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

Modified files:

Index: src/doc/CHANGES
diff -u src/doc/CHANGES:1.1717 src/doc/CHANGES:1.1718
--- src/doc/CHANGES:1.1717	Thu Jul 12 16:55:57 2012
+++ src/doc/CHANGES	Sun Jul 15 18:38:44 2012
@@ -1,4 +1,4 @@
-# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1717 $>
+# LIST OF CHANGES FROM LAST RELEASE:			<$Revision: 1.1718 $>
 #
 #
 # [Note: This file does not mention every change made to the NetBSD source tree.
@@ -80,3 +80,5 @@ Changes from NetBSD 6.0 to NetBSD 7.0:
 	kernel, libc: Add MurmurHash2 function. [rmind 20120708]
 	atf(7): Import 0.16.  [jmmv 20120711]
 	dhcpcd(8): Import dhcpcd-5.6.1 [roy 20120712]
+	kernel: Add support for sensors to provide entropy to rnd(4)
+		[pgoyette 20120715]



CVS commit: src/share/man/man9

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 15 18:34:03 UTC 2012

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

Log Message:
Document the new SYSMON_FHAS_ENTROPY flag.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/share/man/man9/sysmon_envsys.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/sysmon_envsys.9
diff -u src/share/man/man9/sysmon_envsys.9:1.41 src/share/man/man9/sysmon_envsys.9:1.42
--- src/share/man/man9/sysmon_envsys.9:1.41	Thu Dec  2 12:54:13 2010
+++ src/share/man/man9/sysmon_envsys.9	Sun Jul 15 18:34:03 2012
@@ -1,4 +1,4 @@
-.\"	$NetBSD: sysmon_envsys.9,v 1.41 2010/12/02 12:54:13 wiz Exp $
+.\"	$NetBSD: sysmon_envsys.9,v 1.42 2012/07/15 18:34:03 pgoyette Exp $
 .\"
 .\" Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 10, 2010
+.Dd July 13, 2012
 .Dt SYSMON_ENVSYS 9
 .Os
 .Sh NAME
@@ -530,6 +530,9 @@ Disallows setting of limits (or threshol
 .Xr ioctl 2 .
 This flag only disables setting the limits from userland.
 It has no effect on monitoring flags set by the driver.
+.It Dv ENVSYS_FHAS_ENTROPY
+Allows this sensor to provide entropy for
+.Xr rnd 4 .
 .El
 .Pp
 .Em If the driver has to use any of the



CVS commit: src/sys/dev/sysmon

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 15 18:33:07 UTC 2012

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c sysmon_envsys_events.c sysmonvar.h

Log Message:
If a sensor is flagged as capable of providing rnd(4) with entropy,
hook the sensor into rnd subsystem, and make sure we periodically
refresh the sensor whether or not it is being actively monitored.


To generate a diff of this commit:
cvs rdiff -u -r1.119 -r1.120 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.99 -r1.100 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sysmon/sysmonvar.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.119 src/sys/dev/sysmon/sysmon_envsys.c:1.120
--- src/sys/dev/sysmon/sysmon_envsys.c:1.119	Sun Jul 15 17:41:39 2012
+++ src/sys/dev/sysmon/sysmon_envsys.c	Sun Jul 15 18:33:07 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.119 2012/07/15 17:41:39 pgoyette Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.120 2012/07/15 18:33:07 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.119 2012/07/15 17:41:39 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.120 2012/07/15 18:33:07 pgoyette Exp $");
 
 #include 
 #include 
@@ -76,6 +76,7 @@ __KERNEL_RCSID(0, "$NetBSD: sysmon_envsy
 #include 
 #include 
 #include 
+#include 
 
 /* #define ENVSYS_DEBUG */
 #include 
@@ -360,7 +361,7 @@ sysmonioctl_envsys(dev_t dev, u_long cmd
 			if ((sme->sme_flags & SME_DISABLE_REFRESH) == 0 &&
 			(sme->sme_flags & SME_POLL_ONLY) == 0) {
 mutex_enter(&sme->sme_mtx);
-(*sme->sme_refresh)(sme, edata);
+sysmon_envsys_refresh_sensor(sme, edata);
 mutex_exit(&sme->sme_mtx);
 			}
 
@@ -602,7 +603,7 @@ sysmon_envsys_sensor_detach(struct sysmo
 	}
 
 	/*
-	 * remove it and decrement the sensors count.
+	 * remove it, unhook from rnd(4), and decrement the sensors count.
 	 */
 	sme_event_unregister_sensor(sme, edata);
 	TAILQ_REMOVE(&sme->sme_sensors_list, edata, sensors_head);
@@ -636,6 +637,7 @@ sysmon_envsys_register(struct sysmon_env
 	sme_event_drv_t *this_evdrv;
 	int nevent;
 	int error = 0;
+	char rnd_name[sizeof(edata->rnd_src.name)];
 
 	KASSERT(sme != NULL);
 	KASSERT(sme->sme_name != NULL);
@@ -773,6 +775,17 @@ out:
 			sme_event_drvadd, evdv->evdrv);
 			nevent++;
 		}
+		/*
+		 * Hook the sensor into rnd(4) entropy pool if requested
+		 */
+		TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head) {
+			if (edata->flags & ENVSYS_FHAS_ENTROPY) {
+snprintf(rnd_name, sizeof(rnd_name), "%s-%s",
+sme->sme_name, edata->desc);
+rnd_attach_source(&edata->rnd_src, rnd_name,
+RND_TYPE_ENV, 0);
+			}
+		}
 		DPRINTF(("%s: driver '%s' registered (nsens=%d nevent=%d)\n",
 		__func__, sme->sme_name, sme->sme_nsensors, nevent));
 	}
@@ -1003,7 +1016,7 @@ sme_initial_refresh(void *arg)
 	sysmon_envsys_acquire(sme, true);
 	TAILQ_FOREACH(edata, &sme->sme_sensors_list, sensors_head)
 		if ((sme->sme_flags & SME_DISABLE_REFRESH) == 0)
-			(*sme->sme_refresh)(sme, edata);
+			sysmon_envsys_refresh_sensor(sme, edata);
 	sysmon_envsys_release(sme, true);
 	mutex_exit(&sme->sme_mtx);
 }
@@ -1356,9 +1369,10 @@ sme_add_sensor_dictionary(struct sysmon_
 	}
 
 	/*
-	 * Register new event(s) if any monitoring flag was set.
+	 * Register new event(s) if any monitoring flag was set or if
+	 * the sensor provides entropy for rnd(4).
 	 */
-	if (edata->flags & ENVSYS_FMONANY) {
+	if (edata->flags & (ENVSYS_FMONANY | ENVSYS_FHAS_ENTROPY)) {
 		sme_evdrv_t = kmem_zalloc(sizeof(*sme_evdrv_t), KM_SLEEP);
 		sme_evdrv_t->sed_sdict = dict;
 		sme_evdrv_t->sed_edata = edata;
@@ -1427,7 +1441,7 @@ sme_get_max_value(struct sysmon_envsys *
 		 */
 		if (refresh && (sme->sme_flags & SME_DISABLE_REFRESH) == 0) {
 			mutex_enter(&sme->sme_mtx);
-			(*sme->sme_refresh)(sme, edata);
+			sysmon_envsys_refresh_sensor(sme, edata);
 			mutex_exit(&sme->sme_mtx);
 		}
 
@@ -1504,7 +1518,7 @@ sme_update_dictionary(struct sysmon_envs
 		 */
 		if ((sme->sme_flags & SME_DISABLE_REFRESH) == 0) {
 			mutex_enter(&sme->sme_mtx);
-			(*sme->sme_refresh)(sme, edata);
+			sysmon_envsys_refresh_sensor(sme, edata);
 			mutex_exit(&sme->sme_mtx);
 		}
 
@@ -1937,7 +1951,7 @@ sysmon_envsys_foreach_sensor(sysmon_envs
 			if (refresh &&
 			(sme->sme_flags & SME_DISABLE_REFRESH) == 0) {
 mutex_enter(&sme->sme_mtx);
-(*sme->sme_refresh)(sme, sensor);
+sysmon_envsys_refresh_sensor(sme, sensor);
 mutex_exit(&sme->sme_mtx);
 			}
 			if (!(*func)(sme, sensor, arg))
@@ -1947,3 +1961,25 @@ sysmon_envsys_foreach_sensor(sysmon_envs
 	}
 	mutex_exit(&sme_global_mtx);
 }
+
+/*
+ * Call the sensor's refresh function, and collect/stir entropy
+ */
+void
+sysmon_envsys_refresh_

CVS commit: src/sys/sys

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 15 18:31:35 UTC 2012

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

Log Message:
Add a new (dummy) event type so we can use it for forcing sensors to be
refreshed even when the sensor is not being monitored.


To generate a diff of this commit:
cvs rdiff -u -r1.16 -r1.17 src/sys/sys/power.h

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

Modified files:

Index: src/sys/sys/power.h
diff -u src/sys/sys/power.h:1.16 src/sys/sys/power.h:1.17
--- src/sys/sys/power.h:1.16	Wed Apr  6 08:15:44 2011
+++ src/sys/sys/power.h	Sun Jul 15 18:31:35 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: power.h,v 1.16 2011/04/06 08:15:44 jruoho Exp $	*/
+/*	$NetBSD: power.h,v 1.17 2012/07/15 18:31:35 pgoyette Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -208,6 +208,13 @@ struct pswitch_state {
 #define PENVSYS_EVENT_CAPACITY		210
 
 /*
+ * The following pseudo-event is used to force refreshing of a
+ * sensor that provides rnd(4) entropy, even if the sensor is not
+ * otherwise being monitored.
+ */
+#define PENVSYS_EVENT_NULL		220
+
+/*
  * This structure defines the properties of an envsys event.
  */
 struct penvsys_state {



CVS commit: src/sys/dev/sysmon

2012-07-15 Thread Paul Goyette
Module Name:src
Committed By:   pgoyette
Date:   Sun Jul 15 17:41:39 UTC 2012

Modified Files:
src/sys/dev/sysmon: sysmon_envsys.c sysmon_envsys_events.c
sysmon_envsysvar.h

Log Message:
When unregistering a sensor device, make sure we unregister and delete
all the associated events.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/sysmon/sysmon_envsys.c
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/sysmon/sysmon_envsys_events.c
cvs rdiff -u -r1.41 -r1.42 src/sys/dev/sysmon/sysmon_envsysvar.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/sysmon/sysmon_envsys.c
diff -u src/sys/dev/sysmon/sysmon_envsys.c:1.118 src/sys/dev/sysmon/sysmon_envsys.c:1.119
--- src/sys/dev/sysmon/sysmon_envsys.c:1.118	Sat Feb 18 01:08:00 2012
+++ src/sys/dev/sysmon/sysmon_envsys.c	Sun Jul 15 17:41:39 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: sysmon_envsys.c,v 1.118 2012/02/18 01:08:00 matt Exp $	*/
+/*	$NetBSD: sysmon_envsys.c,v 1.119 2012/07/15 17:41:39 pgoyette Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.118 2012/02/18 01:08:00 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys.c,v 1.119 2012/07/15 17:41:39 pgoyette Exp $");
 
 #include 
 #include 
@@ -604,6 +604,7 @@ sysmon_envsys_sensor_detach(struct sysmo
 	/*
 	 * remove it and decrement the sensors count.
 	 */
+	sme_event_unregister_sensor(sme, edata);
 	TAILQ_REMOVE(&sme->sme_sensors_list, edata, sensors_head);
 	sme->sme_nsensors--;
 	sysmon_envsys_release(sme, true);

Index: src/sys/dev/sysmon/sysmon_envsys_events.c
diff -u src/sys/dev/sysmon/sysmon_envsys_events.c:1.98 src/sys/dev/sysmon/sysmon_envsys_events.c:1.99
--- src/sys/dev/sysmon/sysmon_envsys_events.c:1.98	Wed Jun  8 16:14:57 2011
+++ src/sys/dev/sysmon/sysmon_envsys_events.c	Sun Jul 15 17:41:39 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: sysmon_envsys_events.c,v 1.98 2011/06/08 16:14:57 pgoyette Exp $ */
+/* $NetBSD: sysmon_envsys_events.c,v 1.99 2012/07/15 17:41:39 pgoyette Exp $ */
 
 /*-
  * Copyright (c) 2007, 2008 Juan Romero Pardines.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.98 2011/06/08 16:14:57 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sysmon_envsys_events.c,v 1.99 2012/07/15 17:41:39 pgoyette Exp $");
 
 #include 
 #include 
@@ -77,6 +77,8 @@ static bool sme_battery_check(void);
 static bool sme_battery_critical(envsys_data_t *);
 static bool sme_acadapter_check(void);
 
+static void sme_remove_event(sme_event_t *, struct sysmon_envsys *);
+
 /*
  * sme_event_register:
  *
@@ -334,11 +336,11 @@ sme_event_unregister_all(struct sysmon_e
 			break;
 
 		if (strcmp(see->see_pes.pes_dvname, sme->sme_name) == 0) {
-			LIST_REMOVE(see, see_list);
 			DPRINTF(("%s: event %s %d removed (%s)\n", __func__,
 			see->see_pes.pes_sensname, see->see_type,
 			sme->sme_name));
-			kmem_free(see, sizeof(*see));
+			sme_remove_event(see, sme);
+
 			evcounter--;
 		}
 	}
@@ -386,6 +388,58 @@ sme_event_unregister(struct sysmon_envsy
 
 	DPRINTF(("%s: removed dev=%s sensor=%s type=%d\n",
 	__func__, see->see_pes.pes_dvname, sensor, type));
+
+	sme_remove_event(see, sme);
+
+	mutex_exit(&sme->sme_mtx);
+	return 0;
+}
+
+/*
+ * sme_event_unregister_sensor:
+ *
+ *	+ Unregisters any event associated with a specific sensor
+ *	  The caller must already own the sme_mtx.
+ */
+int
+sme_event_unregister_sensor(struct sysmon_envsys *sme, envsys_data_t *edata)
+{
+	sme_event_t *see;
+	bool found = false;
+
+	KASSERT(mutex_owned(&sme->sme_mtx));
+	LIST_FOREACH(see, &sme->sme_events_list, see_list) {
+		if (see->see_edata == edata) {
+			found = true;
+			break;
+		}
+	}
+	if (!found)
+		return EINVAL;
+
+	/*
+	 * Wait for the event to finish its work, remove from the list
+	 * and release resouces.
+	 */
+	while (see->see_flags & SEE_EVENT_WORKING)
+		cv_wait(&sme->sme_condvar, &sme->sme_mtx);
+
+	DPRINTF(("%s: removed dev=%s sensor=%s\n",
+	__func__, see->see_pes.pes_dvname, edata->desc));
+
+	sme_remove_event(see, sme);
+
+	return 0;
+}
+
+static void
+sme_remove_event(sme_event_t *see, struct sysmon_envsys *sme)
+{
+
+	KASSERT(mutex_owned(&sme->sme_mtx));
+
+	if (see->see_edata->flags & ENVSYS_FHAS_ENTROPY)
+		rnd_detach_source(&see->see_edata->rnd_src);
 	LIST_REMOVE(see, see_list);
 	/*
 	 * So the events list is empty, we'll do the following:
@@ -395,10 +449,8 @@ sme_event_unregister(struct sysmon_envsy
 	 */
 	if (LIST_EMPTY(&sme->sme_events_list))
 		sme_events_destroy(sme);
-	mutex_exit(&sme->sme_mtx);
 
 	kmem_free(see, sizeof(*see));
-	return 0;
 }
 
 /*

Index: src/sys/dev/sysmon/sysmon_envsysvar.h
diff -u src/sys/dev/sysmon/sysmon_envsysvar.h:1.41 src/sys/dev/sysmon/sysmon_envsysvar.h:1.42
--- src/sys/dev/sysmon/sysmon_envsysvar.h:1.41	Sat Feb 18 01:08:00 2012
+++ src/sys/dev/sysmon/sysmon_envsysva

CVS commit: src/sys/dev/ata

2012-07-15 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jul 15 15:49:46 UTC 2012

Modified Files:
src/sys/dev/ata: ata.c

Log Message:
Stopgap crash prevention when atadebug_mask includes DEBUG_PROBE bit.


To generate a diff of this commit:
cvs rdiff -u -r1.118 -r1.119 src/sys/dev/ata/ata.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/ata/ata.c
diff -u src/sys/dev/ata/ata.c:1.118 src/sys/dev/ata/ata.c:1.119
--- src/sys/dev/ata/ata.c:1.118	Sun Jul 15 10:55:29 2012
+++ src/sys/dev/ata/ata.c	Sun Jul 15 15:49:46 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ata.c,v 1.118 2012/07/15 10:55:29 dsl Exp $	*/
+/*	$NetBSD: ata.c,v 1.119 2012/07/15 15:49:46 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.118 2012/07/15 10:55:29 dsl Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.119 2012/07/15 15:49:46 jakllsch Exp $");
 
 #include "opt_ata.h"
 
@@ -212,9 +212,11 @@ atabusconfig(struct atabus_softc *atabus
 	if (chp->ch_satapmp_nports == 0)
 		(*atac->atac_probe)(chp);
 
-	ATADEBUG_PRINT(("atabusattach: ch_drive_type 0x%x 0x%x\n",
-	chp->ch_drive[0].drive_type, chp->ch_drive[1].drive_type),
-	DEBUG_PROBE);
+	if (chp->ch_drive != NULL && chp->ch_ndrives >= 1) {
+		ATADEBUG_PRINT(("atabusattach: ch_drive_type 0x%x 0x%x\n",
+		chp->ch_drive[0].drive_type, chp->ch_drive[1].drive_type),
+		DEBUG_PROBE);
+	}
 
 	/* next operations will occurs in a separate thread */
 	s = splbio();



CVS commit: src/sys

2012-07-15 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Jul 15 15:17:57 UTC 2012

Modified Files:
src/sys/arch/amd64/amd64: genassym.cf locore.S machdep.c
netbsd32_machdep.c trap.c
src/sys/arch/amd64/include: frameasm.h proc.h
src/sys/arch/x86/include: cpu.h
src/sys/arch/x86/x86: vm_machdep.c
src/sys/compat/linux32/arch/amd64: linux32_machdep.c

Log Message:
Rename MDP_IRET to MDL_IRET since it is an lwp flag, not a proc one.
Add an MDL_COMPAT32 flag to the lwp's md_flags, set it for 32bit lwps
  and use it to force 'return to user' with iret (as is done when
  MDL_IRET is set).
Split the iret/sysret code paths much later.
Remove all the replicated code for 32bit system calls - which was only
  needed so that iret was always used.
frameasm.h for XEN contains '#define swapgs', while XEN probable never
  needs swapgs, this is likely to be confusing.
Add a SWAPGS which is a nop on XEN and swapgs otherwise.
(I've not yet checked all the swapgs in files that include frameasm.h)
Simple x86 programs still work.
Hijack 6.99.9 kernel bump (needed for compat32 modules)


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/amd64/amd64/genassym.cf
cvs rdiff -u -r1.69 -r1.70 src/sys/arch/amd64/amd64/locore.S
cvs rdiff -u -r1.188 -r1.189 src/sys/arch/amd64/amd64/machdep.c
cvs rdiff -u -r1.78 -r1.79 src/sys/arch/amd64/amd64/netbsd32_machdep.c
cvs rdiff -u -r1.72 -r1.73 src/sys/arch/amd64/amd64/trap.c
cvs rdiff -u -r1.19 -r1.20 src/sys/arch/amd64/include/frameasm.h
cvs rdiff -u -r1.14 -r1.15 src/sys/arch/amd64/include/proc.h
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/include/cpu.h
cvs rdiff -u -r1.15 -r1.16 src/sys/arch/x86/x86/vm_machdep.c
cvs rdiff -u -r1.30 -r1.31 \
src/sys/compat/linux32/arch/amd64/linux32_machdep.c

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

Modified files:

Index: src/sys/arch/amd64/amd64/genassym.cf
diff -u src/sys/arch/amd64/amd64/genassym.cf:1.51 src/sys/arch/amd64/amd64/genassym.cf:1.52
--- src/sys/arch/amd64/amd64/genassym.cf:1.51	Mon Jun 11 15:18:05 2012
+++ src/sys/arch/amd64/amd64/genassym.cf	Sun Jul 15 15:17:56 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: genassym.cf,v 1.51 2012/06/11 15:18:05 chs Exp $
+#	$NetBSD: genassym.cf,v 1.52 2012/07/15 15:17:56 dsl Exp $
 
 #
 # Copyright (c) 1998, 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -162,7 +162,8 @@ define	L_MD_ASTPENDING		offsetof(struct 
 
 define	PAGE_SIZE		PAGE_SIZE
 
-define	MDP_IRET		MDP_IRET
+define	MDL_IRET		MDL_IRET
+define	MDL_COMPAT32		MDL_COMPAT32
 
 define	P_FLAG			offsetof(struct proc, p_flag)
 define	P_RASLIST		offsetof(struct proc, p_raslist)

Index: src/sys/arch/amd64/amd64/locore.S
diff -u src/sys/arch/amd64/amd64/locore.S:1.69 src/sys/arch/amd64/amd64/locore.S:1.70
--- src/sys/arch/amd64/amd64/locore.S:1.69	Sat Jun 16 17:30:19 2012
+++ src/sys/arch/amd64/amd64/locore.S	Sun Jul 15 15:17:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore.S,v 1.69 2012/06/16 17:30:19 chs Exp $	*/
+/*	$NetBSD: locore.S,v 1.70 2012/07/15 15:17:56 dsl Exp $	*/
 
 /*
  * Copyright-o-rama!
@@ -986,9 +986,9 @@ ENTRY(cpu_switchto)
 	xorq	%rax, %rax
 	movw	%ax, %fs
 	CLI(cx)
-	swapgs
+	SWAPGS
 	movw	%ax, %gs
-	swapgs
+	SWAPGS
 	STI(cx)
 
 	movq	CPUVAR(GDT),%rcx
@@ -1018,9 +1018,9 @@ ENTRY(cpu_switchto)
 	movq	L_MD_REGS(%r12), %rbx
 	movw	TF_FS(%rbx), %fs
 	CLI(ax)
-	swapgs
+	SWAPGS
 	movw	TF_GS(%rbx), %gs
-	swapgs
+	SWAPGS
 	STI(ax)
 
 #else
@@ -1063,40 +1063,50 @@ IDTVEC(syscall32)
 /*
  * syscall()
  *
- * syscall insn entry. This currently isn't much faster, but
- * it can be made faster in the future.
+ * syscall insn entry.
+ * This currently isn't much faster, but it can be made faster in the future.
+ * (Actually we've already saved a few 100 clocks by not loading the trap gate)
  */
 IDTVEC(syscall)
 #ifndef XEN
+	/*
+	 * The user %rip is in %rcx and the user %flags in %r11.
+	 * The kernel %cs and %ss are loaded, but nothing else is.
+	 * The 'swapgs' gives us access to cpu-specific memory where
+	 * we can save a user register and then read the lwps
+	 * kernel stack pointer,
+	 * This code doesn't seem to set %ds, this may not matter since it
+	 * is ignored in 64bit mode, OTOH the syscall instruction sets %ss
+	 * and that is ignored as well.
+	 */
 	swapgs
 	movq	%r15,CPUVAR(SCRATCH)
 	movq	CPUVAR(CURLWP),%r15
 	movq	L_PCB(%r15),%r15
-	movq	PCB_RSP0(%r15),%r15
-	xchgq	%r15,%rsp
+	movq	PCB_RSP0(%r15),%r15	/* LWP's kernel stack pointer */
 
-	/*
-	 * XXX don't need this whole frame, split of the
-	 * syscall frame and trapframe is needed.
-	 * First, leave some room for the trapno, error,
-	 * ss:rsp, etc, so that all GP registers can be
-	 * saved. Then, fill in the rest.
-	 */
-	pushq	$(LSEL(LUDATA_SEL, SEL_UPL))	/* Known to be user ss */
-	pushq	%r15/* User space rsp */
+	/* Make stack look like an 'int nn' frame */
+#define SP(x)	(x)-(TF_SS+8)(%r15)
+	movq	$(LSEL(LUDATA_SEL, SEL_UPL)), SP(TF_SS

CVS commit: src/sys/dev/acpi

2012-07-15 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Jul 15 11:52:01 UTC 2012

Modified Files:
src/sys/dev/acpi: thinkpad_acpi.c

Log Message:
add function switch to switch on/off "wireless WAN", aka GSM et al modem
not tested to actually work, extensively tested not to do any harm if you
don't have a wwan


To generate a diff of this commit:
cvs rdiff -u -r1.39 -r1.40 src/sys/dev/acpi/thinkpad_acpi.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/acpi/thinkpad_acpi.c
diff -u src/sys/dev/acpi/thinkpad_acpi.c:1.39 src/sys/dev/acpi/thinkpad_acpi.c:1.40
--- src/sys/dev/acpi/thinkpad_acpi.c:1.39	Mon Jun 20 15:00:04 2011
+++ src/sys/dev/acpi/thinkpad_acpi.c	Sun Jul 15 11:52:01 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.39 2011/06/20 15:00:04 pgoyette Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.40 2012/07/15 11:52:01 spz Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.39 2011/06/20 15:00:04 pgoyette Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.40 2012/07/15 11:52:01 spz Exp $");
 
 #include 
 #include 
@@ -79,7 +79,7 @@ typedef struct thinkpad_softc {
 #define	THINKPAD_NOTIFY_BatteryInfo	0x003
 #define	THINKPAD_NOTIFY_SleepButton	0x004
 #define	THINKPAD_NOTIFY_WirelessSwitch	0x005
-#define	THINKPAD_NOTIFY_FnF6		0x006
+#define	THINKPAD_NOTIFY_wWANSwitch	0x006
 #define	THINKPAD_NOTIFY_DisplayCycle	0x007
 #define	THINKPAD_NOTIFY_PointerSwitch	0x008
 #define	THINKPAD_NOTIFY_EjectButton	0x009
@@ -120,6 +120,7 @@ static void	thinkpad_temp_refresh(struct
 static void	thinkpad_fan_refresh(struct sysmon_envsys *, envsys_data_t *);
 
 static void	thinkpad_wireless_toggle(thinkpad_softc_t *);
+static void	thinkpad_wwan_toggle(thinkpad_softc_t *);
 
 static bool	thinkpad_resume(device_t, const pmf_qual_t *);
 static void	thinkpad_brightness_up(device_t);
@@ -348,6 +349,9 @@ thinkpad_get_hotkeys(void *opaque)
 		case THINKPAD_NOTIFY_WirelessSwitch:
 			thinkpad_wireless_toggle(sc);
 			break;
+		case THINKPAD_NOTIFY_wWANSwitch:
+			thinkpad_wwan_toggle(sc);
+			break;
 		case THINKPAD_NOTIFY_SleepButton:
 			if (sc->sc_smpsw_valid == false)
 break;
@@ -405,7 +409,6 @@ thinkpad_get_hotkeys(void *opaque)
 			PSWITCH_EVENT_PRESSED);
 			break;
 		case THINKPAD_NOTIFY_FnF1:
-		case THINKPAD_NOTIFY_FnF6:
 		case THINKPAD_NOTIFY_PointerSwitch:
 		case THINKPAD_NOTIFY_FnF10:
 		case THINKPAD_NOTIFY_FnF11:
@@ -590,6 +593,13 @@ thinkpad_wireless_toggle(thinkpad_softc_
 	(void)AcpiEvaluateObject(sc->sc_node->ad_handle, "GWAN", NULL, NULL);
 }
 
+static void
+thinkpad_wwan_toggle(thinkpad_softc_t *sc)
+{
+	/* Ignore return value, as the hardware may not support wireless WAN */
+	(void)AcpiEvaluateObject(sc->sc_node->ad_handle, "WTGL", NULL, NULL);
+}
+
 static uint8_t
 thinkpad_brightness_read(thinkpad_softc_t *sc)
 {



CVS commit: src/sys/dev/pci

2012-07-15 Thread David Laight
Module Name:src
Committed By:   dsl
Date:   Sun Jul 15 10:56:50 UTC 2012

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

Log Message:
Some namespace protection (and add greppablity).
Prefix the DRIVE_ and DRIVET_ constants from atavar.h with ATA_.
Don't use an enum for drive_type - you don't know how big it will be.
Move driver_type to avoid implicit structure padding (esp on arm).
This change is purely lexical and mechanical.

Update to 6.99.9 - this wasn't done when the SATA PMP changes
were made - I'm sure they warranted a bump.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/dev/pci/nside.c

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

Modified files:

Index: src/sys/dev/pci/nside.c
diff -u src/sys/dev/pci/nside.c:1.3 src/sys/dev/pci/nside.c:1.4
--- src/sys/dev/pci/nside.c:1.3	Mon Jul  2 18:15:47 2012
+++ src/sys/dev/pci/nside.c	Sun Jul 15 10:56:50 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: nside.c,v 1.3 2012/07/02 18:15:47 bouyer Exp $	*/
+/*	$NetBSD: nside.c,v 1.4 2012/07/15 10:56:50 dsl Exp $	*/
 
 /*
  * Copyright (c) 1999, 2000, 2001 Manuel Bouyer.
@@ -25,7 +25,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: nside.c,v 1.3 2012/07/02 18:15:47 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: nside.c,v 1.4 2012/07/15 10:56:50 dsl Exp $");
 
 #include 
 #include 
@@ -173,12 +173,12 @@ natsemi_setup_channel(struct ata_channel
 	for (drive = 0; drive < 2; drive++) {
 		drvp = &chp->ch_drive[drive];
 		/* If no drive, skip */
-		if (drvp->drive_type == DRIVET_NONE)
+		if (drvp->drive_type == ATA_DRIVET_NONE)
 			continue;
 
 		ndrives++;
 		/* add timing values, setup DMA if needed */
-		if ((drvp->drive_flags & DRIVE_DMA) == 0) {
+		if ((drvp->drive_flags & ATA_DRIVE_DMA) == 0) {
 			tim = natsemi_pio_pulse[drvp->PIO_mode] |
 			(natsemi_pio_recover[drvp->PIO_mode] << 4);
 		} else {



CVS commit: src/dist/nvi/common

2012-07-15 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Jul 15 09:13:59 UTC 2012

Modified Files:
src/dist/nvi/common: exf.c

Log Message:
Use after free (Coverity 273146)


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/dist/nvi/common/exf.c

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

Modified files:

Index: src/dist/nvi/common/exf.c
diff -u src/dist/nvi/common/exf.c:1.4 src/dist/nvi/common/exf.c:1.5
--- src/dist/nvi/common/exf.c:1.4	Sat Nov 14 20:01:20 2009
+++ src/dist/nvi/common/exf.c	Sun Jul 15 09:13:59 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: exf.c,v 1.4 2009/11/14 20:01:20 tnozaki Exp $ */
+/*	$NetBSD: exf.c,v 1.5 2012/07/15 09:13:59 spz Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -173,6 +173,7 @@ file_init(SCR *sp, FREF *frp, char *rcv_
 			exfp->minode == sb.st_ino && 
 			(exfp != sp->ep || exfp->refcnt > 1)) {
 ep = exfp;
+oname = ep->rcv_path;
 goto postinit;
 			}
 		}
@@ -807,8 +808,10 @@ file_end(SCR *sp, EXF *ep, int force)
 		(void)close(ep->rcv_fd);
 	if (ep->env_path != NULL)
 		free(ep->env_path);
-	if (ep->rcv_path != NULL)
+	if (ep->rcv_path != NULL) {
 		free(ep->rcv_path);
+		ep->rcv_path = NULL;
+	}
 	if (ep->rcv_mpath != NULL)
 		free(ep->rcv_mpath);
 
@@ -1251,6 +1254,8 @@ file_backup(SCR *sp, const char *name, c
 	}
 	if (bp != NULL)
 		FREE_SPACE(sp, bp, blen);
+	if (d != NULL)
+		free(d);
 	return (0);
 
 alloc_err:



CVS commit: src/usr.sbin/mtree

2012-07-15 Thread S.P.Zeidler
Module Name:src
Committed By:   spz
Date:   Sun Jul 15 09:08:30 UTC 2012

Modified Files:
src/usr.sbin/mtree: create.c

Log Message:
resource leak (Coverity issues 274383 and 274384)


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.sbin/mtree/create.c

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

Modified files:

Index: src/usr.sbin/mtree/create.c
diff -u src/usr.sbin/mtree/create.c:1.58 src/usr.sbin/mtree/create.c:1.59
--- src/usr.sbin/mtree/create.c:1.58	Fri Apr  3 21:18:59 2009
+++ src/usr.sbin/mtree/create.c	Sun Jul 15 09:08:29 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: create.c,v 1.58 2009/04/03 21:18:59 apb Exp $	*/
+/*	$NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $	*/
 
 /*-
  * Copyright (c) 1989, 1993
@@ -38,7 +38,7 @@
 #if 0
 static char sccsid[] = "@(#)create.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: create.c,v 1.58 2009/04/03 21:18:59 apb Exp $");
+__RCSID("$NetBSD: create.c,v 1.59 2012/07/15 09:08:29 spz Exp $");
 #endif
 #endif /* not lint */
 
@@ -259,9 +259,11 @@ statf(FTSENT *p)
 	(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE))
 		output(&indent, "link=%s", vispath(rlink(p->fts_accpath)));
 #if HAVE_STRUCT_STAT_ST_FLAGS
-	if (keys & F_FLAGS && p->fts_statp->st_flags != flags)
-		output(&indent, "flags=%s",
-		flags_to_string(p->fts_statp->st_flags, "none"));
+	if (keys & F_FLAGS && p->fts_statp->st_flags != flags) {
+		char *str = flags_to_string(p->fts_statp->st_flags, "none");
+		output(&indent, "flags=%s", str);
+		free(str);
+	}
 #endif
 	putchar('\n');
 }
@@ -372,9 +374,11 @@ statd(FTS *t, FTSENT *parent, uid_t *pui
 			printf(" mode=%#lo", (u_long)savemode);
 		if (keys & F_NLINK)
 			printf(" nlink=1");
-		if (keys & F_FLAGS)
-			printf(" flags=%s",
-			flags_to_string(saveflags, "none"));
+		if (keys & F_FLAGS) {
+			char *str = flags_to_string(saveflags, "none");
+			printf(" flags=%s", str);
+			free(str);
+		}
 		printf("\n");
 		*puid = saveuid;
 		*pgid = savegid;



CVS commit: src/sys/arch

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 08:44:57 UTC 2012

Modified Files:
src/sys/arch/evbppc/conf: files.mpc85xx
src/sys/arch/evbppc/mpc85xx: machdep.c
src/sys/arch/powerpc/booke: e500_intr.c
src/sys/arch/powerpc/booke/dev: pq3etsec.c pq3gpio.c
src/sys/arch/powerpc/include/booke: e500reg.h openpicreg.h spr.h
Added Files:
src/sys/arch/evbppc/conf: INSTALL_TWRP1025 INSTALL_TWRP1025.MP TWRP1025
TWRP1025.MP

Log Message:
Add support for the Freescale TWR-P1025 evaluation board and the P1025/P1016
QorIQ processors.  XXX tsec isn't working yet on the TWR-P1025.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbppc/conf/INSTALL_TWRP1025 \
src/sys/arch/evbppc/conf/INSTALL_TWRP1025.MP \
src/sys/arch/evbppc/conf/TWRP1025 src/sys/arch/evbppc/conf/TWRP1025.MP
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/evbppc/conf/files.mpc85xx
cvs rdiff -u -r1.24 -r1.25 src/sys/arch/evbppc/mpc85xx/machdep.c
cvs rdiff -u -r1.18 -r1.19 src/sys/arch/powerpc/booke/e500_intr.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/powerpc/booke/dev/pq3etsec.c
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/powerpc/booke/dev/pq3gpio.c
cvs rdiff -u -r1.10 -r1.11 src/sys/arch/powerpc/include/booke/e500reg.h
cvs rdiff -u -r1.5 -r1.6 src/sys/arch/powerpc/include/booke/openpicreg.h
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/powerpc/include/booke/spr.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/evbppc/conf/files.mpc85xx
diff -u src/sys/arch/evbppc/conf/files.mpc85xx:1.8 src/sys/arch/evbppc/conf/files.mpc85xx:1.9
--- src/sys/arch/evbppc/conf/files.mpc85xx:1.8	Mon Jul  9 17:36:55 2012
+++ src/sys/arch/evbppc/conf/files.mpc85xx	Sun Jul 15 08:44:56 2012
@@ -1,9 +1,9 @@
-#	$NetBSD: files.mpc85xx,v 1.8 2012/07/09 17:36:55 matt Exp $
+#	$NetBSD: files.mpc85xx,v 1.9 2012/07/15 08:44:56 matt Exp $
 #
 # mpc85xx-specific configuration info
 
 defflag	opt_mpc85xx.h	MPC8536 MPC8544 MPC8548 MPC8555 MPC8568 MPC8572
-			P2020 CADMUS PIXIS E500_WDOG_STACK
+			P1025 P2020 CADMUS PIXIS E500_WDOG_STACK
 defparam opt_mpc85xx.h	SYS_CLK MEMSIZE
 
 file	arch/evbppc/mpc85xx/autoconf.c

Index: src/sys/arch/evbppc/mpc85xx/machdep.c
diff -u src/sys/arch/evbppc/mpc85xx/machdep.c:1.24 src/sys/arch/evbppc/mpc85xx/machdep.c:1.25
--- src/sys/arch/evbppc/mpc85xx/machdep.c:1.24	Sat Jul  7 08:06:51 2012
+++ src/sys/arch/evbppc/mpc85xx/machdep.c	Sun Jul 15 08:44:56 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.24 2012/07/07 08:06:51 skrll Exp $	*/
+/*	$NetBSD: machdep.c,v 1.25 2012/07/15 08:44:56 matt Exp $	*/
 /*-
  * Copyright (c) 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -205,12 +205,15 @@ static struct consdev e500_earlycons = {
  */
 static const struct cpunode_locators mpc8548_cpunode_locs[] = {
 	{ "cpu", 0, 0, 0, 0, { 0 }, 0,	/* not a real device */
-		{ 0x, SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
-#if defined(MPC8572) || defined(P2020)
+		{ 0x, SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16,
+		  SVR_P1025v1 >> 16 } },
+#if defined(MPC8572) || defined(P2020) || defined(P1025)
 	{ "cpu", 0, 0, 1, 0, { 0 }, 0,	/* not a real device */
-		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16,
+		  SVR_P1025v1 >> 16 } },
 	{ "cpu", 0, 0, 2, 0, { 0 }, 0,	/* not a real device */
-		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+		{ SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16,
+		  SVR_P1025v1 >> 16 } },
 #endif
 	{ "wdog" },	/* not a real device */
 	{ "duart", DUART1_BASE, 2*DUART_SIZE, 0,
@@ -219,12 +222,14 @@ static const struct cpunode_locators mpc
 	{ "tsec", ETSEC1_BASE, ETSEC_SIZE, 1,
 		3, { ISOURCE_ETSEC1_TX, ISOURCE_ETSEC1_RX, ISOURCE_ETSEC1_ERR },
 		1 + ilog2(DEVDISR_TSEC1) },
-#if defined(MPC8548) || defined(MPC8555) || defined(MPC8572) || defined(P2020)
+#if defined(MPC8548) || defined(MPC8555) || defined(MPC8572) \
+|| defined(P2020) || defined(P1025)
 	{ "tsec", ETSEC2_BASE, ETSEC_SIZE, 2,
 		3, { ISOURCE_ETSEC2_TX, ISOURCE_ETSEC2_RX, ISOURCE_ETSEC2_ERR },
 		1 + ilog2(DEVDISR_TSEC2),
 		{ SVR_MPC8548v1 >> 16, SVR_MPC8555v1 >> 16,
-		  SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16 } },
+		  SVR_MPC8572v1 >> 16, SVR_P2020v2 >> 16,
+		  SVR_P1025v1 >> 16 } },
 #endif
 #if defined(MPC8544) || defined(MPC8536)
 	{ "tsec", ETSEC3_BASE, ETSEC_SIZE, 2,
@@ -232,12 +237,12 @@ static const struct cpunode_locators mpc
 		1 + ilog2(DEVDISR_TSEC3),
 		{ SVR_MPC8536v1 >> 16, SVR_MPC8544v1 >> 16 } },
 #endif
-#if defined(MPC8548) || defined(MPC8572) || defined(P2020)
+#if defined(MPC8548) || defined(MPC8572) || defined(P1025) || defined(P2020)
 	{ "tsec", ETSEC3_BASE, ETSEC_SIZE, 3,
 		3, { ISOURCE_ETSEC3_TX, ISOURCE_ETSEC3_RX, ISOURCE_ETSEC3_ERR },
 		1 + ilog2(DEVDISR_TSEC3),
 		{ SVR_MPC8548v1 >> 16, SVR_MPC8572v1 >> 16,
-		  SVR_P2020v2 >> 16 } },
+		  SVR_P2020v2 >> 16, SVR_P1025v1 >> 16 } },
 #endif
 #if defined(MPC8548) |

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

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 08:26:21 UTC 2012

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

Log Message:
Use ldrexb/strexb for ARMv6 and above platforms since
"swp{b} use is deprecated" for them.


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 src/sys/arch/arm/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/arm/include/lock.h
diff -u src/sys/arch/arm/include/lock.h:1.17 src/sys/arch/arm/include/lock.h:1.18
--- src/sys/arch/arm/include/lock.h:1.17	Mon Apr 28 20:23:14 2008
+++ src/sys/arch/arm/include/lock.h	Sun Jul 15 08:26:21 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: lock.h,v 1.17 2008/04/28 20:23:14 martin Exp $	*/
+/*	$NetBSD: lock.h,v 1.18 2012/07/15 08:26:21 matt Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -77,10 +77,22 @@ __cpu_simple_lock_set(__cpu_simple_lock_
 static __inline int
 __swp(int __val, volatile unsigned char *__ptr)
 {
-
+#ifdef _ARM_ARCH_6
+	int __rv, __tmp;
+	__asm volatile(
+		"1:\t"
+		"ldrexb\t%[__rv], [%[__ptr]]"			"\n\t"
+		"strexb\t%[__tmp], %[__val], [%[__ptr]]"	"\n\t"
+		"cmpeq\t%[__tmp], #0""\n\t"
+		"bne 1b"
+	: [__rv] "=&r" (__rv), [__tmp] "=&r"(__tmp)
+	: [__val] "r" (__val), [__ptr] "r" (__ptr) : "memory");
+	return __rv;
+#else
 	__asm volatile("swpb %0, %1, [%2]"
 	: "=&r" (__val) : "r" (__val), "r" (__ptr) : "memory");
 	return __val;
+#endif
 }
 #else
 static __inline int



CVS commit: src/sys/dev/mii

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 07:31:19 UTC 2012

Modified Files:
src/sys/dev/mii: miidevs.h miidevs_data.h

Log Message:
Regen.


To generate a diff of this commit:
cvs rdiff -u -r1.110 -r1.111 src/sys/dev/mii/miidevs.h
cvs rdiff -u -r1.98 -r1.99 src/sys/dev/mii/miidevs_data.h

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

Modified files:

Index: src/sys/dev/mii/miidevs.h
diff -u src/sys/dev/mii/miidevs.h:1.110 src/sys/dev/mii/miidevs.h:1.111
--- src/sys/dev/mii/miidevs.h:1.110	Fri Apr  6 18:49:44 2012
+++ src/sys/dev/mii/miidevs.h	Sun Jul 15 07:31:18 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs.h,v 1.110 2012/04/06 18:49:44 matt Exp $	*/
+/*	$NetBSD: miidevs.h,v 1.111 2012/07/15 07:31:18 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.107 2012/04/06 18:49:17 matt Exp
+ *	NetBSD: miidevs,v 1.108 2012/07/15 07:30:57 matt Exp
  */
 
 /*-
@@ -135,6 +135,8 @@
 #define	MII_STR_ATTANSIC_L2	"L2 10/100 PHY"
 #define	MII_MODEL_ATTANSIC_AR8021	0x0004
 #define	MII_STR_ATTANSIC_AR8021	"Atheros AR8021 10/100/1000 PHY"
+#define	MII_MODEL_ATTANSIC_AR8035	0x0007
+#define	MII_STR_ATTANSIC_AR8035	"Atheros AR8035 10/100/1000 PHY"
 
 /* Altima Communications PHYs */
 /* Don't know the model for ACXXX */

Index: src/sys/dev/mii/miidevs_data.h
diff -u src/sys/dev/mii/miidevs_data.h:1.98 src/sys/dev/mii/miidevs_data.h:1.99
--- src/sys/dev/mii/miidevs_data.h:1.98	Fri Apr  6 18:49:45 2012
+++ src/sys/dev/mii/miidevs_data.h	Sun Jul 15 07:31:19 2012
@@ -1,10 +1,10 @@
-/*	$NetBSD: miidevs_data.h,v 1.98 2012/04/06 18:49:45 matt Exp $	*/
+/*	$NetBSD: miidevs_data.h,v 1.99 2012/07/15 07:31:19 matt Exp $	*/
 
 /*
  * THIS FILE AUTOMATICALLY GENERATED.  DO NOT EDIT.
  *
  * generated from:
- *	NetBSD: miidevs,v 1.107 2012/04/06 18:49:17 matt Exp
+ *	NetBSD: miidevs,v 1.108 2012/07/15 07:30:57 matt Exp
  */
 
 /*-
@@ -43,6 +43,7 @@ struct mii_knowndev mii_knowndevs[] = {
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L1, MII_STR_ATTANSIC_L1 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_L2, MII_STR_ATTANSIC_L2 },
  { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_AR8021, MII_STR_ATTANSIC_AR8021 },
+ { MII_OUI_ATTANSIC, MII_MODEL_ATTANSIC_AR8035, MII_STR_ATTANSIC_AR8035 },
  { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_ACXXX, MII_STR_ALTIMA_ACXXX },
  { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101, MII_STR_ALTIMA_AC101 },
  { MII_OUI_ALTIMA, MII_MODEL_ALTIMA_AC101L, MII_STR_ALTIMA_AC101L },



CVS commit: src/sys/dev/mii

2012-07-15 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Sun Jul 15 07:30:58 UTC 2012

Modified Files:
src/sys/dev/mii: miidevs

Log Message:
Add AR8035


To generate a diff of this commit:
cvs rdiff -u -r1.107 -r1.108 src/sys/dev/mii/miidevs

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/mii/miidevs
diff -u src/sys/dev/mii/miidevs:1.107 src/sys/dev/mii/miidevs:1.108
--- src/sys/dev/mii/miidevs:1.107	Fri Apr  6 18:49:17 2012
+++ src/sys/dev/mii/miidevs	Sun Jul 15 07:30:57 2012
@@ -1,4 +1,4 @@
-$NetBSD: miidevs,v 1.107 2012/04/06 18:49:17 matt Exp $
+$NetBSD: miidevs,v 1.108 2012/07/15 07:30:57 matt Exp $
 
 /*-
  * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc.
@@ -122,6 +122,7 @@ model ATHEROS F2		0x0002 F2 10/100 PHY
 model ATTANSIC L1		0x0001 L1 10/100/1000 PHY
 model ATTANSIC L2		0x0002 L2 10/100 PHY
 model ATTANSIC AR8021		0x0004 Atheros AR8021 10/100/1000 PHY
+model ATTANSIC AR8035		0x0007 Atheros AR8035 10/100/1000 PHY
 
 /* Altima Communications PHYs */
 /* Don't know the model for ACXXX */