From owner-svn-src-user@FreeBSD.ORG  Sun Oct 19 06:10:01 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id CB2FD106568D;
	Sun, 19 Oct 2008 06:10:01 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B61A38FC08;
	Sun, 19 Oct 2008 06:10:01 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J6A1La035536;
	Sun, 19 Oct 2008 06:10:01 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J6A00i035501;
	Sun, 19 Oct 2008 06:10:00 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200810190610.m9J6A00i035501@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Sun, 19 Oct 2008 06:10:00 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184043 - in user/kmacy/HEAD_ECMP:
	gnu/usr.bin/gdb/arch/amd64 gnu/usr.bin/gdb/arch/i386
	lib/libarchive lib/libarchive/test lib/libc lib/libc/stdlib
	lib/libc/string lib/libkvm lib/libuti...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 19 Oct 2008 06:10:02 -0000

Author: kmacy
Date: Sun Oct 19 06:09:59 2008
New Revision: 184043
URL: http://svn.freebsd.org/changeset/base/184043

Log:
  IF_HEAD 183298:184042

Added:
  user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_freebsd.c
  user/kmacy/HEAD_ECMP/share/syscons/keymaps/eee_nordic.kbd
Modified:
  user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/amd64/Makefile
  user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/i386/Makefile
  user/kmacy/HEAD_ECMP/lib/libarchive/archive_write_disk.c
  user/kmacy/HEAD_ECMP/lib/libarchive/test/Makefile
  user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_basic.c
  user/kmacy/HEAD_ECMP/lib/libc/   (props changed)
  user/kmacy/HEAD_ECMP/lib/libc/stdlib/Makefile.inc
  user/kmacy/HEAD_ECMP/lib/libc/string/strxfrm.c
  user/kmacy/HEAD_ECMP/lib/libkvm/kvm.c
  user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_amd64.c
  user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_i386.c
  user/kmacy/HEAD_ECMP/lib/libutil/login_times.c
  user/kmacy/HEAD_ECMP/lib/libutil/logwtmp.c
  user/kmacy/HEAD_ECMP/lib/libutil/realhostname.c
  user/kmacy/HEAD_ECMP/sbin/dhclient/dhclient.c
  user/kmacy/HEAD_ECMP/sbin/dhclient/dhcp.h
  user/kmacy/HEAD_ECMP/sbin/dhclient/tables.c
  user/kmacy/HEAD_ECMP/share/man/man4/ddb.4
  user/kmacy/HEAD_ECMP/share/syscons/keymaps/INDEX.keymaps
  user/kmacy/HEAD_ECMP/sys/amd64/linux32/linux32_sysvec.c
  user/kmacy/HEAD_ECMP/sys/arm/arm/swtch.S
  user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-cyrix.c
  user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-marvell.c
  user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-national.c
  user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-serverworks.c
  user/kmacy/HEAD_ECMP/sys/dev/cxgb/cxgb_sge.c
  user/kmacy/HEAD_ECMP/sys/dev/mii/e1000phy.c
  user/kmacy/HEAD_ECMP/sys/dev/mmc/mmc.c
  user/kmacy/HEAD_ECMP/sys/dev/mmc/mmcreg.h
  user/kmacy/HEAD_ECMP/sys/dev/mmc/mmcsd.c
  user/kmacy/HEAD_ECMP/sys/dev/mmc/mmcvar.h
  user/kmacy/HEAD_ECMP/sys/dev/usb/usb_quirks.c
  user/kmacy/HEAD_ECMP/sys/dev/usb/usbdevs
  user/kmacy/HEAD_ECMP/sys/i386/i386/trap.c
  user/kmacy/HEAD_ECMP/sys/i386/include/cpufunc.h
  user/kmacy/HEAD_ECMP/sys/i386/include/trap.h
  user/kmacy/HEAD_ECMP/sys/i386/xen/locore.s
  user/kmacy/HEAD_ECMP/sys/i386/xen/xen_machdep.c
  user/kmacy/HEAD_ECMP/sys/kern/kern_fork.c
  user/kmacy/HEAD_ECMP/sys/kern/kern_prot.c
  user/kmacy/HEAD_ECMP/sys/kern/kern_synch.c
  user/kmacy/HEAD_ECMP/sys/kern/kern_thread.c
  user/kmacy/HEAD_ECMP/sys/kern/subr_trap.c
  user/kmacy/HEAD_ECMP/sys/kern/subr_witness.c
  user/kmacy/HEAD_ECMP/sys/kern/uipc_socket.c
  user/kmacy/HEAD_ECMP/sys/netinet/if_ether.c
  user/kmacy/HEAD_ECMP/sys/netinet/ip_divert.c
  user/kmacy/HEAD_ECMP/sys/netinet/raw_ip.c
  user/kmacy/HEAD_ECMP/sys/netinet/sctp_crc32.c
  user/kmacy/HEAD_ECMP/sys/netinet/sctp_output.c
  user/kmacy/HEAD_ECMP/sys/netinet/sctp_sysctl.c
  user/kmacy/HEAD_ECMP/sys/netinet/sctp_uio.h
  user/kmacy/HEAD_ECMP/sys/netinet/sctp_usrreq.c
  user/kmacy/HEAD_ECMP/sys/netinet/sctputil.c
  user/kmacy/HEAD_ECMP/sys/netinet/tcp_subr.c
  user/kmacy/HEAD_ECMP/sys/netinet/udp_usrreq.c
  user/kmacy/HEAD_ECMP/sys/security/mac/mac_framework.h
  user/kmacy/HEAD_ECMP/sys/security/mac/mac_inet.c
  user/kmacy/HEAD_ECMP/sys/security/mac/mac_policy.h
  user/kmacy/HEAD_ECMP/sys/security/mac_biba/mac_biba.c
  user/kmacy/HEAD_ECMP/sys/security/mac_lomac/mac_lomac.c
  user/kmacy/HEAD_ECMP/sys/security/mac_mls/mac_mls.c
  user/kmacy/HEAD_ECMP/sys/security/mac_partition/mac_partition.c
  user/kmacy/HEAD_ECMP/sys/security/mac_seeotheruids/mac_seeotheruids.c
  user/kmacy/HEAD_ECMP/sys/security/mac_stub/mac_stub.c
  user/kmacy/HEAD_ECMP/sys/security/mac_test/mac_test.c
  user/kmacy/HEAD_ECMP/sys/sys/systm.h
  user/kmacy/HEAD_ECMP/usr.bin/ministat/Makefile
  user/kmacy/HEAD_ECMP/usr.bin/ministat/ministat.c
  user/kmacy/HEAD_ECMP/usr.bin/netstat/inet.c
  user/kmacy/HEAD_ECMP/usr.bin/netstat/route.c
  user/kmacy/HEAD_ECMP/usr.sbin/pkg_install/add/main.c
  user/kmacy/HEAD_ECMP/usr.sbin/setfib/setfib.c
  user/kmacy/HEAD_ECMP/usr.sbin/sysinstall/keymap.c

Modified: user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/amd64/Makefile
==============================================================================
--- user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/amd64/Makefile	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/amd64/Makefile	Sun Oct 19 06:09:59 2008	(r184043)
@@ -7,7 +7,7 @@ LIBSRCS+= amd64-nat.c amd64bsd-nat.c amd
 .endif
 LIBSRCS+= solib.c solib-svr4.c
 LIBSRCS+= amd64-tdep.c amd64fbsd-tdep.c i386-tdep.c i386bsd-tdep.c \
-	i386fbsd-tdep-fixed.c	i387-tdep.c
+	i386fbsd-tdep-fixed.c i387-tdep.c
 
 nm.h:
 	echo '#include "i386/nm-fbsd64.h"' > ${.TARGET}
@@ -18,7 +18,7 @@ tm.h:
 xm.h:
 	echo '#include "i386/xm-i386.h"' > ${.TARGET}
 
+# Fix source static/extern mismatch nits that GCC 4.2 warns about.
+CLEANFILES+= i386fbsd-tdep-fixed.c
 i386fbsd-tdep-fixed.c: i386fbsd-tdep.c
 	sed -e '48s/^static //' ${.ALLSRC} > ${.TARGET}
-
-CLEANFILES+= i386fbsd-tdep-fixed.c

Modified: user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/i386/Makefile
==============================================================================
--- user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/i386/Makefile	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/gnu/usr.bin/gdb/arch/i386/Makefile	Sun Oct 19 06:09:59 2008	(r184043)
@@ -17,6 +17,7 @@ tm.h:
 xm.h:
 	echo '#include "i386/xm-i386.h"' > ${.TARGET}
 
+# Fix source static/extern mismatch nits that GCC 4.2 warns about.
+CLEANFILES += i386fbsd-tdep-fixed.c
 i386fbsd-tdep-fixed.c: i386fbsd-tdep.c
 	sed -e '48s/^static\ //' ${.ALLSRC} > ${.TARGET}
-CLEANFILES += i386fbsd-tdep-fixed.c

Modified: user/kmacy/HEAD_ECMP/lib/libarchive/archive_write_disk.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libarchive/archive_write_disk.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libarchive/archive_write_disk.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -710,10 +710,6 @@ _archive_write_finish_entry(struct archi
 		int r2 = set_mode(a, a->mode);
 		if (r2 < ret) ret = r2;
 	}
-	if (a->todo & TODO_TIMES) {
-		int r2 = set_times(a);
-		if (r2 < ret) ret = r2;
-	}
 	if (a->todo & TODO_ACLS) {
 		int r2 = set_acls(a);
 		if (r2 < ret) ret = r2;
@@ -726,6 +722,10 @@ _archive_write_finish_entry(struct archi
 		int r2 = set_fflags(a);
 		if (r2 < ret) ret = r2;
 	}
+	if (a->todo & TODO_TIMES) {
+		int r2 = set_times(a);
+		if (r2 < ret) ret = r2;
+	}
 
 	/* If there's an fd, we can close it now. */
 	if (a->fd >= 0) {

Modified: user/kmacy/HEAD_ECMP/lib/libarchive/test/Makefile
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libarchive/test/Makefile	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libarchive/test/Makefile	Sun Oct 19 06:09:59 2008	(r184043)
@@ -9,6 +9,7 @@ LA_SRCS!=make -f ${LA_SRCDIR}/Makefile -
 
 TESTS= \
 	test_acl_basic.c			\
+	test_acl_freebsd.c			\
 	test_acl_pax.c				\
 	test_archive_api_feature.c		\
 	test_bad_fd.c				\

Modified: user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_basic.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_basic.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_basic.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -27,8 +27,7 @@ __FBSDID("$FreeBSD$");
 
 /*
  * Exercise the system-independent portion of the ACL support.
- * Check that archive_entry objects can save and restore ACL data
- * and that pax archive can save and restore ACL data.
+ * Check that archive_entry objects can save and restore ACL data.
  *
  * This should work on all systems, regardless of whether local
  * filesystems support ACLs or not.
@@ -42,7 +41,7 @@ struct acl_t {
 	const char *name; /* Name of user/group, depending on tag. */
 };
 
-struct acl_t acls0[] = {
+static struct acl_t acls0[] = {
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
 	  ARCHIVE_ENTRY_ACL_USER_OBJ, 0, "" },
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
@@ -51,7 +50,7 @@ struct acl_t acls0[] = {
 	  ARCHIVE_ENTRY_ACL_OTHER, 0, "" },
 };
 
-struct acl_t acls1[] = {
+static struct acl_t acls1[] = {
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE,
 	  ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
@@ -62,7 +61,7 @@ struct acl_t acls1[] = {
 	  ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
 };
 
-struct acl_t acls2[] = {
+static struct acl_t acls2[] = {
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ,
 	  ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
 	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,

Added: user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_freebsd.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/kmacy/HEAD_ECMP/lib/libarchive/test/test_acl_freebsd.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -0,0 +1,243 @@
+/*-
+ * Copyright (c) 2003-2008 Tim Kientzle
+ * 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(S) ``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(S) 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 "test.h"
+__FBSDID("$FreeBSD$");
+
+#if defined(__FreeBSD__) && __FreeBSD__ > 4
+#include <sys/acl.h>
+
+struct myacl_t {
+	int type;  /* Type of ACL: "access" or "default" */
+	int permset; /* Permissions for this class of users. */
+	int tag; /* Owner, User, Owning group, group, other, etc. */
+	int qual; /* GID or UID of user/group, depending on tag. */
+	const char *name; /* Name of user/group, depending on tag. */
+};
+
+static struct myacl_t acls2[] = {
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_EXECUTE | ARCHIVE_ENTRY_ACL_READ,
+	  ARCHIVE_ENTRY_ACL_USER_OBJ, -1, "" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+	  ARCHIVE_ENTRY_ACL_USER, 77, "user77" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0,
+	  ARCHIVE_ENTRY_ACL_USER, 78, "user78" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, ARCHIVE_ENTRY_ACL_READ,
+	  ARCHIVE_ENTRY_ACL_GROUP_OBJ, -1, "" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS, 0007,
+	  ARCHIVE_ENTRY_ACL_GROUP, 78, "group78" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+	  ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_EXECUTE,
+	  ARCHIVE_ENTRY_ACL_OTHER, -1, "" },
+	{ ARCHIVE_ENTRY_ACL_TYPE_ACCESS,
+	  ARCHIVE_ENTRY_ACL_WRITE | ARCHIVE_ENTRY_ACL_READ | ARCHIVE_ENTRY_ACL_EXECUTE,
+	  ARCHIVE_ENTRY_ACL_MASK, -1, "" },
+	{ 0, 0, 0, 0, NULL }
+};
+
+static void
+set_acls(struct archive_entry *ae, struct myacl_t *acls)
+{
+	int i;
+
+	archive_entry_acl_clear(ae);
+	for (i = 0; acls[i].name != NULL; i++) {
+		archive_entry_acl_add_entry(ae,
+		    acls[i].type, acls[i].permset, acls[i].tag, acls[i].qual,
+		    acls[i].name);
+	}
+}
+
+static int
+acl_match(acl_entry_t aclent, struct myacl_t *myacl)
+{
+	acl_tag_t tag_type;
+	acl_permset_t opaque_ps;
+	int permset = 0;
+
+	acl_get_tag_type(aclent, &tag_type);
+
+	/* translate the silly opaque permset to a bitmap */
+	acl_get_permset(aclent, &opaque_ps);
+	if (acl_get_perm_np(opaque_ps, ACL_EXECUTE))
+		permset |= ARCHIVE_ENTRY_ACL_EXECUTE;
+	if (acl_get_perm_np(opaque_ps, ACL_WRITE))
+		permset |= ARCHIVE_ENTRY_ACL_WRITE;
+	if (acl_get_perm_np(opaque_ps, ACL_READ))
+		permset |= ARCHIVE_ENTRY_ACL_READ;
+
+	if (permset != myacl->permset)
+		return (0);
+
+	switch (tag_type) {
+	case ACL_USER_OBJ:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_USER_OBJ) return (0);
+		break;
+	case ACL_USER:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_USER)
+			return (0);
+		if ((uid_t)myacl->qual != *(uid_t *)acl_get_qualifier(aclent))
+			return (0);
+		break;
+	case ACL_GROUP_OBJ:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP_OBJ) return (0);
+		break;
+	case ACL_GROUP:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_GROUP)
+			return (0);
+		if ((gid_t)myacl->qual != *(gid_t *)acl_get_qualifier(aclent))
+			return (0);
+		break;
+	case ACL_MASK:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_MASK) return (0);
+		break;
+	case ACL_OTHER:
+		if (myacl->tag != ARCHIVE_ENTRY_ACL_OTHER) return (0);
+		break;
+	}
+	return (1);
+}
+
+static void
+compare_acls(acl_t acl, struct myacl_t *myacls)
+{
+	int *marker;
+	int entry_id = ACL_FIRST_ENTRY;
+	int matched;
+	int i, n;
+	acl_entry_t acl_entry;
+
+	/* Count ACL entries in myacls array and allocate an indirect array. */
+	for (n = 0; myacls[n].name != NULL; ++n)
+		continue;
+	marker = malloc(sizeof(marker[0]) * n);
+	for (i = 0; i < n; i++)
+		marker[i] = i;
+
+	/*
+	 * Iterate over acls in system acl object, try to match each
+	 * one with an item in the myacls array.
+	 */
+	while (1 == acl_get_entry(acl, entry_id, &acl_entry)) {
+		/* After the first time... */
+		entry_id = ACL_NEXT_ENTRY;
+
+		/* Search for a matching entry (tag and qualifier) */
+		for (i = 0, matched = 0; i < n && !matched; i++) {
+			if (acl_match(acl_entry, &myacls[marker[i]])) {
+				/* We found a match; remove it. */
+				marker[i] = marker[n - 1];
+				n--;
+				matched = 1;
+			}
+		}
+
+		/* TODO: Print out more details in this case. */
+		failure("ACL entry on file that shouldn't be there");
+		assert(matched == 1);
+	}
+
+	/* Dump entries in the myacls array that weren't in the system acl. */
+	for (i = 0; i < n; ++i) {
+		failure(" ACL entry missing from file: "
+		    "type=%d,permset=%d,tag=%d,qual=%d,name=``%s''\n",
+		    myacls[marker[i]].type, myacls[marker[i]].permset,
+		    myacls[marker[i]].tag, myacls[marker[i]].qual,
+		    myacls[marker[i]].name);
+		assert(0); /* Record this as a failure. */
+	}
+	free(marker);
+}
+
+#endif
+
+
+/*
+ * Verify ACL restore-to-disk.  This test is FreeBSD-specific.
+ */
+
+DEFINE_TEST(test_acl_freebsd)
+{
+#if !defined(__FreeBSD__)
+	skipping("FreeBSD-specific ACL restore test");
+#elif __FreeBSD__ < 5
+	skipping("ACL restore supported only on FreeBSD 5.0 and later");
+#else
+	struct stat st;
+	struct archive *a;
+	struct archive_entry *ae;
+	int n, fd;
+	acl_t acl;
+
+	/*
+	 * First, do a quick manual set/read of ACL data to
+	 * verify that the local filesystem does support ACLs.
+	 * If it doesn't, we'll simply skip the remaining tests.
+	 */
+	acl = acl_from_text("u::rwx,u:1:rw,g::rwx,g:15:rx,o::rwx,m::rwx");
+	assert((void *)acl != NULL);
+	/* Create a test file and try to set an ACL on it. */
+	fd = open("pretest", O_WRONLY | O_CREAT | O_EXCL, 0777);
+	failure("Could not create test file?!");
+	n = -1;
+	if (assert(fd >= 0)) {
+		n = acl_set_fd(fd, acl);
+		failure("acl_set_fd(): errno = %d (%s)",
+		    errno, strerror(errno));
+		assertEqualInt(0, n);
+		close(fd);
+	}
+
+	if (fd < 0 || n != 0) {
+		skipping("ACL tests require that ACL support be enabled on the filesystem");
+		return;
+	}
+
+	/* Create a write-to-disk object. */
+	assert(NULL != (a = archive_write_disk_new()));
+	archive_write_disk_set_options(a,
+	    ARCHIVE_EXTRACT_TIME | ARCHIVE_EXTRACT_PERM | ARCHIVE_EXTRACT_ACL);
+
+	/* Populate an archive entry with some metadata, including ACL info */
+	ae = archive_entry_new();
+	assert(ae != NULL);
+	archive_entry_set_pathname(ae, "test0");
+	archive_entry_set_mtime(ae, 123456, 7890);
+	archive_entry_set_size(ae, 0);
+	set_acls(ae, acls2);
+	assertEqualIntA(a, ARCHIVE_OK, archive_write_header(a, ae));
+	archive_entry_free(ae);
+
+	/* Close the archive. */
+	assertEqualIntA(a, ARCHIVE_OK, archive_write_close(a));
+	assertEqualInt(ARCHIVE_OK, archive_write_finish(a));
+
+	/* Verify the data on disk. */
+	assertEqualInt(0, stat("test0", &st));
+	assertEqualInt(st.st_mtime, 123456);
+	acl = acl_get_file("test0", ACL_TYPE_ACCESS);
+	assert(acl != (acl_t)NULL);
+	compare_acls(acl, acls2);
+#endif
+}

