CVS commit: src/share/man/man3

2011-04-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Thu Apr 14 06:56:28 UTC 2011

Modified Files:
src/share/man/man3: __alignof__.3 offsetof.3

Log Message:
No need to use \*[q], use plain double quotes instead.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/share/man/man3/__alignof__.3 \
src/share/man/man3/offsetof.3

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/man3/__alignof__.3
diff -u src/share/man/man3/__alignof__.3:1.4 src/share/man/man3/__alignof__.3:1.5
--- src/share/man/man3/__alignof__.3:1.4	Mon Dec 20 19:15:26 2010
+++ src/share/man/man3/__alignof__.3	Thu Apr 14 06:56:28 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: __alignof__.3,v 1.4 2010/12/20 19:15:26 jruoho Exp $
+.\" $NetBSD: __alignof__.3,v 1.5 2011/04/14 06:56:28 wiz Exp $
 .\"
 .\" Copyright (c) 2010 Jukka Ruohonen 
 .\" All rights reserved.
@@ -61,7 +61,7 @@
 If the architecture aligns integers along 32-bit address boundaries,
 the following should print the value 4.
 .Bd -literal -offset indent
-(void)printf(\*[q]%d\en\*[q], __alignof__(int));
+(void)printf("%d\en", __alignof__(int));
 .Ed
 .Pp
 On the other hand, the following example should print the value 1,
@@ -73,7 +73,7 @@
 	char y;
 } a;
 
-(void)printf(\*[q]%d\en\*[q], __alignof__(a.y));
+(void)printf("%d\en", __alignof__(a.y));
 .Ed
 .Sh SEE ALSO
 .Xr gcc 1 ,
Index: src/share/man/man3/offsetof.3
diff -u src/share/man/man3/offsetof.3:1.4 src/share/man/man3/offsetof.3:1.5
--- src/share/man/man3/offsetof.3:1.4	Fri Apr  1 05:24:37 2011
+++ src/share/man/man3/offsetof.3	Thu Apr 14 06:56:28 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: offsetof.3,v 1.4 2011/04/01 05:24:37 jruoho Exp $
+.\"	$NetBSD: offsetof.3,v 1.5 2011/04/14 06:56:28 wiz Exp $
 .\"
 .\"	$OpenBSD: offsetof.3,v 1.2 2010/02/18 18:30:19 jmc Exp $
 .\"
@@ -59,7 +59,7 @@
 y = offsetof(struct example, y);
 z = offsetof(struct example, z);
 
-(void)printf(\*[q]%zu %zu %zu\en\*[q], x, y, z);
+(void)printf("%zu %zu %zu\en", x, y, z);
 .Ed
 .Sh SEE ALSO
 .Xr __alignof__ 3 ,



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 06:54:58 UTC 2011

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
cpuwatch_* stuff is #if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
now cobalt can build


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/arch/mips/mips/cpu_subr.c

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

Modified files:

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.8 src/sys/arch/mips/mips/cpu_subr.c:1.9
--- src/sys/arch/mips/mips/cpu_subr.c:1.8	Thu Apr 14 05:54:24 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Apr 14 06:54:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.9 2011/04/14 06:54:57 cliff Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -1014,6 +1014,8 @@
 }
 
 
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
+
 #if (CPUWATCH_MAX != 8)
 # error CPUWATCH_MAX
 #endif
@@ -1145,3 +1147,4 @@
 	mipsNN_cp0_watchlo_write(cwnum, 0);
 }
 
+#endif	/* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */



CVS commit: src/sys/dev/acpi

2011-04-13 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 06:37:13 UTC 2011

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

Log Message:
Use the common power resource code. Also add a comment explaining
what can happen if we do not power on the resource upon resume from S3.


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 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.35 src/sys/dev/acpi/thinkpad_acpi.c:1.36
--- src/sys/dev/acpi/thinkpad_acpi.c:1.35	Sun Mar 27 08:52:25 2011
+++ src/sys/dev/acpi/thinkpad_acpi.c	Thu Apr 14 06:37:13 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: thinkpad_acpi.c,v 1.35 2011/03/27 08:52:25 mlelstv Exp $ */
+/* $NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.35 2011/03/27 08:52:25 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: thinkpad_acpi.c,v 1.36 2011/04/14 06:37:13 jruoho Exp $");
 
 #include 
 #include 
@@ -37,6 +37,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -51,6 +52,7 @@
 	device_t		sc_dev;
 	device_t		sc_ecdev;
 	struct acpi_devnode	*sc_node;
+	ACPI_HANDLE		sc_powhdl;
 	ACPI_HANDLE		sc_cmoshdl;
 	bool			sc_cmoshdl_valid;
 
@@ -170,8 +172,9 @@
 	ACPI_INTEGER val;
 	int i;
 
-	sc->sc_node = aa->aa_node;
 	sc->sc_dev = self;
+	sc->sc_powhdl = NULL;
+	sc->sc_node = aa->aa_node;
 	sc->sc_display_state = THINKPAD_DISPLAY_LCD;
 
 	aprint_naive("\n");
@@ -218,6 +221,14 @@
 
 	(void)acpi_register_notify(sc->sc_node, thinkpad_notify_handler);
 
+	/*
+	 * Obtain a handle to the power resource available on many models.
+	 * Since pmf(9) is not yet integrated with the ACPI power resource
+	 * code, this must be turned on manually upon resume. Otherwise the
+	 * system may, for instance, resume from S3 with usb(4) powered down.
+	 */
+	(void)AcpiGetHandle(NULL, "\\_SB.PCI0.LPC.EC.PUBS", &sc->sc_powhdl);
+
 	/* Register power switches with sysmon */
 	psw = sc->sc_smpsw;
 	sc->sc_smpsw_valid = true;
@@ -633,17 +644,12 @@
 static bool
 thinkpad_resume(device_t dv, const pmf_qual_t *qual)
 {
-	ACPI_STATUS rv;
-	ACPI_HANDLE pubs;
+	thinkpad_softc_t *sc = device_private(dv);
 
-	rv = AcpiGetHandle(NULL, "\\_SB.PCI0.LPC.EC.PUBS", &pubs);
-	if (ACPI_FAILURE(rv))
-		return true;	/* not fatal */
+	if (sc->sc_powhdl == NULL)
+		return true;
 
-	rv = AcpiEvaluateObject(pubs, "_ON", NULL, NULL);
-	if (ACPI_FAILURE(rv))
-		aprint_error_dev(dv, "failed to execute PUBS._ON: %s\n",
-		AcpiFormatException(rv));
+	(void)acpi_power_res(sc->sc_powhdl, sc->sc_node->ad_handle, true);
 
 	return true;
 }



CVS commit: src/sys/dev/acpi

2011-04-13 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 06:25:25 UTC 2011

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

Log Message:
Simplify by using a static array for the reference counting.


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/dev/acpi/acpi_power.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/acpi_power.c
diff -u src/sys/dev/acpi/acpi_power.c:1.29 src/sys/dev/acpi/acpi_power.c:1.30
--- src/sys/dev/acpi/acpi_power.c:1.29	Sun Jan  9 16:22:07 2011
+++ src/sys/dev/acpi/acpi_power.c	Thu Apr 14 06:25:25 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: acpi_power.c,v 1.29 2011/01/09 16:22:07 jruoho Exp $ */
+/* $NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $ */
 
 /*-
- * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
+ * Copyright (c) 2009, 2010, 2011 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -56,7 +56,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.29 2011/01/09 16:22:07 jruoho Exp $");
+__KERNEL_RCSID(0, "$NetBSD: acpi_power.c,v 1.30 2011/04/14 06:25:25 jruoho Exp $");
 
 #include 
 #include 
@@ -74,27 +74,15 @@
 #define	ACPI_STA_POW_OFF		0x00
 #define	ACPI_STA_POW_ON			0x01
 
-/*
- * References.
- */
-struct acpi_power_ref {
-	ACPI_HANDLE			ref_handle;
-
-	SIMPLEQ_ENTRY(acpi_power_ref)	ref_list;
-};
-
-/*
- * Resources.
- */
 struct acpi_power_res {
 	ACPI_HANDLE			res_handle;
 	ACPI_INTEGER			res_level;
 	ACPI_INTEGER			res_order;
+	ACPI_HANDLE			res_ref[5];
 	charres_name[5];
 	kmutex_t			res_mutex;
 
 	TAILQ_ENTRY(acpi_power_res)	res_list;
-	SIMPLEQ_HEAD(, acpi_power_ref)	ref_head;
 };
 
 static TAILQ_HEAD(, acpi_power_res) res_head =
@@ -128,6 +116,7 @@
 	ACPI_OBJECT *obj;
 	ACPI_BUFFER buf;
 	ACPI_STATUS rv;
+	size_t i;
 
 	rv = acpi_eval_struct(hdl, NULL, &buf);
 
@@ -155,7 +144,9 @@
 	(void)strlcpy(res->res_name,
 	acpi_xname(hdl), sizeof(res->res_name));
 
-	SIMPLEQ_INIT(&res->ref_head);
+	for (i = 0; i < __arraycount(res->res_ref); i++)
+		res->res_ref[i] = NULL;
+
 	mutex_init(&res->res_mutex, MUTEX_DEFAULT, IPL_NONE);
 
 	/*
@@ -481,8 +472,13 @@
 	if (res == NULL)
 		return AE_NOT_FOUND;
 
+	if (ref == NULL)
+		return AE_BAD_PARAMETER;
+
 	/*
-	 * (De)reference the resource.
+	 * Adjust the reference counting. This is
+	 * necessary since a single power resource
+	 * can be shared by multiple devices.
 	 */
 	switch (on) {
 
@@ -510,82 +506,70 @@
 }
 
 static ACPI_STATUS
-acpi_power_res_ref(struct acpi_power_res *res, ACPI_HANDLE hdl)
+acpi_power_res_ref(struct acpi_power_res *res, ACPI_HANDLE ref)
 {
-	struct acpi_power_ref *ref, *tmp;
+	size_t i, j = SIZE_MAX;
 
-	ref = kmem_zalloc(sizeof(*ref), KM_SLEEP);
+	mutex_enter(&res->res_mutex);
 
-	if (ref == NULL)
-		return AE_NO_MEMORY;
+	for (i = 0; i < __arraycount(res->res_ref); i++) {
 
-	mutex_enter(&res->res_mutex);
+		/*
+		 * Do not error out if the handle
+		 * has already been referenced.
+		 */
+		if (res->res_ref[i] == ref) {
+			mutex_exit(&res->res_mutex);
+			return AE_OK;
+		}
 
-	SIMPLEQ_FOREACH(tmp, &res->ref_head, ref_list) {
+		if (j == SIZE_MAX && res->res_ref[i] == NULL)
+			j = i;
+	}
 
-		if (tmp->ref_handle == hdl)
-			goto out;
+	if (j == SIZE_MAX) {
+		mutex_exit(&res->res_mutex);
+		return AE_LIMIT;
 	}
 
-	ref->ref_handle = hdl;
-	SIMPLEQ_INSERT_TAIL(&res->ref_head, ref, ref_list);
+	res->res_ref[j] = ref;
 	mutex_exit(&res->res_mutex);
 
 	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s referenced "
-		"by %s\n", res->res_name, acpi_xname(hdl)));
-
-	return AE_OK;
-
-out:
-	mutex_exit(&res->res_mutex);
-	kmem_free(ref, sizeof(*ref));
-
-	ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s already referenced "
-		"by %s?\n", res->res_name, acpi_xname(hdl)));
+		"by %s\n", res->res_name, acpi_xname(ref)));
 
 	return AE_OK;
 }
 
 static ACPI_STATUS
