CVS commit: [jmcneill-usbmp] src/sys/dev/usb

2011-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec  6 05:40:03 UTC 2011

Modified Files:
src/sys/dev/usb [jmcneill-usbmp]: uhci.c

Log Message:
don't take the sc_lock in uhci_device_request() since it is already
taken (as verified by the assert at the top of this function.)


To generate a diff of this commit:
cvs rdiff -u -r1.240.6.3 -r1.240.6.4 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.240.6.3 src/sys/dev/usb/uhci.c:1.240.6.4
--- src/sys/dev/usb/uhci.c:1.240.6.3	Tue Dec  6 05:26:26 2011
+++ src/sys/dev/usb/uhci.c	Tue Dec  6 05:40:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $	*/
+/*	$NetBSD: uhci.c,v 1.240.6.4 2011/12/06 05:40:02 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.4 2011/12/06 05:40:02 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -2524,7 +2524,6 @@ uhci_device_request(usbd_xfer_handle xfe
 	sqh->qh.qh_elink = htole32(setup->physaddr | UHCI_PTR_TD);
 	/* uhci_add_?s_ctrl() will do usb_syncmem(sqh) */
 
-	mutex_enter(&sc->sc_lock);
 	if (dev->speed == USB_SPEED_LOW)
 		uhci_add_ls_ctrl(sc, sqh);
 	else
@@ -2562,7 +2561,6 @@ uhci_device_request(usbd_xfer_handle xfe
 			uhci_timeout, ii);
 	}
 	xfer->status = USBD_IN_PROGRESS;
-	mutex_exit(&sc->sc_lock);
 
 	return (USBD_NORMAL_COMPLETION);
 }



CVS commit: [jmcneill-usbmp] src/sys/dev/usb

2011-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec  6 05:26:26 UTC 2011

Modified Files:
src/sys/dev/usb [jmcneill-usbmp]: uhci.c

Log Message:
kassert the right lock.


To generate a diff of this commit:
cvs rdiff -u -r1.240.6.2 -r1.240.6.3 src/sys/dev/usb/uhci.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.240.6.2 src/sys/dev/usb/uhci.c:1.240.6.3
--- src/sys/dev/usb/uhci.c:1.240.6.2	Tue Dec  6 05:06:50 2011
+++ src/sys/dev/usb/uhci.c	Tue Dec  6 05:26:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhci.c,v 1.240.6.2 2011/12/06 05:06:50 mrg Exp $	*/
+/*	$NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
@@ -43,7 +43,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.2 2011/12/06 05:06:50 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.3 2011/12/06 05:26:26 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -1323,7 +1323,7 @@ uhci_intr1(uhci_softc_t *sc)
 	}
 #endif
 
-	KASSERT(mutex_owned(&sc->sc_lock));
+	KASSERT(mutex_owned(&sc->sc_intr_lock));
 
 	status = UREAD2(sc, UHCI_STS) & UHCI_STS_ALLINTRS;
 	if (status == 0)	/* The interrupt was not for us. */



CVS commit: [jmcneill-usbmp] src/sys/dev/usb

2011-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec  6 05:06:50 UTC 2011

Modified Files:
src/sys/dev/usb [jmcneill-usbmp]: uhci.c uhcivar.h

Log Message:
my compiles-but-un-runtime-tested port of uhci to usbmp branch.
based upon the ohci and ehci changes.


