CVS commit: src/sys/arch/i386/stand/bootxx

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  3 20:59:47 UTC 2016

Modified Files:
src/sys/arch/i386/stand/bootxx: pbr.S

Log Message:
change 60 to 70 which is the current release. Noticed by Rares Aioanei.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/sys/arch/i386/stand/bootxx/pbr.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/i386/stand/bootxx/pbr.S
diff -u src/sys/arch/i386/stand/bootxx/pbr.S:1.20 src/sys/arch/i386/stand/bootxx/pbr.S:1.21
--- src/sys/arch/i386/stand/bootxx/pbr.S:1.20	Tue Aug 16 20:07:38 2011
+++ src/sys/arch/i386/stand/bootxx/pbr.S	Sun Jan  3 15:59:47 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pbr.S,v 1.20 2011/08/17 00:07:38 jakllsch Exp $	*/
+/*	$NetBSD: pbr.S,v 1.21 2016/01/03 20:59:47 christos Exp $	*/
 
 /*-
  * Copyright (c) 2003,2004 The NetBSD Foundation, Inc.
@@ -115,7 +115,7 @@ ENTRY(start)
 	 */
 	jmp	start0
 	nop
-	.ascii	"NetBSD60"		/* oemname (8 bytes) */
+	.ascii	"NetBSD70"		/* oemname (8 bytes) */
 
 	. = start + MBR_BPB_OFFSET	/* move to start of BPB */
 	/* (ensures oemname doesn't overflow) */



CVS commit: src/share/man/man4

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 21:58:17 UTC 2016

Modified Files:
src/share/man/man4: admtemp.4

Log Message:
Correct email address (pointed out by wiz@).


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/share/man/man4/admtemp.4

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

Modified files:

Index: src/share/man/man4/admtemp.4
diff -u src/share/man/man4/admtemp.4:1.5 src/share/man/man4/admtemp.4:1.6
--- src/share/man/man4/admtemp.4:1.5	Sun Jan  3 17:27:39 2016
+++ src/share/man/man4/admtemp.4	Sun Jan  3 21:58:17 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: admtemp.4,v 1.5 2016/01/03 17:27:39 jdc Exp $
+.\"	$NetBSD: admtemp.4,v 1.6 2016/01/03 21:58:17 jdc Exp $
 .\"
 .\"	$OpenBSD: admtemp.4,v 1.8 2007/05/31 19:19:48 jmc Exp $
 .\"
@@ -78,7 +78,7 @@ The
 driver was written by
 .An Theo de Raadt Aq Mt dera...@openbsd.org .
 Extended precision temperatures, and limit display and setting were added by
-.An Julian Coleman Aq Mt jcole...@netbsd.org .
+.An Julian Coleman Aq Mt j...@netbsd.org .
 .Sh BUGS
 Limit sensors occasionally read as 0xff.
 If this occurs, the



CVS commit: src/bin/sh

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Mon Jan  4 03:00:24 UTC 2016

Modified Files:
src/bin/sh: cd.c eval.c input.c redir.c redir.h

Log Message:
Don't leak redirected rescriptors to exec'ed processes. This is what ksh
does, but bash does not. For example:

$ cat test1
#!/bin/sh
exec 6> out
echo "test" >&6
sh ./test2
exec 6>&-
$ cat test2
echo "test2" >&6
$ ./test1
./test2: 6: Bad file descriptor

This fixes by side effect the problem of the rc system leaking file descriptors
7 and 8 to all starting daemons:

$ fstat -p 1359
USER CMD  PID   FD MOUNT   INUM MODE SZ|DV R/W
root powerd  1359   wd /  2 drwxr-xr-x 512 r
root powerd  13590 /  63029 crw-rw-rw-null rw
root powerd  13591 /  63029 crw-rw-rw-null rw
root powerd  13592 /  63029 crw-rw-rw-null rw
root powerd  13593* kqueue pending 0
root powerd  13594 /  64463 crw-r-   power r
root powerd  13597 flags 0x80034
root powerd  13598 flags 0x80034
root powerd  13599* pipe 0xfe815d7bfdc0 -> 0x0 w

Note fd=7,8 pointing to the revoked pty from the parent rc process.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/bin/sh/cd.c
cvs rdiff -u -r1.110 -r1.111 src/bin/sh/eval.c
cvs rdiff -u -r1.46 -r1.47 src/bin/sh/input.c
cvs rdiff -u -r1.37 -r1.38 src/bin/sh/redir.c
cvs rdiff -u -r1.16 -r1.17 src/bin/sh/redir.h

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

Modified files:

Index: src/bin/sh/cd.c
diff -u src/bin/sh/cd.c:1.44 src/bin/sh/cd.c:1.45
--- src/bin/sh/cd.c:1.44	Wed Aug 31 12:24:54 2011
+++ src/bin/sh/cd.c	Sun Jan  3 22:00:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cd.c,v 1.44 2011/08/31 16:24:54 plunky Exp $	*/
+/*	$NetBSD: cd.c,v 1.45 2016/01/04 03:00:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)cd.c	8.2 (Berkeley) 5/4/95";
 #else
-__RCSID("$NetBSD: cd.c,v 1.44 2011/08/31 16:24:54 plunky Exp $");
+__RCSID("$NetBSD: cd.c,v 1.45 2016/01/04 03:00:24 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -429,7 +429,7 @@ find_curdir(int noerror)
 			(void) close(pip[0]);
 			if (pip[1] != 1) {
 close(1);
-copyfd(pip[1], 1, 1);
+copyfd(pip[1], 1, 1, 0);
 close(pip[1]);
 			}
 			(void) execl("/bin/pwd", "pwd", (char *)0);

Index: src/bin/sh/eval.c
diff -u src/bin/sh/eval.c:1.110 src/bin/sh/eval.c:1.111
--- src/bin/sh/eval.c:1.110	Fri Jan  2 14:56:20 2015
+++ src/bin/sh/eval.c	Sun Jan  3 22:00:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: eval.c,v 1.110 2015/01/02 19:56:20 christos Exp $	*/
+/*	$NetBSD: eval.c,v 1.111 2016/01/04 03:00:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)eval.c	8.9 (Berkeley) 6/8/95";
 #else
-__RCSID("$NetBSD: eval.c,v 1.110 2015/01/02 19:56:20 christos Exp $");
+__RCSID("$NetBSD: eval.c,v 1.111 2016/01/04 03:00:24 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -539,14 +539,14 @@ evalpipe(union node *n)
 			INTON;
 			if (prevfd > 0) {
 close(0);
-copyfd(prevfd, 0, 1);
+copyfd(prevfd, 0, 1, 0);
 close(prevfd);
 			}
 			if (pip[1] >= 0) {
 close(pip[0]);
 if (pip[1] != 1) {
 	close(1);
-	copyfd(pip[1], 1, 1);
+	copyfd(pip[1], 1, 1, 0);
 	close(pip[1]);
 }
 			}
@@ -610,7 +610,7 @@ evalbackcmd(union node *n, struct backcm
 			close(pip[0]);
 			if (pip[1] != 1) {
 close(1);
-copyfd(pip[1], 1, 1);
+copyfd(pip[1], 1, 1, 0);
 close(pip[1]);
 			}
 			eflag = 0;
@@ -926,7 +926,7 @@ normal_fork:
 			close(pip[0]);
 			if (pip[1] != 1) {
 close(1);
-copyfd(pip[1], 1, 1);
+copyfd(pip[1], 1, 1, 0);
 close(pip[1]);
 			}
 		}

Index: src/bin/sh/input.c
diff -u src/bin/sh/input.c:1.46 src/bin/sh/input.c:1.47
--- src/bin/sh/input.c:1.46	Wed Oct 30 04:38:40 2013
+++ src/bin/sh/input.c	Sun Jan  3 22:00:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: input.c,v 1.46 2013/10/30 08:38:40 mrg Exp $	*/
+/*	$NetBSD: input.c,v 1.47 2016/01/04 03:00:24 christos Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -37,7 +37,7 @@
 #if 0
 static char sccsid[] = "@(#)input.c	8.3 (Berkeley) 6/9/95";
 #else
-__RCSID("$NetBSD: input.c,v 1.46 2013/10/30 08:38:40 mrg Exp $");
+__RCSID("$NetBSD: input.c,v 1.47 2016/01/04 03:00:24 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -412,7 +412,7 @@ setinputfile(const char *fname, int push
 	}
 
 	if (fd < 10) {
-		fd2 = copyfd(fd, 10, 0);
+		fd2 = copyfd(fd, 10, 0, 0);
 		close(fd);
 		if (fd2 < 0)
 			error("Out of file descriptors");

Index: src/bin/sh/redir.c
diff -u src/bin/sh/redir.c:1.37 src/bin/sh/redir.c:1.38
--- src/bin/sh/redir.c:1.37	Thu Oct 23 17:03:25 2014
+++ 

CVS commit: src/usr.bin/kdump

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  3 22:05:18 UTC 2016

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

Log Message:
be a bit smarter about fcntl


To generate a diff of this commit:
cvs rdiff -u -r1.120 -r1.121 src/usr.bin/kdump/kdump.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/kdump/kdump.c
diff -u src/usr.bin/kdump/kdump.c:1.120 src/usr.bin/kdump/kdump.c:1.121
--- src/usr.bin/kdump/kdump.c:1.120	Tue Jun 16 20:01:59 2015
+++ src/usr.bin/kdump/kdump.c	Sun Jan  3 17:05:18 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: kdump.c,v 1.120 2015/06/17 00:01:59 christos Exp $	*/
+/*	$NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $	*/
 
 /*-
  * Copyright (c) 1988, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)kdump.c	8.4 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: kdump.c,v 1.120 2015/06/17 00:01:59 christos Exp $");
+__RCSID("$NetBSD: kdump.c,v 1.121 2016/01/03 22:05:18 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -460,6 +460,31 @@ output_long(u_long it, int as_x)
 		printf(as_x ? "%#lx" : "%ld", it);
 }
 
+static const char *
+fcntlname(u_long cmd)
+{
+#define	FCNTLCASE(a)	case a:	return # a
+	switch (cmd) {
+	FCNTLCASE(F_DUPFD);
+	FCNTLCASE(F_GETFD);
+	FCNTLCASE(F_SETFD);
+	FCNTLCASE(F_GETFL);
+	FCNTLCASE(F_SETFL);
+	FCNTLCASE(F_GETOWN);
+	FCNTLCASE(F_SETOWN);
+	FCNTLCASE(F_GETLK);
+	FCNTLCASE(F_SETLK);
+	FCNTLCASE(F_SETLKW);
+	FCNTLCASE(F_CLOSEM);
+	FCNTLCASE(F_MAXFD);
+	FCNTLCASE(F_DUPFD_CLOEXEC);
+	FCNTLCASE(F_GETNOSIGPIPE);
+	FCNTLCASE(F_SETNOSIGPIPE);
+	default:
+		return NULL;
+	}
+}
+
 static void
 ioctldecode(u_long cmd)
 {
@@ -544,6 +569,19 @@ ktrsyscall(struct ktr_syscall *ktr)
 			argcount--;
 			c = ',';
 
+		} else if (strcmp(sys_name, "fcntl") == 0 && argcount >= 2) {
+			(void)putchar('(');
+			output_long((long)*ap, !(decimal || small(*ap)));
+			ap++;
+			argcount--;
+			if ((cp = fcntlname(*ap)) != NULL)
+(void)printf(",%s", cp);
+			else {
+(void)printf(",%#lx", *ap);
+			}
+			ap++;
+			argcount--;
+			c = ',';
 		} else if ((strstr(sys_name, "sigaction") != NULL ||
 		strstr(sys_name, "sigvec") != NULL) && argcount >= 1) {
 			(void)printf("(SIG%s", signame(ap[0], 1));



CVS commit: src/sys/net

2016-01-03 Thread Kengo NAKAHARA
Module Name:src
Committed By:   knakahara
Date:   Mon Jan  4 07:50:08 UTC 2016

Modified Files:
src/sys/net: if_gif.c if_gif.h

Log Message:
Revert extra wating codes.

PR kern/50522 is actually fixed by sys/kern/kern_softint.c:r1.42, so waiting
codes in if_gif.c is not required.


To generate a diff of this commit:
cvs rdiff -u -r1.102 -r1.103 src/sys/net/if_gif.c
cvs rdiff -u -r1.20 -r1.21 src/sys/net/if_gif.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/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.102 src/sys/net/if_gif.c:1.103
--- src/sys/net/if_gif.c:1.102	Fri Dec 11 07:59:14 2015
+++ src/sys/net/if_gif.c	Mon Jan  4 07:50:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.102 2015/12/11 07:59:14 knakahara Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.103 2016/01/04 07:50:08 knakahara Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.102 2015/12/11 07:59:14 knakahara Exp $");
+__KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1.103 2016/01/04 07:50:08 knakahara Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -53,7 +53,6 @@ __KERNEL_RCSID(0, "$NetBSD: if_gif.c,v 1
 #include 
 #include 
 #include 
-#include 
 
 #include 
 #include 
@@ -147,10 +146,6 @@ void
 gifattach0(struct gif_softc *sc)
 {
 
-	sc->gif_si_lock = mutex_obj_alloc(MUTEX_DEFAULT, IPL_NONE);
-	KASSERT(sc->gif_si_lock != NULL);
-	cv_init(>gif_si_cv, "if_gif_cv");
-	sc->gif_si_refs = 0;
 	sc->encap_cookie4 = sc->encap_cookie6 = NULL;
 
 	sc->gif_if.if_addrlen = 0;
@@ -179,8 +174,6 @@ gif_clone_destroy(struct ifnet *ifp)
 	if_detach(ifp);
 	rtcache_free(>gif_ro);
 
-	cv_destroy(>gif_si_cv);
-	mutex_obj_free(sc->gif_si_lock);
 	kmem_free(sc, sizeof(struct gif_softc));
 
 	return (0);
@@ -356,21 +349,12 @@ gifintr(void *arg)
 	sc = arg;
 	ifp = >gif_if;
 
-	atomic_inc_uint(>gif_si_refs);
-
 	/*
-	 * pattern (a) (see also gif_set_tunnel())
 	 * other CPUs does {set,delete}_tunnel after curcpu have done
 	 * softint_schedule().
 	 */
 	if (sc->gif_pdst == NULL || sc->gif_psrc == NULL) {
 		IFQ_PURGE(>if_snd);
-
-		if (atomic_dec_uint_nv(>gif_si_refs) == 0) {
-			mutex_enter(sc->gif_si_lock);
-			cv_broadcast(>gif_si_cv);
-			mutex_exit(sc->gif_si_lock);
-		}
 		return;
 	}
 
@@ -425,16 +409,6 @@ gifintr(void *arg)
 			ifp->if_obytes += len;
 		}
 	}
-
-	/*
-	 * pattern (b) (see also gif_set_tunnel())
-	 * other CPUs begin {set,delete}_tunnel while curcpu si doing gifintr.
-	 */
-	if (atomic_dec_uint_nv(>gif_si_refs) == 0) {
-		mutex_enter(sc->gif_si_lock);
-		cv_broadcast(>gif_si_cv);
-		mutex_exit(sc->gif_si_lock);
-	}
 }
 
 void