-acpi_power_res_deref(struct acpi_power_res *res, ACPI_HANDLE hdl)
+acpi_power_res_deref(struct acpi_power_res *res, ACPI_HANDLE ref)
 {
-	struct acpi_power_ref *ref;
+	size_t i;
 
 	mutex_enter(&res->res_mutex);
 
-	if (SIMPLEQ_EMPTY(&res->ref_head) != 0) {
+	for (i = 0; i < __arraycount(res->res_ref); i++) {
+
+		if (res->res_ref[i] != ref)
+			continue;
+
+		res->res_ref[i] = NULL;
 		mutex_exit(&res->res_mutex);
-		return AE_OK;
-	}
 
-	SIMPLEQ_FOREACH(ref, &res->ref_head, ref_list) {
+		ACPI_DEBUG_PRINT((ACPI_DB_INFO, "%s dereferenced "
+			"by %s\n", res->res_name, acpi_xname(ref)));
 
-		if (ref->ref_handle == hdl) {
-			SIMPLEQ_REMOVE(&res->ref_head,
-			ref, acpi_power_ref, ref_list);
-			mutex_exit(&res->res_mutex);
-			kmem_free(ref, sizeof(*ref));
-			mutex_enter(&res->res_mutex);
-			break;
-		}
+		return AE_OK;
 	}
 
 	/*
-	 * If the queue remains non-empty,
+	 * If the array remains to be non-empty,
 	 * something else is using the resource
 	 * and hence it can not be turned off.
 	 */
-	if (

CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 06:12:21 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpucore.c

Log Message:
- fix comment at cpucore_rmixl_run()


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_cpucore.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.3 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.4
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.3	Thu Apr 14 05:14:23 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Thu Apr 14 06:12:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.4 2011/04/14 06:12:21 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -199,7 +199,8 @@
 
 /*
  * cpucore_rmixl_run
- *	called from cpu_rmixl_hatch for each cpu
+ *	called from cpucore_rmixl_attach for primary core
+ *	and called from cpu_rmixl_run for each hatched cpu
  *	the first call for each cpucore causes init of per-core features:
  *	- disable unused threads
  *	- set Fine-grained (Round Robin) thread scheduling mode



CVS commit: src/sys/kern

2011-04-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 06:12:02 UTC 2011

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

Log Message:
rearrange some common code in lockdebug_unlocked.
When printing a lockdebug error, add a '*' to indicate whether lock or
unlock was performed.


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/kern/subr_lockdebug.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/subr_lockdebug.c
diff -u src/sys/kern/subr_lockdebug.c:1.43 src/sys/kern/subr_lockdebug.c:1.44
--- src/sys/kern/subr_lockdebug.c:1.43	Sat Sep 25 01:42:39 2010
+++ src/sys/kern/subr_lockdebug.c	Thu Apr 14 06:12:02 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $	*/
+/*	$NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -34,7 +34,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.43 2010/09/25 01:42:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_lockdebug.c,v 1.44 2011/04/14 06:12:02 matt Exp $");
 
 #include "opt_ddb.h"
 
@@ -572,9 +572,6 @@
 "not held by current LWP", true);
 return;
 			}
-			ld->ld_flags &= ~LD_LOCKED;
-			ld->ld_unlocked = where;
-			ld->ld_lwp = NULL;
 			TAILQ_REMOVE(&l->l_ld_locks, ld, ld_chain);
 		} else {
 			if (ld->ld_cpu != (uint16_t)cpu_index(curcpu())) {
@@ -582,12 +579,12 @@
 "not held by current CPU", true);
 return;
 			}
-			ld->ld_flags &= ~LD_LOCKED;
-			ld->ld_unlocked = where;		
-			ld->ld_lwp = NULL;
 			TAILQ_REMOVE(&curcpu()->ci_data.cpu_ld_locks, ld,
 			ld_chain);
 		}
+		ld->ld_flags &= ~LD_LOCKED;
+		ld->ld_unlocked = where;		
+		ld->ld_lwp = NULL;
 	}
 	__cpu_simple_unlock(&ld->ld_spinlock);
 	splx(s);
@@ -733,12 +730,15 @@
 		"shares wanted: %18u exclusive: %18u\n"
 		"current cpu  : %18u last held: %18u\n"
 		"current lwp  : %#018lx last held: %#018lx\n"
-		"last locked  : %#018lx unlocked : %#018lx\n",
+		"last locked%c : %#018lx unlocked%c: %#018lx\n",
 		(unsigned)ld->ld_shares, ((ld->ld_flags & LD_LOCKED) != 0),
 		(unsigned)ld->ld_shwant, (unsigned)ld->ld_exwant,
 		(unsigned)cpu_index(curcpu()), (unsigned)ld->ld_cpu,
 		(long)curlwp, (long)ld->ld_lwp,
-		(long)ld->ld_locked, (long)ld->ld_unlocked);
+		((ld->ld_flags & LD_LOCKED) ? '*' : ' '),
+		(long)ld->ld_locked,
+		((ld->ld_flags & LD_LOCKED) ? ' ' : '*'),
+		(long)ld->ld_unlocked);
 	}
 
 	if (ld->ld_lockops->lo_dump != NULL)



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:54:24 UTC 2011

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
- no need to check lsw_cpu_run != NULL before calling, nullop is default


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/mips/mips/cpu_subr.c

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

Modified files:

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.7 src/sys/arch/mips/mips/cpu_subr.c:1.8
--- src/sys/arch/mips/mips/cpu_subr.c:1.7	Thu Apr 14 05:08:51 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Apr 14 05:54:24 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.7 2011/04/14 05:08:51 cliff Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.7 2011/04/14 05:08:51 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.8 2011/04/14 05:54:24 cliff Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -936,8 +936,7 @@
 	 * Let this CPU do its own post-running initialization
 	 * (for things that have to be done on the local CPU).
 	 */
-	if (mips_locoresw.lsw_cpu_run != NULL)
-		(*mips_locoresw.lsw_cpu_run)(ci);
+	(*mips_locoresw.lsw_cpu_run)(ci);
 
 	/*
 	 * Now turn on interrupts.



CVS commit: src/sys/kern

2011-04-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 05:53:53 UTC 2011

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

Log Message:
Add a KASSERT


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/kern/subr_percpu.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/subr_percpu.c
diff -u src/sys/kern/subr_percpu.c:1.10 src/sys/kern/subr_percpu.c:1.11
--- src/sys/kern/subr_percpu.c:1.10	Wed Oct 21 21:12:06 2009
+++ src/sys/kern/subr_percpu.c	Thu Apr 14 05:53:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_percpu.c,v 1.10 2009/10/21 21:12:06 rmind Exp $	*/
+/*	$NetBSD: subr_percpu.c,v 1.11 2011/04/14 05:53:53 matt Exp $	*/
 
 /*-
  * Copyright (c)2007,2008 YAMAMOTO Takashi,
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.10 2009/10/21 21:12:06 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: subr_percpu.c,v 1.11 2011/04/14 05:53:53 matt Exp $");
 
 #include 
 #include 
@@ -90,10 +90,11 @@
 	percpu_cpu_t * const newpcc = p2;
 	percpu_cpu_t * const pcc = cpu_percpu(ci);
 
+	KASSERT(ci == curcpu());
+
 	/*
 	 * swap *pcc and *newpcc unless anyone has beaten us.
 	 */
-
 	rw_enter(&percpu_swap_lock, RW_WRITER);
 	if (newpcc->pcc_size > pcc->pcc_size) {
 		percpu_cpu_t tmp;



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:51:28 UTC 2011

Modified Files:
src/sys/arch/mips/mips: mipsX_subr.S

Log Message:
- add loocoresw slot for lsw_cpu_run
- fix comments for locoresw fields


To generate a diff of this commit:
cvs rdiff -u -r1.43 -r1.44 src/sys/arch/mips/mips/mipsX_subr.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/mips/mips/mipsX_subr.S
diff -u src/sys/arch/mips/mips/mipsX_subr.S:1.43 src/sys/arch/mips/mips/mipsX_subr.S:1.44
--- src/sys/arch/mips/mips/mipsX_subr.S:1.43	Wed Apr  6 14:04:32 2011
+++ src/sys/arch/mips/mips/mipsX_subr.S	Thu Apr 14 05:51:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mipsX_subr.S,v 1.43 2011/04/06 14:04:32 tsutsui Exp $	*/
+/*	$NetBSD: mipsX_subr.S,v 1.44 2011/04/14 05:51:27 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -2569,12 +2569,13 @@
 
 	.globl _C_LABEL(MIPSX(locoresw))
 _C_LABEL(MIPSX(locoresw)):
-	PTR_WORD _C_LABEL(MIPSX(wbflush)) # wbflush
-	PTR_WORD _C_LABEL(nullop)	# cpu_idle
-	PTR_WORD _C_LABEL(nullop)	# send ipi
-	PTR_WORD _C_LABEL(nullop)	# cpu_offline_md
-	PTR_WORD _C_LABEL(nullop)	# cpu_init_md
-	PTR_WORD _C_LABEL(nullop)	# lsw_bus_error
+	PTR_WORD _C_LABEL(MIPSX(wbflush))	# lsw_wbflush
+	PTR_WORD _C_LABEL(nullop)		# lsw_cpu_idle
+	PTR_WORD _C_LABEL(nullop)		# lsw_send_ipi
+	PTR_WORD _C_LABEL(nullop)		# lsw_cpu_offline_md
+	PTR_WORD _C_LABEL(nullop)		# lsw_cpu_init
+	PTR_WORD _C_LABEL(nullop)		# lsw_cpu_run
+	PTR_WORD _C_LABEL(nullop)		# lsw_bus_error
 
 MIPSX(excpt_sw):
 	



CVS commit: src/lib/libc

2011-04-13 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 05:50:50 UTC 2011

Modified Files:
src/lib/libc/locale: nl_langinfo.3 wcsftime.3
src/lib/libc/time: getdate.3 offtime.3 strftime.3

Log Message:
Xref tm(3).


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/lib/libc/locale/nl_langinfo.3
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/locale/wcsftime.3
cvs rdiff -u -r1.1 -r1.2 src/lib/libc/time/getdate.3
cvs rdiff -u -r1.2 -r1.3 src/lib/libc/time/offtime.3
cvs rdiff -u -r1.27 -r1.28 src/lib/libc/time/strftime.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/libc/locale/nl_langinfo.3
diff -u src/lib/libc/locale/nl_langinfo.3:1.19 src/lib/libc/locale/nl_langinfo.3:1.20
--- src/lib/libc/locale/nl_langinfo.3:1.19	Mon Mar 22 19:30:54 2010
+++ src/lib/libc/locale/nl_langinfo.3	Thu Apr 14 05:50:49 2011
@@ -1,9 +1,9 @@
-.\"	$NetBSD: nl_langinfo.3,v 1.19 2010/03/22 19:30:54 joerg Exp $
+.\"	$NetBSD: nl_langinfo.3,v 1.20 2011/04/14 05:50:49 jruoho Exp $
 .\"
 .\" Written by J.T. Conklin .
 .\" Public domain.
 .\"
-.Dd February 12, 2003
+.Dd April 14, 2011
 .Dt NL_LANGINFO 3
 .Os
 .Sh NAME
@@ -135,6 +135,7 @@
 .\" .Ed
 .Sh SEE ALSO
 .Xr setlocale 3 ,
+.Xr tm 3 ,
 .Xr nls 7
 .Sh STANDARDS
 The

Index: src/lib/libc/locale/wcsftime.3
diff -u src/lib/libc/locale/wcsftime.3:1.2 src/lib/libc/locale/wcsftime.3:1.3
--- src/lib/libc/locale/wcsftime.3:1.2	Wed Apr  6 21:39:17 2005
+++ src/lib/libc/locale/wcsftime.3	Thu Apr 14 05:50:49 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: wcsftime.3,v 1.2 2005/04/06 21:39:17 kleink Exp $
+.\" $NetBSD: wcsftime.3,v 1.3 2011/04/14 05:50:49 jruoho Exp $
 .\"
 .\" Copyright (c) 2002 Tim J. Robbins
 .\" All rights reserved.
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD: /repoman/r/ncvs/src/lib/libc/locale/wcsftime.3,v 1.2 2002/11/29 17:35:09 ru Exp $
 .\"
-.Dd September 8, 2002
+.Dd April 14, 2011
 .Dt WCSFTIME 3
 .Os
 .Sh NAME
@@ -61,7 +61,8 @@
 instead of
 .Vt "const wchar_t *" .
 .Sh SEE ALSO
-.Xr strftime 3
+.Xr strftime 3 ,
+.Xr tm 3
 .Sh STANDARDS
 The
 .Fn wcsftime

Index: src/lib/libc/time/getdate.3
diff -u src/lib/libc/time/getdate.3:1.1 src/lib/libc/time/getdate.3:1.2
--- src/lib/libc/time/getdate.3:1.1	Thu May 14 02:37:36 2009
+++ src/lib/libc/time/getdate.3	Thu Apr 14 05:50:49 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: getdate.3,v 1.1 2009/05/14 02:37:36 ginsbach Exp $
+.\"	$NetBSD: getdate.3,v 1.2 2011/04/14 05:50:49 jruoho Exp $
 .\"
 .\" Copyright (c) 2009, The NetBSD Foundation.
 .\" 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 May 8, 2009
+.Dd April 14, 2011
 .Dt GETDATE 3
 .Os
 .Sh NAME
@@ -50,7 +50,8 @@
 .Fa str
 into a static
 .Va tm
-structure.
+structure described in
+.Xr tm 3 .
 .Pp
 The input string is parsed and interpreted using templates.
 A text file containing templates is specified by the

Index: src/lib/libc/time/offtime.3
diff -u src/lib/libc/time/offtime.3:1.2 src/lib/libc/time/offtime.3:1.3
--- src/lib/libc/time/offtime.3:1.2	Thu Dec 16 18:38:07 2010
+++ src/lib/libc/time/offtime.3	Thu Apr 14 05:50:50 2011
@@ -1,7 +1,7 @@
-.\"	$NetBSD: offtime.3,v 1.2 2010/12/16 18:38:07 christos Exp $
+.\"	$NetBSD: offtime.3,v 1.3 2011/04/14 05:50:50 jruoho Exp $
 .\" Written by Klaus Klein, May 10, 2004.
 .\" Public domain.
-.Dd December 14, 2010
+.Dd April 14, 2011
 .Dt OFFTIME 3
 .Os
 .Sh NAME
@@ -71,4 +71,5 @@
 and is provided for symmetry only.
 .Sh SEE ALSO
 .Xr ctime 3 ,
+.Xr tm 3 ,
 .Xr tzset 3

Index: src/lib/libc/time/strftime.3
diff -u src/lib/libc/time/strftime.3:1.27 src/lib/libc/time/strftime.3:1.28
--- src/lib/libc/time/strftime.3:1.27	Thu Dec 16 18:38:07 2010
+++ src/lib/libc/time/strftime.3	Thu Apr 14 05:50:50 2011
@@ -30,9 +30,9 @@
 .\" SUCH DAMAGE.
 .\"
 .\" from: @(#)strftime.3	5.12 (Berkeley) 6/29/91
-.\"	$NetBSD: strftime.3,v 1.27 2010/12/16 18:38:07 christos Exp $
+.\"	$NetBSD: strftime.3,v 1.28 2011/04/14 05:50:50 jruoho Exp $
 .\"
-.Dd December 14, 2010
+.Dd April 14, 2011
 .Dt STRFTIME 3
 .Os
 .Sh NAME
@@ -210,7 +210,8 @@
 .Xr printf 1 ,
 .Xr ctime 3 ,
 .Xr printf 3 ,
-.Xr strptime 3
+.Xr strptime 3 ,
+.Xr tm 3
 .Sh STANDARDS
 The
 .Fn strftime



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:50:44 UTC 2011

Modified Files:
src/sys/arch/mips/mips: locore_mips1.S

Log Message:
- add loocoresw slot for lsw_cpu_run
- fix comments for locoresw entries


To generate a diff of this commit:
cvs rdiff -u -r1.77 -r1.78 src/sys/arch/mips/mips/locore_mips1.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/mips/mips/locore_mips1.S
diff -u src/sys/arch/mips/mips/locore_mips1.S:1.77 src/sys/arch/mips/mips/locore_mips1.S:1.78
--- src/sys/arch/mips/mips/locore_mips1.S:1.77	Wed Apr  6 14:12:36 2011
+++ src/sys/arch/mips/mips/locore_mips1.S	Thu Apr 14 05:50:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: locore_mips1.S,v 1.77 2011/04/06 14:12:36 tsutsui Exp $	*/
+/*	$NetBSD: locore_mips1.S,v 1.78 2011/04/14 05:50:43 cliff Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993
@@ -1697,12 +1697,13 @@
 
 	.globl _C_LABEL(MIPSX(locoresw))
 _C_LABEL(MIPSX(locoresw)):
-	PTR_WORD _C_LABEL(MIPSX(wbflush))		# wbflush
-	PTR_WORD _C_LABEL(nullop)			# idle
-	PTR_WORD _C_LABEL(nullop)			# send ipi
-	PTR_WORD _C_LABEL(nullop)			# cpu_offline_md
-	PTR_WORD _C_LABEL(nullop)			# spare
-	PTR_WORD _C_LABEL(nullop)			# spare
+	PTR_WORD _C_LABEL(MIPSX(wbflush))		# lsw_wbflush
+	PTR_WORD _C_LABEL(nullop)			# lsw_cpu_idle
+	PTR_WORD _C_LABEL(nullop)			# lsw_send_ipi
+	PTR_WORD _C_LABEL(nullop)			# lsw_cpu_offline_md
+	PTR_WORD _C_LABEL(nullop)			# lsw_cpu_init
+	PTR_WORD _C_LABEL(nullop)			# lsw_cpu_run
+	PTR_WORD _C_LABEL(nullop)			# lsw_bus_error
 
 MIPSX(excpt_sw):
 	



CVS commit: src/share/man/man3

2011-04-13 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Thu Apr 14 05:45:34 UTC 2011

Modified Files:
src/share/man/man3: tm.3

Log Message:
Improve as per discussion on source-changes.


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

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/man3/tm.3
diff -u src/share/man/man3/tm.3:1.3 src/share/man/man3/tm.3:1.4
--- src/share/man/man3/tm.3:1.3	Tue Apr 12 13:48:29 2011
+++ src/share/man/man3/tm.3	Thu Apr 14 05:45:34 2011
@@ -1,4 +1,4 @@
-.\" $NetBSD: tm.3,v 1.3 2011/04/12 13:48:29 jruoho Exp $
+.\" $NetBSD: tm.3,v 1.4 2011/04/14 05:45:34 jruoho Exp $
 .\"
 .\" Copyright (c) 2011 Jukka Ruohonen 
 .\" All rights reserved.
@@ -24,7 +24,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd April 12, 2011
+.Dd April 14, 2011
 .Dt TM 3
 .Os
 .Sh NAME
@@ -35,38 +35,22 @@
 .Sh DESCRIPTION
 The
 .In time.h
-header defines the following structure:
-.Bd -literal -offset indent
-struct tm {
-	int		 tm_sec;
-	int		 tm_min;
-	int		 tm_hour;
-	int		 tm_mday;
-	int		 tm_mon;
-	int		 tm_year;
-	int		 tm_wday;
-	int		 tm_yday;
-	int		 tm_isdst;
-	long		 tm_gmtoff;
-	__aconst char	*tm_zone;
-};
-.Ed
-.Pp
-The members are:
+header defines the
+.Vt tm
+structure that contains calendar dates and time broken down into components.
+The following standards-compliant fields are present:
 .Bl -column -offset indent \
-"Member  " "Months since January 1 "  "Range "
-.It Sy Member Ta Sy Represents Ta Sy Range
-.It Va tm_sec Ta Seconds Ta [0, 61]
-.It Va tm_min Ta Minutes Ta [0, 59]
-.It Va tm_hour Ta Hours since midnight Ta [0, 23]
-.It Va tm_mday Ta Day of the month Ta [1, 31]
-.It Va tm_mon Ta Months since January Ta [0, 11]
-.It Va tm_year Ta Years since 1900 Ta
-.It Va tm_wday Ta Days since Sunday Ta [0,  6]
-.It Va tm_yday Ta Days since January 1 Ta [0, 365]
-.It Va tm_isdt Ta Positive if daylight savings Ta >= 0
-.It Va tm_gmtoff Ta Offset from UTC in seconds Ta
-.It Va tm_zone Ta Timezone abbreviation
+"Type" "Field  " "Months since January 1 "  "Range "
+.It Sy Type Ta Sy Field Ta Sy Represents Ta Sy Range
+.It Vt int Ta Va tm_sec Ta Seconds Ta [0, 61]
+.It Vt int Ta Va tm_min Ta Minutes Ta [0, 59]
+.It Vt int Ta Va tm_hour Ta Hours since midnight Ta [0, 23]
+.It Vt int Ta Va tm_mday Ta Day of the month Ta [1, 31]
+.It Vt int Ta Va tm_mon Ta Months since January Ta [0, 11]
+.It Vt int Ta Va tm_year Ta Years since 1900 Ta
+.It Vt int Ta Va tm_wday Ta Days since Sunday Ta [0,  6]
+.It Vt int Ta Va tm_yday Ta Days since January 1 Ta [0, 365]
+.It Vt int Ta Va tm_isdt Ta Positive if daylight savings Ta >= 0
 .El
 .Pp
 The
@@ -76,13 +60,18 @@
 .Xr localtime 3 ,
 and
 .Xr strptime 3 .
-All except
-.Va tm_gmtoff
-and
-.Va tm_zone
-are defined in
-.St -p1003.1-2008 .
+All fields described above are defined in the
+.St -p1003.1-2008
+standard.
 .Ss NetBSD Extensions
+In addition, the following NetBSD-specific fields are available:
+.Bl -column -offset indent \
+"Type " "Field  " "Months since January 1"
+.It Sy Type Ta Sy Field Ta Sy Represents
+.It Vt int Ta Va tm_gmtoff Ta Offset from UTC in seconds
+.It Vt __aconst char Ta Va tm_zone Ta Timezone abbreviation
+.El
+.Pp
 The
 .Va tm_zone
 and
@@ -112,9 +101,12 @@
 .Xr tzfree 3 .
 .Sh SEE ALSO
 .Xr asctime 3 ,
-.Xr timeval 3
+.Xr offtime 3 ,
+.Xr timeval 3 ,
+.Xr wcsftime 3
 .Sh STANDARDS
 The
 .Vt tm
 structure conforms to
-.St -p1003.1-2008 .
+.St -p1003.1-2008
+with respect to the described standard structure members.



CVS commit: src/sys/kern

2011-04-13 Thread Matt Thomas
Module Name:src
Committed By:   matt
Date:   Thu Apr 14 05:33:20 UTC 2011

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

Log Message:
Add an assert to make sure no unexpected spinlocks are held in mi_switch


To generate a diff of this commit:
cvs rdiff -u -r1.286 -r1.287 src/sys/kern/kern_synch.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_synch.c
diff -u src/sys/kern/kern_synch.c:1.286 src/sys/kern/kern_synch.c:1.287
--- src/sys/kern/kern_synch.c:1.286	Mon Jan  3 13:22:32 2011
+++ src/sys/kern/kern_synch.c	Thu Apr 14 05:33:20 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_synch.c,v 1.286 2011/01/03 13:22:32 pooka Exp $	*/
+/*	$NetBSD: kern_synch.c,v 1.287 2011/04/14 05:33:20 matt Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2004, 2006, 2007, 2008, 2009
@@ -69,7 +69,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.286 2011/01/03 13:22:32 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: kern_synch.c,v 1.287 2011/04/14 05:33:20 matt Exp $");
 
 #include "opt_kstack.h"
 #include "opt_perfctrs.h"
@@ -739,6 +739,9 @@
 		 * of the last lock - we must remain at IPL_SCHED during
 		 * the context switch.
 		 */
+		KASSERTMSG(ci->ci_mtx_count == -1,
+		("%s: cpu%u: ci_mtx_count (%d) != -1",
+		 __func__, cpu_index(ci), ci->ci_mtx_count));
 		oldspl = MUTEX_SPIN_OLDSPL(ci);
 		ci->ci_mtx_count--;
 		lwp_unlock(l);



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:22:47 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_pcix.c

Log Message:
- in rmixl_pcix_intr_string() convert irq to vector when calling
rmixl_intr_string()
- in rmixl_pcix_intr_establish(), initialize dispatch data 'counts' pointer
- in rmixl_pcix_pip_add_1(), zero out pip_new after allocated.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_pcix.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_pcix.c
diff -u src/sys/arch/mips/rmi/rmixl_pcix.c:1.4 src/sys/arch/mips/rmi/rmixl_pcix.c:1.5
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.4	Wed Apr 13 21:06:30 2011
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Thu Apr 14 05:22:47 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.4 2011/04/13 21:06:30 cliff Exp $	*/
+/*	$NetBSD: rmixl_pcix.c,v 1.5 2011/04/14 05:22:47 cliff Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.4 2011/04/13 21:06:30 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.5 2011/04/14 05:22:47 cliff Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -797,7 +797,7 @@
 		panic("%s: cpu %#x not supported\n",
 			__func__, mips_options.mips_cpu_id);
 
-	return rmixl_intr_string(irq);
+	return rmixl_intr_string(RMIXL_IRT_VECTOR(irq));
 }
 
 const struct evcnt *
@@ -925,6 +925,7 @@
 	dip->irq = irq;
 	dip->func = func;
 	dip->arg = arg;
+	dip->counts = RMIXL_PCIX_EVCNT(sc, bitno, 0);
 #if NEVER
 	snprintf(dip->count_name, sizeof(dip->count_name),
 		"pin %d", bitno + 1);
@@ -990,6 +991,8 @@
 		return NULL;
 	}
 
+	memset(pip_new, 0, size);
+
 	if (pip_old == NULL) {
 		/* initialize the interrupt struct */
 		pip_new->sc = sc;



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:22:03 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_pcie.c

Log Message:
- in rmixl_pcie_intr_string(), convert irq to vector when calling
rmixl_intr_string()


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixl_pcie.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_pcie.c
diff -u src/sys/arch/mips/rmi/rmixl_pcie.c:1.4 src/sys/arch/mips/rmi/rmixl_pcie.c:1.5
--- src/sys/arch/mips/rmi/rmixl_pcie.c:1.4	Mon Apr  4 20:37:52 2011
+++ src/sys/arch/mips/rmi/rmixl_pcie.c	Thu Apr 14 05:22:03 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcie.c,v 1.4 2011/04/04 20:37:52 dyoung Exp $	*/
+/*	$NetBSD: rmixl_pcie.c,v 1.5 2011/04/14 05:22:03 cliff Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.4 2011/04/04 20:37:52 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcie.c,v 1.5 2011/04/14 05:22:03 cliff Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -1112,7 +1112,7 @@
 		switch (irq) {
 		case 26:
 		case 27:
-			name = rmixl_intr_string(irq);
+			name = rmixl_intr_string(RMIXL_IRT_VECTOR(irq));
 			break;
 		}
 		break;
@@ -1123,7 +1123,7 @@
 		case 24:
 		case 26:
 		case 27:
-			name = rmixl_intr_string(irq);
+			name = rmixl_intr_string(RMIXL_IRT_VECTOR(irq));
 			break;
 		}
 		break;
@@ -1137,7 +1137,7 @@
 		case 27:
 		case 28:
 		case 29:
-			name = rmixl_intr_string(irq);
+			name = rmixl_intr_string(RMIXL_IRT_VECTOR(irq));
 			break;
 		}
 		break;



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:21:22 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixlvar.h

Log Message:
- add prototype for rmixl_eirr_ack()


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/mips/rmi/rmixlvar.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/mips/rmi/rmixlvar.h
diff -u src/sys/arch/mips/rmi/rmixlvar.h:1.4 src/sys/arch/mips/rmi/rmixlvar.h:1.5
--- src/sys/arch/mips/rmi/rmixlvar.h:1.4	Fri Mar 18 00:58:54 2011
+++ src/sys/arch/mips/rmi/rmixlvar.h	Thu Apr 14 05:21:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixlvar.h,v 1.4 2011/03/18 00:58:54 cliff Exp $	*/
+/*	$NetBSD: rmixlvar.h,v 1.5 2011/04/14 05:21:22 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -164,6 +164,7 @@
 
 extern uint64_t rmixl_mfcr(u_int);
 extern void rmixl_mtcr(uint64_t, u_int);
+extern void rmixl_eirr_ack(uint64_t, uint64_t, uint64_t);
 
 
 /*



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:20:53 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_usbi.c

Log Message:
- report of BIST result is information only; don't fail attach because of it


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_usbi.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_usbi.c
diff -u src/sys/arch/mips/rmi/rmixl_usbi.c:1.2 src/sys/arch/mips/rmi/rmixl_usbi.c:1.3
--- src/sys/arch/mips/rmi/rmixl_usbi.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_usbi.c	Thu Apr 14 05:20:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_usbi.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_usbi.c,v 1.3 2011/04/14 05:20:52 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1998, 1999, 2000, 2002, 2003 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_usbi.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_usbi.c,v 1.3 2011/04/14 05:20:52 cliff Exp $");
 
 #include "locators.h"
 
@@ -148,10 +148,10 @@
 r = RMIXL_IOREG_READ(RMIXL_IO_DEV_GPIO + RMIXL_GPIO_BIST_EACH_STS);
 	aprint_normal(": BIST status=");
 	if ((r & __BIT(18)) == 0) {			/* XXX USB_BIST */
-		aprint_normal("FAIL\n");
-		return;
+		aprint_normal("FAIL,");
+	} else {
+		aprint_normal("OK,");
 	}
-	aprint_normal("OK");
 
 	/*
 	 * set BYTESWAP_EN register nonzero when software is little endian



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:20:08 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_subr.S

Log Message:
- fix RCSID
- add rmixl_eirr_ack() to ack the EIRR, using COP0_SYNC & JR_HB_RA as needed
- in rmixl_cpu_trampoline, remove old KSEG0 address reconstruction
of trampoline args pointer, and comment/explain the new way
- also in rmixl_cpu_trampoline, remove old watchpoint hack used for debugging


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_subr.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/mips/rmi/rmixl_subr.S
diff -u src/sys/arch/mips/rmi/rmixl_subr.S:1.3 src/sys/arch/mips/rmi/rmixl_subr.S:1.4
--- src/sys/arch/mips/rmi/rmixl_subr.S:1.3	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_subr.S	Thu Apr 14 05:20:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_subr.S,v 1.3 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_subr.S,v 1.4 2011/04/14 05:20:08 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -37,10 +37,13 @@
 #include 
 #include 
 
-RCSID("$NetSBD$")
+RCSID("$NetBSD: rmixl_subr.S,v 1.4 2011/04/14 05:20:08 cliff Exp $");
 
 #include "assym.h"
 
+#define RMIXL_COP_0_EIRR	_(9), 6
+#define RMIXL_COP_0_EIMR	_(9), 7
+
 	.set	push
 .setnoreorder
 .setmips64
@@ -56,7 +59,7 @@
 #error O32 not supported
 #endif
 	j	ra
-	mfcr	v0, a0
+	 mfcr	v0, a0
 END(rmixl_mfcr)
 
 /*
@@ -69,9 +72,29 @@
 #error O32 not supported
 #endif
 	j	ra
-	mtcr	a1, a0
+	 mtcr	a1, a0
 END(rmixl_mtcr)
 
+/*
+ * void rmixl_eirr_ack(uint64_t eimr, uint64_t vecbit, uint64_t preserve)
+ *
+ *	ack in EIRR the irq we are about to handle
+ *	disable all interrupts to prevent a race that would allow
+ *	e.g. softints set from a higher interrupt getting
+ *	clobbered by the EIRR read-modify-write 
+ */
+LEAF(rmixl_eirr_ack)
+	dmtc0	zero, RMIXL_COP_0_EIMR	/* EIMR = 0 */
+	COP0_SYNC
+	dmfc0	a3, RMIXL_COP_0_EIRR	/* a3 = EIRR */
+	and	a3, a2			/* a3 &= preserve */
+	or	a3, a1			/* a3 |= vecbit */
+	dmtc0	a3, RMIXL_COP_0_EIRR	/* EIRR = a3 */
+	COP0_SYNC
+	dmtc0	a0, RMIXL_COP_0_EIMR	/* EIMR = eimr */
+	JR_HB_RA
+END(rmixl_eirr_ack)
+
 #ifdef MULTIPROCESSOR
 /*
  * rmixlfw_wakeup_cpu(func, args, mask, callback)
@@ -111,13 +134,13 @@
  */
 NESTED(rmixl_cpu_trampoline, CALLFRAME_SIZ, ra)
 #ifdef _LP64
-	li		t0, MIPS_SR_KX
-#if 0
-	li		t1, MIPS_KSEG0_START	/* reconstruct presumed upper half ... */
-	or		s0, a0, t1		/* ... of trampoline args addr */
-#else
+	/*
+	 * reconstruct trampoline args addr:
+	 * sign-extend 32 bit KSEG0 address in a0
+	 * to make proper 64 bit KSEG0 addr
+	 */
 	sll		s0, a0, 0
-#endif
+	li		t0, MIPS_SR_KX
 #else
 	li		t0, 0
 #endif
@@ -132,18 +155,6 @@
 	mtc0		t0, $15, 1	/* MIPS_COP_0_EBASE */
 
 	/*
-	 * Set up a watch exception if we try to execute from cpu_info.
-	 */ 
-	lui		t0, %hi(0x4000)	/* global bit */
-	ori		t0, PAGE_SIZE-1
-	mtc0		t0, MIPS_COP_0_WATCH_HI 
-
-	REG_L		t0, 2*SZREG(s0)		/* XXX ta_cpuinfo */
-	dmtc0		t0, $22, 1
-	ori		t0, 4
-	dmtc0		t0, MIPS_COP_0_WATCH_LO
-
-	/*
 	 * load our stack pointer from trampoline args
 	 */
 	REG_L		sp, 0*SZREG(s0)		/* XXX ta_sp */



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:16:54 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_spl.S

Log Message:
- remove most of the PARANOIA code
- add COP0_SYNC and JR_HB_RA following CP0 after all
writes to STATUS or EIMR that change interrupt control.
- all interrupt control now done w/ EIMR, except for
initial set of IE in STATUS.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_spl.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/mips/rmi/rmixl_spl.S
diff -u src/sys/arch/mips/rmi/rmixl_spl.S:1.2 src/sys/arch/mips/rmi/rmixl_spl.S:1.3
--- src/sys/arch/mips/rmi/rmixl_spl.S:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_spl.S	Thu Apr 14 05:16:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_spl.S,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_spl.S,v 1.3 2011/04/14 05:16:54 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2009, 2010 The NetBSD Foundation, Inc.
@@ -37,14 +37,15 @@
 #include 
 #include 
 
-RCSID("$NetBSD: rmixl_spl.S,v 1.2 2011/02/20 07:48:37 matt Exp $");
+RCSID("$NetBSD: rmixl_spl.S,v 1.3 2011/04/14 05:16:54 cliff Exp $");
 
 #include "assym.h"
 
-
 #define MAP_SCALESHIFT		3
 #define RMIXL_SOFT_INT_MASK_1	(MIPS_SOFT_INT_MASK_1 >> 8)
 #define RMIXL_SOFT_INT_MASK	(MIPS_SOFT_INT_MASK >> 8)
+#define RMIXL_INT_MASK_5	(MIPS_INT_MASK_5 >> 8)
+#define RMIXL_EIRR_PRESERVE	(RMIXL_INT_MASK_5 | RMIXL_SOFT_INT_MASK)
 #define RMIXL_INT_MASK_1	(MIPS_INT_MASK_1 >> 8)
 #define RMIXL_INT_MASK_5	(MIPS_INT_MASK_5 >> 8)
 #define RMIXL_COP_0_EIRR	_(9), 6
@@ -88,11 +89,13 @@
 	mfc0	t0, MIPS_COP_0_STATUS		# get STATUS
 	ori	t0, MIPS_SR_INT_IE		# set IE
 	mtc0	zero, MIPS_COP_0_STATUS		## disable all ints in STATUS
+	COP0_SYNC
 	dmtc0	zero, RMIXL_COP_0_EIMR		##  "   "   "   "  EIMR
+	COP0_SYNC
 	dmtc0	zero, RMIXL_COP_0_EIRR		## clear EIRR
+	COP0_SYNC
 	mtc0	t0, MIPS_COP_0_STATUS		## set STATUS | IE
-	j	ra
-	 nop
+	JR_HB_RA
 END(rmixl_spl_init_cpu)
 
 /*
@@ -100,115 +103,86 @@
  *
  * Used as building blocks for spl(9) kernel interface.
  */
+
 _splraise:
 	/*
-	 * a0 = EIMR bits to be set for this IPL
+	 * a0 = EIMR bits requested to be set for this IPL
 	 * a1 = this IPL (IPL_*)
 	 * Can only use a0-a3 and v0-v1
+	 * old IPL is returned in v0
 	 */
-	PTR_L	a3, L_CPU(MIPS_CURLWP)
-	INT_L	v0, CPU_INFO_CPL(a3)		# get current IPL from cpu_info
-	sltu	v1, a1, v0			# newipl < curipl
-	bnez	v1, 2f# yes, don't change.
-	 nop
+	dmfc0	a2, RMIXL_COP_0_EIMR		# save EIMR
 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
-	PTR_L	a3, L_CPU(MIPS_CURLWP)		## reload L_CPU in case we were
-		##  preempted and moved...
+	COP0_SYNC
+	PTR_L	a3, L_CPU(MIPS_CURLWP)		##
+	INT_L	v0, CPU_INFO_CPL(a3)		## get current IPL from cpu_info
+	sltu	v1, a1, v0			## newipl < curipl
+	bnez	v1, 1f## yes, don't change.
+	 nop
 	INT_S	a1, CPU_INFO_CPL(a3)		## save IPL in cpu_info
 	dmtc0	a0, RMIXL_COP_0_EIMR		## set new EIMR
-#ifdef PARANOIA
-	j	ra
-	 nop
-#endif /* PARANOIA */
-#ifdef PARANOIA
-	dmfc0	v0, RMIXL_COP_0_EIMR		# get EIMR
-1:	bne	a0, v0, 1b			# loop forever if not equal
-	 nop
-#endif /* PARANOIA */
-2:	j	ra
-	 nop
+	JR_HB_RA
+1:
+	dmtc0	a2, RMIXL_COP_0_EIMR		## restore saved EIMR
+	JR_HB_RA
 
 STATIC_LEAF(_splsw_splx)
 STATIC_XLEAF(_splsw_splx_noprof)		# does not get mcount hooks
-	PTR_L	a3, L_CPU(MIPS_CURLWP)		# get cpu_info
-	INT_L	a2, CPU_INFO_CPL(a3)		# get IPL from cpu_info
-	beq	a0, a2, 2f			# if same, nothing to do
-	 nop
-#ifdef PARANOIA
-	sltu	v0, a0, a2			# v0 = a0 < a2
-99:	beqz	v0, 99b# loop forever if false
-	 nop
-#endif /* PARANOIA */
 	PTR_LA	v1, _C_LABEL(ipl_eimr_map)	# get address of table
 	sll	a2, a0, MAP_SCALESHIFT		# convert IPL to array offset
 	PTR_ADDU v1, a2# add to table addr
 	REG_L	v1, (v1)			# load EIMR bits for this IPL
-1:
+
 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	COP0_SYNC
+	PTR_L	a3, L_CPU(MIPS_CURLWP)		## get cpu_info
 	INT_S	a0, CPU_INFO_CPL(a3)		## save IPL in cpu_info
 	dmtc0	v1, RMIXL_COP_0_EIMR		## set new EIMR
-#ifdef PARANOIA
-	j	ra
-	 nop
-#endif /* PARANOIA */
-2:
-#ifdef PARANOIA
-	PTR_LA	v1, _C_LABEL(ipl_eimr_map)	# get address of table
-	sll	a2, a0, MAP_SCALESHIFT		# convert IPL to array offset
-	PTR_ADDU v1, a2# add to table addr
-	REG_L	a1, (v1)			# load EIMR bits for this IPL
-	dmfc0	v1, RMIXL_COP_0_EIMR		# get EIMR
-3:	bne	a1, v1, 3b			# loop forever if not equal
-	 nop
-#endif /* PARANOIA */
-	j	ra
-	 nop
+	JR_HB_RA
 END(_splsw_splx)
 
 STATIC_LEAF(_splsw_spl0)
 	REG_L	v1, _C_LABEL(ipl_eimr_map) + 8*IPL_NONE
-	PTR_L	a3, L_CPU(MIPS_CURLWP)
 	dmtc0	zero, RMIXL_COP_0_EIMR		## disable all interrupts
+	COP0_SYNC
+	PTR_L	a3, L_CPU(MIPS_CURLWP)		## get cpu_info
 #if IPL_NONE == 0
-	INT_S	zero, CPU_INFO_CPL(a3)		## set ipl to 0
+	INT_S	zero, CPU_INFO_CPL(a3)		## save IPL in cpu_info
 #else
 #error IPL_NONE != 0
 #endif
 	dmtc0	v1, RMIXL_COP

CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:16:28 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_intr.h

Log Message:
- add compile time check in case NIPIS ever exceeds number of available vectors


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_intr.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/mips/rmi/rmixl_intr.h
diff -u src/sys/arch/mips/rmi/rmixl_intr.h:1.2 src/sys/arch/mips/rmi/rmixl_intr.h:1.3
--- src/sys/arch/mips/rmi/rmixl_intr.h:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.h	Thu Apr 14 05:16:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.h,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.h,v 1.3 2011/04/14 05:16:28 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -56,7 +56,12 @@
 /*
  * vectors (0 <= vec < 8)  are CAUSE[8..15] (including softintrs and count/compare)
  * vectors (8 <= vec < 31) are for other non-IRT based interrupts
+ * we use one for FMN, and each IPI currently gets own vector;
+ * if NIPIS >= (32 - 8 - 1), then redesign so IPIs share vector(s)
  */
+#if NIPIS >= 23
+# error too many IPIs
+#endif
 #define RMIXL_INTRVEC_IPI	8
 #define RMIXL_INTRVEC_FMN	(RMIXL_INTRVEC_IPI + NIPIS)
 



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:16:00 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_intr.c

Log Message:
- in evbmips_iointr(), call assembly function rmixl_eirr_ack()
to ack the EIRR, instead of using a bunch of asm() here.
- in rmixl_ipi_intr(), remove overly paranoid assert that the given
IPI request is pending; if the request is clear, it was previously processed.
- in rmixl_vecnames_common[], give ipi vectors unique (numbered) names


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_intr.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_intr.c
diff -u src/sys/arch/mips/rmi/rmixl_intr.c:1.3 src/sys/arch/mips/rmi/rmixl_intr.c:1.4
--- src/sys/arch/mips/rmi/rmixl_intr.c:1.3	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_intr.c	Thu Apr 14 05:16:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_intr.c,v 1.3 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_intr.c,v 1.4 2011/04/14 05:16:00 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2007 Ruslan Ermilov and Vsevolod Lobko.
@@ -64,7 +64,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.3 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_intr.c,v 1.4 2011/04/14 05:16:00 cliff Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -292,15 +292,15 @@
 	"vec 5",		/*  5 */
 	"vec 6",		/*  6 */
 	"vec 7",		/*  7 */
-	"vec 8 (ipi)",		/*  8 */
-	"vec 9 (ipi)",		/*  9 */
-	"vec 10 (ipi)",		/* 10 */
-	"vec 11 (ipi)",		/* 11 */
-	"vec 12 (ipi)",		/* 12 */
-	"vec 13 (ipi)",		/* 13 */
-	"vec 14 (ipi)",		/* 14 */
-	"vec 15 (ipi)",		/* 15 */
-	"vec 16 (fmn)",		/* 16 */
+	"vec 8 (ipi 0)",	/*  8 */
+	"vec 9 (ipi 1)",	/*  9 */
+	"vec 10 (ipi 2)",	/* 10 */
+	"vec 11 (ipi 3)",	/* 11 */
+	"vec 12 (ipi 4)",	/* 12 */
+	"vec 13 (ipi 5)",	/* 13 */
+	"vec 14 (ipi 6)",	/* 14 */
+	"vec 15 (fmn)",		/* 15 */
+	"vec 16",		/* 16 */
 	"vec 17",		/* 17 */
 	"vec 18",		/* 18 */
 	"vec 19",		/* 19 */
@@ -920,18 +920,10 @@
 		KASSERT ((vecbit & RMIXL_EIRR_PRESERVE_MASK) == 0);
 
 		/*
-		 * ack in EIRR the irq we are about to handle
-		 * disable all interrupt to prevent a race that would allow
-		 * e.g. softints set from a higher interrupt getting
-		 * clobbered by the EIRR read-modify-write 
+		 * ack in EIRR, and in PIC if needed,
+		 * the irq we are about to handle
 		 */
-		asm volatile("dmtc0 $0, $9, 7;");
-		asm volatile("dmfc0 %0, $9, 6;" : "=r"(eirr));
-		eirr &= RMIXL_EIRR_PRESERVE_MASK;
-		eirr |= vecbit;
-		asm volatile("dmtc0 %0, $9, 6;" :: "r"(eirr));
-		asm volatile("dmtc0 %0, $9, 7;" :: "r"(eimr));
-
+		rmixl_eirr_ack(eimr, vecbit, RMIXL_EIRR_PRESERVE_MASK);
 		if (RMIXL_VECTOR_IS_IRT(vec))
 			RMIXL_PICREG_WRITE(RMIXL_PIC_INTRACK,
 1 << RMIXL_VECTOR_IRT(vec));
@@ -993,12 +985,14 @@
 rmixl_ipi_intr(void *arg)
 {
 	struct cpu_info * const ci = curcpu();
+	const uint64_t ipi_mask = 1 << (uintptr_t)arg;
 
 	KASSERT(ci->ci_cpl >= IPL_SCHED);
-
 	KASSERT((uintptr_t)arg < NIPIS);
-	const uint64_t ipi_mask = 1 << (uintptr_t)arg;
-	KASSERT((ci->ci_request_ipis & ipi_mask) != 0);
+
+	/* if the request is clear, it was previously processed */
+	if ((ci->ci_request_ipis & ipi_mask) == 0)
+		return 0;
 
 	atomic_or_64(&ci->ci_active_ipis, ipi_mask);
 	atomic_and_64(&ci->ci_request_ipis, ~ipi_mask);



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:15:22 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpucorevar.h

Log Message:
- add sc_running flag to allow cpucore_rmixl_run() to do once-per-core
initializations once we know what threads are configured
- add sc_threads_enb and sc_threads_dis to track what threads are
enabled by firmware and configured and attach, or not.
- add prototype for cpucore_rmixl_run()


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_cpucorevar.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/mips/rmi/rmixl_cpucorevar.h
diff -u src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.2 src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.3
--- src/sys/arch/mips/rmi/rmixl_cpucorevar.h:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucorevar.h	Thu Apr 14 05:15:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucorevar.h,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_cpucorevar.h,v 1.3 2011/04/14 05:15:22 cliff Exp $	*/
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
  * All rights reserved.
@@ -38,7 +38,10 @@
 struct cpucore_softc {
 	device_t	sc_dev;
 	bool		sc_attached;
+	bool		sc_running;
 	u_int		sc_core;
+	u_int		sc_threads_enb;
+	u_int		sc_threads_dis;
 	bool		sc_hatched;
 #ifdef MULTIPROCESSOR
 	struct pmap_tlb_info *sc_tlbinfo;
@@ -52,5 +55,6 @@
 };
 
 extern void cpucore_rmixl_hatch(device_t);
+extern void cpucore_rmixl_run(device_t);
 
 #endif	/* _ARCH_MIPS_RMI_RMIXL_CPUCOREVAR_H_ */



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:14:23 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpucore.c

Log Message:
- in cpucore_rmixl_attach(), keep track of which threads are
enabled by firmware and configured and attach, or not.
- add cpucore_rmixl_run() to do the post-running initialization:
disable unused threads in RMIXL_PCR_THREADEN, and
set Round Robin thread scheduling mode.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_cpucore.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_cpucore.c
diff -u src/sys/arch/mips/rmi/rmixl_cpucore.c:1.2 src/sys/arch/mips/rmi/rmixl_cpucore.c:1.3
--- src/sys/arch/mips/rmi/rmixl_cpucore.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_cpucore.c	Thu Apr 14 05:14:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpucore.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpucore.c,v 1.3 2011/04/14 05:14:23 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 
@@ -145,25 +145,44 @@
 		(u_int)(rcp->rc_psb_info.userapp_cpu_map >> core_shft) & thread_mask;
 	u_int threads_dis = (~threads_enb) & thread_mask;
 
+	sc->sc_threads_dis = threads_dis;
 	if (threads_dis != 0) {
 		aprint_normal_dev(self, "threads");
-		while (threads_dis != 0) {
-			u_int t = ffs(threads_dis) - 1;
-			threads_dis ^= (1 << t);
-			aprint_normal(" %d%s",
-t, (threads_dis==0) ? "" : ",");
+		u_int d = threads_dis;
+		while (d != 0) {
+			u_int t = ffs(d) - 1;
+			d ^= (1 << t);
+			aprint_normal(" %d%s", t, (d==0) ? "" : ",");
 		}
 		aprint_normal(" offline (disabled by firmware)\n");
 	}
 
-	while (threads_enb != 0) {
-		u_int t = ffs(threads_enb) - 1;
-		threads_enb ^= (1 << t);
+	u_int threads_try_attach = threads_enb;
+	while (threads_try_attach != 0) {
+		u_int t = ffs(threads_try_attach) - 1;
+		threads_try_attach ^= (1 << t);
 		ca.ca_name = "cpu";
 		ca.ca_thread = t;
 		ca.ca_core = sc->sc_core;
-		config_found(self, &ca, cpucore_rmixl_print);
+		if (config_found(self, &ca, cpucore_rmixl_print) == NULL) {
+			/*
+			 * thread did not attach, e.g. not configured
+			 * arrange to have it disabled in THREADEN PCR
+			 */
+			u_int bit = 1 << t;
+			threads_enb ^= bit;
+			threads_dis |= bit;
+		}
 	}
+	sc->sc_threads_enb = threads_enb;
+	sc->sc_threads_dis = threads_dis;
+
+	/*
+	 * when attaching the core of the primary cpu,
+	 * do the post-running initialization here
+	 */
+	if (sc->sc_core == RMIXL_CPU_CORE((curcpu()->ci_cpuid)))
+		cpucore_rmixl_run(self);
 }
 
 static int
@@ -178,6 +197,25 @@
 	return (UNCONF);
 }
 
+/*
+ * cpucore_rmixl_run
+ *	called from cpu_rmixl_hatch for each cpu
+ *	the first call for each cpucore causes init of per-core features:
+ *	- disable unused threads
+ *	- set Fine-grained (Round Robin) thread scheduling mode
+ */
+void
+cpucore_rmixl_run(device_t self)
+{
+	struct cpucore_softc * const sc = device_private(self);
+
+	if (sc->sc_running == false) {
+		sc->sc_running = true;
+		rmixl_mtcr(RMIXL_PCR_THREADEN, sc->sc_threads_enb);
+		rmixl_mtcr(RMIXL_PCR_SCHEDULING, 0);
+	}
+}
+
 #ifdef MULTIPROCESSOR
 /*
  * cpucore_rmixl_hatch



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:12:58 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_cpu.c

Log Message:
- add cpu_rmixl_run(), and set in mips_locoresw.lsw_cpu_run
to be called from cpu_hatch() once cpus are running,
so we can determine what threads are configured
and running, and can finish initialization of per-core registers
depending on that.
- in cpu_rmixl_db_watch_init() clear IEU_DEFEATURE[DBE],
and init all COP0 watchpoint regs
- option MIPS_DDB_WATCH is deprecated, removed; use of cpu watchpoints
is longer depends on that or DDB


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/mips/rmi/rmixl_cpu.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_cpu.c
diff -u src/sys/arch/mips/rmi/rmixl_cpu.c:1.2 src/sys/arch/mips/rmi/rmixl_cpu.c:1.3
--- src/sys/arch/mips/rmi/rmixl_cpu.c:1.2	Sun Feb 20 07:48:37 2011
+++ src/sys/arch/mips/rmi/rmixl_cpu.c	Thu Apr 14 05:12:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_cpu.c,v 1.2 2011/02/20 07:48:37 matt Exp $	*/
+/*	$NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -38,7 +38,7 @@
 #include "locators.h"
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.2 2011/02/20 07:48:37 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_cpu.c,v 1.3 2011/04/14 05:12:58 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_ddb.h"
@@ -78,6 +78,7 @@
 
 #ifdef MULTIPROCESSOR
 void		cpu_rmixl_hatch(struct cpu_info *);
+void		cpu_rmixl_run(struct cpu_info *);
 #if 0
 static void	cpu_setup_trampoline_ipi(struct device *, struct cpu_info *);
 #endif
@@ -98,19 +99,25 @@
 static struct rmixl_cpu_trampoline_args rmixl_cpu_trampoline_args;
 #endif
 
-#if defined(DDB) && defined(MIPS_DDB_WATCH)
 /*
  * cpu_rmixl_db_watch_init - initialize COP0 watchpoint stuff
  *
  * clear IEU_DEFEATURE[DBE] to ensure T_WATCH on watchpoint exception
  * set COP0 watchhi and watchlo
+ *
+ * disable all watchpoints
  */
 static void
 cpu_rmixl_db_watch_init(void)
 {
-	db_mach_watch_set_all();
+	uint32_t r;
+
+	r = rmixl_mfcr(RMIXL_PCR_IEU_DEFEATURE);
+	r &= ~__BIT(7);		/* DBE */
+	rmixl_mtcr(RMIXL_PCR_IEU_DEFEATURE, r);
+
+	cpuwatch_clr_all();
 }
-#endif	/* DDB && MIPS_DDB_WATCH */
 
 /*
  * cpu_xls616_erratum
@@ -186,6 +193,7 @@
 
 #ifdef MULTIPROCESSOR
 		mips_locoresw.lsw_cpu_init = cpu_rmixl_hatch;
+		mips_locoresw.lsw_cpu_run = cpu_rmixl_run;
 	} else {
 		struct cpucore_attach_args *ca = aux;
 		struct cpucore_softc * const ccsc = device_private(parent);
@@ -255,9 +263,7 @@
 	asm volatile("dmfc0 %0, $15, 1;" : "=r"(ebase));
 	ci->ci_cpuid = ebase & __BITS(9,0);
 
-#if defined(DDB) && defined(MIPS_DDB_WATCH)
 	cpu_rmixl_db_watch_init();
-#endif
 
 	rmixl_fmn_init();
 
@@ -295,6 +301,18 @@
 
 #ifdef MULTIPROCESSOR
 /*
+ * cpu_rmixl_run
+ *
+ * - chip-specific post-running code called from cpu_hatch via lsw_cpu_run
+ */
+void
+cpu_rmixl_run(struct cpu_info *ci)
+{
+	struct rmixl_cpu_softc * const sc = (void *)ci->ci_softc;
+	cpucore_rmixl_run(device_parent(sc->sc_dev));
+}
+
+/*
  * cpu_rmixl_hatch
  *
  * - chip-specific hatch code called from cpu_hatch via lsw_cpu_init
@@ -318,9 +336,7 @@
 
 	cpucore_rmixl_hatch(device_parent(sc->sc_dev));
 
-#if defined(DDB) && defined(MIPS_DDB_WATCH)
 	cpu_rmixl_db_watch_init();
-#endif
 }
 
 static int
@@ -359,8 +375,8 @@
 	 *   RMI firmware only passes the lower 32-bit half of 'ta'
 	 *   to rmixl_cpu_trampoline (the upper half is clear)
 	 *   so rmixl_cpu_trampoline must reconstruct the missing upper half
-	 *   rmixl_cpu_trampoline "knows" to use MIPS_KSEG0_START
-	 *   to reconstruct upper half of 'ta'.
+	 *   rmixl_cpu_trampoline "knows" 'ta' is a KSEG0 address
+	 *   and sign-extends to make an LP64 KSEG0 address.
 	 */
 	KASSERT(MIPS_KSEG0_P(ta));
 



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:10:04 UTC 2011

Modified Files:
src/sys/arch/mips/mips: mips_machdep.c

Log Message:
- add mips_watchpoint_init() to discover number of CPU watchpoints,
and call that from {mips32,mips32r2,mips64,mips64r2}_vector_init()


To generate a diff of this commit:
cvs rdiff -u -r1.238 -r1.239 src/sys/arch/mips/mips/mips_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/mips/mips/mips_machdep.c
diff -u src/sys/arch/mips/mips/mips_machdep.c:1.238 src/sys/arch/mips/mips/mips_machdep.c:1.239
--- src/sys/arch/mips/mips/mips_machdep.c:1.238	Wed Apr  6 05:50:39 2011
+++ src/sys/arch/mips/mips/mips_machdep.c	Thu Apr 14 05:10:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mips_machdep.c,v 1.238 2011/04/06 05:50:39 matt Exp $	*/
+/*	$NetBSD: mips_machdep.c,v 1.239 2011/04/14 05:10:04 cliff Exp $	*/
 
 /*
  * Copyright 2002 Wasabi Systems, Inc.
@@ -112,7 +112,7 @@
 
 #include 			/* RCS ID & Copyright macro defns */
 
-__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.238 2011/04/06 05:50:39 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mips_machdep.c,v 1.239 2011/04/14 05:10:04 cliff Exp $");
 
 #define __INTR_PRIVATE
 #include "opt_cputype.h"
@@ -188,6 +188,10 @@
 u_long	cpu_dump_mempagecnt(void);
 int	cpu_dump(void);
 
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
+static void mips_watchpoint_init(void);
+#endif
+
 #if defined(MIPS3_PLUS)
 uint32_t mips3_cp0_tlb_page_mask_probe(void);
 uint64_t mips3_cp0_tlb_entry_hi_probe(void);
@@ -784,6 +788,8 @@
 
 	/* Clear BEV in SR so we start handling our own exceptions */
 	mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV);
+
+	mips_watchpoint_init();
 }
 #endif /* MIPS32 */
 
@@ -849,6 +855,8 @@
 
 	/* Clear BEV in SR so we start handling our own exceptions */
 	mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV);
+
+	mips_watchpoint_init();
 }
 #endif /* MIPS32R2 */
 