To generate a diff of this commit:
cvs rdiff -u -r1.240.6.1 -r1.240.6.2 src/sys/dev/usb/uhci.c
cvs rdiff -u -r1.48 -r1.48.12.1 src/sys/dev/usb/uhcivar.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/uhci.c
diff -u src/sys/dev/usb/uhci.c:1.240.6.1 src/sys/dev/usb/uhci.c:1.240.6.2
--- src/sys/dev/usb/uhci.c:1.240.6.1	Sun Dec  4 13:23:17 2011
+++ src/sys/dev/usb/uhci.c	Tue Dec  6 05:06:50 2011
@@ -1,13 +1,14 @@
-/*	$NetBSD: uhci.c,v 1.240.6.1 2011/12/04 13:23:17 jmcneill Exp $	*/
+/*	$NetBSD: uhci.c,v 1.240.6.2 2011/12/06 05:06:50 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhci.c,v 1.33 1999/11/17 22:33:41 n_hibma Exp $	*/
 
 /*
- * Copyright (c) 1998, 2004 The NetBSD Foundation, Inc.
+ * Copyright (c) 1998, 2004, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
  * by Lennart Augustsson (lenn...@augustsson.net) at
- * Carlstedt Research & Technology.
+ * Carlstedt Research & Technology, Jared D. McNeill (jmcne...@invisible.ca)
+ * and Matthew R. Green.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -42,14 +43,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.1 2011/12/04 13:23:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uhci.c,v 1.240.6.2 2011/12/06 05:06:50 mrg Exp $");
 
 #include "opt_usb.h"
 
 #include 
 #include 
 #include 
-#include 
+#include 
 #include 
 #include 
 #include 
@@ -171,6 +172,8 @@ Static void		uhci_freem(struct usbd_bus 
 
 Static usbd_xfer_handle	uhci_allocx(struct usbd_bus *);
 Static void		uhci_freex(struct usbd_bus *, usbd_xfer_handle);
+Static void		uhci_get_locks(struct usbd_bus *, kmutex_t **,
+   kmutex_t **);
 
 Static usbd_status	uhci_device_ctrl_transfer(usbd_xfer_handle);
 Static usbd_status	uhci_device_ctrl_start(usbd_xfer_handle);
@@ -288,7 +291,7 @@ const struct usbd_bus_methods uhci_bus_m
 	uhci_freem,
 	uhci_allocx,
 	uhci_freex,
-	NULL, /* uhci_get_locks */
+	uhci_get_locks,
 };
 
 const struct usbd_pipe_methods uhci_root_ctrl_methods = {
@@ -523,7 +526,11 @@ uhci_init(uhci_softc_t *sc)
 
 	SIMPLEQ_INIT(&sc->sc_free_xfers);
 
-	callout_init(&sc->sc_poll_handle, 0);
+	callout_init(&sc->sc_poll_handle, CALLOUT_MPSAFE);
+
+	mutex_init(&sc->sc_lock, MUTEX_DEFAULT, IPL_SOFTUSB);
+	mutex_init(&sc->sc_intr_lock, MUTEX_DEFAULT, IPL_USB);
+	cv_init(&sc->sc_softwake_cv, "uhciab");
 
 	/* Set up the bus struct. */
 	sc->sc_bus.methods = &uhci_bus_methods;
@@ -580,12 +587,17 @@ uhci_detach(struct uhci_softc *sc, int f
 		if (xfer == NULL)
 			break;
 		SIMPLEQ_REMOVE_HEAD(&sc->sc_free_xfers, next);
-		free(xfer, M_USB);
+		kmem_free(xfer, sizeof(struct uhci_xfer));
 	}
 
 	callout_halt(&sc->sc_poll_handle, NULL);
 	callout_destroy(&sc->sc_poll_handle);
 
+	cv_destroy(&sc->sc_softwake_cv);
+
+	mutex_destroy(&sc->sc_lock);
+	mutex_destroy(&sc->sc_intr_lock);
+
 	/* XXX free other data structures XXX */
 
 	return (rv);
@@ -609,18 +621,19 @@ uhci_allocm(struct usbd_bus *bus, usb_dm
 	if (n > 16) {
 		u_int32_t i;
 		uhci_soft_td_t **stds;
+
 		DPRINTF(("uhci_allocm: get %d TDs\n", n));
-		stds = malloc(sizeof(uhci_soft_td_t *) * n, M_TEMP,
-		M_WAITOK|M_ZERO);
-		for(i=0; i < n; i++)
+		stds = kmem_alloc(sizeof(uhci_soft_td_t *) * n, KM_SLEEP);
+		if (!stds)
+			return USBD_NOMEM;
+		for(i = 0; i < n; i++)
 			stds[i] = uhci_alloc_std(sc);
-		for(i=0; i < n; i++)
+		for(i = 0; i < n; i++)
 			if (stds[i] != NULL)
 uhci_free_std(sc, stds[i]);
-		free(stds, M_TEMP);
+		kmem_free(stds, sizeof(uhci_soft_td_t *) * n);
 	}
 
-
 	status = usb_allocmem(&sc->sc_bus, size, 0, dma);
 	if (status == USBD_NOMEM)
 		status = usb_reserve_allocm(&sc->sc_dma_reserve, dma, size);
@@ -654,7 +667,7 @@ uhci_allocx(struct usbd_bus *bus)
 		}
 #endif
 	} else {
-		xfer = malloc(sizeof(struct uhci_xfer), M_USB, M_NOWAIT);
+		xfer = kmem_alloc(sizeof(struct uhci_xfer), KM_SLEEP);
 	}
 	if (xfer != NULL) {
 		memset(xfer, 0, sizeof (struct uhci_xfer));
@@ -685,6 +698,16 @@ uhci_freex(struct usbd_bus *bus, usbd_xf
 	SIMPLEQ_INSERT_HEAD(&sc->sc_free_xfers, xfer, next);
 }
 
+Static void
+uhci_get_locks(struct usbd_bus *bus, kmutex_t **intr, kmutex_t **thread)
+{
+	struct uhci_softc *sc = bus->hci_private;
+
+	*intr = &sc->sc_intr_lock;
+	*thread = &sc->sc_lock;
+}
+
+
 /*
  * Handle suspend/resume.
  *
@@ -697,9 +720,8 @@ uhci_resume(device_t dv, const pmf_qual_
 {
 	uhci_softc_t *sc = device_private(dv);
 	int cmd;
-	int s;
 
-	s = splhardusb();
+	mutex_spin_enter(&sc->sc_intr_lock);
 
 	cmd = UREAD2(sc

CVS commit: [jmcneill-usbmp] src/sys/dev/usb

2011-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec  6 05:05:30 UTC 2011

Modified Files:
src/sys/dev/usb [jmcneill-usbmp]: ohci.c

Log Message:
don't forget to drop the lock in ohci_intr if we got there when
polling.  also don't try to drop a lock we don't have in ohci_open.

XXX: these might apply to ehci as well, i found them when porting
XXX: to uhci.


To generate a diff of this commit:
cvs rdiff -u -r1.218.6.3 -r1.218.6.4 src/sys/dev/usb/ohci.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/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.218.6.3 src/sys/dev/usb/ohci.c:1.218.6.4
--- src/sys/dev/usb/ohci.c:1.218.6.3	Tue Dec  6 02:10:01 2011
+++ src/sys/dev/usb/ohci.c	Tue Dec  6 05:05:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.218.6.3 2011/12/06 02:10:01 mrg Exp $	*/
+/*	$NetBSD: ohci.c,v 1.218.6.4 2011/12/06 05:05:30 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.3 2011/12/06 02:10:01 mrg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.4 2011/12/06 05:05:30 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -1147,7 +1147,7 @@ ohci_intr(void *p)
 		OWRITE4(sc, OHCI_INTERRUPT_STATUS,
 			OREAD4(sc, OHCI_INTERRUPT_STATUS));
 
-		return (0);
+		goto done;
 	}
 
 	ret = ohci_intr1(sc);
@@ -2225,7 +2225,6 @@ ohci_open(usbd_pipe_handle pipe)
 	if (sed != NULL)
 		ohci_free_sed(sc, sed);
  bad0:
-	mutex_exit(&sc->sc_lock);
 	return err;
 
 }



CVS commit: [jmcneill-usbmp] src/sys/dev/usb

2011-12-05 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Tue Dec  6 02:10:02 UTC 2011

Modified Files:
src/sys/dev/usb [jmcneill-usbmp]: ehci.c ohci.c usb.c

Log Message:
need to ensure kpreempt_disable() for softint_schedule().

fix the locking in ohci_timeout_task(), ohci_device_isoc_start(),
ohci_device_isoc_abort() and ohci_device_isoc_close().

uaudio(4) can still play with these, but mixerctl -a against it will
hang the writer.  however, mixerctl continues to run in a tight loop
and the system isn't soft-locked up at this point, an advance from
how it is in -current.


To generate a diff of this commit:
cvs rdiff -u -r1.181.6.2 -r1.181.6.3 src/sys/dev/usb/ehci.c
cvs rdiff -u -r1.218.6.2 -r1.218.6.3 src/sys/dev/usb/ohci.c
cvs rdiff -u -r1.125.6.1 -r1.125.6.2 src/sys/dev/usb/usb.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/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.181.6.2 src/sys/dev/usb/ehci.c:1.181.6.3
--- src/sys/dev/usb/ehci.c:1.181.6.2	Sun Dec  4 19:22:56 2011
+++ src/sys/dev/usb/ehci.c	Tue Dec  6 02:10:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.181.6.2 2011/12/04 19:22:56 jmcneill Exp $ */
+/*	$NetBSD: ehci.c,v 1.181.6.3 2011/12/06 02:10:01 mrg Exp $ */
 
 /*
  * Copyright (c) 2004-2011 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.2 2011/12/04 19:22:56 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.181.6.3 2011/12/06 02:10:01 mrg Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -652,7 +652,9 @@ ehci_intr1(ehci_softc_t *sc)
 	sc->sc_bus.no_intrs++;
 	if (eintrs & EHCI_STS_IAA) {
 		DPRINTF(("ehci_intr1: door bell\n"));
+		kpreempt_disable();
 		softint_schedule(sc->sc_doorbell_si);
+		kpreempt_enable();
 		eintrs &= ~EHCI_STS_IAA;
 	}
 	if (eintrs & (EHCI_STS_INT | EHCI_STS_ERRINT)) {
@@ -668,7 +670,9 @@ ehci_intr1(ehci_softc_t *sc)
 		/* XXX what else */
 	}
 	if (eintrs & EHCI_STS_PCD) {
+		kpreempt_disable();
 		softint_schedule(sc->sc_pcd_si);
+		kpreempt_enable();
 		eintrs &= ~EHCI_STS_PCD;
 	}
 

