CVS commit: src/crypto/dist/ipsec-tools/src/racoon

2010-09-08 Thread VANHULLEBUS Yvan
Module Name:src
Committed By:   vanhu
Date:   Wed Sep  8 12:18:35 UTC 2010

Modified Files:
src/crypto/dist/ipsec-tools/src/racoon: remoteconf.c

Log Message:
fixed remoteconf selection when no ID specified in configuration, and added 
some debug to remoteconf selection


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 \
src/crypto/dist/ipsec-tools/src/racoon/remoteconf.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/dist/ipsec-tools/src/racoon/remoteconf.c
diff -u src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.20 src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.21
--- src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c:1.20	Thu Aug 26 13:31:55 2010
+++ src/crypto/dist/ipsec-tools/src/racoon/remoteconf.c	Wed Sep  8 12:18:35 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: remoteconf.c,v 1.20 2010/08/26 13:31:55 vanhu Exp $	*/
+/*	$NetBSD: remoteconf.c,v 1.21 2010/09/08 12:18:35 vanhu Exp $	*/
 
 /* Id: remoteconf.c,v 1.38 2006/05/06 15:52:44 manubsd Exp */
 
@@ -106,11 +106,13 @@
 		return 0;
 
 	for (id = genlist_next(rmconf-idvl_p, gpb); id; id = genlist_next(0, gpb)) {
+		/* No ID specified in configuration, so it is ok */
+		if (id-id == 0)
+			return 0;
+
 		/* check the type of both IDs */
 		if (id-idtype != doi2idtype(id_b-type))
 			continue;  /* ID type mismatch */
-		if (id-id == 0)
-			return 0;
 
 		/* compare defined ID with the ID sent by peer. */
 		switch (id-idtype) {
@@ -197,23 +199,32 @@
 	struct rmconfselector *rmsel;
 	struct remoteconf *rmconf;
 {
-	int ret = MATCH_NONE;
+	int ret = MATCH_NONE, tmp;
 
 	/* No match at all: unwanted anonymous */
 	if ((rmsel-flags  GETRMCONF_F_NO_ANONYMOUS) 
-	rmconf-remote-sa_family == AF_UNSPEC)
+	rmconf-remote-sa_family == AF_UNSPEC){
+		plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+		 Not matched: Anonymous conf.\n);
 		return MATCH_NONE;
+	}
 
-	if ((rmsel-flags  GETRMCONF_F_NO_PASSIVE)  rmconf-passive)
+	if ((rmsel-flags  GETRMCONF_F_NO_PASSIVE)  rmconf-passive){
+		plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+		 Not matched: passive conf.\n);
 		return MATCH_NONE;
+	}
 
 	ret |= MATCH_BASIC;
 
 	/* Check address */
 	if (rmsel-remote != NULL) {
 		if (rmconf-remote-sa_family != AF_UNSPEC) {
-			if (cmpsaddr(rmsel-remote, rmconf-remote) == CMPSADDR_MISMATCH)
+			if (cmpsaddr(rmsel-remote, rmconf-remote) == CMPSADDR_MISMATCH){
+plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+ Not matched: address mismatch.\n);
 return MATCH_NONE;
+			}
 
 			/* Address matched */
 			ret |= MATCH_ADDRESS;
@@ -222,24 +233,34 @@
 
 	/* Check etype and approval */
 	if (rmsel-etype != ISAKMP_ETYPE_NONE) {
-		if (rmconf_match_etype_and_approval(rmconf, rmsel-etype,
-		rmsel-approval) != 0)
+		tmp=rmconf_match_etype_and_approval(rmconf, rmsel-etype,
+		rmsel-approval);
+		if (tmp != 0){
+			plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+			 Not matched: etype (%d)/approval mismatch (%d).\n, rmsel-etype, tmp);
 			return MATCH_NONE;
+		}
 		ret |= MATCH_SA;
 	}
 
 	/* Check identity */
 	if (rmsel-identity != NULL  rmconf-verify_identifier) {
-		if (rmconf_match_identity(rmconf, rmsel-identity) != 0)
+		if (rmconf_match_identity(rmconf, rmsel-identity) != 0){
+			plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+			 Not matched: identity mismatch.\n);
 			return MATCH_NONE;
+		}
 		ret |= MATCH_IDENTITY;
 	}
 
 	/* Check certificate request */
 	if (rmsel-certificate_request != NULL) {
 		if (oakley_get_certtype(rmsel-certificate_request) !=
-		oakley_get_certtype(rmconf-mycert))
+		oakley_get_certtype(rmconf-mycert)){
+			plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+			 Not matched: cert type mismatch.\n);
 			return MATCH_NONE;
+		}
 
 		if (rmsel-certificate_request-l  1) {
 			vchar_t *issuer;
@@ -249,12 +270,17 @@
 			memcmp(rmsel-certificate_request-v + 1,
    issuer-v, issuer-l) != 0) {
 vfree(issuer);
+plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+ Not matched: cert issuer mismatch.\n);
 return MATCH_NONE;
 			}
 			vfree(issuer);
 		} else {
-			if (!rmconf-match_empty_cr)
+			if (!rmconf-match_empty_cr){
+plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+ Not matched: empty certificate request.\n);
 return MATCH_NONE;
+			}
 		}
 
 		ret |= MATCH_AUTH_IDENTITY;