@@ -902,6 +910,8 @@
 
 	/* Clear BEV in SR so we start handling our own exceptions */
 	mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV);
+
+	mips_watchpoint_init();
 }
 #endif /* MIPS64 */
 
@@ -972,6 +982,8 @@
 
 	/* Clear BEV in SR so we start handling our own exceptions */
 	mips_cp0_status_write(mips_cp0_status_read() & ~MIPS_SR_BEV);
+
+	mips_watchpoint_init();
 }
 #endif /* MIPS64R2 */
 
@@ -2196,3 +2208,14 @@
 	KASSERT(ci->ci_cpl == IPL_NONE);
 }
 #endif /* PARANOIA */
+
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
+static void
+mips_watchpoint_init(void)
+{
+	/*
+	 * determine number of CPU watchpoints
+	 */
+	curcpu()->ci_cpuwatch_count = cpuwatch_discover();
+}
+#endif



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:09:34 UTC 2011

Modified Files:
src/sys/arch/mips/mips: db_interface.c

Log Message:
- option MIPS_DDB_WATCH is dedprecated, removed; now using
(MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 for conditional
compile of db_mach_watch stuff
- MIPS CPU (COP0) watchpoint support moved from db_interface.c
to cpu_subr.c, cpu.h; ddb_mach_watch &etc now use those cpu functions.
- ddb_cpu now volatile
- 'struct db_mach_watch' definition &etc moved to mips/include/db_machdep.h
- db_mach_watch_tab is replaced by curcpu()->ci_watch_tab
to allow per-cpu watchpoint control
- improve MP function in kdb_trap()
- fix conditions for printing cp0 regs


To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/sys/arch/mips/mips/db_interface.c

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

Modified files:

Index: src/sys/arch/mips/mips/db_interface.c
diff -u src/sys/arch/mips/mips/db_interface.c:1.70 src/sys/arch/mips/mips/db_interface.c:1.71
--- src/sys/arch/mips/mips/db_interface.c:1.70	Wed Apr  6 05:53:27 2011
+++ src/sys/arch/mips/mips/db_interface.c	Thu Apr 14 05:09:34 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: db_interface.c,v 1.70 2011/04/06 05:53:27 matt Exp $	*/
+/*	$NetBSD: db_interface.c,v 1.71 2011/04/14 05:09:34 cliff Exp $	*/
 
 /*
  * Mach Operating System
@@ -27,7 +27,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.70 2011/04/06 05:53:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: db_interface.c,v 1.71 2011/04/14 05:09:34 cliff Exp $");
 
 #include "opt_multiprocessor.h"
 #include "opt_cputype.h"	/* which mips CPUs do we support? */
@@ -67,34 +67,15 @@
 #endif
 
 #define NOCPU   ~0
-u_int ddb_cpu = NOCPU;
+volatile u_int ddb_cpu = NOCPU;
 
 int		db_active = 0;
 db_regs_t	ddb_regs;
 
-#ifdef MIPS_DDB_WATCH
-struct db_mach_watch {
-	register_t	addr;
-	register_t	mask;
-	uint32_t	asid;
-	uint32_t	mode;
-};
-/* mode bits */
-#define DB_WATCH_WRITE	__BIT(0)
-#define DB_WATCH_READ	__BIT(1)
-#define DB_WATCH_EXEC	__BIT(2)
-#define DB_WATCH_MASK	__BIT(3)
-#define DB_WATCH_ASID	__BIT(4)
-#define DB_WATCH_RWX	(DB_WATCH_EXEC|DB_WATCH_READ|DB_WATCH_WRITE)
-
-#define DBNWATCH	1
-static volatile struct db_mach_watch db_mach_watch_tab[DBNWATCH];
-
-static void db_mach_watch_set(int, register_t, register_t, uint32_t, uint32_t,
-	bool);
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
 static void db_watch_cmd(db_expr_t, bool, db_expr_t, const char *);
 static void db_unwatch_cmd(db_expr_t, bool, db_expr_t, const char *);
-#endif	/* MIPS_DDB_WATCH */
+#endif	/* (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0 */
 
 #ifdef MULTIPROCESSOR
 static void db_mach_cpu(db_expr_t, bool, db_expr_t, const char *);
@@ -146,6 +127,8 @@
 		break;
 	}
 