Modified: user/kmacy/HEAD_ECMP/lib/libc/stdlib/Makefile.inc
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libc/stdlib/Makefile.inc	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libc/stdlib/Makefile.inc	Sun Oct 19 06:09:59 2008	(r184043)
@@ -48,3 +48,8 @@ MLINKS+=strtoul.3 strtoull.3 strtoul.3 s
 MLINKS+=malloc.3 calloc.3 malloc.3 free.3 malloc.3 malloc.conf.5 \
 	malloc.3 realloc.3 malloc.3 reallocf.3 malloc.3 malloc_usable_size.3
 MLINKS+=tsearch.3 tdelete.3 tsearch.3 tfind.3 tsearch.3 twalk.3
+
+.if defined(MALLOC_PRODUCTION)
+CFLAGS+=	-DMALLOC_PRODUCTION
+.endif
+

Modified: user/kmacy/HEAD_ECMP/lib/libc/string/strxfrm.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libc/string/strxfrm.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libc/string/strxfrm.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -51,8 +51,7 @@ strxfrm(char * __restrict dest, const ch
 			if (slen < len)
 				strcpy(dest, src);
 			else {
-				strncpy(dest, src, len - 1);
-				dest[len - 1] = '\0';
+				strlcpy(dest, src, len);
 			}
 		}
 		return slen;