@@ -286,9 +312,17 @@
 	int ret = 0;
 
 	RACOON_TAILQ_FOREACH_REVERSE(p, rmtree, _rmtree, chain) {
+		plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+		 Checking remote conf \%s\ %s.\n, p-name,
+		 p-remote-sa_family == AF_UNSPEC ?
+		 anonymous : saddr2str(p-remote));
+
 		if (rmsel != NULL) {
-			if (rmconf_match_type(rmsel, p) == MATCH_NONE)
+			if (rmconf_match_type(rmsel, p) == MATCH_NONE){
+plog(LLV_DEBUG2, LOCATION, rmsel-remote,
+ Not matched.\n);
 continue;
+			}
 		}
 
 		plog(LLV_DEBUG2, LOCATION, NULL,
@@ -740,6 +774,8 @@
 	for (e = rmconf-etypes; e != NULL; e = 

CVS commit: src/usr.bin/passwd

2010-09-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep  8 13:44:44 UTC 2010

Modified Files:
src/usr.bin/passwd: yp_passwd.c

Log Message:
PR/43852: Wolfgang Stukenbrock: yp_passwd command may destroy NIS database
entries when used on a server that includes users via netgroups.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/passwd/yp_passwd.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/passwd/yp_passwd.c
diff -u src/usr.bin/passwd/yp_passwd.c:1.33 src/usr.bin/passwd/yp_passwd.c:1.34
--- src/usr.bin/passwd/yp_passwd.c:1.33	Sun Apr 12 19:59:37 2009
+++ src/usr.bin/passwd/yp_passwd.c	Wed Sep  8 09:44:44 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: yp_passwd.c,v 1.33 2009/04/12 23:59:37 lukem Exp $	*/
+/*	$NetBSD: yp_passwd.c,v 1.34 2010/09/08 13:44:44 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from:  @(#)local_passwd.c8.3 (Berkeley) 4/2/94;
 #else
-__RCSID($NetBSD: yp_passwd.c,v 1.33 2009/04/12 23:59:37 lukem Exp $);
+__RCSID($NetBSD: yp_passwd.c,v 1.34 2010/09/08 13:44:44 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -168,21 +168,26 @@
 ypgetpwnam(const char *nam, struct passwd *pwd)
 {
 	char *val;
-	int reason, vallen;
-	int flags;
+	int reason, vallen, namlen = (int)strlen(nam);
+	int flags = 0;
 	int ok = 0;
 	
 	val = NULL;
-	reason = yp_match(domain, passwd.byname, nam, (int)strlen(nam),
-			  val, vallen);
+	reason = yp_match(domain, master.passwd.byname, nam, namlen,
+  val, vallen);
+	if (reason == YPERR_MAP) {
+		reason = yp_match(domain, passwd.byname, nam, namlen,
+  val, vallen);
+		flags = _PASSWORD_OLDFMT;
+	}
 	if (reason != 0)
 		goto out;
 
-	flags = _PASSWORD_OLDFMT;
 	if (pw_scan(val, pwd, flags) == 0)
 		goto out;
 
 	ok = 1;
+	val = NULL;	/* Don't free the memory, it is still in use */
 out:
 	if (val)
 		free(val);
@@ -213,7 +218,7 @@
 	char *master;
 	int ch, r, rpcport, status;
 	struct yppasswd ypp;
-	struct passwd pwb, *pw;
+	struct passwd pwb, pwb2, *pw;
 	char pwbuf[1024];
 	struct timeval tv;
 	CLIENT *client;
@@ -266,7 +271,7 @@
 	 * the daemon.
 	 */
 	if ((r = yp_master(domain, passwd.byname, master)) != 0)
-		errx(1, can't find the master NIS server.  Reason: %s,
+		errx(1, can't find the master NIS server. Reason: %s,
 		yperr_string(r));
 
 	/*
@@ -285,16 +290,16 @@
 
 	/* Bail out if this is a local (non-yp) user, */
 	/* then get user's login identity */
-	if (!ypgetpwnam(username, pw = pwb) ||
-	getpwnam_r(username, pwb, pwbuf, sizeof(pwbuf), pw) ||
+	if (!ypgetpwnam(username, pwb) ||
+	getpwnam_r(username, pwb2, pwbuf, sizeof(pwbuf), pw) ||
 	pw == NULL)
 		errx(1, NIS unknown user %s, username);
 
-	if (uid  uid != pw-pw_uid)
+	if (uid  uid != pwb.pw_uid)
 		errx(1, you may only change your own password: %s,
 		strerror(EACCES));
 
-	makeypp(ypp, pw);
+	makeypp(ypp, pwb);
 
 	client = clnt_create(master, YPPASSWDPROG, YPPASSWDVERS, udp);
 	if (client == NULL)



CVS commit: src/usr.bin/passwd

2010-09-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep  8 13:58:47 UTC 2010

Modified Files:
src/usr.bin/passwd: yp_passwd.c

Log Message:
KNF, make error messages consistent.


To generate a diff of this commit:
cvs rdiff -u -r1.34 -r1.35 src/usr.bin/passwd/yp_passwd.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/passwd/yp_passwd.c
diff -u src/usr.bin/passwd/yp_passwd.c:1.34 src/usr.bin/passwd/yp_passwd.c:1.35
--- src/usr.bin/passwd/yp_passwd.c:1.34	Wed Sep  8 09:44:44 2010
+++ src/usr.bin/passwd/yp_passwd.c	Wed Sep  8 09:58:46 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: yp_passwd.c,v 1.34 2010/09/08 13:44:44 christos Exp $	*/
+/*	$NetBSD: yp_passwd.c,v 1.35 2010/09/08 13:58:46 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1990, 1993, 1994
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = from:  @(#)local_passwd.c8.3 (Berkeley) 4/2/94;
 #else
-__RCSID($NetBSD: yp_passwd.c,v 1.34 2010/09/08 13:44:44 christos Exp $);
+__RCSID($NetBSD: yp_passwd.c,v 1.35 2010/09/08 13:58:46 christos Exp $);
 #endif
 #endif /* not lint */
 
@@ -85,8 +85,8 @@
 	int tries;
 	const char *p, *t;
 	char *result;
-	static char buf[_PASSWORD_LEN+1];
-	char salt[_PASSWORD_LEN+1];
+	static char buf[_PASSWORD_LEN + 1];
+	char salt[_PASSWORD_LEN + 1];
 	char option[LINE_MAX], *key, *opt;
 
 	(void)printf(Changing NIS password for %s.\n, pw-pw_name);
@@ -96,7 +96,7 @@
 	
 		if (pw-pw_passwd[0]) {
 			if (strcmp(crypt(p = getpass(Old password:),
-	 pw-pw_passwd),  pw-pw_passwd)) {
+			pw-pw_passwd),  pw-pw_passwd)) {
 (void)printf(Sorry.\n);
 pwerror(NULL, 0, 1);
 			}
@@ -123,9 +123,9 @@
 		for (t = p; *t  islower((unsigned char)*t); ++t);
 		if (!*t  ++tries  2) {
 			(void)printf(Please don't use an all-lower case 
- password.\nUnusual capitalization, 
- control characters or digits are 
- suggested.\n);
+			password.\nUnusual capitalization, 
+			control characters or digits are 
+			suggested.\n);
 			continue;
 		}
 		(void)strlcpy(buf, p, sizeof(buf));
@@ -146,7 +146,7 @@
 		(void)printf(not enough core.\n);
 		pwerror(NULL, 0, 0);
 	}
-	return (result);
+	return result;
 }
 
 static void
@@ -169,15 +169,16 @@
 {
 	char *val;
 	int reason, vallen, namlen = (int)strlen(nam);
-	int flags = 0;
-	int ok = 0;
+	int flags;
+	int ok;
 	
+	flags = ok = 0;
 	val = NULL;
 	reason = yp_match(domain, master.passwd.byname, nam, namlen,
-  val, vallen);
+	val, vallen);
 	if (reason == YPERR_MAP) {
 		reason = yp_match(domain, passwd.byname, nam, namlen,
-  val, vallen);
+		val, vallen);
 		flags = _PASSWORD_OLDFMT;
 	}
 	if (reason != 0)