+	s = splhigh();
+
 #ifdef MULTIPROCESSOR
 	bool first_in_ddb = false;
 	const u_int cpu_me = cpu_number();
@@ -155,26 +138,25 @@
 		cpu_pause_others();
 	} else {
 		if (old_ddb_cpu != cpu_me) {
+			KASSERT(cpu_is_paused(cpu_me));
 			cpu_pause(regs);
+			splx(s);
 			return 1;
 		}
 	}
+	KASSERT(! cpu_is_paused(cpu_me));
 #endif
 
-	/* Should switch to kdb`s own stack here. */
 	ddb_regs = *regs;
-
-	s = splhigh();
 	db_active++;
 	cnpollc(1);
 	db_trap(type & ~T_USER, 0 /*code*/);
 	cnpollc(0);
 	db_active--;
-	splx(s);
+	*regs = ddb_regs;
 
 #ifdef MULTIPROCESSOR
-	if (ddb_cpu == cpu_me) {
-		ddb_cpu = NOCPU;
+	if (atomic_cas_uint(&ddb_cpu, cpu_me, NOCPU) == cpu_me) {
 		cpu_resume_others();
 	} else {
 		cpu_resume(ddb_cpu);
@@ -183,9 +165,8 @@
 	}
 #endif
 
-	*regs = ddb_regs;
-
-	return (1);
+	splx(s);
+	return 1;
 }
 
 void
@@ -411,10 +392,12 @@
 		SHOW32(MIPS_COP_0_COUNT, "count");
 	}
 
-	if ((cp0flags & MIPS_CP0FL_EIRR) != 0)
-		SHOW64SEL(9, 6, "eirr");
-	if ((cp0flags & MIPS_CP0FL_EIMR) != 0)
-		SHOW64SEL(9, 7, "eimr");
+	if ((cp0flags & MIPS_CP0FL_USE) != 0) {
+		if ((cp0flags & MIPS_CP0FL_EIRR) != 0)
+			SHOW64SEL(9, 6, "eirr");
+		if ((cp0flags & MIPS_CP0FL_EIMR) != 0)
+			SHOW64SEL(9, 7, "eimr");
+	}
 
 	if (CPUIS64BITS) {
 		SHOW64(MIPS_COP_0_TLB_HI, "entryhi");
@@ -479,146 +462,98 @@
 			else
 SHOW32(MIPS_COP_0_LLADDR, "lladdr");
 		}
+	}
 
-		SHOW32(MIPS_COP_0_WATCH_HI, "watchhi");
-		if (CPUIS64BITS)
-			SHOW64(MIPS_COP_0_WATCH_LO, "watchlo");
-		else
-			SHOW32(MIPS_COP_0_WATCH_LO, "watchlo");
-
+#if (MIPS32 + MIPS32R2 + MIPS64 + MIPS64R2) > 0
+	for (int i=0; i < curcpu()->ci_cpuwatch_count; i++) {
+		uint32_t r = mipsNN_cp0_watchlo_read(i);
+		printf("  %s%d:%*s %#x\n", "watchlo", i, FLDWIDTH - 8, "", r);
+	}
+	for (int i=0; i < curcpu()->ci_cpuwatch_count; i++) {
 		if (CPUIS64BITS) {
-			SHOW64(MIPS_COP_0_TLB_XCONTEXT, "xcontext");
-		}
-
-		if (CPUISMIPSNN) {
-			if (CPUIS64BITS) {
-SHOW64(MIPS_COP_0_PERFCNT, "perfcnt");
-			} else {
-SHOW32(MIPS_COP_0_PERFCNT, "perfcnt");
-			}
+			uint32_t r = mipsNN_cp0_watchhi_read(i);
+			printf("  %s%d:%*s %#x\n",
+"watchhi", i, FLDWIDTH - 8, "", r);
+		} e

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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:08:51 UTC 2011

Modified Files:
src/sys/arch/mips/mips: cpu_subr.c

Log Message:
- MIPS CPU (COP0) watchpoint support moved from db_interface.c to cpu_subr.c
see the cpuwatch_* functions
- ci_cpuwatch_count in allocated cpu_info is inherited from cpu_info_store
- cpu_hatch() calls lsw_cpu_run (if not NULL)
to optionally allow running MIPS chip-specific code
after subordinate cpus have been set running
- #ifdef DDB cpu_debug_dump() to allow compile when DDB not defined


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/mips/mips/cpu_subr.c

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

Modified files:

Index: src/sys/arch/mips/mips/cpu_subr.c
diff -u src/sys/arch/mips/mips/cpu_subr.c:1.6 src/sys/arch/mips/mips/cpu_subr.c:1.7
--- src/sys/arch/mips/mips/cpu_subr.c:1.6	Wed Apr  6 05:53:27 2011
+++ src/sys/arch/mips/mips/cpu_subr.c	Thu Apr 14 05:08:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu_subr.c,v 1.6 2011/04/06 05:53:27 matt Exp $	*/
+/*	$NetBSD: cpu_subr.c,v 1.7 2011/04/14 05:08:51 cliff Exp $	*/
 
 /*-
  * Copyright (c) 2010 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.6 2011/04/06 05:53:27 matt Exp $");
+__KERNEL_RCSID(0, "$NetBSD: cpu_subr.c,v 1.7 2011/04/14 05:08:51 cliff Exp $");
 
 #include "opt_ddb.h"
 #include "opt_multiprocessor.h"
@@ -101,7 +101,6 @@
 static int  cpu_ipi_wait(volatile __cpuset_t *, u_long);
 static void cpu_ipi_error(const char *, __cpuset_t, __cpuset_t);
 
-
 static struct cpu_info *cpu_info_last = &cpu_info_store;
 
 struct cpu_info *
@@ -151,6 +150,7 @@
 ci->ci_cycles_per_hz = cpu_info_store.ci_cycles_per_hz;
 ci->ci_divisor_delay = cpu_info_store.ci_divisor_delay;
 ci->ci_divisor_recip = cpu_info_store.ci_divisor_recip;
+ci->ci_cpuwatch_count = cpu_info_store.ci_cpuwatch_count;
 
 	/*
 	 * Attach its TLB info (which must be direct-mapped)
@@ -785,9 +785,6 @@
 #endif
 		break;
 	}
-#if defined(DDB) && defined(MIPS_DDB_WATCH)
-	db_mach_watch_set_all();
-#endif
 
 	splx(s);
 }
@@ -848,6 +845,7 @@
 	return CPUSET_HAS_P(cpus_paused, index);
 }
 
+#ifdef DDB
 void
 cpu_debug_dump(void)
 {
@@ -871,6 +869,7 @@
 			ci->ci_active_ipis, ci->ci_request_ipis);
 	}
 }
+#endif
 
 void
 cpu_hatch(struct cpu_info *ci)
@@ -934,6 +933,13 @@
 	ci->ci_data.cpu_cc_skew = 0;
 
 	/*
+	 * Let this CPU do its own post-running initialization
+	 * (for things that have to be done on the local CPU).
+	 */
+	if (mips_locoresw.lsw_cpu_run != NULL)
+		(*mips_locoresw.lsw_cpu_run)(ci);
+
+	/*
 	 * Now turn on interrupts.
 	 */
 	spl0();
@@ -1007,3 +1013,136 @@
 #endif
 	return 0;
 }