Index: src/sys/dev/usb/ohci.c
diff -u src/sys/dev/usb/ohci.c:1.218.6.2 src/sys/dev/usb/ohci.c:1.218.6.3
--- src/sys/dev/usb/ohci.c:1.218.6.2	Sun Dec  4 21:02:27 2011
+++ src/sys/dev/usb/ohci.c	Tue Dec  6 02:10:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ohci.c,v 1.218.6.2 2011/12/04 21:02:27 jmcneill Exp $	*/
+/*	$NetBSD: ohci.c,v 1.218.6.3 2011/12/06 02:10:01 mrg Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/ohci.c,v 1.22 1999/11/17 22:33:40 n_hibma Exp $	*/
 
 /*
@@ -42,7 +42,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.2 2011/12/04 21:02:27 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.218.6.3 2011/12/06 02:10:01 mrg Exp $");
 
 #include "opt_usb.h"
 
@@ -2020,14 +2020,10 @@ void
 ohci_timeout_task(void *addr)
 {
 	usbd_xfer_handle xfer = addr;
-	ohci_softc_t *sc = xfer->pipe->device->bus->hci_private;
 
 	DPRINTF(("ohci_timeout_task: xfer=%p\n", xfer));
 
-	KASSERT(mutex_owned(&sc->sc_lock));
-	//mutex_enter(&sc->sc_lock);
 	ohci_abort_xfer(xfer, USBD_TIMEOUT);
-	//mutex_exit(&sc->sc_lock);
 }
 
 #ifdef OHCI_DEBUG
@@ -3540,6 +3536,8 @@ ohci_device_isoc_start(usbd_xfer_handle 
 
 	/* XXX anything to do? */
 