@@ -200,7 +201,7 @@
 pwyp_usage(const char *prefix)
 {
 
-	(void) fprintf(stderr, %s %s [-d nis | -y] [user]\n,
+	(void)fprintf(stderr, %s %s [-d nis | -y] [user]\n,
 	prefix, getprogname());
 }
 
@@ -208,7 +209,7 @@
 pwyp_argv0_usage(const char *prefix)
 {
 
-	(void) fprintf(stderr, %s %s [user]\n,
+	(void)fprintf(stderr, %s %s [user]\n,
 	prefix, getprogname());
 }
 
@@ -217,6 +218,7 @@
 {
 	char *master;
 	int ch, r, rpcport, status;
+	enum clnt_stat yr;
 	struct yppasswd ypp;
 	struct passwd pwb, pwb2, *pw;
 	char pwbuf[1024];
@@ -249,12 +251,12 @@
 		break;
 	default:
 		usage();
-		/* NOTREACHED */
+		/*NOTREACHED*/
 	}
 
 	if (_yp_check(NULL) == 0) {
 		/* can't use YP. */
-		errx(1, NIS not in use.);
+		errx(EXIT_FAILURE, NIS not in use.);
 	}
 
 	uid = getuid();
@@ -263,7 +265,7 @@
 	 * Get local domain
 	 */
 	if ((r = yp_get_default_domain(domain)) != 0)
-		errx(1, can't get local NIS domain.  Reason: %s,
+		errx(EXIT_FAILURE, Can't get local NIS domain (%s),
 		yperr_string(r));
 
 	/*
@@ -271,7 +273,7 @@
 	 * the daemon.
 	 */
 	if ((r = yp_master(domain, passwd.byname, master)) != 0)
-		errx(1, can't find the master NIS server. Reason: %s,
+		errx(EXIT_FAILURE, Can't find the master NIS server (%s),
 		yperr_string(r));
 
 	/*
@@ -279,40 +281,42 @@
 	 */
 	if ((rpcport = getrpcport(master, YPPASSWDPROG,
 	YPPASSWDPROC_UPDATE, IPPROTO_UDP)) == 0)
-		errx(1, master NIS server not running yppasswd daemon.\n\t%s\n,
-		Can't change NIS password.);
+		errx(EXIT_FAILURE, Master NIS server not running yppasswd 
+		daemon);
 
 	/*
 	 * Be sure the port is privileged
 	 */
 	if (rpcport = IPPORT_RESERVED)
-		errx(1, yppasswd daemon is on an invalid port.);
+		errx(EXIT_FAILURE, Yppasswd daemon is on an invalid port);
 
 	/* Bail out if this is a local (non-yp) user, */
 	/* then get user's login identity */
 	if (!ypgetpwnam(username, pwb) ||
 	getpwnam_r(username, pwb2, pwbuf, sizeof(pwbuf), pw) ||
 	pw == NULL)
-		errx(1, NIS unknown user %s, username);
+		errx(EXIT_FAILURE, NIS unknown user %s, username);
 
-	if (uid  uid != pwb.pw_uid)
-		errx(1, you may only change your own password: %s,
-		strerror(EACCES));
+	if (uid  uid != pwb.pw_uid) {
+		errno = 

CVS commit: src/sys/dev/usb

2010-09-08 Thread KIYOHARA Takashi
Module Name:src
Committed By:   kiyohara
Date:   Wed Sep  8 14:01:58 UTC 2010

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

Log Message:
Ensure that it is UPS_PORT_ENABLED before checking the speed of the device.


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

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

Modified files:

Index: src/sys/dev/usb/uhub.c
diff -u src/sys/dev/usb/uhub.c:1.109 src/sys/dev/usb/uhub.c:1.110
--- src/sys/dev/usb/uhub.c:1.109	Tue Feb  2 23:18:49 2010
+++ src/sys/dev/usb/uhub.c	Wed Sep  8 14:01:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: uhub.c,v 1.109 2010/02/02 23:18:49 pooka Exp $	*/
+/*	$NetBSD: uhub.c,v 1.110 2010/09/08 14:01:58 kiyohara Exp $	*/
 /*	$FreeBSD: src/sys/dev/usb/uhub.c,v 1.18 1999/11/17 22:33:43 n_hibma Exp $	*/
 
 /*
@@ -36,7 +36,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.109 2010/02/02 23:18:49 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: uhub.c,v 1.110 2010/09/08 14:01:58 kiyohara Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -525,6 +525,14 @@
 #endif
 			continue;
 		}
+		if (!(status  UPS_PORT_ENABLED)) {
+			/* Not allowed send/receive packet. */
+#ifdef DIAGNOSTIC
+			printf(%s: port %d, device not enable\n,
+			   USBDEVNAME(sc-sc_dev), port);
+#endif
+			continue;
+		}
 
 		/* Figure out device speed */
 		if (status  UPS_HIGH_SPEED)



CVS commit: src/distrib/notes/common

2010-09-08 Thread Zoltan Arnold NAGY
Module Name:src
Committed By:   zoltan
Date:   Wed Sep  8 19:21:14 UTC 2010

Modified Files:
src/distrib/notes/common: main

Log Message:
Add myself to the list of developers.


To generate a diff of this commit:
cvs rdiff -u -r1.465 -r1.466 src/distrib/notes/common/main

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

Modified files:

Index: src/distrib/notes/common/main
diff -u src/distrib/notes/common/main:1.465 src/distrib/notes/common/main:1.466
--- src/distrib/notes/common/main:1.465	Sun Jul 11 20:00:52 2010
+++ src/distrib/notes/common/main	Wed Sep  8 19:21:13 2010
@@ -1,4 +1,4 @@
-.\	$NetBSD: main,v 1.465 2010/07/11 20:00:52 gsutre Exp $
+.\	$NetBSD: main,v 1.466 2010/09/08 19:21:13 zoltan Exp $
 .\
 .\ Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -1261,6 +1261,7 @@
 .It Ta Constantine A. Murenin Ta Mt c...@netbsd.org
 .It Ta Joseph Myers Ta Mt j...@netbsd.org
 .It Ta Tuomo M\(:akinen Ta Mt t...@netbsd.org
+.It Ta Zolt\('an Arnold NAGY Ta Mt zol...@netbsd.org
 .It Ta Ken Nakata Ta Mt k...@netbsd.org
 .It Ta Takeshi Nakayama Ta Mt nakay...@netbsd.org
 .It Ta Phil Nelson Ta Mt p...@netbsd.org



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

2010-09-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Sep  8 21:02:12 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Improve pagedaemon performance:
  * page out vnode objects
  * drain kmem/kernel_map

As long as there is a reasonable memory hardlimit (600kB or so),
a rump kernel can now survive file system metadata access for an
arbitrary size file system (provided, of course, that the file
system does not use wired kernel memory for metadata ...).

Data handling still needs a little givetake finetuning.  The
general problem is that a single vm object can easily be the owner
of all vm pages in a rump kernel.  now, if a thread wants to allocate
memory while holding that object locked, there's very little the
pagedaemon can do to avoid deadlock.  but I think the problem can
be solved by making an object release a page when it wants to
allocate a page if a) the system is short on memory and b) too many
pages belong to the object.  that still doesn't take care of the
pathological situation where 1000 threads hold an object with 1
page of memory locked and try to allocate more.  but then again,
running 1000 threads with 1MB of memory is an unlikely scenario.
and ultimately, I call upon the fundamental interaction which is
the basis of why any operating works: luck.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.91 src/sys/rump/librump/rumpkern/vm.c:1.92
--- src/sys/rump/librump/rumpkern/vm.c:1.91	Tue Sep  7 21:11:10 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Sep  8 21:02:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.91 2010/09/07 21:11:10 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.92 2010/09/08 21:02:11 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.91 2010/09/07 21:11:10 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.92 2010/09/08 21:02:11 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -84,6 +84,26 @@
 
 unsigned long rump_physmemlimit = RUMPMEM_UNLIMITED;
 static unsigned long curphysmem;
+static unsigned long dddlim;		/* 90% of memory limit used */
+#define NEED_PAGEDAEMON() \
+(rump_physmemlimit != RUMPMEM_UNLIMITED  curphysmem  dddlim)
+
+/*
+ * Try to free two pages worth of pages from objects.
+ * If this succesfully frees a full page cache page, we'll
+ * free the released page plus PAGE_SIZEĀ²/sizeof(vm_page).
+ */
+#define PAGEDAEMON_OBJCHUNK (2*PAGE_SIZE / sizeof(struct vm_page))
+
+/*
+ * Keep a list of least recently used pages.  Since the only way a
+ * rump kernel can access a page is via lookup, we put the page
+ * at the back of queue every time a lookup for it is done.  If the
+ * page is in front of this global queue and we're short of memory, 
+ * it's a candidate for pageout.
+ */
+static struct pglist vmpage_lruqueue;
+static unsigned vmpage_onqueue;
 
 static int
 pg_compare_key(const struct rb_node *n, const void *key)
@@ -135,13 +155,18 @@
 
 static struct pool_cache pagecache;
 
-/* called with the object locked */
+/*
+ * Called with the object locked.  We don't support anons.
+ */
 struct vm_page *
 uvm_pagealloc_strat(struct uvm_object *uobj, voff_t off, struct vm_anon *anon,
 	int flags, int strat, int free_list)
 {
 	struct vm_page *pg;
 
+	KASSERT(uobj  mutex_owned(uobj-vmobjlock));
+	KASSERT(anon == NULL);
+
 	pg = pool_cache_get(pagecache, PR_WAITOK);
 	pg-offset = off;
 	pg-uobject = uobj;
@@ -154,6 +179,17 @@
 	TAILQ_INSERT_TAIL(uobj-memq, pg, listq.queue);
 	rb_tree_insert_node(uobj-rb_tree, pg-rb_node);
 
+	/*
+	 * Put vnodes on the LRU page queue.  we can't flush others,
+	 * so don't bother with them.
+	 */
+	if (UVM_OBJ_IS_VNODE(uobj)) {
+		atomic_inc_uint(vmpage_onqueue);
+		mutex_enter(uvm_pageqlock);
+		TAILQ_INSERT_TAIL(vmpage_lruqueue, pg, pageq.queue);
+		mutex_exit(uvm_pageqlock);
+	}
+
 	uobj-uo_npages++;
 
 	return pg;
@@ -169,12 +205,21 @@
 {
 	struct uvm_object *uobj = pg-uobject;
 
+	KASSERT(mutex_owned(uvm_pageqlock));
+
 	if (pg-flags  PG_WANTED)
 		wakeup(pg);
 
+	TAILQ_REMOVE(uobj-memq, pg, listq.queue);
+
 	uobj-uo_npages--;
 	rb_tree_remove_node(uobj-rb_tree, pg-rb_node);
-	TAILQ_REMOVE(uobj-memq, pg, listq.queue);
+
+	if (UVM_OBJ_IS_VNODE(uobj)) {
+		TAILQ_REMOVE(vmpage_lruqueue, pg, pageq.queue);
+		atomic_dec_uint(vmpage_onqueue);
+	}
+
 	pool_cache_put(pagecache, pg);
 }
 
@@ -207,11 +252,14 @@
 		CTASSERT(sizeof(buf) = HUMANIZE_BYTES);
 		format_bytes(buf, HUMANIZE_BYTES, rump_physmemlimit);
 #undef HUMANIZE_BYTES
+		dddlim = 9 * (rump_physmemlimit / 10);
 	} else {
 		strlcpy(buf, unlimited (host limit), sizeof(buf));
 	}
 	aprint_verbose(total memory = %s\n, buf);
 
+	

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

2010-09-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Sep  8 21:14:33 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Actually, we want to say no aobjs instead of only vnodes to
make component boundaries go right.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/rump/librump/rumpkern/vm.c

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

Modified files:

Index: src/sys/rump/librump/rumpkern/vm.c
diff -u src/sys/rump/librump/rumpkern/vm.c:1.92 src/sys/rump/librump/rumpkern/vm.c:1.93
--- src/sys/rump/librump/rumpkern/vm.c:1.92	Wed Sep  8 21:02:11 2010
+++ src/sys/rump/librump/rumpkern/vm.c	Wed Sep  8 21:14:32 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: vm.c,v 1.92 2010/09/08 21:02:11 pooka Exp $	*/
+/*	$NetBSD: vm.c,v 1.93 2010/09/08 21:14:32 pooka Exp $	*/
 
 /*
  * Copyright (c) 2007-2010 Antti Kantee.  All Rights Reserved.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.92 2010/09/08 21:02:11 pooka Exp $);
+__KERNEL_RCSID(0, $NetBSD: vm.c,v 1.93 2010/09/08 21:14:32 pooka Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -180,10 +180,11 @@
 	rb_tree_insert_node(uobj-rb_tree, pg-rb_node);
 
 	/*
-	 * Put vnodes on the LRU page queue.  we can't flush others,
-	 * so don't bother with them.
+	 * Don't put anons on the LRU page queue.  We can't flush them
+	 * (there's no concept of swap in a rump kernel), so no reason
+	 * to bother with them.
 	 */
-	if (UVM_OBJ_IS_VNODE(uobj)) {
+	if (!UVM_OBJ_IS_AOBJ(uobj)) {
 		atomic_inc_uint(vmpage_onqueue);
 		mutex_enter(uvm_pageqlock);
 		TAILQ_INSERT_TAIL(vmpage_lruqueue, pg, pageq.queue);
@@ -215,7 +216,7 @@
 	uobj-uo_npages--;
 	rb_tree_remove_node(uobj-rb_tree, pg-rb_node);
 
-	if (UVM_OBJ_IS_VNODE(uobj)) {
+	if (!UVM_OBJ_IS_AOBJ(uobj)) {
 		TAILQ_REMOVE(vmpage_lruqueue, pg, pageq.queue);
 		atomic_dec_uint(vmpage_onqueue);
 	}
@@ -467,7 +468,7 @@
 	struct vm_page *pg;
 
 	pg = (struct vm_page *)rb_tree_find_node(uobj-rb_tree, off);
-	if (pg  UVM_OBJ_IS_VNODE(pg-uobject)) {
+	if (pg  !UVM_OBJ_IS_AOBJ(pg-uobject)) {
 		mutex_enter(uvm_pageqlock);
 		TAILQ_REMOVE(vmpage_lruqueue, pg, pageq.queue);
 		TAILQ_INSERT_TAIL(vmpage_lruqueue, pg, pageq.queue);



CVS commit: src/sys/dev/ic

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:01:29 UTC 2010

Added Files:
src/sys/dev/ic: dm9000.c dm9000reg.h dm9000var.h

Log Message:
Driver for Davicom DM9000 ethernet chips.

Written by Paul Fleischer, minor modifications by me.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/dm9000.c src/sys/dev/ic/dm9000reg.h \
src/sys/dev/ic/dm9000var.h

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

Added files:

Index: src/sys/dev/ic/dm9000.c
diff -u /dev/null src/sys/dev/ic/dm9000.c:1.1
--- /dev/null	Wed Sep  8 22:01:29 2010
+++ src/sys/dev/ic/dm9000.c	Wed Sep  8 22:01:29 2010
@@ -0,0 +1,843 @@
+/*	$NetBSD: dm9000.c,v 1.1 2010/09/08 22:01:29 ahoka Exp $	*/
+
+/*
+ * Copyright (c) 2009 Paul Fleischer
+ * All rights reserved.
+ *
+ * 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.
+ * 3. The name of the company nor the name of the author may be used to
+ *endorse or promote products derived from this software without specific
+ *prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/* based on sys/dev/ic/cs89x0.c */
+/*
+ * Copyright (c) 2004 Christopher Gilbert
+ * All rights reserved.
+ *
+ * 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.
+ * 3. The name of the company nor the name of the author may be used to
+ *endorse or promote products derived from this software without specific
+ *prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Copyright 1997
+ * Digital Equipment Corporation. All rights reserved.
+ *
+ * This software is furnished under license and may be used and
+ * copied only in accordance with the following terms and conditions.
+ * Subject to these conditions, you may download, copy, install,
+ * use, modify and distribute this software in source and/or binary
+ * form. No title or ownership is transferred hereby.
+ *
+ * 1) Any source code used, modified or distributed must reproduce
+ *and retain this copyright notice and list of conditions as
+ *they appear in the source file.
+ *
+ * 2) No right is granted to use any trade name, trademark, or logo of
+ *Digital Equipment Corporation. Neither the Digital Equipment
+ *Corporation name nor any trademark or logo of Digital Equipment
+ *Corporation may be used to endorse or promote products derived
+ *from this software without the prior written permission of
+ *Digital Equipment Corporation.
+ *
+ * 3) This software is provided AS-IS and any express or implied
+ *warranties, including but not limited to, any implied warranties
+ *of merchantability, fitness for a particular purpose, or
+ *non-infringement are disclaimed. In no event shall DIGITAL be
+ *liable for any damages whatsoever, and in particular, DIGITAL
+ *shall not be liable for special, indirect, 

CVS commit: src/crypto/external/bsd/netpgp/dist/src/libmj

2010-09-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Sep  8 22:17:27 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/libmj: libmj.3

Log Message:
Add RCS Id, use more markup, use standard section headers,
fill in more fields in ECMA-262 reference.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3

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/netpgp/dist/src/libmj/libmj.3
diff -u src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3:1.2 src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3:1.3
--- src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3:1.2	Wed Sep  8 03:21:22 2010
+++ src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3	Wed Sep  8 22:17:27 2010
@@ -1,3 +1,4 @@
+.\ $NetBSD: libmj.3,v 1.3 2010/09/08 22:17:27 wiz Exp $
 .\
 .\ Copyright (c) 2010 Alistair Crooks a...@netbsd.org
 .\ All rights reserved.
@@ -102,7 +103,7 @@
 .Pp
 The
 .Nm
-library can be used to create a string in memory which contains a textutal
+library can be used to create a string in memory which contains a textual
 representation of a number of objects, arbitrarily structured.
 The library can also be used to reconstruct the structure.
 Data can thus be serialised easily and efficiently, and data structures
@@ -158,8 +159,9 @@
 .Fa depth
 and for the formatted output to be followed by a
 .Fa trailer
-string, which is usually NULL for external calls,
-but can be any valid string.
+string, which is usually
+.Dv NULL
+for external calls, but can be any valid string.
 Output is sent to the
 .Fa stream
 file stream.
@@ -188,8 +190,7 @@
 This restriction of values for an integer type may be removed at a later date.
 .Pp
 Within a JSON object, the key values can be iterated over using an integer
-index to access the individual
-JSON objects.
+index to access the individual JSON objects.
 The index can also be found using the
 .Fn mj_object_find
 function.
@@ -202,8 +203,7 @@
 Arrays are implemented as a simple array.
 Thus, to find an object in an array using
 .Fn mj_object_find ,
-a value of 1 should be used as the
-increment value.
+a value of 1 should be used as the increment value.
 This means that every entry in the internal array will be examined,
 and the first match after the starting point will be returned.
 For objects, an incremental value of 2 should be used,
@@ -212,13 +212,17 @@
 .Xr calloc 3 ,
 .Xr free 3
 .Rs
+.%Q Ecma International
+.%D December 2009
+.%T ECMA-262: ECMAScript Language Specification
 .%U http://www.ecma-international.org/publications/files/ecma-st/ECMA-262.pdf
+.%O 5th Edition
 .Re
 .Sh HISTORY
 The
 .Nm
 library first appeared in
 .Nx 6.0 .
-.Sh AUTHOR
+.Sh AUTHORS
 .An Alistair Crooks Aq a...@netbsd.org
 wrote this implementation and manual page.



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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:49:50 UTC 2010

Added Files:
src/sys/arch/evbarm/devkit8000: if_dme_gpmc.c

Log Message:
dme ethernet driver for devkit8000 gpmc


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/devkit8000/if_dme_gpmc.c

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

Added files:

Index: src/sys/arch/evbarm/devkit8000/if_dme_gpmc.c
diff -u /dev/null src/sys/arch/evbarm/devkit8000/if_dme_gpmc.c:1.1
--- /dev/null	Wed Sep  8 22:49:50 2010
+++ src/sys/arch/evbarm/devkit8000/if_dme_gpmc.c	Wed Sep  8 22:49:49 2010
@@ -0,0 +1,161 @@
+/*	$NetBSD: if_dme_gpmc.c,v 1.1 2010/09/08 22:49:49 ahoka Exp $	*/
+
+/*
+ * Copyright (c) 2010 Adam Hoka
+ * 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 AUTHOR ``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 AUTHOR 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.
+ */
+
+/*
+ * Copyright (c) 2009 Paul Fleischer
+ * All rights reserved.
+ *
+ * 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.
+ * 3. The name of the company nor the name of the author may be used to
+ *endorse or promote products derived from this software without specific
+ *prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
+ * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+
+#include opt_omap.h
+
+#include sys/param.h
+#include sys/systm.h
+#include sys/socket.h
+#include sys/device.h
+
+#include net/if.h
+#include net/if_ether.h
+#include net/if_media.h
+
+#include machine/bus.h
+#include machine/intr.h
+
+#include arch/arm/omap/omap2_gpmcvar.h
+#include arch/arm/omap/omap2_gpmcreg.h
+
+#include dev/ic/dm9000var.h
+#include dev/ic/dm9000reg.h
+
+int	dme_gpmc_match(device_t, struct cfdata *, void *);
+void	dme_gpmc_attach(device_t, device_t, void *);
+
+CFATTACH_DECL_NEW(dme_gpmc, sizeof(struct dme_softc),
+dme_gpmc_match, dme_gpmc_attach, NULL, NULL);
+
+int
+dme_gpmc_match(device_t parent, struct cfdata *cf, void *aux)
+{
+	struct gpmc_attach_args *gpmc = aux;
+	bus_space_tag_t iot = gpmc-gpmc_iot;
+	bus_space_handle_t ioh;
+
+	uint8_t vendor_id[2];
+	uint8_t product_id[2];
+	int result = 0;
+
+	/* Map memory to access the device during probing */
+	/* XXX should be done with two mappings */
+	if (bus_space_map(iot, gpmc-gpmc_addr, 0x404, 0, ioh))
+		goto out;
+
+	/* Used to temporarily access the device for probing */
+	struct dme_softc sc = {
+		.sc_iot = iot,
+		.sc_ioh = ioh,
+		.dme_io = 0x0,
+		.dme_data = 0x400
+	};
+
+	vendor_id[0] = dme_read(sc, DM9000_VID0);
+	vendor_id[1] = dme_read(sc, DM9000_VID1);
+
+	product_id[0] = dme_read(sc, DM9000_PID0);
+	product_id[1] = dme_read(sc, DM9000_PID1);
+
+	if (vendor_id[0] == 0x46  vendor_id[1] == 0x0a 
+	product_id[0] == 0x00  product_id[1] == 0x90 ) {
+		result 

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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:52:25 UTC 2010

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

Log Message:
Remove the unintentional parts of the last commit.


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

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

Modified files:

Index: src/sys/arch/evbarm/conf/BEAGLEBOARD
diff -u src/sys/arch/evbarm/conf/BEAGLEBOARD:1.11 src/sys/arch/evbarm/conf/BEAGLEBOARD:1.12
--- src/sys/arch/evbarm/conf/BEAGLEBOARD:1.11	Tue Aug 31 19:07:01 2010
+++ src/sys/arch/evbarm/conf/BEAGLEBOARD	Wed Sep  8 22:52:25 2010
@@ -1,5 +1,5 @@
 #
-#	$NetBSD: BEAGLEBOARD,v 1.11 2010/08/31 19:07:01 macallan Exp $
+#	$NetBSD: BEAGLEBOARD,v 1.12 2010/09/08 22:52:25 ahoka Exp $
 #
 #	BEAGLEBOARD -- TI OMAP 3530 Eval Board Kernel
 #
@@ -27,7 +27,7 @@
 
 file-system	FFS		# UFS
 #file-system	LFS		# log-structured file system
-#file-system	MFS		# memory file system
+file-system	MFS		# memory file system
 file-system	NFS		# Network file system
 #file-system 	ADOSFS		# AmigaDOS-compatible file system
 #file-system 	EXT2FS		# second extended file system (linux)
@@ -87,8 +87,8 @@
 
 #options 	COMPAT_43	# 4.3BSD compatibility.
 options 	COMPAT_50	# NetBSD 5.0 compatibility.
-#options 	COMPAT_40	# NetBSD 4.0 compatibility.
-#options 	COMPAT_30	# NetBSD 3.0 compatibility.
+options 	COMPAT_40	# NetBSD 4.0 compatibility.
+options 	COMPAT_30	# NetBSD 3.0 compatibility.
 #options 	COMPAT_20	# NetBSD 2.0 compatibility.
 #options 	COMPAT_16	# NetBSD 1.6 compatibility.
 #options 	COMPAT_15	# NetBSD 1.5 compatibility.
@@ -248,19 +248,19 @@
 prcm*		at obio1 addr 0x48306000 size 0x2000	# PRM Module
 
 # On-board USB
-ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
+#ehci*		at obio0 addr 0x48064800 size 0x0400 intr 77
 #ohci*		at obio0 addr 0x48064400 size 0x0400 intr 76
 #usb*		at ohci?
-usb*		at ehci?
-uhub*		at usb?
-uhub*		at uhub? port ?
-umass*		at uhub? port ? configuration ? interface ?
-wd*		at umass?
-uhidev*		at uhub?
-ukbd*		at uhidev?
-ums*		at uhidev?
-wskbd*		at ukbd?
-wsmouse*	at ums?
+#usb*		at ehci?
+#uhub*		at usb?
+#uhub*		at uhub? port ?
+#umass*		at uhub? port ? configuration ? interface ?
+#wd*		at umass?
+#uhidev*		at uhub?
+#ukbd*		at uhidev?
+#ums*		at uhidev?
+#wskbd*		at ukbd?
+#wsmouse*	at ums?
 
 #axe*		at uhub? port ? configuration ? interface ?
 
@@ -273,7 +273,7 @@
 # Pseudo-Devices
 
 # disk/mass storage pseudo-devices
-#pseudo-device	md		1	# memory disk device (ramdisk)
+pseudo-device	md		1	# memory disk device (ramdisk)
 #pseudo-device	vnd			# disk-like interface to files
 #pseudo-device	fss			# file system snapshot device
 



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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:53:53 UTC 2010

Added Files:
src/sys/arch/evbarm/conf: DEVKIT8000 files.devkit8000

Log Message:
config for devkit8000 boards (currently beagle conf + dme)
config glue for devkit8000 ethernet


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/DEVKIT8000 \
src/sys/arch/evbarm/conf/files.devkit8000

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

Added files:

Index: src/sys/arch/evbarm/conf/DEVKIT8000
diff -u /dev/null src/sys/arch/evbarm/conf/DEVKIT8000:1.1
--- /dev/null	Wed Sep  8 22:53:53 2010
+++ src/sys/arch/evbarm/conf/DEVKIT8000	Wed Sep  8 22:53:53 2010
@@ -0,0 +1,15 @@
+#
+#	$NetBSD: DEVKIT8000,v 1.1 2010/09/08 22:53:53 ahoka Exp $
+#
+#	DevKit8000 -- TI OMAP 3530 Eval Board Kernel
+#
+
+# DevKit8000 is a Beagleboard clone
+#
+include	arch/evbarm/conf/BEAGLEBOARD
+
+include arch/evbarm/conf/files.devkit8000
+
+# DM9000 Ethernet (requires omapgpio0)
+dme0		at gpmc? addr 0x2c00 intr 121
+
Index: src/sys/arch/evbarm/conf/files.devkit8000
diff -u /dev/null src/sys/arch/evbarm/conf/files.devkit8000:1.1
--- /dev/null	Wed Sep  8 22:53:53 2010
+++ src/sys/arch/evbarm/conf/files.devkit8000	Wed Sep  8 22:53:53 2010
@@ -0,0 +1,9 @@
+#	$NetBSD: files.devkit8000,v 1.1 2010/09/08 22:53:53 ahoka Exp $
+#
+# DevKit8000 TI OMAP2 evaluation board configuration info
+#
+
+# on-board DM9000
+#
+attach dme at gpmc with dme_gpmc
+file	arch/evbarm/devkit8000/if_dme_gpmc.c		dme_gpmc



CVS commit: src/sys/conf

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:55:55 UTC 2010

Modified Files:
src/sys/conf: files

Log Message:
add dme (dm9000 ethernet)


To generate a diff of this commit:
cvs rdiff -u -r1.994 -r1.995 src/sys/conf/files

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

Modified files:

Index: src/sys/conf/files
diff -u src/sys/conf/files:1.994 src/sys/conf/files:1.995
--- src/sys/conf/files:1.994	Sun Aug 22 18:56:21 2010
+++ src/sys/conf/files	Wed Sep  8 22:55:54 2010
@@ -1,4 +1,4 @@
-#	$NetBSD: files,v 1.994 2010/08/22 18:56:21 rmind Exp $
+#	$NetBSD: files,v 1.995 2010/09/08 22:55:54 ahoka Exp $
 #	@(#)files.newconf	7.5 (Berkeley) 5/10/93
 
 version 	20100430
@@ -1247,6 +1247,11 @@
 device	bwi: arp, ifnet, firmload, wlan
 file	dev/ic/bwi.c			bwi
 
+# DM9000 Ethernet controllers
+#
+device	dme: arp, ether, ifnet
+file	dev/ic/dm9000.c			dme
+
 # legitimate pseudo-devices
 #
 defpseudodev vnd:	disk



CVS commit: src/sys

2010-09-08 Thread Simon J. Gerraty
Module Name:src
Committed By:   sjg
Date:   Thu Sep  9 00:10:16 UTC 2010

Added Files:
src/sys/dev/filemon: filemon.c filemon.h filemon_wrapper.c mknod-sh
src/sys/modules/filemon: Makefile

Log Message:
First cut of simple syscall wrapper, which make(1) can use
to track process activity.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/filemon/filemon.c \
src/sys/dev/filemon/filemon.h src/sys/dev/filemon/filemon_wrapper.c \
src/sys/dev/filemon/mknod-sh
cvs rdiff -u -r0 -r1.1 src/sys/modules/filemon/Makefile

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

Added files:

Index: src/sys/dev/filemon/filemon.c
diff -u /dev/null src/sys/dev/filemon/filemon.c:1.1
--- /dev/null	Thu Sep  9 00:10:16 2010
+++ src/sys/dev/filemon/filemon.c	Thu Sep  9 00:10:16 2010
@@ -0,0 +1,366 @@
+/*
+ * Copyright (c) 2010, Juniper Networks, Inc.
+ *
+ * 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 COPYRIGHT HOLDERS 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 COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: filemon.c,v 1.1 2010/09/09 00:10:16 sjg Exp $);
+
+#include sys/param.h
+#include sys/kernel.h
+#include sys/module.h
+#include sys/conf.h
+#include sys/file.h
+#include sys/filedesc.h
+#include sys/systm.h
+#include sys/buf.h
+#include sys/fcntl.h
+#include sys/rwlock.h
+#include sys/condvar.h
+#include sys/lwp.h
+#include sys/proc.h
+#include sys/kmem.h
+#include sys/syslog.h
+
+#include filemon.h
+
+MODULE(MODULE_CLASS_DRIVER, filemon, NULL);
+
+static dev_type_open(filemon_open);
+
+static struct cdevsw filemon_cdevsw = {
+	.d_open = filemon_open,
+	.d_flag = D_MPSAFE,
+	.d_close = noclose,
+	.d_read = noread,
+	.d_write = nowrite,
+	.d_ioctl = noioctl,
+	.d_stop = nostop,
+	.d_tty = notty,
+	.d_poll = nopoll,
+	.d_mmap = nommap,
+	.d_kqfilter = nokqfilter,
+};
+
+static int filemon_ioctl(struct file *, u_long, void *);
+static int filemon_close(struct file *);
+
+static const struct fileops filemon_fileops = {
+	.fo_ioctl = filemon_ioctl,
+	.fo_close = filemon_close,
+	.fo_read = fbadop_read,
+	.fo_write = fbadop_write,
+	.fo_fcntl = fnullop_fcntl,
+	.fo_poll = fnullop_poll,
+	.fo_stat = fbadop_stat,
+	.fo_kqfilter = fnullop_kqfilter,
+};
+
+static krwlock_t filemon_mtx;
+
+static TAILQ_HEAD(, filemon) filemons_inuse =
+	TAILQ_HEAD_INITIALIZER(filemons_inuse);
+
+#ifdef DEBUG
+static int logLevel = LOG_DEBUG;
+#endif
+
+void
+filemon_output(struct filemon * filemon, char *msg, size_t len)
+{
+	struct uio auio;
+	struct iovec aiov;
+
+	if (filemon-fm_fp == NULL)
+		return;
+
+	aiov.iov_base = msg;
+	aiov.iov_len = len;
+	auio.uio_iov = aiov;
+	auio.uio_iovcnt = 1;
+	auio.uio_resid = len;
+	auio.uio_rw = UIO_WRITE;
+	auio.uio_offset = (off_t) - 1;
+	uio_setup_sysspace(auio);
+
+#ifdef DEBUG
+	{
+		char *cp;
+		int x = 16;
+
+		cp = strchr(msg, '\n');
+		if (cp  cp - msg = 16)
+			x = (cp - msg) - 2;
+		log(logLevel, filemont_output:('%.*s%s', x,
+		(x  16) ? ... : , msg);
+	}
+#endif
+	(*filemon-fm_fp-f_ops-fo_write) (filemon-fm_fp,
+	(filemon-fm_fp-f_offset),
+	auio, curlwp-l_cred, FOF_UPDATE_OFFSET);
+}
+
+static void
+filemon_comment(struct filemon * filemon)
+{
+	int len;
+
+	len = snprintf(filemon-fm_msgbufr, sizeof(filemon-fm_msgbufr),
+	# filemon version 2\n# Target pid %d\nV 2\n,
+	curproc-p_pid);
+
+	filemon_output(filemon, filemon-fm_msgbufr, len);
+}
+
+
+static struct filemon *
+filemon_pid_check(struct proc * p)
+{
+	struct filemon *filemon;
+
+	TAILQ_FOREACH(filemon, filemons_inuse, fm_link) {
+		if (p-p_pid == filemon-fm_pid)
+			return (filemon);
+	}
+
+	if (p-p_pptr == NULL)
+		return (NULL);
+
+	return (filemon_pid_check(p-p_pptr));
+}
+
+/*
+ * return exclusive access to a 

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

2010-09-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  9 00:24:59 UTC 2010

Modified Files:
src/sys/arch/macppc/dev: snapper.c

Log Message:
get rid of custom PMF event handlers, instead do what the upper layer expects
so volume control via PMF still works


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

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

Modified files:

Index: src/sys/arch/macppc/dev/snapper.c
diff -u src/sys/arch/macppc/dev/snapper.c:1.33 src/sys/arch/macppc/dev/snapper.c:1.34
--- src/sys/arch/macppc/dev/snapper.c:1.33	Thu Nov  5 05:37:30 2009
+++ src/sys/arch/macppc/dev/snapper.c	Thu Sep  9 00:24:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: snapper.c,v 1.33 2009/11/05 05:37:30 dyoung Exp $	*/
+/*	$NetBSD: snapper.c,v 1.34 2010/09/09 00:24:59 macallan Exp $	*/
 /*	Id: snapper.c,v 1.11 2002/10/31 17:42:13 tsubai Exp	*/
 /*	Id: i2s.c,v 1.12 2005/01/15 14:32:35 tsubai Exp		*/
 
@@ -35,7 +35,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: snapper.c,v 1.33 2009/11/05 05:37:30 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: snapper.c,v 1.34 2010/09/09 00:24:59 macallan Exp $);
 
 #include sys/param.h
 #include sys/audioio.h
@@ -148,8 +148,6 @@
 static int snapper_cint(void *);
 static int tas3004_init(struct snapper_softc *);
 static void snapper_init(struct snapper_softc *, int);
-static void snapper_volume_up(device_t);
-static void snapper_volume_down(device_t);
 
 struct snapper_codecvar {
 	stream_filter_t	base;
@@ -617,7 +615,7 @@
 #define  DEQ_MCR1_W_16	0x00	/*  16 bit */
 #define  DEQ_MCR1_W_18	0x01	/*  18 bit */
 #define  DEQ_MCR1_W_20	0x02	/*  20 bit */
-#define  DEQ_MCR1_W_24	0x03	/*  20 bit */
+#define  DEQ_MCR1_W_24	0x03	/*  24 bit */
 
 #define DEQ_MCR2_DL	0x80	/* Download */
 #define DEQ_MCR2_AP	0x02	/* All pass mode */
@@ -788,10 +786,8 @@
 	aprint_normal(: irq %d,%d,%d\n, cirq, oirq, iirq);
 
 	/* PMF event handler */
-	pmf_event_register(self, PMFE_AUDIO_VOLUME_DOWN,
-	snapper_volume_down, TRUE);
-	pmf_event_register(self, PMFE_AUDIO_VOLUME_UP,
-	snapper_volume_up, TRUE);
+	pmf_device_register(sc-sc_dev, NULL, NULL);
+
 	config_defer(self, snapper_defer);
 }
 
@@ -1202,7 +1198,7 @@
 	switch (dip-index) {
 
 	case SNAPPER_OUTPUT_SELECT:
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNoutput);
 		dip-type = AUDIO_MIXER_SET;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
@@ -1214,11 +1210,12 @@
 		return 0;
 
 	case SNAPPER_VOL_OUTPUT:
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNmaster);
 		dip-type = AUDIO_MIXER_VALUE;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
 		dip-un.v.num_channels = 2;
+		dip-un.v.delta = 16;
 		strcpy(dip-un.v.units.name, AudioNvolume);
 		return 0;
 
@@ -1271,7 +1268,7 @@
 		if (sc-sc_mode == SNAPPER_SWVOL)
 			return ENXIO;
 
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNtreble);
 		dip-type = AUDIO_MIXER_VALUE;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
@@ -1282,7 +1279,7 @@
 		if (sc-sc_mode == SNAPPER_SWVOL)
 			return ENXIO;
 
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNbass);
 		dip-type = AUDIO_MIXER_VALUE;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
@@ -1293,7 +1290,7 @@
 		if (sc-sc_mode == SNAPPER_SWVOL)
 			return ENXIO;
 
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNdac);
 		dip-type = AUDIO_MIXER_VALUE;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
@@ -1304,7 +1301,7 @@
 		if (sc-sc_mode == SNAPPER_SWVOL)
 			return ENXIO;
 
-		dip-mixer_class = SNAPPER_MONITOR_CLASS;
+		dip-mixer_class = SNAPPER_OUTPUT_CLASS;
 		strcpy(dip-label.name, AudioNline);
 		dip-type = AUDIO_MIXER_VALUE;
 		dip-prev = dip-next = AUDIO_MIXER_LAST;
@@ -2111,21 +2108,3 @@
 	sc-mixer[5] = 0;
 	snapper_write_mixers(sc);
 }
-
-static void
-snapper_volume_up(device_t dev)
-{
-	struct snapper_softc *sc = device_private(dev);
-
-	snapper_set_volume(sc, min(0xff, sc-sc_vol_l + 8),
-	 min(0xff, sc-sc_vol_r + 8));
-}
-
-static void
-snapper_volume_down(device_t dev)
-{
-	struct snapper_softc *sc = device_private(dev);
-
-	snapper_set_volume(sc, max(0, sc-sc_vol_l - 8),
-	 max(0, sc-sc_vol_r - 8));
-}



CVS commit: src/sys/dev/pci

2010-09-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  9 01:22:11 UTC 2010

Modified Files:
src/sys/dev/pci: r128fb.c r128fbreg.h

Log Message:
add backlight control via PMF
TODO: support wsconsctl


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/r128fb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/r128fbreg.h

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

Modified files:

Index: src/sys/dev/pci/r128fb.c
diff -u src/sys/dev/pci/r128fb.c:1.10 src/sys/dev/pci/r128fb.c:1.11
--- src/sys/dev/pci/r128fb.c:1.10	Thu Oct  1 19:02:27 2009
+++ src/sys/dev/pci/r128fb.c	Thu Sep  9 01:22:11 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fb.c,v 1.10 2009/10/01 19:02:27 jmmv Exp $	*/
+/*	$NetBSD: r128fb.c,v 1.11 2010/09/09 01:22:11 macallan Exp $	*/
 
 /*
  * Copyright (c) 2007 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.10 2009/10/01 19:02:27 jmmv Exp $);
+__KERNEL_RCSID(0, $NetBSD: r128fb.c,v 1.11 2010/09/09 01:22:11 macallan Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -59,6 +59,14 @@
 
 #include dev/i2c/i2cvar.h
 
+#include opt_r128fb.h
+
+#ifdef R128FB_DEBUG
+#define DPRINTF printf
+#else
+#define DPRINTF while(0) printf
+#endif
+
 struct r128fb_softc {
 	device_t sc_dev;
 
@@ -74,7 +82,7 @@
 	bus_size_t sc_fbsize, sc_regsize;
 
 	int sc_width, sc_height, sc_depth, sc_stride;
-	int sc_locked;
+	int sc_locked, sc_have_backlight, sc_bl_level;
 	void *sc_fbaddr;
 	struct vcons_screen sc_console_screen;
 	struct wsscreen_descr sc_defaultscreen_descr;
@@ -124,6 +132,10 @@
 static void	r128fb_copyrows(void *, int, int, int);
 static void	r128fb_eraserows(void *, int, int, long);
 
+static void	r128fb_brightness_up(device_t);
+static void	r128fb_brightness_down(device_t);
+static void	r128fb_set_backlight(struct r128fb_softc *, int);
+
 struct wsdisplay_accessops r128fb_accessops = {
 	r128fb_ioctl,
 	r128fb_mmap,
@@ -191,6 +203,7 @@
 	unsigned long		defattr;
 	bool			is_console;
 	int i, j;
+	uint32_t reg;
 
 	sc-sc_pc = pa-pa_pc;
 	sc-sc_pcitag = pa-pa_tag;
@@ -305,7 +318,21 @@
 	aa.accesscookie = sc-vd;
 
 	config_found(sc-sc_dev, aa, wsemuldisplaydevprint);
-	
+
+	/* no suspend/resume support yet */
+	pmf_device_register(sc-sc_dev, NULL, NULL);
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, R128_LVDS_GEN_CNTL);
+	DPRINTF(reg: %08x\n, reg);
+	if (reg  R128_LVDS_ON) {
+		sc-sc_have_backlight = 1;
+		sc-sc_bl_level = 255 -
+		((reg  R128_LEVEL_MASK)  R128_LEVEL_SHIFT);
+		pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_UP,
+		r128fb_brightness_up, TRUE);
+		pmf_event_register(sc-sc_dev, PMFE_DISPLAY_BRIGHTNESS_DOWN,
+		r128fb_brightness_down, TRUE);
+	} else
+		sc-sc_have_backlight = 0;	
 }
 
 static int
@@ -787,3 +814,37 @@
 	}
 }
 