+
+
+#if (CPUWATCH_MAX != 8)
+# error CPUWATCH_MAX
+#endif
+
+/*
+ * cpuwatch_discover - determine how many COP0 watchpoints this CPU supports
+ */
+u_int
+cpuwatch_discover(void)
+{
+	int i;
+
+	for (i=0; i < CPUWATCH_MAX; i++) {
+		uint32_t watchhi = mipsNN_cp0_watchhi_read(i);
+		if ((watchhi & __BIT(31)) == 0)	/* test 'M' bit */
+			break;
+	}
+	return i + 1;
+}
+
+void
+cpuwatch_free(cpu_watchpoint_t *cwp)
+{
+#ifdef DIAGNOSTIC
+	struct cpu_info * const ci = curcpu();
+	KASSERT(cwp >= &ci->ci_cpuwatch_tab[0] &&
+		cwp <= &ci->ci_cpuwatch_tab[ci->ci_cpuwatch_count-1]);
+#endif
+	cwp->cw_mode = 0;
+	cwp->cw_asid = 0;
+	cwp->cw_addr = 0;
+	cpuwatch_clr(cwp);
+}
+
+/*
+ * cpuwatch_alloc
+ * 	find an empty slot
+ *	no locking for the table since it is CPU private
+ */
+cpu_watchpoint_t *
+cpuwatch_alloc(void)
+{
+	struct cpu_info * const ci = curcpu();
+	cpu_watchpoint_t *cwp;
+
+	for (int i=0; i < ci->ci_cpuwatch_count; i++) {
+		cwp = &ci->ci_cpuwatch_tab[i];
+		if ((cwp->cw_mode & CPUWATCH_RWX) == 0)
+			return cwp;
+	}
+	return NULL;
+}
+
+
+void
+cpuwatch_set_all(void)
+{
+	struct cpu_info * const ci = curcpu();
+	cpu_watchpoint_t *cwp;
+	int i;
+
+	for (i=0; i < ci->ci_cpuwatch_count; i++) {
+		cwp = &ci->ci_cpuwatch_tab[i];
+		if ((cwp->cw_mode & CPUWATCH_RWX) != 0)
+			cpuwatch_set(cwp);
+	}
+}
+
+void
+cpuwatch_clr_all(void)
+{
+	struct cpu_info * const ci = curcpu();
+	cpu_watchpoint_t *cwp;
+	int i;
+
+	for (i=0; i < ci->ci_cpuwatch_count; i++) {
+		cwp = &ci->ci_cpuwatch_tab[i];
+		if ((cwp->cw_mode & CPUWATCH_RWX) != 0)
+			cpuwatch_clr(cwp);
+	}
+}
+
+/*
+ * cpuwatch_set - establish a MIPS COP0 watchpoint
+ */
+void
+cpuwatch_set(cpu_watchpoint_t *cwp)
+{
+	struct cpu_info * const ci = curcpu();
+	uint32_t watchhi;
+	register_t watchlo;
+	int cwnum = cwp - &ci->ci_cpuwatch_tab[0];
+
+	KASSERT(cwp >= &ci->ci_cpuwatch_tab[0] &&
+		cwp <= &ci->ci_cpuwatch_tab[ci->ci_cpuwatch_count-1]);
+
+	watchlo = cwp->cw_addr;
+	if (cwp->cw_mode & CPUWATCH_WRITE)
+		watchlo |= __BIT(0);
+	if (cwp->cw_mode & CPUWATCH_READ)
+		watchlo |= __BIT(1);
+	if (cwp->cw_mode & CPUWATCH_EXEC)
+		watchlo |= __BIT(2);
+
+	if (cwp->cw_mode & CPUWATCH_ASID)
+		watchhi = cwp->cw_asid << 16;	/

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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:08:22 UTC 2011

Modified Files:
src/sys/arch/mips/include: locore.h

Log Message:
- add lsw_cpu_run function pointer to struct locoresw


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/sys/arch/mips/include/locore.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/mips/include/locore.h
diff -u src/sys/arch/mips/include/locore.h:1.87 src/sys/arch/mips/include/locore.h:1.88
--- src/sys/arch/mips/include/locore.h:1.87	Tue Apr 12 22:54:31 2011
+++ src/sys/arch/mips/include/locore.h	Thu Apr 14 05:08:22 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: locore.h,v 1.87 2011/04/12 22:54:31 matt Exp $ */
+/* $NetBSD: locore.h,v 1.88 2011/04/14 05:08:22 cliff Exp $ */
 
 /*
  * This file should not be included by MI code!!!
@@ -362,6 +362,7 @@
 	int		(*lsw_send_ipi)(struct cpu_info *, int);
 	void		(*lsw_cpu_offline_md)(void);
 	void		(*lsw_cpu_init)(struct cpu_info *);
+	void		(*lsw_cpu_run)(struct cpu_info *);
 	int		(*lsw_bus_error)(unsigned int);
 };
 



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:07:56 UTC 2011

Modified Files:
src/sys/arch/mips/include: db_machdep.h

Log Message:
- remove include , unused
- db_mach_watch_set_all() is deprecated, removed,
superceded by cpuwatch_set_all()


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/include/db_machdep.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/mips/include/db_machdep.h
diff -u src/sys/arch/mips/include/db_machdep.h:1.25 src/sys/arch/mips/include/db_machdep.h:1.26
--- src/sys/arch/mips/include/db_machdep.h:1.25	Wed Apr  6 05:53:27 2011
+++ src/sys/arch/mips/include/db_machdep.h	Thu Apr 14 05:07:56 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: db_machdep.h,v 1.25 2011/04/06 05:53:27 matt Exp $ */
+/* $NetBSD: db_machdep.h,v 1.26 2011/04/14 05:07:56 cliff Exp $ */
 
 /*
  * Copyright (c) 1997 Jonathan Stone (hereinafter referred to as the author)
@@ -38,7 +38,6 @@
 #include 			/* T_BREAK */
 #include 			/* register state */
 #include 		/* symbolic register indices */
-#include 
 #include 
 
 
@@ -117,9 +116,6 @@
 bool ddb_running_on_this_cpu_p(void);
 bool ddb_running_on_any_cpu_p(void);
 void db_resume_others(void);
-#ifdef MIPS_DDB_WATCH
-void db_mach_watch_set_all(void);
-#endif
 
 /*
  * We have machine-dependent commands.



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:07:31 UTC 2011

Modified Files:
src/sys/arch/mips/include: cpu.h

Log Message:
- MIPS CPU (COP0) watchpoint support moved from db_machdep.h to cpu.h
- CPU watchpoints are per-cpu; add ci_cpuwatch_count, ci_watchpoint_tab[]
to struct cpuinfo


To generate a diff of this commit:
cvs rdiff -u -r1.100 -r1.101 src/sys/arch/mips/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/mips/include/cpu.h
diff -u src/sys/arch/mips/include/cpu.h:1.100 src/sys/arch/mips/include/cpu.h:1.101
--- src/sys/arch/mips/include/cpu.h:1.100	Wed Apr  6 05:42:21 2011
+++ src/sys/arch/mips/include/cpu.h	Thu Apr 14 05:07:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cpu.h,v 1.100 2011/04/06 05:42:21 matt Exp $	*/
+/*	$NetBSD: cpu.h,v 1.101 2011/04/14 05:07:30 cliff Exp $	*/
 
 /*-
  * Copyright (c) 1992, 1993
@@ -56,6 +56,30 @@
 #include 
 #include 
 
+typedef struct cpu_watchpoint {
+	register_t	cw_addr;
+	register_t	cw_mask;
+	uint32_t	cw_asid;
+	uint32_t	cw_mode;
+} cpu_watchpoint_t;
+/* (abstract) mode bits */
+#define CPUWATCH_WRITE	__BIT(0)
+#define CPUWATCH_READ	__BIT(1)
+#define CPUWATCH_EXEC	__BIT(2)
+#define CPUWATCH_MASK	__BIT(3)
+#define CPUWATCH_ASID	__BIT(4)
+#define CPUWATCH_RWX	(CPUWATCH_EXEC|CPUWATCH_READ|CPUWATCH_WRITE)
+
+#define CPUWATCH_MAX	8	/* max possible number of watchpoints */
+
+u_int		  cpuwatch_discover(void);
+void		  cpuwatch_free(cpu_watchpoint_t *);
+cpu_watchpoint_t *cpuwatch_alloc(void);
+void		  cpuwatch_set_all(void);
+void		  cpuwatch_clr_all(void);
+void		  cpuwatch_set(cpu_watchpoint_t *);
+void		  cpuwatch_clr(cpu_watchpoint_t *);
+
 struct cpu_info {
 	struct cpu_data ci_data;	/* MI per-cpu data */
 	struct cpu_info *ci_next;	/* Next CPU in list */
@@ -96,6 +120,8 @@
 	vaddr_t ci_pmap_dstbase;	/* starting VA of ephemeral dst space */
 #endif
 
+	u_int ci_cpuwatch_count;	/* number of watchpoints on this CPU */
+	cpu_watchpoint_t ci_cpuwatch_tab[CPUWATCH_MAX];
 
 #ifdef MULTIPROCESSOR
 	volatile u_long ci_flags;



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:07:00 UTC 2011

Modified Files:
src/sys/arch/mips/conf: files.mips

Log Message:
- option MIPS_DDB_WATCH is deprecated, removed


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/arch/mips/conf/files.mips

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

Modified files:

Index: src/sys/arch/mips/conf/files.mips
diff -u src/sys/arch/mips/conf/files.mips:1.67 src/sys/arch/mips/conf/files.mips:1.68
--- src/sys/arch/mips/conf/files.mips:1.67	Wed Apr  6 05:47:54 2011
+++ src/sys/arch/mips/conf/files.mips	Thu Apr 14 05:07:00 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.mips,v 1.67 2011/04/06 05:47:54 matt Exp $
+#	$NetBSD: files.mips,v 1.68 2011/04/14 05:07:00 cliff Exp $
 #
 
 defflag	opt_cputype.h		NOFPU FPEMUL
@@ -19,7 +19,6 @@
 defflag opt_mips3_wired.h		ENABLE_MIPS3_WIRED_MAP
 
 defflag	opt_ddb.h		DDB_TRACE
-defflag	opt_ddb.h		MIPS_DDB_WATCH
 
 file	arch/mips/mips/locore_mips1.S		mips1
 file	arch/mips/mips/locore_mips3.S		mips3|mips4|mips32|mips32r2|mips64|mips64r2



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:06:39 UTC 2011

Modified Files:
src/sys/arch/evbmips/conf: XLSATX64.MP

Log Message:
- remove cpucore and cpu reconfiguration stuff
cares and threads can be specified here,
but it's easier to do at boot time from firmmware
e.g. using 'userapp_mask_cpus ' command


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/conf/XLSATX64.MP

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/evbmips/conf/XLSATX64.MP
diff -u src/sys/arch/evbmips/conf/XLSATX64.MP:1.2 src/sys/arch/evbmips/conf/XLSATX64.MP:1.3
--- src/sys/arch/evbmips/conf/XLSATX64.MP:1.2	Sun Feb 20 07:48:34 2011
+++ src/sys/arch/evbmips/conf/XLSATX64.MP	Thu Apr 14 05:06:39 2011
@@ -1,4 +1,4 @@
-# $NetBSD: XLSATX64.MP,v 1.2 2011/02/20 07:48:34 matt Exp $
+# $NetBSD: XLSATX64.MP,v 1.3 2011/04/14 05:06:39 cliff Exp $
 #
 include "arch/evbmips/conf/XLSATX64"
 
@@ -7,13 +7,3 @@
 
 pseudo-device	lockstat
 
-no cpucore*
-no cpu*
-cpucore0 at cpunode0 core 0
-cpu0 at cpucore0 thread 0
-cpucore1 at cpunode0 core 1
-cpu4 at cpucore1 thread 0
-#cpucore2 at cpunode0 core 2
-#cpu8 at cpucore2 thread 0
-#cpucore3 at cpunode0 core 3
-#cpu12 at cpucore3 thread 0



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:06:10 UTC 2011

Modified Files:
src/sys/arch/evbmips/conf: XLSATX32

Log Message:
- 32 bit kernel must MEMLIMIT to 512MB


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/evbmips/conf/XLSATX32

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/evbmips/conf/XLSATX32
diff -u src/sys/arch/evbmips/conf/XLSATX32:1.2 src/sys/arch/evbmips/conf/XLSATX32:1.3
--- src/sys/arch/evbmips/conf/XLSATX32:1.2	Sun Feb 20 07:48:33 2011
+++ src/sys/arch/evbmips/conf/XLSATX32	Thu Apr 14 05:06:10 2011
@@ -1,8 +1,10 @@
-# $NetBSD: XLSATX32,v 1.2 2011/02/20 07:48:33 matt Exp $
+# $NetBSD: XLSATX32,v 1.3 2011/04/14 05:06:10 cliff Exp $
 #
 
+#ident 		"XLSATX32-$Revision: 1.3 $"
+
 include "arch/evbmips/conf/XLSATX"
 
-#ident 		"XLSATX32-$Revision: 1.2 $"
+options 	MEMLIMIT=0x2000 # 512MB 
 
 makeoptions	LP64="no"



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

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Thu Apr 14 05:05:35 UTC 2011

Modified Files:
src/sys/arch/evbmips/conf: XLSATX

Log Message:
- remove options LOCKDEBUG; is set in XLSATX64.MP
- option MIPS_DDB_WATCH is deprecated, removed


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/evbmips/conf/XLSATX

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/evbmips/conf/XLSATX
diff -u src/sys/arch/evbmips/conf/XLSATX:1.3 src/sys/arch/evbmips/conf/XLSATX:1.4
--- src/sys/arch/evbmips/conf/XLSATX:1.3	Fri Mar 18 02:14:55 2011
+++ src/sys/arch/evbmips/conf/XLSATX	Thu Apr 14 05:05:35 2011
@@ -1,8 +1,8 @@
-#	$NetBSD: XLSATX,v 1.3 2011/03/18 02:14:55 cliff Exp $
+#	$NetBSD: XLSATX,v 1.4 2011/04/14 05:05:35 cliff Exp $
 
 include 	"arch/evbmips/conf/std.rmixl"
 
-#ident 		"XLSATX-$Revision: 1.3 $"
+#ident 		"XLSATX-$Revision: 1.4 $"
 
 #options 	INCLUDE_CONFIG_FILE	# embed config file in kernel binary
 
@@ -39,13 +39,11 @@
 options 	USERCONF	# userconf(4) support
 #options 	SYSCTL_INCLUDE_DESCR	# Include sysctl descriptions in kernel
 options 	DDB		# kernel dynamic debugger
-options 	MIPS_DDB_WATCH	# enable T_WATCH (see IEU_DEFAUTURE[DBE])
 options 	DDB_HISTORY_SIZE=100 # enable history editing in DDB
 makeoptions 	DEBUG="-g"	# compile full symbol table
 options 	SYMTAB_SPACE=50	# size for embedded symbol table
 #options 	DDB_COMMANDONENTER="trace;show registers"
 options 	DB_MAX_LINE=-1
-options 	LOCKDEBUG
 
 # Compatibility options
 #options 	COMPAT_43	# compatibility with 4.3BSD binaries



CVS commit: othersrc/external/bsd/hmac

2011-04-13 Thread Alistair G. Crooks
Module Name:othersrc
Committed By:   agc
Date:   Thu Apr 14 04:52:46 UTC 2011

Update of /cvsroot/othersrc/external/bsd/hmac
In directory ivanova.netbsd.org:/tmp/cvs-serv1497

Log Message:
Initial import of the libhmac(3) library and hmac(1) utility to
calculate an HMAC value.

Some tests based on the IETF SHA2 HMAC tests are included, although
not installed by default.

Examples of usage:

 % hmac -k '  ' -a sha256 Makefile
 sha256 (Makefile) = 
9612652f4e2371dc41e75f7d1b80e305a7be54b171b6a6002ba5caa072f3e825
 % hmac -a sha256 Makefile
 hmac key:
 sha256 (Makefile) = 
9612652f4e2371dc41e75f7d1b80e305a7be54b171b6a6002ba5caa072f3e825
 % hmac -a sha256 < Makefile
 hmac key:
 9612652f4e2371dc41e75f7d1b80e305a7be54b171b6a6002ba5caa072f3e825
 %

Hashing algorithms supported are:  md5, rmd160, sha1, sha224, sha256,
sha384 and sha512 (using code from libc).  Default algorithm is sha512.

Status:

Vendor Tag: CROOKS
Release Tags:   hmac-base

N othersrc/external/bsd/hmac/Makefile
N othersrc/external/bsd/hmac/libhmac/shlib_version
N othersrc/external/bsd/hmac/libhmac/Makefile
N othersrc/external/bsd/hmac/dist/hmacwrap.c
N othersrc/external/bsd/hmac/dist/tests.c
N othersrc/external/bsd/hmac/dist/hmacwrap.h
N othersrc/external/bsd/hmac/dist/hmac.h
N othersrc/external/bsd/hmac/dist/hmac.c
N othersrc/external/bsd/hmac/dist/libhmac.c
N othersrc/external/bsd/hmac/dist/hmac.1
N othersrc/external/bsd/hmac/dist/libhmac.3
N othersrc/external/bsd/hmac/hmac/Makefile
N othersrc/external/bsd/hmac/tests/Makefile

No conflicts created by this import



CVS commit: xsrc/external/mit/xf86-video-suncg14/dist/src

2011-04-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Thu Apr 14 01:37:22 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-suncg14/dist/src: cg14.h cg14_driver.c

Log Message:
use ioctl(FBIOSVIDEO) in CG14SaveScreen(), now the Xserver can actually turn
the monitor off
TODO: hw cursor


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.2 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.3
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h:1.2	Thu Jun 10 13:26:46 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14.h	Thu Apr 14 01:37:22 2011
@@ -69,6 +69,7 @@
  * '/usr/include/sys/cg14io.h'.
  */
 #ifdef __NetBSD__
+#include 
 #include 
 #define CG14_SET_PIXELMODE	_IOW('M', 3, int)
 #else

Index: xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c
diff -u xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.4 xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.5
--- xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c:1.4	Thu Jun 17 04:50:43 2010
+++ xsrc/external/mit/xf86-video-suncg14/dist/src/cg14_driver.c	Thu Apr 14 01:37:22 2011
@@ -643,10 +643,24 @@
 /* Mandatory */
 static Bool
 CG14SaveScreen(ScreenPtr pScreen, int mode)
-/* this function should blank the screen when unblank is FALSE and
-   unblank it when unblank is TRUE -- it doesn't actually seem to be
-   used for much though */
 {
+ScrnInfoPtr pScrn = xf86Screens[pScreen->myNum];
+Cg14Ptr pCg14 = GET_CG14_FROM_SCRN(pScrn);
+int state;
+switch(mode) {
+	case SCREEN_SAVER_ON:
+	case SCREEN_SAVER_CYCLE:
+		state = FBVIDEO_OFF;
+		ioctl(pCg14->psdp->fd, FBIOSVIDEO, &state);
+		break;
+	case SCREEN_SAVER_OFF:
+	case SCREEN_SAVER_FORCER:
+		state = FBVIDEO_ON;
+		ioctl(pCg14->psdp->fd, FBIOSVIDEO, &state);
+		break;
+	default:
+		return FALSE;
+}
 return TRUE;
 }
 
@@ -686,4 +700,4 @@
   int bpp = 8;
   
   ioctl (pCg14->psdp->fd, CG14_SET_PIXELMODE, &bpp);
-}  
+}