@@ -822,27 +796,20 @@ gif_set_tunnel(struct ifnet *ifp, struct
 		sc->gif_psrc = NULL;
 		sc->gif_pdst = NULL;
 		sc->gif_si = NULL;
-
 		/*
 		 * At this point, gif_output() does not softint_schedule()
-		 * any more. However, there are below 2 fears of other CPUs.
-		 * (a) gif_output() has done softint_schedule(),and softint
+		 * any more. However, there are below 2 fears of other CPUs
+		 * which would cause panic because of the race between
+		 * softint_execute() and softint_disestablish().
+		 * (a) gif_output() has done softint_schedule(), and softint
 		 * (gifintr()) is waiting for execution
+		 * => This pattern is avoided by waiting SOFTINT_PENDING
+		 *CPUs in softint_disestablish()
 		 * (b) gifintr() is already running
-		 * see also gifintr()
+		 * => This pattern is avoided by waiting SOFTINT_ACTIVE
+		 *CPUs in softint_disestablish()
 		 */
 
-		/*
-		 * To avoid the above fears, wait for gifintr() completion of
-		 * all CPUs here.
-		 */
-		mutex_enter(sc->gif_si_lock);
-		while (sc->gif_si_refs > 0) {
-			aprint_debug("%s: cv_wait on gif_softc\n", __func__);
-			cv_wait(>gif_si_cv, sc->gif_si_lock);
-		}
-		mutex_exit(sc->gif_si_lock);
-
 		softint_disestablish(osi);
 		sc->gif_psrc = osrc;
 		sc->gif_pdst = odst;
@@ -929,13 +896,6 @@ gif_delete_tunnel(struct ifnet *ifp)
 		sc->gif_pdst = NULL;
 		sc->gif_si = NULL;
 
-		mutex_enter(sc->gif_si_lock);
-		while (sc->gif_si_refs > 0) {
-			aprint_debug("%s: cv_wait on gif_softc\n", __func__);
-			cv_wait(>gif_si_cv, sc->gif_si_lock);
-		}
-		mutex_exit(sc->gif_si_lock);
-
 		softint_disestablish(osi);
 		sc->gif_psrc = osrc;
 		sc->gif_pdst = odst;

Index: src/sys/net/if_gif.h
diff -u src/sys/net/if_gif.h:1.20 src/sys/net/if_gif.h:1.21
--- src/sys/net/if_gif.h:1.20	Fri Dec 11 07:59:14 2015
+++ src/sys/net/if_gif.h	Mon Jan  4 07:50:08 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.h,v 1.20 2015/12/11 07:59:14 knakahara Exp $	*/
+/*	$NetBSD: if_gif.h,v 1.21 2016/01/04 07:50:08 knakahara Exp $	*/
 /*	$KAME: if_gif.h,v 1.23 2001/07/27 09:21:42 itojun Exp $	*/
 
 /*
@@ -38,8 +38,6 @@
 #define _NET_IF_GIF_H_
 
 #include 
-#include 
-#include 
 
 #ifdef _KERNEL_OPT
 #include "opt_inet.h"
@@ -62,21 

CVS commit: [nick-nhusb] src/sys/dev/usb

2016-01-03 Thread Nick Hudson
Module Name:src
Committed By:   skrll
Date:   Sun Jan  3 08:30:37 UTC 2016

Modified Files:
src/sys/dev/usb [nick-nhusb]: ehci.c

Log Message:
In ehci_idone check for timed out or aborted transfer earlier and before
twiddling ex_isdone to avoid KASSERT firing.


To generate a diff of this commit:
cvs rdiff -u -r1.234.2.74 -r1.234.2.75 src/sys/dev/usb/ehci.c

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

Modified files:

Index: src/sys/dev/usb/ehci.c
diff -u src/sys/dev/usb/ehci.c:1.234.2.74 src/sys/dev/usb/ehci.c:1.234.2.75
--- src/sys/dev/usb/ehci.c:1.234.2.74	Mon Dec 28 22:25:43 2015
+++ src/sys/dev/usb/ehci.c	Sun Jan  3 08:30:37 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: ehci.c,v 1.234.2.74 2015/12/28 22:25:43 skrll Exp $ */
+/*	$NetBSD: ehci.c,v 1.234.2.75 2016/01/03 08:30:37 skrll Exp $ */
 
 /*
  * Copyright (c) 2004-2012 The NetBSD Foundation, Inc.
@@ -53,7 +53,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.74 2015/12/28 22:25:43 skrll Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ehci.c,v 1.234.2.75 2016/01/03 08:30:37 skrll Exp $");
 
 #include "ohci.h"
 #include "uhci.h"
@@ -1027,6 +1027,12 @@ ehci_idone(struct ehci_xfer *ex)
 
 	USBHIST_LOG(ehcidebug, "ex=%p", ex, 0, 0, 0);
 
+	if (xfer->ux_status == USBD_CANCELLED ||
+	xfer->ux_status == USBD_TIMEOUT) {
+		USBHIST_LOG(ehcidebug, "aborted xfer=%p", xfer, 0, 0, 0);
+		return;
+	}
+
 #ifdef DIAGNOSTIC
 #ifdef EHCI_DEBUG
 	if (ex->ex_isdone) {
@@ -1039,12 +1045,6 @@ ehci_idone(struct ehci_xfer *ex)
 	ex->ex_isdone = true;
 #endif
 
-	if (xfer->ux_status == USBD_CANCELLED ||
-	xfer->ux_status == USBD_TIMEOUT) {
-		USBHIST_LOG(ehcidebug, "aborted xfer=%p", xfer, 0, 0, 0);
-		return;
-	}
-
 	USBHIST_LOG(ehcidebug, "xfer=%p, pipe=%p ready", xfer, epipe, 0, 0);
 
 	/* The transfer is done, compute actual length and status. */



CVS commit: src/sys/dev/raidframe

2016-01-03 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sun Jan  3 08:17:24 UTC 2016

Modified Files:
src/sys/dev/raidframe: rf_engine.c rf_kintf.h rf_netbsdkintf.c
rf_states.c

Log Message:
refactor driver to use common code in dksubr.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/raidframe/rf_engine.c
cvs rdiff -u -r1.23 -r1.24 src/sys/dev/raidframe/rf_kintf.h
cvs rdiff -u -r1.334 -r1.335 src/sys/dev/raidframe/rf_netbsdkintf.c
cvs rdiff -u -r1.49 -r1.50 src/sys/dev/raidframe/rf_states.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/raidframe/rf_engine.c
diff -u src/sys/dev/raidframe/rf_engine.c:1.50 src/sys/dev/raidframe/rf_engine.c:1.51
--- src/sys/dev/raidframe/rf_engine.c:1.50	Sat Oct 18 08:33:28 2014
+++ src/sys/dev/raidframe/rf_engine.c	Sun Jan  3 08:17:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_engine.c,v 1.50 2014/10/18 08:33:28 snj Exp $	*/
+/*	$NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $	*/
 /*
  * Copyright (c) 1995 Carnegie-Mellon University.
  * All rights reserved.
@@ -55,7 +55,7 @@
  /
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.50 2014/10/18 08:33:28 snj Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_engine.c,v 1.51 2016/01/03 08:17:24 mlelstv Exp $");
 
 #include 
 
@@ -843,7 +843,7 @@ DAGExecutionThread(RF_ThreadArg_t arg)
 
 /*
  * rf_RaidIOThread() -- When I/O to a component begins, raidstrategy()
- * puts the I/O on a buf_queue, and then signals raidPtr->iodone.  If
+ * puts the I/O on a buffer queue, and then signals raidPtr->iodone.  If
  * necessary, this function calls raidstart() to initiate the I/O.
  * When I/O to a component completes, KernelWakeupFunc() puts the
  * completed request onto raidPtr->iodone TAILQ.  This function looks

Index: src/sys/dev/raidframe/rf_kintf.h
diff -u src/sys/dev/raidframe/rf_kintf.h:1.23 src/sys/dev/raidframe/rf_kintf.h:1.24
--- src/sys/dev/raidframe/rf_kintf.h:1.23	Wed Aug  3 14:44:38 2011
+++ src/sys/dev/raidframe/rf_kintf.h	Sun Jan  3 08:17:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_kintf.h,v 1.23 2011/08/03 14:44:38 oster Exp $	*/
+/*	$NetBSD: rf_kintf.h,v 1.24 2016/01/03 08:17:24 mlelstv Exp $	*/
 /*
  * rf_kintf.h
  *
@@ -42,6 +42,7 @@ int rf_reasonable_label(RF_ComponentLabe
 
 voidraidstart(RF_Raid_t * raidPtr);
 int rf_DispatchKernelIO(RF_DiskQueue_t * queue, RF_DiskQueueData_t * req);
+voidraiddone(RF_Raid_t * raidPtr, struct buf * bp);
 
 int raidfetch_component_label(RF_Raid_t *, RF_RowCol_t);
 RF_ComponentLabel_t *raidget_component_label(RF_Raid_t *, RF_RowCol_t);
@@ -59,7 +60,6 @@ void raid_init_component_label(RF_Raid_t
 void rf_print_component_label(RF_ComponentLabel_t *);
 void rf_UnconfigureVnodes( RF_Raid_t * );
 void rf_close_component( RF_Raid_t *, struct vnode *, int);
-void rf_disk_unbusy(RF_RaidAccessDesc_t *);
 int rf_getdisksize(struct vnode *, RF_RaidDisk_t *);
 int rf_sync_component_caches(RF_Raid_t *raidPtr);
 #endif/* _RF__RF_KINTF_H_ */

Index: src/sys/dev/raidframe/rf_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.334 src/sys/dev/raidframe/rf_netbsdkintf.c:1.335
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.334	Sat Jan  2 16:20:50 2016
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Sun Jan  3 08:17:24 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.334 2016/01/02 16:20:50 mlelstv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: rf_netbsdkintf.c,v 1.335 2016/01/03 08:17:24 mlelstv Exp $");
 
 #ifdef _KERNEL_OPT
 #include "opt_compat_netbsd.h"
@@ -181,6 +181,7 @@ static void InitBP(struct buf *, struct 
 void *, int, struct proc *);
 struct raid_softc;
 static void raidinit(struct raid_softc *);
+static int raiddoaccess(RF_Raid_t *raidPtr, struct buf *bp);
 
 static int raid_match(device_t, cfdata_t, void *);
 static void raid_attach(device_t, device_t, void *);
@@ -196,6 +197,9 @@ static int raidwrite_component_label(uns
 static int raidread_component_label(unsigned,
 dev_t, struct vnode *, RF_ComponentLabel_t *);
 
+static int raid_diskstart(device_t, struct buf *bp);
+static int raid_dumpblocks(device_t, void *, daddr_t, int);
+static int raid_lastclose(device_t);
 
 static dev_type_open(raidopen);
 static dev_type_close(raidclose);
@@ -233,12 +237,17 @@ const struct cdevsw raid_cdevsw = {
 };
 
 static struct dkdriver rf_dkdriver = {
+	.d_open = raidopen,
+	.d_close = raidclose,
 	.d_strategy = raidstrategy,
+	.d_diskstart = raid_diskstart,
+	.d_dumpblocks = raid_dumpblocks,
+	.d_lastclose = 

CVS commit: src/usr.sbin/etcupdate

2016-01-03 Thread Martin Husemann
Module Name:src
Committed By:   martin
Date:   Sun Jan  3 08:44:59 UTC 2016

Modified Files:
src/usr.sbin/etcupdate: etcupdate

Log Message:
>From Jim Bernard in PR install/50615: install_checksum expects a path
relative to ${DESTDIR}, and most callers did pass it that way - fix the
one place where it eroneously was called with a ${DESTDIR} path.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/usr.sbin/etcupdate/etcupdate

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

Modified files:

Index: src/usr.sbin/etcupdate/etcupdate
diff -u src/usr.sbin/etcupdate/etcupdate:1.59 src/usr.sbin/etcupdate/etcupdate:1.60
--- src/usr.sbin/etcupdate/etcupdate:1.59	Thu Nov 13 07:11:06 2014
+++ src/usr.sbin/etcupdate/etcupdate	Sun Jan  3 08:44:59 2016
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $NetBSD: etcupdate,v 1.59 2014/11/13 07:11:06 apb Exp $
+# $NetBSD: etcupdate,v 1.60 2016/01/03 08:44:59 martin Exp $
 #
 # Copyright (c) 2001-2008 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -280,7 +280,7 @@ diff_and_merge_file() {
 	if cmp -s "${TEMPROOT}${1}" "${DESTDIR}${1}"; then
 		verbose "===> ${1} (ok)"
 		rm -f "${TEMPROOT}${1}"
-		install_checksum "${DESTDIR}${1}"
+		install_checksum "${1}"
 		return
 	fi
 



CVS commit: src/tests/lib/libusbhid

2016-01-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  3 15:16:10 UTC 2016

Modified Files:
src/tests/lib/libusbhid: t_usbhid.c

Log Message:
Move MY*_ATF_CHECK_EQ debugging helper macros to before all functions.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/tests/lib/libusbhid/t_usbhid.c

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/libusbhid/t_usbhid.c
diff -u src/tests/lib/libusbhid/t_usbhid.c:1.6 src/tests/lib/libusbhid/t_usbhid.c:1.7
--- src/tests/lib/libusbhid/t_usbhid.c:1.6	Sat Jan  2 01:24:44 2016
+++ src/tests/lib/libusbhid/t_usbhid.c	Sun Jan  3 15:16:10 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_usbhid.c,v 1.6 2016/01/02 01:24:44 jakllsch Exp $	*/
+/*	$NetBSD: t_usbhid.c,v 1.7 2016/01/03 15:16:10 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2016 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_usbhid.c,v 1.6 2016/01/02 01:24:44 jakllsch Exp $");
+__RCSID("$NetBSD: t_usbhid.c,v 1.7 2016/01/03 15:16:10 jakllsch Exp $");
 
 #include 
 
@@ -46,6 +46,15 @@ ATF_TC(check_hid_usage);
 ATF_TC(check_hid_get_data);
 ATF_TC(check_hid_set_data);
 
+#define MYd_ATF_CHECK_EQ(d, v) \
+	ATF_CHECK_EQ_MSG(d, v, "== %d", (d))
+
+#define MYu_ATF_CHECK_EQ(d, v) \
+	ATF_CHECK_EQ_MSG(d, v, "== %u", (d))
+
+#define MYx_ATF_CHECK_EQ(d, v) \
+	ATF_CHECK_EQ_MSG(d, v, "== 0x%x", (d))
+
 static const uint8_t range_test_report_descriptor[] = {
 	0x0b, 0x03, 0x00, 0x00, 0xff,	// Usage
 	0x75, 0x20,			// Report Size
@@ -158,9 +167,6 @@ ATF_TC_HEAD(check_hid_usage, tc)
 	atf_tc_set_md_var(tc, "descr", "Test libusbhid usage.c");
 }
 
-#define MYx_ATF_CHECK_EQ(d, v) \
-	ATF_CHECK_EQ_MSG(d, v, "== %x", (d))
-
 ATF_TC_BODY(check_hid_usage, tc)
 {
 	char usages_path[PATH_MAX];
@@ -202,12 +208,6 @@ ATF_TC_BODY(check_hid_usage, tc)
 	0xff2aff1b);
 }
 
-#define MYd_ATF_CHECK_EQ(d, v) \
-	ATF_CHECK_EQ_MSG(d, v, "== %d", (d))
-
-#define MYu_ATF_CHECK_EQ(d, v) \
-	ATF_CHECK_EQ_MSG(d, v, "== %u", (d))
-
 ATF_TC_HEAD(check_hid_logical_range, tc)
 {
 



CVS commit: src/tests/lib/libusbhid

2016-01-03 Thread Jonathan A. Kollasch
Module Name:src
Committed By:   jakllsch
Date:   Sun Jan  3 15:26:39 UTC 2016

Modified Files:
src/tests/lib/libusbhid: t_usbhid.c

Log Message:
reorganize constant test data


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/tests/lib/libusbhid/t_usbhid.c

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/libusbhid/t_usbhid.c
diff -u src/tests/lib/libusbhid/t_usbhid.c:1.7 src/tests/lib/libusbhid/t_usbhid.c:1.8
--- src/tests/lib/libusbhid/t_usbhid.c:1.7	Sun Jan  3 15:16:10 2016
+++ src/tests/lib/libusbhid/t_usbhid.c	Sun Jan  3 15:26:39 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: t_usbhid.c,v 1.7 2016/01/03 15:16:10 jakllsch Exp $	*/
+/*	$NetBSD: t_usbhid.c,v 1.8 2016/01/03 15:26:39 jakllsch Exp $	*/
 
 /*
  * Copyright (c) 2016 Jonathan A. Kollasch
@@ -27,7 +27,7 @@
  */
 
 #include 
-__RCSID("$NetBSD: t_usbhid.c,v 1.7 2016/01/03 15:16:10 jakllsch Exp $");
+__RCSID("$NetBSD: t_usbhid.c,v 1.8 2016/01/03 15:26:39 jakllsch Exp $");
 
 #include 
 
@@ -84,6 +84,30 @@ static const uint8_t range_test_report_d
 	0x81, 0x00,			// Input
 };
 
+static const uint8_t range_test_minimum_report[7] = {
+	0x00, 0x00, 0x00, 0x80,
+	0x00, 0x80,
+	0x80,
+};
+
+static const uint8_t range_test_negative_one_report[7] = {
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff,
+	0xff,
+};
+
+static const uint8_t range_test_positive_one_report[7] = {
+	0x01, 0x00, 0x00, 0x00,
+	0x01, 0x00,
+	0x01,
+};
+
+static const uint8_t range_test_maximum_report[7] = {
+	0xff, 0xff, 0xff, 0x7f,
+	0xff, 0x7f,
+	0x7f,
+};
+
 static const uint8_t unsigned_range_test_report_descriptor[] = {
 	0x0b, 0x13, 0x00, 0x00, 0xff,	// Usage
 	0x75, 0x20,			// Report Size
@@ -113,54 +137,30 @@ static const uint8_t unsigned_range_test
 	0x81, 0x00,			// Input
 };
 
-static const uint8_t range_test_minimum_report[7] = {
-	0x00, 0x00, 0x00, 0x80,
-	0x00, 0x80,
-	0x80,
-};
-
 static const uint8_t unsigned_range_test_minimum_report[7] = {
 	0x00, 0x00, 0x00, 0x00,
 	0x00, 0x00,
 	0x00,
 };
 
-static const uint8_t range_test_maximum_report[7] = {
-	0xff, 0xff, 0xff, 0x7f,
-	0xff, 0x7f,
-	0x7f,
-};
-
-static const uint8_t unsigned_range_test_maximum_report[7] = {
-	0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff,
-	0xff,
-};
-
-static const uint8_t range_test_positive_one_report[7] = {
-	0x01, 0x00, 0x00, 0x00,
-	0x01, 0x00,
-	0x01,
-};
-
 static const uint8_t unsigned_range_test_positive_one_report[7] = {
 	0x01, 0x00, 0x00, 0x00,
 	0x01, 0x00,
 	0x01,
 };
 
-static const uint8_t range_test_negative_one_report[7] = {
-	0xff, 0xff, 0xff, 0xff,
-	0xff, 0xff,
-	0xff,
-};
-
 static const uint8_t unsigned_range_test_negative_one_report[7] = {
 	0xfe, 0xff, 0xff, 0xff,
 	0xfe, 0xff,
 	0xfe,
 };
 
+static const uint8_t unsigned_range_test_maximum_report[7] = {
+	0xff, 0xff, 0xff, 0xff,
+	0xff, 0xff,
+	0xff,
+};
+
 ATF_TC_HEAD(check_hid_usage, tc)
 {
 



CVS commit: src/share/misc

2016-01-03 Thread Marc Balmer
Module Name:src
Committed By:   mbalmer
Date:   Sun Jan  3 15:25:31 UTC 2016

Modified Files:
src/share/misc: airport

Log Message:
add tehran airport


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/share/misc/airport

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

Modified files:

Index: src/share/misc/airport
diff -u src/share/misc/airport:1.60 src/share/misc/airport:1.61
--- src/share/misc/airport:1.60	Fri Oct  2 09:01:23 2015
+++ src/share/misc/airport	Sun Jan  3 15:25:31 2016
@@ -1,4 +1,4 @@
-#	$NetBSD: airport,v 1.60 2015/10/02 09:01:23 mbalmer Exp $
+#	$NetBSD: airport,v 1.61 2016/01/03 15:25:31 mbalmer Exp $
 #	@(#)airport	8.1 (Berkeley) 6/8/93
 #
 # Some of this information is from http://www.mapping.com/airportcodes.html.
@@ -3198,6 +3198,7 @@ IJD:Willimantic (Windham Airport), CT, U
 IJK:Izhevsk, Udmurtia, Russia
 IJU:Ijui, RS, Brazil
 IJX:Jacksonville Municipal Airport, IL, USA
+IKA:Imam Khomeini International Airport, Ahmadabad, Tehran, Iran
 IKB:Wilkesboro (Wilkes County Airport), NC, USA
 IKI:Iki, Japan
 IKK:Kankakee (Greater Kankakee Airport), IL, USA



CVS commit: src/usr.bin/tip

2016-01-03 Thread Christos Zoulas
Module Name:src
Committed By:   christos
Date:   Sun Jan  3 15:38:29 UTC 2016

Modified Files:
src/usr.bin/tip: cu.c

Log Message:
Put back -n


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/usr.bin/tip/cu.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/tip/cu.c
diff -u src/usr.bin/tip/cu.c:1.22 src/usr.bin/tip/cu.c:1.23
--- src/usr.bin/tip/cu.c:1.22	Sun Jul 27 00:32:23 2014
+++ src/usr.bin/tip/cu.c	Sun Jan  3 10:38:29 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: cu.c,v 1.22 2014/07/27 04:32:23 dholland Exp $	*/
+/*	$NetBSD: cu.c,v 1.23 2016/01/03 15:38:29 christos Exp $	*/
 
 /*
  * Copyright (c) 1983, 1993
@@ -36,7 +36,7 @@
 #if 0
 static char sccsid[] = "@(#)cu.c	8.1 (Berkeley) 6/6/93";
 #endif
-__RCSID("$NetBSD: cu.c,v 1.22 2014/07/27 04:32:23 dholland Exp $");
+__RCSID("$NetBSD: cu.c,v 1.23 2016/01/03 15:38:29 christos Exp $");
 #endif /* not lint */
 
 #include "tip.h"
@@ -54,7 +54,7 @@ cumain(int argc, char *argv[])
 	int parity = 0;		/* 0 is no parity */
 	int flow = -1;		/* -1 is "tandem" ^S/^Q */
 	static int helpme = 0, nostop = 0;
-	char useresc = '~';
+	int useresc = '~';
 	static char sbuf[12];
 	int cmdlineBR;
 	extern char *optarg;
@@ -84,7 +84,7 @@ cumain(int argc, char *argv[])
 	cmdlineBR = 0;
 
 	while((c = getopt_long(argc, argv,
-	"E:F:P:a:p:c:l:s:hefot0123456789", longopts, NULL)) != -1) {
+	"E:F:P:a:p:c:l:ns:hefot0123456789", longopts, NULL)) != -1) {
 
 		if (helpme == 1) cuhelp();
 
@@ -136,6 +136,9 @@ cumain(int argc, char *argv[])
 			else
 (void)asprintf(, "/dev/%s", optarg);
 			break;
+		case 'n':
+			useresc = -1;
+			break;
 		case 's':
 			BR = atoi(optarg);
 			break;
@@ -296,6 +299,7 @@ cuhelp(void)
 	" -o: Use odd parity\n"
 	" -P,--parity {even,odd,none}: use even, odd, no parity\n"
 	" -l,--line line: Use this device (ttyXX)\n"
+	" -n: Disable escape character processing\n"
 	" -s,--speed,--baud speed,-#: Use this speed\n"
 	" -t: Connect via hard-wired connection\n");
 	exit(0);



CVS commit: src/share/man/man4

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:27:39 UTC 2016

Modified Files:
src/share/man/man4: admtemp.4

Log Message:
Mention supported chips and their differences.
Mention display and setting of chip temperature limits.


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

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

Modified files:

Index: src/share/man/man4/admtemp.4
diff -u src/share/man/man4/admtemp.4:1.4 src/share/man/man4/admtemp.4:1.5
--- src/share/man/man4/admtemp.4:1.4	Tue Mar 18 18:20:39 2014
+++ src/share/man/man4/admtemp.4	Sun Jan  3 17:27:39 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: admtemp.4,v 1.4 2014/03/18 18:20:39 riastradh Exp $
+.\"	$NetBSD: admtemp.4,v 1.5 2016/01/03 17:27:39 jdc Exp $
 .\"
 .\"	$OpenBSD: admtemp.4,v 1.8 2007/05/31 19:19:48 jmc Exp $
 .\"
@@ -16,7 +16,7 @@
 .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 .\"
-.Dd October 29, 2008
+.Dd December 31, 2015
 .Dt ADMTEMP 4
 .Os
 .Sh NAME
@@ -29,16 +29,44 @@ The
 .Nm
 driver provides support for the Analog Devices ADM1021,
 Analog Devices ADM1023, Analog Devices ADM1032, Genesys Logic GL523SM,
-Global Mixed-mode Technology G781, Maxim 1617, and Xeon embedded
-temperature sensors.
-The device possesses internal and external temperature sensors.
-These values are made available through the
-.Xr envstat 8
-interface.
+Global Mixed-mode Technology G781, Texas Instruments LM84, Maxim 1617,
+Maxim 1617A, Philips Semiconductors NE1617A, and Xeon embedded temperature
+sensors.
+The device possesses internal and external temperature sensors, and
+programmable low and high temperature limits, with a temperature range of
+-65 to +127 degC and a resolution of 1 degC.
 .Pp
 On i386 machines, this driver also supports the Xeon embedded
 I2C temperature probes.
 In this case, however, only one temperature value is provided.
+.Pp
+Exceeding the temperature limits causes the device to assert an Alarm signal,
+which can be used by other hardware to detect critical conditions.
+.Pp
+Some sensors differ from the ADM1021, MAX1617 and NE1617A:
+.Bl -item -offset indent
+.It
+The ADM1021A, ADM1023, ADM1032, and G781 have a temperature range of 0 to
++127 degC and a resolution of 1 degC.
+.It
+The LM84 has no low temperature limits.
+.It
+The ADM1023, ADM1032, and G781 have extended precision remote temperature
+sensors, with a range of 0 to +127.875 degC and a resolution of 0.125 degC.
+.It
+The ADM1032 and G781 have additional high temperature limits with a range of
+0 to +127 degC and a resolution of 1 degC.
+If these are exceeded, a separate Therm signal is asserted.
+.El
+.Pp
+The sensor and limit values are made available through the
+.Xr envstat 8
+interface.
+For devices without additional high temperature limits, the limits that are
+displayed and set are the critical limits.
+For devices with additional high temperature limits, high and low temperature
+warning limits and high temperature critical limits are displayed and can be
+set.
 .Sh SEE ALSO
 .Xr iic 4 ,
 .Xr intro 4 ,
@@ -49,3 +77,10 @@ The
 .Nm
 driver was written by
 .An Theo de Raadt Aq Mt dera...@openbsd.org .
+Extended precision temperatures, and limit display and setting were added by
+.An Julian Coleman Aq Mt jcole...@netbsd.org .
+.Sh BUGS
+Limit sensors occasionally read as 0xff.
+If this occurs, the
+.Nm
+driver will ignore that limit.



CVS commit: src/sys/dev/i2c

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:27:26 UTC 2016

Modified Files:
src/sys/dev/i2c: adm1021.c

Log Message:
Add display and setting of chip temperature limits for envsys(4).
Different chips are recognised where possible, and the appropriate limits
are displayed/settable.


To generate a diff of this commit:
cvs rdiff -u -r1.10 -r1.11 src/sys/dev/i2c/adm1021.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/i2c/adm1021.c
diff -u src/sys/dev/i2c/adm1021.c:1.10 src/sys/dev/i2c/adm1021.c:1.11
--- src/sys/dev/i2c/adm1021.c:1.10	Mon Dec  7 20:59:44 2015
+++ src/sys/dev/i2c/adm1021.c	Sun Jan  3 17:27:26 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: adm1021.c,v 1.10 2015/12/07 20:59:44 jdc Exp $ */
+/*	$NetBSD: adm1021.c,v 1.11 2016/01/03 17:27:26 jdc Exp $ */
 /*	$OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $	*/
 
 /*
@@ -17,8 +17,28 @@
  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  */
 
+/*
+ * Driver for ADM1021 and compatible temperature sensors, including ADM1021,
+ * ADM1021A, ADM1023, ADM1032, GL523SM, G781, LM84, MAX1617, MAX1617A,
+ * NE1617A, and Xeon embedded temperature sensors.
+ *
+ * Some sensors differ from the ADM1021/MAX1617/NE1617A:
+ * ADM1021A ADM1023 ADM1032 G781 LM84 MAX1617A
+ *   company/revision reg  XX   X   X X
+ *   no negative temps XX   X   X
+ *   11-bit remote temp X   X   X
+ *   no low limits   X
+ *   therm (high) limitsX   X
+ *
+ * Registers 0x00 to 0x0f have separate read/write addresses, but
+ * registers 0x10 and above have the same read/write address.
+ * The 11-bit (extended) temperature consists of a separate register with
+ * 3 valid bits that are always added to the external temperature (even if
+ * the temperature is negative).
+ */
+
 #include 
-__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.10 2015/12/07 20:59:44 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.11 2016/01/03 17:27:26 jdc Exp $");
 
 #include 
 #include 
@@ -27,40 +47,102 @@ __KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 
 
 #include 
 
+/* Registers */
+#define ADM1021_INT_TEMP	0x00	/* Internal temperature value */
+#define ADM1021_EXT_TEMP	0x01	/* External temperature value */
+#define ADM1021_STATUS		0x02	/* Status */
+#define ADM1021_CONFIG_READ	0x03	/* Read configuration */
+#define ADM1021_CONV_RATE_READ	0x04	/* Read conversion rate */
+#define ADM1021_INT_HIGH_READ	0x05	/* Read internal high limit */
+#define ADM1021_INT_LOW_READ	0x06	/* Read internal low limit */
+#define ADM1021_EXT_HIGH_READ	0x07	/* Read external high limit */
+#define ADM1021_EXT_LOW_READ	0x08	/* Read external low limit */
+#define ADM1021_CONFIG_WRITE	0x09	/* Write configuration */
+#define ADM1021_CONV_RATE_WRITE 0x0a	/* Write conversion rate */
+#define ADM1021_INT_HIGH_WRITE	0x0b	/* Write internal high limit */
+#define ADM1021_INT_LOW_WRITE	0x0c	/* Write internal low limit */
+#define ADM1021_EXT_HIGH_WRITE	0x0d	/* Write external high limit */
+#define ADM1021_EXT_LOW_WRITE	0x0e	/* Write external low limit */
+#define ADM1021_ONE_SHOT	0x0f	/* One shot command */
+#define ADM1023_EXT_TEMP2	0x10	/* R/W external temp low byte */
+#define ADM1023_EXT_TEMP_OFF	0x11	/* R/W external temp offset */
+#define ADM1023_EXT_TEMP_OFF2	0x12	/* R/W external temp off low byte */
+#define ADM1023_EXT_HIGH2	0x13	/* R/W external high lim low byte */
+#define ADM1023_EXT_LOW2	0x14	/* R/W external low lim low byte */
+#define ADM1032_EXT_THERM	0x19	/* R/W external Therm (high) limit */
+#define ADM1032_INT_THERM	0x20	/* R/W internal Therm (high) limit */
+#define ADM1032_THERM_HYST	0x21	/* R/W Therm hysteris */
+#define ADM1032_ALERT_QUEUE	0x22	/* R/W consecutive alert queue */
+#define ADM1021_COMPANY		0xfe	/* Company ID */
+#define ADM1021_DIE_REVISION	0xff	/* Die revision code */
 
-/* ADM 1021 registers */
-#define ADM1021_INT_TEMP	0x00
-#define ADM1021_EXT_TEMP	0x01
-#define ADM1021_STATUS		0x02
-#define ADM1021_STATUS_INVAL	0x7f
-#define ADM1021_STATUS_NOEXT	0x40
-#define ADM1021_CONFIG_READ	0x03
-#define ADM1021_CONFIG_WRITE	0x09
+/* Register values */
 #define ADM1021_CONFIG_RUN	0x40
-#define ADM1021_COMPANY		0xfe	/* contains 0x41 */
-#define ADM1021_DIE_REVISION	0xff
+
+#define ADM1021_STATUS_INVAL	0x7f
+#define ADM1021_STATUS_NOEXT	0x40	/* External diode is open-circuit */
+
+#define ADM1023_EXT2_SHIFT	5
+#define ADM1023_EXT2_MASK	0x07
+
+#define ADM1021_COMPANY_ADM	0x41	/* 'A' */
+#define ADM1021_COMPANY_GMT	0x47	/* 'G' */
+#define ADM1021_COMPANY_MAXIM	0x4d	/* 'M' */
+
+#define ADM1021_REV_1021	0x00
+#define ADM1021_REV_1021A	0x30
+#define ADM1021_REV_MASK	0xf0
 
 /* Sensors */
 #define ADMTEMP_INT		0
 #define ADMTEMP_EXT		1
 #define ADMTEMP_NUM_SENSORS	2
 
+#define ADMTEMP_MAX_NEG		-65
+#define ADMTEMP_MAX_POS		127
+#define 

CVS commit: src/sys/dev/i2c

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:28:33 UTC 2016

Modified Files:
src/sys/dev/i2c: lm75reg.h

Log Message:
Add LM75A ID register (for completeness).


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/i2c/lm75reg.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/i2c/lm75reg.h
diff -u src/sys/dev/i2c/lm75reg.h:1.4 src/sys/dev/i2c/lm75reg.h:1.5
--- src/sys/dev/i2c/lm75reg.h:1.4	Wed Aug  7 19:38:45 2013
+++ src/sys/dev/i2c/lm75reg.h	Sun Jan  3 17:28:33 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm75reg.h,v 1.4 2013/08/07 19:38:45 soren Exp $	*/
+/*	$NetBSD: lm75reg.h,v 1.5 2016/01/03 17:28:33 jdc Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -66,6 +66,7 @@
 #define	LM75_REG_CONFIG			0x01
 #define	LM75_REG_THYST_SET_POINT	0x02
 #define	LM75_REG_TOS_SET_POINT		0x03
+#define	LM75_REG_ID			0x07	/* LM75A only */
 
 #define	LM77_REG_TCRIT_SET_POINT	0x03
 #define	LM77_REG_TLOW_SET_POINT		0x04



CVS commit: src/share/man/man4

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:28:46 UTC 2016

Modified Files:
src/share/man/man4: lmtemp.4

Log Message:
Mention supported chips and their differences.
Mention display and setting of chip temperature limits.


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

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

Modified files:

Index: src/share/man/man4/lmtemp.4
diff -u src/share/man/man4/lmtemp.4:1.3 src/share/man/man4/lmtemp.4:1.4
--- src/share/man/man4/lmtemp.4:1.3	Mon Oct  8 17:56:59 2012
+++ src/share/man/man4/lmtemp.4	Sun Jan  3 17:28:46 2016
@@ -1,4 +1,4 @@
-.\"	$NetBSD: lmtemp.4,v 1.3 2012/10/08 17:56:59 njoly Exp $
+.\"	$NetBSD: lmtemp.4,v 1.4 2016/01/03 17:28:46 jdc Exp $
 .\"
 .\" Copyright (c) 2005 KIYOHARA Takashi
 .\" 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 4, 2008
+.Dd January 1, 2016
 .Dt LMTEMP 4
 .Os
 .Sh NAME
@@ -37,18 +37,13 @@ The
 .Nm
 driver provides support for the
 .Tn National Semiconductor
-LM on iicbus series temperatures and register compatible chips to be used
-with the
-.Xr envsys 4
-API.
-The
-.Nm
-supports ranges of the temperature between +125 from -55.
+LM on iicbus series temperature sensors and register compatible chips.
 .Pp
 Each device is specified by the value of the address and flags.
-.Bl -column "Temperature" "0x48 - 0x4f" "flags" -offset indent
-.It Sy "Temperature" Ta Sy "addr" Ta Sy "flags"
+.Bl -column "Device" "0x48 - 0x4f" "flags" -offset indent
+.It Sy "Device" Ta Sy "addr" Ta Sy "flags"
 .It Li "LM75" Ta "0x48 - 0x4f" Ta "0x"
+.It Li "LM75A" Ta "0x48 - 0x4f" Ta "0x"
 .It Li "DS75" Ta "0x48 - 0x4f" Ta "0x0001"
 .It Li "LM77" Ta "0x48 - 0x4b" Ta "0x0002"
 .El
@@ -56,17 +51,27 @@ Each device is specified by the value of
 Chips supported by the
 .Nm
 driver include:
-.Bl -item -offset indent
-.It
-.Tn National Semiconductor
-.Em LM75
-.It
-.Tn National Semiconductor
-.Em LM77
-.It
-.Tn Dallas Semiconductor
-.Em DS75
+.Bl -column "National Semiconductor LM75" "-55 \(en +125" "Resolution" \
+-offset indent
+.It Sy "Device" Ta Sy "Range" Ta Sy "Resolution"
+.It Li "National Semiconductor LM75" Ta "-55 \(en +125" Ta "0.5 degC"
+.It Li "Texas Instruments LM75A" Ta "-55 \(en +125" Ta "0.5 degC"
+.It Li "Dallas Semiconductor DS75" Ta "-55 \(en +125" Ta "0.0625 degC"
+.It Li "National Semiconductor LM77" Ta "-55 \(en +130" Ta "0.5 degC"
 .El
+.Pp
+The LM75, LM75A, and DS75 have a programmable high temperature limit.
+When this is exceeded, the device asserts an over-temperature output.
+.Pp
+The LM77 has programmable low and high temperature limits.
+Exceeding either of these causes the device to assert an interrupt output.
+It also has a programmable critical high temperature limit, and
+exceeding this causes the device to assert a separate critical alarm
+output.
+.Pp
+The sensor and limit values are made available through the
+.Xr envstat 8
+interface.
 .Sh SEE ALSO
 .Xr envsys 4 ,
 .Xr envstat 8



CVS commit: src/sys/dev/i2c

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:27:57 UTC 2016

Modified Files:
src/sys/dev/i2c: lm75.c

Log Message:
Add display and setting of chip temperature limit(s) for envsys(4).


To generate a diff of this commit:
cvs rdiff -u -r1.27 -r1.28 src/sys/dev/i2c/lm75.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/i2c/lm75.c
diff -u src/sys/dev/i2c/lm75.c:1.27 src/sys/dev/i2c/lm75.c:1.28
--- src/sys/dev/i2c/lm75.c:1.27	Fri Jan  1 20:13:50 2016
+++ src/sys/dev/i2c/lm75.c	Sun Jan  3 17:27:57 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: lm75.c,v 1.27 2016/01/01 20:13:50 jdc Exp $	*/
+/*	$NetBSD: lm75.c,v 1.28 2016/01/03 17:27:57 jdc Exp $	*/
 
 /*
  * Copyright (c) 2003 Wasabi Systems, Inc.
@@ -36,7 +36,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.27 2016/01/01 20:13:50 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: lm75.c,v 1.28 2016/01/03 17:27:57 jdc Exp $");
 
 #include 
 #include 
@@ -57,8 +57,10 @@ struct lmtemp_softc {
 	struct sysmon_envsys *sc_sme;
 	envsys_data_t sc_sensor;
 	int sc_tmax;
+	uint32_t sc_smax, sc_smin, sc_scrit;
 
 	uint32_t (*sc_lmtemp_decode)(const uint8_t *, int);
+	void (*sc_lmtemp_encode)(const uint32_t, uint8_t *, int);
 };
 
 static int  lmtemp_match(device_t, cfdata_t, void *);
@@ -68,14 +70,25 @@ CFATTACH_DECL_NEW(lmtemp, sizeof(struct 
 	lmtemp_match, lmtemp_attach, NULL, NULL);
 
 static void	lmtemp_refresh(struct sysmon_envsys *, envsys_data_t *);
-
 static int	lmtemp_config_write(struct lmtemp_softc *, uint8_t);
-static int	lmtemp_temp_write(struct lmtemp_softc *, int, uint16_t);
+static int	lmtemp_temp_write(struct lmtemp_softc *, uint8_t, uint32_t,
+int);
 static int	lmtemp_temp_read(struct lmtemp_softc *, uint8_t, uint32_t *,
 int);
 static uint32_t lmtemp_decode_lm75(const uint8_t *, int);
 static uint32_t lmtemp_decode_ds75(const uint8_t *, int);
 static uint32_t lmtemp_decode_lm77(const uint8_t *, int);
+static void	lmtemp_encode_lm75(const uint32_t, uint8_t *, int);
+static void	lmtemp_encode_ds75(const uint32_t, uint8_t *, int);
+static void	lmtemp_encode_lm77(const uint32_t, uint8_t *, int);
+static void	lmtemp_getlim_lm75(struct sysmon_envsys *, envsys_data_t *,
+sysmon_envsys_lim_t *, uint32_t *);
+static void	lmtemp_getlim_lm77(struct sysmon_envsys *, envsys_data_t *,
+sysmon_envsys_lim_t *, uint32_t *);
+static void	lmtemp_setlim_lm75(struct sysmon_envsys *, envsys_data_t *,
+sysmon_envsys_lim_t *, uint32_t *);
+static void	lmtemp_setlim_lm77(struct sysmon_envsys *, envsys_data_t *,
+sysmon_envsys_lim_t *, uint32_t *);
 
 static void	lmtemp_setup_sysctl(struct lmtemp_softc *);
 static int	sysctl_lm75_temp(SYSCTLFN_ARGS);
@@ -100,16 +113,24 @@ static const struct {
 	int lmtemp_addrmask;
 	int lmtemp_addr;
 	uint32_t (*lmtemp_decode)(const uint8_t *, int);
+	void (*lmtemp_encode)(const uint32_t, uint8_t *, int);
+	void (*lmtemp_getlim)(struct sysmon_envsys *, envsys_data_t *,
+		sysmon_envsys_lim_t *, uint32_t *);
+	void (*lmtemp_setlim)(struct sysmon_envsys *, envsys_data_t *,
+		sysmon_envsys_lim_t *, uint32_t *);
 } lmtemptbl[] = {
-	{ lmtemp_lm75,	"LM75",
-	LM75_ADDRMASK,	LM75_ADDR,	lmtemp_decode_lm75 },
-	{ lmtemp_ds75,	"DS75",
-	LM75_ADDRMASK,	LM75_ADDR,	lmtemp_decode_ds75 },
-	{ lmtemp_lm77,	"LM77",
-	LM77_ADDRMASK,	LM77_ADDR,	lmtemp_decode_lm77 },
-
-	{ -1,		NULL,
-	0,			0,		NULL }
+	{ lmtemp_lm75,	"LM75",	LM75_ADDRMASK,	LM75_ADDR,
+	lmtemp_decode_lm75,	lmtemp_encode_lm75,
+	lmtemp_getlim_lm75,	lmtemp_setlim_lm75 },
+	{ lmtemp_ds75,	"DS75",	LM75_ADDRMASK,	LM75_ADDR,
+	lmtemp_decode_ds75,	lmtemp_encode_ds75,
+	lmtemp_getlim_lm75,	lmtemp_setlim_lm75 },
+	{ lmtemp_lm77,	"LM77",	LM77_ADDRMASK,	LM77_ADDR,
+	lmtemp_decode_lm77, lmtemp_encode_lm77,
+	lmtemp_getlim_lm77,	lmtemp_setlim_lm77 },
+	{ -1,		NULL,	 0,		0,
+	NULL,		NULL,
+	NULL,		NULL }
 };
 
 static int
@@ -180,15 +201,34 @@ lmtemp_attach(device_t parent, device_t 
 	}
 
 	sc->sc_lmtemp_decode = lmtemptbl[i].lmtemp_decode;
+	sc->sc_lmtemp_encode = lmtemptbl[i].lmtemp_encode;
 
 	iic_acquire_bus(sc->sc_tag, I2C_F_POLL);
 
-	/* Read temperature limit and remember initial value. */
-	if (lmtemp_temp_read(sc, LM75_REG_TOS_SET_POINT, >sc_tmax, 1)
+	/* Read temperature limit(s) and remember initial value(s). */
+	if (lmtemp_temp_read(sc, LM75_REG_TOS_SET_POINT, >sc_smax, 1)
 	!= 0) {
+		aprint_error_dev(self, "unable to read Tos register\n");
 		iic_release_bus(sc->sc_tag, I2C_F_POLL);
 		return;
 	}
+	sc->sc_tmax = sc->sc_smax;
+	if (i == lmtemp_lm77) {
+		if (lmtemp_temp_read(sc, LM77_REG_TLOW_SET_POINT,
+		>sc_smax, 1) != 0) {
+			aprint_error_dev(self,
+			"unable to read low register\n");
+			iic_release_bus(sc->sc_tag, I2C_F_POLL);
+			return;
+		}
+		if (lmtemp_temp_read(sc, LM77_REG_THIGH_SET_POINT,
+		>sc_smax, 1) != 0) {
+			aprint_error_dev(self,
+			"unable to read 

CVS commit: src/sys

2016-01-03 Thread Julian Coleman
Module Name:src
Committed By:   jdc
Date:   Sun Jan  3 17:32:17 UTC 2016

Modified Files:
src/sys/arch/sparc64/dev: pcfiic_ebus.c
src/sys/dev/ic: pcf8584.c pcf8584reg.h pcf8584var.h

Log Message:
Remove duplicate register definitions and merge them all into pcf8584reg.h.
No functional change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/sparc64/dev/pcfiic_ebus.c
cvs rdiff -u -r1.12 -r1.13 src/sys/dev/ic/pcf8584.c
cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/pcf8584reg.h
cvs rdiff -u -r1.4 -r1.5 src/sys/dev/ic/pcf8584var.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/sparc64/dev/pcfiic_ebus.c
diff -u src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.4 src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.5
--- src/sys/arch/sparc64/dev/pcfiic_ebus.c:1.4	Sun Feb  3 17:46:28 2013
+++ src/sys/arch/sparc64/dev/pcfiic_ebus.c	Sun Jan  3 17:32:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcfiic_ebus.c,v 1.4 2013/02/03 17:46:28 jdc Exp $	*/
+/*	$NetBSD: pcfiic_ebus.c,v 1.5 2016/01/03 17:32:17 jdc Exp $	*/
 /*	$OpenBSD: pcfiic_ebus.c,v 1.13 2008/06/08 03:07:40 deraadt Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include 
-__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.4 2013/02/03 17:46:28 jdc Exp $");
+__KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.c,v 1.5 2016/01/03 17:32:17 jdc Exp $");
 
 /*
  * Device specific driver for the EBus i2c devices found on some sun4u
@@ -42,6 +42,7 @@ __KERNEL_RCSID(0, "$NetBSD: pcfiic_ebus.
 #include 
 
 #include 
+#include 
 
 int	pcfiic_ebus_match(device_t, struct cfdata *, void *);
 void	pcfiic_ebus_attach(device_t, device_t, void *);
@@ -94,7 +95,7 @@ pcfiic_ebus_attach(device_t parent, devi
 	struct ebus_attach_args		*ea = aux;
 	charcompat[32];
 	u_int64_t			addr;
-	u_int8_t			clock = PCF_CLOCK_12 | PCF_FREQ_90;
+	u_int8_t			clock = PCF8584_CLK_12 | PCF8584_SCL_90;
 	intswapregs = 0;
 
 	if (ea->ea_nreg < 1 || ea->ea_nreg > 2) {
@@ -113,9 +114,9 @@ pcfiic_ebus_attach(device_t parent, devi
 		int clk = prom_getpropint(findroot(), "clock-frequency", 0);
 
 		if (clk < 10500)
-			clock = PCF_CLOCK_3 | PCF_FREQ_90;
+			clock = PCF8584_CLK_3 | PCF8584_SCL_90;
 		else if (clk < 16000)
-			clock = PCF_CLOCK_4_43 | PCF_FREQ_90;
+			clock = PCF8584_CLK_4_43 | PCF8584_SCL_90;
 		swapregs = 1;
 	}
 
@@ -161,10 +162,10 @@ pcfiic_ebus_attach(device_t parent, devi
 
 	if (strcmp(ea->ea_name, "SUNW,envctrl") == 0) {
 		envctrl_props(create_dict(self), ea->ea_node);
-		pcfiic_attach(sc, 0x55, PCF_CLOCK_12 | PCF_FREQ_45, 0);
+		pcfiic_attach(sc, 0x55, PCF8584_CLK_12 | PCF8584_SCL_45, 0);
 	} else if (strcmp(ea->ea_name, "SUNW,envctrltwo") == 0) {
 		envctrltwo_props(create_dict(self), ea->ea_node);
-		pcfiic_attach(sc, 0x55, PCF_CLOCK_12 | PCF_FREQ_45, 0);
+		pcfiic_attach(sc, 0x55, PCF8584_CLK_12 | PCF8584_SCL_45, 0);
 	} else
 		pcfiic_attach(sc, (i2c_addr_t)(addr >> 1), clock, swapregs);
 }

Index: src/sys/dev/ic/pcf8584.c
diff -u src/sys/dev/ic/pcf8584.c:1.12 src/sys/dev/ic/pcf8584.c:1.13
--- src/sys/dev/ic/pcf8584.c:1.12	Wed Dec 16 08:04:58 2015
+++ src/sys/dev/ic/pcf8584.c	Sun Jan  3 17:32:17 2016
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcf8584.c,v 1.12 2015/12/16 08:04:58 jdc Exp $	*/
+/*	$NetBSD: pcf8584.c,v 1.13 2016/01/03 17:32:17 jdc Exp $	*/
 /*	$OpenBSD: pcf8584.c,v 1.9 2007/10/20 18:46:21 kettenis Exp $ */
 
 /*
@@ -29,36 +29,13 @@
 #include 
 
 #include 
+#include 
 
-#define PCF_S0			0x00
-#define PCF_S1			0x01
-#define PCF_S2			0x02
-#define PCF_S3			0x03
-
-#define PCF_CTRL_ACK		(1<<0)
-#define PCF_CTRL_STO		(1<<1)
-#define PCF_CTRL_STA		(1<<2)
-#define PCF_CTRL_ENI		(1<<3)
-#define PCF_CTRL_ES2		(1<<4)
-#define PCF_CTRL_ES1		(1<<5)
-#define PCF_CTRL_ESO		(1<<6)
-#define PCF_CTRL_PIN		(1<<7)
-
-#define PCF_CTRL_START		(PCF_CTRL_PIN | PCF_CTRL_ESO | \
-PCF_CTRL_STA | PCF_CTRL_ACK)
-#define PCF_CTRL_STOP		(PCF_CTRL_PIN | PCF_CTRL_ESO | \
-PCF_CTRL_STO | PCF_CTRL_ACK)
-#define PCF_CTRL_REPSTART	(PCF_CTRL_ESO | PCF_CTRL_STA | PCF_CTRL_ACK)
-#define PCF_CTRL_IDLE		(PCF_CTRL_PIN | PCF_CTRL_ESO | PCF_CTRL_ACK)
-
-#define PCF_STAT_nBB		(1<<0)
-#define PCF_STAT_LAB		(1<<1)
-#define PCF_STAT_AAS		(1<<2)
-#define PCF_STAT_AD0		(1<<3)
-#define PCF_STAT_LRB		(1<<3)
-#define PCF_STAT_BER		(1<<4)
-#define PCF_STAT_STS		(1<<5)
-#define PCF_STAT_PIN		(1<<7)
+/* Internal egisters */
+#define PCF8584_S0		0x00
+#define PCF8584_S1		0x01
+#define PCF8584_S2		0x02
+#define PCF8584_S3		0x03
 
 void		pcfiic_init(struct pcfiic_softc *);
 int		pcfiic_i2c_acquire_bus(void *, int);
@@ -74,22 +51,22 @@ int		pcfiic_recv(struct pcfiic_softc *, 
 u_int8_t	pcfiic_read(struct pcfiic_softc *, bus_size_t);
 void		pcfiic_write(struct pcfiic_softc *, bus_size_t, u_int8_t);
 void		pcfiic_choose_bus(struct pcfiic_softc *, u_int8_t);
-int		pcfiic_wait_nBB(struct pcfiic_softc *);
+int		pcfiic_wait_BBN(struct pcfiic_softc *);
 int		pcfiic_wait_pin(struct pcfiic_softc *, volatile u_int8_t *);