+static void
+r128fb_set_backlight(struct r128fb_softc *sc, int level)
+{
+	uint32_t reg;
+
+	if (level  255) level = 255;
+	if (level  0) level = 0;
+	if (level == sc-sc_bl_level)
+		return;
+	sc-sc_bl_level = level;
+	level = 255 - level;
+	reg = bus_space_read_4(sc-sc_memt, sc-sc_regh, R128_LVDS_GEN_CNTL);
+	reg = ~R128_LEVEL_MASK;
+	reg |= level  R128_LEVEL_SHIFT;
+	bus_space_write_4(sc-sc_memt, sc-sc_regh, R128_LVDS_GEN_CNTL, reg);
+	DPRINTF(level: %d reg %08x\n, level, reg);
+}
+	
+
+static void
+r128fb_brightness_up(device_t dev)
+{
+	struct r128fb_softc *sc = device_private(dev);
+
+	r128fb_set_backlight(sc, sc-sc_bl_level + 8);
+}
+
+static void
+r128fb_brightness_down(device_t dev)
+{
+	struct r128fb_softc *sc = device_private(dev);
+
+	r128fb_set_backlight(sc, sc-sc_bl_level - 8);
+}

Index: src/sys/dev/pci/r128fbreg.h
diff -u src/sys/dev/pci/r128fbreg.h:1.1 src/sys/dev/pci/r128fbreg.h:1.2
--- src/sys/dev/pci/r128fbreg.h:1.1	Wed Nov  7 19:09:09 2007
+++ src/sys/dev/pci/r128fbreg.h	Thu Sep  9 01:22:10 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: r128fbreg.h,v 1.1 2007/11/07 19:09:09 macallan Exp $	*/
+/*	$NetBSD: r128fbreg.h,v 1.2 2010/09/09 01:22:10 macallan Exp $	*/
 
 /*
  * Copyright 1999, 2000 ATI Technologies Inc., Markham, Ontario,
@@ -55,9 +55,35 @@
 #ifndef R128FB_REG_H
 #define R128FB_REG_H
 
-#define R128_PALETTE_DATA 0x00b4
-#define R128_PALETTE_INDEX0x00b0
+/* RAMDAC */
+#define R128_PALETTE_DATA		0x00b4
+#define R128_PALETTE_INDEX		0x00b0
+
+/* flat panel registers */
+#define R128_FP_PANEL_CNTL		0x0288
+	#define FPCNT_DIGON		  0x0001	/* FP dig. voltage */
+	#define FPCNT_BACKLIGHT_ON	  0x0002
+	#define FPCNT_BL_MODULATION_ON	  0x0004
+	#define FPCNT_BL_CLK_SEL	  0x0008	/* 1 - divide by 3 */
+	#define FPCNT_MONID_EN		  0x0010	/* use MONID pins for
+			   backlight control */
+	#define FPCNT_FPENABLE_POL	  0x0020	/* 1 - active low */
+	#define FPCNT_LEVEL_MASK	  0xff00
+	#define FPCNT_LEVEL_SHIFT	  8
+
+#define R128_LVDS_GEN_CNTL0x02d0
+#   define R128_LVDS_ON   (1 0)
+#   define 