CVS commit: src/sys/compat/linux/arch/alpha

2011-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 14 01:03:24 UTC 2011

Modified Files:
src/sys/compat/linux/arch/alpha: linux_pipe.c

Log Message:
add the "special" pipe2.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/compat/linux/arch/alpha/linux_pipe.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/compat/linux/arch/alpha/linux_pipe.c
diff -u src/sys/compat/linux/arch/alpha/linux_pipe.c:1.13 src/sys/compat/linux/arch/alpha/linux_pipe.c:1.14
--- src/sys/compat/linux/arch/alpha/linux_pipe.c:1.13	Mon Apr 28 16:23:42 2008
+++ src/sys/compat/linux/arch/alpha/linux_pipe.c	Wed Apr 13 21:03:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pipe.c,v 1.13 2008/04/28 20:23:42 martin Exp $	*/
+/*	$NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $	*/
 
 /*-
  * Copyright (c) 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.13 2008/04/28 20:23:42 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.14 2011/04/14 01:03:23 christos Exp $");
 
 #include 
 #include 
@@ -40,12 +40,15 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 #include 
 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -62,9 +65,43 @@
 {
 	int error;
 
-	if ((error = sys_pipe(l, 0, retval)))
+	if ((error = pipe1(l, retval, 0)))
 		return error;
 
 	(l->l_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
 	return 0;
 }
+
+int
+linux_sys_pipe2(struct lwp *l, const linux_sys_pipe2_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int *) pfds;
+		syscallarg(int) flags;
+	} */
+	int error;
+	int flag = 0;
+
+	switch (SCARG(uap, flags)) {
+	case LINUX_O_CLOEXEC:
+		break;
+	case LINUX_O_NONBLOCK:
+	case LINUX_O_NONBLOCK|LINUX_O_CLOEXEC:
+		flag = O_NONBLOCK;
+		break;
+	default:
+		return EINVAL;
+	}
+
+	if ((error = pipe1(l, retval, flag)))
+		return error;
+
+	(l->l_md.md_tf)->tf_regs[FRAME_A4] = retval[1];
+
+	if (SCARG(uap, flags) & LINUX_O_CLOEXEC) {
+		fd_set_exclose(l, retval[0], true);
+		fd_set_exclose(l, retval[1], true);
+	}   
+	return 0;
+}



CVS commit: src/sys/compat/linux/common

2011-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Thu Apr 14 00:59:06 UTC 2011

Modified Files:
src/sys/compat/linux/common: linux_file.c linux_pipe.c

Log Message:
move dup3 to a more appropriate place because pipe is "special". Gotta love
linux.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/compat/linux/common/linux_file.c
cvs rdiff -u -r1.64 -r1.65 src/sys/compat/linux/common/linux_pipe.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/compat/linux/common/linux_file.c
diff -u src/sys/compat/linux/common/linux_file.c:1.102 src/sys/compat/linux/common/linux_file.c:1.103
--- src/sys/compat/linux/common/linux_file.c:1.102	Sun Apr 10 11:49:56 2011
+++ src/sys/compat/linux/common/linux_file.c	Wed Apr 13 20:59:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $	*/
+/*	$NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998, 2008 The NetBSD Foundation, Inc.
@@ -35,13 +35,14 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.102 2011/04/10 15:49:56 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_file.c,v 1.103 2011/04/14 00:59:06 christos Exp $");
 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -621,6 +622,25 @@
 	return sys_pwrite(l, &pra, retval);
 }
 
+int
+linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
+register_t *retval)
+{
+	/* {
+		syscallarg(int) from;
+		syscallarg(int) to;
+		syscallarg(int) flags;
+	} */
+	int error;
+	if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
+		return error;
+
+	if (SCARG(uap, flags) & LINUX_O_CLOEXEC)
+		fd_set_exclose(l, SCARG(uap, to), true);
+
+	return 0;
+}
+
 #define LINUX_NOT_SUPPORTED(fun) \
 int \
 fun(struct lwp *l, const struct fun##_args *uap, register_t *retval) \

Index: src/sys/compat/linux/common/linux_pipe.c
diff -u src/sys/compat/linux/common/linux_pipe.c:1.64 src/sys/compat/linux/common/linux_pipe.c:1.65
--- src/sys/compat/linux/common/linux_pipe.c:1.64	Sun Apr 10 11:50:34 2011
+++ src/sys/compat/linux/common/linux_pipe.c	Wed Apr 13 20:59:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $	*/
+/*	$NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $	*/
 
 /*-
  * Copyright (c) 1995, 1998 The NetBSD Foundation, Inc.
@@ -30,7 +30,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.64 2011/04/10 15:50:34 christos Exp $");
+__KERNEL_RCSID(0, "$NetBSD: linux_pipe.c,v 1.65 2011/04/14 00:59:06 christos Exp $");
 
 #include 
 #include 
@@ -130,22 +130,3 @@
 	return linux_pipe_return(l, SCARG(uap, pfds), retval,
 	SCARG(uap, flags));
 }
-
-int
-linux_sys_dup3(struct lwp *l, const struct linux_sys_dup3_args *uap,
-register_t *retval)
-{
-	/* {
-		syscallarg(int) from;
-		syscallarg(int) to;
-		syscallarg(int) flags;
-	} */
-	int error;
-	if ((error = sys_dup2(l, (const struct sys_dup2_args *)uap, retval)))
-		return error;
-
-	if (SCARG(uap, flags) & LINUX_O_CLOEXEC)
-		fd_set_exclose(l, SCARG(uap, to), true);
-
-	return 0;
-}



CVS commit: src/usr.bin/fstat

2011-04-13 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu Apr 14 00:35:35 UTC 2011

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

Log Message:
Add DTYPE_SEM.


To generate a diff of this commit:
cvs rdiff -u -r1.89 -r1.90 src/usr.bin/fstat/fstat.c

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

Modified files:

Index: src/usr.bin/fstat/fstat.c
diff -u src/usr.bin/fstat/fstat.c:1.89 src/usr.bin/fstat/fstat.c:1.90
--- src/usr.bin/fstat/fstat.c:1.89	Sun May 24 21:41:44 2009
+++ src/usr.bin/fstat/fstat.c	Thu Apr 14 00:35:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: fstat.c,v 1.89 2009/05/24 21:41:44 ad Exp $	*/
+/*	$NetBSD: fstat.c,v 1.90 2011/04/14 00:35:35 rmind Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)fstat.c	8.3 (Berkeley) 5/2/95";
 #else
-__RCSID("$NetBSD: fstat.c,v 1.89 2009/05/24 21:41:44 ad Exp $");
+__RCSID("$NetBSD: fstat.c,v 1.90 2011/04/14 00:35:35 rmind Exp $");
 #endif
 #endif /* not lint */
 
@@ -407,6 +407,7 @@
 	case DTYPE_KQUEUE:
 	case DTYPE_CRYPTO:
 	case DTYPE_MQUEUE:
+	case DTYPE_SEM:
 		if (checkfile == 0)
 			misctrans(&file);
 		break;



CVS commit: src/sys/kern

2011-04-13 Thread Mindaugas Rasiukevicius
Module Name:src
Committed By:   rmind
Date:   Thu Apr 14 00:32:23 UTC 2011

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

Log Message:
Minor comment fix.  Use fd_close() in sys__ksem_destroy(), it is cleaner.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/kern/uipc_sem.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/uipc_sem.c
diff -u src/sys/kern/uipc_sem.c:1.31 src/sys/kern/uipc_sem.c:1.32
--- src/sys/kern/uipc_sem.c:1.31	Tue Apr 12 20:37:25 2011
+++ src/sys/kern/uipc_sem.c	Thu Apr 14 00:32:23 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: uipc_sem.c,v 1.31 2011/04/12 20:37:25 rmind Exp $	*/
+/*	$NetBSD: uipc_sem.c,v 1.32 2011/04/14 00:32:23 rmind Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -60,7 +60,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.31 2011/04/12 20:37:25 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_sem.c,v 1.32 2011/04/14 00:32:23 rmind Exp $");
 
 #include 
 #include 
@@ -460,7 +460,7 @@
 		}
 
 		/*
-		 * Finally, insert semaphore into the hash.
+		 * Finally, insert semaphore into the list.
 		 * Note: it already has the initial reference.
 		 */
 		ks = ksnew;
@@ -676,7 +676,6 @@
 		intptr_t id;
 	} */
 	int fd = (int)SCARG(uap, id), error;
-	struct sys_close_args cuap;
 	ksem_t *ks;
 
 	error = ksem_get(fd, &ks);
@@ -697,10 +696,9 @@
 	}
 out:
 	mutex_exit(&ks->ks_lock);
-	fd_putfile(fd);
 	if (error) {
+		fd_putfile(fd);
 		return error;
 	}
-	SCARG(&cuap, fd) = fd;
-	return sys_close(l, (const void *)&cuap, retval);
+	return fd_close(fd);
 }



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

2011-04-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 13 23:31:25 UTC 2011

Modified Files:
src/sys/arch/sparc/dev: cgfourteen.c

Log Message:
use the same function whenever we change colour depth
also, when opening the fb device switch to 32bit and back to 8 on close, not
the other way around


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/sparc/dev/cgfourteen.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/sparc/dev/cgfourteen.c
diff -u src/sys/arch/sparc/dev/cgfourteen.c:1.65 src/sys/arch/sparc/dev/cgfourteen.c:1.66
--- src/sys/arch/sparc/dev/cgfourteen.c:1.65	Tue Aug 31 21:14:57 2010
+++ src/sys/arch/sparc/dev/cgfourteen.c	Wed Apr 13 23:31:25 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: cgfourteen.c,v 1.65 2010/08/31 21:14:57 macallan Exp $ */
+/*	$NetBSD: cgfourteen.c,v 1.66 2011/04/13 23:31:25 macallan Exp $ */
 
 /*
  * Copyright (c) 1996
@@ -477,20 +477,10 @@
 	case CG14_SET_PIXELMODE: {
 		int depth = *(int *)data;
 
-		switch (depth) {
-		case 8:
-			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
-			CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			CG14_MCTL_PIXMODE_8 | CG14_MCTL_POWERCTL);
-			break;
-		case 32:
-			bus_space_write_1(sc->sc_bustag, sc->sc_regh,
-			CG14_MCTL, CG14_MCTL_ENABLEVID | 
-			CG14_MCTL_PIXMODE_32 | CG14_MCTL_POWERCTL);
-			break;
-		default:
+		if (sc->sc_mode == WSDISPLAYIO_MODE_EMUL)
 			return EINVAL;
-		}
+
+		cg14_set_depth(sc, depth);
 		}
 		break;
 	default:
@@ -586,6 +576,7 @@
 static void
 cg14_init(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -613,12 +604,16 @@
 	 */
 	sc->sc_ctl->ctl_mctl = CG14_MCTL_ENABLEVID | CG14_MCTL_PIXMODE_8 |
 		CG14_MCTL_POWERCTL;
+#else
+	cg14_set_depth(sc, 32);
+#endif
 }
 
 static void
 /* Restore the state saved on cg14_init */
 cg14_reset(struct cgfourteen_softc *sc)
 {
+#if 0
 	volatile uint32_t *clut;
 	volatile uint8_t  *xlut;
 	int i;
@@ -646,6 +641,9 @@
 		clut[i] = sc->sc_saveclut.cm_chip[i];
 		xlut[i] = sc->sc_savexlut[i];
 	}
+#else
+	cg14_set_depth(sc, 8);
+#endif
 }
 
 /* Enable/disable video display; power down monitor if DPMS-capable */
@@ -932,10 +930,12 @@
 		bus_space_write_1(sc->sc_bustag,
 		sc->sc_regh,
 		CG14_CURSOR_CONTROL, 0);
+
 		cg14_set_depth(sc, 8);
 		cg14_init_cmap(sc);
 		vcons_redraw_screen(ms);
 	} else {
+
 		cg14_set_depth(sc, 32);
 	}
 }
@@ -1038,6 +1038,7 @@
 
 	if (sc->sc_depth == depth)
 		return;
