CVS commit: src/distrib

2012-10-16 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Oct 16 08:19:37 UTC 2012

Modified Files:
src/distrib/amd64/kmod: Makefile
src/distrib/i386/kmod: Makefile
Added Files:
src/distrib/common: Makefile.minirootkmod

Log Message:
Add distrib/common/Makefile.minirootkmod.  Apart from comments and the
conversion of some constants to variables, this is identical to the code
that was previously present in both distrib/amd64/kmod/Makefile and
distrib/i386/kmod/Makefile.

Change distrib/amd64/kmod/Makefile and distrib/i386/kmod/Makefile to just
set some variables and .include ../../common/Makefile.minirootkmod.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/distrib/amd64/kmod/Makefile
cvs rdiff -u -r0 -r1.1 src/distrib/common/Makefile.minirootkmod
cvs rdiff -u -r1.11 -r1.12 src/distrib/i386/kmod/Makefile

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

Modified files:

Index: src/distrib/amd64/kmod/Makefile
diff -u src/distrib/amd64/kmod/Makefile:1.2 src/distrib/amd64/kmod/Makefile:1.3
--- src/distrib/amd64/kmod/Makefile:1.2	Fri Feb 17 00:33:24 2012
+++ src/distrib/amd64/kmod/Makefile	Tue Oct 16 08:19:37 2012
@@ -1,27 +1,6 @@
-#	$NetBSD: Makefile,v 1.2 2012/02/17 00:33:24 riz Exp $
+#	$NetBSD: Makefile,v 1.3 2012/10/16 08:19:37 apb Exp $
 