CVS commit: src/sys/net

2010-09-08 Thread Thor Lancelot Simon
Module Name:src
Committed By:   tls
Date:   Thu Sep  9 03:24:57 UTC 2010

Modified Files:
src/sys/net: if_srt.c

Log Message:
From Coyote Point source tree: fix srt IPv4 lookup on little-endian
hosts.  IPv6 is probably still broken, and, actually, the lookup table
for mask values should be kept in network byte order, not host byte order
and the corresponding change to the srtconfig ioctl interface made.

But at least this works.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/if_srt.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/net/if_srt.c
diff -u src/sys/net/if_srt.c:1.14 src/sys/net/if_srt.c:1.15
--- src/sys/net/if_srt.c:1.14	Mon Apr  5 07:22:24 2010
+++ src/sys/net/if_srt.c	Thu Sep  9 03:24:57 2010
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.14 2010/04/05 07:22:24 joerg Exp $ */
+/* $NetBSD: if_srt.c,v 1.15 2010/09/09 03:24:57 tls Exp $ */
 /* This file is in the public domain. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_srt.c,v 1.14 2010/04/05 07:22:24 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_srt.c,v 1.15 2010/09/09 03:24:57 tls Exp $);
 
 #include opt_inet.h
 
@@ -110,13 +110,13 @@
 		break;
 	}
 	va_end(ap);
-	for (i=0;isc-nrt;i++) {
+	for (i=0; i  sc-nrt; i++) {
 		r = sc-rts[i];
 		if (r-af != af)
 			continue;
 		switch (af) {
 		case AF_INET:
-			if ((ia.s_addr  ipv4_masks[r-srcmask]) ==
+			if ((ia.s_addr  htonl(ipv4_masks[r-srcmask])) ==
 			r-srcmatch.v4.s_addr)
 return r;
 			break;



CVS commit: src/libexec/httpd

2010-09-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep  9 04:41:49 UTC 2010

Modified Files:
src/libexec/httpd: bozohttpd.h

Log Message:
fix another compile error if NO_DAEMON_MODE is defined.  also from rudolf.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/libexec/httpd/bozohttpd.h

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

Modified files:

Index: src/libexec/httpd/bozohttpd.h
diff -u src/libexec/httpd/bozohttpd.h:1.15 src/libexec/httpd/bozohttpd.h:1.16
--- src/libexec/httpd/bozohttpd.h:1.15	Wed Sep  8 00:47:44 2010
+++ src/libexec/httpd/bozohttpd.h	Thu Sep  9 04:41:49 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: bozohttpd.h,v 1.15 2010/09/08 00:47:44 mrg Exp $	*/
+/*	$NetBSD: bozohttpd.h,v 1.16 2010/09/09 04:41:49 mrg Exp $	*/
 
 /*	$eterna: bozohttpd.h,v 1.35 2010/06/17 00:49:30 mrg Exp $	*/
 