+
 	switch (depth) {
 		case 8:
 			bus_space_write_1(sc->sc_bustag, sc->sc_regh,



CVS commit: src/sys/dev/pci

2011-04-13 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Apr 13 22:24:12 UTC 2011

Modified Files:
src/sys/dev/pci: pcidevs

Log Message:
+ ATI Radeon HD4650.


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

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

Modified files:

Index: src/sys/dev/pci/pcidevs
diff -u src/sys/dev/pci/pcidevs:1.1070 src/sys/dev/pci/pcidevs:1.1071
--- src/sys/dev/pci/pcidevs:1.1070	Mon Apr  4 17:59:59 2011
+++ src/sys/dev/pci/pcidevs	Wed Apr 13 22:24:12 2011
@@ -1,4 +1,4 @@
-$NetBSD: pcidevs,v 1.1070 2011/04/04 17:59:59 bouyer Exp $
+$NetBSD: pcidevs,v 1.1071 2011/04/13 22:24:12 wiz Exp $
 
 /*
  * Copyright (c) 1995, 1996 Christopher G. Demetriou
@@ -1414,6 +1414,7 @@
 product ATI RS690_PPB_7915	0x7915	RS690 PCI to PCI-Express Port 1 Bridge
 product ATI RS690_PPB_7916	0x7916	RS690 PCI to PCI-Express Port 2 Bridge
 product ATI RS690_PPB_7917	0x7917	RS690 PCI to PCI-Express Port 3 Bridge
+product ATI RADEON_HD4650	0x9498 	Radeon HD4650
 product ATI RADEON_HD2600_XT	0x9588 	Radeon HD2600 XT GDDR3
 product ATI RADEON_HD4250_S	0x95C5	Radeon HD4250 GPU (RV610) Secondary
 product ATI RADEON_HD4200	0x9712	Radeon HD4200 Mobility



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

2011-04-13 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Apr 13 22:16:52 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal: heimdal2netbsd

Log Message:
no more amd, factor out more stuff.


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

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

Modified files:

Index: src/crypto/external/bsd/heimdal/heimdal2netbsd
diff -u src/crypto/external/bsd/heimdal/heimdal2netbsd:1.1 src/crypto/external/bsd/heimdal/heimdal2netbsd:1.2
--- src/crypto/external/bsd/heimdal/heimdal2netbsd:1.1	Wed Apr 13 15:04:40 2011
+++ src/crypto/external/bsd/heimdal/heimdal2netbsd	Wed Apr 13 18:16:52 2011
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: heimdal2netbsd,v 1.1 2011/04/13 19:04:40 elric Exp $
+#	$NetBSD: heimdal2netbsd,v 1.2 2011/04/13 22:16:52 christos Exp $
 #
 # Copyright (c) 2011 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -27,7 +27,7 @@
 # POSSIBILITY OF SUCH DAMAGE.
 #
 # heimdal2netbsd:  convert a heimdal source tree into a
-# netbsd amd source tree, under src/crypto/external/bsd/heimdal/dist
+# netbsd heimdal source tree, under src/crypto/external/bsd/heimdal/dist
 # based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
 #
 # Rough instructions for importing new heimdal release from their git
@@ -56,16 +56,18 @@
 #	- check makefiles to see if any extra sources have been added.
 #	- update distrib/sets if necessary.
 
-if [ $# -ne 2 ]; then echo "heimdal2netbsd src dest"; exit 1; fi
-
+prog="$(basename "$0")"
 r=$1
 d=$2/src/crypto/external/bsd/heimdal/dist
 
+if [ $# -ne 2 ]; then echo "${prog} src dest"; exit 1; fi
+
+
 case "$d" in
 	/*)
 		;;
 	*)
-		d=`/bin/pwd`/$d
+		d="$(pwd)/$d"
 		;;
 esac
 
@@ -73,7 +75,7 @@
 	/*)
 		;;
 	*)
-		r=`/bin/pwd`/$r
+		r=$(pwd)/$r
 		;;
 esac
 
@@ -211,26 +213,26 @@
 ### Add our NetBSD RCS Id
 find $d -type f -name '*.[chly]' -print | while read c; do
 	sed 1q < $c | grep -q '\$NetBSD' || (
-echo "/*	\$NetBSD\$	*/" >/tmp/amd3n$$
-echo "" >>/tmp/amd3n$$
-cat $c  >> /tmp/amd3n$$
-mv /tmp/amd3n$$ $c && echo added NetBSD RCS tag to $c
+echo "/*	\$NetBSD\$	*/" >/tmp/${prog}3n$$
+echo "" >>/tmp/${prog}3n$$
+cat $c  >> /tmp/${prog}3n$$
+mv /tmp/${prog}3n$$ $c && echo added NetBSD RCS tag to $c
 	)
 done
 
 find $d -type f -name '*.[0-9]' -print | while read m; do
 	sed 1q < $m | grep -q '\$NetBSD' || (
-echo ".\\\"	\$NetBSD\$" >/tmp/amd2m$$
-echo ".\\\"" >>/tmp/amd2m$$
-cat $m >> /tmp/amd2m$$
-mv /tmp/amd2m$$ $m && echo added NetBSD RCS tag to $m
+echo ".\\\"	\$NetBSD\$" >/tmp/${prog}2m$$
+echo ".\\\"" >>/tmp/${prog}2m$$
+cat $m >> /tmp/${prog}2m$$
+mv /tmp/${prog}2m$$ $m && echo added NetBSD RCS tag to $m
 	)
 done
 
 find $d -type f -name '*.texi' -print | while read t; do
 sed "2 s/^/@c \$NetBSD\$\\
-/" < $t > /tmp/amd4t$$
-	mv /tmp/amd4t$$ $t && echo added NetBSD RCS tag to $t
+/" < $t > /tmp/${prog}4t$$
+	mv /tmp/${prog}4t$$ $t && echo added NetBSD RCS tag to $t
 done
 
 echo done



CVS commit: [matt-nb5-mips64] src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed Apr 13 21:10:11 UTC 2011

Modified Files:
src/sys/arch/mips/rmi [matt-nb5-mips64]: rmixl_pcix.c

Log Message:
initialize mutex in attach


To generate a diff of this commit:
cvs rdiff -u -r1.1.2.7 -r1.1.2.8 src/sys/arch/mips/rmi/rmixl_pcix.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_pcix.c
diff -u src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.7 src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.8
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.1.2.7	Mon Sep 20 19:42:31 2010
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Wed Apr 13 21:10:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.1.2.7 2010/09/20 19:42:31 cliff Exp $	*/
+/*	$NetBSD: rmixl_pcix.c,v 1.1.2.8 2011/04/13 21:10:11 cliff Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.1.2.7 2010/09/20 19:42:31 cliff Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.1.2.8 2011/04/13 21:10:11 cliff Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -316,6 +316,8 @@
 
 	aprint_normal(": RMI XLR PCI-X Interface\n");
 
+	mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_HIGH);
+
 	rmixl_pcix_intcfg(sc);
 
 	rmixl_pcix_errata(sc);



CVS commit: src/sys/arch/mips/rmi

2011-04-13 Thread Cliff Neighbors
Module Name:src
Committed By:   cliff
Date:   Wed Apr 13 21:06:31 UTC 2011

Modified Files:
src/sys/arch/mips/rmi: rmixl_pcix.c

Log Message:
initialize mutex in attach


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/mips/rmi/rmixl_pcix.c

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

Modified files:

Index: src/sys/arch/mips/rmi/rmixl_pcix.c
diff -u src/sys/arch/mips/rmi/rmixl_pcix.c:1.3 src/sys/arch/mips/rmi/rmixl_pcix.c:1.4
--- src/sys/arch/mips/rmi/rmixl_pcix.c:1.3	Mon Apr  4 20:37:52 2011
+++ src/sys/arch/mips/rmi/rmixl_pcix.c	Wed Apr 13 21:06:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: rmixl_pcix.c,v 1.3 2011/04/04 20:37:52 dyoung Exp $	*/
+/*	$NetBSD: rmixl_pcix.c,v 1.4 2011/04/13 21:06:30 cliff Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -40,7 +40,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.3 2011/04/04 20:37:52 dyoung Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rmixl_pcix.c,v 1.4 2011/04/13 21:06:30 cliff Exp $");
 
 #include "opt_pci.h"
 #include "pci.h"
@@ -316,6 +316,8 @@
 
 	aprint_normal(": RMI XLR PCI-X Interface\n");
 
+	mutex_init(&sc->sc_mutex, MUTEX_DEFAULT, IPL_HIGH);
+
 	rmixl_pcix_intcfg(sc);
 
 	rmixl_pcix_errata(sc);



CVS commit: src/crypto/external/bsd/heimdal/include

2011-04-13 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Apr 13 19:15:27 UTC 2011

Added Files:
src/crypto/external/bsd/heimdal/include: heimntlm-protos.h

Log Message:
Autogenerated headers for heimdal head-20110412.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 \
src/crypto/external/bsd/heimdal/include/heimntlm-protos.h

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

Added files:

Index: src/crypto/external/bsd/heimdal/include/heimntlm-protos.h
diff -u /dev/null src/crypto/external/bsd/heimdal/include/heimntlm-protos.h:1.1
--- /dev/null	Wed Apr 13 19:15:27 2011
+++ src/crypto/external/bsd/heimdal/include/heimntlm-protos.h	Wed Apr 13 19:15:27 2011
@@ -0,0 +1,194 @@
+/* This is a generated file */
+#ifndef __heimntlm_protos_h__
+#define __heimntlm_protos_h__
+
+#include 
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int
+heim_ntlm_build_ntlm1_master (
+	void */*key*/,
+	size_t /*len*/,
+	struct ntlm_buf */*session*/,
+	struct ntlm_buf */*master*/);
+
+int
+heim_ntlm_build_ntlm2_master (
+	void */*key*/,
+	size_t /*len*/,
+	struct ntlm_buf */*blob*/,
+	struct ntlm_buf */*session*/,
+	struct ntlm_buf */*master*/);
+
+int
+heim_ntlm_calculate_lm2 (
+	const void */*key*/,
+	size_t /*len*/,
+	const char */*username*/,
+	const char */*target*/,
+	const unsigned char serverchallenge[8],
+	unsigned char ntlmv2[16],
+	struct ntlm_buf */*answer*/);
+
+int
+heim_ntlm_calculate_ntlm1 (
+	void */*key*/,
+	size_t /*len*/,
+	unsigned char challenge[8],
+	struct ntlm_buf */*answer*/);
+
+int
+heim_ntlm_calculate_ntlm2 (
+	const void */*key*/,
+	size_t /*len*/,
+	const char */*username*/,
+	const char */*target*/,
+	const unsigned char serverchallenge[8],
+	const struct ntlm_buf */*infotarget*/,
+	unsigned char ntlmv2[16],
+	struct ntlm_buf */*answer*/);
+
+int
+heim_ntlm_calculate_ntlm2_sess (
+	const unsigned char clnt_nonce[8],
+	const unsigned char svr_chal[8],
+	const unsigned char ntlm_hash[16],
+	struct ntlm_buf */*lm*/,
+	struct ntlm_buf */*ntlm*/);
+
+int
+heim_ntlm_calculate_ntlm2_sess_hash (
+	const unsigned char clnt_nonce[8],
+	const unsigned char svr_chal[8],
+	unsigned char verifier[8]);
+
+int
+heim_ntlm_decode_targetinfo (
+	const struct ntlm_buf */*data*/,
+	int /*ucs2*/,
+	struct ntlm_targetinfo */*ti*/);
+
+int
+heim_ntlm_decode_type1 (
+	const struct ntlm_buf */*buf*/,
+	struct ntlm_type1 */*data*/);
+
+int
+heim_ntlm_decode_type2 (
+	const struct ntlm_buf */*buf*/,
+	struct ntlm_type2 */*type2*/);
+
+int
+heim_ntlm_decode_type3 (
+	const struct ntlm_buf */*buf*/,
+	int /*ucs2*/,
+	struct ntlm_type3 */*type3*/);
+
+void
+heim_ntlm_derive_ntlm2_sess (
+	const unsigned char sessionkey[16],
+	const unsigned char */*clnt_nonce*/,
+	size_t /*clnt_nonce_length*/,
+	const unsigned char svr_chal[8],
+	unsigned char derivedkey[16]);
+
+int
+heim_ntlm_encode_targetinfo (
+	const struct ntlm_targetinfo */*ti*/,
+	int /*ucs2*/,
+	struct ntlm_buf */*data*/);
+
+int
+heim_ntlm_encode_type1 (
+	const struct ntlm_type1 */*type1*/,
+	struct ntlm_buf */*data*/);
+
+int
+heim_ntlm_encode_type2 (
+	const struct ntlm_type2 */*type2*/,
+	struct ntlm_buf */*data*/);
+
+int
+heim_ntlm_encode_type3 (
+	const struct ntlm_type3 */*type3*/,
+	struct ntlm_buf */*data*/);
+
+void
+heim_ntlm_free_buf (struct ntlm_buf */*p*/);
+
+void
+heim_ntlm_free_targetinfo (struct ntlm_targetinfo */*ti*/);
+
+void
+heim_ntlm_free_type1 (struct ntlm_type1 */*data*/);
+
+void
+heim_ntlm_free_type2 (struct ntlm_type2 */*data*/);
+
+void
+heim_ntlm_free_type3 (struct ntlm_type3 */*data*/);
+
+int
+heim_ntlm_keyex_unwrap (
+	struct ntlm_buf */*baseKey*/,
+	struct ntlm_buf */*encryptedSession*/,
+	struct ntlm_buf */*session*/);
+
+int
+heim_ntlm_keyex_wrap (
+	struct ntlm_buf */*base_session*/,
+	struct ntlm_buf */*session*/,
+	struct ntlm_buf */*encryptedSession*/);
+
+int
+heim_ntlm_nt_key (
+	const char */*password*/,
+	struct ntlm_buf */*key*/);
+
+int
+heim_ntlm_ntlmv2_key (
+	const void */*key*/,
+	size_t /*len*/,
+	const char */*username*/,
+	const char */*target*/,
+	unsigned char ntlmv2[16]);
+
+size_t
+heim_ntlm_unparse_flags (
+	uint32_t /*flags*/,
+	char */*s*/,
+	size_t /*len*/);
+
+int
+heim_ntlm_v1_base_session (
+	void */*key*/,
+	size_t /*len*/,
+	struct ntlm_buf */*session*/);
+
+int
+heim_ntlm_v2_base_session (
+	void */*key*/,
+	size_t /*len*/,
+	struct ntlm_buf */*ntlmResponse*/,
+	struct ntlm_buf */*session*/);
+
+int
+heim_ntlm_verify_ntlm2 (
+	const void */*key*/,
+	size_t /*len*/,
+	const char */*username*/,
+	const char */*target*/,
+	time_t /*now*/,
+	const unsigned char serverchallenge[8],
+	const struct ntlm_buf */*answer*/,
+	struct ntlm_buf */*infotarget*/,
+	unsigned char ntlmv2[16]);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __heimntlm_protos_h__ */



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

2011-04-13 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Apr 13 19:04:40 UTC 2011

Added Files:
src/crypto/external/bsd/heimdal: heimdal2netbsd

Log Message:
Script to convert a git clone of Heimdal into our dist format.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/crypto/external/bsd/heimdal/heimdal2netbsd

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

Added files:

Index: src/crypto/external/bsd/heimdal/heimdal2netbsd
diff -u /dev/null src/crypto/external/bsd/heimdal/heimdal2netbsd:1.1
--- /dev/null	Wed Apr 13 19:04:40 2011
+++ src/crypto/external/bsd/heimdal/heimdal2netbsd	Wed Apr 13 19:04:40 2011
@@ -0,0 +1,258 @@
+#! /bin/sh
+#
+#	$NetBSD: heimdal2netbsd,v 1.1 2011/04/13 19:04:40 elric Exp $
+#
+# Copyright (c) 2011 The NetBSD Foundation, Inc.
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+#notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#notice, this list of conditions and the following disclaimer in the
+#documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
+# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
+# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
+# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+# POSSIBILITY OF SUCH DAMAGE.
+#
+# heimdal2netbsd:  convert a heimdal source tree into a
+# netbsd amd source tree, under src/crypto/external/bsd/heimdal/dist
+# based on bind2netbsd by Bernd Ernesti and changes by Simon Burge
+#
+# Rough instructions for importing new heimdal release from their git
+# repository:
+#
+#	$ export SRCDIR=/usr/src
+#	$ export HEIMDAL_SRCDIR=src/crypto/external/bsd/heimdal
+#	$ cd /some/where/temporary
+#	$ git clone git://svn.h5l.org/heimdal.git
+#	$ sh $SRCDIR/$HEIMDAL_SRCDIR/heimdal2netbsd heimdal `pwd`
+#	$ cd $HEIMDAL_SRCDIR/dist
+#   $ cvs -d ... import $HEIMDAL_SRCDIR/dist HEIMDAL head-20110317
+#	$ cd /some/where/temporary/heimdal
+#	$ autoreconf -f -i
+#	$ ./configure
+#	$ make
+#	>>> merge newly generated config.h
+#	>>> with $HEIMDAL_SRCDIR/include/config.h
+#	>>> and check out diffs in generated headers
+#	>>> and C files.
+#	$ cd ..
+#	$ rm -r src heimdal
+#	$ cd $SRCDIR/$HEIMDAL_SRCDIR
+#	$ cvs commit -m "Updated generated files for Heimdal head-20110317"
+#
+#	- check makefiles to see if any extra sources have been added.
+#	- update distrib/sets if necessary.
+
+if [ $# -ne 2 ]; then echo "heimdal2netbsd src dest"; exit 1; fi
+
+r=$1
+d=$2/src/crypto/external/bsd/heimdal/dist
+
+case "$d" in
+	/*)
+		;;
+	*)
+		d=`/bin/pwd`/$d
+		;;
+esac
+
+case "$r" in
+	/*)
+		;;
+	*)
+		r=`/bin/pwd`/$r
+		;;
+esac
+
+echo preparing directory $d
+rm -rf $d
+mkdir -p $d
+
+### Copy the files and directories
+echo copying $r to $d
+cd $r
+pax -rw * $d
+
+### Remove unneeded files
+#echo removing unneeded directories and files
+#find $d/po -name '*[0-9] XXX:
+find $d -name '*.cat[0-9]' | xargs rm -f && echo removed catman pages
+find $d -name '*.info' | xargs rm -f	 && echo removed info pages
+rm -rf $d/appl && echo removed appl
+rm -rf $d/lib/libedit			 && echo removed lib/libedit
+rm -rf $d/lib/sqlite			 && echo removed lib/sqlite
+rm -rf $d/doc/standardisation		 && echo removed doc/standardisation
+
+# Fix man pages
+find $d -type f -name '*.[1358]' -print | while read f; do
+	sed \
+	-e 's,\.Os HEIMDAL,.Os,' \
+	-e 's,\.Pa krb5.h,.Pa krb5/krb5.h,' \
+	-e 's,\.In krb5.h,.In krb5/krb5.h,' \
+	-e 's,\.Pa gssapi.h,.Pa gssapi/gssapi.h,' \
+	-e 's,\.In gssapi.h,.In gssapi/gssapi.h,' \
+	-e 's,#include ,#include ,' \
+	< $f > /tmp/heimdal1f$$ && mv /tmp/heimdal1f$$ $f && \
+	echo fixing man page $f
+done
+
+# Fix include usage
+
+KRB5_INCRE="asn1-common|asn1_err"
+KRB5_INCRE="$KRB5_INCRE|base64"
+KRB5_INCRE="$KRB5_INCRE|cms_asn1"
+KRB5_INCRE="$KRB5_INCRE|com_err"
+KRB5_INCRE="$KRB5_INCRE|com_right"
+KRB5_INCRE="$KRB5_INCRE|crmf_asn1"
+KRB5_INCRE="$KRB5_INCRE|der|der-protos"
+KRB5_INCRE="$KRB5_INCRE|digest_asn1"
+KRB5_INCRE="$KRB5_INCRE|getarg"
+KRB5_INCRE="$KRB5_INCRE|hdb|hdb_err|hdb-protos|hdb_asn1"
+KRB5_INCRE="$KRB5_INCRE|he

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

2011-04-13 Thread Frank Wille
Module Name:src
Committed By:   phx
Date:   Wed Apr 13 18:32:21 UTC 2011

Modified Files:
src/sys/arch/sandpoint/stand/altboot: brdsetup.c

Log Message:
ExtClk for QNAP should be the same as for Synology's 266MHz systems.
This seems logical, as both boards are very similar, and the clock precision
is ok now.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/sandpoint/stand/altboot/brdsetup.c

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

Modified files:

Index: src/sys/arch/sandpoint/stand/altboot/brdsetup.c
diff -u src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.13 src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.14
--- src/sys/arch/sandpoint/stand/altboot/brdsetup.c:1.13	Sat Apr  9 19:56:20 2011
+++ src/sys/arch/sandpoint/stand/altboot/brdsetup.c	Wed Apr 13 18:32:21 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: brdsetup.c,v 1.13 2011/04/09 19:56:20 phx Exp $ */
+/* $NetBSD: brdsetup.c,v 1.14 2011/04/13 18:32:21 phx Exp $ */
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -83,15 +83,16 @@
 	"synology",
 	"Synology DS",
 	BRD_SYNOLOGY,
-	33164691,	/* from Synology/Linux source */
-	/* 33168000,		XXX better precision? */
+	33164691,	/* from Synology/Linux source*/
+			/* XXX should be 33165343 for the CS-406 */
 	"eumb", 0x4500, 115200,
 	NULL, synobrdfix, NULL, synoreset },
 {
 	"qnap",
 	"QNAP TS",
 	BRD_QNAPTS,
-	0,
+	33164691,	/* Linux source says 3300, but the Synology  */
+			/* clock value delivers a much better precision. */
 	"eumb", 0x4500, 115200,
 	NULL, qnapbrdfix, NULL, qnapreset },
 {



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5

2011-04-13 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Apr 13 18:30:04 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5:
init_sec_context.c

Log Message:
_gss_DES3_get_mic_compat() requires that ctx->target has been defined, and,
well, it hasn't yet.  Move the call down to after it is defined and things
are better.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c:1.1.1.1	Wed Apr 13 18:14:45 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/gssapi/krb5/init_sec_context.c	Wed Apr 13 18:30:04 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: init_sec_context.c,v 1.1.1.1 2011/04/13 18:14:45 elric Exp $	*/
+/*	$NetBSD: init_sec_context.c,v 1.2 2011/04/13 18:30:04 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan
@@ -424,10 +424,6 @@
 	goto failure;
 }
 
-ret = _gss_DES3_get_mic_compat(minor_status, ctx, context);
-if (ret)
-	goto failure;
-
 
 /*
  * This is hideous glue for (NFS) clients that wants to limit the
@@ -471,6 +467,10 @@
 
 ctx->lifetime = ctx->kcred->times.endtime;
 
+ret = _gss_DES3_get_mic_compat(minor_status, ctx, context);
+if (ret)
+	goto failure;
+
 ret = _gsskrb5_lifetime_left(minor_status,
  context,
  ctx->lifetime,



CVS commit: src/crypto/external/bsd/heimdal/dist/lib/hdb

2011-04-13 Thread Roland Dowdeswell
Module Name:src
Committed By:   elric
Date:   Wed Apr 13 18:23:42 UTC 2011

Modified Files:
src/crypto/external/bsd/heimdal/dist/lib/hdb: hdb.c

Log Message:
Conditionalise the sqlite3 HDB backend.


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 \
src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c

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

Modified files:

Index: src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c
diff -u src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c:1.1.1.1 src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c:1.2
--- src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c:1.1.1.1	Wed Apr 13 18:14:42 2011
+++ src/crypto/external/bsd/heimdal/dist/lib/hdb/hdb.c	Wed Apr 13 18:23:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: hdb.c,v 1.1.1.1 2011/04/13 18:14:42 elric Exp $	*/
+/*	$NetBSD: hdb.c,v 1.2 2011/04/13 18:23:42 elric Exp $	*/
 
 /*
  * Copyright (c) 1997 - 2008 Kungliga Tekniska Högskolan
@@ -80,7 +80,9 @@
 { HDB_INTERFACE_VERSION, "ldap:",	hdb_ldap_create},
 { HDB_INTERFACE_VERSION, "ldapi:",	hdb_ldapi_create},
 #endif
+#ifdef SQLITE3
 { HDB_INTERFACE_VERSION, "sqlite:", hdb_sqlite_create},
+#endif
 {0, NULL,	NULL}
 };
 



CVS commit: xsrc/external/mit/xf86-input-keyboard/dist/src

2011-04-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 13 16:23:29 UTC 2011

Modified Files:
xsrc/external/mit/xf86-input-keyboard/dist/src: kbd.c

Log Message:
default to wskbd
tested on amd64, sparc(64), shark
Now X without a config file should work on most hardware


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.4 -r1.2 \
xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c

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

Modified files:

Index: xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c
diff -u xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.1.1.4 xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.2
--- xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c:1.1.1.4	Mon Nov 22 07:27:28 2010
+++ xsrc/external/mit/xf86-input-keyboard/dist/src/kbd.c	Wed Apr 13 16:23:29 2011
@@ -78,11 +78,16 @@
 };
 
 static const char *kbdDefaults[] = {
+#ifdef __NetBSD__
+"Protocol",		"wskbd",
+"Device",		"/dev/wskbd",
+#else /* NetBSD */
 #ifdef XQUEUE 
 "Protocol",		"Xqueue",
 #else
 "Protocol",		"standard",
 #endif
+#endif /* NetBSD */
 "XkbRules",		"base",
 "XkbModel",		"pc105",
 "XkbLayout",	"us",



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

2011-04-13 Thread Iain Hibbert
Module Name:src
Committed By:   plunky
Date:   Wed Apr 13 16:22:09 UTC 2011

Modified Files:
src/sys/arch/sgimips/dev: crmfb.c

Log Message:
use PRIx64 for printing 64-bit values


To generate a diff of this commit:
cvs rdiff -u -r1.32 -r1.33 src/sys/arch/sgimips/dev/crmfb.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/sgimips/dev/crmfb.c
diff -u src/sys/arch/sgimips/dev/crmfb.c:1.32 src/sys/arch/sgimips/dev/crmfb.c:1.33
--- src/sys/arch/sgimips/dev/crmfb.c:1.32	Thu Apr  7 01:20:31 2011
+++ src/sys/arch/sgimips/dev/crmfb.c	Wed Apr 13 16:22:09 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: crmfb.c,v 1.32 2011/04/07 01:20:31 macallan Exp $ */
+/* $NetBSD: crmfb.c,v 1.33 2011/04/13 16:22:09 plunky Exp $ */
 
 /*-
  * Copyright (c) 2007 Jared D. McNeill 
@@ -32,7 +32,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.32 2011/04/07 01:20:31 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: crmfb.c,v 1.33 2011/04/13 16:22:09 plunky Exp $");
 
 #include 
 #include 
@@ -968,7 +968,7 @@
 bus_space_write_8(sc->sc_iot, sc->sc_reh,
 CRIME_RE_TLB_A + tlbptr + lptr, 
 reg);
-DPRINTF("%04x: %016llx\n", tlbptr + lptr, reg);
+DPRINTF("%04x: %016"PRIx64"\n", tlbptr + lptr, reg);
 reg = 0;
 lptr += 8;
 			}
@@ -977,7 +977,7 @@
 		if (shift != 64) {
 			bus_space_write_8(sc->sc_iot, sc->sc_reh,
 			CRIME_RE_TLB_A + tlbptr + lptr, reg);
-			DPRINTF("%04x: %016llx\n", tlbptr + lptr, reg);
+			DPRINTF("%04x: %016"PRIx64"\n", tlbptr + lptr, reg);
 		}
 		tlbptr += 32;
 	}



CVS commit: src/external/mit/xorg/server/xorg-server/hw/xfree86/common

2011-04-13 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Wed Apr 13 16:18:14 UTC 2011

Modified Files:
src/external/mit/xorg/server/xorg-server/hw/xfree86/common: Makefile

Log Message:
pass ${MACHINE} as -D__ so we can have arch-specific defaults


To generate a diff of this commit:
cvs rdiff -u -r1.17 -r1.18 \
src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile

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

Modified files:

Index: src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile
diff -u src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile:1.17 src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile:1.18
--- src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile:1.17	Mon Feb 21 04:42:16 2011
+++ src/external/mit/xorg/server/xorg-server/hw/xfree86/common/Makefile	Wed Apr 13 16:18:14 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.17 2011/02/21 04:42:16 mrg Exp $
+#	$NetBSD: Makefile,v 1.18 2011/04/13 16:18:14 macallan Exp $
 
 .include  # for HOST_SH
 
@@ -75,7 +75,8 @@
 		-I${X11SRCDIR.xorg-server}/render \
 		-I${X11SRCDIR.xorg-server}/randr \
 		-I. \
-		-I${X11SRCDIR.xorg-server}/../include
+		-I${X11SRCDIR.xorg-server}/../include \
+		-D__${MACHINE}
 
 CPPFLAGS+=	${X11FLAGS.EXTENSION} ${X11FLAGS.OS_DEFINES} \
 		${X11FLAGS.DIX} \



CVS commit: xsrc/external/mit/xorg-server/dist/hw/xfree86/common

2011-04-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 13 16:00:38 UTC 2011

Modified Files:
xsrc/external/mit/xorg-server/dist/hw/xfree86/common: xf86AutoConfig.c

Log Message:
- get platform #ifdefs in a slightly more sane order
- look for SBus and UPA devices on sparc(64)
- add default drivers for shark and sgimips
- only try wsfb if we can't find any other usable device
With this Xorg without config file works fine on shark, sparc(64) and amd64,
should work on other archs as well.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c

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

Modified files:

Index: xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c
diff -u xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c:1.4 xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c:1.5
--- xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c:1.4	Tue Nov 23 06:38:03 2010
+++ xsrc/external/mit/xorg-server/dist/hw/xfree86/common/xf86AutoConfig.c	Wed Apr 13 16:00:38 2011
@@ -49,6 +49,13 @@
 # include 
 #endif
 
+#ifdef __NetBSD__
+#if defined(__sparc__) || defined(__sparc64__)
+#include 
+extern struct sbus_devtable sbusDeviceTable[];
+#endif /* sparc / sparc64 */
+#endif /* NetBSD */
+
 /* Sections for the default built-in configuration. */
 
 #define BUILTIN_DEVICE_NAME \
@@ -198,6 +205,45 @@
 }
 i = 0;
 
+#ifdef __NetBSD__
+#if defined(__shark)
+matches[i++] = xnfstrdup("chips");
+matches[i++] = xnfstrdup("igs");
+#elif defined(__sgimips)
+matches[i++] = xnfstrdup("crime");
+matches[i++] = xnfstrdup("newport");
+#elif defined(__sparc) || defined(__sparc64)
+/* dig through /dev/fb* */
+{
+	struct fbtype fbt;
+	int j = 0, fd = 0, dev;
+	char fbpath[32];
+
+	for (j = 0; j < 10; j++) {
+	snprintf(fbpath, 31, "/dev/fb%d", j);
+	xf86Msg(X_ERROR,"%s: trying %s\n", __func__, fbpath);
+	fd = open(fbpath, O_RDONLY, 0);
+	if (fd == -1) continue;
+	memset(&fbt, 0, sizeof(fbt));
+	if (ioctl(fd, FBIOGTYPE, &fbt) == -1) {
+		close(fd);
+		continue;
+	}
+	close(fd);
+	dev = 0;
+	while ((sbusDeviceTable[dev].fbType != 0) &&
+	   (sbusDeviceTable[dev].fbType != fbt.fb_type))
+		dev++;
+	if (sbusDeviceTable[dev].fbType == fbt.fb_type) {
+		xf86Msg(X_ERROR,"%s: found %s\n", __func__,
+		sbusDeviceTable[dev].driverName);
+		matches[i++] = xnfstrdup(sbusDeviceTable[dev].driverName);
+	}
+	}
+}
+#endif
+
+#else /* !NetBSD */
 #ifdef sun
 /* Check for driver type based on /dev/fb type and if valid, use
it instead of PCI bus probe results */
@@ -255,25 +301,33 @@
 	matches[i++] = xnfstrdup(sbusDriver);
 }
 #endif