+	mutex_exit(&sc->sc_lock);
+
 	return (USBD_IN_PROGRESS);
 }
 
@@ -3551,9 +3549,9 @@ ohci_device_isoc_abort(usbd_xfer_handle 
 	ohci_soft_ed_t *sed;
 	ohci_soft_itd_t *sitd;
 
-	DPRINTFN(1,("ohci_device_isoc_abort: xfer=%p\n", xfer));
+	DPRINTFN(1,("ohci_device_isoc_abort: xfer=%p lock=%p\n", xfer, &sc->sc_lock));
 
-	KASSERT(mutex_owned(&sc->sc_lock));
+	mutex_enter(&sc->sc_lock);
 
 	/* Transfer is already done. */
 	if (xfer->status != USBD_NOT_STARTED &&
@@ -3635,9 +3633,11 @@ ohci_device_isoc_close(usbd_pipe_handle 
 	ohci_softc_t *sc = pipe->device->bus->hci_private;
 
 	DPRINTF(("ohci_device_isoc_close: pipe=%p\n", pipe));
+	mutex_enter(&sc->sc_lock);
 	ohci_close_pipe(pipe, sc->sc_isoc_head);
 #ifdef DIAGNOSTIC
 	opipe->tail.itd->isdone = 1;
 #endif
+	mutex_exit(&sc->sc_lock);
 	ohci_free_sitd(sc, opipe->tail.itd);
 }

Index: src/sys/dev/usb/usb.c
diff -u src/sys/dev/usb/usb.c:1.125.6.1 src/sys/dev/usb/usb.c:1.125.6.2
--- src/sys/dev/usb/usb.c:1.125.6.1	Sun Dec  4 13:23:17 2011
+++ src/sys/dev/usb/usb.c	Tue Dec  6 02:10:01 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: usb.c,v 1.125.6.1 2011/12/04 13:23:17 jmcneill Exp $	*/
+/*	$NetBSD: usb.c,v 1.125.6.2 2011/12/06 02:10:01 mrg Exp $	*/
 
 /*
  * Copyright (c) 1998, 2002, 2008 The NetBSD Foundation, Inc.
@@ -37,7 +37,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.1 2011/12/04 13:23:17 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: usb.c,v 1.125.6.2 2011/12/06 02:10:01 mrg Exp $");
 
 #include "opt_compat_netbsd.h"
 #include "opt_usb.h"
@@ -890,7 +890,9 @@ usb_add_event(int type, struct usb_event
 	wakeup(&usb_events);
 	selnotify(&usb_selevent, 0, 0);
 	if (usb_async_proc != NULL) {
+		kpreempt_disable();
 	

CVS commit: src

2011-12-05 Thread Jean-Yves Migeon
Module Name:src
Committed By:   jym
Date:   Mon Dec  5 23:04:39 UTC 2011

Modified Files:
src: build.sh

Log Message:
do_sys_sync() is part of vfs, hence rumpvfs. Used by pmf(9) during
device suspend, so explicitly link against rumpvfs to resolve that
symbol when linking rumpdev.

Unbreaks "rumptest" target.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/build.sh

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

Modified files:

Index: src/build.sh
diff -u src/build.sh:1.251 src/build.sh:1.252
--- src/build.sh:1.251	Mon Oct 17 16:22:12 2011
+++ src/build.sh	Mon Dec  5 23:04:39 2011
@@ -1,5 +1,5 @@
 #! /usr/bin/env sh
-#	$NetBSD: build.sh,v 1.251 2011/10/17 16:22:12 mbalmer Exp $
+#	$NetBSD: build.sh,v 1.252 2011/12/05 23:04:39 jym Exp $
 #
 # Copyright (c) 2001-2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -1632,7 +1632,7 @@ createmakewrapper()
 	eval cat <

CVS commit: src/sys/kern

2011-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  5 21:30:48 UTC 2011

Modified Files:
src/sys/kern: kern_ksyms.c

Log Message:
close the comment, there is a draft.


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

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

Modified files:

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.66 src/sys/kern/kern_ksyms.c:1.67
--- src/sys/kern/kern_ksyms.c:1.66	Mon Dec  5 15:55:14 2011
+++ src/sys/kern/kern_ksyms.c	Mon Dec  5 16:30:48 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.66 2011/12/05 20:55:14 christos Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.67 2011/12/05 21:30:48 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.66 2011/12/05 20:55:14 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.67 2011/12/05 21:30:48 christos Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -134,7 +134,7 @@ int		db_symtabsize = SYMTAB_SPACE;
 struct ksyms_hdr ksyms_hdr;
 int ksyms_symsz;
 int ksyms_strsz;
-int ksyms_ctfsz;	/* this is not currently used by savecore(8)
+int ksyms_ctfsz;	/* this is not currently used by savecore(8) */
 TAILQ_HEAD(, ksyms_symtab) ksyms_symtabs =
 TAILQ_HEAD_INITIALIZER(ksyms_symtabs);
 



CVS commit: src/sys/kern

2011-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  5 20:55:14 UTC 2011

Modified Files:
src/sys/kern: kern_ksyms.c

Log Message:
PR/45687: Mike Pumford: savecore: (null): _ksyms_hdr not in namelist
Make it non-static and add a comment so that they don't become static again.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/kern/kern_ksyms.c

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

Modified files:

Index: src/sys/kern/kern_ksyms.c
diff -u src/sys/kern/kern_ksyms.c:1.65 src/sys/kern/kern_ksyms.c:1.66
--- src/sys/kern/kern_ksyms.c:1.65	Thu Jul 28 09:42:16 2011
+++ src/sys/kern/kern_ksyms.c	Mon Dec  5 15:55:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_ksyms.c,v 1.65 2011/07/28 13:42:16 uebayasi Exp $	*/
+/*	$NetBSD: kern_ksyms.c,v 1.66 2011/12/05 20:55:14 christos Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -71,7 +71,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.65 2011/07/28 13:42:16 uebayasi Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_ksyms.c,v 1.66 2011/12/05 20:55:14 christos Exp $");
 
 #if defined(_KERNEL) && defined(_KERNEL_OPT)
 #include "opt_ddb.h"
@@ -107,8 +107,8 @@ static uint32_t *ksyms_nmap = NULL;
 static int ksyms_maxlen;
 static bool ksyms_isopen;
 static bool ksyms_initted;
-static struct ksyms_hdr ksyms_hdr;
 static kmutex_t ksyms_lock;
+static struct ksyms_symtab kernel_symtab;
 
 void ksymsattach(int);
 static void ksyms_hdr_init(void *);
@@ -128,12 +128,15 @@ char		db_symtab[SYMTAB_SPACE] = SYMTAB_F
 int		db_symtabsize = SYMTAB_SPACE;
 #endif
 
+/*
+ * used by savecore(8) so non-static
+ */
+struct ksyms_hdr ksyms_hdr;
 int ksyms_symsz;
 int ksyms_strsz;
-int ksyms_ctfsz;
+int ksyms_ctfsz;	/* this is not currently used by savecore(8)
 TAILQ_HEAD(, ksyms_symtab) ksyms_symtabs =
 TAILQ_HEAD_INITIALIZER(ksyms_symtabs);
-static struct ksyms_symtab kernel_symtab;
 
 static int
 ksyms_verify(void *symstart, void *strstart)



CVS commit: src/sys/dev

2011-12-05 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Dec  5 19:20:55 UTC 2011

Modified Files:
src/sys/dev/isa: joy_isa.c
src/sys/dev/isapnp: joy_isapnp.c
src/sys/dev/pci: joy_pci.c

Log Message:
make joy code consistent (avoid games with pointers), and fix the isa softc
declaration


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isa/joy_isa.c
cvs rdiff -u -r1.13 -r1.14 src/sys/dev/isapnp/joy_isapnp.c
cvs rdiff -u -r1.18 -r1.19 src/sys/dev/pci/joy_pci.c

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

Modified files:

Index: src/sys/dev/isa/joy_isa.c
diff -u src/sys/dev/isa/joy_isa.c:1.13 src/sys/dev/isa/joy_isa.c:1.14
--- src/sys/dev/isa/joy_isa.c:1.13	Wed Nov 23 18:07:32 2011
+++ src/sys/dev/isa/joy_isa.c	Mon Dec  5 14:20:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: joy_isa.c,v 1.13 2011/11/23 23:07:32 jmcneill Exp $	*/
+/*	$NetBSD: joy_isa.c,v 1.14 2011/12/05 19:20:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995 Jean-Marc Zucconi
@@ -33,7 +33,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: joy_isa.c,v 1.13 2011/11/23 23:07:32 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: joy_isa.c,v 1.14 2011/12/05 19:20:54 christos Exp $");
 
 #include 
 #include 
@@ -49,7 +49,7 @@ __KERNEL_RCSID(0, "$NetBSD: joy_isa.c,v 
 #define JOY_NPORTS1
 
 struct joy_isa_softc {
-	struct joy_softc	*sc;
+	struct joy_softc	sc_joy;
 	kmutex_t		sc_lock;
 };
 
@@ -101,8 +101,8 @@ joy_isa_probe(device_t parent, cfdata_t 
 static void
 joy_isa_attach(device_t parent, device_t self, void *aux)
 {
-	struct joy_softc *sc = device_private(self);
 	struct joy_isa_softc *isc = device_private(self);
+	struct joy_softc *sc = &isc->sc_joy;
 	struct isa_attach_args *ia = aux;
 
 	aprint_normal("\n");

Index: src/sys/dev/isapnp/joy_isapnp.c
diff -u src/sys/dev/isapnp/joy_isapnp.c:1.13 src/sys/dev/isapnp/joy_isapnp.c:1.14
--- src/sys/dev/isapnp/joy_isapnp.c:1.13	Wed Nov 23 18:07:33 2011
+++ src/sys/dev/isapnp/joy_isapnp.c	Mon Dec  5 14:20:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: joy_isapnp.c,v 1.13 2011/11/23 23:07:33 jmcneill Exp $	*/
+/*	$NetBSD: joy_isapnp.c,v 1.14 2011/12/05 19:20:54 christos Exp $	*/
 
 /*-
  * Copyright (c) 1996, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: joy_isapnp.c,v 1.13 2011/11/23 23:07:33 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: joy_isapnp.c,v 1.14 2011/12/05 19:20:54 christos Exp $");
 
 #include 
 #include 
@@ -71,8 +71,8 @@ joy_isapnp_match(device_t parent, cfdata
 static void
 joy_isapnp_attach(device_t parent, device_t self, void *aux)
 {
-	struct joy_softc *sc = device_private(self);
 	struct joy_isapnp_softc *isc = device_private(self);
+	struct joy_softc *sc = &isc->sc_joy;
 	struct isapnp_attach_args *ipa = aux;
 	bus_space_handle_t ioh;
 

Index: src/sys/dev/pci/joy_pci.c
diff -u src/sys/dev/pci/joy_pci.c:1.18 src/sys/dev/pci/joy_pci.c:1.19
--- src/sys/dev/pci/joy_pci.c:1.18	Wed Nov 23 18:07:35 2011
+++ src/sys/dev/pci/joy_pci.c	Mon Dec  5 14:20:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: joy_pci.c,v 1.18 2011/11/23 23:07:35 jmcneill Exp $	*/
+/*	$NetBSD: joy_pci.c,v 1.19 2011/12/05 19:20:55 christos Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: joy_pci.c,v 1.18 2011/11/23 23:07:35 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: joy_pci.c,v 1.19 2011/12/05 19:20:55 christos Exp $");
 
 #include 
 #include 
@@ -88,8 +88,8 @@ bar_is_io(pci_chipset_tag_t pc, pcitag_t
 static void
 joy_pci_attach(device_t parent, device_t self, void *aux)
 {
-	struct joy_softc *sc = device_private(self);
 	struct joy_pci_softc *psc = device_private(self);
+	struct joy_softc *sc = &psc->sc_joy;
 	struct pci_attach_args *pa = aux;
 	char devinfo[256];
 	bus_size_t mapsize;



CVS commit: src/sys/arch/hp700/hp700

2011-12-05 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Mon Dec  5 15:04:27 UTC 2011

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

Log Message:
Fix mm_md_kernacc to report correct status for the direct mapped pages
between kernel start and end of physical memory.  Report everything else
as unhandled.


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/hp700/hp700/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/hp700/hp700/machdep.c
diff -u src/sys/arch/hp700/hp700/machdep.c:1.100 src/sys/arch/hp700/hp700/machdep.c:1.101
--- src/sys/arch/hp700/hp700/machdep.c:1.100	Sun Jun 12 03:35:41 2011
+++ src/sys/arch/hp700/hp700/machdep.c	Mon Dec  5 15:04:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: machdep.c,v 1.100 2011/06/12 03:35:41 rmind Exp $	*/
+/*	$NetBSD: machdep.c,v 1.101 2011/12/05 15:04:27 skrll Exp $	*/
 
 /*-
  * Copyright (c) 2001, 2002 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.100 2011/06/12 03:35:41 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: machdep.c,v 1.101 2011/12/05 15:04:27 skrll Exp $");
 
 #include "opt_cputype.h"
 #include "opt_ddb.h"
@@ -2106,7 +2106,24 @@ mm_md_physacc(paddr_t pa, vm_prot_t prot
 int
 mm_md_kernacc(void *ptr, vm_prot_t prot, bool *handled)
 {
+	extern int kernel_text;
+	extern int __data_start;
+	extern int end;
+
+	const vaddr_t ksro = (vaddr_t) &kernel_text;
+	const vaddr_t ksrw = (vaddr_t) &__data_start;
+	const vaddr_t kend = (vaddr_t) end;
+	const vaddr_t v = (vaddr_t)ptr;
 
 	*handled = false;
-	return mm_md_physacc((paddr_t)ptr, prot);
+	if (v >= ksro && v < kend) {
+		*handled = true;
+		if (v < ksrw && (prot & VM_PROT_WRITE)) {
+			return EFAULT;
+		}
+	} else if (v >= kend && atop((paddr_t)v) < physmem) {
+		*handled = true;
+	}
+
+	return 0;
 }



CVS commit: src/sys/fs/union

2011-12-05 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Dec  5 11:12:11 UTC 2011

Modified Files:
src/sys/fs/union: union_vfsops.c

Log Message:
The union file system is as stable as other layered file systems so
no longer print a warning to the console.

Gnats is waiting ...


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/fs/union/union_vfsops.c

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

Modified files:

Index: src/sys/fs/union/union_vfsops.c
diff -u src/sys/fs/union/union_vfsops.c:1.66 src/sys/fs/union/union_vfsops.c:1.67
--- src/sys/fs/union/union_vfsops.c:1.66	Wed Nov 23 19:39:11 2011
+++ src/sys/fs/union/union_vfsops.c	Mon Dec  5 11:12:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: union_vfsops.c,v 1.66 2011/11/23 19:39:11 hannken Exp $	*/
+/*	$NetBSD: union_vfsops.c,v 1.67 2011/12/05 11:12:10 hannken Exp $	*/
 
 /*
  * Copyright (c) 1994 The Regents of the University of California.
@@ -77,7 +77,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.66 2011/11/23 19:39:11 hannken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: union_vfsops.c,v 1.67 2011/12/05 11:12:10 hannken Exp $");
 
 #include 
 #include 
@@ -101,9 +101,6 @@ MODULE(MODULE_CLASS_VFS, union, NULL);
 VFS_PROTOS(union);
 
 static struct sysctllog *union_sysctl_log;
-static const char *warn_user =
-"WARNING: the union file system is experimental\n"
-"WARNING: it can cause crashes and file system corruption\n";
 
 /*
  * Mount union filesystem
@@ -151,11 +148,6 @@ union_mount(struct mount *mp, const char
 		goto bad;
 	}
 
-	if (warn_user != NULL) {
-		printf("%s", warn_user);
-		warn_user = NULL;
-	}
-
 	lowerrootvp = mp->mnt_vnodecovered;
 	vref(lowerrootvp);
 



CVS commit: src/external/gpl3/gdb/dist

2011-12-05 Thread Matthias Scheler
Module Name:src
Committed By:   tron
Date:   Mon Dec  5 10:43:26 UTC 2011

Removed Files:
src/external/gpl3/gdb/dist/bfd: .gitignore
src/external/gpl3/gdb/dist/gdb: .gitignore
src/external/gpl3/gdb/dist/gdb/gdbserver: .gitignore
src/external/gpl3/gdb/dist/libdecnumber: .gitignore
src/external/gpl3/gdb/dist/libiberty: .gitignore
src/external/gpl3/gdb/dist/opcodes: .gitignore
src/external/gpl3/gdb/dist/sim: .gitignore

Log Message:
Remove ".gitignore" files which blacklist some files that actually are
in the NetBSD sources. This should fix build problems for people using
GIT to track current.

Problem reported by Evgeniy Ivanov on "current-users" mailing list.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/bfd/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/gdb/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 \
src/external/gpl3/gdb/dist/gdb/gdbserver/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/libdecnumber/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/libiberty/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/opcodes/.gitignore
cvs rdiff -u -r1.1.1.1 -r0 src/external/gpl3/gdb/dist/sim/.gitignore

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



CVS commit: src/share/man/man4/man4.amiga

2011-12-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec  5 10:36:40 UTC 2011

Modified Files:
src/share/man/man4/man4.amiga: mppb.4

Log Message:
Remove trailing whitespace and fix a typo.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/share/man/man4/man4.amiga/mppb.4

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

Modified files:

Index: src/share/man/man4/man4.amiga/mppb.4
diff -u src/share/man/man4/man4.amiga/mppb.4:1.3 src/share/man/man4/man4.amiga/mppb.4:1.4
--- src/share/man/man4/man4.amiga/mppb.4:1.3	Sat Dec  3 23:09:42 2011
+++ src/share/man/man4/man4.amiga/mppb.4	Mon Dec  5 10:36:39 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: mppb.4,v 1.3 2011/12/03 23:09:42 rkujawa Exp $
+.\" $NetBSD: mppb.4,v 1.4 2011/12/05 10:36:39 wiz Exp $
 .\"
 .\" Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -52,7 +52,7 @@ Matay Prometheus. Manufacturer 44359, pr
 .Sh DIAGNOSTICS
 .Bl -diag
 .It Unable to allocate space in parent map.
-The kernel has ran out of virtual memory space. 
+The kernel has run out of virtual memory space.
 .El
 .Sh SEE ALSO
 .Xr pci 4
@@ -71,16 +71,16 @@ driver was written by
 The hardware does not support DMA to host memory.
 .Pp
 The Prometheus does not support repeating of PCI transations, instead if the
-PCI card demands a retry of transaction, it returns value 0x. 
-This is currently not handled by the 
+PCI card demands a retry of transaction, it returns value 0x.
+This is currently not handled by the
 .Nm
 driver and will confuse some PCI card drivers.
 .Pp
 The system may run out of kernel virtual memory space if Prometheus is present.
-This is due to fact that m68k-specific 
+This is due to fact that m68k-specific
 .Xr pmap 9
-code places User Page Table base address at statically defined address 
-0x1000, which does not leave enough kernel space to fit a 512MB board, such 
-as the Prometheus. 
-It is possible to work around this problem, by moving User Page Table base 
+code places User Page Table base address at statically defined address
+0x1000, which does not leave enough kernel space to fit a 512MB board, such
+as the Prometheus.
+It is possible to work around this problem, by moving User Page Table base
 to higher address.



CVS commit: src/lib/libpthread

2011-12-05 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Mon Dec  5 10:27:41 UTC 2011

Modified Files:
src/lib/libpthread: affinity.3

Log Message:
Do not xref to itself.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/lib/libpthread/affinity.3

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

Modified files:

Index: src/lib/libpthread/affinity.3
diff -u src/lib/libpthread/affinity.3:1.7 src/lib/libpthread/affinity.3:1.8
--- src/lib/libpthread/affinity.3:1.7	Sun Dec  4 21:08:44 2011
+++ src/lib/libpthread/affinity.3	Mon Dec  5 10:27:40 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: affinity.3,v 1.7 2011/12/04 21:08:44 jym Exp $
+.\"	$NetBSD: affinity.3,v 1.8 2011/12/05 10:27:40 wiz Exp $
 .\"
 .\" Copyright (c) 2008 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -67,7 +67,7 @@ must be created and initialized using th
 functions.
 .Sh IMPLEMENTATION NOTES
 Setting CPU
-.Xr affinity 3
+.Nm
 requires super-user privileges.
 Ordinary users can be allowed to control CPU affinity
 of their threads via the