Modified: user/kmacy/HEAD_ECMP/lib/libkvm/kvm.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libkvm/kvm.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libkvm/kvm.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -244,11 +244,10 @@ kvm_openfiles(uf, mf, sf, flag, errout)
 {
 	kvm_t *kd;
 
-	if ((kd = malloc(sizeof(*kd))) == NULL) {
+	if ((kd = calloc(1, sizeof(*kd))) == NULL) {
 		(void)strlcpy(errout, strerror(errno), _POSIX2_LINE_MAX);
 		return (0);
 	}
-	memset(kd, 0, sizeof(*kd));
 	kd->program = 0;
 	return (_kvm_open(kd, uf, mf, flag, errout));
 }
@@ -263,13 +262,12 @@ kvm_open(uf, mf, sf, flag, errstr)
 {
 	kvm_t *kd;
 
-	if ((kd = malloc(sizeof(*kd))) == NULL) {
+	if ((kd = calloc(1, sizeof(*kd))) == NULL) {
 		if (errstr != NULL)
 			(void)fprintf(stderr, "%s: %s\n",
 				      errstr, strerror(errno));
 		return (0);
 	}
-	memset(kd, 0, sizeof(*kd));
 	kd->program = errstr;
 	return (_kvm_open(kd, uf, mf, flag, NULL));
 }

Modified: user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_amd64.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_amd64.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_amd64.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -146,7 +146,6 @@ _kvm_minidump_initvtop(kvm_t *kd)
 		return (-1);
 	}
 	kd->vmst = vmst;
-	bzero(vmst, sizeof(*vmst));
 	vmst->minidump = 1;
 	if (pread(kd->pmfd, &vmst->hdr, sizeof(vmst->hdr), 0) !=
 	    sizeof(vmst->hdr)) {

Modified: user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_i386.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_i386.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libkvm/kvm_minidump_i386.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -148,7 +148,6 @@ _kvm_minidump_initvtop(kvm_t *kd)
 		return (-1);
 	}
 	kd->vmst = vmst;
-	bzero(vmst, sizeof(*vmst));
 	vmst->minidump = 1;
 	if (pread(kd->pmfd, &vmst->hdr, sizeof(vmst->hdr), 0) !=
 	    sizeof(vmst->hdr)) {

Modified: user/kmacy/HEAD_ECMP/lib/libutil/login_times.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libutil/login_times.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libutil/login_times.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -72,8 +72,7 @@ parse_lt(const char * str)
 	char		buf[64];
 
 	/* Make local copy and force lowercase to simplify parsing */
-	p = strncpy(buf, str, sizeof buf);
-	buf[sizeof buf - 1] = '\0';
+	p = strlcpy(buf, str, sizeof buf);
 	for (i = 0; buf[i]; i++)
 	    buf[i] = (char)tolower(buf[i]);
 

Modified: user/kmacy/HEAD_ECMP/lib/libutil/logwtmp.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libutil/logwtmp.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libutil/logwtmp.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -59,8 +59,7 @@ logwtmp(const char *line, const char *na
 	char   fullhost[MAXHOSTNAMELEN];
 	int fd;
 	
-	strncpy(fullhost, host, sizeof(fullhost) - 1);	
-	fullhost[sizeof(fullhost) - 1] = '\0';
+	strlcpy(fullhost, host, sizeof(fullhost));	
 	trimdomain(fullhost, UT_HOSTSIZE);
 	host = fullhost;
 

Modified: user/kmacy/HEAD_ECMP/lib/libutil/realhostname.c
==============================================================================
--- user/kmacy/HEAD_ECMP/lib/libutil/realhostname.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/lib/libutil/realhostname.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -61,8 +61,7 @@ realhostname(char *host, size_t hsize, c
 		if (strlen(trimmed) <= hsize) {
 			char lookup[MAXHOSTNAMELEN];
 
-			strncpy(lookup, hp->h_name, sizeof(lookup) - 1);
-			lookup[sizeof(lookup) - 1] = '\0';
+			strlcpy(lookup, hp->h_name, sizeof(lookup));
 			hp = gethostbyname(lookup);
 			if (hp == NULL)
 				result = HOSTNAME_INVALIDNAME;

Modified: user/kmacy/HEAD_ECMP/sbin/dhclient/dhclient.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sbin/dhclient/dhclient.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sbin/dhclient/dhclient.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -2317,12 +2317,16 @@ check_option(struct client_lease *l, int
 	case DHO_NETBIOS_DD_SERVER:
 	case DHO_FONT_SERVERS:
 	case DHO_DHCP_SERVER_IDENTIFIER:
+	case DHO_NISPLUS_SERVERS:
+	case DHO_MOBILE_IP_HOME_AGENT:
 	case DHO_SMTP_SERVER:
 	case DHO_POP_SERVER:
 	case DHO_NNTP_SERVER:
 	case DHO_WWW_SERVER:
 	case DHO_FINGER_SERVER:
 	case DHO_IRC_SERVER:
+	case DHO_STREETTALK_SERVER:
+	case DHO_STREETTALK_DA_SERVER:
 		if (!ipv4addrs(opbuf)) {
 			warning("Invalid IP address in option: %s", opbuf);
 			return (0);
@@ -2330,6 +2334,8 @@ check_option(struct client_lease *l, int
 		return (1)  ;
 	case DHO_HOST_NAME:
 	case DHO_NIS_DOMAIN:
+	case DHO_NISPLUS_DOMAIN:
+	case DHO_TFTP_SERVER_NAME:
 		if (!res_hnok(sbuf)) {
 			warning("Bogus Host Name option %d: %s (%s)", option,
 			    sbuf, opbuf);
@@ -2388,6 +2394,7 @@ check_option(struct client_lease *l, int
 	case DHO_DHCP_REBINDING_TIME:
 	case DHO_DHCP_CLASS_IDENTIFIER:
 	case DHO_DHCP_CLIENT_IDENTIFIER:
+	case DHO_BOOTFILE_NAME:
 	case DHO_DHCP_USER_CLASS_ID:
 	case DHO_END:
 		return (1);

Modified: user/kmacy/HEAD_ECMP/sbin/dhclient/dhcp.h
==============================================================================
--- user/kmacy/HEAD_ECMP/sbin/dhclient/dhcp.h	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sbin/dhclient/dhcp.h	Sun Oct 19 06:09:59 2008	(r184043)
@@ -155,12 +155,19 @@ struct dhcp_packet {
 #define DHO_DHCP_REBINDING_TIME		59
 #define DHO_DHCP_CLASS_IDENTIFIER	60
 #define DHO_DHCP_CLIENT_IDENTIFIER	61
+#define	DHO_NISPLUS_DOMAIN		64
+#define	DHO_NISPLUS_SERVERS		65
+#define	DHO_TFTP_SERVER_NAME		66
+#define	DHO_BOOTFILE_NAME		67
+#define	DHO_MOBILE_IP_HOME_AGENT	68
 #define DHO_SMTP_SERVER			69
 #define DHO_POP_SERVER			70
 #define DHO_NNTP_SERVER			71
 #define DHO_WWW_SERVER			72
 #define DHO_FINGER_SERVER		73
 #define DHO_IRC_SERVER			74
+#define	DHO_STREETTALK_SERVER		75
+#define	DHO_STREETTALK_DA_SERVER	76
 #define DHO_DHCP_USER_CLASS_ID		77
 #define DHO_CLASSLESS_ROUTES		121
 #define DHO_END				255

Modified: user/kmacy/HEAD_ECMP/sbin/dhclient/tables.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sbin/dhclient/tables.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sbin/dhclient/tables.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -387,13 +387,25 @@ unsigned char dhcp_option_default_priori
 	DHO_FONT_SERVERS,
 	DHO_X_DISPLAY_MANAGER,
 	DHO_DHCP_PARAMETER_REQUEST_LIST,
+	DHO_NISPLUS_DOMAIN,
+	DHO_NISPLUS_SERVERS,
+	DHO_TFTP_SERVER_NAME,
+	DHO_BOOTFILE_NAME,
+	DHO_MOBILE_IP_HOME_AGENT,
+	DHO_SMTP_SERVER,
+	DHO_POP_SERVER,
+	DHO_NNTP_SERVER,
+	DHO_WWW_SERVER,
+	DHO_FINGER_SERVER,
+	DHO_IRC_SERVER,
+	DHO_STREETTALK_SERVER,
+	DHO_STREETTALK_DA_SERVER,
 
 	/* Presently-undefined options... */
-	62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
-	78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92,
-	93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106,
-	107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118,
-	119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
+	62, 63, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
+	92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105,
+	106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117,
+	118, 119, 120, 122, 123, 124, 125, 126, 127, 128, 129, 130,
 	131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142,
 	143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
 	155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166,

Modified: user/kmacy/HEAD_ECMP/share/man/man4/ddb.4
==============================================================================
--- user/kmacy/HEAD_ECMP/share/man/man4/ddb.4	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/share/man/man4/ddb.4	Sun Oct 19 06:09:59 2008	(r184043)
@@ -60,7 +60,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 4, 2008
+.Dd October 18, 2008
 .Dt DDB 4
 .Os
 .Sh NAME

Modified: user/kmacy/HEAD_ECMP/share/syscons/keymaps/INDEX.keymaps
==============================================================================
--- user/kmacy/HEAD_ECMP/share/syscons/keymaps/INDEX.keymaps	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/share/syscons/keymaps/INDEX.keymaps	Sun Oct 19 06:09:59 2008	(r184043)
@@ -99,6 +99,8 @@ danish.cp865.kbd:fr:Danois Code page 865
 danish.cp865.kbd:pt:Dinamarqu阺 Codepage 865
 danish.cp865.kbd:es:Dan閟 Codepage 865
 
+eee_nordic.kbd:en:Nordic layout on Asus eeePC
+
 el.iso07.kbd:en:Greek ISO-8859-7 (104 keys)
 el.iso07.kbd:el:烹腌黹挈 ISO-8859-7 (104 痣揸赳)
 

Added: user/kmacy/HEAD_ECMP/share/syscons/keymaps/eee_nordic.kbd
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/kmacy/HEAD_ECMP/share/syscons/keymaps/eee_nordic.kbd	Sun Oct 19 06:09:59 2008	(r184043)
@@ -0,0 +1,131 @@
+# $FreeBSD$
+#                                                         alt
+# scan                       cntrl          alt    alt   cntrl lock
+# code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
+# ------------------------------------------------------------------
+  000   nop    nop    nop    nop    nop    nop    nop    nop     O
+  001   esc    esc    esc    esc    esc    esc    debug  esc     O
+  002   '1'    '!'    nop    nop    nop    nop    nop    nop     O
+  003   '2'    '"'    nul    nul    '@'    '@'    nul    nul     O
+  004   '3'    '#'    nop    nop    163    nop    nop    nop     O
+  005   '4'    164    nop    nop    '$'    nop    nop    nop     O
+  006   '5'    '%'    nop    nop    nop    nop    nop    nop     O
+  007   '6'    '&'    nop    nop    nop    nop    nop    nop     O
+# Alt + Shift + 7 = 梅
+  008   '7'    '/'    nop    nop    '{'    '梅'    nop    nop     O
+  009   '8'    '('    nop    nop    '['    nop    nop    nop     O
+  010   '9'    ')'    nop    nop    ']'    nop    gs     nop     O
+  011   '0'    '='    nop    nop    '}'    nop    nop    nop     O
+  012   '+'    '?'    nop    nop    '\'    nop    fs     nop     O
+# For left of backspace key, gives with Alt=' and Alt+Shift+Key=|
+  013   128    '`'    nop    nop    39     '|'    nop    nop     O
+  014   bs     bs     del    del    bs     bs     del    del     O
+  015   ht     btab   nop    nop    ht     btab   nop    nop     O
+  016   'q'    'Q'    dc1    dc1    'q'    'Q'    dc1    dc1     C
+  017   'w'    'W'    etb    etb    'w'    'W'    etb    etb     C
+# Alt + Ctrl + E = French e (as in caf茅)
+  018   'e'    'E'    enq    enq    164    'E'    '茅'    enq     C
+# Alt + R = Copyright sign
+  019   'r'    'R'    dc2    dc2    '庐'    'R'    dc2    dc2     C
+  020   't'    'T'    dc4    dc4    't'    'T'    dc4    dc4     C
+  021   'y'    'Y'    em     em     'y'    'Y'    em     em      C
+# Alt + U = Mikro,  Alt + Shift + U = German u
+  022   'u'    'U'    nak    nak    '碌'    'U'    '眉'    '脺'     C
+  023   'i'    'I'    ht     ht     'i'    'I'    ht     ht      C
+# Alt + O = Norwegian/Danish 脰
+  024   'o'    'O'    si     si     '酶'    '脴'    si     si      C
+# Alt + P = Pi
+  025   'p'    'P'    dle    dle    '露'    'P'    dle    dle     C
+  026   229    197    nop    nop    '}'    ']'    nop    nop     C
+  027   168    '^'    nop    nop    '~'    nop    nop    nop     O
+  028   cr     cr     nl     nl     cr     cr     nl     nl      O
+  029   lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl  lctrl   O
+# Alt + A = At sign,  Ctrl+Alt = ae,  Ctrl+Alt+Shift = AE
+  030   'a'    'A'    soh    soh    '@'    'A'    '忙'    '脝'     C
+  031   's'    'S'    dc3    dc3    's'    'S'    dc3    dc3     C
+  032   'd'    'D'    eot    eot    'd'    'D'    eot    eot     C
+  033   'f'    'F'    ack    ack    'f'    'F'    ack    ack     C
+  034   'g'    'G'    bel    bel    'g'    'G'    bel    bel     C
+  035   'h'    'H'    bs     bs     'h'    'H'    bs     bs      C
+  036   'j'    'J'    nl     nl     'j'    'J'    nl     nl      C
+  037   'k'    'K'    vt     vt     'k'    'K'    vt     vt      C
+  038   'l'    'L'    ff     ff     'l'    'L'    ff     ff      C
+  039   246    214    nop    nop    '|'    '\'    nop    nop     C
+  040   228    196    nop    nop    '{'    '['    nop    nop     C
+  041   167    189    nop    nop    '\'    '|'    nop    nop     O
+  042   lshift lshift lshift lshift lshift lshift lshift lshift  O
+  043   '''    '*'    nop    nop    nop    nop    nop    nop     O
+# Alt + Z = Pipe
+  044   'z'    'Z'    sub    sub    '|'    'Z'    sub    sub     C
+  045   'x'    'X'    can    can    'x'    'X'    can    can     C
+  046   'c'    'C'    etx    etx    'c'    'C'    etx    etx     C
+  047   'v'    'V'    syn    syn    'v'    'V'    syn    syn     C
+# Ctrl + Shift + B = German B
+  048   'b'    'B'    stx    '脽'    'b'    'B'    stx    stx     C
+  049   'n'    'N'    so     so     'n'    'N'    so     so      C
+# Alt + M = Mikro
+  050   'm'    'M'    cr     cr     181    'M'    cr     cr      C
+# Alt + [,/;] = <
+  051   ','    ';'    nop    nop    '<'    '<'    nop    nop     O
+# Alt + [./:] = >
+  052   '.'    ':'    nop    nop    '>'    '>'    nop    nop     O
+  053   '-'    '_'    us     nop    '/'    '?'    nop    nop     O
+  054   rshift rshift rshift rshift rshift rshift rshift rshift  O
+  055   '*'    '*'    '*'    '*'    '*'    '*'    '*'    '*'     O
+  056   lalt   lalt   lalt   lalt   lalt   lalt   lalt   lalt    O
+  057   ' '    ' '    nul    ' '    ' '    ' '    susp   ' '     O
+  058   clock  clock  clock  clock  clock  clock  clock  clock   O
+  059   fkey01 fkey13 fkey25 fkey37 scr01  scr11  scr01  scr11   O
+  060   fkey02 fkey14 fkey26 fkey38 scr02  scr12  scr02  scr12   O
+  061   fkey03 fkey15 fkey27 fkey39 scr03  scr13  scr03  scr13   O
+  062   fkey04 fkey16 fkey28 fkey40 scr04  scr14  scr04  scr14   O
+  063   fkey05 fkey17 fkey29 fkey41 scr05  scr15  scr05  scr15   O
+  064   fkey06 fkey18 fkey30 fkey42 scr06  scr16  scr06  scr16   O
+  065   fkey07 fkey19 fkey31 fkey43 scr07  scr07  scr07  scr07   O
+  066   fkey08 fkey20 fkey32 fkey44 scr08  scr08  scr08  scr08   O
+  067   fkey09 fkey21 fkey33 fkey45 scr09  scr09  scr09  scr09   O
+  068   fkey10 fkey22 fkey34 fkey46 scr10  scr10  scr10  scr10   O
+  069   nlock  nlock  nlock  nlock  nlock  nlock  nlock  nlock   O
+  070   slock  slock  slock  slock  slock  slock  slock  slock   O
+  071   fkey49 '7'    '7'    '7'    '7'    '7'    '7'    '7'     N
+  072   fkey50 '8'    '8'    '8'    '8'    '8'    '8'    '8'     N
+  073   fkey51 '9'    '9'    '9'    '9'    '9'    '9'    '9'     N
+  074   fkey52 '-'    '-'    '-'    '-'    '-'    '-'    '-'     N
+  075   fkey53 '4'    '4'    '4'    '4'    '4'    '4'    '4'     N
+  076   fkey54 '5'    '5'    '5'    '5'    '5'    '5'    '5'     N
+  077   fkey55 '6'    '6'    '6'    '6'    '6'    '6'    '6'     N
+  078   fkey56 '+'    '+'    '+'    '+'    '+'    '+'    '+'     N
+  079   fkey57 '1'    '1'    '1'    '1'    '1'    '1'    '1'     N
+  080   fkey58 '2'    '2'    '2'    '2'    '2'    '2'    '2'     N
+  081   fkey59 '3'    '3'    '3'    '3'    '3'    '3'    '3'     N
+  082   fkey60 '0'    '0'    '0'    '0'    '0'    '0'    '0'     N
+  083   del    '.'    '.'    '.'    '.'    '.'    boot   boot    N
+  084   nop    nop    nop    nop    nop    nop    nop    nop     O
+  085   nop    nop    nop    nop    nop    nop    nop    nop     O
+  086   '<'    '>'    nop    nop    '|'    nop    nop    nop     O
+  087   fkey11 fkey23 fkey35 fkey47 scr11  scr11  scr11  scr11   O
+  088   fkey12 fkey24 fkey36 fkey48 scr12  scr12  scr12  scr12   O
+  089   cr     cr     nl     nl     cr     cr     nl     nl      O
+  090   rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl  rctrl   O
+  091   '/'    '/'    '/'    '/'    '/'    '/'    '/'    '/'     N
+  092   nscr   pscr   debug  debug  nop    nop    nop    nop     O
+  093   ralt   ralt   ralt   ralt   ralt   ralt   ralt   ralt    O
+  094   fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49 fkey49  O
+# Alt+Arrow up = Page up
+  095   fkey50 fkey50 fkey50 fkey50 fkey51 fkey50 fkey50 fkey50  O
+  096   fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51 fkey51  O
+# Alt+Arrow left = Home
+  097   fkey53 fkey53 fkey53 fkey53 fkey49 fkey53 fkey53 fkey53  O
+# Alt+Arrow right = End
+  098   fkey55 fkey55 fkey55 fkey55 fkey57 fkey55 fkey55 fkey55  O
+  099   fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57 fkey57  O
+# Alt+Arrow down = Page down
+  100   fkey58 fkey58 fkey58 fkey58 fkey59 fkey58 fkey58 fkey58  O
+  101   fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59 fkey59  O
+  102   fkey60 paste  fkey60 fkey60 fkey60 fkey60 fkey60 fkey60  O
+  103	fkey61 fkey61 fkey61 fkey61 fkey61 fkey61 boot   fkey61  O
+  104   slock  saver  slock  saver  susp   nop    susp   nop     O
+  105   fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62 fkey62  O
+  106   fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63 fkey63  O
+  107   fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64 fkey64  O
+  108   nop    nop    nop    nop    nop    nop    nop    nop     O

Modified: user/kmacy/HEAD_ECMP/sys/amd64/linux32/linux32_sysvec.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/amd64/linux32/linux32_sysvec.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/amd64/linux32/linux32_sysvec.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -843,7 +843,8 @@ exec_linux_setregs(td, entry, stack, ps_
 	fpstate_drop(td);
 
 	/* Return via doreti so that we can change to a different %cs */
-	pcb->pcb_flags |= PCB_FULLCTX;
+	pcb->pcb_flags |= PCB_FULLCTX | PCB_32BIT;
+	pcb->pcb_flags &= ~PCB_GS32BIT;
 	td->td_retval[1] = 0;
 }
 

Modified: user/kmacy/HEAD_ECMP/sys/arm/arm/swtch.S
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/arm/arm/swtch.S	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/arm/arm/swtch.S	Sun Oct 19 06:09:59 2008	(r184043)
@@ -143,8 +143,6 @@ ENTRY(cpu_throw)
 	ldr	r9, .Lcpufuncs
 	mov	lr, pc
 	ldr	pc, [r9, #CF_IDCACHE_WBINV_ALL]
-	mov	lr, pc
-	ldr	pc, [r9, #CF_L2CACHE_WBINV_ALL]
 	ldr	r0, [r7, #(PCB_PL1VEC)]
 	ldr	r1, [r7, #(PCB_DACR)]
 	/*
@@ -174,8 +172,6 @@ ENTRY(cpu_throw)
 	movne	r1, #4
 	movne	lr, pc
 	ldrne	pc, [r9, #CF_DCACHE_WB_RANGE]
-	movne	lr, pc
-	ldrne	pc, [r9, #CF_L2CACHE_WB_RANGE]
 #endif /* PMAP_INCLUDE_PTE_SYNC */
 
 	/*
@@ -332,8 +328,6 @@ ENTRY(cpu_switch)
 	ldr	r1, .Lcpufuncs
 	mov	lr, pc
 	ldr	pc, [r1, #CF_IDCACHE_WBINV_ALL]
-	mov	lr, pc
-	ldr	pc, [r1, #CF_L2CACHE_WBINV_ALL]
 .Lcs_cache_purge_skipped:
 	/* rem: r6 = lock */
 	/* rem: r9 = new PCB */
@@ -366,8 +360,6 @@ ENTRY(cpu_switch)
 	mov	r1, #4
 	mov	lr, pc
 	ldr	pc, [r2, #CF_DCACHE_WB_RANGE]
-	mov	lr, pc
-	ldr	pc, [r2, #CF_L2CACHE_WB_RANGE]
 
 .Lcs_same_vector:
 #endif /* PMAP_INCLUDE_PTE_SYNC */

Modified: user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-cyrix.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-cyrix.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-cyrix.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -109,7 +109,7 @@ ata_cyrix_setmode(device_t dev, int mode
 	/* dont try to set the mode if we dont have the resource */
 	if (ctlr->r_res1) {
 	    ch->dma.alignment = 16;
-	    ch->dma.max_iosize = 126 * DEV_BSIZE;
+	    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
 	    if (mode >= ATA_UDMA0) {
 		ATA_OUTL(ch->r_io[ATA_BMCMD_PORT].res,

Modified: user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-marvell.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-marvell.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-marvell.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -536,7 +536,7 @@ ata_marvell_edma_dmainit(device_t dev)
 	ch->dma.max_address = BUS_SPACE_MAXADDR;
 
     /* chip does not reliably do 64K DMA transfers */
-    ch->dma.max_iosize = 126 * DEV_BSIZE; 
+    ch->dma.max_iosize = 64 * DEV_BSIZE; 
 }
 
 ATA_DECLARE_DRIVER(ata_marvell);

Modified: user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-national.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-national.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-national.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -101,7 +101,7 @@ ata_national_setmode(device_t dev, int m
     int error;
 
     ch->dma.alignment = 16;
-    ch->dma.max_iosize = 126 * DEV_BSIZE;
+    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
     mode = ata_limit_mode(dev, mode, ATA_UDMA2);
 

Modified: user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-serverworks.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-serverworks.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/ata/chipsets/ata-serverworks.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -79,7 +79,7 @@ ata_serverworks_probe(device_t dev)
      { ATA_CSB6,      0x00, SWKS_100, 0, ATA_UDMA5, "CSB6" },
      { ATA_CSB6_1,    0x00, SWKS_66,  0, ATA_UDMA4, "CSB6" },
      { ATA_HT1000,    0x00, SWKS_100, 0, ATA_UDMA5, "HT1000" },
-     { ATA_HT1000_S1, 0x00, SWKS_100, 4, ATA_SA150, "HT1000" },
+     { ATA_HT1000_S1, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" },
      { ATA_HT1000_S2, 0x00, SWKS_MIO, 4, ATA_SA150, "HT1000" },
      { ATA_K2,        0x00, SWKS_MIO, 4, ATA_SA150, "K2" },
      { ATA_FRODO4,    0x00, SWKS_MIO, 4, ATA_SA150, "Frodo4" },
@@ -184,7 +184,7 @@ ata_serverworks_allocate(device_t dev)
     ch->hw.tf_write = ata_serverworks_tf_write;
 
     /* chip does not reliably do 64K DMA transfers */
-    ch->dma.max_iosize = 126 * DEV_BSIZE;
+    ch->dma.max_iosize = 64 * DEV_BSIZE;
 
     return 0;
 }

Modified: user/kmacy/HEAD_ECMP/sys/dev/cxgb/cxgb_sge.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/cxgb/cxgb_sge.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/cxgb/cxgb_sge.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -1887,7 +1887,11 @@ t3_free_tx_desc(struct sge_txq *q, int r
 			m_freem_iovec(&txsd->mi);	
 			buf_ring_scan(&q->txq_mr, txsd->mi.mi_base, __FILE__, __LINE__);
 			txsd->mi.mi_base = NULL;
-
+			/*
+			 * XXX check for cache hit rate here
+			 *
+			 */
+			q->port->ifp->if_opackets++;
 #if defined(DIAGNOSTIC) && 0
 			if (m_get_priority(txsd->m[0]) != cidx) 
 				printf("pri=%d cidx=%d\n",
@@ -2505,6 +2509,7 @@ t3_rx_eth(struct adapter *adap, struct s
 	
 	m->m_pkthdr.rcvif = ifp;
 	m->m_pkthdr.header = mtod(m, uint8_t *) + sizeof(*cpl) + ethpad;
+	ifp->if_ipackets++;
 #ifndef DISABLE_MBUF_IOVEC
 	m_explode(m);
 #endif	

Modified: user/kmacy/HEAD_ECMP/sys/dev/mii/e1000phy.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/mii/e1000phy.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/mii/e1000phy.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -153,6 +153,20 @@ e1000phy_attach(device_t dev)
 		if (PHY_READ(sc, E1000_ESSR) & E1000_ESSR_FIBER_LINK)
 			sc->mii_flags |= MIIF_HAVEFIBER;
 		break;
+	case MII_MODEL_MARVELL_E1149:
+		/*
+		 * Some 88E1149 PHY's page select is initialized to
+		 * point to other bank instead of copper/fiber bank
+		 * which in turn resulted in wrong registers were
+		 * accessed during PHY operation. It is believed that
+		 * page 0 should be used for copper PHY so reinitialize
+		 * E1000_EADR to select default copper PHY. If parent
+		 * device know the type of PHY(either copper or fiber),
+		 * that information should be used to select default
+		 * type of PHY.
+		 */
+		PHY_WRITE(sc, E1000_EADR, 0);
+		break;
 	case MII_MODEL_MARVELL_E3082:
 		/* 88E3082 10/100 Fast Ethernet PHY. */
 		sc->mii_anegticks = MII_ANEGTICKS;

Modified: user/kmacy/HEAD_ECMP/sys/dev/mmc/mmc.c
==============================================================================
--- user/kmacy/HEAD_ECMP/sys/dev/mmc/mmc.c	Sun Oct 19 01:35:27 2008	(r184042)
+++ user/kmacy/HEAD_ECMP/sys/dev/mmc/mmc.c	Sun Oct 19 06:09:59 2008	(r184043)
@@ -85,11 +85,13 @@ struct mmc_ivars {
 	uint32_t raw_csd[4];	/* Raw bits of the CSD */
 	uint32_t raw_scr[2];	/* Raw bits of the SCR */
 	uint8_t raw_ext_csd[512];	/* Raw bits of the EXT_CSD */
+	uint32_t raw_sd_status[16];	/* Raw bits of the SD_STATUS */
 	uint16_t rca;
 	enum mmc_card_mode mode;
 	struct mmc_cid cid;	/* cid decoded */
 	struct mmc_csd csd;	/* csd decoded */
 	struct mmc_scr scr;	/* scr decoded */
+	struct mmc_sd_status sd_status;	/* SD_STATUS decoded */
 	u_char read_only;	/* True when the device is read-only */
 	u_char bus_width;	/* Bus width to use */
 	u_char timing;		/* Bus timing support */
@@ -97,6 +99,7 @@ struct mmc_ivars {
 	uint32_t sec_count;	/* Card capacity in 512byte blocks */
 	uint32_t tran_speed;	/* Max speed in normal mode */
 	uint32_t hs_tran_speed;	/* Max speed in high speed mode */
+	uint32_t erase_sector;	/* Card native erase sector size */
 };
 
 #define CMD_RETRIES	3
@@ -723,9 +726,8 @@ mmc_test_bus_width(struct mmc_softc *sc)
 }
 
 static uint32_t
-mmc_get_bits(uint32_t *bits, int start, int size)
+mmc_get_bits(uint32_t *bits, int bit_len, int start, int size)
 {
-	const int bit_len = 128;
 	const int i = (bit_len / 32) - (start / 32) - 1;
 	const int shift = start & 31;
 	uint32_t retval = bits[i] >> shift;
@@ -741,14 +743,14 @@ mmc_decode_cid_sd(uint32_t *raw_cid, str
 
 	/* There's no version info, so we take it on faith */
 	memset(cid, 0, sizeof(*cid));
-	cid->mid = mmc_get_bits(raw_cid, 120, 8);
-	cid->oid = mmc_get_bits(raw_cid, 104, 16);
+	cid->mid = mmc_get_bits(raw_cid, 128, 120, 8);
+	cid->oid = mmc_get_bits(raw_cid, 128, 104, 16);
 	for (i = 0; i < 5; i++)
-		cid->pnm[i] = mmc_get_bits(raw_cid, 96 - i * 8, 8);
-	cid->prv = mmc_get_bits(raw_cid, 56, 8);
-	cid->psn = mmc_get_bits(raw_cid, 24, 32);
-	cid->mdt_year = mmc_get_bits(raw_cid, 12, 8) + 2001;
-	cid->mdt_month = mmc_get_bits(raw_cid, 8, 4);
+		cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8);
+	cid->prv = mmc_get_bits(raw_cid, 128, 56, 8);
+	cid->psn = mmc_get_bits(raw_cid, 128, 24, 32);
+	cid->mdt_year = mmc_get_bits(raw_cid, 128, 12, 8) + 2001;
+	cid->mdt_month = mmc_get_bits(raw_cid, 128, 8, 4);
 }
 
 static void
@@ -758,14 +760,14 @@ mmc_decode_cid_mmc(uint32_t *raw_cid, st
 
 	/* There's no version info, so we take it on faith */
 	memset(cid, 0, sizeof(*cid));
-	cid->mid = mmc_get_bits(raw_cid, 120, 8);
-	cid->oid = mmc_get_bits(raw_cid, 104, 8);
+	cid->mid = mmc_get_bits(raw_cid, 128, 120, 8);
+	cid->oid = mmc_get_bits(raw_cid, 128, 104, 8);
 	for (i = 0; i < 6; i++)
-		cid->pnm[i] = mmc_get_bits(raw_cid, 96 - i * 8, 8);
-	cid->prv = mmc_get_bits(raw_cid, 48, 8);
-	cid->psn = mmc_get_bits(raw_cid, 16, 32);
-	cid->mdt_month = mmc_get_bits(raw_cid, 12, 4);
-	cid->mdt_year = mmc_get_bits(raw_cid, 8, 4) + 1997;
+		cid->pnm[i] = mmc_get_bits(raw_cid, 128, 96 - i * 8, 8);
+	cid->prv = mmc_get_bits(raw_cid, 128, 48, 8);
+	cid->psn = mmc_get_bits(raw_cid, 128, 16, 32);
+	cid->mdt_month = mmc_get_bits(raw_cid, 128, 12, 4);
+	cid->mdt_year = mmc_get_bits(raw_cid, 128, 8, 4) + 1997;
 }
 
 static const int exp[8] = {
@@ -789,58 +791,58 @@ mmc_decode_csd_sd(uint32_t *raw_csd, str
 	int e;
 
 	memset(csd, 0, sizeof(*csd));
-	csd->csd_structure = v = mmc_get_bits(raw_csd, 126, 2);
+	csd->csd_structure = v = mmc_get_bits(raw_csd, 128, 126, 2);
 	if (v == 0) {
-		m = mmc_get_bits(raw_csd, 115, 4);
-		e = mmc_get_bits(raw_csd, 112, 3);
+		m = mmc_get_bits(raw_csd, 128, 115, 4);
+		e = mmc_get_bits(raw_csd, 128, 112, 3);
 		csd->tacc = exp[e] * mant[m] + 9 / 10;
-		csd->nsac = mmc_get_bits(raw_csd, 104, 8) * 100;
-		m = mmc_get_bits(raw_csd, 99, 4);
-		e = mmc_get_bits(raw_csd, 96, 3);
+		csd->nsac = mmc_get_bits(raw_csd, 128, 104, 8) * 100;
+		m = mmc_get_bits(raw_csd, 128, 99, 4);
+		e = mmc_get_bits(raw_csd, 128, 96, 3);
 		csd->tran_speed = exp[e] * 10000 * mant[m];
-		csd->ccc = mmc_get_bits(raw_csd, 84, 12);
-		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 80, 4);
-		csd->read_bl_partial = mmc_get_bits(raw_csd, 79, 1);
-		csd->write_blk_misalign = mmc_get_bits(raw_csd, 78, 1);
-		csd->read_blk_misalign = mmc_get_bits(raw_csd, 77, 1);
-		csd->dsr_imp = mmc_get_bits(raw_csd, 76, 1);
-		csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 59, 3)];
-		csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 56, 3)];
-		csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 53, 3)];
-		csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 50, 3)];
-		m = mmc_get_bits(raw_csd, 62, 12);
-		e = mmc_get_bits(raw_csd, 47, 3);
+		csd->ccc = mmc_get_bits(raw_csd, 128, 84, 12);
+		csd->read_bl_len = 1 << mmc_get_bits(raw_csd, 128, 80, 4);
+		csd->read_bl_partial = mmc_get_bits(raw_csd, 128, 79, 1);
+		csd->write_blk_misalign = mmc_get_bits(raw_csd, 128, 78, 1);
+		csd->read_blk_misalign = mmc_get_bits(raw_csd, 128, 77, 1);
+		csd->dsr_imp = mmc_get_bits(raw_csd, 128, 76, 1);
+		csd->vdd_r_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 59, 3)];
+		csd->vdd_r_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 56, 3)];
+		csd->vdd_w_curr_min = cur_min[mmc_get_bits(raw_csd, 128, 53, 3)];
+		csd->vdd_w_curr_max = cur_max[mmc_get_bits(raw_csd, 128, 50, 3)];
+		m = mmc_get_bits(raw_csd, 128, 62, 12);
+		e = mmc_get_bits(raw_csd, 128, 47, 3);
 		csd->capacity = ((1 + m) << (e + 2)) * csd->read_bl_len;
-		csd->erase_blk_en = mmc_get_bits(raw_csd, 46, 1);
-		csd->sector_size = mmc_get_bits(raw_csd, 39, 7);
-		csd->wp_grp_size = mmc_get_bits(raw_csd, 32, 7);
-		csd->wp_grp_enable = mmc_get_bits(raw_csd, 31, 1);
-		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 26, 3);
-		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 22, 4);
-		csd->write_bl_partial = mmc_get_bits(raw_csd, 21, 1);
+		csd->erase_blk_en = mmc_get_bits(raw_csd, 128, 46, 1);
+		csd->erase_sector = mmc_get_bits(raw_csd, 128, 39, 7) + 1;
+		csd->wp_grp_size = mmc_get_bits(raw_csd, 128, 32, 7);
+		csd->wp_grp_enable = mmc_get_bits(raw_csd, 128, 31, 1);
+		csd->r2w_factor = 1 << mmc_get_bits(raw_csd, 128, 26, 3);
+		csd->write_bl_len = 1 << mmc_get_bits(raw_csd, 128, 22, 4);
+		csd->write_bl_partial = mmc_get_bits(raw_csd, 128, 21, 1);
 	} else if (v == 1) {
-		m = mmc_get_bits(raw_csd, 115, 4);
-		e = mmc_get_bits(raw_csd, 112, 3);
+		m = mmc_get_bits(raw_csd, 128, 115, 4);
+		e = mmc_get_bits(raw_csd, 128, 112, 3);
 		csd->tacc = exp[e] * mant[m] + 9 / 10;
-		csd->nsac = mmc_get_bits(raw_csd, 104, 8) * 100;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Sun Oct 19 06:12:47 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BF59C106568E;
	Sun, 19 Oct 2008 06:12:47 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 962128FC18;
	Sun, 19 Oct 2008 06:12:47 +0000 (UTC)
	(envelope-from kmacy@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J6ClJu035619;
	Sun, 19 Oct 2008 06:12:47 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J6ClQk035618;
	Sun, 19 Oct 2008 06:12:47 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <200810190612.m9J6ClQk035618@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Sun, 19 Oct 2008 06:12:47 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184044 - user/kmacy/HEAD_fast_xmit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 19 Oct 2008 06:12:47 -0000

Author: kmacy
Date: Sun Oct 19 06:12:47 2008
New Revision: 184044
URL: http://svn.freebsd.org/changeset/base/184044

Log:
  Speed up IP xmit by eliminating route lookup and arpresolve from the common case packet transmit path

Added:
  user/kmacy/HEAD_fast_xmit/
     - copied from r184043, user/kmacy/HEAD_ECMP/

From owner-svn-src-user@FreeBSD.ORG  Sun Oct 19 08:38:02 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7BDBA106573B;
	Sun, 19 Oct 2008 08:37:58 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 717F18FC0A;
	Sun, 19 Oct 2008 08:37:58 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J8bwJk038243;
	Sun, 19 Oct 2008 08:37:58 GMT (envelope-from nyan@svn.freebsd.org)
Received: (from nyan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J8bwb7038241;
	Sun, 19 Oct 2008 08:37:58 GMT (envelope-from nyan@svn.freebsd.org)
Message-Id: <200810190837.m9J8bwb7038241@svn.freebsd.org>
From: Takahashi Yoshihiro <nyan@FreeBSD.org>
Date: Sun, 19 Oct 2008 08:37:58 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184050 - user/nyan/pc98/sys/pc98/pc98
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 19 Oct 2008 08:38:02 -0000

Author: nyan
Date: Sun Oct 19 08:37:58 2008
New Revision: 184050
URL: http://svn.freebsd.org/changeset/base/184050

Log:
  Add the machdep.ad_geom_method tunable to select the method of the IDE HDD
  geometry conversion.
  
  Submitted by:	kato

Modified:
  user/nyan/pc98/sys/pc98/pc98/pc98_machdep.c
  user/nyan/pc98/sys/pc98/pc98/pc98_machdep.h

Modified: user/nyan/pc98/sys/pc98/pc98/pc98_machdep.c
==============================================================================
--- user/nyan/pc98/sys/pc98/pc98/pc98_machdep.c	Sun Oct 19 08:37:51 2008	(r184049)
+++ user/nyan/pc98/sys/pc98/pc98/pc98_machdep.c	Sun Oct 19 08:37:58 2008	(r184050)
@@ -36,15 +36,23 @@
 #include <sys/param.h>
 #include <sys/systm.h>
 
-#include <cam/cam.h>
-#include <cam/cam_ccb.h>
 #include <sys/bio.h>
 #include <sys/bus.h>
 #include <sys/conf.h>
+#include <sys/kernel.h>
+#include <sys/sysctl.h>
+#include <cam/cam.h>
+#include <cam/cam_ccb.h>
 #include <geom/geom_disk.h>
 #include <machine/md_var.h>
 #include <pc98/pc98/pc98_machdep.h>
 
+static	int	ad_geom_method = AD_GEOM_ADJUST_COMPATIDE;
+
+TUNABLE_INT("machdep.ad_geom_method", &ad_geom_method);
+SYSCTL_INT(_machdep, OID_AUTO, ad_geom_method, CTLFLAG_RW, &ad_geom_method, 0,
+    "IDE disk geometry conversion method");
+
 /*
  * Initialize DMA controller
  */
@@ -198,12 +206,62 @@ scsi_da_bios_params(struct ccb_calc_geom
 }
 
 /*
- * Get the geometry of the ATA HDD from the BIOS work area.
- *
- * XXX for now, we hack it
+ * Adjust the geometry of the IDE HDD.
  */
-void
-pc98_ad_firmware_geom_adjust(device_t dev, struct disk *disk)
+
+/* IDE BIOS compatible mode. */
+static	void
+pc98_ad_geom_adjust_idebios(struct disk *disk)
+{
+
+	if (disk->d_mediasize < MEDIASIZE_4_3G) {
+		disk->d_fwsectors = 17;
+		disk->d_fwheads = 8;
+	} else if (disk->d_mediasize < MEDIASIZE_29_5G) {
+		disk->d_fwsectors = 63;
+		if (disk->d_fwheads != 15)	/* Allow 15H63S. */
+			disk->d_fwheads = 16;
+	} else if (disk->d_mediasize < MEDIASIZE_31_5G) {
+		disk->d_fwsectors = 63;
+		disk->d_fwheads = 16;
+	} else if (disk->d_mediasize < MEDIASIZE_127G) {
+		disk->d_fwsectors = 255;
+		disk->d_fwheads = 16;
+	} else {
+		/* XXX */
+		disk->d_fwsectors = 255;
+		disk->d_fwheads = 255;
+	}
+}
+
+/* SCSI BIOS compatible mode. */
+static	void
+pc98_ad_geom_adjust_scsibios(struct disk *disk)
+{
+
+	if (disk->d_mediasize < MEDIASIZE_8G) {
+		disk->d_fwsectors = 32;
+		disk->d_fwheads = 8;
+	} else if (disk->d_mediasize < MEDIASIZE_32G) {
+		disk->d_fwsectors = 128;
+		disk->d_fwheads = 8;
+	} else if (disk->d_mediasize < MEDIASIZE_60G) {
+		/* Compatible with IFC-USP 1.2. */
+		disk->d_fwsectors = 128;
+		disk->d_fwheads = 15;
+	} else if (disk->d_mediasize < MEDIASIZE_120G) {
+		disk->d_fwsectors = 255;
+		disk->d_fwheads = 15;
+	} else {
+		/* XXX */
+		disk->d_fwsectors = 255;
+		disk->d_fwheads = 255;
+	}
+}
+
+/* Compatible with the revision 1.28. */
+static	void
+pc98_ad_geom_adjust_cyl16bit(struct disk *disk)
 {
 	off_t totsec = disk->d_mediasize / disk->d_sectorsize;
 	off_t cyl = totsec / disk->d_fwsectors / disk->d_fwheads;
@@ -229,3 +287,35 @@ pc98_ad_firmware_geom_adjust(device_t de
 		}
 	}
 }
+
+void
+pc98_ad_firmware_geom_adjust(device_t dev, struct disk *disk)
+{
+	u_int	oldsectors, oldheads;
+
+	oldsectors = disk->d_fwsectors;
+	oldheads = disk->d_fwheads;
+
+	switch (ad_geom_method) {
+	case AD_GEOM_ADJUST_COMPATIDE:
+		pc98_ad_geom_adjust_idebios(disk);
+		break;
+	case AD_GEOM_ADJUST_COMPATSCSI:
+		pc98_ad_geom_adjust_scsibios(disk);
+		break;
+	case AD_GEOM_ADJUST_COMPATCYL16:
+		pc98_ad_geom_adjust_cyl16bit(disk);
+		break;
+	default:
+		/* Do nothing. */
+		break;
+	}
+
+	if (bootverbose &&
+	    (oldsectors != disk->d_fwsectors || oldheads != disk->d_fwheads))
+		device_printf(dev,
+		    "geometry adjusted from [%dH/%dS] to [%dH/%dS]\n",
+		    oldheads, oldsectors,
+		    disk->d_fwheads, disk->d_fwsectors);
+
+}

Modified: user/nyan/pc98/sys/pc98/pc98/pc98_machdep.h
==============================================================================
--- user/nyan/pc98/sys/pc98/pc98/pc98_machdep.h	Sun Oct 19 08:37:51 2008	(r184049)
+++ user/nyan/pc98/sys/pc98/pc98/pc98_machdep.h	Sun Oct 19 08:37:58 2008	(r184050)
@@ -85,6 +85,21 @@ extern unsigned char	pc98_system_paramet
 #define EPSON_PC486_SR		0x38
 #define EPSON_PC486_HA		0x3b
 
+/* IDE HDD geometry conversion. */
+#define	AD_GEOM_ADJUST_NONE		0	/* Do nothing. */
+#define	AD_GEOM_ADJUST_COMPATIDE	1	/* PC-98 IDE BIOS. */
+#define	AD_GEOM_ADJUST_COMPATSCSI	2	/* PC-98 SCSI. */
+#define	AD_GEOM_ADJUST_COMPATCYL16	100	/* Compat Rev. 1.28. */
+
+#define	MEDIASIZE_4_3G		(4351LL * 1024LL * 1024LL)      /* 4351M */
+#define	MEDIASIZE_8G		(8192LL * 1024LL * 1024LL)      /* 8192M */
+#define	MEDIASIZE_29_5G		(30239LL * 1024LL * 1024LL)	/* 30239M */
+#define	MEDIASIZE_31_5G		(32255LL * 1024 * 1024)         /* 32255M */
+#define	MEDIASIZE_32G		(32768LL * 1024LL * 1024LL)     /* 32768M */
+#define	MEDIASIZE_60G		(61440LL * 1024LL * 1024LL)     /* 61440M */
+#define	MEDIASIZE_120G		(122400LL * 1024LL * 1024LL)    /* 122400M */
+#define	MEDIASIZE_127G		(130558LL * 1024LL * 1024LL)    /* 130558M */
+
 #endif /* _KERNEL */
 
 #endif /* __PC98_PC98_PC98_MACHDEP_H__ */

From owner-svn-src-user@FreeBSD.ORG  Sun Oct 19 08:39:09 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 7A5E9106568E;
	Sun, 19 Oct 2008 08:39:09 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 665618FC15;
	Sun, 19 Oct 2008 08:39:09 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J8d9pJ038307;
	Sun, 19 Oct 2008 08:39:09 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J8d96Y038302;
	Sun, 19 Oct 2008 08:39:09 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200810190839.m9J8d96Y038302@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Sun, 19 Oct 2008 08:39:09 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184051 - in user/edwin/releasenotes: .
	releng-6.1/release/doc/en_US.ISO8859-1/relnotes
	releng-6.2/release/doc/en_US.ISO8859-1/relnotes
	releng-7.0/release/doc/en_US.ISO8859-1/relnotes s...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 19 Oct 2008 08:39:09 -0000

Author: edwin
Date: Sun Oct 19 08:39:08 2008
New Revision: 184051
URL: http://svn.freebsd.org/changeset/base/184051

Log:
  Be able to find the branches to compare (temporary commit, tomorrow
  I'll be on the train again!)

Modified:
  user/edwin/releasenotes/contrib-xmltoent.pl
  user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile

Modified: user/edwin/releasenotes/contrib-xmltoent.pl
==============================================================================
--- user/edwin/releasenotes/contrib-xmltoent.pl	Sun Oct 19 08:37:58 2008	(r184050)
+++ user/edwin/releasenotes/contrib-xmltoent.pl	Sun Oct 19 08:39:08 2008	(r184051)
@@ -167,10 +167,30 @@ if (!defined $branches{$releaseent{"rele
 }
 
 #
-# Find all MFVs which are done in the time that 
+# Changes in software versions are determined as follows:
 #
+# For version N.M and M != 0, compare against branches{N.(M-1)}
+# For version N.0, compare against branches{(N-1)}
+# For version N, compare against branches{(N-1)}
+#
+my $thisversion = $releaseent{"release.current"};
+my $prevversion = "";
 
+# XXX - This fails for 5.2.1
+if ($thisversion =~ /^(\d+)\.(\d+)/) {
+	my $major = $1;
+	my $minor = $2;
+	if ($minor eq "0") {
+		$prevversion = $major - 1;
+	} else {
+		$prevversion = sprintf("%d.%d", $major, $minor - 1);
+	}
+} elsif ($thisversion =~ /^(\d+)$/) {
+	$prevversion = $1 - 1;
+}
 
-print Dumper(%branches);
-print Dumper(%releaseent);
+print "$thisversion - $prevversion\n";
+print "$branches{$thisversion} - $branches{$prevversion}\n";
+#print Dumper(%branches);
+#print Dumper(%releaseent);
 #print Dumper(%softwares);

Modified: user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:37:58 2008	(r184050)
+++ user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:39:08 2008	(r184051)
@@ -9,5 +9,8 @@ SUBDIR+= i386
 SUBDIR+= pc98
 SUBDIR+= sparc64
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
 .include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:37:58 2008	(r184050)
+++ user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:39:08 2008	(r184051)
@@ -9,5 +9,8 @@ SUBDIR+= i386
 SUBDIR+= pc98
 SUBDIR+= sparc64
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
 .include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:37:58 2008	(r184050)
+++ user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:39:08 2008	(r184051)
@@ -18,6 +18,9 @@ JADEFLAGS+=	-V %generate-article-toc%
 # SGML content
 SRCS+=	article.sgml
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 URL_RELPREFIX?=	../../../..
 
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"

Modified: user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:37:58 2008	(r184050)
+++ user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile	Sun Oct 19 08:39:08 2008	(r184051)
@@ -18,6 +18,9 @@ JADEFLAGS+=	-V %generate-article-toc%
 # SGML content
 SRCS+=	article.sgml
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 URL_RELPREFIX?=	../../../..
 
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"

From owner-svn-src-user@FreeBSD.ORG  Sun Oct 19 09:42:10 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 69AE41065687;
	Sun, 19 Oct 2008 09:42:10 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 56EF08FC08;
	Sun, 19 Oct 2008 09:42:10 +0000 (UTC)
	(envelope-from nyan@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9J9gA7G039548;
	Sun, 19 Oct 2008 09:42:10 GMT (envelope-from nyan@svn.freebsd.org)
Received: (from nyan@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9J9gAsS039541;
	Sun, 19 Oct 2008 09:42:10 GMT (envelope-from nyan@svn.freebsd.org)
Message-Id: <200810190942.m9J9gAsS039541@svn.freebsd.org>
From: Takahashi Yoshihiro <nyan@FreeBSD.org>
Date: Sun, 19 Oct 2008 09:42:10 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184056 - in user/nyan/pc98/sys: conf dev/ic dev/uart
	modules/uart pc98/conf pc98/pc98
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sun, 19 Oct 2008 09:42:10 -0000

Author: nyan
Date: Sun Oct 19 09:42:09 2008
New Revision: 184056
URL: http://svn.freebsd.org/changeset/base/184056

Log:
  Add an experimental i8251 support.
  It does not work yet.

Added:
  user/nyan/pc98/sys/dev/uart/uart_dev_i8251.c   (contents, props changed)
  user/nyan/pc98/sys/dev/uart/uart_dev_i8251.h   (contents, props changed)
Modified:
  user/nyan/pc98/sys/conf/files
  user/nyan/pc98/sys/dev/ic/i8251.h
  user/nyan/pc98/sys/dev/uart/uart.h
  user/nyan/pc98/sys/dev/uart/uart_core.c
  user/nyan/pc98/sys/dev/uart/uart_cpu_pc98.c
  user/nyan/pc98/sys/dev/uart/uart_subr.c
  user/nyan/pc98/sys/modules/uart/Makefile
  user/nyan/pc98/sys/pc98/conf/DEFAULTS
  user/nyan/pc98/sys/pc98/conf/GENERIC
  user/nyan/pc98/sys/pc98/conf/GENERIC.hints
  user/nyan/pc98/sys/pc98/pc98/busiosubr.c

Modified: user/nyan/pc98/sys/conf/files
==============================================================================
--- user/nyan/pc98/sys/conf/files	Sun Oct 19 09:10:44 2008	(r184055)
+++ user/nyan/pc98/sys/conf/files	Sun Oct 19 09:42:09 2008	(r184056)
@@ -1297,6 +1297,7 @@ dev/uart/uart_bus_puc.c		optional uart p
 dev/uart/uart_bus_scc.c		optional uart scc
 dev/uart/uart_core.c		optional uart
 dev/uart/uart_dbg.c		optional uart gdb
+dev/uart/uart_dev_i8251.c	optional uart uart_i8251
 dev/uart/uart_dev_ns8250.c	optional uart uart_ns8250
 dev/uart/uart_dev_quicc.c	optional uart quicc
 dev/uart/uart_dev_sab82532.c	optional uart uart_sab82532

Modified: user/nyan/pc98/sys/dev/ic/i8251.h
==============================================================================
--- user/nyan/pc98/sys/dev/ic/i8251.h	Sun Oct 19 09:10:44 2008	(r184055)
+++ user/nyan/pc98/sys/dev/ic/i8251.h	Sun Oct 19 09:42:09 2008	(r184056)
@@ -69,6 +69,7 @@
 #define	STS8251_FE	0x20	/* framing error */
 #define	STS8251_BI	0x40	/* break detect */
 #define	STS8251_DSR	0x80	/* DSR is asserted */
+#define	STS8251_RCV_ERR	0x78
 
 /* i8251F line status register */
 #define	FLSR_TxEMP	0x01	/* transmit buffer EMPTY */
@@ -77,6 +78,7 @@
 #define	FLSR_OE		0x10	/* overrun error */
 #define	FLSR_PE		0x20	/* perity error */
 #define	FLSR_BI		0x80	/* break detect */
+#define	FLSR_RCV_ERR	0xb0
 
 /* i8251F modem status register */
 #define	MSR_DCD		0x80	/* Current Data Carrier Detect */

Modified: user/nyan/pc98/sys/dev/uart/uart.h
==============================================================================
--- user/nyan/pc98/sys/dev/uart/uart.h	Sun Oct 19 09:10:44 2008	(r184055)
+++ user/nyan/pc98/sys/dev/uart/uart.h	Sun Oct 19 09:42:09 2008	(r184056)
@@ -38,6 +38,9 @@
 struct uart_bas {
 	bus_space_tag_t bst;
 	bus_space_handle_t bsh;
+#ifdef PC98
+	u_int	type;
+#endif
 	u_int	chan;
 	u_int	rclk;
 	u_int	regshft;
@@ -64,6 +67,9 @@ struct uart_bas {
  */
 struct uart_class;
 
+#ifdef PC98
+extern struct uart_class uart_i8251_class __attribute__((weak));
+#endif
 extern struct uart_class uart_ns8250_class __attribute__((weak));
 extern struct uart_class uart_quicc_class __attribute__((weak));
 extern struct uart_class uart_sab82532_class __attribute__((weak));

Modified: user/nyan/pc98/sys/dev/uart/uart_core.c
==============================================================================
--- user/nyan/pc98/sys/dev/uart/uart_core.c	Sun Oct 19 09:10:44 2008	(r184055)
+++ user/nyan/pc98/sys/dev/uart/uart_core.c	Sun Oct 19 09:42:09 2008	(r184056)
@@ -376,6 +376,9 @@ uart_bus_probe(device_t dev, int regshft
 	 */
 	sc->sc_bas.bsh = rman_get_bushandle(sc->sc_rres);
 	sc->sc_bas.bst = rman_get_bustag(sc->sc_rres);
+#ifdef PC98
+	sc->sc_bas.type = 0;
+#endif
 	sc->sc_bas.chan = chan;
 	sc->sc_bas.regshft = regshft;
 	sc->sc_bas.rclk = (rclk == 0) ? sc->sc_class->uc_rclk : rclk;

Modified: user/nyan/pc98/sys/dev/uart/uart_cpu_pc98.c
==============================================================================
--- user/nyan/pc98/sys/dev/uart/uart_cpu_pc98.c	Sun Oct 19 09:10:44 2008	(r184055)
+++ user/nyan/pc98/sys/dev/uart/uart_cpu_pc98.c	Sun Oct 19 09:42:09 2008	(r184056)
@@ -44,6 +44,7 @@ static struct {
 	u_long iobase;
 	struct uart_class *class;
 } uart_pc98_devs[] = {
+	{ 0x30, &uart_i8251_class },
 	{ 0x238, &uart_ns8250_class },
 	{ 0, NULL }
 };
@@ -76,7 +77,7 @@ uart_cpu_getdev(int devtype, struct uart
 	struct uart_class *class;
 	unsigned int i, ivar;
 
-	class = &uart_ns8250_class;
+	class = &uart_ns8250_class;	/* Default is ns8250 class. */
 	if (class == NULL)
 		return (ENXIO);
 
@@ -112,6 +113,7 @@ uart_cpu_getdev(int devtype, struct uart
 			continue;
 
 		di->ops = uart_getops(class);
+		di->bas.type = 0;
 		di->bas.chan = 0;
 		di->bas.bst = uart_bus_space_io;
 		if (bus_space_map(di->bas.bst, ivar, uart_getrange(class), 0,

Added: user/nyan/pc98/sys/dev/uart/uart_dev_i8251.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/nyan/pc98/sys/dev/uart/uart_dev_i8251.c	Sun Oct 19 09:42:09 2008	(r184056)
@@ -0,0 +1,1261 @@
+/*-
+ * Copyright (c) 2008 TAKAHASHI Yoshihiro
+ * Copyright (c) 2003 Marcel Moolenaar
+ * 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 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 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>
+__FBSDID("$FreeBSD$");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/kernel.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <machine/bus.h>
+#include <machine/timerreg.h>
+
+#include <dev/uart/uart.h>
+#include <dev/uart/uart_cpu.h>
+#include <dev/uart/uart_bus.h>
+#include <dev/uart/uart_dev_i8251.h>
+
+#include <dev/ic/i8251.h>
+#include <dev/ic/i8255.h>
+
+#include <pc98/pc98/pc98_machdep.h>
+
+#include "uart_if.h"
+
+/*
+ * I/O address table
+ */
+/* Internal i8251 / i8251F */
+static bus_addr_t i8251_iat[] =
+    { 0, 2, 2, 2, 3, 5, 0, 0, 0x100, 0x102, 0x104, 0x106, 0x108, 0x10a };
+/* PC-9861K */
+static bus_addr_t pc9861k_ext1_iat[] = { 1, 3, 3, 3, 0, 0 };
+static bus_addr_t pc9861k_ext2_iat[] = { 7, 9, 9, 9, 0, 0 };
+/* IND-SS / IND-SP */
+static bus_addr_t indss_ext1_iat[] = { 1, 3, 3, 3, 0, 0, 3 };
+static bus_addr_t indss_ext2_iat[] = { 7, 9, 9, 9, 0, 0, 9 };
+/* PIO-9032B */
+static bus_addr_t pio9032b_ext1_iat[] = { 1, 3, 3, 3, 0, 0, 8 };
+static bus_addr_t pio9032b_ext2_iat[] = { 7, 9, 9, 9, 0, 0, 8 };
+/* B98-01 */
+static bus_addr_t b9801_ext1_iat[] = { 1, 3, 3, 3, 0, 0, 0x21, 0x23 };
+static bus_addr_t b9801_ext2_iat[] = { 7, 9, 9, 9, 0, 0, 0x23, 0x25 };
+
+/*
+ * Baudrate table
+ */
+static struct i8251_speedtab sptab_vfast[] = {
+	{ 9600,		12, },
+	{ 14400,	8, },
+	{ 19200,	6, },
+	{ 28800,	4, },
+	{ 38400,	3, },
+	{ 57600,	2, },
+	{ 115200,	1, },
+	{ -1,		-1 }
+};
+static struct i8251_speedtab sptab_pio9032b[] = {
+	{ 300,		6, },
+	{ 600,		5, },
+	{ 1200,		4, },
+	{ 2400,		3, },
+	{ 4800,		2, },
+	{ 9600,		1, },
+	{ 19200,	0, },
+	{ 38400,	7, },
+	{ -1,		-1 }
+};
+static struct i8251_speedtab sptab_b9801[] = {
+	{ 75,		11, },
+	{ 150,		10, },
+	{ 300,		9, },
+	{ 600,		8, },
+	{ 1200,		7, },
+	{ 2400,		6, },
+	{ 4800,		5, },
+	{ 9600,		4, },
+	{ 19200,	3, },
+	{ 38400,	2, },
+	{ 76800,	1, },
+	{ 153600,	0, },
+	{ -1,		-1 }
+};
+
+/*
+ * Hardware specific table
+ */
+struct i8251_hw_table i8251_hw[] = {
+	{ "internal", i8251_iat, BUS_SPACE_IAT_SZ(i8251_iat),
+	  sptab_vfast },
+	{ "PC-9861K", pc9861k_ext1_iat, BUS_SPACE_IAT_SZ(pc9861k_ext1_iat),
+	  NULL },
+	{ "PC-9861K", pc9861k_ext2_iat, BUS_SPACE_IAT_SZ(pc9861k_ext2_iat),
+	  NULL },
+	{ "IND-SS / IND-SP", indss_ext1_iat, BUS_SPACE_IAT_SZ(indss_ext1_iat),
+	  NULL },
+	{ "IND-SS / IND-SP", indss_ext2_iat, BUS_SPACE_IAT_SZ(indss_ext2_iat),
+	  NULL },
+	{ "PIO-9032B", pio9032b_ext1_iat, BUS_SPACE_IAT_SZ(pio9032b_ext1_iat),
+	  sptab_pio9032b },
+	{ "PIO-9032B", pio9032b_ext2_iat, BUS_SPACE_IAT_SZ(pio9032b_ext2_iat),
+	  sptab_pio9032b },
+	{ "B98-01", b9801_ext1_iat, BUS_SPACE_IAT_SZ(b9801_ext1_iat),
+	  sptab_b9801 },
+	{ "B98-01", b9801_ext2_iat, BUS_SPACE_IAT_SZ(b9801_ext2_iat),
+	  sptab_b9801 },
+};
+
+
+static void
+i8251_probe_fifo(struct uart_bas *bas)
+{
+	u_int8_t t1, t2;
+
+	t1 = uart_getreg(bas, serf_iir);
+	DELAY(10);
+	t2 = uart_getreg(bas, serf_iir);
+
+	if ((t1 & IIR_FIFO_CK1) == (t2 & IIR_FIFO_CK1))
+		return;
+	if ((t1 & IIR_FIFO_CK2) != 0 || (t2 & IIR_FIFO_CK2) != 0)
+		return;
+
+#ifndef	I8251_DISABLE_FIFO
+	SET_TYPE(bas, COM_SUB_I8251F);
+#endif
+}
+
+static void
+i8251_probe_vfast(struct uart_bas *bas)
+{
+
+	uart_setreg(bas, serf_div, 0);
+	if (uart_getreg(bas, serf_div) & 0x80)
+		return;
+
+#ifndef	I8251_DISABLE_FIFO
+	SET_TYPE(bas, COM_SUB_I8251VFAST);
+#endif
+}
+
+static void
+i8251_reset(struct uart_bas *bas, u_int8_t mode, int force)
+{
+
+	if (force) {
+		uart_setreg(bas, seri_cmd, 0);
+		DELAY(30);
+		uart_setreg(bas, seri_cmd, 0);
+		DELAY(30);
+		uart_setreg(bas, seri_cmd, 0);
+		DELAY(30);
+	}
+
+	uart_setreg(bas, seri_cmd, CMD8251_RESET);
+	DELAY(100);
+	uart_setreg(bas, seri_mod, mode);
+	DELAY(100);
+}
+
+static __inline void
+i8251_write_cmd(struct uart_bas *bas, u_int8_t cmd)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F) {
+		uart_setreg(bas, serf_fcr, 0);
+		uart_setreg(bas, seri_cmd, cmd);
+		uart_setreg(bas, serf_fcr, I8251F_DEF_FIFO);
+	} else
+		uart_setreg(bas, seri_cmd, cmd);
+}
+
+static __inline void
+i8251_init_func(struct uart_bas *bas)
+{
+
+	uart_setreg(bas, seri_func, 0xf2);
+}
+
+static __inline void
+i8251_enable_fifo(struct uart_bas *bas)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		uart_setreg(bas, serf_fcr,
+			    I8251F_DEF_FIFO | FIFO_XMT_RST | FIFO_RCV_RST);
+}
+
+static __inline void
+i8251_disable_fifo(struct uart_bas *bas)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		uart_setreg(bas, serf_fcr, 0);
+}
+
+static __inline void
+i8251_data_putc(struct uart_bas *bas, u_int8_t c)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		uart_setreg(bas, serf_data, c);
+	else
+		uart_setreg(bas, seri_data, c);
+}
+
+static __inline u_int8_t
+i8251_data_getc(struct uart_bas *bas)
+{
+	u_int8_t c;
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		c = uart_getreg(bas, serf_data);
+	else
+		c = uart_getreg(bas, seri_data);
+
+	return (c);
+}
+
+static __inline int
+i8251_check_rxready(struct uart_bas *bas)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		return (uart_getreg(bas, serf_lsr) & FLSR_RxRDY);
+	else
+		return (uart_getreg(bas, seri_lsr) & STS8251_RxRDY);
+}
+
+static __inline int
+i8251_check_txready(struct uart_bas *bas)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		return (uart_getreg(bas, serf_lsr) & FLSR_TxRDY);
+	else
+		return (uart_getreg(bas, seri_lsr) & STS8251_TxRDY);
+}
+
+static __inline int
+i8251_check_txempty(struct uart_bas *bas)
+{
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		return (uart_getreg(bas, serf_lsr) & FLSR_TxEMP);
+	else
+		return (uart_getreg(bas, seri_lsr) & STS8251_TxEMP);
+}
+
+static u_int8_t
+i8251_read_lsr(struct uart_bas *bas)
+{
+	u_int8_t stat, lsr;
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F) {
+		stat = uart_getreg(bas, serf_lsr);
+		lsr = 0;
+		if (stat & FLSR_TxEMP)
+			lsr |= STS8251_TxEMP;
+		if (stat & FLSR_TxRDY)
+			lsr |= STS8251_TxRDY;
+		if (stat & FLSR_RxRDY)
+			lsr |= STS8251_RxRDY;
+		if (stat & FLSR_OE)
+			lsr |= STS8251_OE;
+		if (stat & FLSR_PE)
+			lsr |= STS8251_PE;
+		if (stat & FLSR_BI)
+			lsr |= STS8251_BI;
+	} else {
+		lsr = uart_getreg(bas, seri_lsr);
+	}
+
+	return (lsr);
+}
+
+static u_int8_t
+i8251_read_msr(struct uart_bas *bas)
+{
+	static u_int8_t msr_translate_tbl[] = {
+		0,
+		MSR_DCD,
+		MSR_CTS,
+		MSR_DCD | MSR_CTS,
+		MSR_RI,
+		MSR_RI | MSR_DCD,
+		MSR_RI | MSR_CTS,
+		MSR_RI | MSR_CTS | MSR_DCD
+	};
+	u_int8_t stat, msr;
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F)
+		return (uart_getreg(bas, serf_msr));
+
+	stat = (uart_getreg(bas, seri_msr) ^ 0xff) >> 5;
+	msr = msr_translate_tbl[stat];
+
+	stat = uart_getreg(bas, seri_lsr);
+	if (stat & STS8251_DSR)
+		msr |= MSR_DSR;
+
+	return (msr);
+}
+
+static void
+i8251_set_icr(struct uart_bas *bas, u_int8_t icr)
+{
+	u_int8_t tmp;
+
+	tmp = 0;
+	if (GET_IFTYPE(bas) == COM_IF_INTERNAL) {
+		tmp = uart_getreg(bas, seri_icr);
+		tmp &= ~(IEN_Rx | IEN_TxEMP | IEN_Tx);
+	}
+	tmp |= icr & (IEN_Rx | IEN_TxEMP | IEN_Tx);
+
+	uart_setreg(bas, seri_icr, tmp);
+}
+
+
+/*
+ * Clear pending interrupts. THRE is cleared by reading IIR. Data
+ * that may have been received gets lost here.
+ */
+static void
+i8251_clrint(struct uart_bas *bas)
+{
+	u_int8_t iir;
+
+	if (GET_SUBTYPE(bas) & COM_SUB_I8251F) {
+		iir = uart_getreg(bas, serf_iir);
+		while ((iir & IIR_NOPEND) == 0) {
+			iir &= IIR_IMASK;
+			if (iir == IIR_RLS)
+				(void)uart_getreg(bas, serf_lsr);
+			else if (iir == IIR_RXRDY || iir == IIR_RXTOUT)
+				(void)uart_getreg(bas, serf_data);
+			else if (iir == IIR_MLSC)
+				(void)uart_getreg(bas, serf_msr);
+			iir = uart_getreg(bas, serf_iir);
+		}
+	} else {
+		if (uart_getreg(bas, seri_lsr) & STS8251_RxRDY)
+			(void)uart_getreg(bas, seri_data);
+	}
+}
+
+static int
+i8251_drain(struct uart_bas *bas, int what)
+{
+	int delay, limit;
+
+	delay = 100;
+
+	if (what & UART_DRAIN_TRANSMITTER) {
+		/*
+		 * Pick an arbitrary high limit to avoid getting stuck in
+		 * an infinite loop when the hardware is broken. Make the
+		 * limit high enough to handle large FIFOs.
+		 */
+		limit = 10*256;
+		while ((uart_getreg(bas, seri_lsr) & STS8251_TxEMP) == 0 &&
+		       --limit)
+			DELAY(delay);
+		if (limit == 0) {
+			/* printf("i8251: transmitter appears stuck... "); */
+			return (EIO);
+		}
+	}
+
+	if (what & UART_DRAIN_RECEIVER) {
+		/*
+		 * Pick an arbitrary high limit to avoid getting stuck in
+		 * an infinite loop when the hardware is broken. Make the
+		 * limit high enough to handle large FIFOs and integrated
+		 * UARTs.
+		 */
+		limit=10*1024;
+		while ((uart_getreg(bas, seri_lsr) & STS8251_RxRDY) &&
+		       --limit) {
+			(void)uart_getreg(bas, seri_data);
+			DELAY(delay << 2);
+		}
+		if (limit == 0) {
+			/* printf("i8251: receiver appears broken... "); */
+			return (EIO);
+		}
+	}
+
+	return (0);
+}
+
+/*
+ * We can only flush UARTs with FIFOs. UARTs without FIFOs should be
+ * drained. WARNING: this function clobbers the FIFO setting!
+ */
+static void
+i8251_flush(struct uart_bas *bas, int what)
+{
+	u_int8_t fcr;
+
+	fcr = FIFO_ENABLE;
+	if (what & UART_FLUSH_TRANSMITTER)
+		fcr |= FIFO_XMT_RST;
+	if (what & UART_FLUSH_RECEIVER)
+		fcr |= FIFO_RCV_RST;
+	uart_setreg(bas, serf_fcr, fcr);
+}
+
+static int
+i8251_divisor(int rclk, int baudrate)
+{
+	int actual_baud, divisor;
+	int error;
+
+	if (baudrate == 0)
+		return (0);
+
+	divisor = (rclk / (baudrate << 3) + 1) >> 1;
+	if (divisor == 0 || divisor >= 65536)
+		return (0);
+	actual_baud = rclk / (divisor << 4);
+
+	/* 10 times error in percent: */
+	error = ((actual_baud - baudrate) * 2000 / baudrate + 1) >> 1;
+
+	/* 3.0% maximum error tolerance: */
+	if (error < -30 || error > 30)
+		return (0);
+
+	return (divisor);
+}
+
+static int
+i8251_ttspeedtab(int speed, struct i8251_speedtab *table)
+{
+
+	if (table == NULL)
+		return (-1);
+
+	for (; table->sp_speed != -1; table++)
+		if (table->sp_speed == speed)
+			return (table->sp_code);
+
+	return (-1);
+}
+
+static int
+i8251_set_baudrate(struct uart_bas *bas, int baudrate)
+{
+	int type, divisor, rclk;
+
+	if (baudrate == 0)
+		return (EINVAL);
+
+	type = GET_IFTYPE(bas);
+
+	switch (type) {
+	case COM_IF_INTERNAL:
+		if (GET_SUBTYPE(bas) & COM_SUB_I8251VFAST) {
+			divisor = i8251_ttspeedtab(baudrate,
+						   i8251_hw[type].sp_tab);
+			if (divisor != -1) {
+				divisor |= 0x80;
+				uart_setreg(bas, serf_div, divisor);
+				return (0);
+			} else {
+				/* Set compatible mode. */
+				uart_setreg(bas, serf_div, 0);
+			}
+		}
+
+		/* Check system clock. */
+		if (pc98_machine_type & M_8M)
+			rclk = 1996800;		/* 8 MHz system */
+		else
+			rclk = 2457600;		/* 5 MHz system */
+
+		divisor = i8251_divisor(rclk, baudrate);
+		if (divisor < 2)
+			return (EINVAL);
+		if (divisor == 3)
+			outb(TIMER_MODE,
+			     TIMER_SEL2 | TIMER_16BIT | TIMER_RATEGEN);
+		else
+			outb(TIMER_MODE,
+			     TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
+		DELAY(10);
+		outb(TIMER_CNTR2, divisor & 0xff);
+		DELAY(10);
+		outb(TIMER_CNTR2, (divisor >> 8) & 0xff);
+		break;
+	case COM_IF_PC9861K_1:
+	case COM_IF_PC9861K_2:
+		/* Cannot set a baudrate. */
+		break;
+	case COM_IF_IND_SS_1:
+	case COM_IF_IND_SS_2:
+		divisor = i8251_divisor(460800 * 16, baudrate);
+		if (divisor == 0)
+			return (EINVAL);
+		divisor |= 0x8000;
+#if 0
+		i8251_reset(bas, I8251_DEF_MODE, 1);
+#else
+		uart_setreg(bas, seri_icr, 0);
+		uart_setreg(bas, seri_div, 0);
+#endif
+		uart_setreg(bas, seri_cmd, CMD8251_RESET | CMD8251_EH);
+		uart_setreg(bas, seri_div, (divisor >> 8) & 0xff);
+		uart_setreg(bas, seri_div, divisor & 0xff);
+		break;
+	case COM_IF_PIO9032B_1:
+	case COM_IF_PIO9032B_2:
+	case COM_IF_B98_01_1:
+	case COM_IF_B98_01_2:
+		divisor = i8251_ttspeedtab(baudrate, i8251_hw[type].sp_tab);
+		if (divisor == -1)
+			return (EINVAL);
+		uart_setreg(bas, seri_div, divisor);
+		break;
+	}
+
+	return (0);
+}
+
+static int
+i8251_get_baudrate(struct uart_bas *bas)
+{
+	static int vfast_translate_tbl[] = {
+		0, 115200, 57600, 38400, 28800, 0, 19200, 0,
+		14400, 0, 0, 0, 9600, 0, 0, 0
+	};
+	int divisor, rclk;
+
+	switch (GET_IFTYPE(bas)) {
+	case COM_IF_INTERNAL:
+		if (GET_SUBTYPE(bas) & COM_SUB_I8251VFAST) {
+			divisor = uart_getreg(bas, serf_div);
+			if (divisor & 0x80)
+				return (vfast_translate_tbl[divisor & 0x0f]);
+		}
+
+		/* Check system clock */
+		if (pc98_machine_type & M_8M)
+			rclk = 1996800;		/* 8 MHz system */
+		else
+			rclk = 2457600;		/* 5 MHz system */
+
+		/* XXX Always set mode3 */
+		outb(TIMER_MODE, TIMER_SEL2 | TIMER_16BIT | TIMER_SQWAVE);
+		DELAY(10);
+		divisor = inb(TIMER_CNTR2);
+		DELAY(10);
+		divisor |= inb(TIMER_CNTR2) << 8;
+		if (divisor != 0)
+			return (rclk / divisor / 16);
+		break;
+	case COM_IF_PC9861K_1:
+	case COM_IF_PC9861K_2:
+	case COM_IF_IND_SS_1:
+	case COM_IF_IND_SS_2:
+	case COM_IF_PIO9032B_1:
+	case COM_IF_PIO9032B_2:
+	case COM_IF_B98_01_1:
+	case COM_IF_B98_01_2:
+		break;
+	}
+
+	return (0);
+}
+
+static int
+i8251_param(struct uart_bas *bas, int baudrate, int databits, int stopbits,
+    int parity)
+{
+	u_int8_t mod;
+	int error;
+
+	mod = 0;
+	if (databits >= 8)
+		mod |= MOD8251_8BITS;
+	else if (databits == 7)
+		mod |= MOD8251_7BITS;
+	else if (databits == 6)
+		mod |= MOD8251_6BITS;
+	else
+		mod |= MOD8251_5BITS;
+	if (stopbits >= 2)
+		mod |= MOD8251_STOP2;
+	else if (stopbits == 1)
+		mod |= MOD8251_STOP1;
+	if (parity == UART_PARITY_ODD)
+		mod |= MOD8251_PENAB;
+	else if (parity == UART_PARITY_EVEN)
+		mod |= MOD8251_PENAB | MOD8251_PEVEN;
+
+	/* Set baudrate. */
+	if (baudrate > 0) {
+		if ((error = i8251_set_baudrate(bas, baudrate)) != 0)
+			return (error);
+	}
+
+	/* Set mode and command register. */
+	i8251_disable_fifo(bas);
+	i8251_reset(bas, mod, 1);
+	uart_setreg(bas, seri_cmd, I8251_DEF_CMD | CMD8251_ER);
+	i8251_enable_fifo(bas);
+
+	return (0);
+}
+
+/*
+ * Low-level UART interface.
+ */
+static int i8251_probe(struct uart_bas *bas);
+static void i8251_init(struct uart_bas *bas, int, int, int, int);
+static void i8251_term(struct uart_bas *bas);
+static void i8251_putc(struct uart_bas *bas, int);
+static int i8251_rxready(struct uart_bas *bas);
+static int i8251_getc(struct uart_bas *bas, struct mtx *);
+
+static struct uart_ops uart_i8251_ops = {
+	.probe = i8251_probe,
+	.init = i8251_init,
+	.term = i8251_term,
+	.putc = i8251_putc,
+	.rxready = i8251_rxready,
+	.getc = i8251_getc,
+};
+
+static int
+i8251_probe(struct uart_bas *bas)
+{
+	int error;
+	u_int type;
+	u_int8_t lsr;
+
+	type = GET_IFTYPE(bas);
+
+	/* Load I/O address table. */
+	error = bus_space_map_load(bas->bst, bas->bsh,
+	    i8251_hw[type].iatsz, i8251_hw[type].iat, 0);
+	if (error)
+		return (error);
+
+	/* Probe i8251F and V-FAST. */
+	if (type == COM_IF_INTERNAL) {
+		i8251_probe_fifo(bas);
+		i8251_probe_vfast(bas);
+	}
+
+	/*
+	 * Clear fifo advanced mode, because line status register has
+	 * no response under the i8251F mode. 
+	 */
+	i8251_disable_fifo(bas);
+
+	/* Reset i8251. */
+	i8251_reset(bas, I8251_DEF_MODE, 1);
+
+	/* Initialize function regsiter for B98-01. */
+	if (type ==  COM_IF_B98_01_1 || type ==  COM_IF_B98_01_2)
+		i8251_init_func(bas);
+
+	/* Disable transmit. */
+	uart_setreg(bas, seri_cmd, CMD8251_DTR | CMD8251_RTS);
+	DELAY(100);
+
+	/* Check tx buffer empty. */
+	uart_setreg(bas, seri_cmd, CMD8251_DTR | CMD8251_RTS);
+	lsr = uart_getreg(bas, seri_lsr);
+	if ((lsr & STS8251_TxRDY) == 0)
+		return (ENXIO);
+
+	/* Write 2 bytes. */
+	uart_setreg(bas, seri_data, ' ');
+	DELAY(100);
+	uart_setreg(bas, seri_data, ' ');
+	DELAY(100);
+
+	/* Check tx buffer non empty. */
+	lsr = uart_getreg(bas, seri_lsr);
+	if ((lsr & STS8251_TxRDY) != 0)
+		return (ENXIO);
+
+	/* Clear tx buffer. */
+	i8251_reset(bas, I8251_DEF_MODE, 0);
+
+	return (0);
+}
+
+static void
+i8251_init(struct uart_bas *bas, int baudrate, int databits, int stopbits,
+    int parity)
+{
+
+	/* Disable the FIFO (if present). */
+	i8251_disable_fifo(bas);
+
+	/* Reset i8251. */
+	i8251_reset(bas, I8251_DEF_MODE, 1);
+
+	i8251_param(bas, baudrate, databits, stopbits, parity);
+
+	/* Disable the FIFO again. */
+	i8251_disable_fifo(bas);
+
+        /* Disable all interrupt sources. */
+	i8251_set_icr(bas, 0);
+
+	/* Set RTS & DTR. */
+	uart_setreg(bas, seri_cmd, I8251_DEF_CMD);
+
+	i8251_drain(bas, UART_DRAIN_RECEIVER | UART_DRAIN_TRANSMITTER);
+
+	/* Reset and enable FIFO. */
+	i8251_enable_fifo(bas);
+}
+
+static void
+i8251_term(struct uart_bas *bas)
+{
+
+	/* Clear DTR & RTS. */
+	i8251_write_cmd(bas, I8251_DEF_CMD & ~(CMD8251_DTR | CMD8251_RTS));
+}
+
+static void
+i8251_putc(struct uart_bas *bas, int c)
+{
+	int limit;
+
+	limit = 250000;
+	while (i8251_check_txready(bas) == 0 && --limit)
+		DELAY(4);
+	i8251_data_putc(bas, c);
+	limit = 250000;
+	while (i8251_check_txempty(bas) == 0 && --limit)
+		DELAY(4);
+}
+
+static int
+i8251_rxready(struct uart_bas *bas)
+{
+
+	return (i8251_check_rxready(bas) != 0 ? 1 : 0);
+}
+
+static int
+i8251_getc(struct uart_bas *bas, struct mtx *hwmtx)
+{
+	int c;
+
+	uart_lock(hwmtx);
+
+	while (i8251_check_rxready(bas) == 0) {
+		uart_unlock(hwmtx);
+		DELAY(4);
+		uart_lock(hwmtx);
+	}
+
+	c = i8251_data_getc(bas);
+
+	uart_unlock(hwmtx);
+
+	return (c);
+}
+
+/*
+ * High-level UART interface.
+ */
+struct i8251_softc {
+	struct uart_softc base;
+	u_int8_t icr;
+	u_int8_t cmd;
+	u_int8_t msr;
+	struct callout_handle timeout_msr;
+};
+
+static void i8251_enable_msrintr(struct uart_softc *);
+static void i8251_disable_msrintr(struct uart_softc *);
+
+static int i8251_bus_attach(struct uart_softc *);
+static int i8251_bus_detach(struct uart_softc *);
+static int i8251_bus_flush(struct uart_softc *, int);
+static int i8251_bus_getsig(struct uart_softc *);
+static int i8251_bus_ioctl(struct uart_softc *, int, intptr_t);
+static int i8251_bus_ipend(struct uart_softc *);
+static int i8251_bus_param(struct uart_softc *, int, int, int, int);
+static int i8251_bus_probe(struct uart_softc *);
+static int i8251_bus_receive(struct uart_softc *);
+static int i8251_bus_setsig(struct uart_softc *, int);
+static int i8251_bus_transmit(struct uart_softc *);
+
+static kobj_method_t i8251_methods[] = {
+	KOBJMETHOD(uart_attach,		i8251_bus_attach),
+	KOBJMETHOD(uart_detach,		i8251_bus_detach),
+	KOBJMETHOD(uart_flush,		i8251_bus_flush),
+	KOBJMETHOD(uart_getsig,		i8251_bus_getsig),
+	KOBJMETHOD(uart_ioctl,		i8251_bus_ioctl),
+	KOBJMETHOD(uart_ipend,		i8251_bus_ipend),
+	KOBJMETHOD(uart_param,		i8251_bus_param),
+	KOBJMETHOD(uart_probe,		i8251_bus_probe),
+	KOBJMETHOD(uart_receive,	i8251_bus_receive),
+	KOBJMETHOD(uart_setsig,		i8251_bus_setsig),
+	KOBJMETHOD(uart_transmit,	i8251_bus_transmit),
+	{ 0, 0 }
+};
+
+struct uart_class uart_i8251_class = {
+	"i8251",
+	i8251_methods,
+	sizeof(struct i8251_softc),
+	.uc_ops = &uart_i8251_ops,
+	.uc_range = 1,
+	.uc_rclk = 0
+};
+
+#define	SIGCHG(c, i, s, d)				\
+	if (c) {					\
+		i |= (i & s) ? s : s | d;		\
+	} else {					\
+		i = (i & s) ? (i & ~s) | d : i;		\
+	}
+
+static int
+i8251_bus_attach(struct uart_softc *sc)
+{
+	struct i8251_softc *i8251;
+	struct uart_bas *bas;
+	int type, error;
+
+	i8251 = (struct i8251_softc *)sc;
+	bas = &sc->sc_bas;
+	type = GET_IFTYPE(bas);
+
+	/* Load I/O address table. */
+	error = bus_space_map_load(bas->bst, bas->bsh,
+	    i8251_hw[type].iatsz, i8251_hw[type].iat, 0);
+	if (error)
+		return (error);
+
+	i8251_bus_flush(sc, UART_FLUSH_RECEIVER | UART_FLUSH_TRANSMITTER);
+
+	i8251->cmd = I8251_DEF_CMD;
+	if (i8251->cmd & CMD8251_DTR)
+		sc->sc_hwsig |= SER_DTR;
+	if (i8251->cmd & CMD8251_RTS)
+		sc->sc_hwsig |= SER_RTS;
+	i8251_bus_getsig(sc);
+
+	i8251_clrint(bas);
+	i8251->icr = IEN_Rx;
+	i8251_set_icr(bas, i8251->icr);
+
+	i8251_enable_msrintr(sc);
+
+	return (0);
+}
+
+static int
+i8251_bus_detach(struct uart_softc *sc)
+{
+	struct uart_bas *bas;
+
+	bas = &sc->sc_bas;
+
+	i8251_disable_msrintr(sc);
+
+	i8251_set_icr(bas, 0);
+	i8251_clrint(bas);
+
+	return (0);
+}
+
+static int
+i8251_bus_flush(struct uart_softc *sc, int what)
+{
+	struct i8251_softc *i8251;
+	struct uart_bas *bas;
+	int error;

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***

From owner-svn-src-user@FreeBSD.ORG  Mon Oct 20 00:21:06 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 52E48106567D;
	Mon, 20 Oct 2008 00:21:06 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2890D8FC0A;
	Mon, 20 Oct 2008 00:21:06 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9K0L6Z5055729;
	Mon, 20 Oct 2008 00:21:06 GMT
	(envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9K0L6lS055728;
	Mon, 20 Oct 2008 00:21:06 GMT
	(envelope-from lstewart@svn.freebsd.org)
Message-Id: <200810200021.m9K0L6lS055728@svn.freebsd.org>
From: Lawrence Stewart <lstewart@FreeBSD.org>
Date: Mon, 20 Oct 2008 00:21:06 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184064 - user/lstewart
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 20 Oct 2008 00:21:06 -0000

Author: lstewart
Date: Mon Oct 20 00:21:05 2008
New Revision: 184064
URL: http://svn.freebsd.org/changeset/base/184064

Log:
  Create my user dir

Added:
  user/lstewart/

From owner-svn-src-user@FreeBSD.ORG  Mon Oct 20 00:35:03 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id 80A691065679;
	Mon, 20 Oct 2008 00:35:03 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 55F748FC1B;
	Mon, 20 Oct 2008 00:35:03 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9K0Z35a056020;
	Mon, 20 Oct 2008 00:35:03 GMT
	(envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9K0Z3c0056019;
	Mon, 20 Oct 2008 00:35:03 GMT
	(envelope-from lstewart@svn.freebsd.org)
Message-Id: <200810200035.m9K0Z3c0056019@svn.freebsd.org>
From: Lawrence Stewart <lstewart@FreeBSD.org>
Date: Mon, 20 Oct 2008 00:35:03 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184065 - user/lstewart/alq_varlen_8.x
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 20 Oct 2008 00:35:03 -0000

Author: lstewart
Date: Mon Oct 20 00:35:02 2008
New Revision: 184065
URL: http://svn.freebsd.org/changeset/base/184065

Log:
  Create a place to dump the patch to ALQ(9) I've been working on that turns the
  code into a KLD and adds variable length message support to the KPI.

Added:
  user/lstewart/alq_varlen_8.x/
     - copied from r184064, head/

From owner-svn-src-user@FreeBSD.ORG  Mon Oct 20 01:46:54 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id ADC2D106566C;
	Mon, 20 Oct 2008 01:46:54 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 9AF138FC17;
	Mon, 20 Oct 2008 01:46:54 +0000 (UTC)
	(envelope-from lstewart@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9K1ksTn057214;
	Mon, 20 Oct 2008 01:46:54 GMT
	(envelope-from lstewart@svn.freebsd.org)
Received: (from lstewart@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9K1ksJh057210;
	Mon, 20 Oct 2008 01:46:54 GMT
	(envelope-from lstewart@svn.freebsd.org)
Message-Id: <200810200146.m9K1ksJh057210@svn.freebsd.org>
From: Lawrence Stewart <lstewart@FreeBSD.org>
Date: Mon, 20 Oct 2008 01:46:54 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184066 - in user/lstewart/alq_varlen_8.x/sys: kern
	modules modules/alq sys
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Mon, 20 Oct 2008 01:46:54 -0000

Author: lstewart
Date: Mon Oct 20 01:46:54 2008
New Revision: 184066
URL: http://svn.freebsd.org/changeset/base/184066

Log:
  Initial import of a patch to turn ALQ(9) into a KLD and add support for variable
  length messages.
  
  Patch currently compiles fine and appears to be usable in basic testing,
  but needs more extensive testing and perhaps some additional refinement.
  
  Todo:
   - Update ALQ(9) man page
   - Regression testing
  Discussed with:	jeff@, rwatson@

Added:
  user/lstewart/alq_varlen_8.x/sys/modules/alq/
  user/lstewart/alq_varlen_8.x/sys/modules/alq/Makefile   (contents, props changed)
Modified:
  user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c
  user/lstewart/alq_varlen_8.x/sys/modules/Makefile
  user/lstewart/alq_varlen_8.x/sys/sys/alq.h

Modified: user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c
==============================================================================
--- user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c	Mon Oct 20 00:35:02 2008	(r184065)
+++ user/lstewart/alq_varlen_8.x/sys/kern/kern_alq.c	Mon Oct 20 01:46:54 2008	(r184066)
@@ -1,5 +1,6 @@
 /*-
  * Copyright (c) 2002, Jeffrey Roberson <jeff@freebsd.org>
+ * Copyright (c) 2008, Lawrence Stewart <lstewart@freebsd.org>
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -51,14 +52,18 @@ __FBSDID("$FreeBSD$");
 struct alq {
 	int	aq_entmax;		/* Max entries */
 	int	aq_entlen;		/* Entry length */
+	int	aq_freebytes;		/* Bytes available in buffer */
+	int	aq_buflen;		/* Total length of our buffer */
 	char	*aq_entbuf;		/* Buffer for stored entries */
+	int	aq_writehead;
+	int	aq_writetail;
 	int	aq_flags;		/* Queue flags */
 	struct mtx	aq_mtx;		/* Queue lock */
 	struct vnode	*aq_vp;		/* Open vnode handle */
 	struct ucred	*aq_cred;	/* Credentials of the opening thread */
-	struct ale	*aq_first;	/* First ent */
-	struct ale	*aq_entfree;	/* First free ent */
-	struct ale	*aq_entvalid;	/* First ent valid for writing */
+	//struct ale	*aq_first;	/* First ent */
+	//struct ale	*aq_entfree;	/* First free ent */
+	//struct ale	*aq_entvalid;	/* First ent valid for writing */
 	LIST_ENTRY(alq)	aq_act;		/* List of active queues */
 	LIST_ENTRY(alq)	aq_link;	/* List of all queues */
 };
@@ -182,8 +187,14 @@ ald_daemon(void)
 	ALD_LOCK();
 
 	for (;;) {
-		while ((alq = LIST_FIRST(&ald_active)) == NULL)
-			msleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);
+		while ((alq = LIST_FIRST(&ald_active)) == NULL
+				&& !ald_shutingdown)
+			mtx_sleep(&ald_active, &ald_mtx, PWAIT, "aldslp", 0);
+
+		if (ald_shutingdown) {
+			ALD_UNLOCK();
+			break;
+		}
 
 		ALQ_LOCK(alq);
 		ald_deactivate(alq);
@@ -191,9 +202,11 @@ ald_daemon(void)
 		needwakeup = alq_doio(alq);
 		ALQ_UNLOCK(alq);
 		if (needwakeup)
-			wakeup(alq);
+			wakeup_one(alq);
 		ALD_LOCK();
 	}
+
+	kthread_exit();
 }
 
 static void
@@ -204,6 +217,12 @@ ald_shutdown(void *arg, int howto)
 	ALD_LOCK();
 	ald_shutingdown = 1;
 
+	/* wake ald_daemon so that it exits*/
+	wakeup(&ald_active);
+
+	/* wait for ald_daemon to exit */
+	mtx_sleep(ald_thread, &ald_mtx, PWAIT, "aldslp", 0);
+
 	while ((alq = LIST_FIRST(&ald_queues)) != NULL) {
 		LIST_REMOVE(alq, aq_link);
 		ALD_UNLOCK();
@@ -244,41 +263,45 @@ alq_doio(struct alq *alq)
 	struct vnode *vp;
 	struct uio auio;
 	struct iovec aiov[2];
-	struct ale *ale;
-	struct ale *alstart;
 	int totlen;
 	int iov;
 	int vfslocked;
 
+	KASSERT(alq->aq_freebytes != alq->aq_buflen,
+		("%s: queue emtpy!", __func__)
+	);
+
 	vp = alq->aq_vp;
 	td = curthread;
 	totlen = 0;
 	iov = 0;
 
-	alstart = ale = alq->aq_entvalid;
-	alq->aq_entvalid = NULL;
-
 	bzero(&aiov, sizeof(aiov));
 	bzero(&auio, sizeof(auio));
 
-	do {
-		if (aiov[iov].iov_base == NULL)
-			aiov[iov].iov_base = ale->ae_data;
-		aiov[iov].iov_len += alq->aq_entlen;
-		totlen += alq->aq_entlen;
-		/* Check to see if we're wrapping the buffer */
-		if (ale->ae_data + alq->aq_entlen != ale->ae_next->ae_data)
-			iov++;
-		ale->ae_flags &= ~AE_VALID;
-		ale = ale->ae_next;
-	} while (ale->ae_flags & AE_VALID);
+	/* start the write from the location of our buffer tail pointer */
+	aiov[iov].iov_base = alq->aq_entbuf + alq->aq_writetail;
+
+	if (alq->aq_writetail < alq->aq_writehead) {
+		/* buffer not wrapped */
+		totlen = aiov[iov].iov_len =  alq->aq_writehead -
+							alq->aq_writetail;
+	} else {
+		/*
+		 * buffer wrapped, requires 2 aiov entries:
+		 * - first is from writetail to end of buffer
+		 * - second is from start of buffer to writehead
+		 */
+		aiov[iov].iov_len =  alq->aq_buflen - alq->aq_writetail;
+		iov++;
+		aiov[iov].iov_base = alq->aq_entbuf;
+		aiov[iov].iov_len =  alq->aq_writehead;
+		totlen = aiov[0].iov_len + aiov[1].iov_len;
+	}
 
 	alq->aq_flags |= AQ_FLUSHING;
 	ALQ_UNLOCK(alq);
 
-	if (iov == 2 || aiov[iov].iov_base == NULL)
-		iov--;
-
 	auio.uio_iov = &aiov[0];
 	auio.uio_offset = 0;
 	auio.uio_segflg = UIO_SYSSPACE;
@@ -308,8 +331,17 @@ alq_doio(struct alq *alq)
 	ALQ_LOCK(alq);
 	alq->aq_flags &= ~AQ_FLUSHING;
 
-	if (alq->aq_entfree == NULL)
-		alq->aq_entfree = alstart;
+	/* Adjust writetail as required, taking into account wrapping */
+	alq->aq_writetail += (iov == 2) ? aiov[1].iov_len : totlen;
+	alq->aq_freebytes += totlen;
+
+	/*
+	 * If we just flushed the buffer completely,
+	 * reset indexes to 0 to minimise buffer wraps
+	 * This is also required to ensure alq_getn() can't wedge itself
+	 */
+	if (alq->aq_freebytes == alq->aq_buflen)
+		alq->aq_writehead = alq->aq_writetail = 0;
 
 	if (alq->aq_flags & AQ_WANTED) {
 		alq->aq_flags &= ~AQ_WANTED;
@@ -340,13 +372,13 @@ alq_open(struct alq **alqp, const char *
 {
 	struct thread *td;
 	struct nameidata nd;
-	struct ale *ale;
-	struct ale *alp;
 	struct alq *alq;
-	char *bufp;
 	int flags;
 	int error;
-	int i, vfslocked;
+	int vfslocked;
+
+	KASSERT(size > 0, ("%s: size <= 0", __func__));
+	KASSERT(count >= 0, ("%s: count < 0", __func__));
 
 	*alqp = NULL;
 	td = curthread;
@@ -365,31 +397,27 @@ alq_open(struct alq **alqp, const char *
 	VFS_UNLOCK_GIANT(vfslocked);
 
 	alq = malloc(sizeof(*alq), M_ALD, M_WAITOK|M_ZERO);
-	alq->aq_entbuf = malloc(count * size, M_ALD, M_WAITOK|M_ZERO);
-	alq->aq_first = malloc(sizeof(*ale) * count, M_ALD, M_WAITOK|M_ZERO);
 	alq->aq_vp = nd.ni_vp;
 	alq->aq_cred = crhold(cred);
-	alq->aq_entmax = count;
-	alq->aq_entlen = size;
-	alq->aq_entfree = alq->aq_first;
 
 	mtx_init(&alq->aq_mtx, "ALD Queue", NULL, MTX_SPIN|MTX_QUIET);
 
-	bufp = alq->aq_entbuf;
-	ale = alq->aq_first;
-	alp = NULL;
-
-	/* Match up entries with buffers */
-	for (i = 0; i < count; i++) {
-		if (alp)
-			alp->ae_next = ale;
-		ale->ae_data = bufp;
-		alp = ale;
-		ale++;
-		bufp += size;
+	if (count > 0) {
+		/* fixed length messages */
+		alq->aq_buflen = size * count;
+		alq->aq_entmax = count;
+		alq->aq_entlen = size;
+	} else {
+		/* variable length messages */
+		alq->aq_buflen = size;
+		alq->aq_entmax = 0;
+		alq->aq_entlen = 0;
 	}
 
-	alp->ae_next = alq->aq_first;
+	alq->aq_freebytes = alq->aq_buflen;	
+	alq->aq_entbuf = malloc(alq->aq_buflen, M_ALD, M_WAITOK|M_ZERO);
+
+	alq->aq_writehead = alq->aq_writetail = 0;
 
 	if ((error = ald_add(alq)) != 0)
 		return (error);
@@ -403,46 +431,180 @@ alq_open(struct alq **alqp, const char *
  * wait or return an error depending on the value of waitok.
  */
 int
-alq_write(struct alq *alq, void *data, int waitok)
+alq_write(struct alq *alq, void *data, int flags)
 {
-	struct ale *ale;
+	/* should only be called in fixed length message (legacy) mode */
+	KASSERT(alq->aq_entmax > 0 && alq->aq_entlen > 0,
+		("%s: fixed length write on variable length queue", __func__)
+	);
+	return (alq_writen(alq, data, alq->aq_entlen, flags));
+}
+
+int
+alq_writen(struct alq *alq, void *data, int len, int flags)
+{
+	int activate = 0;
+	int copy = len;
+
+	KASSERT(len > 0 && len < alq->aq_buflen,
+		("%s: len <= 0 || len > alq->aq_buflen", __func__)
+	);
+
+	ALQ_LOCK(alq);
+
+	/*
+	 * If the message is larger than our underlying buffer or
+	 * there is not enough free space in our underlying buffer
+	 * to accept the message and the user can't wait, return
+	 */
+	if ((len > alq->aq_buflen) ||
+		((flags & ALQ_NOWAIT) && (alq->aq_freebytes < len))) {
+		ALQ_UNLOCK(alq);
+		return (EWOULDBLOCK);
+	}
+
+	/*
+	 * ALQ_WAITOK or alq->aq_freebytes > len,
+	 * either spin until we have enough free bytes (former) or skip (latter)
+	 */
+	while (alq->aq_freebytes < len && (alq->aq_flags & AQ_SHUTDOWN) == 0) {
+		alq->aq_flags |= AQ_WANTED;
+		msleep_spin(alq, &alq->aq_mtx, "alqwriten", 0);
+	}
 
-	if ((ale = alq_get(alq, waitok)) == NULL)
+	/*
+	 * we need to serialise wakups to ensure records remain in order...
+	 * therefore, wakeup the next thread in the queue waiting for
+	 * alq resources to be available
+	 * (technically this is only required if we actually entered the above
+	 * while loop)
+	 */
+	wakeup_one(alq);
+
+	/* bail if we're shutting down */
+	if (alq->aq_flags & AQ_SHUTDOWN) {
+		ALQ_UNLOCK(alq);
 		return (EWOULDBLOCK);
+	}
+
+	/*
+	 * if we need to wrap the buffer to accommodate the write,
+	 * we'll need 2 calls to bcopy
+	 */
+	if ((alq->aq_buflen - alq->aq_writehead) < len)
+		copy = alq->aq_buflen - alq->aq_writehead;
+
+	/* copy (part of) message to the buffer */
+	bcopy(data, alq->aq_entbuf + alq->aq_writehead, copy);
+	alq->aq_writehead += copy;
+
+	if (copy != len) {
+		/*
+		 * wrap the buffer by copying the remainder of our message
+		 * to the start of the buffer and resetting the head ptr
+		 */
+		bcopy(data, alq->aq_entbuf, len - copy);
+		alq->aq_writehead = copy;
+	}
 
-	bcopy(data, ale->ae_data, alq->aq_entlen);
-	alq_post(alq, ale);
+	alq->aq_freebytes -= len;
+
+	if ((alq->aq_flags & AQ_ACTIVE) == 0) {
+		alq->aq_flags |= AQ_ACTIVE;
+		activate = 1;
+	}
+
+	ALQ_UNLOCK(alq);
+
+	if (activate) {
+		ALD_LOCK();
+		ald_activate(alq);
+		ALD_UNLOCK();
+	}
 
 	return (0);
 }
 
 struct ale *
-alq_get(struct alq *alq, int waitok)
+alq_get(struct alq *alq, int flags)
+{
+	/* should only be called in fixed length message (legacy) mode */
+	KASSERT(alq->aq_entmax > 0 && alq->aq_entlen > 0,
+		("%s: fixed length get on variable length queue", __func__)
+	);
+	return (alq_getn(alq, alq->aq_entlen, flags));
+}
+
+struct ale *
+alq_getn(struct alq *alq, int len, int flags)
 {
 	struct ale *ale;
-	struct ale *aln;
+	int contigbytes;
 
-	ale = NULL;
+	ale = malloc(	sizeof(struct ale),
+			M_ALD,
+			(flags & ALQ_NOWAIT) ? M_NOWAIT : M_WAITOK
+	);
+
+	if (ale == NULL)
+		return (NULL);
 
 	ALQ_LOCK(alq);
 
-	/* Loop until we get an entry or we're shutting down */
-	while ((alq->aq_flags & AQ_SHUTDOWN) == 0 && 
-	    (ale = alq->aq_entfree) == NULL &&
-	    (waitok & ALQ_WAITOK)) {
-		alq->aq_flags |= AQ_WANTED;
-		msleep_spin(alq, &alq->aq_mtx, "alqget", 0);
+	/* determine the number of free contiguous bytes */
+	if (alq->aq_writehead <= alq->aq_writetail)
+		contigbytes = alq->aq_freebytes;
+	else
+		contigbytes = alq->aq_buflen - alq->aq_writehead;
+
+	/*
+	 * If the message is larger than our underlying buffer or
+	 * there is not enough free contiguous space in our underlying buffer
+	 * to accept the message and the user can't wait, return
+	 */
+	if ((len > alq->aq_buflen) ||
+		((flags & ALQ_NOWAIT) && (contigbytes < len))) {
+		ALQ_UNLOCK(alq);
+		return (NULL);
 	}
 
-	if (ale != NULL) {
-		aln = ale->ae_next;
-		if ((aln->ae_flags & AE_VALID) == 0)
-			alq->aq_entfree = aln;
+	/*
+	 * ALQ_WAITOK or contigbytes > len,
+	 * either spin until we have enough free contiguous bytes (former)
+	 * or skip (latter)
+	 */
+	while (contigbytes < len && (alq->aq_flags & AQ_SHUTDOWN) == 0) {
+		alq->aq_flags |= AQ_WANTED;
+		msleep_spin(alq, &alq->aq_mtx, "alqgetn", 0);
+		if (alq->aq_writehead <= alq->aq_writetail)
+			contigbytes = alq->aq_freebytes;
 		else
-			alq->aq_entfree = NULL;
-	} else
+			contigbytes = alq->aq_buflen - alq->aq_writehead;
+	}
+
+	/*
+	 * we need to serialise wakups to ensure records remain in order...
+	 * therefore, wakeup the next thread in the queue waiting for
+	 * alq resources to be available
+	 * (technically this is only required if we actually entered the above
+	 * while loop)
+	 */
+	wakeup_one(alq);
+
+	/* bail if we're shutting down */
+	if (alq->aq_flags & AQ_SHUTDOWN) {
 		ALQ_UNLOCK(alq);
+		return (NULL);
+	}
 
+	/*
+	 * If we are here, we have a contiguous number of bytes >= len
+	 * available in our buffer starting at aq_writehead.
+	 */
+	ale->ae_data = alq->aq_entbuf + alq->aq_writehead;
+	ale->ae_datalen = len;
+	alq->aq_writehead += len;
+	alq->aq_freebytes -= len;
 
 	return (ale);
 }
@@ -452,11 +614,6 @@ alq_post(struct alq *alq, struct ale *al
 {
 	int activate;
 
-	ale->ae_flags |= AE_VALID;
-
-	if (alq->aq_entvalid == NULL)
-		alq->aq_entvalid = ale;
-
 	if ((alq->aq_flags & AQ_ACTIVE) == 0) {
 		alq->aq_flags |= AQ_ACTIVE;
 		activate = 1;
@@ -464,11 +621,14 @@ alq_post(struct alq *alq, struct ale *al
 		activate = 0;
 
 	ALQ_UNLOCK(alq);
+
 	if (activate) {
 		ALD_LOCK();
 		ald_activate(alq);
 		ALD_UNLOCK();
 	}
+
+	free(ale, M_ALD);
 }
 
 void
@@ -487,7 +647,7 @@ alq_flush(struct alq *alq)
 	ALQ_UNLOCK(alq);
 
 	if (needwakeup)
-		wakeup(alq);
+		wakeup_one(alq);
 }
 
 /*
@@ -509,7 +669,49 @@ alq_close(struct alq *alq)
 	alq_shutdown(alq);
 
 	mtx_destroy(&alq->aq_mtx);
-	free(alq->aq_first, M_ALD);
 	free(alq->aq_entbuf, M_ALD);
 	free(alq, M_ALD);
 }
+
+static int alq_load_handler(module_t mod, int what, void *arg)
+{
+	int ret = 0;
+
+	switch(what) {
+		case MOD_LOAD:
+		case MOD_UNLOAD:
+		case MOD_SHUTDOWN:
+			break;
+		
+		case MOD_QUIESCE:
+			ALD_LOCK();
+			/* only allow unload if there are no open queues */
+			if (LIST_FIRST(&ald_queues) == NULL) {
+				ald_shutingdown = 1;
+				ALD_UNLOCK();
+				ald_shutdown(NULL, 0);
+				mtx_destroy(&ald_mtx);
+			} else {
+				ALD_UNLOCK();
+				ret = EBUSY;
+			}
+			break;
+		
+		default:
+			ret = EINVAL;
+			break;
+	}
+
+	return (ret);
+}
+
+/* basic module data */
+static moduledata_t alq_mod =
+{
+	"alq",
+	alq_load_handler, /* execution entry point for the module */
+	NULL
+};
+
+DECLARE_MODULE(alq, alq_mod, SI_SUB_SMP, SI_ORDER_ANY);
+MODULE_VERSION(alq, 1);

Modified: user/lstewart/alq_varlen_8.x/sys/modules/Makefile
==============================================================================
--- user/lstewart/alq_varlen_8.x/sys/modules/Makefile	Mon Oct 20 00:35:02 2008	(r184065)
+++ user/lstewart/alq_varlen_8.x/sys/modules/Makefile	Mon Oct 20 01:46:54 2008	(r184066)
@@ -17,6 +17,7 @@ SUBDIR=	${_3dfx} \
 	${_aic} \
 	aic7xxx \
 	aio \
+	alq \
 	${_amd} \
 	amr \
 	${_an} \

Added: user/lstewart/alq_varlen_8.x/sys/modules/alq/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/lstewart/alq_varlen_8.x/sys/modules/alq/Makefile	Mon Oct 20 01:46:54 2008	(r184066)
@@ -0,0 +1,10 @@
+# $FreeBSD$
+
+.include <bsd.own.mk>
+
+.PATH:  ${.CURDIR}/../../kern
+KMOD=alq
+SRCS=opt_mac.h vnode_if.h kern_alq.c
+
+.include <bsd.kmod.mk> 
+

Modified: user/lstewart/alq_varlen_8.x/sys/sys/alq.h
==============================================================================
--- user/lstewart/alq_varlen_8.x/sys/sys/alq.h	Mon Oct 20 00:35:02 2008	(r184065)
+++ user/lstewart/alq_varlen_8.x/sys/sys/alq.h	Mon Oct 20 01:46:54 2008	(r184066)
@@ -41,15 +41,15 @@ extern struct thread *ald_thread;
  * Async. Logging Entry
  */
 struct ale {
-	struct ale	*ae_next;	/* Next Entry */
+	//struct ale	*ae_next;	/* Next Entry */
 	char		*ae_data;	/* Entry buffer */
-	int		ae_flags;	/* Entry flags */
+	int		ae_datalen;	/* Length of buffer */
+	//int		ae_flags;	/* Entry flags */
 };
 
-#define	AE_VALID	0x0001		/* Entry has valid data */
- 
+//#define	AE_VALID	0x0001		/* Entry has valid data */
 
-/* waitok options */
+/* flags options */
 #define	ALQ_NOWAIT	0x0001
 #define	ALQ_WAITOK	0x0002
 
@@ -88,7 +88,8 @@ int alq_open(struct alq **, const char *
  *		The system is shutting down.
  *	0 on success.
  */
-int alq_write(struct alq *alq, void *data, int waitok);
+int alq_write(struct alq *alq, void *data, int flags);
+int alq_writen(struct alq *alq, void *data, int len, int flags);
 
 /*
  * alq_flush:  Flush the queue out to disk
@@ -115,13 +116,14 @@ void alq_close(struct alq *alq);
  *
  * This leaves the queue locked until a subsequent alq_post.
  */
-struct ale *alq_get(struct alq *alq, int waitok);
+struct ale *alq_get(struct alq *alq, int flags);
+struct ale *alq_getn(struct alq *alq, int len, int flags);
 
 /*
  * alq_post:  Schedule the ale retrieved by alq_get for writing.
  *	alq	The queue to post the entry to.
  *	ale	An asynch logging entry returned by alq_get.
  */
-void alq_post(struct alq *, struct ale *);
+void alq_post(struct alq *alq, struct ale *ale);
 
 #endif	/* _SYS_ALQ_H_ */

From owner-svn-src-user@FreeBSD.ORG  Tue Oct 21 10:54:13 2008
Return-Path: <owner-svn-src-user@FreeBSD.ORG>
Delivered-To: svn-src-user@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id DDCC9106567C;
	Tue, 21 Oct 2008 10:54:13 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA2DC8FC19;
	Tue, 21 Oct 2008 10:54:13 +0000 (UTC)
	(envelope-from edwin@FreeBSD.org)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id m9LAsDPK097296;
	Tue, 21 Oct 2008 10:54:13 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id m9LAsCD9097276;
	Tue, 21 Oct 2008 10:54:12 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <200810211054.m9LAsCD9097276@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Tue, 21 Oct 2008 10:54:12 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Cc: 
Subject: svn commit: r184121 - in user/edwin/releasenotes: .
	head/release/doc/en_US.ISO8859-1/relnotes
	releng-6.0/release/doc/en_US.ISO8859-1/relnotes
	releng-6.0/release/doc/en_US.ISO8859-1/relnotes/common ...
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
	src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-user>,
	<mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Tue, 21 Oct 2008 10:54:14 -0000

Author: edwin
Date: Tue Oct 21 10:54:12 2008
New Revision: 184121
URL: http://svn.freebsd.org/changeset/base/184121

Log:
  Automatic generation of Contributed Software overview.
  First working code, will check the correctness tomorrow.

Added:
  user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
  user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
  user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
  user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
  user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
  user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
Modified:
  user/edwin/releasenotes/Makefile
  user/edwin/releasenotes/contrib-xmltoent.pl
  user/edwin/releasenotes/contrib.xml
  user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile
  user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml
  user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile

Modified: user/edwin/releasenotes/Makefile
==============================================================================
--- user/edwin/releasenotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -6,14 +6,26 @@ RELENG=7.0 6.4 6.3 6.2 6.1 6.0
 
 build:
 .for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} 
-	cd ${d}/release/doc/en_US.ISO8859-1/relnotes/; \
+	@cd ${d}/release/doc/en_US.ISO8859-1/relnotes/; \
 	make
 .endfor
 
+clean:
+.for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} 
+	@cd ${d}/release/doc/en_US.ISO8859-1/relnotes/; \
+	make clean
+.endfor
+
+perl:
+.for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} 
+	@cd ${d}/release/doc/en_US.ISO8859-1/relnotes/; \
+	make contrib.ent
+.endfor
+
 html:
 	> links.html
 .for d in ${DIRS} ${STABLE:S/^/stable-/} ${RELENG:S/^/releng-/} 
-	A=$$(find ${d} -name article.html | egrep '(relnotes/article|i386)'); \
+	@A=$$(find ${d} -name article.html | egrep '(relnotes/article|i386)'); \
 	echo "<a href=\"$${A}\">${d}</a><br>" >> links.html
 .endfor
 

Modified: user/edwin/releasenotes/contrib-xmltoent.pl
==============================================================================
--- user/edwin/releasenotes/contrib-xmltoent.pl	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/contrib-xmltoent.pl	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,6 +2,7 @@
 
 use XML::Parser;
 use Data::Dumper;
+use POSIX;
 use strict;
 
 my @tree = ();
@@ -12,6 +13,7 @@ my %branches = ();
 my %softwares = ();
 my $software = "";
 my $mfcbranch = "";
+my $mfvbranch = "";
 my $swversion = "";
 
 my %releaseent = ();
@@ -35,6 +37,11 @@ sub xml_start {
 	if ($element eq "mfc") {
 		$mfcbranch = $values[$treeindex]{branch};
 	}
+	if ($element eq "mfv") {
+		$mfvbranch = "";
+		$mfvbranch = $values[$treeindex]{branch}
+			if (defined $values[$treeindex]{branch});
+	}
 
 }
 
@@ -89,6 +96,8 @@ sub xml_char {
 						}
 						if ($tree[5] eq "mfv") {
 							$softwares{$software}{versions}{$swversion}{mfv} = $value;
+							$softwares{$software}{versions}{$swversion}{mfc}{$mfvbranch} = $value
+								if ($mfvbranch);
 							return;
 						}
 						if ($tree[5] eq "desc") {
@@ -116,7 +125,7 @@ my $p = new XML::Parser(
 		End     => \&xml_end,
 		Char    => \&xml_char,
 	});
-$p->parsefile("../../../../../contrib.xml");
+$p->parsefile(defined $ARGV[0] ? $ARGV[0] : "../../../../../contrib.xml");
 
 {
 	my %r = (
@@ -144,25 +153,41 @@ $p->parsefile("../../../../../contrib.xm
 
 #
 # If we are in -current, then release.current doesn't exist yet.
-# In that case copy all MFVs into MFC{release.branch}. The date
+# In that case copy all MFVs into MFC{branchitwasinMFVin}. The date
 # of the new MFC is the date of the release.prev.
 #
 # release.current is then assigned with release.branch.
 #
-# the creation date of branches{release.current} will be
-# branches{release.prev}
+# the creation date of branches{release.current} will be today.
 #
 if (!defined $branches{$releaseent{"release.current"}}) {
 	foreach my $sw (keys(%softwares)) {
 		foreach my $vs (keys(%{$softwares{$sw}{versions}})) {
+			next;
+			# XXX
 			next if (!defined $softwares{$sw}{versions}{$vs}{mfv});
-			$softwares{$sw}{versions}{$vs}{mfc}{$releaseent{"release.branch"}} = $softwares{$sw}{versions}{$vs}{mfv};
+			my $date = $softwares{$sw}{versions}{$vs}{mfv};
+			my $branch = 0;
+
+			foreach my $b (sort(keys(%branches))) {
+				if ($b !~ /\./ &&
+				    $date lt $branches{$b} &&
+				    ($branch eq "0" || $date lt $branches{$branch})) {
+					$branch = $b;
+				}
+			}
+
+			$softwares{$sw}{versions}{$vs}{mfc}{$branch} =
+				$softwares{$sw}{versions}{$vs}{mfv};
 		}
 	}
 
 	$releaseent{"release.current"} = $releaseent{"release.branch"};
-	$branches{$releaseent{"release.current"}} =
-		$branches{$releaseent{"release.prev"}}
+#	$branches{$releaseent{"release.current"}} =
+#		$branches{$releaseent{"release.prev"}}
+	my @lt = localtime();
+	$branches{$releaseent{"release.current"}} = strftime("%Y-%m-%d",
+	    0, 0, 0, $lt[3], $lt[4], $lt[5]);
 
 }
 
@@ -189,8 +214,57 @@ if ($thisversion =~ /^(\d+)\.(\d+)/) {
 	$prevversion = $1 - 1;
 }
 
-print "$thisversion - $prevversion\n";
-print "$branches{$thisversion} - $branches{$prevversion}\n";
-#print Dumper(%branches);
-#print Dumper(%releaseent);
-#print Dumper(%softwares);
+#
+# Now we know the branches to compare, we know the dates between
+# which the changes have to be displayed.
+#
+# Let's find the software which has been updated
+#
+
+my $T1 = $branches{$prevversion};
+my $T2 = $branches{$thisversion};
+my @T1 = split(/\-/, $T1);
+my @T2 = split(/\-/, $T2);
+
+my %updated = ();
+
+#print $releaseent{"release.current"}, " - $thisversion - $prevversion\n";
+#print "$branches{$thisversion} - $branches{$prevversion}\n";
+
+my %versions = ();
+foreach my $sw (sort(keys(%softwares))) {
+	foreach my $vs (sort(keys(%{$softwares{$sw}{versions}}))) {
+		foreach my $branch (sort(keys(%{$softwares{$sw}{versions}{$vs}{mfc}}))) {
+			next if ($branch ne $prevversion &&
+			    $branch ne $thisversion);
+
+			my $date = $softwares{$sw}{versions}{$vs}{mfc}{$branch};
+			next if ($date lt $branches{$prevversion} ||
+			    $date gt $branches{$thisversion});
+#			print "$date - $branch - $vs -> $sw\n";
+			if (!defined $versions{$sw}{f_date} ||
+			    $versions{$sw}{f_date} ge $date) {
+				$versions{$sw}{f_date} = $date;
+				$versions{$sw}{f_version} = $vs;
+			}
+			if (!defined $versions{$sw}{l_date} ||
+			    $versions{$sw}{l_date} le $date) {
+				$versions{$sw}{l_date} = $date;
+				$versions{$sw}{l_version} = $vs;
+			}
+		}
+	}
+}
+
+foreach my $sw (sort(keys(%versions))) {
+	my $a = $softwares{$sw}{desc};
+	print "<!ENTITY contrib.${sw}1 \"$versions{$sw}{f_version}\">\n";
+	print "<!ENTITY contrib.${sw}2 \"$versions{$sw}{l_version}\">\n";
+	print "<!ENTITY contrib.${sw}text \"$softwares{$sw}{desc}\">\n";
+}
+
+print "<!ENTITY contrib.softwares \"";
+foreach my $sw (sort(keys(%versions))) {
+	print "&contrib.${sw}text; ";
+}
+print "\">\n";

Modified: user/edwin/releasenotes/contrib.xml
==============================================================================
--- user/edwin/releasenotes/contrib.xml	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/contrib.xml	Tue Oct 21 10:54:12 2008	(r184121)
@@ -8,62 +8,63 @@
     <branch name="6.2">2006-11-14</branch>
     <branch name="6.3">2007-10-24</branch>
     <branch name="6.4">2008-10-02</branch>
+    <branch name="5">2003-01-15</branch>
   </branches>
 
   <softwares>
     <software name="less">
       <desc><![CDATA[
 	<para><application>less</application> has been updated from
-	      %v1% to %v2%.</para>
+	      &contrib.less1; to &contrib.less2;</para>
       ]]></desc>
 
       <versions>
 	<version version="v416">
 	  <import>2007-11-26</import>
-	  <mfv>2007-11-26</mfv>
+	  <mfv branch="8">2007-11-26</mfv>
 	  <mfc branch="7">2007-12-05</mfc>
 	  <mfc branch="6">2007-12-05</mfc>
 	</version>
 	<version version="v415">
 	  <import>2007-11-17</import>
-	  <mfv>2007-11-17</mfv>
+	  <mfv branch="8">2007-11-17</mfv>
 	</version>
 	<version version="v409">
 	  <import>2007-10-13</import>
-	  <mfv>2007-10-13</mfv>
+	  <mfv branch="8">2007-10-13</mfv>
 	  <mfc branch="7">2007-10-18</mfc>
 	  <mfc branch="6">2007-10-16</mfc>
 	</version>
 	<version version="v408">
 	  <import>2007-10-09</import>
-	  <mfv>2007-10-09</mfv>
+	  <mfv branch="7">2007-10-09</mfv>
 	  <mfc branch="6">2007-10-12</mfc>
 	</version>
 	<version version="v406">
 	  <import>2007-06-21</import>
-	  <mfv>2007-06-21</mfv>
+	  <mfv branch="7">2007-06-21</mfv>
 	  <mfc branch="6">2007-07-03</mfc>
 	</version>
 	<version version="v403">
 	  <import>2007-06-04</import>
-	  <mfv>2007-06-04</mfv>
+	  <mfv branch="7">2007-06-04</mfv>
 	</version>
 	<version version="v394">
 	  <import>2006-08-21</import>
-	  <mfv>2006-08-21</mfv>
+	  <mfv branch="7">2006-08-21</mfv>
 	  <mfc branch="6">2006-08-30</mfc>
 	</version>
 	<version version="v381">
 	  <import>2004-04-17</import>
-	  <mfv>2004-04-17</mfv>
+	  <mfv branch="6">2004-04-17</mfv>
 	</version>
 	<version version="v371">
 	  <import>2002-01-08</import>
-	  <mfv>2002-01-08</mfv>
+	  <mfv branch="5">2002-01-08</mfv>
 	</version>
 	<version version="v357">
 	  <import>2000-07-14</import>
-	  <mfv>2000-07-14</mfv>
+	  <mfv branch="5">2000-07-14</mfv>
 	</version>
 	<version version="v354">
 	  <import>2000-05-22</import>
@@ -74,123 +75,123 @@
     <software name="tzdata">
       <desc><![CDATA[
 	  <para>The timezone database has been updated from
-	  the <application>%v1%</application> release to the
-	  <application>%v2%</application> release.</para>
+	  the <application>&contrib.tzdata1;</application> release to the
+	  <application>&contrib.tzdata2;</application> release.</para>
       ]]></desc>
 
       <versions>
 	<version version="tzdata2008h">
 	  <import>2008-10-14</import>
-	  <mfv>2008-10-14</mfv>
+	  <mfv branch="8">2008-10-14</mfv>
 	  <mfc branch="7">2008-10-14</mfc>
 	  <mfc branch="6">2008-10-14</mfc>
 	  <mfc branch="6.4">2008-10-14</mfc>
 	</version>
 	<version version="tzdata2008g">
 	  <import>2008-10-14</import>
-	  <mfv>2008-10-14</mfv>
+	  <mfv branch="8">2008-10-14</mfv>
 	  <mfc branch="7">2008-10-14</mfc>
 	  <mfc branch="6">2008-10-14</mfc>
 	  <mfc branch="6.4">2008-10-14</mfc>
 	</version>
 	<version version="tzdata2008f">
 	  <import>2008-09-16</import>
-	  <mfv>2008-09-16</mfv>
+	  <mfv branch="8">2008-09-16</mfv>
 	  <mfc branch="7">2008-09-16</mfc>
 	  <mfc branch="6">2008-09-16</mfc>
 	</version>
 	<version version="tzdata2008e">
 	  <import>2008-08-08</import>
-	  <mfv>2008-08-08</mfv>
+	  <mfv branch="8">2008-08-08</mfv>
 	  <mfc branch="7">2008-08-08</mfc>
 	  <mfc branch="6">2008-08-15</mfc>
 	</version>
 	<version version="tzdata2008d">
 	  <import>2008-08-08</import>
-	  <mfv>2008-08-08</mfv>
+	  <mfv branch="8">2008-08-08</mfv>
 	  <mfc branch="7">2008-08-08</mfc>
 	  <mfc branch="6">2008-08-15</mfc>
 	</version>
 	<version version="tzdata2008c">
 	  <import>2008-08-08</import>
-	  <mfv>2008-08-08</mfv>
+	  <mfv branch="8">2008-08-08</mfv>
 	  <mfc branch="7">2008-08-08</mfc>
 	  <mfc branch="6">2008-08-15</mfc>
 	</version>
 	<version version="tzdata2008b">
 	  <import>2008-03-25</import>
-	  <mfv>2008-08-08</mfv>
+	  <mfv branch="8">2008-08-08</mfv>
 	  <mfc branch="7">2008-03-25</mfc>
 	  <mfc branch="6">2008-03-25</mfc>
 	</version>
 	<version version="tzdata2008a">
 	  <import>2008-03-09</import>
-	  <mfv>2008-03-09</mfv>
+	  <mfv branch="8">2008-03-09</mfv>
 	  <mfc branch="7">2008-03-09</mfc>
 	  <mfc branch="6">2008-03-09</mfc>
 	</version>
 	<version version="tzdata2007k">
 	  <import>2008-01-01</import>
-	  <mfv>2008-01-01</mfv>
+	  <mfv branch="8">2008-01-01</mfv>
 	  <mfc branch="7">2008-01-06</mfc>
 	  <mfc branch="6">2008-01-06</mfc>
 	  <mfc branch="6.3">2008-01-06</mfc>
 	</version>
 	<version version="tzdata2007j">
 	  <import>2007-12-04</import>
-	  <mfv>2007-12-04</mfv>
+	  <mfv branch="8">2007-12-04</mfv>
 	</version>
 	<version version="tzdata2007i">
 	  <import>2007-11-04</import>
-	  <mfv>2007-11-04</mfv>
+	  <mfv branch="8">2007-11-04</mfv>
 	</version>
 	<version version="tzdata2007h">
 	  <import>2007-10-09</import>
-	  <mfv>2007-10-09</mfv>
+	  <mfv branch="7">2007-10-09</mfv>
 	  <mfc branch="6">2007-10-18</mfc>
 	</version>
 	<version version="tzdata2007g">
 	  <import>2007-08-24</import>
-	  <mfv>2007-08-24</mfv>
+	  <mfv branch="7">2007-08-24</mfv>
 	  <mfc branch="6">2007-09-02</mfc>
 	</version>
 	<version version="tzdata2007f">
 	  <import>2007-05-21</import>
-	  <mfv>2007-05-21</mfv>
+	  <mfv branch="7">2007-05-21</mfv>
 	</version>
 	<version version="tzdata2006n">
 	  <import>2006-05-11</import>
-	  <mfv>2006-05-21</mfv>
+	  <mfv branch="7">2006-05-21</mfv>
 	  <mfc branch="6">2006-10-16</mfc>
 	</version>
 	<version version="tzdata2006g">
 	  <import>2006-05-11</import>
-	  <mfv></mfv>
+	  <mfv branch="7">x</mfv>
 	  <mfc branch="6">2005-05-11</mfc>
 	</version>
 	<version version="tzdata2005r">
 	  <import>2005-12-27</import>
-	  <mfv>2005-12-27</mfv>
+	  <mfv branch="7">2005-12-27</mfv>
 	  <mfc branch="6">2005-12-27</mfc>
 	</version>
 	<version version="tzdata2005q">
 	  <import>2005-12-22</import>
-	  <mfv>2005-12-22</mfv>
+	  <mfv branch="7">2005-12-22</mfv>
 	  <mfc branch="6">2005-12-22</mfc>
 	</version>
 	<version version="tzdata2005m">
 	  <import>2005-08-26</import>
-	  <mfv>2005-08-29</mfv>
+	  <mfv branch="7">2005-08-29</mfv>
 	  <mfc branch="6">2005-12-22</mfc>
 	</version>
 	<version version="tzdata2005l">
 	  <import>2005-08-26</import>
-	  <mfv>2005-08-27</mfv>
+	  <mfv branch="7">2005-08-27</mfv>
 	  <mfc branch="6">2005-12-22</mfc>
 	</version>
 	<version version="tzdata2004g">
 	  <import>2004-12-03</import>
-	  <mfv>2004-12-03</mfv>
+	  <mfv branch="7">2004-12-03</mfv>
 	  <mfc branch="6">2004-12-02</mfc>
 	</version>
 	<version version="tzdata2004e">

Modified: user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/head/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -19,10 +19,11 @@ JADEFLAGS+=	-V %generate-article-toc%
 SRCS+=	article.sgml
 
 # Contributed software
-SRCS+= contrib.ent
+SRCS+=	contrib.ent
+CLEANFILES+= contrib.ent
 
 contrib.ent: ${RELN_ROOT}/../../../contrib.xml
-	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl > contrib.ent
 
 URL_RELPREFIX?=	../../../..
 

Modified: user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,12 +2,16 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386
 SUBDIR+= pc98
 SUBDIR+= sparc64
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
 .include "${DOC_PREFIX}/share/mk/doc.project.mk"

Added: user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/releng-6.0/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,7 +2,8 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386

Added: user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/releng-6.1/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,7 +2,8 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386

Added: user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/releng-6.2/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,7 +2,8 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386
@@ -10,5 +11,8 @@ SUBDIR+= pc98
 SUBDIR+= powerpc
 SUBDIR+= sparc64
 
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+
 .include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
 .include "${DOC_PREFIX}/share/mk/doc.project.mk"

Added: user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/releng-6.3/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,7 +2,8 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386

Added: user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/releng-6.4/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/releng-7.0/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -18,8 +18,12 @@ JADEFLAGS+=	-V %generate-article-toc%
 # SGML content
 SRCS+=	article.sgml
 
+# Contributes software
+SRCS+=	contrib.ent
+CLEANFILES+=	contrib.ent
+
 contrib.ent: ${RELN_ROOT}/../../../contrib.xml
-	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl > contrib.ent
 
 URL_RELPREFIX?=	../../../..
 

Modified: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -2,7 +2,8 @@
 
 RELN_ROOT?= ${.CURDIR}/../..
 
-SUBDIR = alpha
+SUBDIR = common
+SUBDIR+= alpha
 SUBDIR+= amd64
 SUBDIR+= ia64
 SUBDIR+= i386

Added: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -0,0 +1,27 @@
+# $FreeBSD: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/Makefile 165865 2007-01-07 18:37:59Z marcel $
+
+RELN_ROOT?= ${.CURDIR}/../../..
+
+.ifdef NO_LANGCODE_IN_DESTDIR
+DESTDIR?=	${DOCDIR}/relnotes
+.else
+DESTDIR?=	${DOCDIR}/en_US.ISO8859-1/relnotes
+.endif
+
+DOC?=	article
+FORMATS?=	html
+INSTALL_COMPRESSED?=	gz
+INSTALL_ONLY_COMPRESSED?=
+
+JADEFLAGS+=	-V %generate-article-toc%
+
+CLEANFILES+=	contrib.ent
+SRCS+=		contrib.ent
+
+contrib.ent: ${RELN_ROOT}/../../../contrib.xml
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl $? > contrib.ent
+
+URL_RELPREFIX?=	../../../../..
+
+.include "${RELN_ROOT}/share/mk/doc.relnotes.mk"
+.include "${DOC_PREFIX}/share/mk/doc.project.mk"

Modified: user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml
==============================================================================
--- user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/stable-6/release/doc/en_US.ISO8859-1/relnotes/common/new.sgml	Tue Oct 21 10:54:12 2008	(r184121)
@@ -198,6 +198,12 @@
 
   <sect2 id="contrib">
     <title>Contributed Software</title>
+    &contrib.softwares;
+
+  </sect>
+
+  <sect2 id="excontrib">
+    <title>Contributed Software</title>
 
     <para><application>bzip2</application> has been updated from 1.0.4
       to 1.0.5.</para>

Modified: user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile
==============================================================================
--- user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:17:51 2008	(r184120)
+++ user/edwin/releasenotes/stable-7/release/doc/en_US.ISO8859-1/relnotes/Makefile	Tue Oct 21 10:54:12 2008	(r184121)
@@ -18,8 +18,12 @@ JADEFLAGS+=	-V %generate-article-toc%
 # SGML content
 SRCS+=	article.sgml
 
+# Contributed software
+SRCS+=	contrib.ent
+CLEANFILES+=	contrib.ent
+
 contrib.ent: ${RELN_ROOT}/../../../contrib.xml
-	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl
+	${PERL} -w ${RELN_ROOT}/../../../contrib-xmltoent.pl > contrib.ent
 
 URL_RELPREFIX?=	../../../..