-.include bsd.own.mk
-.include ../../common/Makefile.distrib
-
-MKMAN=		no
-PROG=		miniroot.kmod
-
-SRCMOD=		${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod
-DSTMOD=		${.OBJDIR}/miniroot.kmod
+MINIROOT=	miniroot
 RAMDISK=	ramdisk
-RAMDISKDIR!=	cd ${.CURDIR}/../ramdisks/${RAMDISK}  ${PRINTOBJDIR}
-RAMDISKFS=	${RAMDISKDIR}/${RAMDISK}.fs
-
-miniroot.kmod:	${RAMDISKFS} ${SRCMOD}
-		${OBJCOPY} --add-section miniroot=${RAMDISKFS} \
-		--set-section-flags miniroot=alloc,contents,load,data \
-		${SRCMOD} ${DSTMOD}.tmp
-		gzip -9nc  ${DSTMOD}.tmp  ${DSTMOD}
-		rm -f ${DSTMOD}.tmp
-
-.include bsd.prog.mk
-
-release:	miniroot.kmod
-		${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG}  \
-		${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/
 
+.include ../../common/Makefile.minirootkmod

Index: src/distrib/i386/kmod/Makefile
diff -u src/distrib/i386/kmod/Makefile:1.11 src/distrib/i386/kmod/Makefile:1.12
--- src/distrib/i386/kmod/Makefile:1.11	Fri Feb 17 00:33:25 2012
+++ src/distrib/i386/kmod/Makefile	Tue Oct 16 08:19:37 2012
@@ -1,27 +1,6 @@
-#	$NetBSD: Makefile,v 1.11 2012/02/17 00:33:25 riz Exp $
+#	$NetBSD: Makefile,v 1.12 2012/10/16 08:19:37 apb Exp $
 
-.include bsd.own.mk
-.include ../../common/Makefile.distrib
-
-MKMAN=		no
-PROG=		miniroot.kmod
-
-SRCMOD=		${DESTDIR}/stand/${MACHINE}/${MODULEVER}/modules/miniroot/miniroot.kmod
-DSTMOD=		${.OBJDIR}/miniroot.kmod
+MINIROOT=	miniroot
 RAMDISK=	ramdisk-big
-RAMDISKDIR!=	cd ${.CURDIR}/../ramdisks/${RAMDISK}  ${PRINTOBJDIR}
-RAMDISKFS=	${RAMDISKDIR}/${RAMDISK}.fs
-
-miniroot.kmod:	${RAMDISKFS} ${SRCMOD}
-		${OBJCOPY} --add-section miniroot=${RAMDISKFS} \
-		--set-section-flags miniroot=alloc,contents,load,data \
-		${SRCMOD} ${DSTMOD}.tmp
-		gzip -9nc  ${DSTMOD}.tmp  ${DSTMOD}
-		rm -f ${DSTMOD}.tmp
-
-.include bsd.prog.mk
-
-release:	miniroot.kmod
-		${HOST_INSTALL_FILE} -m ${BINMODE} ${PROG}  \
-		${RELEASEDIR}/${RELEASEMACHINEDIR}/installation/miniroot/
 
+.include ../../common/Makefile.minirootkmod

Added files:

Index: src/distrib/common/Makefile.minirootkmod
diff -u /dev/null src/distrib/common/Makefile.minirootkmod:1.1
--- /dev/null	Tue Oct 16 08:19:37 2012
+++ src/distrib/common/Makefile.minirootkmod	Tue Oct 16 08:19:36 2012
@@ -0,0 +1,56 @@
+#	$NetBSD: Makefile.minirootkmod,v 1.1 2012/10/16 08:19:36 apb Exp $
+#
+# Makefile snippet to build a miniroot kernel module (e.g. miniroot.kmod)
+#
+# Required variables:
+#	NETBSDSRCDIR	top level of src tree (set by bsd.own.mk)
+#
+# Optional variables:
+#	MINIROOT	Basename of the kernel module to be created.
+#			.kmod will be appended to get the file name.
+#			[default: miniroot]
+#	RAMDISK		Basename of the ramdisk to be embedded in the
+#			kernel module.  This is used as both a directory
+#			name (${.CURDIR}/../ramdisks/${RAMDISK}) and
+#			as a file name within the .OBJDIR of that
+#			directory (${RAMDISK}.fs).  [default: ramdisk]
+#
+
+MINIROOT?=	miniroot
+RAMDISK?=	ramdisk
+
+.include bsd.own.mk
+.include ${.PARSEDIR}/Makefile.distrib
+
+MKMAN=		no
+PROG=		${MINIROOT}.kmod
+
+# SRCMOD is a skeleton version of miniroot.kmod, without an embedded ramdisk.
+# It should already have been created by make install in
+# .../sys/modules/miniroot, and its name includes literal miniroot,
+# not variable ${MINIROOT}.
+#
+# DSTMOD is a copy of SRCMOD that is modified to include an embedded ramdisk.
+# It will be created by rules in this Makefile.
+#
+# RAMDISKFS is the ramdisk image to be included inside DSTMOD.  It should
+# already have been created by the Makefile in RAMDISKSRCDIR.
+#
+SRCMOD=		

CVS commit: src/distrib

2012-10-16 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Oct 16 08:23:21 UTC 2012

Modified Files:
src/distrib/amd64/ramdisks/common: Makefile.ramdisk
src/distrib/i386/ramdisks/common: Makefile.ramdisk
src/distrib/ofppc/ramdisks/common: Makefile.ramdisk

Log Message:
In distrib/*/ramdisks/common/Makefile.ramdisk, allow the caller to
pre-define the LISTS variable if they do not want it to include
${.CURDIR}/lists.  This opens the possibility of making some of the
many distrib/*/ramdisks/*/lists files shared in the future.

XXX: Some of the differences between these files seem to be unnecessary.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/distrib/amd64/ramdisks/common/Makefile.ramdisk
cvs rdiff -u -r1.10 -r1.11 src/distrib/i386/ramdisks/common/Makefile.ramdisk
cvs rdiff -u -r1.7 -r1.8 src/distrib/ofppc/ramdisks/common/Makefile.ramdisk

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

Modified files:

Index: src/distrib/amd64/ramdisks/common/Makefile.ramdisk
diff -u src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.9 src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.10
--- src/distrib/amd64/ramdisks/common/Makefile.ramdisk:1.9	Thu Feb 11 09:06:47 2010
+++ src/distrib/amd64/ramdisks/common/Makefile.ramdisk	Tue Oct 16 08:23:20 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ramdisk,v 1.9 2010/02/11 09:06:47 roy Exp $
+#	$NetBSD: Makefile.ramdisk,v 1.10 2012/10/16 08:23:20 apb Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
@@ -12,7 +12,10 @@ DBG=		-Os -fno-asynchronous-unwind-table
 CRUNCHGEN_FLAGS= -d ${DBG}
 
 CRUNCHBIN=	ramdiskbin
-LISTS=		${.CURDIR}/list ${AMD64COMMON}/list.ramdisk
+
+# Use ${.CURDIR}/list only if LISTS was not already defined by the caller.
+LISTS?=		${.CURDIR}/list
+LISTS+=		${AMD64COMMON}/list.ramdisk
 MTREECONF=	${DISTRIBDIR}/common/mtree.common
 IMAGEENDIAN=	le
 IMAGEDEPENDS+= 	${CRUNCHBIN} \

Index: src/distrib/i386/ramdisks/common/Makefile.ramdisk
diff -u src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.10 src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.11
--- src/distrib/i386/ramdisks/common/Makefile.ramdisk:1.10	Sun Apr 10 16:45:52 2011
+++ src/distrib/i386/ramdisks/common/Makefile.ramdisk	Tue Oct 16 08:23:21 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ramdisk,v 1.10 2011/04/10 16:45:52 joerg Exp $
+#	$NetBSD: Makefile.ramdisk,v 1.11 2012/10/16 08:23:21 apb Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
@@ -11,8 +11,10 @@ WARNS=		1
 DBG=		-Os
 
 CRUNCHBIN=	ramdiskbin
-LISTS=		${I386COMMON}/list.ramdisk
-LISTS+=		${.CURDIR}/list
+
+# Use ${.CURDIR}/list only if LISTS was not already defined by the caller.
+LISTS?=		${.CURDIR}/list
+LISTS+=		${I386COMMON}/list.ramdisk
 MTREECONF=	${DISTRIBDIR}/common/mtree.common
 IMAGEENDIAN=	le
 IMAGEDEPENDS+= 	${CRUNCHBIN} \

Index: src/distrib/ofppc/ramdisks/common/Makefile.ramdisk
diff -u src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.7 src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.8
--- src/distrib/ofppc/ramdisks/common/Makefile.ramdisk:1.7	Thu Feb 11 09:06:49 2010
+++ src/distrib/ofppc/ramdisks/common/Makefile.ramdisk	Tue Oct 16 08:23:21 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile.ramdisk,v 1.7 2010/02/11 09:06:49 roy Exp $
+#	$NetBSD: Makefile.ramdisk,v 1.8 2012/10/16 08:23:21 apb Exp $
 
 .include bsd.own.mk
 .include ${NETBSDSRCDIR}/distrib/common/Makefile.distrib
@@ -12,7 +12,10 @@ DBG=		-Os -fno-asynchronous-unwind-table
 CRUNCHGEN_FLAGS= -d ${DBG}
 
 CRUNCHBIN=	ramdiskbin
-LISTS=		${.CURDIR}/list ${OFPPCCOMMON}/list.ramdisk
+
+# Use ${.CURDIR}/list only if LISTS was not already defined by the caller.
+LISTS?=		${.CURDIR}/list
+LISTS+=		${OFPPCCOMMON}/list.ramdisk
 MTREECONF=	${DISTRIBDIR}/common/mtree.common ${.CURDIR}/../common/mtree.ramdisk
 IMAGEENDIAN=	le
 IMAGEDEPENDS+= 	${CRUNCHBIN} \



CVS commit: src/distrib/i386/ramdisks/common

2012-10-16 Thread Alan Barrett
Module Name:src
Committed By:   apb
Date:   Tue Oct 16 08:28:14 UTC 2012

Modified Files:
src/distrib/i386/ramdisks/common: list.ramdisk

Log Message:
Make i386/ramdisks/common/list.ramdisk identical to
amd64/ramdisks/common/list.ramdisk.

Previously, the amd64 list.ramdisk used the small version of gzip from
distrib/utils/x_gzip, while the i386 list.ramdisk used the full version
of gzip built from usr.bin/gzip, and also used extra libraries needed to
make that work.  Now, they both use the small version.

The only other difference was in the order of some PROG lines.


To generate a diff of this commit:
cvs rdiff -u -r1.23 -r1.24 src/distrib/i386/ramdisks/common/list.ramdisk

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

Modified files:

Index: src/distrib/i386/ramdisks/common/list.ramdisk
diff -u src/distrib/i386/ramdisks/common/list.ramdisk:1.23 src/distrib/i386/ramdisks/common/list.ramdisk:1.24
--- src/distrib/i386/ramdisks/common/list.ramdisk:1.23	Wed Aug 15 16:49:09 2012
+++ src/distrib/i386/ramdisks/common/list.ramdisk	Tue Oct 16 08:28:13 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: list.ramdisk,v 1.23 2012/08/15 16:49:09 riz Exp $
+#	$NetBSD: list.ramdisk,v 1.24 2012/10/16 08:28:13 apb Exp $
 
 SRCDIRS	external/bsd/less/bin
 SRCDIRS	bin sbin usr.bin usr.sbin libexec
@@ -28,8 +28,8 @@ PROG	sbin/ifconfig
 PROG	sbin/init
 PROG	sbin/mknod
 PROG	sbin/mount
-PROG	sbin/mount_ext2fs
 PROG	sbin/mount_cd9660
+PROG	sbin/mount_ext2fs
 PROG	sbin/mount_ffs
 # PROG	sbin/mount_kernfs
 PROG	sbin/mount_msdos
@@ -56,6 +56,7 @@ PROG	usr/bin/sed
 
 PROG	usr/sbin/chroot
 
+SPECIAL	gzip		srcdir	distrib/utils/x_gzip
 SPECIAL	ifconfig	srcdir	distrib/utils/x_ifconfig
 SPECIAL	ping		srcdir	distrib/utils/x_ping
 SPECIAL	route		srcdir	distrib/utils/x_route
@@ -65,7 +66,7 @@ SPECIAL	route		srcdir	distrib/utils/x_ro
 ARGVLN	sh -sh
 
 # libhack.o is built by Makefile  included Makefile.inc
-LIBS	libhack.o -lbz2 -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -llzma -lprop
+LIBS	libhack.o -ledit -lutil -lcurses -lterminfo -lrmt -lcrypt -ll -lm -lz -lprop
 
 # various files that we need in /etc for the install
 COPY	${NETBSDSRCDIR}/etc/group		etc/group



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

2012-10-16 Thread Radoslaw Kujawa
Module Name:src
Committed By:   rkujawa
Date:   Tue Oct 16 12:31:58 UTC 2012

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

Log Message:
Fix fallout from recent ed driver replacement. Makes amigappc build again.


To generate a diff of this commit:
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/amigappc/conf/files.amigappc

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/amigappc/conf/files.amigappc
diff -u src/sys/arch/amigappc/conf/files.amigappc:1.25 src/sys/arch/amigappc/conf/files.amigappc:1.26
--- src/sys/arch/amigappc/conf/files.amigappc:1.25	Wed Feb 15 12:11:43 2012
+++ src/sys/arch/amigappc/conf/files.amigappc	Tue Oct 16 12:31:57 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amigappc,v 1.25 2012/02/15 12:11:43 phx Exp $
+#	$NetBSD: files.amigappc,v 1.26 2012/10/16 12:31:57 rkujawa Exp $
 
 # maxpartitions must be first item in files.${ARCH}.newconf
 maxpartitions 16			# NOTE THAT AMIGA IS SPECIAL!
@@ -229,8 +229,8 @@ file	arch/amiga/dev/if_ne_zbus.c	ne_zbus
 
 # Hydra ethernet card
 device	ed: ifnet, ether, arp
-attach	ed at zbus with ed_zbus
-file	arch/amiga/dev/if_ed.c		ed_zbus needs-flag
+attach	ed at zbus with ed_zbus: dp8390nic
+file	arch/amiga/dev/if_ed_zbus.c	ed_zbus needs-flag
 
 # C=/Ameristar A2060 / 560
 attach	bah at zbus with bah_zbus



CVS commit: src/lib/librumphijack

2012-10-16 Thread Antti Kantee
Module Name:src
Committed By:   pooka
Date:   Tue Oct 16 12:56:10 UTC 2012

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

Log Message:
* avoid problems if the platform calls readlink() from dlsym()
* alias __read_chk() to read() on Linux (technically, though,
  it should call host __read_chk() instead of read())


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

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

Modified files:

Index: src/lib/librumphijack/hijack.c
diff -u src/lib/librumphijack/hijack.c:1.99 src/lib/librumphijack/hijack.c:1.100
--- src/lib/librumphijack/hijack.c:1.99	Wed Sep 12 10:35:10 2012
+++ src/lib/librumphijack/hijack.c	Tue Oct 16 12:56:10 2012
@@ -1,4 +1,4 @@
-/*  $NetBSD: hijack.c,v 1.99 2012/09/12 10:35:10 martin Exp $	*/
+/*  $NetBSD: hijack.c,v 1.100 2012/10/16 12:56:10 pooka Exp $	*/
 
 /*-
  * Copyright (c) 2011 Antti Kantee.  All Rights Reserved.
@@ -31,7 +31,7 @@
 #include rumpuser_port.h
 
 #include sys/cdefs.h
-__RCSID($NetBSD: hijack.c,v 1.99 2012/09/12 10:35:10 martin Exp $);
+__RCSID($NetBSD: hijack.c,v 1.100 2012/10/16 12:56:10 pooka Exp $);
 
 #include sys/param.h
 #include sys/types.h
@@ -1769,7 +1769,8 @@ REALSELECT(int nfds, fd_set *readfds, fd
 	int i, j;
 	int rv, incr;
 
-	DPRINTF((select\n));
+	DPRINTF((select %d %p %p %p %p\n, nfds,
+	readfds, writefds, exceptfds, timeout));
 
 	/*
 	 * Well, first we must scan the fds to figure out how many
@@ -1949,7 +1950,7 @@ REALPOLLTS(struct pollfd *fds, nfds_t nf
 	nfds_t i;
 	int rv;
 
-	DPRINTF((poll\n));
+	DPRINTF((poll %p %d %p %p\n, fds, (int)nfds, ts, sigmask));
 	checkpoll(fds, nfds, hostcall, rumpcall);
 
 	if (hostcall  rumpcall) {
@@ -2287,6 +2288,11 @@ FDCALL(ssize_t, REALREAD, DUALCALL_READ,
 	(int, void *, size_t),		\
 	(fd, buf, buflen))
 
+#ifdef __linux__
+ssize_t __read_chk(int, void *, size_t)
+__attribute__((alias(read)));
+#endif
+
 FDCALL(ssize_t, readv, DUALCALL_READV, 	\
 	(int fd, const struct iovec *iov, int iovcnt),			\
 	(int, const struct iovec *, int),\
@@ -2438,10 +2444,31 @@ PATHCALL(int, symlink, DUALCALL_SYMLINK,
 	(const char *, const char *),	\
 	(target, path))
 
-PATHCALL(ssize_t, readlink, DUALCALL_READLINK,\
-	(const char *path, char *buf, size_t bufsiz),			\
-	(const char *, char *, size_t),	\
-	(path, buf, bufsiz))
+/*
+ * readlink() can be called from malloc which can be called
+ * from dlsym() during init
+ */
+ssize_t
+readlink(const char *path, char *buf, size_t bufsiz)
+{
+	int (*op_readlink)(const char *, char *, size_t);
+	enum pathtype pt;
+
+	if ((pt = path_isrump(path)) != PATH_HOST) {
+		op_readlink = GETSYSCALL(rump, READLINK);
+		if (pt == PATH_RUMP)
+			path = path_host2rump(path);
+	} else {
+		op_readlink = GETSYSCALL(host, READLINK);
+	}
+
+	if (__predict_false(op_readlink == NULL)) {
+		errno = ENOENT;
+		return -1;
+	}
+
+	return op_readlink(path, buf, bufsiz);
+}
 
 PATHCALL(int, mkdir, DUALCALL_MKDIR,	\
 	(const char *path, mode_t mode),\



CVS commit: src/share/man/man3

2012-10-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 16 17:39:35 UTC 2012

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

Log Message:
Return value of __BIT() and __BITS() is not uint32_t but uint64_t.


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

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

Modified files:

Index: src/share/man/man3/bits.3
diff -u src/share/man/man3/bits.3:1.12 src/share/man/man3/bits.3:1.13
--- src/share/man/man3/bits.3:1.12	Sat Apr 30 19:34:10 2011
+++ src/share/man/man3/bits.3	Tue Oct 16 17:39:35 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: bits.3,v 1.12 2011/04/30 19:34:10 jym Exp $
+.\	$NetBSD: bits.3,v 1.13 2012/10/16 17:39:35 msaitoh Exp $
 .\
 .\ Copyright (c) 2006, 2010 David Young.  All rights reserved.
 .\
@@ -25,7 +25,7 @@
 .\ OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\ POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd April 8, 2011
+.Dd October 17, 2012
 .Dt BITS 3
 .Os
 .Sh NAME
@@ -38,9 +38,9 @@
 .Sh SYNOPSIS
 .In sys/param.h
 .In sys/cdefs.h
-.Ft uint32_t
+.Ft uint64_t
 .Fn __BIT n
-.Ft uint32_t
+.Ft uint64_t
 .Fn __BITS m n
 .Fn __SHIFTIN v mask
 .Fn __SHIFTOUT v mask



CVS commit: src/share/man/man3

2012-10-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 16 19:40:59 UTC 2012

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

Log Message:
Change to uintmax_t again.


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

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

Modified files:

Index: src/share/man/man3/bits.3
diff -u src/share/man/man3/bits.3:1.13 src/share/man/man3/bits.3:1.14
--- src/share/man/man3/bits.3:1.13	Tue Oct 16 17:39:35 2012
+++ src/share/man/man3/bits.3	Tue Oct 16 19:40:59 2012
@@ -1,4 +1,4 @@
-.\	$NetBSD: bits.3,v 1.13 2012/10/16 17:39:35 msaitoh Exp $
+.\	$NetBSD: bits.3,v 1.14 2012/10/16 19:40:59 msaitoh Exp $
 .\
 .\ Copyright (c) 2006, 2010 David Young.  All rights reserved.
 .\
@@ -38,9 +38,9 @@
 .Sh SYNOPSIS
 .In sys/param.h
 .In sys/cdefs.h
-.Ft uint64_t
+.Ft uintmax_t
 .Fn __BIT n
-.Ft uint64_t
+.Ft uintmax_t
 .Fn __BITS m n
 .Fn __SHIFTIN v mask
 .Fn __SHIFTOUT v mask



CVS commit: src/sys/dev/marvell

2012-10-16 Thread SAITOH Masanobu
Module Name:src
Committed By:   msaitoh
Date:   Tue Oct 16 19:49:41 UTC 2012

Modified Files:
src/sys/dev/marvell: if_mvgbe.c mvgbereg.h

Log Message:
Add code to modify interrupt coalescing with sysctl.
 - both TX side an RX side.
 - different setting for each port
 - TX side is hw.mvgbe.mvgbe*.ipginttx
 - RX side is hw.mvgbe.mvgbe*.ipgintrx
 - The default value is 768.
 - The lowest value is 0
 - For highest value, 0x3777 is used for V1, and 0x is used for V2.


To generate a diff of this commit:
cvs rdiff -u -r1.24 -r1.25 src/sys/dev/marvell/if_mvgbe.c
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/marvell/mvgbereg.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/marvell/if_mvgbe.c
diff -u src/sys/dev/marvell/if_mvgbe.c:1.24 src/sys/dev/marvell/if_mvgbe.c:1.25
--- src/sys/dev/marvell/if_mvgbe.c:1.24	Sun Oct 14 19:17:08 2012
+++ src/sys/dev/marvell/if_mvgbe.c	Tue Oct 16 19:49:41 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $	*/
+/*	$NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $	*/
 /*
  * Copyright (c) 2007, 2008 KIYOHARA Takashi
  * All rights reserved.
@@ -25,7 +25,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_mvgbe.c,v 1.24 2012/10/14 19:17:08 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_mvgbe.c,v 1.25 2012/10/16 19:49:41 msaitoh Exp $);
 
 #include sys/param.h
 #include sys/bus.h
@@ -35,6 +35,7 @@ __KERNEL_RCSID(0, $NetBSD: if_mvgbe.c,v
 #include sys/kmem.h
 #include sys/mutex.h
 #include sys/sockio.h
+#include sys/sysctl.h
 
 #include dev/marvell/marvellreg.h
 #include dev/marvell/marvellvar.h
@@ -137,6 +138,8 @@ do {	\
 	MVGBE_CDRXOFF((x)), sizeof(struct mvgbe_rx_desc), (ops));	\
 	} while (/*CONSTCOND*/0)
 
+#define MVGBE_IPGINTTX_DEFAULT	768
+#define MVGBE_IPGINTRX_DEFAULT	768
 
 struct mvgbe_jpool_entry {
 	int slot;
@@ -206,7 +209,8 @@ struct mvgbe_softc {
 	struct mvgbe_ring_data *sc_rdata;
 	bus_dmamap_t sc_ring_map;
 	int sc_if_flags;
-	int sc_ipg_rx;
+	unsigned int sc_ipginttx;
+	unsigned int sc_ipgintrx;
 	int sc_wdogsoft;
 
 	LIST_HEAD(__mvgbe_jfreehead, mvgbe_jpool_entry) sc_jfree_listhead;
@@ -214,6 +218,7 @@ struct mvgbe_softc {
 	SIMPLEQ_HEAD(__mvgbe_txmaphead, mvgbe_txmap_entry) sc_txmap_head;
 
 	krndsource_t sc_rnd_source;
+	struct sysctllog *mvgbe_clog;
 };
 
 
@@ -264,7 +269,11 @@ static void mvgbe_filter_setup(struct mv
 #ifdef MVGBE_DEBUG
 static void mvgbe_dump_txdesc(struct mvgbe_tx_desc *, int);
 #endif
-static uint32_t mvgbe_ipg_rx(struct mvgbec_softc *, struct mvgbe_softc *);
+static int mvgbe_ipginttx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int);
+static int mvgbe_ipgintrx(struct mvgbec_softc *, struct mvgbe_softc *, unsigned int);
+static void sysctl_mvgbe_init(struct mvgbe_softc *);
+static int mvgbe_sysctl_ipginttx(SYSCTLFN_PROTO);
+static int mvgbe_sysctl_ipgintrx(SYSCTLFN_PROTO);
 
 CFATTACH_DECL_NEW(mvgbec_gt, sizeof(struct mvgbec_softc),
 mvgbec_match, mvgbec_attach, NULL, NULL);
@@ -275,6 +284,7 @@ CFATTACH_DECL_NEW(mvgbe, sizeof(struct m
 mvgbe_match, mvgbe_attach, NULL, NULL);
 
 device_t mvgbec0 = NULL;
+static int mvgbe_root_num;
 
 struct mvgbe_port {
 	int model;
@@ -785,6 +795,7 @@ mvgbe_attach(device_t parent, device_t s
 	ether_ifattach(ifp, sc-sc_enaddr);
 	ether_set_ifflags_cb(sc-sc_ethercom, mvgbe_ifflags_cb);
 
+	sysctl_mvgbe_init(sc);
 	rnd_attach_source(sc-sc_rnd_source, device_xname(sc-sc_dev),
 	RND_TYPE_NET, 0);
 
@@ -805,17 +816,50 @@ fail1:
 	return;
 }
 
-static uint32_t
-mvgbe_ipg_rx(struct mvgbec_softc *csc, struct mvgbe_softc *sc)
+static int
+mvgbe_ipginttx(struct mvgbec_softc *csc, struct mvgbe_softc *sc,
+unsigned int ipginttx)
 {
+	uint32_t reg;
+	reg = MVGBE_READ(sc, MVGBE_PTFUT);
 
-	if (csc-sc_flags  FLAGS_IPG2)
-		return (((sc-sc_ipg_rx  0x8000)  10) |
-			((sc-sc_ipg_rx  0x7fff)  7));
-	else if (csc-sc_flags  FLAGS_IPG1)
-		return ((sc-sc_ipg_rx  0x3fff)  8);
-	else
-		return 0;
+	if (csc-sc_flags  FLAGS_IPG2) {
+		if (ipginttx  MVGBE_PTFUT_IPGINTTX_V2_MAX)
+			return -1;
+		reg = ~MVGBE_PTFUT_IPGINTTX_V2_MASK;
+		reg |= MVGBE_PTFUT_IPGINTTX_V2(ipginttx);
+	} else if (csc-sc_flags  FLAGS_IPG1) {
+		if (ipginttx  MVGBE_PTFUT_IPGINTTX_V1_MAX)
+			return -1;
+		reg = ~MVGBE_PTFUT_IPGINTTX_V1_MASK;
+		reg |= MVGBE_PTFUT_IPGINTTX_V1(ipginttx);
+	}
+	MVGBE_WRITE(sc, MVGBE_PTFUT, reg);
+
+	return 0;
+}
+
+static int
+mvgbe_ipgintrx(struct mvgbec_softc *csc, struct mvgbe_softc *sc,
+unsigned int ipgintrx)
+{
+	uint32_t reg;
+	reg = MVGBE_READ(sc, MVGBE_SDC);
+
+	if (csc-sc_flags  FLAGS_IPG2) {
+		if (ipgintrx  MVGBE_SDC_IPGINTRX_V2_MAX)
+			return -1;
+		reg = ~MVGBE_SDC_IPGINTRX_V2_MASK;
+		reg |= MVGBE_SDC_IPGINTRX_V2(ipgintrx);
+	} else if (csc-sc_flags  FLAGS_IPG1) {
+		if (ipgintrx  MVGBE_SDC_IPGINTRX_V1_MAX)
+			return -1;
+		reg = ~MVGBE_SDC_IPGINTRX_V1_MASK;
+		reg |= 

CVS commit: [tls-maxphys] src/sys/dev/raidframe

2012-10-16 Thread Thor Lancelot Simon
Module Name:src
Committed By:   tls
Date:   Wed Oct 17 01:36:13 UTC 2012

Modified Files:
src/sys/dev/raidframe [tls-maxphys]: rf_netbsdkintf.c

Log Message:
Add a minphys routine for raidframe.

For now, we will address the problem of someone adding, at runtime with
a filesystem mounted, a drive to an existing RAID set, that drive being
on a different controller or bus such that it has a smaller maximum
transfer size than the smallest such size of any component previously
in the set, by clamping RAIDframe's reported maximum transfer size at
the old MAXPHYS value multiplied by the number of data disks in the
set.

In the future, we could either implement transfer-splitting to
the device specific maxphys in a generic way for all disks (Manuel's
proposal, and probably the best solution) or simply forbid adding
new components to RAID sets while running if those new components
have a smaller maxphys than that of any component already in the set
(my proposal; less flexible but a lot less code to write).

Anyway, now you should be able to see your 5 disk RAID5 set do
256k transfers through the filesystem -- 64k per component
instead of 64K total.  A win!


To generate a diff of this commit:
cvs rdiff -u -r1.298 -r1.298.2.1 src/sys/dev/raidframe/rf_netbsdkintf.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_netbsdkintf.c
diff -u src/sys/dev/raidframe/rf_netbsdkintf.c:1.298 src/sys/dev/raidframe/rf_netbsdkintf.c:1.298.2.1
--- src/sys/dev/raidframe/rf_netbsdkintf.c:1.298	Thu Aug  9 23:53:25 2012
+++ src/sys/dev/raidframe/rf_netbsdkintf.c	Wed Oct 17 01:36:13 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: rf_netbsdkintf.c,v 1.298 2012/08/09 23:53:25 buhrow Exp $	*/
+/*	$NetBSD: rf_netbsdkintf.c,v 1.298.2.1 2012/10/17 01:36:13 tls Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2008-2011 The NetBSD Foundation, Inc.
@@ -101,7 +101,7 @@
  ***/
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.298 2012/08/09 23:53:25 buhrow Exp $);
+__KERNEL_RCSID(0, $NetBSD: rf_netbsdkintf.c,v 1.298.2.1 2012/10/17 01:36:13 tls Exp $);
 
 #ifdef _KERNEL_OPT
 #include opt_compat_netbsd.h
@@ -216,7 +216,9 @@ const struct cdevsw raid_cdevsw = {
 	nostop, notty, nopoll, nommap, nokqfilter, D_DISK
 };
 
-static struct dkdriver rf_dkdriver = { raidstrategy, minphys };
+static void	raidminphys(struct buf *);
+
+static struct dkdriver rf_dkdriver = { raidstrategy, raidminphys };
 
 /* XXX Not sure if the following should be replacing the raidPtrs above,
or if it should be used in conjunction with that...
@@ -925,7 +927,7 @@ raidread(dev_t dev, struct uio *uio, int
 	if ((rs-sc_flags  RAIDF_INITED) == 0)
 		return (ENXIO);
 
-	return (physio(raidstrategy, NULL, dev, B_READ, minphys, uio));
+	return (physio(raidstrategy, NULL, dev, B_READ, raidminphys, uio));
 
 }
 /* ARGSUSED */
@@ -942,7 +944,7 @@ raidwrite(dev_t dev, struct uio *uio, in
 	if ((rs-sc_flags  RAIDF_INITED) == 0)
 		return (ENXIO);
 
-	return (physio(raidstrategy, NULL, dev, B_WRITE, minphys, uio));
+	return (physio(raidstrategy, NULL, dev, B_WRITE, raidminphys, uio));
 
 }
 
@@ -3963,3 +3965,24 @@ rf_sync_component_caches(RF_Raid_t *raid
 	}
 	return error;
 }
+
+static void
+raidminphys(struct buf *bp)
+{
+	dev_t dev;
+	int unit;
+	struct raid_softc *rs;
+	RF_Raid_t *raidPtr;
+	long xmax;
+
+	dev = bp-b_dev;
+	unit = raidunit(dev);
+	rs = raid_softc[unit];
+	raidPtr = raidPtrs[unit];
+
+	xmax = raidPtr-Layout.numDataCol * MAXPHYS;
+
+	if (bp-b_bcount  xmax) {
+		bp-b_bcount = xmax;
+	}
+}