@@ -238,7 +238,7 @@
 #ifdef NO_DAEMON_MODE
 #define bozo_daemon_init(x)/* nothing */
 #define bozo_daemon_fork(x)0
-#define bozo_daemon_closefds()/* nothing */
+#define bozo_daemon_closefds(x)/* nothing */
 #else
 void	bozo_daemon_init(bozohttpd_t *);
 int	bozo_daemon_fork(bozohttpd_t *);



CVS commit: src/usr.bin/passwd

2010-09-08 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Wed Sep  8 13:44:44 UTC 2010

Modified Files:
src/usr.bin/passwd: yp_passwd.c

Log Message:
PR/43852: Wolfgang Stukenbrock: yp_passwd command may destroy NIS database
entries when used on a server that includes users via netgroups.


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/usr.bin/passwd/yp_passwd.c

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



CVS commit: src/distrib/notes/common

2010-09-08 Thread Zoltan Arnold NAGY
Module Name:src
Committed By:   zoltan
Date:   Wed Sep  8 19:21:14 UTC 2010

Modified Files:
src/distrib/notes/common: main

Log Message:
Add myself to the list of developers.


To generate a diff of this commit:
cvs rdiff -u -r1.465 -r1.466 src/distrib/notes/common/main

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



CVS commit: src/tests/rump/kernspace