+#endif /* NetBSD */
 
 i = xf86PciMatchDriver(matches, nmatches);
 
-/* Fallback to platform default hardware */
-if (i < (nmatches - 1)) {
-#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
+/*
+ * Fallback to platform default frame buffer driver  if we didn't probe
+ * anything useful
+ */
+if (i == 0) {
+#ifdef __NetBSD__
+#if defined(__i386__) || defined(__amd64__)
 	matches[i++] = xnfstrdup("vesa");
-#elif defined(__sparc__) && !defined(sun)
-	matches[i++] = xnfstrdup("sunffb");
+#else
+	matches[i++] = xnfstrdup("wsfb");
 #endif
-}
-
-/* Fallback to platform default frame buffer driver */
-if (i < (nmatches - 1)) {
+#else /* !NetBSD */	
 #if !defined(__linux__) && defined(__sparc__)
 	matches[i++] = xnfstrdup("wsfb");
 #else
 	matches[i++] = xnfstrdup("fbdev");
 #endif
+#if defined(__i386__) || defined(__amd64__) || defined(__hurd__)
+	matches[i++] = xnfstrdup("vesa");
+#elif defined(__sparc__) && !defined(sun)
+	matches[i++] = xnfstrdup("sunffb");
+#endif
+#endif /* NetBSD */
 }
 }
 



CVS commit: xsrc/external/mit/xf86-video-suncg6/dist/src

2011-04-13 Thread Michael Lorenz
Module Name:xsrc
Committed By:   macallan
Date:   Wed Apr 13 15:47:03 UTC 2011

Modified Files:
xsrc/external/mit/xf86-video-suncg6/dist/src: cg6_driver.c

Log Message:
xf86LoaderReqSymLists() is no more


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 \
xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c

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

Modified files:

Index: xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c
diff -u xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.4 xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.5
--- xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c:1.4	Wed Jun 10 00:53:19 2009
+++ xsrc/external/mit/xf86-video-suncg6/dist/src/cg6_driver.c	Wed Apr 13 15:47:03 2011
@@ -417,7 +417,6 @@
 CG6FreeRec(pScrn);
 return FALSE;
 }
-xf86LoaderReqSymLists(xaaSymbols, NULL);
 
 /*
 set up clock and mode stuff



CVS commit: src/lib/librumphijack

2011-04-13 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Apr 13 12:40:54 UTC 2011

Modified Files:
src/lib/librumphijack: hijack.c

Log Message:
Move the forward declaration of _sys_readlink() outside of the #if,
so that the build succeeds even if _FORTIFY_SOURCE isn't > 0.


To generate a diff of this commit:
cvs rdiff -u -r1.87 -r1.88 src/lib/librumphijack/hijack.c

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.87 src/lib/librumphijack/hijack.c:1.88
--- src/lib/librumphijack/hijack.c:1.87	Tue Apr 12 19:49:48 2011
+++ src/lib/librumphijack/hijack.c	Wed Apr 13 12:40:54 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.87 2011/04/12 19:49:48 christos Exp $	*/
+/*  $NetBSD: hijack.c,v 1.88 2011/04/13 12:40:54 he Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -26,7 +26,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: hijack.c,v 1.87 2011/04/12 19:49:48 christos Exp $");
+__RCSID("$NetBSD: hijack.c,v 1.88 2011/04/13 12:40:54 he Exp $");
 
 #define __ssp_weak_name(fun) _hijack_ ## fun
 
@@ -1970,10 +1970,11 @@
 	(int, int),			\
 	(fd, how))
 
+ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t);
+
 #if _FORTIFY_SOURCE > 0
 #define STUB(fun) __ssp_weak_name(fun)
 ssize_t STUB(readlink)(const char * __restrict, char * __restrict, size_t);
-ssize_t _sys_readlink(const char * __restrict, char * __restrict, size_t);
 ssize_t
 STUB(readlink)(const char * __restrict path, char * __restrict buf,
 size_t bufsiz)



CVS commit: src/sys/arch/x68k/stand/loadbsd

2011-04-13 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Apr 13 11:10:50 UTC 2011

Modified Files:
src/sys/arch/x68k/stand/loadbsd: Makefile

Log Message:
Convert to using -nostdinc, and set include paths and create symlinks
so that we include the source tree's sys/, machine/ and m68k/ headers,
and only as a last resort use DESTDIR's /usr/include.  For some reason
the host's bootinfo.h got included ahead of the x68k variant, causing
a build failure in my case.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x68k/stand/loadbsd/Makefile

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

Modified files:

Index: src/sys/arch/x68k/stand/loadbsd/Makefile
diff -u src/sys/arch/x68k/stand/loadbsd/Makefile:1.12 src/sys/arch/x68k/stand/loadbsd/Makefile:1.13
--- src/sys/arch/x68k/stand/loadbsd/Makefile:1.12	Thu Jun 29 03:46:43 2006
+++ src/sys/arch/x68k/stand/loadbsd/Makefile	Wed Apr 13 11:10:49 2011
@@ -1,4 +1,6 @@
-#	$NetBSD: Makefile,v 1.12 2006/06/29 03:46:43 lukem Exp $
+#	$NetBSD: Makefile,v 1.13 2011/04/13 11:10:49 he Exp $
+
+S=	${.CURDIR}/../../../..
 
 BASE=	loadbsd
 PROG=	${BASE}.x	# Human68k ".x" executable
@@ -20,12 +22,22 @@
 
 CPPFLAGS=	-W -Wall -O -fomit-frame-pointer
 CPPFLAGS+=	-m68000 -Wa,-mc68000
+CPPFLAGS+=	-nostdinc 
+CPPFLAGS+=	-I$S -I.
 CPPFLAGS+=	-I${.CURDIR}/../libdos -I${.CURDIR}/../libiocs
+CPPFLAGS+=	-I${DESTDIR}/usr/include
 LDFLAGS=	-nostdlib -static -N
 LDLIBS=		-L${LIBDOS} -ldos -L${LIBIOCS} -liocs -L${DESTDIR}/usr/lib -lc
 DPADD+=		${AOUT2HUX}
 
 CLEANFILES+=	${BASE}1 ${BASE}2
+CLEANFILES+=	machine m68k
+
+.if !make(obj) && !make(clean) && !make(cleandir)
+.BEGIN:
+	rm -f machine && ln -s $S/arch/x68k/include machine
+	rm -f m68k && ln -s $S/arch/m68k/include m68k
+.endif
 
 ${PROG}: ${BASE}1 ${BASE}2
 	${_MKTARGET_LINK}



CVS commit: src/tests/lib/libcurses/slave

2011-04-13 Thread Havard Eidnes
Module Name:src
Committed By:   he
Date:   Wed Apr 13 09:46:38 UTC 2011

Modified Files:
src/tests/lib/libcurses/slave: Makefile

Log Message:
Explicitly list -lterminfo after -lcurses, to support static builds.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libcurses/slave/Makefile

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

Modified files:

Index: src/tests/lib/libcurses/slave/Makefile
diff -u src/tests/lib/libcurses/slave/Makefile:1.1 src/tests/lib/libcurses/slave/Makefile:1.2
--- src/tests/lib/libcurses/slave/Makefile:1.1	Sun Apr 10 09:55:10 2011
+++ src/tests/lib/libcurses/slave/Makefile	Wed Apr 13 09:46:38 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.1 2011/04/10 09:55:10 blymn Exp $
+#	$NetBSD: Makefile,v 1.2 2011/04/13 09:46:38 he Exp $
 #
 .include 
 
@@ -12,6 +12,6 @@
 SRCS=	slave.c commands.c curses_commands.c
 
 CPPFLAGS+=	-g -I${.CURDIR} -I. -I${.CURDIR}/../director
-LDADD+=		-lcurses
+LDADD+=		-lcurses -lterminfo
 
 .include 



CVS commit: src/sys/sys

2011-04-13 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Wed Apr 13 08:45:00 UTC 2011

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

Log Message:
expose the KSTACK_LOWEST_ADDR and KSTACK_SIZE to _KMEMUSER as well,
like the x86 versions do.  for crash(8).


To generate a diff of this commit:
cvs rdiff -u -r1.302 -r1.303 src/sys/sys/proc.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/proc.h
diff -u src/sys/sys/proc.h:1.302 src/sys/sys/proc.h:1.303
--- src/sys/sys/proc.h:1.302	Tue Mar  8 12:39:29 2011
+++ src/sys/sys/proc.h	Wed Apr 13 08:45:00 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: proc.h,v 1.302 2011/03/08 12:39:29 pooka Exp $	*/
+/*	$NetBSD: proc.h,v 1.303 2011/04/13 08:45:00 mrg Exp $	*/
 
 /*-
  * Copyright (c) 2006, 2007, 2008 The NetBSD Foundation, Inc.
@@ -534,6 +534,20 @@
 #define	tsleep(chan, pri, wmesg, timo)	\
 	ltsleep(chan, pri, wmesg, timo, NULL)
 
+#ifdef KSTACK_CHECK_MAGIC
+void	kstack_setup_magic(const struct lwp *);
+void	kstack_check_magic(const struct lwp *);
+#else
+#define	kstack_setup_magic(x)
+#define	kstack_check_magic(x)
+#endif
+
+extern struct emul emul_netbsd;
+
+#endif	/* _KERNEL */
+
+#if defined(_KMEMUSER) || defined(_KERNEL)
+
 /*
  * Kernel stack parameters.
  *
@@ -551,15 +565,6 @@
 #define	KSTACK_SIZE		(USPACE - ALIGN(sizeof(struct pcb)))
 #endif
 
-#ifdef KSTACK_CHECK_MAGIC
-void	kstack_setup_magic(const struct lwp *);
-void	kstack_check_magic(const struct lwp *);
-#else
-#define	kstack_setup_magic(x)
-#define	kstack_check_magic(x)
-#endif
+#endif	/* _KMEMUSER || _KERNEL */
 
-extern struct emul emul_netbsd;
-
-#endif	/* _KERNEL */
 #endif	/* !_SYS_PROC_H_ */



CVS commit: src/lib/libc/stdlib

2011-04-13 Thread Jukka Ruohonen
Module Name:src
Committed By:   jruoho
Date:   Wed Apr 13 07:12:52 UTC 2011

Modified Files:
src/lib/libc/stdlib: Makefile.inc div.3
Removed Files:
src/lib/libc/stdlib: imaxdiv.3 ldiv.3 lldiv.3

Log Message:
Collect also the division functions to single place, div(3).


To generate a diff of this commit:
cvs rdiff -u -r1.76 -r1.77 src/lib/libc/stdlib/Makefile.inc
cvs rdiff -u -r1.12 -r1.13 src/lib/libc/stdlib/div.3
cvs rdiff -u -r1.1 -r0 src/lib/libc/stdlib/imaxdiv.3
cvs rdiff -u -r1.13 -r0 src/lib/libc/stdlib/ldiv.3
cvs rdiff -u -r1.7 -r0 src/lib/libc/stdlib/lldiv.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/libc/stdlib/Makefile.inc
diff -u src/lib/libc/stdlib/Makefile.inc:1.76 src/lib/libc/stdlib/Makefile.inc:1.77
--- src/lib/libc/stdlib/Makefile.inc:1.76	Wed Apr 13 06:56:50 2011
+++ src/lib/libc/stdlib/Makefile.inc	Wed Apr 13 07:12:52 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.inc,v 1.76 2011/04/13 06:56:50 jruoho Exp $
+#	$NetBSD: Makefile.inc,v 1.77 2011/04/13 07:12:52 jruoho Exp $
 #	from: @(#)Makefile.inc	8.3 (Berkeley) 2/4/95
 
 # stdlib sources
@@ -43,9 +43,9 @@
 	exit.3 \
 	getenv.3 getopt.3 getopt_long.3 getsubopt.3 grantpt.3 \
 	hcreate.3 \
-	imaxdiv.3 insque.3 \
+	insque.3 \
 	jemalloc.3 \
-	ldiv.3 lldiv.3 lsearch.3 \
+	lsearch.3 \
 	malloc.3 memory.3 mi_vector_hash.3 \
 	posix_memalign.3 posix_openpt.3 ptsname.3 \
 	qabs.3 qdiv.3 qsort.3 \
@@ -59,6 +59,9 @@
 MLINKS+=abs.3 labs.3 \
 	abs.3 llabs.3 \
 	abs.3 imaxabs.3
+MLINKS+=div.3 ldiv.3 \
+	div.3 lldiv.3 \
+	div.3 imaxdiv.3
 MLINKS+=getenv.3 setenv.3 getenv.3 unsetenv.3 getenv.3 putenv.3
 MLINKS+=getenv.3 getenv_r.3
 MLINKS+=hcreate.3 hdestroy.3 hcreate.3 hsearch.3

Index: src/lib/libc/stdlib/div.3
diff -u src/lib/libc/stdlib/div.3:1.12 src/lib/libc/stdlib/div.3:1.13
--- src/lib/libc/stdlib/div.3:1.12	Mon Aug  4 21:29:27 2008
+++ src/lib/libc/stdlib/div.3	Wed Apr 13 07:12:52 2011
@@ -1,4 +1,4 @@
-.\"	$NetBSD: div.3,v 1.12 2008/08/04 21:29:27 matt Exp $
+.\"	$NetBSD: div.3,v 1.13 2011/04/13 07:12:52 jruoho Exp $
 .\"
 .\" Copyright (c) 1990, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -31,41 +31,57 @@
 .\"
 .\" from: @(#)div.3	8.1 (Berkeley) 6/4/93
 .\"
-.Dd June 4, 1993
+.Dd April 13, 2011
 .Dt DIV 3
 .Os
 .Sh NAME
-.Nm div
-.Nd return quotient and remainder from division
+.Nm div ,
+.Nm ldiv ,
+.Nm lldiv ,
+.Nm imaxdiv
+.Nd quotient and remainder from division
 .Sh LIBRARY
 .Lb libc
 .Sh SYNOPSIS
 .In stdlib.h
 .Ft div_t
 .Fn div "int num" "int denom"
+.Ft ldiv_t
+.Fn ldiv "long int num" "long int denom"
+.Ft lldiv_t
+.Fn lldiv "long long int num" "long long int denom"
+.In inttypes.h
+.Ft imaxdiv_t
+.Fn imaxdiv "intmax_t num" "intmax_t denom"
 .Sh DESCRIPTION
-The
-.Fn div
-function
-computes the value
-.Fa num/denom
-and returns the quotient and remainder in a structure named
-.Fa div_t
-that contains two
-.Em int
-members named
-.Fa quot
+These functions compute the value of
+.Fa num / denom
+and return the quotient and remainder in a specific divison structure.
+The functions differ only with respect to the type of the return value and
+the parameters.
+.Pp
+The returned structure always contains two members named
+.Vt quot
 and
-.Fa rem .
+.Vt rem ,
+denoting the quotient and the remainder.
+The type of these correspond with the underlying type of the function.
+.Sh EXAMPLES
+The following example demonstrate the basic usage of the functions.
+.Bd -literal -offset indent
+div_t d;
+
+int a = 4321;
+int b = 1234;
+
+d = div(a, b);
+
+(void)printf(\*[q]%d %d\en\*[q], d.quot, d.rem);
+.Ed
 .Sh SEE ALSO
-.Xr imaxdiv 3 ,
-.Xr ldiv 3 ,
-.Xr lldiv 3 ,
+.Xr fast_divide32 3 ,
 .Xr math 3 ,
 .Xr qdiv 3
 .Sh STANDARDS
-The
-.Fn div
-function
-conforms to
-.St -ansiC .
+All described functions conform to
+.St -isoC-99 .