2010-09-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Sep  8 20:40:25 UTC 2010

Modified Files:
src/tests/rump/kernspace: busypage.c

Log Message:
vm object must be locked during page allocation.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/tests/rump/kernspace/busypage.c

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



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

2010-09-08 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Wed Sep  8 21:14:33 UTC 2010

Modified Files:
src/sys/rump/librump/rumpkern: vm.c

Log Message:
Actually, we want to say no aobjs instead of only vnodes to
make component boundaries go right.


To generate a diff of this commit:
cvs rdiff -u -r1.92 -r1.93 src/sys/rump/librump/rumpkern/vm.c

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



CVS commit: src/sys/dev/ic

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:01:29 UTC 2010

Added Files:
src/sys/dev/ic: dm9000.c dm9000reg.h dm9000var.h

Log Message:
Driver for Davicom DM9000 ethernet chips.

Written by Paul Fleischer, minor modifications by me.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/dev/ic/dm9000.c src/sys/dev/ic/dm9000reg.h \
src/sys/dev/ic/dm9000var.h

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



CVS commit: src/crypto/external/bsd/netpgp/dist/src/libmj

2010-09-08 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Wed Sep  8 22:17:27 UTC 2010

Modified Files:
src/crypto/external/bsd/netpgp/dist/src/libmj: libmj.3

Log Message:
Add RCS Id, use more markup, use standard section headers,
fill in more fields in ECMA-262 reference.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 \
src/crypto/external/bsd/netpgp/dist/src/libmj/libmj.3

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



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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:49:50 UTC 2010

Added Files:
src/sys/arch/evbarm/devkit8000: if_dme_gpmc.c

Log Message:
dme ethernet driver for devkit8000 gpmc


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/devkit8000/if_dme_gpmc.c

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



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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:52:25 UTC 2010

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

Log Message:
Remove the unintentional parts of the last commit.


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

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



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

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:53:53 UTC 2010

Added Files:
src/sys/arch/evbarm/conf: DEVKIT8000 files.devkit8000

Log Message:
config for devkit8000 boards (currently beagle conf + dme)
config glue for devkit8000 ethernet


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 src/sys/arch/evbarm/conf/DEVKIT8000 \
src/sys/arch/evbarm/conf/files.devkit8000

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



CVS commit: src/sys/conf

2010-09-08 Thread Adam Hoka
Module Name:src
Committed By:   ahoka
Date:   Wed Sep  8 22:55:55 UTC 2010

Modified Files:
src/sys/conf: files

Log Message:
add dme (dm9000 ethernet)


To generate a diff of this commit:
cvs rdiff -u -r1.994 -r1.995 src/sys/conf/files

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



CVS commit: src/sys/dev/pci

2010-09-08 Thread Michael Lorenz
Module Name:src
Committed By:   macallan
Date:   Thu Sep  9 01:22:11 UTC 2010

Modified Files:
src/sys/dev/pci: r128fb.c r128fbreg.h

Log Message:
add backlight control via PMF
TODO: support wsconsctl


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/pci/r128fb.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/pci/r128fbreg.h

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



CVS commit: src/sys/net

2010-09-08 Thread Thor Lancelot Simon
Module Name:src
Committed By:   tls
Date:   Thu Sep  9 03:24:57 UTC 2010

Modified Files:
src/sys/net: if_srt.c

Log Message:
From Coyote Point source tree: fix srt IPv4 lookup on little-endian
hosts.  IPv6 is probably still broken, and, actually, the lookup table
for mask values should be kept in network byte order, not host byte order
and the corresponding change to the srtconfig ioctl interface made.

But at least this works.


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/sys/net/if_srt.c

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



CVS commit: src/libexec/httpd

2010-09-08 Thread matthew green
Module Name:src
Committed By:   mrg
Date:   Thu Sep  9 04:41:49 UTC 2010

Modified Files:
src/libexec/httpd: bozohttpd.h

Log Message:
fix another compile error if NO_DAEMON_MODE is defined.  also from rudolf.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/libexec/httpd/bozohttpd.h

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