From owner-svn-src-user@FreeBSD.ORG  Sun Apr 18 22:02:56 2010
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 20AFE1065670;
	Sun, 18 Apr 2010 22:02:56 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0FD6C8FC1B;
	Sun, 18 Apr 2010 22:02:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IM2txd006527;
	Sun, 18 Apr 2010 22:02:55 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IM2tld006523;
	Sun, 18 Apr 2010 22:02:55 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004182202.o3IM2tld006523@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sun, 18 Apr 2010 22:02:55 +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: r206816 - in user/jmallett/octeon/sys/mips: include mips
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, 18 Apr 2010 22:02:56 -0000

Author: jmallett
Date: Sun Apr 18 22:02:55 2010
New Revision: 206816
URL: http://svn.freebsd.org/changeset/base/206816

Log:
  Add support for showing a remote CPU's TLB entries back.

Modified:
  user/jmallett/octeon/sys/mips/include/tlb.h
  user/jmallett/octeon/sys/mips/mips/mp_machdep.c
  user/jmallett/octeon/sys/mips/mips/tlb.c

Modified: user/jmallett/octeon/sys/mips/include/tlb.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/tlb.h	Sun Apr 18 21:36:34 2010	(r206815)
+++ user/jmallett/octeon/sys/mips/include/tlb.h	Sun Apr 18 22:02:55 2010	(r206816)
@@ -33,6 +33,7 @@ void tlb_insert_wired(unsigned, vm_offse
 void tlb_invalidate_address(struct pmap *, vm_offset_t);
 void tlb_invalidate_all(void);
 void tlb_invalidate_all_user(struct pmap *);
+void tlb_save(void);
 void tlb_update(struct pmap *, vm_offset_t, pt_entry_t);
 
 #endif /* !_MACHINE_TLB_H_ */

Modified: user/jmallett/octeon/sys/mips/mips/mp_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/mp_machdep.c	Sun Apr 18 21:36:34 2010	(r206815)
+++ user/jmallett/octeon/sys/mips/mips/mp_machdep.c	Sun Apr 18 22:02:55 2010	(r206816)
@@ -129,6 +129,7 @@ mips_ipi_handler(void *arg)
 			CTR0(KTR_SMP, "IPI_STOP or IPI_STOP_HARD");
 
 			savectx(&stoppcbs[cpu]);
+			tlb_save();
 
 			/* Indicate we are stopped */
 			atomic_set_int(&stopped_cpus, cpumask);

Modified: user/jmallett/octeon/sys/mips/mips/tlb.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/tlb.c	Sun Apr 18 21:36:34 2010	(r206815)
+++ user/jmallett/octeon/sys/mips/mips/tlb.c	Sun Apr 18 22:02:55 2010	(r206816)
@@ -32,6 +32,7 @@
 #include <sys/kernel.h>
 #include <sys/systm.h>
 #include <sys/pcpu.h>
+#include <sys/smp.h>
 
 #include <vm/vm.h>
 #include <vm/vm_page.h>
@@ -39,6 +40,17 @@
 #include <machine/pte.h>
 #include <machine/tlb.h>
 
+struct tlb_state {
+	unsigned wired;
+	struct tlb_entry {
+		register_t entryhi;
+		register_t entrylo0;
+		register_t entrylo1;
+	} entry[MIPS_MAX_TLB_ENTRIES];
+};
+
+static struct tlb_state tlb_state[MAXCPU];
+
 #if 0
 /*
  * PageMask must increment in steps of 2 bits.
@@ -183,6 +195,25 @@ tlb_invalidate_all_user(struct pmap *pma
 	intr_restore(s);
 }
 
+/* XXX Only if DDB?  */
+void
+tlb_save(void)
+{
+	unsigned i, cpu;
+
+	cpu = PCPU_GET(cpuid);
+
+	tlb_state[cpu].wired = mips_rd_wired();
+	for (i = 0; i < num_tlbentries; i++) {
+		mips_wr_index(i);
+		tlb_read();
+
+		tlb_state[cpu].entry[i].entryhi = mips_rd_entryhi();
+		tlb_state[cpu].entry[i].entrylo0 = mips_rd_entrylo0();
+		tlb_state[cpu].entry[i].entrylo1 = mips_rd_entrylo1();
+	}
+}
+
 void
 tlb_update(struct pmap *pmap, vm_offset_t va, pt_entry_t pte)
 {
@@ -235,22 +266,38 @@ tlb_invalidate_one(unsigned i)
 DB_SHOW_COMMAND(tlb, ddb_dump_tlb)
 {
 	register_t ehi, elo0, elo1;
-	unsigned i;
+	unsigned i, cpu;
 
-	db_printf("Beginning TLB dump...\n");
+	/*
+	 * XXX
+	 * The worst conversion from hex to decimal ever.
+	 */
+	if (have_addr)
+		cpu = ((addr >> 4) % 16) * 10 + (addr % 16);
+	else
+		cpu = PCPU_GET(cpuid);
+
+	if (cpu < 0 || cpu >= mp_ncpus) {
+		db_printf("Invalid CPU %u\n", cpu);
+		return;
+	}
+
+	if (cpu == PCPU_GET(cpuid))
+		tlb_save();
+
+	db_printf("Beginning TLB dump for CPU %u...\n", cpu);
 	for (i = 0; i < num_tlbentries; i++) {
-		if (i == mips_rd_wired()) {
+		if (i == tlb_state[cpu].wired) {
 			if (i != 0)
 				db_printf("^^^ WIRED ENTRIES ^^^\n");
 			else
 				db_printf("(No wired entries.)\n");
 		}
-		mips_wr_index(i);
-		tlb_read();
 
-		ehi = mips_rd_entryhi();
-		elo0 = mips_rd_entrylo0();
-		elo1 = mips_rd_entrylo1();
+		/* XXX PageMask.  */
+		ehi = tlb_state[cpu].entry[i].entryhi;
+		elo0 = tlb_state[cpu].entry[i].entrylo0;
+		elo1 = tlb_state[cpu].entry[i].entrylo1;
 
 		if (elo0 == 0 && elo1 == 0)
 			continue;

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 18 22:34:29 2010
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 B44231065673;
	Sun, 18 Apr 2010 22:34:29 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A1C5A8FC18;
	Sun, 18 Apr 2010 22:34:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IMYTX7014536;
	Sun, 18 Apr 2010 22:34:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IMYTp3014534;
	Sun, 18 Apr 2010 22:34:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004182234.o3IMYTp3014534@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sun, 18 Apr 2010 22:34:29 +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: r206820 -
	user/jmallett/octeon/tools/regression/lib/libc/gen
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, 18 Apr 2010 22:34:29 -0000

Author: jmallett
Date: Sun Apr 18 22:34:29 2010
New Revision: 206820
URL: http://svn.freebsd.org/changeset/base/206820

Log:
  Manually add somehow-mismerged file.

Added:
  user/jmallett/octeon/tools/regression/lib/libc/gen/test-fnmatch.c

Added: user/jmallett/octeon/tools/regression/lib/libc/gen/test-fnmatch.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/tools/regression/lib/libc/gen/test-fnmatch.c	Sun Apr 18 22:34:29 2010	(r206820)
@@ -0,0 +1,336 @@
+/*-
+ * Copyright (c) 2010 Jilles Tjoelker
+ * 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: head/tools/regression/lib/libc/gen/test-fnmatch.c 206711 2010-04-16 22:29:24Z jilles $");
+
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fnmatch.h>
+
+struct testcase {
+	const char *pattern;
+	const char *string;
+	int flags;
+	int result;
+} testcases[] = {
+	"", "", 0, 0,
+	"a", "a", 0, 0,
+	"a", "b", 0, FNM_NOMATCH,
+	"a", "A", 0, FNM_NOMATCH,
+	"*", "a", 0, 0,
+	"*", "aa", 0, 0,
+	"*a", "a", 0, 0,
+	"*a", "b", 0, FNM_NOMATCH,
+	"*a*", "b", 0, FNM_NOMATCH,
+	"*a*b*", "ab", 0, 0,
+	"*a*b*", "qaqbq", 0, 0,
+	"*a*bb*", "qaqbqbbq", 0, 0,
+	"*a*bc*", "qaqbqbcq", 0, 0,
+	"*a*bb*", "qaqbqbb", 0, 0,
+	"*a*bc*", "qaqbqbc", 0, 0,
+	"*a*bb", "qaqbqbb", 0, 0,
+	"*a*bc", "qaqbqbc", 0, 0,
+	"*a*bb", "qaqbqbbq", 0, FNM_NOMATCH,
+	"*a*bc", "qaqbqbcq", 0, FNM_NOMATCH,
+	"*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaa", 0, FNM_NOMATCH,
+	"*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaa", 0, 0,
+	"*a*a*a*a*a*a*a*a*a*a*", "aaaaaaaaaaa", 0, 0,
+	".*.*.*.*.*.*.*.*.*.*", ".........", 0, FNM_NOMATCH,
+	".*.*.*.*.*.*.*.*.*.*", "..........", 0, 0,
+	".*.*.*.*.*.*.*.*.*.*", "...........", 0, 0,
+	"*?*?*?*?*?*?*?*?*?*?*", "123456789", 0, FNM_NOMATCH,
+	"??????????*", "123456789", 0, FNM_NOMATCH,
+	"*??????????", "123456789", 0, FNM_NOMATCH,
+	"*?*?*?*?*?*?*?*?*?*?*", "1234567890", 0, 0,
+	"??????????*", "1234567890", 0, 0,
+	"*??????????", "1234567890", 0, 0,
+	"*?*?*?*?*?*?*?*?*?*?*", "12345678901", 0, 0,
+	"??????????*", "12345678901", 0, 0,
+	"*??????????", "12345678901", 0, 0,
+	"[x]", "x", 0, 0,
+	"[*]", "*", 0, 0,
+	"[?]", "?", 0, 0,
+	"[", "[", 0, 0,
+	"[[]", "[", 0, 0,
+	"[[]", "x", 0, FNM_NOMATCH,
+	"[*]", "", 0, FNM_NOMATCH,
+	"[*]", "x", 0, FNM_NOMATCH,
+	"[?]", "x", 0, FNM_NOMATCH,
+	"*[*]*", "foo*foo", 0, 0,
+	"*[*]*", "foo", 0, FNM_NOMATCH,
+	"[0-9]", "0", 0, 0,
+	"[0-9]", "5", 0, 0,
+	"[0-9]", "9", 0, 0,
+	"[0-9]", "/", 0, FNM_NOMATCH,
+	"[0-9]", ":", 0, FNM_NOMATCH,
+	"[0-9]", "*", 0, FNM_NOMATCH,
+	"[!0-9]", "0", 0, FNM_NOMATCH,
+	"[!0-9]", "5", 0, FNM_NOMATCH,
+	"[!0-9]", "9", 0, FNM_NOMATCH,
+	"[!0-9]", "/", 0, 0,
+	"[!0-9]", ":", 0, 0,
+	"[!0-9]", "*", 0, 0,
+	"*[0-9]", "a0", 0, 0,
+	"*[0-9]", "a5", 0, 0,
+	"*[0-9]", "a9", 0, 0,
+	"*[0-9]", "a/", 0, FNM_NOMATCH,
+	"*[0-9]", "a:", 0, FNM_NOMATCH,
+	"*[0-9]", "a*", 0, FNM_NOMATCH,
+	"*[!0-9]", "a0", 0, FNM_NOMATCH,
+	"*[!0-9]", "a5", 0, FNM_NOMATCH,
+	"*[!0-9]", "a9", 0, FNM_NOMATCH,
+	"*[!0-9]", "a/", 0, 0,
+	"*[!0-9]", "a:", 0, 0,
+	"*[!0-9]", "a*", 0, 0,
+	"*[0-9]", "a00", 0, 0,
+	"*[0-9]", "a55", 0, 0,
+	"*[0-9]", "a99", 0, 0,
+	"*[0-9]", "a0a0", 0, 0,
+	"*[0-9]", "a5a5", 0, 0,
+	"*[0-9]", "a9a9", 0, 0,
+	"\\*", "*", 0, 0,
+	"\\?", "?", 0, 0,
+	"\\[x]", "[x]", 0, 0,
+	"\\[", "[", 0, 0,
+	"\\\\", "\\", 0, 0,
+	"*\\**", "foo*foo", 0, 0,
+	"*\\**", "foo", 0, FNM_NOMATCH,
+	"*\\\\*", "foo\\foo", 0, 0,
+	"*\\\\*", "foo", 0, FNM_NOMATCH,
+	"\\(", "(", 0, 0,
+	"\\a", "a", 0, 0,
+	"\\*", "a", 0, FNM_NOMATCH,
+	"\\?", "a", 0, FNM_NOMATCH,
+	"\\*", "\\*", 0, FNM_NOMATCH,
+	"\\?", "\\?", 0, FNM_NOMATCH,
+	"\\[x]", "\\[x]", 0, FNM_NOMATCH,
+	"\\[x]", "\\x", 0, FNM_NOMATCH,
+	"\\[", "\\[", 0, FNM_NOMATCH,
+	"\\(", "\\(", 0, FNM_NOMATCH,
+	"\\a", "\\a", 0, FNM_NOMATCH,
+	"\\*", "\\*", FNM_NOESCAPE, 0,
+	"\\?", "\\?", FNM_NOESCAPE, 0,
+	"\\", "\\", FNM_NOESCAPE, 0,
+	"\\\\", "\\", FNM_NOESCAPE, FNM_NOMATCH,
+	"\\\\", "\\\\", FNM_NOESCAPE, 0,
+	"*\\*", "foo\\foo", FNM_NOESCAPE, 0,
+	"*\\*", "foo", FNM_NOESCAPE, FNM_NOMATCH,
+	"*", ".", FNM_PERIOD, FNM_NOMATCH,
+	"?", ".", FNM_PERIOD, FNM_NOMATCH,
+	".*", ".", 0, 0,
+	".*", "..", 0, 0,
+	".*", ".a", 0, 0,
+	"[0-9]", ".", FNM_PERIOD, FNM_NOMATCH,
+	"a*", "a.", 0, 0,
+	"a/a", "a/a", FNM_PATHNAME, 0,
+	"a/*", "a/a", FNM_PATHNAME, 0,
+	"*/a", "a/a", FNM_PATHNAME, 0,
+	"*/*", "a/a", FNM_PATHNAME, 0,
+	"a*b/*", "abbb/x", FNM_PATHNAME, 0,
+	"a*b/*", "abbb/.x", FNM_PATHNAME, 0,
+	"*", "a/a", FNM_PATHNAME, FNM_NOMATCH,
+	"*/*", "a/a/a", FNM_PATHNAME, FNM_NOMATCH,
+	"b/*", "b/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH,
+	"b*/*", "a/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH,
+	"b/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0,
+	"b*/.*", "b/.x", FNM_PATHNAME | FNM_PERIOD, 0,
+	"a", "A", FNM_CASEFOLD, 0,
+	"A", "a", FNM_CASEFOLD, 0,
+	"[a]", "A", FNM_CASEFOLD, 0,
+	"[A]", "a", FNM_CASEFOLD, 0,
+	"a", "b", FNM_CASEFOLD, FNM_NOMATCH,
+	"a", "a/b", FNM_PATHNAME, FNM_NOMATCH,
+	"*", "a/b", FNM_PATHNAME, FNM_NOMATCH,
+	"*b", "a/b", FNM_PATHNAME, FNM_NOMATCH,
+	"a", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0,
+	"*", "a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0,
+	"*", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0,
+	"*a", ".a/b", FNM_PATHNAME | FNM_LEADING_DIR, 0,
+	"*", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH,
+	"*a", ".a/b", FNM_PATHNAME | FNM_PERIOD | FNM_LEADING_DIR, FNM_NOMATCH,
+	"a*b/*", "abbb/.x", FNM_PATHNAME | FNM_PERIOD, FNM_NOMATCH,
+};
+
+static const char *
+flags_to_string(int flags)
+{
+	static const int flagvalues[] = { FNM_NOESCAPE, FNM_PATHNAME,
+		FNM_PERIOD, FNM_LEADING_DIR, FNM_CASEFOLD, 0 };
+	static const char flagnames[] = "FNM_NOESCAPE\0FNM_PATHNAME\0FNM_PERIOD\0FNM_LEADING_DIR\0FNM_CASEFOLD\0";
+	static char result[sizeof(flagnames) + 3 * sizeof(int) + 2];
+	char *p;
+	size_t i, len;
+	const char *fp;
+
+	p = result;
+	fp = flagnames;
+	for (i = 0; flagvalues[i] != 0; i++) {
+		len = strlen(fp);
+		if (flags & flagvalues[i]) {
+			if (p != result)
+				*p++ = '|';
+			memcpy(p, fp, len);
+			p += len;
+			flags &= ~flagvalues[i];
+		}
+		fp += len + 1;
+	}
+	if (p == result)
+		memcpy(p, "0", 2);
+	else if (flags != 0)
+		sprintf(p, "%d", flags);
+	else
+		*p = '\0';
+	return result;
+}
+
+int
+main(int argc, char *argv[])
+{
+	size_t i, n;
+	int flags, result, extra, errors;
+	struct testcase *t;
+
+	n = sizeof(testcases) / sizeof(testcases[0]);
+	errors = 0;
+	printf("1..%zu\n", n);
+	for (i = 0; i < n; i++) {
+		t = &testcases[i];
+		flags = t->flags;
+		extra = 0;
+		do {
+			result = fnmatch(t->pattern, t->string, flags);
+			if (result != t->result)
+				break;
+			if (strchr(t->pattern, '\\') == NULL &&
+			    !(flags & FNM_NOESCAPE)) {
+				flags |= FNM_NOESCAPE;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if (strchr(t->pattern, '\\') != NULL &&
+			    strchr(t->string, '\\') == NULL &&
+			    t->result == FNM_NOMATCH &&
+			    !(flags & (FNM_NOESCAPE | FNM_LEADING_DIR))) {
+				flags |= FNM_NOESCAPE;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if ((t->string[0] != '.' || t->pattern[0] == '.' ||
+			    t->result == FNM_NOMATCH) &&
+			    !(flags & (FNM_PATHNAME | FNM_PERIOD))) {
+				flags |= FNM_PERIOD;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if ((strchr(t->string, '/') == NULL ||
+			    t->result == FNM_NOMATCH) &&
+			    !(flags & FNM_PATHNAME)) {
+				flags |= FNM_PATHNAME;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if ((((t->string[0] != '.' || t->pattern[0] == '.') &&
+			    strstr(t->string, "/.") == NULL) ||
+			    t->result == FNM_NOMATCH) &&
+			    flags & FNM_PATHNAME && !(flags & FNM_PERIOD)) {
+				flags |= FNM_PERIOD;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if ((((t->string[0] != '.' || t->pattern[0] == '.') &&
+			    strchr(t->string, '/') == NULL) ||
+			    t->result == FNM_NOMATCH) &&
+			    !(flags & (FNM_PATHNAME | FNM_PERIOD))) {
+				flags |= FNM_PATHNAME | FNM_PERIOD;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if ((strchr(t->string, '/') == NULL || t->result == 0)
+			    && !(flags & FNM_LEADING_DIR)) {
+				flags |= FNM_LEADING_DIR;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if (t->result == 0 && !(flags & FNM_CASEFOLD)) {
+				flags |= FNM_CASEFOLD;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+			if (strchr(t->pattern, '\\') == NULL &&
+			    t->result == 0 &&
+			    !(flags & (FNM_NOESCAPE | FNM_CASEFOLD))) {
+				flags |= FNM_NOESCAPE | FNM_CASEFOLD;
+				result = fnmatch(t->pattern, t->string, flags);
+				if (result != t->result)
+					break;
+				flags = t->flags;
+				extra++;
+			}
+		} while (0);
+		if (result == t->result)
+			printf("ok %zu - fnmatch(\"%s\", \"%s\", %s) = %d (+%d)\n",
+			    i + 1, t->pattern, t->string,
+			    flags_to_string(flags),
+			    result, extra);
+		else {
+			printf("not ok %zu - fnmatch(\"%s\", \"%s\", %s) = %d != %d\n",
+			    i + 1, t->pattern, t->string,
+			    flags_to_string(flags),
+			    result, t->result);
+			errors = 1;
+		}
+	}
+
+	return (errors);
+}

From owner-svn-src-user@FreeBSD.ORG  Sun Apr 18 22:51:20 2010
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 B467E106566B;
	Sun, 18 Apr 2010 22:51:20 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A031F8FC18;
	Sun, 18 Apr 2010 22:51:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3IMpKn4018338;
	Sun, 18 Apr 2010 22:51:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3IMpKah018324;
	Sun, 18 Apr 2010 22:51:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004182251.o3IMpKah018324@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sun, 18 Apr 2010 22:51:20 +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: r206822 - in user/jmallett/octeon: bin/ln bin/sh
	etc/defaults lib/libc/gen lib/libc/sys share/man/man5
	sys/cddl/contrib/opensolaris/uts/common/fs/zfs
	sys/cddl/contrib/opensolaris/uts/co...
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, 18 Apr 2010 22:51:20 -0000

Author: jmallett
Date: Sun Apr 18 22:51:20 2010
New Revision: 206822
URL: http://svn.freebsd.org/changeset/base/206822

Log:
  Merge from head.

Added:
  user/jmallett/octeon/tools/regression/bin/sh/expansion/plus-minus3.0
     - copied unchanged from r206819, head/tools/regression/bin/sh/expansion/plus-minus3.0
  user/jmallett/octeon/tools/regression/bin/sh/parameters/pwd2.0
     - copied unchanged from r206819, head/tools/regression/bin/sh/parameters/pwd2.0
Modified:
  user/jmallett/octeon/bin/ln/ln.c
  user/jmallett/octeon/bin/sh/cd.c
  user/jmallett/octeon/bin/sh/cd.h
  user/jmallett/octeon/bin/sh/main.c
  user/jmallett/octeon/etc/defaults/rc.conf
  user/jmallett/octeon/lib/libc/gen/getcwd.3
  user/jmallett/octeon/lib/libc/sys/sigaction.2
  user/jmallett/octeon/share/man/man5/rc.conf.5
  user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
  user/jmallett/octeon/sys/dev/ahci/ahci.c
  user/jmallett/octeon/sys/dev/ipw/if_ipw.c
  user/jmallett/octeon/sys/dev/ipw/if_ipwvar.h
  user/jmallett/octeon/sys/fs/nfs/nfsclstate.h
  user/jmallett/octeon/sys/fs/nfsclient/nfs_clstate.c
  user/jmallett/octeon/sys/mips/include/param.h
  user/jmallett/octeon/sys/netinet/sctp_indata.c
  user/jmallett/octeon/sys/vm/swap_pager.c
  user/jmallett/octeon/sys/vm/vm_kern.c
  user/jmallett/octeon/sys/vm/vm_object.c
  user/jmallett/octeon/sys/vm/vm_pageout.c
Directory Properties:
  user/jmallett/octeon/   (props changed)
  user/jmallett/octeon/sys/contrib/x86emu/   (props changed)
  user/jmallett/octeon/sys/mips/rmi/dev/sec/desc.h   (props changed)

Modified: user/jmallett/octeon/bin/ln/ln.c
==============================================================================
--- user/jmallett/octeon/bin/ln/ln.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/bin/ln/ln.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -172,6 +172,52 @@ main(int argc, char *argv[])
 	exit(exitval);
 }
 
+/*
+ * Two pathnames refer to the same directory entry if the directories match
+ * and the final components' names match.
+ */
+static int
+samedirent(const char *path1, const char *path2)
+{
+	const char *file1, *file2;
+	char pathbuf[PATH_MAX];
+	struct stat sb1, sb2;
+
+	if (strcmp(path1, path2) == 0)
+		return 1;
+	file1 = strrchr(path1, '/');
+	if (file1 != NULL)
+		file1++;
+	else
+		file1 = path1;
+	file2 = strrchr(path2, '/');
+	if (file2 != NULL)
+		file2++;
+	else
+		file2 = path2;
+	if (strcmp(file1, file2) != 0)
+		return 0;
+	if (file1 - path1 >= PATH_MAX || file2 - path2 >= PATH_MAX)
+		return 0;
+	if (file1 == path1)
+		memcpy(pathbuf, ".", 2);
+	else {
+		memcpy(pathbuf, path1, file1 - path1);
+		pathbuf[file1 - path1] = '\0';
+	}
+	if (stat(pathbuf, &sb1) != 0)
+		return 0;
+	if (file2 == path2)
+		memcpy(pathbuf, ".", 2);
+	else {
+		memcpy(pathbuf, path2, file2 - path2);
+		pathbuf[file2 - path2] = '\0';
+	}
+	if (stat(pathbuf, &sb2) != 0)
+		return 0;
+	return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino;
+}
+
 int
 linkit(const char *source, const char *target, int isdir)
 {
@@ -215,7 +261,6 @@ linkit(const char *source, const char *t
 		target = path;
 	}
 
-	exists = !lstat(target, &sb);
 	/*
 	 * If the link source doesn't exist, and a symbolic link was
 	 * requested, and -w was specified, give a warning.
@@ -242,8 +287,20 @@ linkit(const char *source, const char *t
 				warn("warning: %s", source);
 		}
 	}
+
+	/*
+	 * If the file exists, first check it is not the same directory entry.
+	 */
+	exists = !lstat(target, &sb);
+	if (exists) {
+		if (!sflag && samedirent(source, target)) {
+			warnx("%s and %s are the same directory entry",
+			    source, target);
+			return (1);
+		}
+	}
 	/*
-	 * If the file exists, then unlink it forcibly if -f was specified
+	 * Then unlink it forcibly if -f was specified
 	 * and interactively if -i was specified.
 	 */
 	if (fflag && exists) {

Modified: user/jmallett/octeon/bin/sh/cd.c
==============================================================================
--- user/jmallett/octeon/bin/sh/cd.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/bin/sh/cd.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -70,6 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
+STATIC char *getpwd(void);
 STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;	/* current working directory */
@@ -351,7 +352,7 @@ pwdcmd(int argc, char **argv)
 /*
  * Get the current directory and cache the result in curdir.
  */
-char *
+STATIC char *
 getpwd(void)
 {
 	char *p;
@@ -374,7 +375,6 @@ getpwd(void)
 STATIC char *
 getpwd2(void)
 {
-	struct stat stdot, stpwd;
 	char *pwd;
 	int i;
 
@@ -387,12 +387,29 @@ getpwd2(void)
 			break;
 	}
 
-	pwd = getenv("PWD");
+	return NULL;
+}
+
+/*
+ * Initialize PWD in a new shell.
+ * If the shell is interactive, we need to warn if this fails.
+ */
+void
+pwd_init(int warn)
+{
+	char *pwd;
+	struct stat stdot, stpwd;
+
+	pwd = lookupvar("PWD");
 	if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
 	    stat(pwd, &stpwd) != -1 &&
 	    stdot.st_dev == stpwd.st_dev &&
 	    stdot.st_ino == stpwd.st_ino) {
-		return pwd;
+		if (curdir)
+			ckfree(curdir);
+		curdir = savestr(pwd);
 	}
-	return NULL;
+	if (getpwd() == NULL && warn)
+		out2fmt_flush("sh: cannot determine working directory\n");
+	setvar("PWD", curdir, VEXPORT);
 }

Modified: user/jmallett/octeon/bin/sh/cd.h
==============================================================================
--- user/jmallett/octeon/bin/sh/cd.h	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/bin/sh/cd.h	Sun Apr 18 22:51:20 2010	(r206822)
@@ -29,6 +29,6 @@
  * $FreeBSD$
  */
 
-char	*getpwd(void);
+void	 pwd_init(int);
 int	 cdcmd (int, char **);
 int	 pwdcmd(int, char **);

Modified: user/jmallett/octeon/bin/sh/main.c
==============================================================================
--- user/jmallett/octeon/bin/sh/main.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/bin/sh/main.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -153,10 +153,7 @@ main(int argc, char *argv[])
 	init();
 	setstackmark(&smark);
 	procargs(argc, argv);
-	if (getpwd() == NULL && iflag)
-		out2fmt_flush("sh: cannot determine working directory\n");
-	if (getpwd() != NULL)
-		setvar ("PWD", getpwd(), VEXPORT);
+	pwd_init(iflag);
 	if (iflag)
 		chkmail(1);
 	if (argv[0] && argv[0][0] == '-') {

Modified: user/jmallett/octeon/etc/defaults/rc.conf
==============================================================================
--- user/jmallett/octeon/etc/defaults/rc.conf	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/etc/defaults/rc.conf	Sun Apr 18 22:51:20 2010	(r206822)
@@ -211,6 +211,7 @@ ifconfig_lo0="inet 127.0.0.1"	# default 
 #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
 #ifconfig_ed0_ipx="ipx 0x00010010"	# Sample IPX address family entry.
 #ifconfig_ed0_ipv6="RTADV" 	# Sample IPv6 entry for RA/rtsol(8)
+#ifconfig_ed0_ipv6="inet6 auto_linklocal" 	# To configure only link-local
 #ifconfig_ed0_ipv6="inet6 2001:db8:1::1 prefixlen 64" # Sample IPv6 addr entry
 #ifconfig_ed0_alias0="inet6 2001:db8:2::1 prefixlen 64" # Sample IPv6 alias
 #ifconfig_fxp0_name="net0"	# Change interface name from fxp0 to net0.
@@ -436,7 +437,7 @@ rfcomm_pppd_server_two_channel="3"	# Ove
 #rfcomm_pppd_server_two_register_sp="NO"	# Override SP and DUN register
 #rfcomm_pppd_server_two_register_dun="NO"	# for 'two'
 
-#ubthidhci_enable="YES"		# Switch an USB BT controller present on
+ubthidhci_enable="NO"		# Switch an USB BT controller present on
 #ubthidhci_busnum="3"		# bus 3 and addr 2 from HID mode to HCI mode.
 #ubthidhci_addr="2"		# Check usbconfig list to find the correct
 				# numbers for your system.

Modified: user/jmallett/octeon/lib/libc/gen/getcwd.3
==============================================================================
--- user/jmallett/octeon/lib/libc/gen/getcwd.3	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/lib/libc/gen/getcwd.3	Sun Apr 18 22:51:20 2010	(r206822)
@@ -28,7 +28,7 @@
 .\"     @(#)getcwd.3	8.2 (Berkeley) 12/11/93
 .\" $FreeBSD$
 .\"
-.Dd November 24, 1997
+.Dd April 17, 2010
 .Dt GETCWD 3
 .Os
 .Sh NAME
@@ -108,8 +108,6 @@ The
 function
 will fail if:
 .Bl -tag -width Er
-.It Bq Er EACCES
-Read or search permission was denied for a component of the pathname.
 .It Bq Er EINVAL
 The
 .Fa size
@@ -124,6 +122,16 @@ The
 argument is greater than zero but smaller than the length of the pathname
 plus 1.
 .El
+.Pp
+The
+.Fn getcwd
+function
+may fail if:
+.Bl -tag -width Er
+.It Bq Er EACCES
+Read or search permission was denied for a component of the pathname.
+This is only checked in limited cases, depending on implementation details.
+.El
 .Sh SEE ALSO
 .Xr chdir 2 ,
 .Xr fchdir 2 ,

Modified: user/jmallett/octeon/lib/libc/sys/sigaction.2
==============================================================================
--- user/jmallett/octeon/lib/libc/sys/sigaction.2	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/lib/libc/sys/sigaction.2	Sun Apr 18 22:51:20 2010	(r206822)
@@ -28,7 +28,7 @@
 .\"	From: @(#)sigaction.2	8.2 (Berkeley) 4/3/94
 .\" $FreeBSD$
 .\"
-.Dd April 13, 2010
+.Dd April 18, 2010
 .Dt SIGACTION 2
 .Os
 .Sh NAME
@@ -40,16 +40,11 @@
 .In signal.h
 .Bd -literal
 struct  sigaction {
-        union {
-                void    (*__sa_handler)(int);
-                void    (*__sa_sigaction)(int, siginfo_t *, void *);
-        } __sigaction_u;                /* signal handler */
+        void    (*sa_handler)(int);
+        void    (*sa_sigaction)(int, siginfo_t *, void *);
         int     sa_flags;               /* see signal options below */
         sigset_t sa_mask;               /* signal mask to apply */
 };
-
-#define	sa_handler	__sigaction_u.__sa_handler
-#define	sa_sigaction	__sigaction_u.__sa_sigaction
 .Ed
 .Ft int
 .Fo sigaction
@@ -148,6 +143,16 @@ If
 is non-zero, the previous handling information for the signal
 is returned to the user.
 .Pp
+The above declaration of
+.Vt "struct sigaction"
+is not literal.
+It is provided only to list the accessible members.
+See
+.In sys/signal.h
+for the actual definition.
+In particular, the storage occupied by sa_handler and sa_sigaction overlaps,
+and an application can not use both simultaneously.
+.Pp
 Once a signal handler is installed, it normally remains installed
 until another
 .Fn sigaction
@@ -496,16 +501,6 @@ or
 .Dv SIG_IGN
 this way.
 .Pp
-If preprocessing symbol
-.Va _POSIX_C_SOURCE
-with the value >= 199309 is not defined, the following declaration for
-the handler shall be used:
-.Bl -tag -offset indent -width short
-.It Tn POSIX Dv SA_SIGINFO :
-.Ft void
-.Fn handler int "struct __sigaction *" "void *" ;
-.El
-.Pp
 If the
 .Dv SA_SIGINFO
 flag is not set, the handler function should match

Modified: user/jmallett/octeon/share/man/man5/rc.conf.5
==============================================================================
--- user/jmallett/octeon/share/man/man5/rc.conf.5	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/share/man/man5/rc.conf.5	Sun Apr 18 22:51:20 2010	(r206822)
@@ -1303,6 +1303,13 @@ interface:
 ifconfig_ed0_ipv6="RTADV"
 .Ed
 .Pp
+To configure only a link-local address on the
+.Dq Li ed0
+interface:
+.Bd -literal
+ifconfig_ed0_ipv6="inet6 auto_linklocal"
+.Ed
+.Pp
 To disable RA the
 .Dq Li NORTADV
 option is available, although not required if manual

Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -131,7 +131,6 @@
 #include <sys/kstat.h>
 #include <sys/sdt.h>
 
-#include <sys/ktr.h>
 #include <vm/vm_pageout.h>
 
 static kmutex_t		arc_reclaim_thr_lock;
@@ -238,7 +237,7 @@ struct arcs_lock {
  */
 #define ARC_BUFC_NUMDATALISTS		16
 #define ARC_BUFC_NUMMETADATALISTS	16
-#define ARC_BUFC_NUMLISTS	(ARC_BUFC_NUMMETADATALISTS+ARC_BUFC_NUMDATALISTS)
+#define ARC_BUFC_NUMLISTS	(ARC_BUFC_NUMMETADATALISTS + ARC_BUFC_NUMDATALISTS)
 
 typedef struct arc_state {
 	uint64_t arcs_lsize[ARC_BUFC_NUMTYPES];	/* amount of evictable data */
@@ -247,7 +246,7 @@ typedef struct arc_state {
 	struct arcs_lock arcs_locks[ARC_BUFC_NUMLISTS] __aligned(CACHE_LINE_SIZE);
 } arc_state_t;
 
-#define ARCS_LOCK(s, i) &((s)->arcs_locks[(i)].arcs_lock)
+#define ARCS_LOCK(s, i)	(&((s)->arcs_locks[(i)].arcs_lock))
 
 /* The 6 states: */
 static arc_state_t ARC_anon;
@@ -307,9 +306,9 @@ typedef struct arc_stats {
 	kstat_named_t arcstat_l2_hdr_size;
 	kstat_named_t arcstat_memory_throttle_count;
 	kstat_named_t arcstat_l2_write_trylock_fail;
-	kstat_named_t arcstat_l2_write_in_l2;
 	kstat_named_t arcstat_l2_write_passed_headroom;
 	kstat_named_t arcstat_l2_write_spa_mismatch;
+	kstat_named_t arcstat_l2_write_in_l2;
 	kstat_named_t arcstat_l2_write_hdr_io_in_progress;
 	kstat_named_t arcstat_l2_write_not_cacheable;
 	kstat_named_t arcstat_l2_write_full;
@@ -370,19 +369,19 @@ static arc_stats_t arc_stats = {
 	{ "l2_size",			KSTAT_DATA_UINT64 },
 	{ "l2_hdr_size",		KSTAT_DATA_UINT64 },
 	{ "memory_throttle_count",	KSTAT_DATA_UINT64 },
-	{ "l2_write_trylock_fail", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_in_l2", 		KSTAT_DATA_UINT64 },
-	{ "l2_write_passed_headroom", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_spa_mismatch", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_io_in_progress", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_not_cacheable", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_full", 		KSTAT_DATA_UINT64 },
-	{ "l2_write_buffer_iter", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_pios", 		KSTAT_DATA_UINT64 },
-	{ "l2_write_bytes_written", 		KSTAT_DATA_UINT64 },
-	{ "l2_write_buffer_bytes_scanned", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_buffer_list_iter", 	KSTAT_DATA_UINT64 },
-	{ "l2_write_buffer_list_null_iter", 	KSTAT_DATA_UINT64 }
+	{ "l2_write_trylock_fail",	KSTAT_DATA_UINT64 },
+	{ "l2_write_passed_headroom",	KSTAT_DATA_UINT64 },
+	{ "l2_write_spa_mismatch",	KSTAT_DATA_UINT64 },
+	{ "l2_write_in_l2",		KSTAT_DATA_UINT64 },
+	{ "l2_write_io_in_progress",	KSTAT_DATA_UINT64 },
+	{ "l2_write_not_cacheable",	KSTAT_DATA_UINT64 },
+	{ "l2_write_full",		KSTAT_DATA_UINT64 },
+	{ "l2_write_buffer_iter",	KSTAT_DATA_UINT64 },
+	{ "l2_write_pios",		KSTAT_DATA_UINT64 },
+	{ "l2_write_bytes_written",	KSTAT_DATA_UINT64 },
+	{ "l2_write_buffer_bytes_scanned", KSTAT_DATA_UINT64 },
+	{ "l2_write_buffer_list_iter",	KSTAT_DATA_UINT64 },
+	{ "l2_write_buffer_list_null_iter", KSTAT_DATA_UINT64 }
 };
 
 #define	ARCSTAT(stat)	(arc_stats.stat.value.ui64)
@@ -390,7 +389,7 @@ static arc_stats_t arc_stats = {
 #define	ARCSTAT_INCR(stat, val) \
 	atomic_add_64(&arc_stats.stat.value.ui64, (val));
 
-#define	ARCSTAT_BUMP(stat) 	ARCSTAT_INCR(stat, 1)
+#define	ARCSTAT_BUMP(stat)	ARCSTAT_INCR(stat, 1)
 #define	ARCSTAT_BUMPDOWN(stat)	ARCSTAT_INCR(stat, -1)
 
 #define	ARCSTAT_MAX(stat, val) {					\
@@ -424,7 +423,7 @@ static arc_stats_t arc_stats = {
 	}
 
 kstat_t			*arc_ksp;
-static arc_state_t 	*arc_anon;
+static arc_state_t	*arc_anon;
 static arc_state_t	*arc_mru;
 static arc_state_t	*arc_mru_ghost;
 static arc_state_t	*arc_mfu;
@@ -1076,10 +1075,10 @@ get_buf_info(arc_buf_hdr_t *ab, arc_stat
 {
 	uint64_t buf_hashid = buf_hash(ab->b_spa, &ab->b_dva, ab->b_birth);
 
-	if (ab->b_type == ARC_BUFC_METADATA) 
-		buf_hashid &= (ARC_BUFC_NUMMETADATALISTS-1);
+	if (ab->b_type == ARC_BUFC_METADATA)
+		buf_hashid &= (ARC_BUFC_NUMMETADATALISTS - 1);
 	else {
-		buf_hashid &= (ARC_BUFC_NUMDATALISTS-1);
+		buf_hashid &= (ARC_BUFC_NUMDATALISTS - 1);
 		buf_hashid += ARC_BUFC_NUMMETADATALISTS;
 	}
 
@@ -1096,18 +1095,16 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
 
 	if ((refcount_add(&ab->b_refcnt, tag) == 1) &&
 	    (ab->b_state != arc_anon)) {
-		list_t *list;
-		kmutex_t *lock;
 		uint64_t delta = ab->b_size * ab->b_datacnt;
 		uint64_t *size = &ab->b_state->arcs_lsize[ab->b_type];
+		list_t *list;
+		kmutex_t *lock;
 
 		get_buf_info(ab, ab->b_state, &list, &lock);
 		ASSERT(!MUTEX_HELD(lock));
 		mutex_enter(lock);
 		ASSERT(list_link_active(&ab->b_arc_node));
 		list_remove(list, ab);
-		mutex_exit(lock);
-
 		if (GHOST_STATE(ab->b_state)) {
 			ASSERT3U(ab->b_datacnt, ==, 0);
 			ASSERT3P(ab->b_buf, ==, NULL);
@@ -1116,6 +1113,7 @@ add_reference(arc_buf_hdr_t *ab, kmutex_
 		ASSERT(delta > 0);
 		ASSERT3U(*size, >=, delta);
 		atomic_add_64(size, -delta);
+		mutex_exit(lock);
 		/* remove the prefetch flag if we get a reference */
 		if (ab->b_flags & ARC_PREFETCH)
 			ab->b_flags &= ~ARC_PREFETCH;
@@ -1138,15 +1136,13 @@ remove_reference(arc_buf_hdr_t *ab, kmut
 		kmutex_t *lock;
 
 		get_buf_info(ab, state, &list, &lock);
-
 		ASSERT(!MUTEX_HELD(lock));
 		mutex_enter(lock);
 		ASSERT(!list_link_active(&ab->b_arc_node));
 		list_insert_head(list, ab);
-		mutex_exit(lock);
-
 		ASSERT(ab->b_datacnt > 0);
 		atomic_add_64(size, ab->b_size * ab->b_datacnt);
+		mutex_exit(lock);
 	}
 	return (cnt);
 }
@@ -1182,7 +1178,6 @@ arc_change_state(arc_state_t *new_state,
 
 			get_buf_info(ab, old_state, &list, &lock);
 			use_mutex = !MUTEX_HELD(lock);
-
 			if (use_mutex)
 				mutex_enter(lock);
 
@@ -1205,13 +1200,11 @@ arc_change_state(arc_state_t *new_state,
 				mutex_exit(lock);
 		}
 		if (new_state != arc_anon) {
-			int use_mutex; 
+			int use_mutex;
 			uint64_t *size = &new_state->arcs_lsize[ab->b_type];
 
 			get_buf_info(ab, new_state, &list, &lock);
 			use_mutex = !MUTEX_HELD(lock);
-			
-			
 			if (use_mutex)
 				mutex_enter(lock);
 
@@ -1629,7 +1622,7 @@ arc_evict(arc_state_t *state, spa_t *spa
 	ASSERT(state == arc_mru || state == arc_mfu);
 
 	evicted_state = (state == arc_mru) ? arc_mru_ghost : arc_mfu_ghost;
-	
+
 	if (type == ARC_BUFC_METADATA) {
 		offset = 0;
 		list_count = ARC_BUFC_NUMMETADATALISTS;
@@ -1638,7 +1631,6 @@ arc_evict(arc_state_t *state, spa_t *spa
 		idx = evict_metadata_offset;
 	} else {
 		offset = ARC_BUFC_NUMMETADATALISTS;
-
 		list_start = &state->arcs_lists[offset];
 		evicted_list_start = &evicted_state->arcs_lists[offset];
 		list_count = ARC_BUFC_NUMDATALISTS;
@@ -1646,12 +1638,12 @@ arc_evict(arc_state_t *state, spa_t *spa
 	}
 	bytes_remaining = evicted_state->arcs_lsize[type];
 	count = 0;
-	
+
 evict_start:
 	list = &list_start[idx];
 	evicted_list = &evicted_list_start[idx];
 	lock = ARCS_LOCK(state, (offset + idx));
-	evicted_lock = ARCS_LOCK(evicted_state, (offset + idx)); 
+	evicted_lock = ARCS_LOCK(evicted_state, (offset + idx));
 
 	mutex_enter(lock);
 	mutex_enter(evicted_lock);
@@ -1721,7 +1713,7 @@ evict_start:
 			if (bytes_remaining > 0) {
 				mutex_exit(evicted_lock);
 				mutex_exit(lock);
-				idx  = ((idx + 1)&(list_count-1));
+				idx  = ((idx + 1) & (list_count - 1));
 				count++;
 				goto evict_start;
 			}
@@ -1732,8 +1724,8 @@ evict_start:
 
 	mutex_exit(evicted_lock);
 	mutex_exit(lock);
-	
-	idx  = ((idx + 1)&(list_count-1));
+
+	idx  = ((idx + 1) & (list_count - 1));
 	count++;
 
 	if (bytes_evicted < bytes) {
@@ -1743,11 +1735,11 @@ evict_start:
 			dprintf("only evicted %lld bytes from %x",
 			    (longlong_t)bytes_evicted, state);
 	}
-	if (type == ARC_BUFC_METADATA) 
+	if (type == ARC_BUFC_METADATA)
 		evict_metadata_offset = idx;
 	else
 		evict_data_offset = idx;
-		
+
 	if (skipped)
 		ARCSTAT_INCR(arcstat_evict_skip, skipped);
 
@@ -1804,7 +1796,7 @@ arc_evict_ghost(arc_state_t *state, spa_
 	list_start = &state->arcs_lists[ARC_BUFC_NUMMETADATALISTS];
 	list_count = ARC_BUFC_NUMDATALISTS;
 	offset = ARC_BUFC_NUMMETADATALISTS;
-	
+
 evict_start:
 	list = &list_start[idx];
 	lock = ARCS_LOCK(state, idx + offset);
@@ -1851,12 +1843,12 @@ evict_start:
 		}
 	}
 	mutex_exit(lock);
-	idx  = ((idx + 1)&(ARC_BUFC_NUMDATALISTS-1));
+	idx  = ((idx + 1) & (ARC_BUFC_NUMDATALISTS - 1));
 	count++;
-	
+
 	if (count < list_count)
 		goto evict_start;
-	
+
 	evict_offset = idx;
 	if ((uintptr_t)list > (uintptr_t)&state->arcs_lists[ARC_BUFC_NUMMETADATALISTS] &&
 	    (bytes < 0 || bytes_deleted < bytes)) {
@@ -1945,7 +1937,7 @@ arc_do_user_evicts(void)
 	/*
 	 * Move list over to avoid LOR
 	 */
-restart:	
+restart:
 	mutex_enter(&arc_eviction_mtx);
 	tmp_arc_eviction_list = arc_eviction_list;
 	arc_eviction_list = NULL;
@@ -2056,7 +2048,7 @@ arc_reclaim_needed(void)
 		return (0);
 
 	/*
-	 * If pages are needed or we're within 2048 pages 
+	 * If pages are needed or we're within 2048 pages
 	 * of needing to page need to reclaim
 	 */
 	if (vm_pages_needed || (vm_paging_target() > -2048))
@@ -2614,10 +2606,7 @@ arc_read_done(zio_t *zio)
 	hdr->b_flags &= ~ARC_L2_EVICTED;
 	if (l2arc_noprefetch && (hdr->b_flags & ARC_PREFETCH))
 		hdr->b_flags &= ~ARC_L2CACHE;
-#if 0	
-	else if ((hdr->b_flags & ARC_PREFETCH) == 0)
-		hdr->b_flags |= ARC_L2CACHE;
-#endif	
+
 	/* byteswap if necessary */
 	callback_list = hdr->b_acb;
 	ASSERT(callback_list != NULL);
@@ -2731,7 +2720,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_
     uint32_t *arc_flags, const zbookmark_t *zb)
 {
 	int err;
-	arc_buf_hdr_t *hdr = pbuf->b_hdr;
 
 	ASSERT(!refcount_is_zero(&pbuf->b_hdr->b_refcnt));
 	ASSERT3U((char *)bp - (char *)pbuf->b_data, <, pbuf->b_hdr->b_size);
@@ -2739,8 +2727,6 @@ arc_read(zio_t *pio, spa_t *spa, blkptr_
 
 	err = arc_read_nolock(pio, spa, bp, done, private, priority,
 	    zio_flags, arc_flags, zb);
-
-	ASSERT3P(hdr, ==, pbuf->b_hdr);
 	rw_exit(&pbuf->b_lock);
 	return (err);
 }
@@ -2957,7 +2943,7 @@ top:
 				 * released by l2arc_read_done().
 				 */
 				rzio = zio_read_phys(pio, vd, addr, size,
-				    buf->b_data, ZIO_CHECKSUM_OFF, 
+				    buf->b_data, ZIO_CHECKSUM_OFF,
 				    l2arc_read_done, cb, priority, zio_flags |
 				    ZIO_FLAG_DONT_CACHE | ZIO_FLAG_CANFAIL |
 				    ZIO_FLAG_DONT_PROPAGATE |
@@ -3054,7 +3040,7 @@ arc_buf_evict(arc_buf_t *buf)
 	arc_buf_t **bufp;
 	list_t *list, *evicted_list;
 	kmutex_t *lock, *evicted_lock;
-	
+
 	rw_enter(&buf->b_lock, RW_WRITER);
 	hdr = buf->b_hdr;
 	if (hdr == NULL) {
@@ -3729,7 +3715,6 @@ arc_init(void)
 	arc_size = 0;
 
 	for (i = 0; i < ARC_BUFC_NUMLISTS; i++) {
-		
 		mutex_init(&arc_anon->arcs_locks[i].arcs_lock,
 		    NULL, MUTEX_DEFAULT, NULL);
 		mutex_init(&arc_mru->arcs_locks[i].arcs_lock,
@@ -3742,7 +3727,7 @@ arc_init(void)
 		    NULL, MUTEX_DEFAULT, NULL);
 		mutex_init(&arc_l2c_only->arcs_locks[i].arcs_lock,
 		    NULL, MUTEX_DEFAULT, NULL);
-	
+
 		list_create(&arc_mru->arcs_lists[i],
 		    sizeof (arc_buf_hdr_t), offsetof(arc_buf_hdr_t, b_arc_node));
 		list_create(&arc_mru_ghost->arcs_lists[i],
@@ -3792,7 +3777,7 @@ arc_init(void)
 #ifdef _KERNEL
 	if (TUNABLE_INT_FETCH("vfs.zfs.prefetch_disable", &zfs_prefetch_disable))
 		prefetch_tunable_set = 1;
-	
+
 #ifdef __i386__
 	if (prefetch_tunable_set == 0) {
 		printf("ZFS NOTICE: Prefetch is disabled by default on i386 "
@@ -3801,7 +3786,7 @@ arc_init(void)
 		    "to /boot/loader.conf.\n");
 		zfs_prefetch_disable=1;
 	}
-#else	
+#else
 	if ((((uint64_t)physmem * PAGESIZE) < (1ULL << 32)) &&
 	    prefetch_tunable_set == 0) {
 		printf("ZFS NOTICE: Prefetch is disabled by default if less "
@@ -3810,7 +3795,7 @@ arc_init(void)
 		    "to /boot/loader.conf.\n");
 		zfs_prefetch_disable=1;
 	}
-#endif	
+#endif
 	/* Warn about ZFS memory and address space requirements. */
 	if (((uint64_t)physmem * PAGESIZE) < (256 + 128 + 64) * (1 << 20)) {
 		printf("ZFS WARNING: Recommended minimum RAM size is 512MB; "
@@ -3830,7 +3815,7 @@ void
 arc_fini(void)
 {
 	int i;
-	
+
 	mutex_enter(&arc_reclaim_thr_lock);
 	arc_thread_exit = 1;
 	cv_signal(&arc_reclaim_thr_cv);
@@ -3856,14 +3841,16 @@ arc_fini(void)
 		list_destroy(&arc_mru_ghost->arcs_lists[i]);
 		list_destroy(&arc_mfu->arcs_lists[i]);
 		list_destroy(&arc_mfu_ghost->arcs_lists[i]);
+		list_destroy(&arc_l2c_only->arcs_lists[i]);
 
 		mutex_destroy(&arc_anon->arcs_locks[i].arcs_lock);
 		mutex_destroy(&arc_mru->arcs_locks[i].arcs_lock);
 		mutex_destroy(&arc_mru_ghost->arcs_locks[i].arcs_lock);
 		mutex_destroy(&arc_mfu->arcs_locks[i].arcs_lock);
 		mutex_destroy(&arc_mfu_ghost->arcs_locks[i].arcs_lock);
+		mutex_destroy(&arc_l2c_only->arcs_locks[i].arcs_lock);
 	}
-	
+
 	mutex_destroy(&zfs_write_limit_lock);
 
 	buf_fini();
@@ -4259,18 +4246,18 @@ l2arc_list_locked(int list_num, kmutex_t
 {
 	list_t *list;
 	int idx;
-	
-	ASSERT(list_num >= 0 && list_num < 2*ARC_BUFC_NUMLISTS);
+
+	ASSERT(list_num >= 0 && list_num < 2 * ARC_BUFC_NUMLISTS);
 
 	if (list_num < ARC_BUFC_NUMMETADATALISTS) {
 		idx = list_num;
 		list = &arc_mfu->arcs_lists[idx];
 		*lock = ARCS_LOCK(arc_mfu, idx);
-	} else if (list_num < ARC_BUFC_NUMMETADATALISTS*2) {
+	} else if (list_num < ARC_BUFC_NUMMETADATALISTS * 2) {
 		idx = list_num - ARC_BUFC_NUMMETADATALISTS;
 		list = &arc_mru->arcs_lists[idx];
 		*lock = ARCS_LOCK(arc_mru, idx);
-	} else if (list_num < (ARC_BUFC_NUMMETADATALISTS*2 +
+	} else if (list_num < (ARC_BUFC_NUMMETADATALISTS * 2 +
 		ARC_BUFC_NUMDATALISTS)) {
 		idx = list_num - ARC_BUFC_NUMMETADATALISTS;
 		list = &arc_mfu->arcs_lists[idx];
@@ -4281,8 +4268,6 @@ l2arc_list_locked(int list_num, kmutex_t
 		*lock = ARCS_LOCK(arc_mru, idx);
 	}
 
-	CTR3(KTR_SPARE2, "list=%p list_num=%d idx=%d",
-	    list, list_num, idx);
 	ASSERT(!(MUTEX_HELD(*lock)));
 	mutex_enter(*lock);
 	return (list);
@@ -4452,7 +4437,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 	 * Copy buffers for L2ARC writing.
 	 */
 	mutex_enter(&l2arc_buflist_mtx);
-	for (try = 0; try < 2*ARC_BUFC_NUMLISTS; try++) {
+	for (try = 0; try < 2 * ARC_BUFC_NUMLISTS; try++) {
 		list = l2arc_list_locked(try, &list_lock);
 		passed_sz = 0;
 		ARCSTAT_BUMP(arcstat_l2_write_buffer_list_iter);
@@ -4468,9 +4453,8 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			ab = list_head(list);
 		else
 			ab = list_tail(list);
-		if (ab == NULL) {
+		if (ab == NULL)
 			ARCSTAT_BUMP(arcstat_l2_write_buffer_list_null_iter);
-		}
 
 		for (; ab; ab = ab_prev) {
 			if (arc_warm == B_FALSE)
@@ -4478,7 +4462,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			else
 				ab_prev = list_prev(list, ab);
 			ARCSTAT_INCR(arcstat_l2_write_buffer_bytes_scanned, ab->b_size);
-		
+
 			hash_lock = HDR_LOCK(ab);
 			have_lock = MUTEX_HELD(hash_lock);
 			if (!have_lock && !mutex_tryenter(hash_lock)) {
@@ -4562,6 +4546,7 @@ l2arc_write_buffers(spa_t *spa, l2arc_de
 			hdrl2->b_dev = dev;
 			hdrl2->b_daddr = dev->l2ad_hand;
 
+			ab->b_flags |= ARC_L2_WRITING;
 			ab->b_l2hdr = hdrl2;
 			list_insert_head(dev->l2ad_buflist, ab);
 			buf_data = ab->b_buf->b_data;

Modified: user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
==============================================================================
--- user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h	Sun Apr 18 22:51:20 2010	(r206822)
@@ -55,8 +55,8 @@ struct arc_buf {
 };
 
 typedef enum arc_buf_contents {
-	ARC_BUFC_METADATA,			/* buffer contains metadata */
 	ARC_BUFC_DATA,				/* buffer contains data */
+	ARC_BUFC_METADATA,			/* buffer contains metadata */
 	ARC_BUFC_NUMTYPES
 } arc_buf_contents_t;
 /*

Modified: user/jmallett/octeon/sys/dev/ahci/ahci.c
==============================================================================
--- user/jmallett/octeon/sys/dev/ahci/ahci.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/sys/dev/ahci/ahci.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -126,6 +126,7 @@ static struct {
 	{0x26838086, 0x00, "Intel ESB2",	0},
 	{0x27c18086, 0x00, "Intel ICH7",	0},
 	{0x27c38086, 0x00, "Intel ICH7",	0},
+	{0x27c48086, 0x00, "Intel ICH7M",	0},
 	{0x27c58086, 0x00, "Intel ICH7M",	0},
 	{0x27c68086, 0x00, "Intel ICH7M",	0},
 	{0x28218086, 0x00, "Intel ICH8",	0},

Modified: user/jmallett/octeon/sys/dev/ipw/if_ipw.c
==============================================================================
--- user/jmallett/octeon/sys/dev/ipw/if_ipw.c	Sun Apr 18 22:51:15 2010	(r206821)
+++ user/jmallett/octeon/sys/dev/ipw/if_ipw.c	Sun Apr 18 22:51:20 2010	(r206822)
@@ -888,10 +888,10 @@ ipw_newstate(struct ieee80211vap *vap, e
 			/*
 			 * XXX when joining an ibss network we are called
 			 * with a SCAN -> RUN transition on scan complete.
-			 * Use that to call ipw_auth_and_assoc.  On completing
-			 * the join we are then called again with an
-			 * AUTH -> RUN transition and we want to do nothing.
-			 * This is all totally bogus and needs to be redone.
+			 * Use that to call ipw_assoc.  On completing the
+			 * join we are then called again with an AUTH -> RUN
+			 * transition and we want to do nothing.  This is
+			 * all totally bogus and needs to be redone.
 			 */
 			if (ostate == IEEE80211_S_SCAN)
 				ipw_assoc(ic, vap);
@@ -904,12 +904,19 @@ ipw_newstate(struct ieee80211vap *vap, e
 		break;
 
 	case IEEE80211_S_AUTH:
+		/*
+		 * Move to ASSOC state after the ipw_assoc() call.  Firmware
+		 * takes care of authentication, after the call we'll receive
+		 * only an assoc response which would otherwise be discared
+		 * if we are still in AUTH state.
+		 */
+		nstate = IEEE80211_S_ASSOC;
 		ipw_assoc(ic, vap);
 		break;
 
 	case IEEE80211_S_ASSOC:
 		/*
-		 * If we are not transitioning from AUTH the resend the
+		 * If we are not transitioning from AUTH then resend the
 		 * association request.
 		 */
 		if (ostate != IEEE80211_S_AUTH)
@@ -1021,7 +1028,6 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		}
 		sc->flags &= ~IPW_FLAG_ASSOCIATING;
 		sc->flags |= IPW_FLAG_ASSOCIATED;
-		ieee80211_new_state(vap, IEEE80211_S_RUN, -1);
 		break;
 
 	case IPW_STATE_SCANNING:
@@ -1034,8 +1040,10 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		 * we checked the 802.11 layer state.
 		 */
 		if (sc->flags & IPW_FLAG_ASSOCIATED) {
+			IPW_UNLOCK(sc);
 			/* XXX probably need to issue disassoc to fw */
 			ieee80211_beacon_miss(ic);
+			IPW_LOCK(sc);
 		}
 		break;
 
@@ -1054,7 +1062,9 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 			break;
 		}
 		if (sc->flags & IPW_FLAG_SCANNING) {
+			IPW_UNLOCK(sc);
 			ieee80211_scan_done(vap);
+			IPW_LOCK(sc);
 			sc->flags &= ~IPW_FLAG_SCANNING;
 			sc->sc_scan_timer = 0;
 		}
@@ -1064,13 +1074,16 @@ ipw_rx_newstate_intr(struct ipw_softc *s
 		DPRINTFN(2, ("Association lost (%s flags 0x%x)\n",
 			IEEESTATE(vap), sc->flags));
 		sc->flags &= ~(IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
-		if (vap->iv_state == IEEE80211_S_RUN)
+		if (vap->iv_state == IEEE80211_S_RUN) {
+			IPW_UNLOCK(sc);
 			ieee80211_new_state(vap, IEEE80211_S_SCAN, -1);
+			IPW_LOCK(sc);
+		}
 		break;
 
 	case IPW_STATE_DISABLED:
 		/* XXX? is this right? */
-		sc->flags &= ~(IPW_FLAG_HACK | IPW_FLAG_SCANNING | 
+		sc->flags &= ~(IPW_FLAG_HACK | IPW_FLAG_SCANNING |
 		    IPW_FLAG_ASSOCIATING | IPW_FLAG_ASSOCIATED);
 		DPRINTFN(2, ("Firmware disabled (%s flags 0x%x)\n",
 			IEEESTATE(vap), sc->flags));
@@ -1164,7 +1177,6 @@ ipw_rx_data_intr(struct ipw_softc *sc, s
 	bus_addr_t physaddr;
 	int error;
 	int8_t rssi, nf;
-	IPW_LOCK_DECL;
 
 	DPRINTFN(5, ("received frame len=%u, rssi=%u\n", le32toh(status->len),
 	    status->rssi));
@@ -1234,10 +1246,10 @@ ipw_rx_data_intr(struct ipw_softc *sc, s
 	IPW_UNLOCK(sc);
 	ni = ieee80211_find_rxnode(ic, mtod(m, struct ieee80211_frame_min *));
 	if (ni != NULL) {
-		(void) ieee80211_input(ni, m, rssi, nf);
+		(void) ieee80211_input(ni, m, rssi - nf, nf);
 		ieee80211_free_node(ni);
 	} else
-		(void) ieee80211_input_all(ic, m, rssi, nf);
+		(void) ieee80211_input_all(ic, m, rssi - nf, nf);
 	IPW_LOCK(sc);
 
 	bus_dmamap_sync(sc->rbd_dmat, sc->rbd_map, BUS_DMASYNC_PREWRITE);
@@ -1378,8 +1390,11 @@ ipw_fatal_error_intr(struct ipw_softc *s
 	struct ieee80211vap *vap = TAILQ_FIRST(&ic->ic_vaps);
 
 	device_printf(sc->sc_dev, "firmware error\n");
-	if (vap != NULL)
+	if (vap != NULL) {
+		IPW_UNLOCK(sc);
 		ieee80211_cancel_scan(vap);
+		IPW_LOCK(sc);
+	}
 	ieee80211_runtask(ic, &sc->sc_init_task);
 }
 
@@ -1388,7 +1403,6 @@ ipw_intr(void *arg)
 {
 	struct ipw_softc *sc = arg;
 	uint32_t r;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 
@@ -1718,7 +1732,6 @@ static void
 ipw_start(struct ifnet *ifp)
 {
 	struct ipw_softc *sc = ifp->if_softc;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 	ipw_start_locked(ifp);
@@ -1775,7 +1788,9 @@ ipw_watchdog(void *arg)
 			DPRINTFN(3, ("Scan timeout\n"));
 			/* End the scan */
 			if (sc->flags & IPW_FLAG_SCANNING) {
+				IPW_UNLOCK(sc);
 				ieee80211_scan_done(TAILQ_FIRST(&ic->ic_vaps));
+				IPW_LOCK(sc);
 				sc->flags &= ~IPW_FLAG_SCANNING;
 			}
 		}
@@ -1791,7 +1806,6 @@ ipw_ioctl(struct ifnet *ifp, u_long cmd,
 	struct ieee80211com *ic = ifp->if_l2com;
 	struct ifreq *ifr = (struct ifreq *) data;
 	int error = 0, startall = 0;
-	IPW_LOCK_DECL;
 
 	switch (cmd) {
 	case SIOCSIFFLAGS:
@@ -2201,7 +2215,6 @@ ipw_assoc(struct ieee80211com *ic, struc
 	struct ipw_security security;
 	uint32_t data;
 	int error;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 	error = ipw_disable(sc);
@@ -2260,8 +2273,8 @@ ipw_assoc(struct ieee80211com *ic, struc
 	if (error != 0)
 		goto done;
 
-	if (vap->iv_appie_assocreq != NULL) {
-		struct ieee80211_appie *ie = vap->iv_appie_assocreq;
+	if (vap->iv_appie_wpa != NULL) {
+		struct ieee80211_appie *ie = vap->iv_appie_wpa;
 		error = ipw_setwpaie(sc, ie->ie_data, ie->ie_len);
 		if (error != 0)
 			goto done;
@@ -2291,7 +2304,6 @@ ipw_disassoc(struct ieee80211com *ic, st
 	struct ifnet *ifp = vap->iv_ic->ic_ifp;
 	struct ieee80211_node *ni = vap->iv_bss;
 	struct ipw_softc *sc = ifp->if_softc;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 	DPRINTF(("Disassociate from %6D\n", ni->ni_bssid, ":"));
@@ -2327,7 +2339,6 @@ ipw_init(void *priv)
 	struct ipw_softc *sc = priv;
 	struct ifnet *ifp = sc->sc_ifp;
 	struct ieee80211com *ic = ifp->if_l2com;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 	ipw_init_locked(sc);
@@ -2534,7 +2545,6 @@ static void
 ipw_stop(void *priv)
 {
 	struct ipw_softc *sc = priv;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);
 	ipw_stop_locked(sc);
@@ -2661,7 +2671,6 @@ ipw_scan_start(struct ieee80211com *ic)
 {
 	struct ifnet *ifp = ic->ic_ifp;
 	struct ipw_softc *sc = ifp->if_softc;
-	IPW_LOCK_DECL;
 
 	IPW_LOCK(sc);

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

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 03:01:52 2010
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 B4C9B106564A;
	Mon, 19 Apr 2010 03:01:52 +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 4A7B48FC1C;
	Mon, 19 Apr 2010 03:01:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J31qQM073427;
	Mon, 19 Apr 2010 03:01:52 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J31qJ7073426;
	Mon, 19 Apr 2010 03:01:52 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004190301.o3J31qJ7073426@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 03:01:52 +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: r206824 - user/kmacy/head_page_lock_2
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, 19 Apr 2010 03:01:52 -0000

Author: kmacy
Date: Mon Apr 19 03:01:52 2010
New Revision: 206824
URL: http://svn.freebsd.org/changeset/base/206824

Log:
  create updated merge branch

Added:
     - copied from r206823, head/
Directory Properties:
  user/kmacy/head_page_lock_2/   (props changed)

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 03:07:48 2010
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 55EEF1065673;
	Mon, 19 Apr 2010 03:07:48 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3BCFC8FC0C;
	Mon, 19 Apr 2010 03:07:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J37ma4074731;
	Mon, 19 Apr 2010 03:07:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J37mO4074728;
	Mon, 19 Apr 2010 03:07:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190307.o3J37mO4074728@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 03:07:48 +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: r206825 - in user/jmallett/octeon/sys/mips: include mips
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, 19 Apr 2010 03:07:48 -0000

Author: jmallett
Date: Mon Apr 19 03:07:47 2010
New Revision: 206825
URL: http://svn.freebsd.org/changeset/base/206825

Log:
  Use sign extension and genassym.c rather that remarkable contortions to get
  pointer-width definitions of the 32-bit kernel segment base addresses.
  
  While here remove some unused macros.

Modified:
  user/jmallett/octeon/sys/mips/include/cpuregs.h
  user/jmallett/octeon/sys/mips/mips/genassym.c

Modified: user/jmallett/octeon/sys/mips/include/cpuregs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/cpuregs.h	Mon Apr 19 03:01:52 2010	(r206824)
+++ user/jmallett/octeon/sys/mips/include/cpuregs.h	Mon Apr 19 03:07:47 2010	(r206825)
@@ -78,30 +78,20 @@
  * Caching of mapped addresses is controlled by bits in the TLB entry.
  */
 
-#if defined(_LOCORE) || defined(LOCORE)
-#ifdef __mips_n64
-#define	KSEG_ADDRESS(x)	__CONCAT(0xffffffff, x)
-#else
-#define	KSEG_ADDRESS(x)	__CONCAT(0x, x)
-#endif
-#else
-#define	KSEG_ADDRESS(x)	((intptr_t)(int32_t)__CONCAT(0x, x))
-#endif
-
+#if !defined(_LOCORE)
 #define	MIPS_KUSEG_START		0x00000000
-#define	MIPS_KSEG0_START		KSEG_ADDRESS(80000000)
-#define	MIPS_KSEG0_END			KSEG_ADDRESS(9fffffff)
-#define	MIPS_KSEG1_START		KSEG_ADDRESS(a0000000)
-#define	MIPS_KSEG1_END			KSEG_ADDRESS(bfffffff)
-#define	MIPS_KSSEG_START		KSEG_ADDRESS(c0000000)
-#define	MIPS_KSSEG_END			KSEG_ADDRESS(dfffffff)
-#define	MIPS_KSEG3_START		KSEG_ADDRESS(e0000000)
-#define	MIPS_KSEG3_END			KSEG_ADDRESS(ffffffff)
-#define	MIPS_MAX_MEM_ADDR		KSEG_ADDRESS(be000000)
-#define	MIPS_RESERVED_ADDR		KSEG_ADDRESS(bfc80000)
+#define	MIPS_KSEG0_START		((intptr_t)(int32_t)0x80000000)
+#define	MIPS_KSEG0_END			((intptr_t)(int32_t)0x9fffffff)
+#define	MIPS_KSEG1_START		((intptr_t)(int32_t)0xa0000000)
+#define	MIPS_KSEG1_END			((intptr_t)(int32_t)0xbfffffff)
+#define	MIPS_KSSEG_START		((intptr_t)(int32_t)0xc0000000)
+#define	MIPS_KSSEG_END			((intptr_t)(int32_t)0xdfffffff)
+#define	MIPS_KSEG3_START		((intptr_t)(int32_t)0xe0000000)
+#define	MIPS_KSEG3_END			((intptr_t)(int32_t)0xffffffff)
 
 #define MIPS_KSEG2_START		MIPS_KSSEG_START
 #define MIPS_KSEG2_END			MIPS_KSSEG_END
+#endif
 
 #define	MIPS_XKPHYS_START		0x8000000000000000
 #define	MIPS_XKPHYS_END			0xbfffffffffffffff

Modified: user/jmallett/octeon/sys/mips/mips/genassym.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/genassym.c	Mon Apr 19 03:01:52 2010	(r206824)
+++ user/jmallett/octeon/sys/mips/mips/genassym.c	Mon Apr 19 03:07:47 2010	(r206825)
@@ -54,6 +54,7 @@ __FBSDID("$FreeBSD$");
 #include <vm/pmap.h>
 #include <vm/vm_map.h>
 #include <sys/proc.h>
+#include <machine/cpuregs.h>
 #include <machine/pcb.h>
 #include <machine/sigframe.h>
 #include <machine/proc.h>
@@ -98,3 +99,7 @@ ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED);
 ASSYM(TDF_ASTPENDING, TDF_ASTPENDING);
 ASSYM(PCPU_SIZE, sizeof(struct pcpu));
 ASSYM(MAXCOMLEN, MAXCOMLEN);
+
+ASSYM(MIPS_KSEG0_START, MIPS_KSEG0_START);
+ASSYM(MIPS_KSEG1_START, MIPS_KSEG1_START);
+ASSYM(MIPS_KSEG2_START, MIPS_KSEG2_START);

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 04:09:20 2010
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 CB27C106564A;
	Mon, 19 Apr 2010 04:09:20 +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 B73E98FC23;
	Mon, 19 Apr 2010 04:09:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J49KeT088284;
	Mon, 19 Apr 2010 04:09:20 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J49KTC088281;
	Mon, 19 Apr 2010 04:09:20 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004190409.o3J49KTC088281@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 04:09:20 +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: r206826 - in user/kmacy/head_page_lock_2/sys:
	amd64/amd64 amd64/include
	cddl/contrib/opensolaris/uts/common/fs/zfs dev/agp dev/drm
	dev/md dev/ti fs/nfsclient fs/nwfs fs/smbfs fs/tmpfs k...
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, 19 Apr 2010 04:09:20 -0000

Author: kmacy
Date: Mon Apr 19 04:09:20 2010
New Revision: 206826
URL: http://svn.freebsd.org/changeset/base/206826

Log:
  - integrate page lock patch in to latest version of head
  - additionally lock nwfs, nfsclient, smbfs, tmpfs, agp, and drm

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
  user/kmacy/head_page_lock_2/sys/amd64/include/vmparam.h
  user/kmacy/head_page_lock_2/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  user/kmacy/head_page_lock_2/sys/dev/agp/agp.c
  user/kmacy/head_page_lock_2/sys/dev/agp/agp_i810.c
  user/kmacy/head_page_lock_2/sys/dev/drm/via_dmablit.c
  user/kmacy/head_page_lock_2/sys/dev/md/md.c
  user/kmacy/head_page_lock_2/sys/dev/ti/if_ti.c
  user/kmacy/head_page_lock_2/sys/fs/nfsclient/nfs_clbio.c
  user/kmacy/head_page_lock_2/sys/fs/nwfs/nwfs_io.c
  user/kmacy/head_page_lock_2/sys/fs/smbfs/smbfs_io.c
  user/kmacy/head_page_lock_2/sys/fs/tmpfs/tmpfs_vnops.c
  user/kmacy/head_page_lock_2/sys/kern/kern_exec.c
  user/kmacy/head_page_lock_2/sys/kern/subr_uio.c
  user/kmacy/head_page_lock_2/sys/kern/subr_witness.c
  user/kmacy/head_page_lock_2/sys/kern/sys_pipe.c
  user/kmacy/head_page_lock_2/sys/kern/sys_process.c
  user/kmacy/head_page_lock_2/sys/kern/uipc_cow.c
  user/kmacy/head_page_lock_2/sys/kern/uipc_shm.c
  user/kmacy/head_page_lock_2/sys/kern/uipc_syscalls.c
  user/kmacy/head_page_lock_2/sys/kern/vfs_bio.c
  user/kmacy/head_page_lock_2/sys/net/bpf_zerocopy.c
  user/kmacy/head_page_lock_2/sys/nfsclient/nfs_bio.c
  user/kmacy/head_page_lock_2/sys/ufs/ffs/ffs_vnops.c
  user/kmacy/head_page_lock_2/sys/vm/device_pager.c
  user/kmacy/head_page_lock_2/sys/vm/pmap.h
  user/kmacy/head_page_lock_2/sys/vm/sg_pager.c
  user/kmacy/head_page_lock_2/sys/vm/swap_pager.c
  user/kmacy/head_page_lock_2/sys/vm/uma_core.c
  user/kmacy/head_page_lock_2/sys/vm/vm_contig.c
  user/kmacy/head_page_lock_2/sys/vm/vm_fault.c
  user/kmacy/head_page_lock_2/sys/vm/vm_glue.c
  user/kmacy/head_page_lock_2/sys/vm/vm_kern.c
  user/kmacy/head_page_lock_2/sys/vm/vm_map.c
  user/kmacy/head_page_lock_2/sys/vm/vm_mmap.c
  user/kmacy/head_page_lock_2/sys/vm/vm_object.c
  user/kmacy/head_page_lock_2/sys/vm/vm_page.c
  user/kmacy/head_page_lock_2/sys/vm/vm_page.h
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
  user/kmacy/head_page_lock_2/sys/vm/vnode_pager.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 03:07:47 2010	(r206825)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 04:09:20 2010	(r206826)
@@ -160,16 +160,33 @@ __FBSDID("$FreeBSD$");
 #define PMAP_INLINE
 #endif
 
-#define PV_STATS
 #ifdef PV_STATS
 #define PV_STAT(x)	do { x ; } while (0)
 #else
 #define PV_STAT(x)	do { } while (0)
 #endif
 
+#define	PA_LOCK_PAD	CACHE_LINE_SIZE
+
+struct vp_lock {
+	struct mtx	vp_lock;
+	unsigned char	pad[(PA_LOCK_PAD - sizeof(struct mtx))];
+};
+
 #define	pa_index(pa)	((pa) >> PDRSHIFT)
 #define	pa_to_pvh(pa)	(&pv_table[pa_index(pa)])
 
+#define	PA_LOCKPTR(pa)	&pa_lock[pa_index((pa)) % PA_LOCK_COUNT].vp_lock
+#define	PA_LOCK(pa)	mtx_lock(PA_LOCKPTR(pa))
+#define	PA_TRYLOCK(pa)	mtx_trylock(PA_LOCKPTR(pa))
+#define	PA_UNLOCK(pa)	mtx_unlock(PA_LOCKPTR(pa))
+#define	PA_LOCK_ASSERT(pa, a)	mtx_assert(PA_LOCKPTR(pa), (a))
+
+#define	PA_LOCK_COUNT	256
+
+struct vp_lock pa_lock[PA_LOCK_COUNT] __aligned(CACHE_LINE_SIZE);
+
+
 struct pmap kernel_pmap_store;
 
 vm_offset_t virtual_avail;	/* VA of first avail page (after kernel bss) */
@@ -188,6 +205,15 @@ static int pg_ps_enabled = 1;
 SYSCTL_INT(_vm_pmap, OID_AUTO, pg_ps_enabled, CTLFLAG_RDTUN, &pg_ps_enabled, 0,
     "Are large page mappings enabled?");
 
+static uint64_t pmap_tryrelock_calls;
+SYSCTL_QUAD(_vm_pmap, OID_AUTO, tryrelock_calls, CTLFLAG_RD,
+    &pmap_tryrelock_calls, 0, "Number of tryrelock calls");
+
+static int pmap_tryrelock_restart;
+SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
+    &pmap_tryrelock_restart, 0, "Number of tryrelock restarts");
+
+
 static u_int64_t	KPTphys;	/* phys addr of kernel level 1 */
 static u_int64_t	KPDphys;	/* phys addr of kernel level 2 */
 u_int64_t		KPDPphys;	/* phys addr of kernel level 3 */
@@ -199,7 +225,8 @@ static u_int64_t	DMPDPphys;	/* phys addr
 /*
  * Data for the pv entry allocation mechanism
  */
-static int pv_entry_count = 0, pv_entry_max = 0, pv_entry_high_water = 0;
+static int pv_entry_count __aligned(CACHE_LINE_SIZE);
+static int pv_entry_max = 0, pv_entry_high_water = 0;
 static struct md_page *pv_table;
 static int shpgperproc = PMAP_SHPGPERPROC;
 
@@ -215,8 +242,9 @@ caddr_t CADDR1 = 0;
 static caddr_t crashdumpmap;
 
 static void	free_pv_entry(pmap_t pmap, pv_entry_t pv);
-static pv_entry_t get_pv_entry(pmap_t locked_pmap, int try);
-static void	pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
+static pv_entry_t get_pv_entry(pmap_t locked_pmap);
+static void pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+	struct pv_list_head *pv_list);
 static boolean_t pmap_pv_insert_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static void	pmap_pv_promote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa);
 static void	pmap_pvh_free(struct md_page *pvh, pmap_t pmap, vm_offset_t va);
@@ -225,7 +253,8 @@ static pv_entry_t pmap_pvh_remove(struct
 static int	pmap_pvh_wired_mappings(struct md_page *pvh, int count);
 
 static int pmap_change_attr_locked(vm_offset_t va, vm_size_t size, int mode);
-static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va);
+static boolean_t pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
+	struct pv_list_head *pv_list);
 static boolean_t pmap_demote_pdpe(pmap_t pmap, pdp_entry_t *pdpe,
     vm_offset_t va);
 static boolean_t pmap_enter_pde(pmap_t pmap, vm_offset_t va, vm_page_t m,
@@ -244,7 +273,7 @@ static boolean_t pmap_protect_pde(pmap_t
     vm_prot_t prot);
 static void pmap_pte_attr(pt_entry_t *pte, int cache_bits);
 static int pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva,
-		vm_page_t *free);
+    vm_page_t *free, struct pv_list_head *pv_list);
 static int pmap_remove_pte(pmap_t pmap, pt_entry_t *ptq,
 		vm_offset_t sva, pd_entry_t ptepde, vm_page_t *free);
 static void pmap_remove_pt_page(pmap_t pmap, vm_page_t mpte);
@@ -252,17 +281,17 @@ static void pmap_remove_page(pmap_t pmap
     vm_page_t *free);
 static void pmap_remove_entry(struct pmap *pmap, vm_page_t m,
 		vm_offset_t va);
-static void pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m);
 static boolean_t pmap_try_insert_pv_entry(pmap_t pmap, vm_offset_t va,
     vm_page_t m);
 static void pmap_update_pde(pmap_t pmap, vm_offset_t va, pd_entry_t *pde,
     pd_entry_t newpde);
 static void pmap_update_pde_invalidate(vm_offset_t va, pd_entry_t newpde);
 
-static vm_page_t pmap_allocpde(pmap_t pmap, vm_offset_t va, int flags);
-static vm_page_t pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags);
+static vm_page_t pmap_allocpde(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags);
+static vm_page_t pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags);
 
-static vm_page_t _pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags);
+static vm_page_t _pmap_allocpte(pmap_t pmap, vm_paddr_t pa,
+                vm_pindex_t ptepindex, int flags);
 static int _pmap_unwire_pte_hold(pmap_t pmap, vm_offset_t va, vm_page_t m,
                 vm_page_t* free);
 static int pmap_unuse_pt(pmap_t, vm_offset_t, pd_entry_t, vm_page_t *);
@@ -271,6 +300,82 @@ static vm_offset_t pmap_kmem_choose(vm_o
 CTASSERT(1 << PDESHIFT == sizeof(pd_entry_t));
 CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
 
+
+#define LS_MAX		4
+struct lock_stack {
+	struct mtx *ls_array[LS_MAX];
+	int ls_top;
+};
+
+static void
+ls_init(struct lock_stack *ls)
+{
+
+	ls->ls_top = 0;
+}
+
+
+#define ls_push(ls, m)	_ls_push((ls), (m), LOCK_FILE, LOCK_LINE)
+
+static void
+_ls_push(struct lock_stack *ls, struct mtx *lock, char *file, int line)
+{
+
+	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
+	
+	ls->ls_array[ls->ls_top] = lock;
+	ls->ls_top++;
+#if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE)	
+	_mtx_lock_flags(lock, 0, file, line);
+#else
+	_get_sleep_lock(lock, curthread, 0, file, line);
+#endif
+}
+
+static int
+ls_trypush(struct lock_stack *ls, struct mtx *lock)
+{
+
+	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
+
+	if (mtx_trylock(lock) == 0)
+		return (0);
+	
+	ls->ls_array[ls->ls_top] = lock;
+	ls->ls_top++;
+	return (1);
+}
+
+#ifdef notyet
+static void
+ls_pop(struct lock_stack *ls)
+{
+	struct mtx *lock;
+
+	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
+
+	ls->ls_top--;
+	lock = ls->ls_array[ls->ls_top];
+	mtx_unlock(lock);
+}
+#endif
+
+static void
+ls_popa(struct lock_stack *ls)
+{
+	struct mtx *lock;
+
+	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
+
+	while (ls->ls_top > 0) {
+		ls->ls_top--;
+		lock = ls->ls_array[ls->ls_top];
+		mtx_unlock(lock);
+	}
+}
+#ifdef INVARIANTS
+extern void kdb_backtrace(void);
+#endif
 /*
  * Move the kernel virtual free pointer to the next
  * 2MB.  This is used to help improve performance
@@ -420,6 +525,37 @@ vtopde(vm_offset_t va)
 	return (PDmap + ((va >> PDRSHIFT) & mask));
 }
 
+/*
+ * Try to acquire a physical address lock while a pmap is locked.  If we
+ * fail to trylock we unlock and lock the pmap directly and cache the
+ * locked pa in *locked.  The caller should then restart their loop in case
+ * the virtual to physical mapping has changed.
+ */
+static int
+pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
+{
+	vm_paddr_t lockpa;
+
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
+	lockpa = *locked;
+	*locked = pa;
+	if (lockpa) {
+		PA_LOCK_ASSERT(lockpa, MA_OWNED);
+		if (PA_LOCKPTR(pa) == PA_LOCKPTR(lockpa))
+			return (0);
+		PA_UNLOCK(lockpa);
+	}
+	if (PA_TRYLOCK(pa))
+		return 0;
+	PMAP_UNLOCK(pmap);
+	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
+	PA_LOCK(pa);
+	PMAP_LOCK(pmap);
+
+	return (EAGAIN);
+}
+
 static u_int64_t
 allocpages(vm_paddr_t *firstaddr, int n)
 {
@@ -529,6 +665,7 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 {
 	vm_offset_t va;
 	pt_entry_t *pte, *unused;
+	int i;	
 
 	/*
 	 * Create an initial set of page tables to run the kernel in.
@@ -578,6 +715,12 @@ pmap_bootstrap(vm_paddr_t *firstaddr)
 
 	/* Initialize the PAT MSR. */
 	pmap_init_pat();
+
+		/* Setup page locks. */
+	for (i = 0; i < PA_LOCK_COUNT; i++)
+		mtx_init(&pa_lock[i].vp_lock, "page lock", NULL,
+		    MTX_DEF | MTX_RECURSE | MTX_DUPOK);
+
 }
 
 /*
@@ -651,6 +794,14 @@ pmap_page_init(vm_page_t m)
 	m->md.pat_mode = PAT_WRITE_BACK;
 }
 
+struct mtx *
+pmap_page_lockptr(vm_page_t m)
+{
+
+	KASSERT(m != NULL, ("pmap_page_lockptr: NULL page"));
+	return (PA_LOCKPTR(VM_PAGE_TO_PHYS(m)));
+}
+
 /*
  *	Initialize the pmap module.
  *	Called by vm_init, to initialize any structures that the pmap
@@ -1184,15 +1335,20 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 {
 	pd_entry_t pde, *pdep;
 	pt_entry_t pte;
+	vm_paddr_t pa;
 	vm_page_t m;
 
+	pa = 0;
 	m = NULL;
-	vm_page_lock_queues();
 	PMAP_LOCK(pmap);
+retry:
 	pdep = pmap_pde(pmap, va);
 	if (pdep != NULL && (pde = *pdep)) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
+				if (pa_tryrelock(pmap, pde & PG_PS_FRAME, &pa))
+					goto retry;
+
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
 				    (va & PDRMASK));
 				vm_page_hold(m);
@@ -1201,12 +1357,15 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 			pte = *pmap_pde_to_pte(pdep, va);
 			if ((pte & PG_V) &&
 			    ((pte & PG_RW) || (prot & VM_PROT_WRITE) == 0)) {
+				if (pa_tryrelock(pmap, pte & PG_FRAME, &pa))
+					goto retry;
 				m = PHYS_TO_VM_PAGE(pte & PG_FRAME);
 				vm_page_hold(m);
 			}
 		}
 	}
-	vm_page_unlock_queues();
+	if (pa)
+		PA_UNLOCK(pa);
 	PMAP_UNLOCK(pmap);
 	return (m);
 }
@@ -1604,7 +1763,7 @@ pmap_pinit(pmap_t pmap)
  * race conditions.
  */
 static vm_page_t
-_pmap_allocpte(pmap_t pmap, vm_pindex_t ptepindex, int flags)
+_pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_pindex_t ptepindex, int flags)
 {
 	vm_page_t m, pdppg, pdpg;
 
@@ -1619,9 +1778,9 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 	    VM_ALLOC_WIRED | VM_ALLOC_ZERO)) == NULL) {
 		if (flags & M_WAITOK) {
 			PMAP_UNLOCK(pmap);
-			vm_page_unlock_queues();
+			PA_UNLOCK(pa);
 			VM_WAIT;
-			vm_page_lock_queues();
+			PA_LOCK(pa);
 			PMAP_LOCK(pmap);
 		}
 
@@ -1661,7 +1820,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 		pml4 = &pmap->pm_pml4[pml4index];
 		if ((*pml4 & PG_V) == 0) {
 			/* Have to allocate a new pdp, recurse */
-			if (_pmap_allocpte(pmap, NUPDE + NUPDPE + pml4index,
+			if (_pmap_allocpte(pmap, pa, NUPDE + NUPDPE + pml4index,
 			    flags) == NULL) {
 				--m->wire_count;
 				atomic_subtract_int(&cnt.v_wire_count, 1);
@@ -1694,7 +1853,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 		pml4 = &pmap->pm_pml4[pml4index];
 		if ((*pml4 & PG_V) == 0) {
 			/* Have to allocate a new pd, recurse */
-			if (_pmap_allocpte(pmap, NUPDE + pdpindex,
+			if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex,
 			    flags) == NULL) {
 				--m->wire_count;
 				atomic_subtract_int(&cnt.v_wire_count, 1);
@@ -1708,7 +1867,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 			pdp = &pdp[pdpindex & ((1ul << NPDPEPGSHIFT) - 1)];
 			if ((*pdp & PG_V) == 0) {
 				/* Have to allocate a new pd, recurse */
-				if (_pmap_allocpte(pmap, NUPDE + pdpindex,
+				if (_pmap_allocpte(pmap, pa, NUPDE + pdpindex,
 				    flags) == NULL) {
 					--m->wire_count;
 					atomic_subtract_int(&cnt.v_wire_count,
@@ -1735,7 +1894,7 @@ _pmap_allocpte(pmap_t pmap, vm_pindex_t 
 }
 
 static vm_page_t
-pmap_allocpde(pmap_t pmap, vm_offset_t va, int flags)
+pmap_allocpde(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags)
 {
 	vm_pindex_t pdpindex, ptepindex;
 	pdp_entry_t *pdpe;
@@ -1754,7 +1913,7 @@ retry:
 		/* Allocate a pd page. */
 		ptepindex = pmap_pde_pindex(va);
 		pdpindex = ptepindex >> NPDPEPGSHIFT;
-		pdpg = _pmap_allocpte(pmap, NUPDE + pdpindex, flags);
+		pdpg = _pmap_allocpte(pmap, pa, NUPDE + pdpindex, flags);
 		if (pdpg == NULL && (flags & M_WAITOK))
 			goto retry;
 	}
@@ -1762,11 +1921,12 @@ retry:
 }
 
 static vm_page_t
-pmap_allocpte(pmap_t pmap, vm_offset_t va, int flags)
+pmap_allocpte(pmap_t pmap, vm_paddr_t pa, vm_offset_t va, int flags)
 {
 	vm_pindex_t ptepindex;
 	pd_entry_t *pd;
 	vm_page_t m;
+	struct pv_list_head pv_list;
 
 	KASSERT((flags & (M_NOWAIT | M_WAITOK)) == M_NOWAIT ||
 	    (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
@@ -1787,7 +1947,8 @@ retry:
 	 * normal 4K page.
 	 */
 	if (pd != NULL && (*pd & (PG_PS | PG_V)) == (PG_PS | PG_V)) {
-		if (!pmap_demote_pde(pmap, pd, va)) {
+		TAILQ_INIT(&pv_list);
+		if (!pmap_demote_pde(pmap, pd, va, &pv_list)) {
 			/*
 			 * Invalidation of the 2MB page mapping may have caused
 			 * the deallocation of the underlying PD page.
@@ -1808,7 +1969,7 @@ retry:
 		 * Here if the pte page isn't mapped, or if it has been
 		 * deallocated.
 		 */
-		m = _pmap_allocpte(pmap, ptepindex, flags);
+		m = _pmap_allocpte(pmap, pa, ptepindex, flags);
 		if (m == NULL && (flags & M_WAITOK))
 			goto retry;
 	}
@@ -2014,6 +2175,7 @@ SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_coll
  * allocate per-page pv entries until repromotion occurs, thereby
  * exacerbating the shortage of free pv entries.
  */
+#ifdef nomore
 static void
 pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq)
 {
@@ -2029,8 +2191,8 @@ pmap_collect(pmap_t locked_pmap, struct 
 		if (m->hold_count || m->busy)
 			continue;
 		TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) {
-			va = pv->pv_va;
 			pmap = PV_PMAP(pv);
+			va = pv->pv_va;
 			/* Avoid deadlock and lock recursion. */
 			if (pmap > locked_pmap)
 				PMAP_LOCK(pmap);
@@ -2064,7 +2226,7 @@ pmap_collect(pmap_t locked_pmap, struct 
 		}
 	}
 }
-
+#endif
 
 /*
  * free the pv_entry back to the free list
@@ -2076,11 +2238,11 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	struct pv_chunk *pc;
 	int idx, field, bit;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+
+	atomic_add_int(&pv_entry_count, -1);
 	PV_STAT(pv_entry_frees++);
 	PV_STAT(pv_entry_spare++);
-	pv_entry_count--;
 	pc = pv_to_chunk(pv);
 	idx = pv - &pc->pc_pventry[0];
 	field = idx / 64;
@@ -2099,7 +2261,9 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
 	/* entire chunk is free, return it */
 	m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc));
 	dump_drop_page(m->phys_addr);
-	vm_page_unwire(m, 0);
+	KASSERT(m->wire_count == 1, ("wire_count == %d", m->wire_count));
+	m->wire_count--;
+	atomic_subtract_int(&cnt.v_wire_count, 1);
 	vm_page_free(m);
 }
 
@@ -2108,7 +2272,7 @@ free_pv_entry(pmap_t pmap, pv_entry_t pv
  * when needed.
  */
 static pv_entry_t
-get_pv_entry(pmap_t pmap, int try)
+get_pv_entry(pmap_t pmap)
 {
 	static const struct timeval printinterval = { 60, 0 };
 	static struct timeval lastprint;
@@ -2120,16 +2284,15 @@ get_pv_entry(pmap_t pmap, int try)
 	vm_page_t m;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+
+	atomic_add_int(&pv_entry_count, 1);
 	PV_STAT(pv_entry_allocs++);
-	pv_entry_count++;
 	if (pv_entry_count > pv_entry_high_water)
 		if (ratecheck(&lastprint, &printinterval))
 			printf("Approaching the limit on PV entries, consider "
 			    "increasing either the vm.pmap.shpgperproc or the "
 			    "vm.pmap.pv_entry_max sysctl.\n");
 	pq = NULL;
-retry:
 	pc = TAILQ_FIRST(&pmap->pm_pvchunk);
 	if (pc != NULL) {
 		for (field = 0; field < _NPCM; field++) {
@@ -2156,26 +2319,9 @@ retry:
 	    VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL) | VM_ALLOC_NOOBJ |
 	    VM_ALLOC_WIRED);
 	if (m == NULL) {
-		if (try) {
-			pv_entry_count--;
-			PV_STAT(pc_chunk_tryfail++);
-			return (NULL);
-		}
-		/*
-		 * Reclaim pv entries: At first, destroy mappings to inactive
-		 * pages.  After that, if a pv chunk entry is still needed,
-		 * destroy mappings to active pages.
-		 */
-		if (pq == NULL) {
-			PV_STAT(pmap_collect_inactive++);
-			pq = &vm_page_queues[PQ_INACTIVE];
-		} else if (pq == &vm_page_queues[PQ_INACTIVE]) {
-			PV_STAT(pmap_collect_active++);
-			pq = &vm_page_queues[PQ_ACTIVE];
-		} else
-			panic("get_pv_entry: increase vm.pmap.shpgperproc");
-		pmap_collect(pmap, pq);
-		goto retry;
+		PV_STAT(pc_chunk_tryfail++);
+		atomic_add_int(&pv_entry_count, -1);
+		return (NULL);
 	}
 	PV_STAT(pc_chunk_count++);
 	PV_STAT(pc_chunk_allocs++);
@@ -2189,9 +2335,63 @@ retry:
 	pv = &pc->pc_pventry[0];
 	TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list);
 	PV_STAT(pv_entry_spare += _NPCPV - 1);
+
 	return (pv);
 }
 
+static void
+pmap_pv_list_free(pmap_t pmap, struct pv_list_head *pv_list)
+{
+	pv_entry_t pv;
+
+	while (!TAILQ_EMPTY(pv_list)) {
+		pv = TAILQ_FIRST(pv_list);
+		TAILQ_REMOVE(pv_list, pv, pv_list);
+		free_pv_entry(pmap, pv);
+	}
+}
+
+static boolean_t
+pmap_pv_list_alloc(pmap_t pmap, int count, struct pv_list_head *pv_list)
+{
+	pv_entry_t pv;
+	int i;
+	boolean_t slept;
+
+	slept = FALSE;
+	for (i = 0; i < count; i++) {
+		while ((pv = get_pv_entry(pmap)) == NULL) {
+			PMAP_UNLOCK(pmap);
+			slept = TRUE;
+			VM_WAIT;
+			PMAP_LOCK(pmap);
+		}
+		TAILQ_INSERT_HEAD(pv_list, pv, pv_list);
+	}
+
+	return (slept);
+}
+
+static boolean_t
+pmap_pv_list_try_alloc(pmap_t pmap, int count, struct pv_list_head *pv_list)
+{
+	pv_entry_t pv;
+	int i;
+	boolean_t success;
+
+	success = TRUE;
+	for (i = 0; i < count; i++) {
+		if ((pv = get_pv_entry(pmap)) == NULL) {
+			success = FALSE;
+			pmap_pv_list_free(pmap, pv_list);
+			goto done;
+		}
+		TAILQ_INSERT_HEAD(pv_list, pv, pv_list);
+	}
+done:
+	return (success);
+}
+
 /*
  * First find and then remove the pv entry for the specified pmap and virtual
  * address from the specified pv list.  Returns the pv entry if found and NULL
@@ -2203,7 +2403,8 @@ pmap_pvh_remove(struct md_page *pvh, pma
 {
 	pv_entry_t pv;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+
 	TAILQ_FOREACH(pv, &pvh->pv_list, pv_list) {
 		if (pmap == PV_PMAP(pv) && va == pv->pv_va) {
 			TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
@@ -2219,27 +2420,37 @@ pmap_pvh_remove(struct md_page *pvh, pma
  * entries for each of the 4KB page mappings.
  */
 static void
-pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa)
+pmap_pv_demote_pde(pmap_t pmap, vm_offset_t va, vm_paddr_t pa,
+	struct pv_list_head *pv_list)
 {
 	struct md_page *pvh;
 	pv_entry_t pv;
 	vm_offset_t va_last;
 	vm_page_t m;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	PA_LOCK_ASSERT(pa, MA_OWNED);
 	KASSERT((pa & PDRMASK) == 0,
 	    ("pmap_pv_demote_pde: pa is not 2mpage aligned"));
 
-	/*
-	 * Transfer the 2mpage's pv entry for this mapping to the first
-	 * page's pv list.
-	 */
+	 /* Transfer the 2mpage's pv entry for this mapping to the first
+	  *  page's pv list.
+	  */
 	pvh = pa_to_pvh(pa);
 	va = trunc_2mpage(va);
 	pv = pmap_pvh_remove(pvh, pmap, va);
 	KASSERT(pv != NULL, ("pmap_pv_demote_pde: pv not found"));
 	m = PHYS_TO_VM_PAGE(pa);
+#ifdef INVARIANTS
+		if (va == 0) {
+			printf("inserting va==0\n");
+			kdb_backtrace();
+		}
+#endif
+	vm_page_lock(m);
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
+	vm_page_unlock(m);
+	
 	/* Instantiate the remaining NPTEPG - 1 pv entries. */
 	va_last = va + NBPDR - PAGE_SIZE;
 	do {
@@ -2247,8 +2458,20 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 		KASSERT((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0,
 		    ("pmap_pv_demote_pde: page %p is not managed", m));
 		va += PAGE_SIZE;
-		pmap_insert_entry(pmap, va, m);
+		pv = TAILQ_FIRST(pv_list);
+		TAILQ_REMOVE(pv_list, pv, pv_list);
+#ifdef INVARIANTS
+		if (va == 0) {
+			printf("inserting va==0\n");
+			kdb_backtrace();
+		}
+#endif		
+		pv->pv_va = va;
+		vm_page_lock(m);
+		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
+		vm_page_unlock(m);
 	} while (va < va_last);
+
 }
 
 /*
@@ -2264,7 +2487,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs
 	vm_offset_t va_last;
 	vm_page_t m;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	PA_LOCK_ASSERT(pa, MA_OWNED);
 	KASSERT((pa & PDRMASK) == 0,
 	    ("pmap_pv_promote_pde: pa is not 2mpage aligned"));
 
@@ -2310,7 +2533,8 @@ pmap_remove_entry(pmap_t pmap, vm_page_t
 {
 	struct md_page *pvh;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	vm_page_lock_assert(m, MA_OWNED);
+
 	pmap_pvh_free(&m->md, pmap, va);
 	if (TAILQ_EMPTY(&m->md.pv_list)) {
 		pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
@@ -2320,22 +2544,6 @@ pmap_remove_entry(pmap_t pmap, vm_page_t
 }
 
 /*
- * Create a pv entry for page at pa for
- * (pmap, va).
- */
-static void
-pmap_insert_entry(pmap_t pmap, vm_offset_t va, vm_page_t m)
-{
-	pv_entry_t pv;
-
-	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
-	pv = get_pv_entry(pmap, FALSE);
-	pv->pv_va = va;
-	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
-}
-
-/*
  * Conditionally create a pv entry.
  */
 static boolean_t
@@ -2344,9 +2552,15 @@ pmap_try_insert_pv_entry(pmap_t pmap, vm
 	pv_entry_t pv;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	vm_page_lock_assert(m, MA_OWNED);
 	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	    (pv = get_pv_entry(pmap)) != NULL) {
+#ifdef INVARIANTS
+		if (va == 0) {
+			printf("inserting va==0\n");
+			kdb_backtrace();
+		}
+#endif		
 		pv->pv_va = va;
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		return (TRUE);
@@ -2363,9 +2577,16 @@ pmap_pv_insert_pde(pmap_t pmap, vm_offse
 	struct md_page *pvh;
 	pv_entry_t pv;
 
-	mtx_assert(&vm_page_queue_mtx, MA_OWNED);
+	PA_LOCK_ASSERT(pa, MA_OWNED);
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	if (pv_entry_count < pv_entry_high_water && 
-	    (pv = get_pv_entry(pmap, TRUE)) != NULL) {
+	    (pv = get_pv_entry(pmap)) != NULL) {
+#ifdef INVARIANTS
+		if (va == 0) {
+			printf("inserting va==0\n");
+			kdb_backtrace();
+		}
+#endif		
 		pv->pv_va = va;
 		pvh = pa_to_pvh(pa);
 		TAILQ_INSERT_TAIL(&pvh->pv_list, pv, pv_list);
@@ -2393,7 +2614,8 @@ pmap_fill_ptp(pt_entry_t *firstpte, pt_e
  * mapping is invalidated.
  */
 static boolean_t
-pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va)
+pmap_demote_pde(pmap_t pmap, pd_entry_t *pde, vm_offset_t va,
+	struct pv_list_head *pv_list)
 {
 	pd_entry_t newpde, oldpde;
 	pt_entry_t *firstpte, newpte;
@@ -2429,7 +2651,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 		    DMAP_MAX_ADDRESS ? VM_ALLOC_INTERRUPT : VM_ALLOC_NORMAL) |
 		    VM_ALLOC_NOOBJ | VM_ALLOC_WIRED)) == NULL) {
 			free = NULL;
-			pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free);
+			pmap_remove_pde(pmap, pde, trunc_2mpage(va), &free, pv_list);
 			pmap_invalidate_page(pmap, trunc_2mpage(va));
 			pmap_free_zero_pages(free);
 			CTR2(KTR_PMAP, "pmap_demote_pde: failure for va %#lx"
@@ -2439,6 +2661,10 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 		if (va < VM_MAXUSER_ADDRESS)
 			pmap->pm_stats.resident_count++;
 	}
+	if (TAILQ_EMPTY(pv_list) && ((oldpde & PG_MANAGED) != 0)) {
+		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE)
+			return (FALSE);
+	}
 	mptepa = VM_PAGE_TO_PHYS(mpte);
 	firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa);
 	newpde = mptepa | PG_M | PG_A | (oldpde & PG_U) | PG_RW | PG_V;
@@ -2496,7 +2722,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 	 * the 2mpage to referencing the page table page.
 	 */
 	if ((oldpde & PG_MANAGED) != 0)
-		pmap_pv_demote_pde(pmap, va, oldpde & PG_PS_FRAME);
+		pmap_pv_demote_pde(pmap, va, oldpde & PG_PS_FRAME, pv_list);
 
 	pmap_pde_demotions++;
 	CTR2(KTR_PMAP, "pmap_demote_pde: success for va %#lx"
@@ -2509,7 +2735,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
  */
 static int
 pmap_remove_pde(pmap_t pmap, pd_entry_t *pdq, vm_offset_t sva,
-    vm_page_t *free)
+    vm_page_t *free, struct pv_list_head *pv_list)
 {
 	struct md_page *pvh;
 	pd_entry_t oldpde;
@@ -2536,6 +2762,10 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		eva = sva + NBPDR;
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
 		    va < eva; va += PAGE_SIZE, m++) {
+			/*
+			 * XXX do we need to individually lock each page? 
+			 *
+			 */
 			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
 				vm_page_dirty(m);
 			if (oldpde & PG_A)
@@ -2546,7 +2776,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		}
 	}
 	if (pmap == kernel_pmap) {
-		if (!pmap_demote_pde(pmap, pdq, sva))
+		if (!pmap_demote_pde(pmap, pdq, sva, pv_list))
 			panic("pmap_remove_pde: failed demotion");
 	} else {
 		mpte = pmap_lookup_pt_page(pmap, sva);
@@ -2563,6 +2793,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 	return (pmap_unuse_pt(pmap, sva, *pmap_pdpe(pmap, sva), free));
 }
 
+
 /*
  * pmap_remove_pte: do the things to unmap a page in a process
  */
@@ -2586,6 +2817,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t 
 	pmap->pm_stats.resident_count -= 1;
 	if (oldpte & PG_MANAGED) {
 		m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
+		vm_page_lock_assert(m, MA_OWNED);
 		if ((oldpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
 			vm_page_dirty(m);
 		if (oldpte & PG_A)
@@ -2602,6 +2834,7 @@ static void
 pmap_remove_page(pmap_t pmap, vm_offset_t va, pd_entry_t *pde, vm_page_t *free)
 {
 	pt_entry_t *pte;
+	vm_paddr_t pa = 0;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	if ((*pde & PG_V) == 0)
@@ -2609,10 +2842,89 @@ pmap_remove_page(pmap_t pmap, vm_offset_
 	pte = pmap_pde_to_pte(pde, va);
 	if ((*pte & PG_V) == 0)
 		return;
+	if  (*pte & PG_MANAGED)
+		(void)pa_tryrelock(pmap, *pte & PG_FRAME, &pa);
+
 	pmap_remove_pte(pmap, pte, va, *pde, free);
+	if (pa)
+		PA_UNLOCK(pa);
 	pmap_invalidate_page(pmap, va);
 }
 
+static void
+pmap_prealloc_pv_list(pmap_t pmap, vm_offset_t sva, vm_offset_t eva,
+	struct pv_list_head *pv_list)
+{
+	vm_offset_t va_next;
+	pml4_entry_t *pml4e;
+	pdp_entry_t *pdpe;
+	pd_entry_t ptpaddr, *pde;
+	pt_entry_t *pte;
+	int i, alloc_count;
+
+	alloc_count = 0;
+	PMAP_LOCK(pmap);
+	for (; sva < eva; sva = va_next) {
+
+		pml4e = pmap_pml4e(pmap, sva);
+		if ((*pml4e & PG_V) == 0) {
+			va_next = (sva + NBPML4) & ~PML4MASK;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+
+		pdpe = pmap_pml4e_to_pdpe(pml4e, sva);
+		if ((*pdpe & PG_V) == 0) {
+			va_next = (sva + NBPDP) & ~PDPMASK;
+			if (va_next < sva)
+				va_next = eva;
+			continue;
+		}
+
+		/*
+		 * Calculate index for next page table.
+		 */
+		va_next = (sva + NBPDR) & ~PDRMASK;
+		if (va_next < sva)
+			va_next = eva;
+
+		pde = pmap_pdpe_to_pde(pdpe, sva);
+		ptpaddr = *pde;
+
+		/*
+		 * Weed out invalid mappings.
+		 */
+		if (ptpaddr == 0)
+			continue;
+
+		/*
+		 * Check for large page.
+		 */
+		if ((ptpaddr & PG_PS) != 0) {
+			alloc_count++;
+			continue;
+		}
+		/*
+		 * Limit our scan to either the end of the va represented
+		 * by the current page table page, or to the end of the
+		 * range being removed.
+		 */
+		if (va_next > eva)
+			va_next = eva;
+
+		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
+		    sva += PAGE_SIZE) {
+			if (*pte == 0)
+				continue;
+		}
+	}
+	for (i = 0; i < alloc_count; i++)
+		pmap_pv_list_alloc(pmap, NPTEPG-1, pv_list);
+
+	PMAP_UNLOCK(pmap);
+}
+
 /*
  *	Remove the given range of addresses from the specified map.
  *
@@ -2627,7 +2939,9 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 	pdp_entry_t *pdpe;
 	pd_entry_t ptpaddr, *pde;
 	pt_entry_t *pte;
+	vm_paddr_t pa;
 	vm_page_t free = NULL;
+	struct pv_list_head pv_list;
 	int anyvalid;
 
 	/*
@@ -2636,11 +2950,19 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 	if (pmap->pm_stats.resident_count == 0)
 		return;
 
-	anyvalid = 0;
+	pa = anyvalid = 0;
+	TAILQ_INIT(&pv_list);
 
-	vm_page_lock_queues();
-	PMAP_LOCK(pmap);
+	/*
+	 * pre-allocate pvs
+	 *
+	 */
+	if ((pmap == kernel_pmap) &&
+	    (sva + PAGE_SIZE != eva)) 
+		pmap_prealloc_pv_list(pmap, sva, eva, &pv_list);
 
+	PMAP_LOCK(pmap);
+restart:
 	/*
 	 * special handling of removing one page.  a very
 	 * common operation and easy to short circuit some
@@ -2695,6 +3017,11 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 		 * Check for large page.
 		 */
 		if ((ptpaddr & PG_PS) != 0) {
+			if (pa_tryrelock(pmap, ptpaddr & PG_FRAME, &pa)) {
+				va_next = sva;
+				continue;
+			}
+
 			/*
 			 * Are we removing the entire large page?  If not,
 			 * demote the mapping and fall through.
@@ -2706,9 +3033,9 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 				 */
 				if ((ptpaddr & PG_G) == 0)
 					anyvalid = 1;
-				pmap_remove_pde(pmap, pde, sva, &free);
+				pmap_remove_pde(pmap, pde, sva, &free, &pv_list);
 				continue;
-			} else if (!pmap_demote_pde(pmap, pde, sva)) {
+			} else if (!pmap_demote_pde(pmap, pde, sva, &pv_list)) {
 				/* The large page mapping was destroyed. */
 				continue;
 			} else
@@ -2725,23 +3052,35 @@ pmap_remove(pmap_t pmap, vm_offset_t sva
 
 		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
 		    sva += PAGE_SIZE) {
+			int ret;
+
 			if (*pte == 0)
 				continue;
 
+			if  ((*pte & PG_MANAGED) &&
+			    pa_tryrelock(pmap, *pte & PG_FRAME, &pa))
+				goto restart;
+
 			/*
 			 * The TLB entry for a PG_G mapping is invalidated
 			 * by pmap_remove_pte().
 			 */
 			if ((*pte & PG_G) == 0)
 				anyvalid = 1;
-			if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free))
+			ret = pmap_remove_pte(pmap, pte, sva, ptpaddr, &free);

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

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 04:22:45 2010
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 BD22B1065672;
	Mon, 19 Apr 2010 04:22:45 +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 ACA938FC1A;
	Mon, 19 Apr 2010 04:22:45 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J4MjDq091319;
	Mon, 19 Apr 2010 04:22:45 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J4MjJx091317;
	Mon, 19 Apr 2010 04:22:45 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004190422.o3J4MjJx091317@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 04:22:45 +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: r206827 -
	user/kmacy/head_page_lock_2/sys/dev/cxgb/ulp/tom
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, 19 Apr 2010 04:22:45 -0000

Author: kmacy
Date: Mon Apr 19 04:22:45 2010
New Revision: 206827
URL: http://svn.freebsd.org/changeset/base/206827

Log:
  update cxgb_vm for page lock

Modified:
  user/kmacy/head_page_lock_2/sys/dev/cxgb/ulp/tom/cxgb_vm.c

Modified: user/kmacy/head_page_lock_2/sys/dev/cxgb/ulp/tom/cxgb_vm.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/dev/cxgb/ulp/tom/cxgb_vm.c	Mon Apr 19 04:09:20 2010	(r206826)
+++ user/kmacy/head_page_lock_2/sys/dev/cxgb/ulp/tom/cxgb_vm.c	Mon Apr 19 04:22:45 2010	(r206827)
@@ -90,7 +90,6 @@ vm_fault_hold_user_pages(vm_map_t map, v
 	 * (and R/W if for write) if so just mark pages as held (and 
 	 * dirty if for write) and return
 	 */
-	vm_page_lock_queues();
 	for (pages = mp, faults = 0, va = addr; va < end;
 	     va += PAGE_SIZE, pages++) {
 		/*
@@ -114,7 +113,6 @@ vm_fault_hold_user_pages(vm_map_t map, v
 			vm_page_dirty(m);
 		
 	}
-	vm_page_unlock_queues();
 	
 	if (faults == 0)
 		return (0);
@@ -141,13 +139,13 @@ vm_fault_hold_user_pages(vm_map_t map, v
 error:	
 	log(LOG_WARNING,
 	    "vm_fault bad return rv=%d va=0x%zx\n", rv, va);
-	vm_page_lock_queues();
 	for (pages = mp, va = addr; va < end; va += PAGE_SIZE, pages++)
 		if (*pages) {
+			vm_page_lock(*pages);
 			vm_page_unhold(*pages);
+			vm_page_unlock(*pages);
 			*pages = NULL;
 		}
-	vm_page_unlock_queues();
 	return (EFAULT);
 }
 
@@ -156,10 +154,10 @@ vm_fault_unhold_pages(vm_page_t *mp, int
 {
 
 	KASSERT(count >= 0, ("negative count %d", count));
-	vm_page_lock_queues();
 	while (count--) {
+		vm_page_lock(*mp);
 		vm_page_unhold(*mp);
+		vm_page_unlock(*mp);
 		mp++;
 	}
-	vm_page_unlock_queues();
 }

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 06:37:19 2010
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 5C8B01065675;
	Mon, 19 Apr 2010 06:37:19 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 317EB8FC22;
	Mon, 19 Apr 2010 06:37:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J6bJRA020983;
	Mon, 19 Apr 2010 06:37:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J6bJ25020979;
	Mon, 19 Apr 2010 06:37:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190637.o3J6bJ25020979@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 06:37:19 +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: r206830 - in user/jmallett/octeon/sys/mips: include mips
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, 19 Apr 2010 06:37:19 -0000

Author: jmallett
Date: Mon Apr 19 06:37:18 2010
New Revision: 206830
URL: http://svn.freebsd.org/changeset/base/206830

Log:
  Go back to old cpu_intr calling convention.

Modified:
  user/jmallett/octeon/sys/mips/include/intr_machdep.h
  user/jmallett/octeon/sys/mips/mips/exception.S
  user/jmallett/octeon/sys/mips/mips/intr_machdep.c

Modified: user/jmallett/octeon/sys/mips/include/intr_machdep.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/intr_machdep.h	Mon Apr 19 06:01:58 2010	(r206829)
+++ user/jmallett/octeon/sys/mips/include/intr_machdep.h	Mon Apr 19 06:37:18 2010	(r206830)
@@ -43,7 +43,7 @@ void cpu_establish_hardintr(const char *
     void *, int, int, void **);
 void cpu_establish_softintr(const char *, driver_filter_t *, void (*)(void*), 
     void *, int, int, void **);
-register_t cpu_intr(struct trapframe *);
+void cpu_intr(struct trapframe *);
 
 /*
  * Allow a platform to override the default hard interrupt mask and unmask

Modified: user/jmallett/octeon/sys/mips/mips/exception.S
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/exception.S	Mon Apr 19 06:01:58 2010	(r206829)
+++ user/jmallett/octeon/sys/mips/mips/exception.S	Mon Apr 19 06:37:18 2010	(r206830)
@@ -604,6 +604,7 @@ NNON_LEAF(MipsKernIntr, KERN_EXC_FRAME_S
 	and	a1, a1, ~SR_INT_MASK
 	or	a1, a1, a0
 	SAVE_REG(a1, SR, sp)
+	REG_L	v0, CALLFRAME_RA + KERN_REG_SIZE(sp)
 	RESTORE_CPU			# v0 contains the return address.
 	sync
 	eret

Modified: user/jmallett/octeon/sys/mips/mips/intr_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/intr_machdep.c	Mon Apr 19 06:01:58 2010	(r206829)
+++ user/jmallett/octeon/sys/mips/mips/intr_machdep.c	Mon Apr 19 06:37:18 2010	(r206830)
@@ -213,7 +213,7 @@ cpu_establish_softintr(const char *name,
 	mips_intrcnt_setname(mips_intr_counters[irq], event->ie_fullname);
 }
 
-register_t
+void
 cpu_intr(struct trapframe *tf)
 {
 	struct intr_event *event;
@@ -266,6 +266,4 @@ cpu_intr(struct trapframe *tf)
 	KASSERT(i == 0, ("all interrupts handled"));
 
 	critical_exit();
-
-	return (tf->pc);
 }

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 06:58:31 2010
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 C084A1065674;
	Mon, 19 Apr 2010 06:58:31 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AF10C8FC0C;
	Mon, 19 Apr 2010 06:58:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J6wVKF025664;
	Mon, 19 Apr 2010 06:58:31 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J6wVTe025662;
	Mon, 19 Apr 2010 06:58:31 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190658.o3J6wVTe025662@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 06:58:31 +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: r206831 - user/jmallett/octeon/gnu/lib/libgcc
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, 19 Apr 2010 06:58:31 -0000

Author: jmallett
Date: Mon Apr 19 06:58:31 2010
New Revision: 206831
URL: http://svn.freebsd.org/changeset/base/206831

Log:
  Don't build additional conversion functions for o32.  XXX does n32 need these?

Modified:
  user/jmallett/octeon/gnu/lib/libgcc/Makefile

Modified: user/jmallett/octeon/gnu/lib/libgcc/Makefile
==============================================================================
--- user/jmallett/octeon/gnu/lib/libgcc/Makefile	Mon Apr 19 06:37:18 2010	(r206830)
+++ user/jmallett/octeon/gnu/lib/libgcc/Makefile	Mon Apr 19 06:58:31 2010	(r206831)
@@ -117,11 +117,13 @@ LIB2FUNCS_EXTRA = floatunsidf.c floatuns
 
 .if ${TARGET_ARCH} == "mips"
 LIB2FUNCS_EXTRA = floatunsidf.c floatunsisf.c
+.if defined(TARGET_ABI) && ${TARGET_ABI} != "o32"
 LIB2FUNCS_EXTRA+= floatdidf.c fixunsdfsi.c
 LIB2FUNCS_EXTRA+= floatdisf.c floatundidf.c
 LIB2FUNCS_EXTRA+= fixsfdi.c floatundisf.c
 LIB2FUNCS_EXTRA+= fixdfdi.c fixunssfsi.c
 .endif
+.endif
 
 .if ${TARGET_ARCH} == "ia64"
 #	from config/ia64/t-ia64

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 06:58:57 2010
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 0553C1065677;
	Mon, 19 Apr 2010 06:58:57 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CEA818FC24;
	Mon, 19 Apr 2010 06:58:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J6wu8T025797;
	Mon, 19 Apr 2010 06:58:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J6wuPt025795;
	Mon, 19 Apr 2010 06:58:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190658.o3J6wuPt025795@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 06:58:56 +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: r206832 - user/jmallett/octeon/sys/mips/mips
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, 19 Apr 2010 06:58:57 -0000

Author: jmallett
Date: Mon Apr 19 06:58:56 2010
New Revision: 206832
URL: http://svn.freebsd.org/changeset/base/206832

Log:
  Eliminate the gratuitous pmap_pde() macro.

Modified:
  user/jmallett/octeon/sys/mips/mips/pmap.c

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 06:58:31 2010	(r206831)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 06:58:56 2010	(r206832)
@@ -125,7 +125,6 @@ __FBSDID("$FreeBSD$");
  *     so we end up getting NUSERPGTBLS of 0.
  */
 #define	pmap_segshift(v)	(((v) >> SEGSHIFT) & (NPDEPG - 1))
-#define	pmap_pde(m, v)		(&((m)->pm_segtab[pmap_segshift((v))]))
 #define	segtab_pde(m, v)	((m)[pmap_segshift((v))])
 
 #if defined(__mips_n64)
@@ -272,10 +271,10 @@ caddr_t virtual_sys_start = (caddr_t)0;
 static inline pt_entry_t *
 pmap_segmap(pmap_t pmap, vm_offset_t va)
 {
-	if (pmap->pm_segtab)
-		return (*pmap_pde(pmap, va));
+	if (pmap->pm_segtab != NULL)
+		return (segtab_pde(pmap->pm_segtab, va));
 	else
-		return ((pd_entry_t)0);
+		return (NULL);
 }
 
 /*
@@ -912,7 +911,7 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v
 		    (pmap->pm_ptphint->pindex == ptepindex)) {
 			mpte = pmap->pm_ptphint;
 		} else {
-			pteva = *pmap_pde(pmap, va);
+			pteva = pmap_segmap(pmap, va);
 			mpte = PHYS_TO_VM_PAGE(vtophys(pteva));
 			pmap->pm_ptphint = mpte;
 		}
@@ -1558,7 +1557,7 @@ pmap_remove(struct pmap *pmap, vm_offset
 		goto out;
 	}
 	for (va = sva; va < eva; va = nva) {
-		if (!*pmap_pde(pmap, va)) {
+		if (pmap_segmap(pmap, va) == NULL) {
 			nva = mips_segtrunc(va + NBSEG);
 			continue;
 		}
@@ -1666,7 +1665,7 @@ pmap_protect(pmap_t pmap, vm_offset_t sv
 		/*
 		 * If segment table entry is empty, skip this segment.
 		 */
-		if (!*pmap_pde(pmap, sva)) {
+		if (pmap_segmap(pmap, sva) == NULL) {
 			sva = mips_segtrunc(sva + NBSEG);
 			continue;
 		}
@@ -2611,7 +2610,7 @@ pmap_is_prefaultable(pmap_t pmap, vm_off
 
 	rv = FALSE;
 	PMAP_LOCK(pmap);
-	if (*pmap_pde(pmap, addr)) {
+	if (pmap_segmap(pmap, addr) != NULL) {
 		pte = pmap_pte(pmap, addr);
 		rv = (*pte == 0);
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 07:16:01 2010
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 9929C106564A;
	Mon, 19 Apr 2010 07:16:01 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8778F8FC2A;
	Mon, 19 Apr 2010 07:16:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J7G1Do029576;
	Mon, 19 Apr 2010 07:16:01 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J7G1WY029574;
	Mon, 19 Apr 2010 07:16:01 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190716.o3J7G1WY029574@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 07:16:01 +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: r206833 - user/jmallett/octeon/sys/mips/mips
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, 19 Apr 2010 07:16:01 -0000

Author: jmallett
Date: Mon Apr 19 07:16:01 2010
New Revision: 206833
URL: http://svn.freebsd.org/changeset/base/206833

Log:
  Fix comment.

Modified:
  user/jmallett/octeon/sys/mips/mips/swtch.S

Modified: user/jmallett/octeon/sys/mips/mips/swtch.S
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/swtch.S	Mon Apr 19 06:58:56 2010	(r206832)
+++ user/jmallett/octeon/sys/mips/mips/swtch.S	Mon Apr 19 07:16:01 2010	(r206833)
@@ -304,7 +304,7 @@ blocked_loop:
  * Wiredown the USPACE of newproc in TLB entry#0.  Check whether target
  * USPACE is already in another place of TLB before that, and if so
  * invalidate that TLB entry.
- * NOTE: This is hard coded to UPAGES == 1.
+ * NOTE: This is hard coded to UPAGES == 2.
  * Also, there should be no TLB faults at this point.
  */
 	MTC0	v0, COP_0_TLB_HI		# VPN = va

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 07:39:56 2010
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 A88EC106566C;
	Mon, 19 Apr 2010 07:39:56 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 970308FC1E;
	Mon, 19 Apr 2010 07:39:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3J7dusx034844;
	Mon, 19 Apr 2010 07:39:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3J7duBG034842;
	Mon, 19 Apr 2010 07:39:56 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004190739.o3J7duBG034842@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 07:39:56 +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: r206835 - user/jmallett/octeon/sys/vm
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, 19 Apr 2010 07:39:56 -0000

Author: jmallett
Date: Mon Apr 19 07:39:56 2010
New Revision: 206835
URL: http://svn.freebsd.org/changeset/base/206835

Log:
  Merge from head.

Modified:
  user/jmallett/octeon/sys/vm/vm_glue.c
Directory Properties:
  user/jmallett/octeon/   (props changed)
  user/jmallett/octeon/sys/contrib/x86emu/   (props changed)

Modified: user/jmallett/octeon/sys/vm/vm_glue.c
==============================================================================
--- user/jmallett/octeon/sys/vm/vm_glue.c	Mon Apr 19 07:34:26 2010	(r206834)
+++ user/jmallett/octeon/sys/vm/vm_glue.c	Mon Apr 19 07:39:56 2010	(r206835)
@@ -523,8 +523,8 @@ vm_thread_swapout(struct thread *td)
 		m = vm_page_lookup(ksobj, i);
 		if (m == NULL)
 			panic("vm_thread_swapout: kstack already missing?");
-		vm_page_lock_queues();
 		vm_page_dirty(m);
+		vm_page_lock_queues();
 		vm_page_unwire(m, 0);
 		vm_page_unlock_queues();
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 18:30:11 2010
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 D18B4106566C;
	Mon, 19 Apr 2010 18:30:11 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C0B858FC1E;
	Mon, 19 Apr 2010 18:30:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JIUBCw080491;
	Mon, 19 Apr 2010 18:30:11 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JIUBwp080489;
	Mon, 19 Apr 2010 18:30:11 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004191830.o3JIUBwp080489@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 18:30:11 +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: r206851 - user/jmallett/octeon/sys/mips/include
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, 19 Apr 2010 18:30:11 -0000

Author: jmallett
Date: Mon Apr 19 18:30:11 2010
New Revision: 206851
URL: http://svn.freebsd.org/changeset/base/206851

Log:
  o) Don't obfuscate that the PFN mask is 32-bits by adding a leading 0.
  o) Cast the PFN to vm_paddr_t before shifting it to the left.

Modified:
  user/jmallett/octeon/sys/mips/include/pte.h

Modified: user/jmallett/octeon/sys/mips/include/pte.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/pte.h	Mon Apr 19 18:22:21 2010	(r206850)
+++ user/jmallett/octeon/sys/mips/include/pte.h	Mon Apr 19 18:30:11 2010	(r206851)
@@ -66,9 +66,9 @@ typedef	pt_entry_t *pd_entry_t;
 #define	TLBLO_SWBITS_SHIFT	(30)
 #define	TLBLO_SWBITS_MASK	(0x3U << TLBLO_SWBITS_SHIFT)
 #define	TLBLO_PFN_SHIFT		(6)
-#define	TLBLO_PFN_MASK		(0x03FFFFFC0)
+#define	TLBLO_PFN_MASK		(0x3FFFFFC0)
 #define	TLBLO_PA_TO_PFN(pa)	((((pa) >> TLB_PAGE_SHIFT) << TLBLO_PFN_SHIFT) & TLBLO_PFN_MASK)
-#define	TLBLO_PFN_TO_PA(pfn)	(((pfn) >> TLBLO_PFN_SHIFT) << TLB_PAGE_SHIFT)
+#define	TLBLO_PFN_TO_PA(pfn)	((vm_paddr_t)((pfn) >> TLBLO_PFN_SHIFT) << TLB_PAGE_SHIFT)
 #define	TLBLO_PTE_TO_PFN(pte)	((pte) & TLBLO_PFN_MASK)
 #define	TLBLO_PTE_TO_PA(pte)	(TLBLO_PFN_TO_PA(TLBLO_PTE_TO_PFN((pte))))
 

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:06:11 2010
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 3D157106566C;
	Mon, 19 Apr 2010 19:06:11 +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 2C50B8FC18;
	Mon, 19 Apr 2010 19:06:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJ6BEA088497;
	Mon, 19 Apr 2010 19:06:11 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJ6BR7088495;
	Mon, 19 Apr 2010 19:06:11 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004191906.o3JJ6BR7088495@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:06:11 +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: r206852 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 19:06:11 -0000

Author: kmacy
Date: Mon Apr 19 19:06:10 2010
New Revision: 206852
URL: http://svn.freebsd.org/changeset/base/206852

Log:
  don't acquire page lock needlessly

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_object.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_object.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Mon Apr 19 18:30:11 2010	(r206851)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Mon Apr 19 19:06:10 2010	(r206852)
@@ -1436,15 +1436,14 @@ retry:
 		 * We do not have to VM_PROT_NONE the page as mappings should
 		 * not be changed by this operation.
 		 */
-		vm_page_lock(m);
 		if ((m->oflags & VPO_BUSY) || m->busy) {
-			vm_page_unlock(m);
 			VM_OBJECT_UNLOCK(new_object);
 			m->oflags |= VPO_WANTED;
 			msleep(m, VM_OBJECT_MTX(orig_object), PVM, "spltwt", 0);
 			VM_OBJECT_LOCK(new_object);
 			goto retry;
 		}
+		vm_page_lock(m);
 		vm_page_rename(m, new_object, idx);
 		/* page automatically made dirty by rename and cache handled */
 		vm_page_busy(m);

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:06:41 2010
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 9C75B1065742;
	Mon, 19 Apr 2010 19:06:41 +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 8BD4E8FC1E;
	Mon, 19 Apr 2010 19:06:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJ6fXP088630;
	Mon, 19 Apr 2010 19:06:41 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJ6ffS088628;
	Mon, 19 Apr 2010 19:06:41 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004191906.o3JJ6ffS088628@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:06:41 +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: r206853 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 19:06:41 -0000

Author: kmacy
Date: Mon Apr 19 19:06:41 2010
New Revision: 206853
URL: http://svn.freebsd.org/changeset/base/206853

Log:
  - add assert to rename
  - lock cowfault

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_page.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Mon Apr 19 19:06:10 2010	(r206852)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.c	Mon Apr 19 19:06:41 2010	(r206853)
@@ -818,6 +818,7 @@ void
 vm_page_rename(vm_page_t m, vm_object_t new_object, vm_pindex_t new_pindex)
 {
 
+	vm_page_lock_assert(m, MA_OWNED);
 	vm_page_remove(m);
 	vm_page_insert(m, new_object, new_pindex);
 	vm_page_dirty(m);
@@ -2234,10 +2235,9 @@ vm_page_cowfault(vm_page_t m)
 	vm_object_t object;
 	vm_pindex_t pindex;
 
-	/* XXX Not properly locked. */
-	panic("vm_page_cowfault: Not properly locked\n");
 	object = m->object;
 	VM_OBJECT_LOCK_ASSERT(object, MA_OWNED);
+	vm_page_lock_assert(m, MA_OWNED);
 	KASSERT(object->paging_in_progress != 0,
 	    ("vm_page_cowfault: object %p's paging-in-progress count is zero.",
 	    object)); 
@@ -2271,15 +2271,19 @@ vm_page_cowfault(vm_page_t m)
 		 * waiting to allocate a page.  If so, put things back 
 		 * the way they were 
 		 */
+		vm_page_lock(mnew);
 		vm_page_free(mnew);
+		vm_page_unlock(mnew);
 		vm_page_insert(m, object, pindex);
 	} else { /* clear COW & copy page */
 		if (!so_zerocp_fullpage)
 			pmap_copy_page(m, mnew);
+		vm_page_lock(mnew);
 		mnew->valid = VM_PAGE_BITS_ALL;
 		vm_page_dirty(mnew);
 		mnew->wire_count = m->wire_count - m->cow;
 		m->wire_count = m->cow;
+		vm_page_unlock(mnew);
 	}
 }
 

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:20:37 2010
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 7B2B7106564A;
	Mon, 19 Apr 2010 19:20:37 +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 6A8AC8FC18;
	Mon, 19 Apr 2010 19:20:37 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJKbb6091783;
	Mon, 19 Apr 2010 19:20:37 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJKaYE091782;
	Mon, 19 Apr 2010 19:20:36 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004191920.o3JJKaYE091782@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:20:36 +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: r206854 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 19:20:37 -0000

Author: kmacy
Date: Mon Apr 19 19:20:36 2010
New Revision: 206854
URL: http://svn.freebsd.org/changeset/base/206854

Log:
  move vm_page_dirty under page lock to be more consistent with HEAD

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_glue.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_glue.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_glue.c	Mon Apr 19 19:06:41 2010	(r206853)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_glue.c	Mon Apr 19 19:20:36 2010	(r206854)
@@ -523,8 +523,8 @@ vm_thread_swapout(struct thread *td)
 		m = vm_page_lookup(ksobj, i);
 		if (m == NULL)
 			panic("vm_thread_swapout: kstack already missing?");
-		vm_page_dirty(m);
 		vm_page_lock(m);
+		vm_page_dirty(m);
 		vm_page_unwire(m, 0);
 		vm_page_unlock(m);
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:25:17 2010
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 64EDB106564A;
	Mon, 19 Apr 2010 19:25:17 +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 5451F8FC18;
	Mon, 19 Apr 2010 19:25:17 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJPHr6092912;
	Mon, 19 Apr 2010 19:25:17 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJPHx4092910;
	Mon, 19 Apr 2010 19:25:17 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004191925.o3JJPHx4092910@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:25:17 +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: r206855 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 19:25:17 -0000

Author: kmacy
Date: Mon Apr 19 19:25:17 2010
New Revision: 206855
URL: http://svn.freebsd.org/changeset/base/206855

Log:
  per 206823:
  vm_thread_swapout() can safely dirty the page before rather than after
   acquiring the page queues lock.

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_glue.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_glue.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_glue.c	Mon Apr 19 19:20:36 2010	(r206854)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_glue.c	Mon Apr 19 19:25:17 2010	(r206855)
@@ -523,8 +523,8 @@ vm_thread_swapout(struct thread *td)
 		m = vm_page_lookup(ksobj, i);
 		if (m == NULL)
 			panic("vm_thread_swapout: kstack already missing?");
-		vm_page_lock(m);
 		vm_page_dirty(m);
+		vm_page_lock(m);
 		vm_page_unwire(m, 0);
 		vm_page_unlock(m);
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:29:35 2010
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 51B571065678;
	Mon, 19 Apr 2010 19:29:35 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B53E8FC0C;
	Mon, 19 Apr 2010 19:29:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJTZxk093941;
	Mon, 19 Apr 2010 19:29:35 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJTYpB093919;
	Mon, 19 Apr 2010 19:29:34 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004191929.o3JJTYpB093919@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:29:34 +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: r206856 - in user/kib/vm6: . bin/cp bin/ln bin/ls
	bin/pax bin/ps bin/pwait bin/rcp bin/sh bin/test
	cddl/contrib/opensolaris/lib/libzfs/common
	contrib/binutils/bfd contrib/com_err contri...
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, 19 Apr 2010 19:29:35 -0000

Author: kib
Date: Mon Apr 19 19:29:33 2010
New Revision: 206856
URL: http://svn.freebsd.org/changeset/base/206856

Log:
  IFC

Added:
  user/kib/vm6/etc/rc.d/ubthidhci
     - copied unchanged from r206853, head/etc/rc.d/ubthidhci
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c
     - copied unchanged from r206853, head/gnu/usr.bin/gdb/gdbserver/fbsd-powerpc-low.c
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/reg-amd64.c
     - copied unchanged from r206853, head/gnu/usr.bin/gdb/gdbserver/reg-amd64.c
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c
     - copied unchanged from r206853, head/gnu/usr.bin/gdb/gdbserver/reg-powerpc.c
  user/kib/vm6/lib/libpmc/pmc.corei7.3
     - copied unchanged from r206853, head/lib/libpmc/pmc.corei7.3
  user/kib/vm6/lib/libpmc/pmc.corei7uc.3
     - copied unchanged from r206853, head/lib/libpmc/pmc.corei7uc.3
  user/kib/vm6/lib/libpmc/pmc.ucf.3
     - copied unchanged from r206853, head/lib/libpmc/pmc.ucf.3
  user/kib/vm6/lib/libpmc/pmc.westmere.3
     - copied unchanged from r206853, head/lib/libpmc/pmc.westmere.3
  user/kib/vm6/lib/libpmc/pmc.westmereuc.3
     - copied unchanged from r206853, head/lib/libpmc/pmc.westmereuc.3
  user/kib/vm6/sbin/geom/class/sched/
     - copied from r206853, head/sbin/geom/class/sched/
  user/kib/vm6/share/examples/indent/
     - copied from r206853, head/share/examples/indent/
  user/kib/vm6/share/man/man4/sge.4
     - copied unchanged from r206853, head/share/man/man4/sge.4
  user/kib/vm6/sys/boot/i386/efi/
     - copied from r206853, head/sys/boot/i386/efi/
  user/kib/vm6/sys/contrib/dev/iwn/iwlwifi-6000-9.193.4.1.fw.uu
     - copied unchanged from r206853, head/sys/contrib/dev/iwn/iwlwifi-6000-9.193.4.1.fw.uu
  user/kib/vm6/sys/dev/e1000/if_lem.c
     - copied unchanged from r206853, head/sys/dev/e1000/if_lem.c
  user/kib/vm6/sys/dev/e1000/if_lem.h
     - copied unchanged from r206853, head/sys/dev/e1000/if_lem.h
  user/kib/vm6/sys/dev/hwpmc/hwpmc_uncore.c
     - copied unchanged from r206853, head/sys/dev/hwpmc/hwpmc_uncore.c
  user/kib/vm6/sys/dev/hwpmc/hwpmc_uncore.h
     - copied unchanged from r206853, head/sys/dev/hwpmc/hwpmc_uncore.h
  user/kib/vm6/sys/dev/sge/
     - copied from r206853, head/sys/dev/sge/
  user/kib/vm6/sys/dev/syscons/logo/beastie.c
     - copied unchanged from r206853, head/sys/dev/syscons/logo/beastie.c
  user/kib/vm6/sys/geom/sched/
     - copied from r206853, head/sys/geom/sched/
  user/kib/vm6/sys/mips/cavium/octeon_mp.c
     - copied unchanged from r206853, head/sys/mips/cavium/octeon_mp.c
  user/kib/vm6/sys/modules/alq/
     - copied from r206853, head/sys/modules/alq/
  user/kib/vm6/sys/modules/geom/geom_sched/
     - copied from r206853, head/sys/modules/geom/geom_sched/
  user/kib/vm6/sys/modules/sge/
     - copied from r206853, head/sys/modules/sge/
  user/kib/vm6/sys/modules/syscons/beastie/
     - copied from r206853, head/sys/modules/syscons/beastie/
  user/kib/vm6/sys/net80211/ieee80211_ratectl.c
     - copied unchanged from r206853, head/sys/net80211/ieee80211_ratectl.c
  user/kib/vm6/sys/net80211/ieee80211_ratectl.h
     - copied unchanged from r206853, head/sys/net80211/ieee80211_ratectl.h
  user/kib/vm6/sys/sparc64/pci/sbbc.c
     - copied unchanged from r206853, head/sys/sparc64/pci/sbbc.c
  user/kib/vm6/tools/regression/bin/sh/expansion/arith4.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/arith4.0
  user/kib/vm6/tools/regression/bin/sh/expansion/arith5.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/arith5.0
  user/kib/vm6/tools/regression/bin/sh/expansion/plus-minus2.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/plus-minus2.0
  user/kib/vm6/tools/regression/bin/sh/expansion/plus-minus3.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/plus-minus3.0
  user/kib/vm6/tools/regression/bin/sh/expansion/tilde1.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/tilde1.0
  user/kib/vm6/tools/regression/bin/sh/expansion/tilde2.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/tilde2.0
  user/kib/vm6/tools/regression/bin/sh/expansion/trim1.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/trim1.0
  user/kib/vm6/tools/regression/bin/sh/expansion/trim2.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/expansion/trim2.0
  user/kib/vm6/tools/regression/bin/sh/parameters/pwd1.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/parameters/pwd1.0
  user/kib/vm6/tools/regression/bin/sh/parameters/pwd2.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/parameters/pwd2.0
  user/kib/vm6/tools/regression/bin/sh/parser/heredoc2.0
     - copied unchanged from r206853, head/tools/regression/bin/sh/parser/heredoc2.0
  user/kib/vm6/tools/regression/lib/libc/gen/test-fnmatch.c
     - copied unchanged from r206853, head/tools/regression/lib/libc/gen/test-fnmatch.c
  user/kib/vm6/usr.bin/calendar/dates.c
     - copied unchanged from r206853, head/usr.bin/calendar/dates.c
  user/kib/vm6/usr.bin/calendar/events.c
     - copied unchanged from r206853, head/usr.bin/calendar/events.c
  user/kib/vm6/usr.bin/calendar/locale.c
     - copied unchanged from r206853, head/usr.bin/calendar/locale.c
  user/kib/vm6/usr.bin/calendar/parsedata.c
     - copied unchanged from r206853, head/usr.bin/calendar/parsedata.c
  user/kib/vm6/usr.bin/calendar/pom.c
     - copied unchanged from r206853, head/usr.bin/calendar/pom.c
  user/kib/vm6/usr.bin/calendar/sunpos.c
     - copied unchanged from r206853, head/usr.bin/calendar/sunpos.c
  user/kib/vm6/usr.sbin/services_mkdb/
     - copied from r206853, head/usr.sbin/services_mkdb/
Deleted:
  user/kib/vm6/bin/pax/cpio.1
  user/kib/vm6/bin/pax/tar.1
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/fbsd-ppc-low.c
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/reg-ppc.c
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/reg-x86-64.c
  user/kib/vm6/sys/contrib/dev/iwn/iwlwifi-6000-9.176.4.1.fw.uu
  user/kib/vm6/sys/mips/cavium/dev/rgmii/octeon_fau.c
  user/kib/vm6/sys/mips/include/archtype.h
  user/kib/vm6/sys/mips/include/defs.h
  user/kib/vm6/sys/mips/include/psl.h
  user/kib/vm6/sys/mips/include/queue.h
  user/kib/vm6/sys/mips/include/rm7000.h
  user/kib/vm6/sys/mips/include/segments.h
  user/kib/vm6/sys/mips/mips/copystr.S
Modified:
  user/kib/vm6/MAINTAINERS
  user/kib/vm6/Makefile.inc1
  user/kib/vm6/ObsoleteFiles.inc
  user/kib/vm6/UPDATING
  user/kib/vm6/bin/cp/utils.c
  user/kib/vm6/bin/ln/ln.c
  user/kib/vm6/bin/ls/cmp.c
  user/kib/vm6/bin/pax/Makefile
  user/kib/vm6/bin/pax/getoldopt.c
  user/kib/vm6/bin/ps/ps.1
  user/kib/vm6/bin/pwait/pwait.1
  user/kib/vm6/bin/rcp/rcp.c
  user/kib/vm6/bin/sh/cd.c
  user/kib/vm6/bin/sh/cd.h
  user/kib/vm6/bin/sh/expand.c
  user/kib/vm6/bin/sh/main.c
  user/kib/vm6/bin/sh/mksyntax.c
  user/kib/vm6/bin/sh/options.c
  user/kib/vm6/bin/sh/parser.c
  user/kib/vm6/bin/sh/sh.1
  user/kib/vm6/bin/test/test.c
  user/kib/vm6/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c
  user/kib/vm6/contrib/binutils/bfd/config.bfd
  user/kib/vm6/contrib/com_err/compile_et.1
  user/kib/vm6/contrib/netcat/nc.1
  user/kib/vm6/contrib/netcat/netcat.c
  user/kib/vm6/contrib/top/utils.c
  user/kib/vm6/contrib/top/utils.h
  user/kib/vm6/contrib/tzdata/asia
  user/kib/vm6/contrib/tzdata/europe
  user/kib/vm6/contrib/tzdata/zone.tab
  user/kib/vm6/crypto/openssh/sshd.c
  user/kib/vm6/crypto/openssl/CHANGES
  user/kib/vm6/crypto/openssl/FAQ
  user/kib/vm6/crypto/openssl/Makefile
  user/kib/vm6/crypto/openssl/NEWS
  user/kib/vm6/crypto/openssl/README
  user/kib/vm6/crypto/openssl/apps/req.c
  user/kib/vm6/crypto/openssl/apps/speed.c
  user/kib/vm6/crypto/openssl/config
  user/kib/vm6/crypto/openssl/crypto/asn1/a_object.c
  user/kib/vm6/crypto/openssl/crypto/bio/bss_file.c
  user/kib/vm6/crypto/openssl/crypto/bn/asm/ppc.pl
  user/kib/vm6/crypto/openssl/crypto/bn/asm/x86_64-gcc.c
  user/kib/vm6/crypto/openssl/crypto/bn/bn_div.c
  user/kib/vm6/crypto/openssl/crypto/engine/eng_all.c
  user/kib/vm6/crypto/openssl/crypto/engine/eng_cryptodev.c
  user/kib/vm6/crypto/openssl/crypto/evp/digest.c
  user/kib/vm6/crypto/openssl/crypto/evp/evp_locl.h
  user/kib/vm6/crypto/openssl/crypto/evp/names.c
  user/kib/vm6/crypto/openssl/crypto/md32_common.h
  user/kib/vm6/crypto/openssl/crypto/ocsp/ocsp_prn.c
  user/kib/vm6/crypto/openssl/crypto/opensslv.h
  user/kib/vm6/crypto/openssl/crypto/rand/rand_win.c
  user/kib/vm6/crypto/openssl/engines/e_capi.c
  user/kib/vm6/crypto/openssl/engines/e_chil.c
  user/kib/vm6/crypto/openssl/fips/Makefile
  user/kib/vm6/crypto/openssl/openssl.spec
  user/kib/vm6/crypto/openssl/ssl/kssl.c
  user/kib/vm6/crypto/openssl/ssl/s3_pkt.c
  user/kib/vm6/etc/defaults/rc.conf
  user/kib/vm6/etc/inetd.conf
  user/kib/vm6/etc/mtree/BSD.include.dist
  user/kib/vm6/etc/network.subr
  user/kib/vm6/etc/rc.d/Makefile
  user/kib/vm6/etc/rc.d/ip6addrctl
  user/kib/vm6/etc/rc.d/netif
  user/kib/vm6/etc/rc.d/netoptions
  user/kib/vm6/etc/rc.firewall
  user/kib/vm6/etc/rc.subr
  user/kib/vm6/games/fortune/Notes
  user/kib/vm6/games/fortune/datfiles/fortunes
  user/kib/vm6/games/fortune/datfiles/fortunes-o.real
  user/kib/vm6/games/fortune/datfiles/fortunes.sp.ok
  user/kib/vm6/games/fortune/datfiles/limerick
  user/kib/vm6/games/fortune/datfiles/startrek
  user/kib/vm6/games/fortune/datfiles/zippy
  user/kib/vm6/gnu/usr.bin/diff/context.c.diff
  user/kib/vm6/gnu/usr.bin/diff/diff.c.diff
  user/kib/vm6/gnu/usr.bin/gdb/Makefile
  user/kib/vm6/gnu/usr.bin/gdb/gdbserver/Makefile
  user/kib/vm6/gnu/usr.bin/gdb/kgdb/kgdb.1
  user/kib/vm6/include/inttypes.h
  user/kib/vm6/include/netdb.h
  user/kib/vm6/include/nsswitch.h
  user/kib/vm6/lib/libc/db/hash/hash.c
  user/kib/vm6/lib/libc/db/hash/hash.h
  user/kib/vm6/lib/libc/db/man/hash.3
  user/kib/vm6/lib/libc/gen/__getosreldate.c
  user/kib/vm6/lib/libc/gen/_spinlock_stub.c
  user/kib/vm6/lib/libc/gen/_thread_init.c
  user/kib/vm6/lib/libc/gen/check_utility_compat.3
  user/kib/vm6/lib/libc/gen/confstr.3
  user/kib/vm6/lib/libc/gen/dladdr.3
  user/kib/vm6/lib/libc/gen/dlinfo.3
  user/kib/vm6/lib/libc/gen/dllockinit.3
  user/kib/vm6/lib/libc/gen/dlopen.3
  user/kib/vm6/lib/libc/gen/fmtcheck.3
  user/kib/vm6/lib/libc/gen/fnmatch.c
  user/kib/vm6/lib/libc/gen/frexp.3
  user/kib/vm6/lib/libc/gen/ftok.3
  user/kib/vm6/lib/libc/gen/getcwd.3
  user/kib/vm6/lib/libc/gen/getutxent.3
  user/kib/vm6/lib/libc/gen/setproctitle.3
  user/kib/vm6/lib/libc/gen/stringlist.3
  user/kib/vm6/lib/libc/gen/sysconf.3
  user/kib/vm6/lib/libc/gen/sysctl.3
  user/kib/vm6/lib/libc/locale/isalnum.3
  user/kib/vm6/lib/libc/locale/isalpha.3
  user/kib/vm6/lib/libc/net/getservent.c
  user/kib/vm6/lib/libc/net/nsdispatch.3
  user/kib/vm6/lib/libc/posix1e/acl_to_text_nfs4.c
  user/kib/vm6/lib/libc/posix1e/mac_prepare.3
  user/kib/vm6/lib/libc/softfloat/softfloat-specialize
  user/kib/vm6/lib/libc/stdio/printf.3
  user/kib/vm6/lib/libc/stdio/vasprintf.c
  user/kib/vm6/lib/libc/stdlib/hcreate.3
  user/kib/vm6/lib/libc/stdlib/ptsname.3
  user/kib/vm6/lib/libc/sys/sigaction.2
  user/kib/vm6/lib/libc/sys/stat.2
  user/kib/vm6/lib/libcam/cam.3
  user/kib/vm6/lib/libcam/cam_cdbparse.3
  user/kib/vm6/lib/libcompat/4.1/cftime.3
  user/kib/vm6/lib/libcompat/4.4/cuserid.3
  user/kib/vm6/lib/libedit/editline.3
  user/kib/vm6/lib/libedit/editrc.5
  user/kib/vm6/lib/libelf/elf.3
  user/kib/vm6/lib/libelf/elf_begin.3
  user/kib/vm6/lib/libelf/elf_cntl.3
  user/kib/vm6/lib/libelf/elf_end.3
  user/kib/vm6/lib/libelf/elf_errmsg.3
  user/kib/vm6/lib/libelf/elf_fill.3
  user/kib/vm6/lib/libelf/elf_flagdata.3
  user/kib/vm6/lib/libelf/elf_getarhdr.3
  user/kib/vm6/lib/libelf/elf_getarsym.3
  user/kib/vm6/lib/libelf/elf_getbase.3
  user/kib/vm6/lib/libelf/elf_getdata.3
  user/kib/vm6/lib/libelf/elf_getident.3
  user/kib/vm6/lib/libelf/elf_getphnum.3
  user/kib/vm6/lib/libelf/elf_getscn.3
  user/kib/vm6/lib/libelf/elf_getshnum.3
  user/kib/vm6/lib/libelf/elf_getshstrndx.3
  user/kib/vm6/lib/libelf/elf_hash.3
  user/kib/vm6/lib/libelf/elf_kind.3
  user/kib/vm6/lib/libelf/elf_memory.3
  user/kib/vm6/lib/libelf/elf_next.3
  user/kib/vm6/lib/libelf/elf_rand.3
  user/kib/vm6/lib/libelf/elf_rawfile.3
  user/kib/vm6/lib/libelf/elf_strptr.3
  user/kib/vm6/lib/libelf/elf_update.3
  user/kib/vm6/lib/libelf/elf_version.3
  user/kib/vm6/lib/libelf/gelf.3
  user/kib/vm6/lib/libelf/gelf_checksum.3
  user/kib/vm6/lib/libelf/gelf_fsize.3
  user/kib/vm6/lib/libelf/gelf_getcap.3
  user/kib/vm6/lib/libelf/gelf_getclass.3
  user/kib/vm6/lib/libelf/gelf_getdyn.3
  user/kib/vm6/lib/libelf/gelf_getehdr.3
  user/kib/vm6/lib/libelf/gelf_getmove.3
  user/kib/vm6/lib/libelf/gelf_getphdr.3
  user/kib/vm6/lib/libelf/gelf_getrel.3
  user/kib/vm6/lib/libelf/gelf_getrela.3
  user/kib/vm6/lib/libelf/gelf_getshdr.3
  user/kib/vm6/lib/libelf/gelf_getsym.3
  user/kib/vm6/lib/libelf/gelf_getsyminfo.3
  user/kib/vm6/lib/libelf/gelf_getsymshndx.3
  user/kib/vm6/lib/libelf/gelf_newehdr.3
  user/kib/vm6/lib/libelf/gelf_newphdr.3
  user/kib/vm6/lib/libelf/gelf_update_ehdr.3
  user/kib/vm6/lib/libelf/gelf_xlatetof.3
  user/kib/vm6/lib/libgssapi/gss_accept_sec_context.3
  user/kib/vm6/lib/libgssapi/gss_acquire_cred.3
  user/kib/vm6/lib/libgssapi/gss_add_cred.3
  user/kib/vm6/lib/libgssapi/gss_add_oid_set_member.3
  user/kib/vm6/lib/libgssapi/gss_canonicalize_name.3
  user/kib/vm6/lib/libgssapi/gss_compare_name.3
  user/kib/vm6/lib/libgssapi/gss_context_time.3
  user/kib/vm6/lib/libgssapi/gss_create_empty_oid_set.3
  user/kib/vm6/lib/libgssapi/gss_delete_sec_context.3
  user/kib/vm6/lib/libgssapi/gss_display_name.3
  user/kib/vm6/lib/libgssapi/gss_display_status.3
  user/kib/vm6/lib/libgssapi/gss_duplicate_name.3
  user/kib/vm6/lib/libgssapi/gss_export_name.3
  user/kib/vm6/lib/libgssapi/gss_export_sec_context.3
  user/kib/vm6/lib/libgssapi/gss_get_mic.3
  user/kib/vm6/lib/libgssapi/gss_import_name.3
  user/kib/vm6/lib/libgssapi/gss_import_sec_context.3
  user/kib/vm6/lib/libgssapi/gss_indicate_mechs.3
  user/kib/vm6/lib/libgssapi/gss_init_sec_context.3
  user/kib/vm6/lib/libgssapi/gss_inquire_context.3
  user/kib/vm6/lib/libgssapi/gss_inquire_cred.3
  user/kib/vm6/lib/libgssapi/gss_inquire_cred_by_mech.3
  user/kib/vm6/lib/libgssapi/gss_inquire_mechs_for_name.3
  user/kib/vm6/lib/libgssapi/gss_inquire_names_for_mech.3
  user/kib/vm6/lib/libgssapi/gss_process_context_token.3
  user/kib/vm6/lib/libgssapi/gss_release_buffer.3
  user/kib/vm6/lib/libgssapi/gss_release_cred.3
  user/kib/vm6/lib/libgssapi/gss_release_name.3
  user/kib/vm6/lib/libgssapi/gss_release_oid_set.3
  user/kib/vm6/lib/libgssapi/gss_test_oid_set_member.3
  user/kib/vm6/lib/libgssapi/gss_unwrap.3
  user/kib/vm6/lib/libgssapi/gss_verify_mic.3
  user/kib/vm6/lib/libgssapi/gss_wrap.3
  user/kib/vm6/lib/libgssapi/gss_wrap_size_limit.3
  user/kib/vm6/lib/libmemstat/libmemstat.3
  user/kib/vm6/lib/libpmc/Makefile
  user/kib/vm6/lib/libpmc/libpmc.c
  user/kib/vm6/lib/libpmc/pmc.3
  user/kib/vm6/lib/libpmc/pmc.atom.3
  user/kib/vm6/lib/libpmc/pmc.core.3
  user/kib/vm6/lib/libpmc/pmc.core2.3
  user/kib/vm6/lib/libpmc/pmc.iaf.3
  user/kib/vm6/lib/libpmc/pmc.k7.3
  user/kib/vm6/lib/libpmc/pmc.k8.3
  user/kib/vm6/lib/libpmc/pmc.p4.3
  user/kib/vm6/lib/libpmc/pmc.p5.3
  user/kib/vm6/lib/libpmc/pmc.p6.3
  user/kib/vm6/lib/libpmc/pmc.tsc.3
  user/kib/vm6/lib/libpmc/pmc_allocate.3
  user/kib/vm6/lib/libpmc/pmc_attach.3
  user/kib/vm6/lib/libpmc/pmc_capabilities.3
  user/kib/vm6/lib/libpmc/pmc_configure_logfile.3
  user/kib/vm6/lib/libpmc/pmc_disable.3
  user/kib/vm6/lib/libpmc/pmc_event_names_of_class.3
  user/kib/vm6/lib/libpmc/pmc_get_driver_stats.3
  user/kib/vm6/lib/libpmc/pmc_get_msr.3
  user/kib/vm6/lib/libpmc/pmc_init.3
  user/kib/vm6/lib/libpmc/pmc_name_of_capability.3
  user/kib/vm6/lib/libpmc/pmc_read.3
  user/kib/vm6/lib/libpmc/pmc_set.3
  user/kib/vm6/lib/libpmc/pmc_start.3
  user/kib/vm6/lib/libpmc/pmclog.3
  user/kib/vm6/lib/libstand/assert.c
  user/kib/vm6/lib/libthr/libthr.3
  user/kib/vm6/lib/libugidfw/bsde_get_rule.3
  user/kib/vm6/lib/libugidfw/bsde_get_rule_count.3
  user/kib/vm6/lib/libugidfw/bsde_parse_rule.3
  user/kib/vm6/lib/libugidfw/bsde_rule_to_string.3
  user/kib/vm6/lib/libugidfw/libugidfw.3
  user/kib/vm6/lib/libulog/ulog_login.3
  user/kib/vm6/lib/libulog/utempter_add_record.3
  user/kib/vm6/lib/libutil/_secure_path.3
  user/kib/vm6/lib/libutil/auth.3
  user/kib/vm6/lib/libutil/hexdump.3
  user/kib/vm6/lib/libutil/kinfo_getfile.3
  user/kib/vm6/lib/libutil/kinfo_getvmmap.3
  user/kib/vm6/lib/libutil/kld.3
  user/kib/vm6/lib/libutil/login_auth.3
  user/kib/vm6/lib/libutil/login_cap.3
  user/kib/vm6/lib/libutil/login_class.3
  user/kib/vm6/lib/libutil/login_ok.3
  user/kib/vm6/lib/libutil/login_times.3
  user/kib/vm6/lib/libutil/login_tty.3
  user/kib/vm6/lib/libutil/property.3
  user/kib/vm6/lib/libutil/pty.3
  user/kib/vm6/lib/libutil/realhostname.3
  user/kib/vm6/lib/libutil/realhostname_sa.3
  user/kib/vm6/lib/libutil/trimdomain.3
  user/kib/vm6/lib/libutil/uucplock.3
  user/kib/vm6/lib/libz/ChangeLog
  user/kib/vm6/lib/libz/README
  user/kib/vm6/lib/libz/Symbol.map
  user/kib/vm6/lib/libz/crc32.c
  user/kib/vm6/lib/libz/deflate.c
  user/kib/vm6/lib/libz/gzguts.h   (contents, props changed)
  user/kib/vm6/lib/libz/gzlib.c
  user/kib/vm6/lib/libz/gzread.c
  user/kib/vm6/lib/libz/inftrees.c
  user/kib/vm6/lib/libz/minigzip.c
  user/kib/vm6/lib/libz/zconf.h
  user/kib/vm6/lib/libz/zlib.3
  user/kib/vm6/lib/libz/zlib.h
  user/kib/vm6/lib/libz/zutil.c
  user/kib/vm6/lib/libz/zutil.h
  user/kib/vm6/libexec/fingerd/fingerd.8
  user/kib/vm6/libexec/fingerd/fingerd.c
  user/kib/vm6/release/Makefile
  user/kib/vm6/release/Makefile.inc.docports
  user/kib/vm6/sbin/geom/class/Makefile
  user/kib/vm6/sbin/geom/class/multipath/geom_multipath.c
  user/kib/vm6/sbin/geom/misc/subr.c
  user/kib/vm6/sbin/hastd/hastd.c
  user/kib/vm6/sbin/hastd/pjdlog.c
  user/kib/vm6/sbin/hastd/primary.c
  user/kib/vm6/sbin/ifconfig/ifconfig.c
  user/kib/vm6/sbin/ipfw/dummynet.c
  user/kib/vm6/sbin/ipfw/ipfw2.c
  user/kib/vm6/sbin/ipfw/ipfw2.h
  user/kib/vm6/sbin/ipfw/main.c
  user/kib/vm6/sbin/iscontrol/iscsi.conf.5
  user/kib/vm6/sbin/mca/mca.c
  user/kib/vm6/sbin/spppcontrol/spppcontrol.8
  user/kib/vm6/secure/lib/libcrypto/Makefile.inc
  user/kib/vm6/secure/lib/libcrypto/man/ASN1_OBJECT_new.3
  user/kib/vm6/secure/lib/libcrypto/man/ASN1_STRING_length.3
  user/kib/vm6/secure/lib/libcrypto/man/ASN1_STRING_new.3
  user/kib/vm6/secure/lib/libcrypto/man/ASN1_STRING_print_ex.3
  user/kib/vm6/secure/lib/libcrypto/man/ASN1_generate_nconf.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_ctrl.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_base64.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_buffer.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_cipher.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_md.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_null.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_f_ssl.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_find_type.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_new.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_push.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_read.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_accept.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_bio.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_connect.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_fd.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_file.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_mem.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_null.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_s_socket.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_set_callback.3
  user/kib/vm6/secure/lib/libcrypto/man/BIO_should_retry.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_BLINDING_new.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_CTX_new.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_CTX_start.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_add.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_add_word.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_bn2bin.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_cmp.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_copy.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_generate_prime.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_mod_inverse.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_mod_mul_montgomery.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_mod_mul_reciprocal.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_new.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_num_bytes.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_rand.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_set_bit.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_swap.3
  user/kib/vm6/secure/lib/libcrypto/man/BN_zero.3
  user/kib/vm6/secure/lib/libcrypto/man/CONF_modules_free.3
  user/kib/vm6/secure/lib/libcrypto/man/CONF_modules_load_file.3
  user/kib/vm6/secure/lib/libcrypto/man/CRYPTO_set_ex_data.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_generate_key.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_generate_parameters.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_get_ex_new_index.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_new.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_set_method.3
  user/kib/vm6/secure/lib/libcrypto/man/DH_size.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_SIG_new.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_do_sign.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_dup_DH.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_generate_key.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_generate_parameters.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_get_ex_new_index.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_new.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_set_method.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_sign.3
  user/kib/vm6/secure/lib/libcrypto/man/DSA_size.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_GET_LIB.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_clear_error.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_error_string.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_get_error.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_load_crypto_strings.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_load_strings.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_print_errors.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_put_error.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_remove_state.3
  user/kib/vm6/secure/lib/libcrypto/man/ERR_set_mark.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_BytesToKey.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_DigestInit.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_EncryptInit.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_OpenInit.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_PKEY_new.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_PKEY_set1_RSA.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_SealInit.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_SignInit.3
  user/kib/vm6/secure/lib/libcrypto/man/EVP_VerifyInit.3
  user/kib/vm6/secure/lib/libcrypto/man/OBJ_nid2obj.3
  user/kib/vm6/secure/lib/libcrypto/man/OPENSSL_Applink.3
  user/kib/vm6/secure/lib/libcrypto/man/OPENSSL_VERSION_NUMBER.3
  user/kib/vm6/secure/lib/libcrypto/man/OPENSSL_config.3
  user/kib/vm6/secure/lib/libcrypto/man/OPENSSL_ia32cap.3
  user/kib/vm6/secure/lib/libcrypto/man/OPENSSL_load_builtin_modules.3
  user/kib/vm6/secure/lib/libcrypto/man/OpenSSL_add_all_algorithms.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS12_create.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS12_parse.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS7_decrypt.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS7_encrypt.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS7_sign.3
  user/kib/vm6/secure/lib/libcrypto/man/PKCS7_verify.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_add.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_bytes.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_cleanup.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_egd.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_load_file.3
  user/kib/vm6/secure/lib/libcrypto/man/RAND_set_rand_method.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_blinding_on.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_check_key.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_generate_key.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_get_ex_new_index.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_new.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_padding_add_PKCS1_type_1.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_print.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_private_encrypt.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_public_encrypt.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_set_method.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_sign.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_sign_ASN1_OCTET_STRING.3
  user/kib/vm6/secure/lib/libcrypto/man/RSA_size.3
  user/kib/vm6/secure/lib/libcrypto/man/SMIME_read_PKCS7.3
  user/kib/vm6/secure/lib/libcrypto/man/SMIME_write_PKCS7.3
  user/kib/vm6/secure/lib/libcrypto/man/X509_NAME_ENTRY_get_object.3
  user/kib/vm6/secure/lib/libcrypto/man/X509_NAME_add_entry_by_txt.3
  user/kib/vm6/secure/lib/libcrypto/man/X509_NAME_get_index_by_NID.3
  user/kib/vm6/secure/lib/libcrypto/man/X509_NAME_print_ex.3
  user/kib/vm6/secure/lib/libcrypto/man/X509_new.3
  user/kib/vm6/secure/lib/libcrypto/man/bio.3
  user/kib/vm6/secure/lib/libcrypto/man/blowfish.3
  user/kib/vm6/secure/lib/libcrypto/man/bn.3
  user/kib/vm6/secure/lib/libcrypto/man/bn_internal.3
  user/kib/vm6/secure/lib/libcrypto/man/buffer.3
  user/kib/vm6/secure/lib/libcrypto/man/crypto.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_ASN1_OBJECT.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_DHparams.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_DSAPublicKey.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_PKCS8PrivateKey.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_RSAPublicKey.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509_ALGOR.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509_CRL.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509_NAME.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509_REQ.3
  user/kib/vm6/secure/lib/libcrypto/man/d2i_X509_SIG.3
  user/kib/vm6/secure/lib/libcrypto/man/des.3
  user/kib/vm6/secure/lib/libcrypto/man/dh.3
  user/kib/vm6/secure/lib/libcrypto/man/dsa.3
  user/kib/vm6/secure/lib/libcrypto/man/ecdsa.3
  user/kib/vm6/secure/lib/libcrypto/man/engine.3
  user/kib/vm6/secure/lib/libcrypto/man/err.3
  user/kib/vm6/secure/lib/libcrypto/man/evp.3
  user/kib/vm6/secure/lib/libcrypto/man/hmac.3
  user/kib/vm6/secure/lib/libcrypto/man/lh_stats.3
  user/kib/vm6/secure/lib/libcrypto/man/lhash.3
  user/kib/vm6/secure/lib/libcrypto/man/md5.3
  user/kib/vm6/secure/lib/libcrypto/man/mdc2.3
  user/kib/vm6/secure/lib/libcrypto/man/pem.3
  user/kib/vm6/secure/lib/libcrypto/man/rand.3
  user/kib/vm6/secure/lib/libcrypto/man/rc4.3
  user/kib/vm6/secure/lib/libcrypto/man/ripemd.3
  user/kib/vm6/secure/lib/libcrypto/man/rsa.3
  user/kib/vm6/secure/lib/libcrypto/man/sha.3
  user/kib/vm6/secure/lib/libcrypto/man/threads.3
  user/kib/vm6/secure/lib/libcrypto/man/ui.3
  user/kib/vm6/secure/lib/libcrypto/man/ui_compat.3
  user/kib/vm6/secure/lib/libcrypto/man/x509.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CIPHER_get_name.3
  user/kib/vm6/secure/lib/libssl/man/SSL_COMP_add_compression_method.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_add_extra_chain_cert.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_add_session.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_ctrl.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_flush_sessions.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_free.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_get_ex_new_index.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_get_verify_mode.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_load_verify_locations.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_new.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_sess_number.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_sess_set_cache_size.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_sess_set_get_cb.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_sessions.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_cert_store.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_cert_verify_callback.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_cipher_list.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_client_CA_list.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_client_cert_cb.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_default_passwd_cb.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_generate_session_id.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_info_callback.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_max_cert_list.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_mode.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_msg_callback.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_options.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_quiet_shutdown.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_session_cache_mode.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_session_id_context.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_ssl_version.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_timeout.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_tmp_dh_callback.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_tmp_rsa_callback.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_set_verify.3
  user/kib/vm6/secure/lib/libssl/man/SSL_CTX_use_certificate.3
  user/kib/vm6/secure/lib/libssl/man/SSL_SESSION_free.3
  user/kib/vm6/secure/lib/libssl/man/SSL_SESSION_get_ex_new_index.3
  user/kib/vm6/secure/lib/libssl/man/SSL_SESSION_get_time.3
  user/kib/vm6/secure/lib/libssl/man/SSL_accept.3
  user/kib/vm6/secure/lib/libssl/man/SSL_alert_type_string.3
  user/kib/vm6/secure/lib/libssl/man/SSL_clear.3
  user/kib/vm6/secure/lib/libssl/man/SSL_connect.3
  user/kib/vm6/secure/lib/libssl/man/SSL_do_handshake.3
  user/kib/vm6/secure/lib/libssl/man/SSL_free.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_SSL_CTX.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_ciphers.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_client_CA_list.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_current_cipher.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_default_timeout.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_error.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_ex_data_X509_STORE_CTX_idx.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_ex_new_index.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_fd.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_peer_cert_chain.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_peer_certificate.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_rbio.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_session.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_verify_result.3
  user/kib/vm6/secure/lib/libssl/man/SSL_get_version.3
  user/kib/vm6/secure/lib/libssl/man/SSL_library_init.3
  user/kib/vm6/secure/lib/libssl/man/SSL_load_client_CA_file.3
  user/kib/vm6/secure/lib/libssl/man/SSL_new.3
  user/kib/vm6/secure/lib/libssl/man/SSL_pending.3
  user/kib/vm6/secure/lib/libssl/man/SSL_read.3
  user/kib/vm6/secure/lib/libssl/man/SSL_rstate_string.3
  user/kib/vm6/secure/lib/libssl/man/SSL_session_reused.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_bio.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_connect_state.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_fd.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_session.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_shutdown.3
  user/kib/vm6/secure/lib/libssl/man/SSL_set_verify_result.3
  user/kib/vm6/secure/lib/libssl/man/SSL_shutdown.3
  user/kib/vm6/secure/lib/libssl/man/SSL_state_string.3
  user/kib/vm6/secure/lib/libssl/man/SSL_want.3
  user/kib/vm6/secure/lib/libssl/man/SSL_write.3
  user/kib/vm6/secure/lib/libssl/man/d2i_SSL_SESSION.3
  user/kib/vm6/secure/lib/libssl/man/ssl.3
  user/kib/vm6/secure/usr.bin/openssl/man/CA.pl.1
  user/kib/vm6/secure/usr.bin/openssl/man/asn1parse.1
  user/kib/vm6/secure/usr.bin/openssl/man/ca.1
  user/kib/vm6/secure/usr.bin/openssl/man/ciphers.1
  user/kib/vm6/secure/usr.bin/openssl/man/crl.1
  user/kib/vm6/secure/usr.bin/openssl/man/crl2pkcs7.1
  user/kib/vm6/secure/usr.bin/openssl/man/dgst.1
  user/kib/vm6/secure/usr.bin/openssl/man/dhparam.1
  user/kib/vm6/secure/usr.bin/openssl/man/dsa.1
  user/kib/vm6/secure/usr.bin/openssl/man/dsaparam.1
  user/kib/vm6/secure/usr.bin/openssl/man/ec.1
  user/kib/vm6/secure/usr.bin/openssl/man/ecparam.1
  user/kib/vm6/secure/usr.bin/openssl/man/enc.1
  user/kib/vm6/secure/usr.bin/openssl/man/errstr.1
  user/kib/vm6/secure/usr.bin/openssl/man/gendsa.1
  user/kib/vm6/secure/usr.bin/openssl/man/genrsa.1
  user/kib/vm6/secure/usr.bin/openssl/man/nseq.1
  user/kib/vm6/secure/usr.bin/openssl/man/ocsp.1
  user/kib/vm6/secure/usr.bin/openssl/man/openssl.1
  user/kib/vm6/secure/usr.bin/openssl/man/passwd.1
  user/kib/vm6/secure/usr.bin/openssl/man/pkcs12.1
  user/kib/vm6/secure/usr.bin/openssl/man/pkcs7.1
  user/kib/vm6/secure/usr.bin/openssl/man/pkcs8.1
  user/kib/vm6/secure/usr.bin/openssl/man/rand.1
  user/kib/vm6/secure/usr.bin/openssl/man/req.1
  user/kib/vm6/secure/usr.bin/openssl/man/rsa.1
  user/kib/vm6/secure/usr.bin/openssl/man/rsautl.1
  user/kib/vm6/secure/usr.bin/openssl/man/s_client.1
  user/kib/vm6/secure/usr.bin/openssl/man/s_server.1
  user/kib/vm6/secure/usr.bin/openssl/man/s_time.1
  user/kib/vm6/secure/usr.bin/openssl/man/sess_id.1
  user/kib/vm6/secure/usr.bin/openssl/man/smime.1
  user/kib/vm6/secure/usr.bin/openssl/man/speed.1
  user/kib/vm6/secure/usr.bin/openssl/man/spkac.1
  user/kib/vm6/secure/usr.bin/openssl/man/verify.1
  user/kib/vm6/secure/usr.bin/openssl/man/version.1
  user/kib/vm6/secure/usr.bin/openssl/man/x509.1
  user/kib/vm6/secure/usr.bin/openssl/man/x509v3_config.1
  user/kib/vm6/share/man/man3/sysexits.3
  user/kib/vm6/share/man/man3/tgmath.3
  user/kib/vm6/share/man/man4/Makefile
  user/kib/vm6/share/man/man4/altq.4
  user/kib/vm6/share/man/man4/audit.4
  user/kib/vm6/share/man/man4/auditpipe.4
  user/kib/vm6/share/man/man4/coda.4
  user/kib/vm6/share/man/man4/gbde.4
  user/kib/vm6/share/man/man4/geom.4
  user/kib/vm6/share/man/man4/geom_fox.4
  user/kib/vm6/share/man/man4/geom_linux_lvm.4
  user/kib/vm6/share/man/man4/geom_uzip.4
  user/kib/vm6/share/man/man4/ipw.4
  user/kib/vm6/share/man/man4/iscsi_initiator.4
  user/kib/vm6/share/man/man4/iwi.4
  user/kib/vm6/share/man/man4/iwn.4
  user/kib/vm6/share/man/man4/kbdmux.4
  user/kib/vm6/share/man/man4/ktr.4
  user/kib/vm6/share/man/man4/lp.4
  user/kib/vm6/share/man/man4/mac.4
  user/kib/vm6/share/man/man4/mac_biba.4
  user/kib/vm6/share/man/man4/mac_bsdextended.4
  user/kib/vm6/share/man/man4/mac_ifoff.4
  user/kib/vm6/share/man/man4/mac_lomac.4
  user/kib/vm6/share/man/man4/mac_mls.4
  user/kib/vm6/share/man/man4/mac_none.4
  user/kib/vm6/share/man/man4/mac_partition.4
  user/kib/vm6/share/man/man4/mac_seeotheruids.4
  user/kib/vm6/share/man/man4/mac_stub.4
  user/kib/vm6/share/man/man4/mac_test.4
  user/kib/vm6/share/man/man4/miibus.4
  user/kib/vm6/share/man/man4/netintro.4
  user/kib/vm6/share/man/man4/ng_netflow.4
  user/kib/vm6/share/man/man4/orm.4
  user/kib/vm6/share/man/man4/ral.4
  user/kib/vm6/share/man/man4/rp.4
  user/kib/vm6/share/man/man4/rum.4
  user/kib/vm6/share/man/man4/run.4
  user/kib/vm6/share/man/man4/sched_4bsd.4
  user/kib/vm6/share/man/man4/sched_ule.4
  user/kib/vm6/share/man/man4/si.4
  user/kib/vm6/share/man/man4/splash.4
  user/kib/vm6/share/man/man4/tap.4
  user/kib/vm6/share/man/man4/uhso.4
  user/kib/vm6/share/man/man4/upgt.4
  user/kib/vm6/share/man/man4/ural.4
  user/kib/vm6/share/man/man4/vkbd.4
  user/kib/vm6/share/man/man4/vlan.4
  user/kib/vm6/share/man/man4/wpi.4
  user/kib/vm6/share/man/man5/ar.5
  user/kib/vm6/share/man/man5/nsswitch.conf.5
  user/kib/vm6/share/man/man5/rc.conf.5
  user/kib/vm6/share/man/man5/services.5
  user/kib/vm6/share/man/man7/build.7
  user/kib/vm6/share/man/man7/clocks.7
  user/kib/vm6/share/man/man7/maclabel.7
  user/kib/vm6/share/man/man8/picobsd.8
  user/kib/vm6/share/man/man8/rescue.8
  user/kib/vm6/share/man/man9/CTASSERT.9
  user/kib/vm6/share/man/man9/DELAY.9
  user/kib/vm6/share/man/man9/KASSERT.9
  user/kib/vm6/share/man/man9/VFS.9
  user/kib/vm6/share/man/man9/VFS_CHECKEXP.9
  user/kib/vm6/share/man/man9/VFS_FHTOVP.9
  user/kib/vm6/share/man/man9/VFS_MOUNT.9
  user/kib/vm6/share/man/man9/VFS_QUOTACTL.9
  user/kib/vm6/share/man/man9/VFS_ROOT.9
  user/kib/vm6/share/man/man9/VFS_STATFS.9
  user/kib/vm6/share/man/man9/VFS_SYNC.9
  user/kib/vm6/share/man/man9/VFS_UNMOUNT.9
  user/kib/vm6/share/man/man9/VFS_VGET.9
  user/kib/vm6/share/man/man9/VOP_ACCESS.9
  user/kib/vm6/share/man/man9/VOP_ACLCHECK.9
  user/kib/vm6/share/man/man9/VOP_ADVLOCK.9
  user/kib/vm6/share/man/man9/VOP_ATTRIB.9
  user/kib/vm6/share/man/man9/VOP_BWRITE.9
  user/kib/vm6/share/man/man9/VOP_CREATE.9
  user/kib/vm6/share/man/man9/VOP_FSYNC.9
  user/kib/vm6/share/man/man9/VOP_GETACL.9
  user/kib/vm6/share/man/man9/VOP_GETEXTATTR.9
  user/kib/vm6/share/man/man9/VOP_GETPAGES.9
  user/kib/vm6/share/man/man9/VOP_GETVOBJECT.9
  user/kib/vm6/share/man/man9/VOP_INACTIVE.9
  user/kib/vm6/share/man/man9/VOP_IOCTL.9
  user/kib/vm6/share/man/man9/VOP_LINK.9
  user/kib/vm6/share/man/man9/VOP_LISTEXTATTR.9
  user/kib/vm6/share/man/man9/VOP_LOCK.9
  user/kib/vm6/share/man/man9/VOP_LOOKUP.9
  user/kib/vm6/share/man/man9/VOP_OPENCLOSE.9
  user/kib/vm6/share/man/man9/VOP_PATHCONF.9
  user/kib/vm6/share/man/man9/VOP_PRINT.9
  user/kib/vm6/share/man/man9/VOP_RDWR.9
  user/kib/vm6/share/man/man9/VOP_READDIR.9
  user/kib/vm6/share/man/man9/VOP_READLINK.9
  user/kib/vm6/share/man/man9/VOP_REALLOCBLKS.9
  user/kib/vm6/share/man/man9/VOP_REMOVE.9
  user/kib/vm6/share/man/man9/VOP_RENAME.9
  user/kib/vm6/share/man/man9/VOP_REVOKE.9
  user/kib/vm6/share/man/man9/VOP_SETACL.9
  user/kib/vm6/share/man/man9/VOP_SETEXTATTR.9
  user/kib/vm6/share/man/man9/VOP_STRATEGY.9
  user/kib/vm6/share/man/man9/VOP_VPTOCNP.9
  user/kib/vm6/share/man/man9/VOP_VPTOFH.9
  user/kib/vm6/share/man/man9/accept_filter.9
  user/kib/vm6/share/man/man9/accf_data.9
  user/kib/vm6/share/man/man9/accf_dns.9
  user/kib/vm6/share/man/man9/accf_http.9
  user/kib/vm6/share/man/man9/acl.9
  user/kib/vm6/share/man/man9/atomic.9
  user/kib/vm6/share/man/man9/cr_cansee.9
  user/kib/vm6/share/man/man9/cr_seeothergids.9
  user/kib/vm6/share/man/man9/cr_seeotheruids.9
  user/kib/vm6/share/man/man9/devfs_set_cdevpriv.9
  user/kib/vm6/share/man/man9/devtoname.9
  user/kib/vm6/share/man/man9/extattr.9
  user/kib/vm6/share/man/man9/firmware.9
  user/kib/vm6/share/man/man9/hexdump.9
  user/kib/vm6/share/man/man9/ieee80211.9
  user/kib/vm6/share/man/man9/ieee80211_crypto.9
  user/kib/vm6/share/man/man9/ieee80211_node.9
  user/kib/vm6/share/man/man9/ieee80211_output.9
  user/kib/vm6/share/man/man9/ieee80211_scan.9
  user/kib/vm6/share/man/man9/ifnet.9
  user/kib/vm6/share/man/man9/make_dev.9
  user/kib/vm6/share/man/man9/namei.9
  user/kib/vm6/share/man/man9/p_candebug.9
  user/kib/vm6/share/man/man9/p_cansee.9
  user/kib/vm6/share/man/man9/pfind.9
  user/kib/vm6/share/man/man9/pgfind.9
  user/kib/vm6/share/man/man9/prison_check.9
  user/kib/vm6/share/man/man9/random.9
  user/kib/vm6/share/man/man9/rijndael.9
  user/kib/vm6/share/man/man9/rtalloc.9
  user/kib/vm6/share/man/man9/rtentry.9
  user/kib/vm6/share/man/man9/sleep.9
  user/kib/vm6/share/man/man9/spl.9
  user/kib/vm6/share/man/man9/stack.9
  user/kib/vm6/share/man/man9/uio.9
  user/kib/vm6/share/man/man9/usbdi.9
  user/kib/vm6/share/man/man9/vaccess.9
  user/kib/vm6/share/man/man9/vaccess_acl_nfs4.9
  user/kib/vm6/share/man/man9/vaccess_acl_posix1e.9
  user/kib/vm6/share/man/man9/vcount.9
  user/kib/vm6/share/man/man9/vget.9
  user/kib/vm6/share/man/man9/vm_map_entry_resize_free.9
  user/kib/vm6/share/man/man9/vnode.9
  user/kib/vm6/share/man/man9/vput.9
  user/kib/vm6/share/man/man9/vref.9
  user/kib/vm6/share/man/man9/vrefcnt.9
  user/kib/vm6/share/man/man9/vrele.9
  user/kib/vm6/share/misc/committers-ports.dot
  user/kib/vm6/share/mk/bsd.lib.mk
  user/kib/vm6/share/mk/bsd.port.mk
  user/kib/vm6/share/mk/bsd.prog.mk
  user/kib/vm6/share/mk/sys.mk
  user/kib/vm6/sys/amd64/amd64/apic_vector.S
  user/kib/vm6/sys/amd64/amd64/exception.S
  user/kib/vm6/sys/amd64/amd64/local_apic.c
  user/kib/vm6/sys/amd64/amd64/machdep.c
  user/kib/vm6/sys/amd64/amd64/pmap.c
  user/kib/vm6/sys/amd64/amd64/trap.c
  user/kib/vm6/sys/amd64/conf/GENERIC
  user/kib/vm6/sys/amd64/ia32/ia32_signal.c
  user/kib/vm6/sys/amd64/include/apicvar.h
  user/kib/vm6/sys/amd64/include/md_var.h
  user/kib/vm6/sys/amd64/include/pmc_mdep.h
  user/kib/vm6/sys/amd64/include/reg.h
  user/kib/vm6/sys/amd64/linux32/linux.h
  user/kib/vm6/sys/arm/conf/KB920X
  user/kib/vm6/sys/arm/include/bus.h
  user/kib/vm6/sys/arm/mv/mv_sata.c
  user/kib/vm6/sys/boot/forth/loader.conf
  user/kib/vm6/sys/cam/cam_xpt.c
  user/kib/vm6/sys/cam/scsi/scsi_all.h
  user/kib/vm6/sys/cam/scsi/scsi_cd.c
  user/kib/vm6/sys/cam/scsi/scsi_da.c
  user/kib/vm6/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
  user/kib/vm6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  user/kib/vm6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h
  user/kib/vm6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  user/kib/vm6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  user/kib/vm6/sys/compat/freebsd32/freebsd32.h
  user/kib/vm6/sys/compat/freebsd32/freebsd32_misc.c
  user/kib/vm6/sys/compat/ia32/ia32_signal.h
  user/kib/vm6/sys/compat/linprocfs/linprocfs.c
  user/kib/vm6/sys/compat/linux/linux_stats.c
  user/kib/vm6/sys/compat/svr4/svr4_stat.c
  user/kib/vm6/sys/conf/NOTES
  user/kib/vm6/sys/conf/files
  user/kib/vm6/sys/conf/files.amd64
  user/kib/vm6/sys/conf/files.i386
  user/kib/vm6/sys/conf/files.mips
  user/kib/vm6/sys/conf/files.pc98
  user/kib/vm6/sys/conf/files.sparc64
  user/kib/vm6/sys/conf/kern.mk
  user/kib/vm6/sys/conf/kern.post.mk
  user/kib/vm6/sys/conf/kern.pre.mk
  user/kib/vm6/sys/conf/kmod.mk
  user/kib/vm6/sys/contrib/dev/acpica/changes.txt
  user/kib/vm6/sys/contrib/dev/acpica/common/dmextern.c
  user/kib/vm6/sys/contrib/dev/acpica/compiler/aslanalyze.c
  user/kib/vm6/sys/contrib/dev/acpica/compiler/aslcompiler.h
  user/kib/vm6/sys/contrib/dev/acpica/compiler/aslpredef.c
  user/kib/vm6/sys/contrib/dev/acpica/compiler/aslstubs.c
  user/kib/vm6/sys/contrib/dev/acpica/compiler/asltypes.h
  user/kib/vm6/sys/contrib/dev/acpica/debugger/dbdisply.c
  user/kib/vm6/sys/contrib/dev/acpica/events/evgpe.c
  user/kib/vm6/sys/contrib/dev/acpica/events/evgpeblk.c
  user/kib/vm6/sys/contrib/dev/acpica/events/evxface.c
  user/kib/vm6/sys/contrib/dev/acpica/events/evxfevnt.c
  user/kib/vm6/sys/contrib/dev/acpica/executer/exdebug.c
  user/kib/vm6/sys/contrib/dev/acpica/executer/exmutex.c
  user/kib/vm6/sys/contrib/dev/acpica/executer/exoparg2.c
  user/kib/vm6/sys/contrib/dev/acpica/executer/exregion.c
  user/kib/vm6/sys/contrib/dev/acpica/include/acevents.h
  user/kib/vm6/sys/contrib/dev/acpica/include/acexcep.h
  user/kib/vm6/sys/contrib/dev/acpica/include/acglobal.h
  user/kib/vm6/sys/contrib/dev/acpica/include/aclocal.h
  user/kib/vm6/sys/contrib/dev/acpica/include/acpixf.h
  user/kib/vm6/sys/contrib/dev/acpica/include/actables.h
  user/kib/vm6/sys/contrib/dev/acpica/include/actypes.h
  user/kib/vm6/sys/contrib/dev/acpica/include/platform/acfreebsd.h
  user/kib/vm6/sys/contrib/dev/acpica/parser/psxface.c
  user/kib/vm6/sys/contrib/dev/acpica/tables/tbutils.c
  user/kib/vm6/sys/contrib/dev/acpica/tables/tbxface.c
  user/kib/vm6/sys/contrib/dev/acpica/utilities/utglobal.c
  user/kib/vm6/sys/contrib/dev/iwn/LICENSE
  user/kib/vm6/sys/contrib/ipfilter/netinet/ip_compat.h
  user/kib/vm6/sys/ddb/db_sym.c
  user/kib/vm6/sys/dev/aac/aac.c
  user/kib/vm6/sys/dev/aac/aac_cam.c
  user/kib/vm6/sys/dev/aac/aac_debug.c
  user/kib/vm6/sys/dev/aac/aac_disk.c
  user/kib/vm6/sys/dev/aac/aac_pci.c
  user/kib/vm6/sys/dev/aac/aac_tables.h
  user/kib/vm6/sys/dev/aac/aacreg.h
  user/kib/vm6/sys/dev/aac/aacvar.h
  user/kib/vm6/sys/dev/acpica/acpi.c
  user/kib/vm6/sys/dev/acpica/acpi_button.c
  user/kib/vm6/sys/dev/acpica/acpi_ec.c
  user/kib/vm6/sys/dev/acpica/acpi_lid.c
  user/kib/vm6/sys/dev/acpica/acpivar.h
  user/kib/vm6/sys/dev/ata/ata-all.h
  user/kib/vm6/sys/dev/ata/chipsets/ata-acerlabs.c
  user/kib/vm6/sys/dev/ath/ath_hal/ar5416/ar9285_attach.c
  user/kib/vm6/sys/dev/ath/if_ath.c
  user/kib/vm6/sys/dev/bce/if_bce.c
  user/kib/vm6/sys/dev/bce/if_bcereg.h
  user/kib/vm6/sys/dev/bktr/ioctl_bt848.h
  user/kib/vm6/sys/dev/bktr/ioctl_meteor.h
  user/kib/vm6/sys/dev/bwi/if_bwi.c
  user/kib/vm6/sys/dev/bwi/if_bwivar.h
  user/kib/vm6/sys/dev/bwn/if_bwn.c
  user/kib/vm6/sys/dev/bwn/if_bwnvar.h
  user/kib/vm6/sys/dev/cxgb/common/cxgb_ael1002.c
  user/kib/vm6/sys/dev/cxgb/common/cxgb_common.h
  user/kib/vm6/sys/dev/cxgb/common/cxgb_t3_hw.c
  user/kib/vm6/sys/dev/cxgb/cxgb_adapter.h
  user/kib/vm6/sys/dev/cxgb/cxgb_main.c
  user/kib/vm6/sys/dev/cxgb/cxgb_sge.c
  user/kib/vm6/sys/dev/e1000/e1000_80003es2lan.c
  user/kib/vm6/sys/dev/e1000/e1000_82571.c
  user/kib/vm6/sys/dev/e1000/e1000_82575.c
  user/kib/vm6/sys/dev/e1000/e1000_82575.h
  user/kib/vm6/sys/dev/e1000/e1000_defines.h
  user/kib/vm6/sys/dev/e1000/e1000_hw.h
  user/kib/vm6/sys/dev/e1000/e1000_ich8lan.c
  user/kib/vm6/sys/dev/e1000/e1000_ich8lan.h
  user/kib/vm6/sys/dev/e1000/e1000_mac.c
  user/kib/vm6/sys/dev/e1000/e1000_manage.c
  user/kib/vm6/sys/dev/e1000/e1000_phy.c
  user/kib/vm6/sys/dev/e1000/e1000_regs.h
  user/kib/vm6/sys/dev/e1000/if_em.c
  user/kib/vm6/sys/dev/e1000/if_em.h
  user/kib/vm6/sys/dev/e1000/if_igb.c
  user/kib/vm6/sys/dev/e1000/if_igb.h
  user/kib/vm6/sys/dev/fb/vesa.c
  user/kib/vm6/sys/dev/firewire/sbp.c
  user/kib/vm6/sys/dev/hwpmc/hwpmc_core.c
  user/kib/vm6/sys/dev/hwpmc/hwpmc_core.h
  user/kib/vm6/sys/dev/hwpmc/hwpmc_intel.c
  user/kib/vm6/sys/dev/hwpmc/hwpmc_mod.c
  user/kib/vm6/sys/dev/hwpmc/pmc_events.h
  user/kib/vm6/sys/dev/ipw/if_ipw.c
  user/kib/vm6/sys/dev/ipw/if_ipwvar.h
  user/kib/vm6/sys/dev/iwn/if_iwn.c
  user/kib/vm6/sys/dev/iwn/if_iwnreg.h
  user/kib/vm6/sys/dev/iwn/if_iwnvar.h
  user/kib/vm6/sys/dev/ixgbe/ixgbe.c
  user/kib/vm6/sys/dev/ixgbe/ixgbe.h
  user/kib/vm6/sys/dev/malo/if_malo.c
  user/kib/vm6/sys/dev/mii/miidevs
  user/kib/vm6/sys/dev/mii/truephy.c
  user/kib/vm6/sys/dev/mpt/mpt_cam.c
  user/kib/vm6/sys/dev/msk/if_msk.c
  user/kib/vm6/sys/dev/mxge/if_mxge.c
  user/kib/vm6/sys/dev/mxge/if_mxge_var.h
  user/kib/vm6/sys/dev/ofw/ofw_standard.c
  user/kib/vm6/sys/dev/ral/rt2560.c
  user/kib/vm6/sys/dev/ral/rt2560var.h
  user/kib/vm6/sys/dev/ral/rt2661.c
  user/kib/vm6/sys/dev/ral/rt2661var.h
  user/kib/vm6/sys/dev/re/if_re.c
  user/kib/vm6/sys/dev/siis/siis.c
  user/kib/vm6/sys/dev/sound/pci/envy24.c
  user/kib/vm6/sys/dev/sound/pci/envy24.h
  user/kib/vm6/sys/dev/sound/pci/envy24ht.c
  user/kib/vm6/sys/dev/sound/pci/envy24ht.h
  user/kib/vm6/sys/dev/sound/pci/es137x.c
  user/kib/vm6/sys/dev/sound/pci/spicds.c
  user/kib/vm6/sys/dev/sound/pci/spicds.h
  user/kib/vm6/sys/dev/syscons/logo/logo.c
  user/kib/vm6/sys/dev/syscons/logo/logo_saver.c
  user/kib/vm6/sys/dev/syscons/scvidctl.c
  user/kib/vm6/sys/dev/syscons/syscons.c
  user/kib/vm6/sys/dev/uart/uart.h
  user/kib/vm6/sys/dev/uart/uart_cpu_sparc64.c
  user/kib/vm6/sys/dev/ubsec/ubsec.c
  user/kib/vm6/sys/dev/usb/controller/ehci_pci.c
  user/kib/vm6/sys/dev/usb/controller/ohci_pci.c
  user/kib/vm6/sys/dev/usb/input/ukbd.c
  user/kib/vm6/sys/dev/usb/quirk/usb_quirk.c
  user/kib/vm6/sys/dev/usb/serial/u3g.c
  user/kib/vm6/sys/dev/usb/usb_compat_linux.c
  user/kib/vm6/sys/dev/usb/usbdevs
  user/kib/vm6/sys/dev/usb/wlan/if_rum.c
  user/kib/vm6/sys/dev/usb/wlan/if_rumvar.h
  user/kib/vm6/sys/dev/usb/wlan/if_run.c
  user/kib/vm6/sys/dev/usb/wlan/if_runvar.h
  user/kib/vm6/sys/dev/usb/wlan/if_ural.c
  user/kib/vm6/sys/dev/usb/wlan/if_uralvar.h
  user/kib/vm6/sys/dev/usb/wlan/if_zyd.c
  user/kib/vm6/sys/dev/usb/wlan/if_zydreg.h
  user/kib/vm6/sys/dev/wpi/if_wpi.c
  user/kib/vm6/sys/dev/wpi/if_wpivar.h
  user/kib/vm6/sys/fs/coda/cnode.h
  user/kib/vm6/sys/fs/coda/coda.h
  user/kib/vm6/sys/fs/coda/coda_subr.c
  user/kib/vm6/sys/fs/coda/coda_subr.h
  user/kib/vm6/sys/fs/coda/coda_venus.c
  user/kib/vm6/sys/fs/coda/coda_venus.h
  user/kib/vm6/sys/fs/coda/coda_vfsops.c
  user/kib/vm6/sys/fs/coda/coda_vfsops.h
  user/kib/vm6/sys/fs/coda/coda_vnops.c
  user/kib/vm6/sys/fs/deadfs/dead_vnops.c
  user/kib/vm6/sys/fs/msdosfs/msdosfs_vfsops.c
  user/kib/vm6/sys/fs/nfs/nfs_commonport.c
  user/kib/vm6/sys/fs/nfs/nfs_commonsubs.c
  user/kib/vm6/sys/fs/nfs/nfs_var.h
  user/kib/vm6/sys/fs/nfs/nfsclstate.h
  user/kib/vm6/sys/fs/nfs/nfsport.h
  user/kib/vm6/sys/fs/nfs/nfsrvstate.h
  user/kib/vm6/sys/fs/nfsclient/nfs_clport.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clrpcops.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clstate.c
  user/kib/vm6/sys/fs/nfsserver/nfs_nfsdport.c
  user/kib/vm6/sys/fs/nfsserver/nfs_nfsdserv.c
  user/kib/vm6/sys/fs/nfsserver/nfs_nfsdstate.c
  user/kib/vm6/sys/fs/nwfs/nwfs.h
  user/kib/vm6/sys/fs/nwfs/nwfs_io.c
  user/kib/vm6/sys/fs/nwfs/nwfs_ioctl.c
  user/kib/vm6/sys/fs/nwfs/nwfs_mount.h
  user/kib/vm6/sys/fs/nwfs/nwfs_node.c
  user/kib/vm6/sys/fs/nwfs/nwfs_node.h
  user/kib/vm6/sys/fs/nwfs/nwfs_subr.c
  user/kib/vm6/sys/fs/nwfs/nwfs_subr.h
  user/kib/vm6/sys/fs/nwfs/nwfs_vfsops.c
  user/kib/vm6/sys/fs/nwfs/nwfs_vnops.c
  user/kib/vm6/sys/fs/smbfs/smbfs.h
  user/kib/vm6/sys/fs/smbfs/smbfs_io.c
  user/kib/vm6/sys/fs/smbfs/smbfs_node.c
  user/kib/vm6/sys/fs/smbfs/smbfs_node.h
  user/kib/vm6/sys/fs/smbfs/smbfs_smb.c
  user/kib/vm6/sys/fs/smbfs/smbfs_subr.c
  user/kib/vm6/sys/fs/smbfs/smbfs_subr.h
  user/kib/vm6/sys/fs/smbfs/smbfs_vfsops.c
  user/kib/vm6/sys/fs/smbfs/smbfs_vnops.c
  user/kib/vm6/sys/geom/eli/g_eli.c
  user/kib/vm6/sys/geom/geom_io.c
  user/kib/vm6/sys/geom/geom_vfs.c
  user/kib/vm6/sys/geom/multipath/g_multipath.c
  user/kib/vm6/sys/i386/conf/GENERIC
  user/kib/vm6/sys/i386/i386/apic_vector.s
  user/kib/vm6/sys/i386/i386/local_apic.c
  user/kib/vm6/sys/i386/i386/machdep.c
  user/kib/vm6/sys/i386/i386/mpboot.s
  user/kib/vm6/sys/i386/i386/pmap.c
  user/kib/vm6/sys/i386/i386/trap.c
  user/kib/vm6/sys/i386/ibcs2/ibcs2_stat.c
  user/kib/vm6/sys/i386/include/apicvar.h
  user/kib/vm6/sys/i386/include/bootinfo.h
  user/kib/vm6/sys/i386/include/pmc_mdep.h
  user/kib/vm6/sys/i386/linux/linux.h
  user/kib/vm6/sys/ia64/ia64/mca.c
  user/kib/vm6/sys/ia64/ia64/mp_machdep.c
  user/kib/vm6/sys/ia64/include/mca.h
  user/kib/vm6/sys/ia64/include/pal.h
  user/kib/vm6/sys/kern/init_main.c
  user/kib/vm6/sys/kern/kern_alq.c
  user/kib/vm6/sys/kern/kern_clock.c
  user/kib/vm6/sys/kern/kern_event.c
  user/kib/vm6/sys/kern/kern_ktr.c
  user/kib/vm6/sys/kern/kern_sig.c
  user/kib/vm6/sys/kern/sys_pipe.c
  user/kib/vm6/sys/kern/tty_pts.c
  user/kib/vm6/sys/kern/uipc_mqueue.c
  user/kib/vm6/sys/kern/uipc_sem.c
  user/kib/vm6/sys/kern/uipc_shm.c
  user/kib/vm6/sys/kern/vfs_bio.c
  user/kib/vm6/sys/kern/vfs_cache.c
  user/kib/vm6/sys/kern/vfs_default.c
  user/kib/vm6/sys/kern/vfs_subr.c
  user/kib/vm6/sys/kern/vfs_syscalls.c
  user/kib/vm6/sys/kern/vfs_vnops.c
  user/kib/vm6/sys/libkern/iconv.c
  user/kib/vm6/sys/libkern/iconv_converter_if.m
  user/kib/vm6/sys/libkern/iconv_xlat.c
  user/kib/vm6/sys/libkern/strcasecmp.c
  user/kib/vm6/sys/mips/atheros/if_arge.c
  user/kib/vm6/sys/mips/cavium/asm_octeon.S
  user/kib/vm6/sys/mips/cavium/dev/rgmii/octeon_fau.h
  user/kib/vm6/sys/mips/cavium/dev/rgmii/octeon_rgmx.c
  user/kib/vm6/sys/mips/cavium/files.octeon1
  user/kib/vm6/sys/mips/cavium/octeon_machdep.c
  user/kib/vm6/sys/mips/cavium/octeon_pcmap_regs.h
  user/kib/vm6/sys/mips/conf/AR71XX
  user/kib/vm6/sys/mips/include/_inttypes.h
  user/kib/vm6/sys/mips/include/_limits.h
  user/kib/vm6/sys/mips/include/asm.h
  user/kib/vm6/sys/mips/include/bus.h
  user/kib/vm6/sys/mips/include/cpu.h
  user/kib/vm6/sys/mips/include/cpufunc.h
  user/kib/vm6/sys/mips/include/cpuregs.h
  user/kib/vm6/sys/mips/include/db_machdep.h
  user/kib/vm6/sys/mips/include/param.h
  user/kib/vm6/sys/mips/include/pcb.h
  user/kib/vm6/sys/mips/include/pmap.h
  user/kib/vm6/sys/mips/include/proc.h
  user/kib/vm6/sys/mips/include/profile.h
  user/kib/vm6/sys/mips/include/pte.h
  user/kib/vm6/sys/mips/include/regnum.h
  user/kib/vm6/sys/mips/include/sf_buf.h
  user/kib/vm6/sys/mips/include/trap.h
  user/kib/vm6/sys/mips/include/vmparam.h
  user/kib/vm6/sys/mips/malta/gt_pci.c
  user/kib/vm6/sys/mips/mips/autoconf.c
  user/kib/vm6/sys/mips/mips/busdma_machdep.c
  user/kib/vm6/sys/mips/mips/exception.S
  user/kib/vm6/sys/mips/mips/fp.S
  user/kib/vm6/sys/mips/mips/genassym.c
  user/kib/vm6/sys/mips/mips/locore.S
  user/kib/vm6/sys/mips/mips/machdep.c
  user/kib/vm6/sys/mips/mips/mem.c
  user/kib/vm6/sys/mips/mips/mp_machdep.c
  user/kib/vm6/sys/mips/mips/mpboot.S
  user/kib/vm6/sys/mips/mips/nexus.c
  user/kib/vm6/sys/mips/mips/pmap.c
  user/kib/vm6/sys/mips/mips/psraccess.S
  user/kib/vm6/sys/mips/mips/support.S
  user/kib/vm6/sys/mips/mips/swtch.S
  user/kib/vm6/sys/mips/mips/tick.c
  user/kib/vm6/sys/mips/mips/tlb.S
  user/kib/vm6/sys/mips/mips/trap.c
  user/kib/vm6/sys/mips/mips/uio_machdep.c
  user/kib/vm6/sys/mips/mips/vm_machdep.c
  user/kib/vm6/sys/mips/rmi/clock.c
  user/kib/vm6/sys/modules/Makefile
  user/kib/vm6/sys/modules/dummynet/Makefile
  user/kib/vm6/sys/modules/em/Makefile
  user/kib/vm6/sys/modules/geom/Makefile
  user/kib/vm6/sys/modules/hwpmc/Makefile
  user/kib/vm6/sys/modules/iwnfw/iwn6000/Makefile
  user/kib/vm6/sys/modules/syscons/Makefile
  user/kib/vm6/sys/modules/uart/Makefile
  user/kib/vm6/sys/modules/wlan/Makefile
  user/kib/vm6/sys/net/bpf.c
  user/kib/vm6/sys/net/if.c
  user/kib/vm6/sys/net/if_clone.c
  user/kib/vm6/sys/net/if_llatbl.c
  user/kib/vm6/sys/net/vnet.c
  user/kib/vm6/sys/net/vnet.h
  user/kib/vm6/sys/net80211/ieee80211.c
  user/kib/vm6/sys/net80211/ieee80211_amrr.c
  user/kib/vm6/sys/net80211/ieee80211_amrr.h
  user/kib/vm6/sys/net80211/ieee80211_crypto_ccmp.c
  user/kib/vm6/sys/net80211/ieee80211_crypto_tkip.c
  user/kib/vm6/sys/net80211/ieee80211_freebsd.h
  user/kib/vm6/sys/net80211/ieee80211_hostap.c
  user/kib/vm6/sys/net80211/ieee80211_input.c
  user/kib/vm6/sys/net80211/ieee80211_ioctl.c
  user/kib/vm6/sys/net80211/ieee80211_node.c
  user/kib/vm6/sys/net80211/ieee80211_node.h
  user/kib/vm6/sys/net80211/ieee80211_rssadapt.c
  user/kib/vm6/sys/net80211/ieee80211_rssadapt.h
  user/kib/vm6/sys/net80211/ieee80211_scan_sta.c
  user/kib/vm6/sys/net80211/ieee80211_var.h
  user/kib/vm6/sys/netgraph/ng_deflate.c
  user/kib/vm6/sys/netgraph/ng_ksocket.c
  user/kib/vm6/sys/netgraph/ng_l2tp.c
  user/kib/vm6/sys/netgraph/ng_mppc.c
  user/kib/vm6/sys/netgraph/ng_pipe.c
  user/kib/vm6/sys/netgraph/ng_pipe.h
  user/kib/vm6/sys/netgraph/ng_ppp.c
  user/kib/vm6/sys/netgraph/ng_pptpgre.c
  user/kib/vm6/sys/netgraph/ng_tcpmss.c
  user/kib/vm6/sys/netinet/if_ether.c
  user/kib/vm6/sys/netinet/in.c
  user/kib/vm6/sys/netinet/in.h
  user/kib/vm6/sys/netinet/in_mcast.c
  user/kib/vm6/sys/netinet/ip_dummynet.h
  user/kib/vm6/sys/netinet/ipfw/dn_sched.h
  user/kib/vm6/sys/netinet/ipfw/dn_sched_rr.c
  user/kib/vm6/sys/netinet/ipfw/dn_sched_wf2q.c
  user/kib/vm6/sys/netinet/ipfw/ip_dn_glue.c
  user/kib/vm6/sys/netinet/ipfw/ip_dn_io.c
  user/kib/vm6/sys/netinet/ipfw/ip_dn_private.h
  user/kib/vm6/sys/netinet/ipfw/ip_dummynet.c
  user/kib/vm6/sys/netinet/ipfw/ip_fw_pfil.c
  user/kib/vm6/sys/netinet/ipfw/ip_fw_private.h
  user/kib/vm6/sys/netinet/ipfw/ip_fw_sockopt.c
  user/kib/vm6/sys/netinet/sctp_asconf.c
  user/kib/vm6/sys/netinet/sctp_constants.h
  user/kib/vm6/sys/netinet/sctp_indata.c
  user/kib/vm6/sys/netinet/sctp_indata.h
  user/kib/vm6/sys/netinet/sctp_input.c
  user/kib/vm6/sys/netinet/sctp_output.c
  user/kib/vm6/sys/netinet/sctp_output.h
  user/kib/vm6/sys/netinet/sctp_pcb.c
  user/kib/vm6/sys/netinet/sctp_pcb.h
  user/kib/vm6/sys/netinet/sctp_structs.h
  user/kib/vm6/sys/netinet/sctp_usrreq.c
  user/kib/vm6/sys/netinet/sctp_var.h
  user/kib/vm6/sys/netinet/sctputil.c
  user/kib/vm6/sys/netinet/sctputil.h
  user/kib/vm6/sys/netinet/tcp_input.c
  user/kib/vm6/sys/netinet/tcp_output.c
  user/kib/vm6/sys/netinet6/in6.c
  user/kib/vm6/sys/netinet6/mld6.c
  user/kib/vm6/sys/netinet6/nd6.c
  user/kib/vm6/sys/netinet6/sctp6_usrreq.c
  user/kib/vm6/sys/netipsec/ipsec.c
  user/kib/vm6/sys/netipsec/key.c
  user/kib/vm6/sys/netncp/ncp_conn.c
  user/kib/vm6/sys/netncp/ncp_conn.h
  user/kib/vm6/sys/netncp/ncp_file.h
  user/kib/vm6/sys/netncp/ncp_lib.h
  user/kib/vm6/sys/netncp/ncp_login.c
  user/kib/vm6/sys/netncp/ncp_ncp.c
  user/kib/vm6/sys/netncp/ncp_ncp.h
  user/kib/vm6/sys/netncp/ncp_nls.c
  user/kib/vm6/sys/netncp/ncp_nls.h
  user/kib/vm6/sys/netncp/ncp_rcfile.h
  user/kib/vm6/sys/netncp/ncp_rq.c
  user/kib/vm6/sys/netncp/ncp_rq.h
  user/kib/vm6/sys/netncp/ncp_sock.c
  user/kib/vm6/sys/netncp/ncp_sock.h
  user/kib/vm6/sys/netncp/ncp_subr.c
  user/kib/vm6/sys/netncp/ncp_subr.h
  user/kib/vm6/sys/netncp/ncp_user.h
  user/kib/vm6/sys/netsmb/netbios.h
  user/kib/vm6/sys/netsmb/smb.h
  user/kib/vm6/sys/netsmb/smb_conn.c
  user/kib/vm6/sys/netsmb/smb_conn.h
  user/kib/vm6/sys/netsmb/smb_dev.c
  user/kib/vm6/sys/netsmb/smb_dev.h
  user/kib/vm6/sys/netsmb/smb_iod.c
  user/kib/vm6/sys/netsmb/smb_rq.c
  user/kib/vm6/sys/netsmb/smb_rq.h
  user/kib/vm6/sys/netsmb/smb_smb.c
  user/kib/vm6/sys/netsmb/smb_subr.c
  user/kib/vm6/sys/netsmb/smb_subr.h
  user/kib/vm6/sys/netsmb/smb_tran.h
  user/kib/vm6/sys/netsmb/smb_trantcp.c
  user/kib/vm6/sys/netsmb/smb_trantcp.h
  user/kib/vm6/sys/netsmb/smb_usr.c
  user/kib/vm6/sys/pc98/cbus/clock.c
  user/kib/vm6/sys/pci/if_rlreg.h
  user/kib/vm6/sys/powerpc/ofw/ofw_real.c
  user/kib/vm6/sys/powerpc/ofw/ofw_syscons.c
  user/kib/vm6/sys/sparc64/conf/GENERIC
  user/kib/vm6/sys/sparc64/conf/NOTES
  user/kib/vm6/sys/sparc64/fhc/fhc.c
  user/kib/vm6/sys/sparc64/include/dcr.h
  user/kib/vm6/sys/sparc64/include/lsu.h
  user/kib/vm6/sys/sparc64/pci/apb.c
  user/kib/vm6/sys/sparc64/pci/psycho.c
  user/kib/vm6/sys/sparc64/pci/schizo.c
  user/kib/vm6/sys/sparc64/sbus/sbus.c
  user/kib/vm6/sys/sparc64/sparc64/ofw_machdep.c
  user/kib/vm6/sys/sparc64/sparc64/trap.c
  user/kib/vm6/sys/sys/_timespec.h
  user/kib/vm6/sys/sys/iconv.h
  user/kib/vm6/sys/sys/ioccom.h
  user/kib/vm6/sys/sys/mchain.h
  user/kib/vm6/sys/sys/pcpu.h
  user/kib/vm6/sys/sys/pmc.h
  user/kib/vm6/sys/sys/proc.h
  user/kib/vm6/sys/sys/stat.h
  user/kib/vm6/sys/sys/timespec.h
  user/kib/vm6/sys/sys/vnode.h
  user/kib/vm6/sys/sys/vtoc.h
  user/kib/vm6/sys/teken/teken.c
  user/kib/vm6/sys/ufs/ffs/ffs_vfsops.c
  user/kib/vm6/sys/vm/memguard.c
  user/kib/vm6/sys/vm/memguard.h
  user/kib/vm6/sys/vm/pmap.h
  user/kib/vm6/sys/vm/swap_pager.c
  user/kib/vm6/sys/vm/vm_contig.c
  user/kib/vm6/sys/vm/vm_extern.h
  user/kib/vm6/sys/vm/vm_fault.c
  user/kib/vm6/sys/vm/vm_glue.c
  user/kib/vm6/sys/vm/vm_kern.c
  user/kib/vm6/sys/vm/vm_map.c
  user/kib/vm6/sys/vm/vm_map.h
  user/kib/vm6/sys/vm/vm_object.c
  user/kib/vm6/sys/vm/vm_page.c
  user/kib/vm6/sys/vm/vm_pageout.c
  user/kib/vm6/sys/x86/isa/clock.c
  user/kib/vm6/tools/regression/lib/libc/gen/Makefile
  user/kib/vm6/tools/tools/ath/common/dumpregs_5416.c
  user/kib/vm6/tools/tools/nanobsd/gateworks/common
  user/kib/vm6/tools/tools/nanobsd/nanobsd.sh
  user/kib/vm6/usr.bin/ar/ar.1
  user/kib/vm6/usr.bin/c89/c89.1
  user/kib/vm6/usr.bin/c99/c99.1
  user/kib/vm6/usr.bin/calendar/Makefile
  user/kib/vm6/usr.bin/calendar/calendar.1
  user/kib/vm6/usr.bin/calendar/calendar.c
  user/kib/vm6/usr.bin/calendar/calendar.h
  user/kib/vm6/usr.bin/calendar/calendars/calendar.australia
  user/kib/vm6/usr.bin/calendar/calendars/calendar.dutch
  user/kib/vm6/usr.bin/calendar/calendars/calendar.freebsd
  user/kib/vm6/usr.bin/calendar/day.c
  user/kib/vm6/usr.bin/calendar/io.c
  user/kib/vm6/usr.bin/calendar/ostern.c
  user/kib/vm6/usr.bin/calendar/paskha.c
  user/kib/vm6/usr.bin/calendar/pathnames.h
  user/kib/vm6/usr.bin/column/column.1
  user/kib/vm6/usr.bin/comm/comm.1
  user/kib/vm6/usr.bin/compress/compress.c
  user/kib/vm6/usr.bin/csup/cpasswd.1   (contents, props changed)
  user/kib/vm6/usr.bin/csup/csup.1
  user/kib/vm6/usr.bin/enigma/enigma.1
  user/kib/vm6/usr.bin/getent/getent.c
  user/kib/vm6/usr.bin/gzip/gzip.1
  user/kib/vm6/usr.bin/gzip/gzip.c
  user/kib/vm6/usr.bin/gzip/unbzip2.c
  user/kib/vm6/usr.bin/hexdump/od.1
  user/kib/vm6/usr.bin/indent/args.c
  user/kib/vm6/usr.bin/indent/indent.1
  user/kib/vm6/usr.bin/indent/indent.c
  user/kib/vm6/usr.bin/indent/indent_globs.h
  user/kib/vm6/usr.bin/indent/lexi.c
  user/kib/vm6/usr.bin/kdump/kdump.c
  user/kib/vm6/usr.bin/killall/killall.1
  user/kib/vm6/usr.bin/lockf/lockf.1
  user/kib/vm6/usr.bin/mail/util.c
  user/kib/vm6/usr.bin/make/main.c
  user/kib/vm6/usr.bin/sed/main.c
  user/kib/vm6/usr.bin/sed/sed.1
  user/kib/vm6/usr.bin/sockstat/sockstat.c
  user/kib/vm6/usr.bin/tar/bsdtar.1
  user/kib/vm6/usr.bin/tar/bsdtar.c
  user/kib/vm6/usr.bin/tar/bsdtar_platform.h
  user/kib/vm6/usr.bin/tar/matching.c
  user/kib/vm6/usr.bin/tar/subst.c
  user/kib/vm6/usr.bin/tar/tree.h
  user/kib/vm6/usr.bin/tar/write.c
  user/kib/vm6/usr.bin/touch/touch.c
  user/kib/vm6/usr.bin/wtmpcvt/wtmpcvt.1
  user/kib/vm6/usr.bin/xlint/lint1/decl.c
  user/kib/vm6/usr.bin/xlint/lint1/lint1.h
  user/kib/vm6/usr.bin/xlint/lint1/mem1.c
  user/kib/vm6/usr.sbin/Makefile
  user/kib/vm6/usr.sbin/ac/ac.c
  user/kib/vm6/usr.sbin/asf/asf.8
  user/kib/vm6/usr.sbin/burncd/burncd.8
  user/kib/vm6/usr.sbin/config/config.h
  user/kib/vm6/usr.sbin/config/config.y
  user/kib/vm6/usr.sbin/config/lang.l
  user/kib/vm6/usr.sbin/config/main.c
  user/kib/vm6/usr.sbin/config/mkmakefile.c
  user/kib/vm6/usr.sbin/config/mkoptions.c
  user/kib/vm6/usr.sbin/ctm/ctm/ctm.1
  user/kib/vm6/usr.sbin/ctm/ctm/ctm.5
  user/kib/vm6/usr.sbin/devinfo/devinfo.8
  user/kib/vm6/usr.sbin/fdformat/fdformat.1
  user/kib/vm6/usr.sbin/fdread/fdread.1
  user/kib/vm6/usr.sbin/fdwrite/fdwrite.1
  user/kib/vm6/usr.sbin/fifolog/fifolog_create/fifolog.1
  user/kib/vm6/usr.sbin/flowctl/flowctl.8
  user/kib/vm6/usr.sbin/lastlogin/lastlogin.8
  user/kib/vm6/usr.sbin/lastlogin/lastlogin.c
  user/kib/vm6/usr.sbin/mailwrapper/mailwrapper.8
  user/kib/vm6/usr.sbin/mailwrapper/mailwrapper.c
  user/kib/vm6/usr.sbin/mtest/mtest.8
  user/kib/vm6/usr.sbin/mtree/compare.c
  user/kib/vm6/usr.sbin/mtree/create.c
  user/kib/vm6/usr.sbin/mtree/mtree.8
  user/kib/vm6/usr.sbin/periodic/periodic.8
  user/kib/vm6/usr.sbin/pkg_install/add/futil.c
  user/kib/vm6/usr.sbin/pkg_install/add/perform.c
  user/kib/vm6/usr.sbin/pkg_install/delete/perform.c
  user/kib/vm6/usr.sbin/pkg_install/lib/file.c
  user/kib/vm6/usr.sbin/pkg_install/lib/lib.h
  user/kib/vm6/usr.sbin/pkg_install/lib/match.c
  user/kib/vm6/usr.sbin/pkg_install/lib/pen.c
  user/kib/vm6/usr.sbin/pkg_install/lib/plist.c
  user/kib/vm6/usr.sbin/pkg_install/lib/url.c
  user/kib/vm6/usr.sbin/pkg_install/version/perform.c
  user/kib/vm6/usr.sbin/pmcannotate/pmcannotate.8
  user/kib/vm6/usr.sbin/pmccontrol/pmccontrol.8
  user/kib/vm6/usr.sbin/pmcstat/pmcpl_callgraph.c
  user/kib/vm6/usr.sbin/pmcstat/pmcpl_calltree.c
  user/kib/vm6/usr.sbin/pmcstat/pmcpl_gprof.c
  user/kib/vm6/usr.sbin/pmcstat/pmcstat.8
  user/kib/vm6/usr.sbin/pmcstat/pmcstat_log.c
  user/kib/vm6/usr.sbin/pmcstat/pmcstat_log.h
  user/kib/vm6/usr.sbin/pppctl/pppctl.8
  user/kib/vm6/usr.sbin/setfmac/setfsmac.8
  user/kib/vm6/usr.sbin/setpmac/setpmac.8
  user/kib/vm6/usr.sbin/sysinstall/devices.c
  user/kib/vm6/usr.sbin/sysinstall/menus.c
  user/kib/vm6/usr.sbin/uhsoctl/uhsoctl.1
  user/kib/vm6/usr.sbin/vidcontrol/vidcontrol.c
  user/kib/vm6/usr.sbin/wpa/wpa_supplicant/driver_freebsd.c
  user/kib/vm6/usr.sbin/wpa/wpa_supplicant/wpa_supplicant.conf.5
Directory Properties:
  user/kib/vm6/   (props changed)
  user/kib/vm6/contrib/tzcode/stdtime/   (props changed)
  user/kib/vm6/contrib/tzcode/zic/   (props changed)
  user/kib/vm6/contrib/tzdata/   (props changed)
  user/kib/vm6/crypto/openssl/   (props changed)
  user/kib/vm6/lib/libz/   (props changed)
  user/kib/vm6/sys/contrib/dev/acpica/   (props changed)
  user/kib/vm6/sys/contrib/x86emu/   (props changed)
  user/kib/vm6/sys/dev/ath/ath_hal/ar5416/ar9160.ini   (props changed)
  user/kib/vm6/sys/mips/rmi/dev/sec/desc.h   (props changed)

Modified: user/kib/vm6/MAINTAINERS
==============================================================================
--- user/kib/vm6/MAINTAINERS	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/MAINTAINERS	Mon Apr 19 19:29:33 2010	(r206856)
@@ -123,6 +123,9 @@ usr.sbin/zic		edwin   Heads-up appreciat
 				maintained by a third party source.
 lib/libc/stdtime	edwin   Heads-up appreciated, since parts of this code
 				is maintained by a third party source.
+sysinstall	randi	Please contact about any major changes so that
+			they can be co-ordinated.
+sbin/routed	bms	Pre-commit review; notify vendor at rhyolite.com
 
 Following are the entries from the Makefiles, and a few other sources.
 Please remove stale entries from both their origin, and this file.

Modified: user/kib/vm6/Makefile.inc1
==============================================================================
--- user/kib/vm6/Makefile.inc1	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/Makefile.inc1	Mon Apr 19 19:29:33 2010	(r206856)
@@ -15,6 +15,7 @@
 #	-DNO_CTF do not run the DTrace CTF conversion tools on built objects
 #	LOCAL_DIRS="list of dirs" to add additional dirs to the SUBDIR list
 #	TARGET="machine" to crossbuild world for a different machine type
+#	TARGET_ARCH= may be required when a TARGET supports multiple endians
 
 #
 # The intended user-driven targets are:

Modified: user/kib/vm6/ObsoleteFiles.inc
==============================================================================
--- user/kib/vm6/ObsoleteFiles.inc	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/ObsoleteFiles.inc	Mon Apr 19 19:29:33 2010	(r206856)
@@ -14,6 +14,18 @@
 # The file is partitioned: OLD_FILES first, then OLD_LIBS and OLD_DIRS last.
 #
 
+# 20100416: [mips] removed <machine/psl.h>
+.if ${TARGET_ARCH} == "mips"
+OLD_FILES+=usr/include/machine/psl.h
+.endif
+# 20100415: [mips] removed unused headers
+.if ${TARGET_ARCH} == "mips"
+OLD_FILES+=usr/include/machine/archtype.h
+OLD_FILES+=usr/include/machine/segments.h
+OLD_FILES+=usr/include/machine/rm7000.h
+OLD_FILES+=usr/include/machine/defs.h
+OLD_FILES+=usr/include/machine/queue.h
+.endif
 # 20100326: [ia64] removed <machine/nexusvar.h>
 .if ${TARGET_ARCH} == "ia64"
 OLD_FILES+=usr/include/machine/nexusvar.h

Modified: user/kib/vm6/UPDATING
==============================================================================
--- user/kib/vm6/UPDATING	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/UPDATING	Mon Apr 19 19:29:33 2010	(r206856)
@@ -22,6 +22,16 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 9.
 	machines to maximize performance.  (To disable malloc debugging, run
 	ln -s aj /etc/malloc.conf.)
 
+20100402:
+	WITH_CTF can now be specified in src.conf (not recommended, there
+	are some problems with static executables), make.conf (would also
+	affect ports which do not use GNU make and do not override the
+	compile targets) or in the kernel config (via "makeoptions
+	WITH_CTF=yes").
+	When WITH_CTF was specified there before this was silently ignored,
+	so make sure that WITH_CTF is not used in places which could lead
+	to unwanted behavior.
+
 20100311:
 	The kernel option COMPAT_IA32 has been replaced with COMPAT_FREEBSD32
 	to allow 32-bit compatibility on non-x86 platforms. All kernel

Modified: user/kib/vm6/bin/cp/utils.c
==============================================================================
--- user/kib/vm6/bin/cp/utils.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/cp/utils.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -323,8 +323,8 @@ setfile(struct stat *fs, int fd)
 	fs->st_mode &= S_ISUID | S_ISGID | S_ISVTX |
 		       S_IRWXU | S_IRWXG | S_IRWXO;
 
-	TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atimespec);
-	TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtimespec);
+	TIMESPEC_TO_TIMEVAL(&tv[0], &fs->st_atim);
+	TIMESPEC_TO_TIMEVAL(&tv[1], &fs->st_mtim);
 	if (islink ? lutimes(to.p_path, tv) : utimes(to.p_path, tv)) {
 		warn("%sutimes: %s", islink ? "l" : "", to.p_path);
 		rval = 1;

Modified: user/kib/vm6/bin/ln/ln.c
==============================================================================
--- user/kib/vm6/bin/ln/ln.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/ln/ln.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -172,6 +172,52 @@ main(int argc, char *argv[])
 	exit(exitval);
 }
 
+/*
+ * Two pathnames refer to the same directory entry if the directories match
+ * and the final components' names match.
+ */
+static int
+samedirent(const char *path1, const char *path2)
+{
+	const char *file1, *file2;
+	char pathbuf[PATH_MAX];
+	struct stat sb1, sb2;
+
+	if (strcmp(path1, path2) == 0)
+		return 1;
+	file1 = strrchr(path1, '/');
+	if (file1 != NULL)
+		file1++;
+	else
+		file1 = path1;
+	file2 = strrchr(path2, '/');
+	if (file2 != NULL)
+		file2++;
+	else
+		file2 = path2;
+	if (strcmp(file1, file2) != 0)
+		return 0;
+	if (file1 - path1 >= PATH_MAX || file2 - path2 >= PATH_MAX)
+		return 0;
+	if (file1 == path1)
+		memcpy(pathbuf, ".", 2);
+	else {
+		memcpy(pathbuf, path1, file1 - path1);
+		pathbuf[file1 - path1] = '\0';
+	}
+	if (stat(pathbuf, &sb1) != 0)
+		return 0;
+	if (file2 == path2)
+		memcpy(pathbuf, ".", 2);
+	else {
+		memcpy(pathbuf, path2, file2 - path2);
+		pathbuf[file2 - path2] = '\0';
+	}
+	if (stat(pathbuf, &sb2) != 0)
+		return 0;
+	return sb1.st_dev == sb2.st_dev && sb1.st_ino == sb2.st_ino;
+}
+
 int
 linkit(const char *source, const char *target, int isdir)
 {
@@ -215,7 +261,6 @@ linkit(const char *source, const char *t
 		target = path;
 	}
 
-	exists = !lstat(target, &sb);
 	/*
 	 * If the link source doesn't exist, and a symbolic link was
 	 * requested, and -w was specified, give a warning.
@@ -242,8 +287,20 @@ linkit(const char *source, const char *t
 				warn("warning: %s", source);
 		}
 	}
+
+	/*
+	 * If the file exists, first check it is not the same directory entry.
+	 */
+	exists = !lstat(target, &sb);
+	if (exists) {
+		if (!sflag && samedirent(source, target)) {
+			warnx("%s and %s are the same directory entry",
+			    source, target);
+			return (1);
+		}
+	}
 	/*
-	 * If the file exists, then unlink it forcibly if -f was specified
+	 * Then unlink it forcibly if -f was specified
 	 * and interactively if -i was specified.
 	 */
 	if (fflag && exists) {

Modified: user/kib/vm6/bin/ls/cmp.c
==============================================================================
--- user/kib/vm6/bin/ls/cmp.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/ls/cmp.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -66,17 +66,17 @@ int
 modcmp(const FTSENT *a, const FTSENT *b)
 {
 
-	if (b->fts_statp->st_mtimespec.tv_sec >
-	    a->fts_statp->st_mtimespec.tv_sec)
+	if (b->fts_statp->st_mtim.tv_sec >
+	    a->fts_statp->st_mtim.tv_sec)
 		return (1);
-	if (b->fts_statp->st_mtimespec.tv_sec <
-	    a->fts_statp->st_mtimespec.tv_sec)
+	if (b->fts_statp->st_mtim.tv_sec <
+	    a->fts_statp->st_mtim.tv_sec)
 		return (-1);
-	if (b->fts_statp->st_mtimespec.tv_nsec >
-	    a->fts_statp->st_mtimespec.tv_nsec)
+	if (b->fts_statp->st_mtim.tv_nsec >
+	    a->fts_statp->st_mtim.tv_nsec)
 		return (1);
-	if (b->fts_statp->st_mtimespec.tv_nsec <
-	    a->fts_statp->st_mtimespec.tv_nsec)
+	if (b->fts_statp->st_mtim.tv_nsec <
+	    a->fts_statp->st_mtim.tv_nsec)
 		return (-1);
 	return (strcoll(a->fts_name, b->fts_name));
 }
@@ -92,17 +92,17 @@ int
 acccmp(const FTSENT *a, const FTSENT *b)
 {
 
-	if (b->fts_statp->st_atimespec.tv_sec >
-	    a->fts_statp->st_atimespec.tv_sec)
+	if (b->fts_statp->st_atim.tv_sec >
+	    a->fts_statp->st_atim.tv_sec)
 		return (1);
-	if (b->fts_statp->st_atimespec.tv_sec <
-	    a->fts_statp->st_atimespec.tv_sec)
+	if (b->fts_statp->st_atim.tv_sec <
+	    a->fts_statp->st_atim.tv_sec)
 		return (-1);
-	if (b->fts_statp->st_atimespec.tv_nsec >
-	    a->fts_statp->st_atimespec.tv_nsec)
+	if (b->fts_statp->st_atim.tv_nsec >
+	    a->fts_statp->st_atim.tv_nsec)
 		return (1);
-	if (b->fts_statp->st_atimespec.tv_nsec <
-	    a->fts_statp->st_atimespec.tv_nsec)
+	if (b->fts_statp->st_atim.tv_nsec <
+	    a->fts_statp->st_atim.tv_nsec)
 		return (-1);
 	return (strcoll(a->fts_name, b->fts_name));
 }
@@ -118,17 +118,17 @@ int
 birthcmp(const FTSENT *a, const FTSENT *b)
 {
 
-	if (b->fts_statp->st_birthtimespec.tv_sec >
-	    a->fts_statp->st_birthtimespec.tv_sec)
+	if (b->fts_statp->st_birthtim.tv_sec >
+	    a->fts_statp->st_birthtim.tv_sec)
 		return (1);
-	if (b->fts_statp->st_birthtimespec.tv_sec <
-	    a->fts_statp->st_birthtimespec.tv_sec)
+	if (b->fts_statp->st_birthtim.tv_sec <
+	    a->fts_statp->st_birthtim.tv_sec)
 		return (-1);
-	if (b->fts_statp->st_birthtimespec.tv_nsec >
-	    a->fts_statp->st_birthtimespec.tv_nsec)
+	if (b->fts_statp->st_birthtim.tv_nsec >
+	    a->fts_statp->st_birthtim.tv_nsec)
 		return (1);
-	if (b->fts_statp->st_birthtimespec.tv_nsec <
-	    a->fts_statp->st_birthtimespec.tv_nsec)
+	if (b->fts_statp->st_birthtim.tv_nsec <
+	    a->fts_statp->st_birthtim.tv_nsec)
 		return (-1);
 	return (strcoll(a->fts_name, b->fts_name));
 }
@@ -144,17 +144,17 @@ int
 statcmp(const FTSENT *a, const FTSENT *b)
 {
 
-	if (b->fts_statp->st_ctimespec.tv_sec >
-	    a->fts_statp->st_ctimespec.tv_sec)
+	if (b->fts_statp->st_ctim.tv_sec >
+	    a->fts_statp->st_ctim.tv_sec)
 		return (1);
-	if (b->fts_statp->st_ctimespec.tv_sec <
-	    a->fts_statp->st_ctimespec.tv_sec)
+	if (b->fts_statp->st_ctim.tv_sec <
+	    a->fts_statp->st_ctim.tv_sec)
 		return (-1);
-	if (b->fts_statp->st_ctimespec.tv_nsec >
-	    a->fts_statp->st_ctimespec.tv_nsec)
+	if (b->fts_statp->st_ctim.tv_nsec >
+	    a->fts_statp->st_ctim.tv_nsec)
 		return (1);
-	if (b->fts_statp->st_ctimespec.tv_nsec <
-	    a->fts_statp->st_ctimespec.tv_nsec)
+	if (b->fts_statp->st_ctim.tv_nsec <
+	    a->fts_statp->st_ctim.tv_nsec)
 		return (-1);
 	return (strcoll(a->fts_name, b->fts_name));
 }

Modified: user/kib/vm6/bin/pax/Makefile
==============================================================================
--- user/kib/vm6/bin/pax/Makefile	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/pax/Makefile	Mon Apr 19 19:29:33 2010	(r206856)
@@ -29,8 +29,5 @@ PROG=   pax
 SRCS=	ar_io.c ar_subs.c buf_subs.c cache.c cpio.c file_subs.c ftree.c \
 	gen_subs.c getoldopt.c options.c pat_rep.c pax.c sel_subs.c \
 	tables.c tar.c tty_subs.c
-#XXX NOTYET
-#MAN=	pax.1 tar.1 cpio.1
-#LINKS=	${BINDIR}/pax ${BINDIR}/tar ${BINDIR}/pax ${BINDIR}/cpio
 
 .include <bsd.prog.mk>

Modified: user/kib/vm6/bin/pax/getoldopt.c
==============================================================================
--- user/kib/vm6/bin/pax/getoldopt.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/pax/getoldopt.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -1,4 +1,4 @@
-/*	$OpenBSD: getoldopt.c,v 1.4 2000/01/22 20:24:51 deraadt Exp $	*/
+/*	$OpenBSD: getoldopt.c,v 1.9 2009/10/27 23:59:22 deraadt Exp $	*/
 /*	$NetBSD: getoldopt.c,v 1.3 1995/03/21 09:07:28 cgd Exp $	*/
 
 /*-
@@ -7,7 +7,7 @@
  * otherwise, it uses the old rules used by tar, dump, and ps.
  *
  * Written 25 August 1985 by John Gilmore (ihnp4!hoptoad!gnu) and placed
- * in the Pubic Domain for your edification and enjoyment.
+ * in the Public Domain for your edification and enjoyment.
  */
 
 #include <sys/cdefs.h>
@@ -33,7 +33,8 @@ getoldopt(int argc, char **argv, const c
 	optarg = NULL;
 
 	if (key == NULL) {		/* First time */
-		if (argc < 2) return EOF;
+		if (argc < 2)
+			return (-1);
 		key = argv[1];
 		if (*key == '-')
 			use_getopt++;
@@ -42,18 +43,18 @@ getoldopt(int argc, char **argv, const c
 	}
 
 	if (use_getopt)
-		return getopt(argc, argv, optstring);
+		return (getopt(argc, argv, optstring));
 
 	c = *key++;
 	if (c == '\0') {
 		key--;
-		return EOF;
+		return (-1);
 	}
 	place = strchr(optstring, c);
 
 	if (place == NULL || c == ':') {
 		fprintf(stderr, "%s: unknown option %c\n", argv[0], c);
-		return('?');
+		return ('?');
 	}
 
 	place++;
@@ -64,9 +65,9 @@ getoldopt(int argc, char **argv, const c
 		} else {
 			fprintf(stderr, "%s: %c argument missing\n",
 				argv[0], c);
-			return('?');
+			return ('?');
 		}
 	}
 
-	return(c);
+	return (c);
 }

Modified: user/kib/vm6/bin/ps/ps.1
==============================================================================
--- user/kib/vm6/bin/ps/ps.1	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/ps/ps.1	Mon Apr 19 19:29:33 2010	(r206856)
@@ -29,7 +29,7 @@
 .\"     @(#)ps.1	8.3 (Berkeley) 4/18/94
 .\" $FreeBSD$
 .\"
-.Dd March 17, 2010
+.Dd April 13, 2010
 .Dt PS 1
 .Os
 .Sh NAME
@@ -298,6 +298,7 @@ the include file
 .It Dv "P_WAITED" Ta No "0x01000	Someone is waiting for us"
 .It Dv "P_WEXIT" Ta No "0x02000		Working on exiting"
 .It Dv "P_EXEC" Ta No "0x04000		Process called exec"
+.It Dv "P_WKILLED" Ta No "0x08000	Killed, shall go to kernel/user boundary ASAP"
 .It Dv "P_CONTINUED" Ta No "0x10000	Proc has continued from a stopped state"
 .It Dv "P_STOPPED_SIG" Ta No "0x20000	Stopped due to SIGSTOP/SIGTSTP"
 .It Dv "P_STOPPED_TRACE" Ta No "0x40000	Stopped because of tracing"

Modified: user/kib/vm6/bin/pwait/pwait.1
==============================================================================
--- user/kib/vm6/bin/pwait/pwait.1	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/pwait/pwait.1	Mon Apr 19 19:29:33 2010	(r206856)
@@ -33,8 +33,8 @@
 .\" $FreeBSD$
 .\"
 .Dd November 1, 2009
-.Os
 .Dt PWAIT 1
+.Os
 .Sh NAME
 .Nm pwait
 .Nd wait for processes to terminate

Modified: user/kib/vm6/bin/rcp/rcp.c
==============================================================================
--- user/kib/vm6/bin/rcp/rcp.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/rcp/rcp.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -390,8 +390,8 @@ syserr:			run_err("%s: %s", name, strerr
 			 * versions expecting microseconds.
 			 */
 			(void)snprintf(buf, sizeof(buf), "T%ld 0 %ld 0\n",
-			    (long)stb.st_mtimespec.tv_sec,
-			    (long)stb.st_atimespec.tv_sec);
+			    (long)stb.st_mtim.tv_sec,
+			    (long)stb.st_atim.tv_sec);
 			(void)write(rem, buf, strlen(buf));
 			if (response() < 0)
 				goto next;
@@ -454,8 +454,8 @@ rsource(char *name, struct stat *statp)
 		last++;
 	if (pflag) {
 		(void)snprintf(path, sizeof(path), "T%ld 0 %ld 0\n",
-		    (long)statp->st_mtimespec.tv_sec,
-		    (long)statp->st_atimespec.tv_sec);
+		    (long)statp->st_mtim.tv_sec,
+		    (long)statp->st_atim.tv_sec);
 		(void)write(rem, path, strlen(path));
 		if (response() < 0) {
 			closedir(dirp);

Modified: user/kib/vm6/bin/sh/cd.c
==============================================================================
--- user/kib/vm6/bin/sh/cd.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/cd.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -70,6 +70,7 @@ STATIC int docd(char *, int, int);
 STATIC char *getcomponent(void);
 STATIC char *findcwd(char *);
 STATIC void updatepwd(char *);
+STATIC char *getpwd(void);
 STATIC char *getpwd2(void);
 
 STATIC char *curdir = NULL;	/* current working directory */
@@ -351,7 +352,7 @@ pwdcmd(int argc, char **argv)
 /*
  * Get the current directory and cache the result in curdir.
  */
-char *
+STATIC char *
 getpwd(void)
 {
 	char *p;
@@ -374,7 +375,6 @@ getpwd(void)
 STATIC char *
 getpwd2(void)
 {
-	struct stat stdot, stpwd;
 	char *pwd;
 	int i;
 
@@ -387,12 +387,29 @@ getpwd2(void)
 			break;
 	}
 
-	pwd = getenv("PWD");
+	return NULL;
+}
+
+/*
+ * Initialize PWD in a new shell.
+ * If the shell is interactive, we need to warn if this fails.
+ */
+void
+pwd_init(int warn)
+{
+	char *pwd;
+	struct stat stdot, stpwd;
+
+	pwd = lookupvar("PWD");
 	if (pwd && *pwd == '/' && stat(".", &stdot) != -1 &&
 	    stat(pwd, &stpwd) != -1 &&
 	    stdot.st_dev == stpwd.st_dev &&
 	    stdot.st_ino == stpwd.st_ino) {
-		return pwd;
+		if (curdir)
+			ckfree(curdir);
+		curdir = savestr(pwd);
 	}
-	return NULL;
+	if (getpwd() == NULL && warn)
+		out2fmt_flush("sh: cannot determine working directory\n");
+	setvar("PWD", curdir, VEXPORT);
 }

Modified: user/kib/vm6/bin/sh/cd.h
==============================================================================
--- user/kib/vm6/bin/sh/cd.h	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/cd.h	Mon Apr 19 19:29:33 2010	(r206856)
@@ -29,6 +29,6 @@
  * $FreeBSD$
  */
 
-char	*getpwd(void);
+void	 pwd_init(int);
 int	 cdcmd (int, char **);
 int	 pwdcmd(int, char **);

Modified: user/kib/vm6/bin/sh/expand.c
==============================================================================
--- user/kib/vm6/bin/sh/expand.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/expand.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -273,7 +273,6 @@ exptilde(char *p, int flag)
 		switch(c) {
 		case CTLESC: /* This means CTL* are always considered quoted. */
 		case CTLVAR:
-		case CTLENDVAR:
 		case CTLBACKQ:
 		case CTLBACKQ | CTLQUOTE:
 		case CTLARI:
@@ -285,6 +284,7 @@ exptilde(char *p, int flag)
 				goto done;
 			break;
 		case '/':
+		case CTLENDVAR:
 			goto done;
 		}
 		p++;
@@ -506,7 +506,9 @@ subevalvar(char *p, char *str, int strlo
 	int amount;
 
 	herefd = -1;
-	argstr(p, 0);
+	argstr(p, (subtype == VSTRIMLEFT || subtype == VSTRIMLEFTMAX ||
+	    subtype == VSTRIMRIGHT || subtype == VSTRIMRIGHTMAX ?
+	    EXP_CASE : 0) | EXP_TILDE);
 	STACKSTRNUL(expdest);
 	herefd = saveherefd;
 	argbackq = saveargbackq;

Modified: user/kib/vm6/bin/sh/main.c
==============================================================================
--- user/kib/vm6/bin/sh/main.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/main.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -153,10 +153,7 @@ main(int argc, char *argv[])
 	init();
 	setstackmark(&smark);
 	procargs(argc, argv);
-	if (getpwd() == NULL && iflag)
-		out2fmt_flush("sh: cannot determine working directory\n");
-	if (getpwd() != NULL)
-		setvar ("PWD", getpwd(), VEXPORT);
+	pwd_init(iflag);
 	if (iflag)
 		chkmail(1);
 	if (argv[0] && argv[0][0] == '-') {

Modified: user/kib/vm6/bin/sh/mksyntax.c
==============================================================================
--- user/kib/vm6/bin/sh/mksyntax.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/mksyntax.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -232,7 +232,6 @@ main(int argc __unused, char **argv __un
 	add("\n", "CNL");
 	add("\\", "CBACK");
 	add("`", "CBQUOTE");
-	add("'", "CSQUOTE");
 	add("\"", "CDQUOTE");
 	add("$", "CVAR");
 	add("}", "CENDVAR");

Modified: user/kib/vm6/bin/sh/options.c
==============================================================================
--- user/kib/vm6/bin/sh/options.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/options.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -93,8 +93,11 @@ procargs(int argc, char **argv)
 	options(1);
 	if (*argptr == NULL && minusc == NULL)
 		sflag = 1;
-	if (iflag == 2 && sflag == 1 && isatty(0) && isatty(1))
+	if (iflag != 0 && sflag == 1 && isatty(0) && isatty(1)) {
 		iflag = 1;
+		if (Eflag == 2)
+			Eflag = 1;
+	}
 	if (mflag == 2)
 		mflag = iflag;
 	for (i = 0; i < NOPTS; i++)

Modified: user/kib/vm6/bin/sh/parser.c
==============================================================================
--- user/kib/vm6/bin/sh/parser.c	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/parser.c	Mon Apr 19 19:29:33 2010	(r206856)
@@ -79,6 +79,10 @@ struct heredoc {
 	int striptabs;		/* if set, strip leading tabs */
 };
 
+struct parser_temp {
+	struct parser_temp *next;
+	void *data;
+};
 
 
 STATIC struct heredoc *heredoclist;	/* list of here documents to read */
@@ -94,6 +98,7 @@ STATIC struct heredoc *heredoc;
 STATIC int quoteflag;		/* set if (part of) last token was quoted */
 STATIC int startlinno;		/* line # where last token started */
 STATIC int funclinno;		/* line # where the current function started */
+STATIC struct parser_temp *parser_temp;
 
 /* XXX When 'noaliases' is set to one, no alias expansion takes place. */
 static int noaliases = 0;
@@ -117,6 +122,73 @@ STATIC void synerror(const char *);
 STATIC void setprompt(int);
 
 
+STATIC void *
+parser_temp_alloc(size_t len)
+{
+	struct parser_temp *t;
+
+	INTOFF;
+	t = ckmalloc(sizeof(*t));
+	t->data = NULL;
+	t->next = parser_temp;
+	parser_temp = t;
+	t->data = ckmalloc(len);
+	INTON;
+	return t->data;
+}
+
+
+STATIC void *
+parser_temp_realloc(void *ptr, size_t len)
+{
+	struct parser_temp *t;
+
+	INTOFF;
+	t = parser_temp;
+	if (ptr != t->data)
+		error("bug: parser_temp_realloc misused");
+	t->data = ckrealloc(t->data, len);
+	INTON;
+	return t->data;
+}
+
+
+STATIC void
+parser_temp_free_upto(void *ptr)
+{
+	struct parser_temp *t;
+	int done = 0;
+
+	INTOFF;
+	while (parser_temp != NULL && !done) {
+		t = parser_temp;
+		parser_temp = t->next;
+		done = t->data == ptr;
+		ckfree(t->data);
+		ckfree(t);
+	}
+	INTON;
+	if (!done)
+		error("bug: parser_temp_free_upto misused");
+}
+
+
+STATIC void
+parser_temp_free_all(void)
+{
+	struct parser_temp *t;
+
+	INTOFF;
+	while (parser_temp != NULL) {
+		t = parser_temp;
+		parser_temp = t->next;
+		ckfree(t->data);
+		ckfree(t);
+	}
+	INTON;
+}
+
+
 /*
  * Read and parse a command.  Returns NEOF on end of file.  (NULL is a
  * valid parse tree indicating a blank line.)
@@ -127,6 +199,11 @@ parsecmd(int interact)
 {
 	int t;
 
+	/* This assumes the parser is not re-entered,
+	 * which could happen if we add command substitution on PS1/PS2.
+	 */
+	parser_temp_free_all();
+
 	tokpushback = 0;
 	doprompt = interact;
 	if (doprompt)
@@ -863,6 +940,21 @@ breakloop:
 }
 
 
+#define MAXNEST_STATIC 8
+struct tokenstate
+{
+	const char *syntax; /* *SYNTAX */
+	int parenlevel; /* levels of parentheses in arithmetic */
+	enum tokenstate_category
+	{
+		TSTATE_TOP,
+		TSTATE_VAR_OLD, /* ${var+-=?}, inherits dquotes */
+		TSTATE_VAR_NEW, /* other ${var...}, own dquote state */
+		TSTATE_ARITH
+	} category;
+};
+
+
 /*
  * Called to parse command substitutions.
  */
@@ -1040,7 +1132,7 @@ done:
 #define	PARSEARITH()	{goto parsearith; parsearith_return:;}
 
 STATIC int
-readtoken1(int firstc, char const *syntax, char *eofmark, int striptabs)
+readtoken1(int firstc, char const *initialsyntax, char *eofmark, int striptabs)
 {
 	int c = firstc;
 	char *out;
@@ -1048,22 +1140,21 @@ readtoken1(int firstc, char const *synta
 	char line[EOFMARKLEN + 1];
 	struct nodelist *bqlist;
 	int quotef;
-	int dblquote;
-	int varnest;	/* levels of variables expansion */
-	int arinest;	/* levels of arithmetic expansion */
-	int parenlevel;	/* levels of parens in arithmetic */
-	char const *prevsyntax;	/* syntax before arithmetic */
+	int newvarnest;
+	int level;
 	int synentry;
+	struct tokenstate state_static[MAXNEST_STATIC];
+	int maxnest = MAXNEST_STATIC;
+	struct tokenstate *state = state_static;
 
 	startlinno = plinno;
-	dblquote = 0;
-	if (syntax == DQSYNTAX)
-		dblquote = 1;
 	quotef = 0;
 	bqlist = NULL;
-	varnest = 0;
-	arinest = 0;
-	parenlevel = 0;
+	newvarnest = 0;
+	level = 0;
+	state[level].syntax = initialsyntax;
+	state[level].parenlevel = 0;
+	state[level].category = TSTATE_TOP;
 
 	STARTSTACKSTR(out);
 	loop: {	/* for each line, until end of word */
@@ -1071,11 +1162,11 @@ readtoken1(int firstc, char const *synta
 		for (;;) {	/* until end of line or end of word */
 			CHECKSTRSPACE(3, out);	/* permit 3 calls to USTPUTC */
 
-			synentry = syntax[c];
+			synentry = state[level].syntax[c];
 
 			switch(synentry) {
 			case CNL:	/* '\n' */
-				if (syntax == BASESYNTAX)
+				if (state[level].syntax == BASESYNTAX)
 					goto endword;	/* exit outer loop */
 				USTPUTC(c, out);
 				plinno++;
@@ -1089,7 +1180,7 @@ readtoken1(int firstc, char const *synta
 				USTPUTC(c, out);
 				break;
 			case CCTL:
-				if (eofmark == NULL || dblquote)
+				if (eofmark == NULL || initialsyntax != SQSYNTAX)
 					USTPUTC(CTLESC, out);
 				USTPUTC(c, out);
 				break;
@@ -1105,41 +1196,37 @@ readtoken1(int firstc, char const *synta
 					else
 						setprompt(0);
 				} else {
-					if (dblquote && c != '\\' &&
-					    c != '`' && c != '$' &&
-					    (c != '"' || eofmark != NULL))
+					if (state[level].syntax == DQSYNTAX &&
+					    c != '\\' && c != '`' && c != '$' &&
+					    (c != '"' || (eofmark != NULL &&
+						newvarnest == 0)) &&
+					    (c != '}' || state[level].category != TSTATE_VAR_OLD))
 						USTPUTC('\\', out);
 					if (SQSYNTAX[c] == CCTL)
 						USTPUTC(CTLESC, out);
-					else if (eofmark == NULL)
+					else if (eofmark == NULL ||
+					    newvarnest > 0)
 						USTPUTC(CTLQUOTEMARK, out);
 					USTPUTC(c, out);
 					quotef++;
 				}
 				break;
 			case CSQUOTE:
-				if (eofmark == NULL)
-					USTPUTC(CTLQUOTEMARK, out);
-				syntax = SQSYNTAX;
+				USTPUTC(CTLQUOTEMARK, out);
+				state[level].syntax = SQSYNTAX;
 				break;
 			case CDQUOTE:
-				if (eofmark == NULL)
-					USTPUTC(CTLQUOTEMARK, out);
-				syntax = DQSYNTAX;
-				dblquote = 1;
+				USTPUTC(CTLQUOTEMARK, out);
+				state[level].syntax = DQSYNTAX;
 				break;
 			case CENDQUOTE:
-				if (eofmark != NULL && arinest == 0 &&
-				    varnest == 0) {
+				if (eofmark != NULL && newvarnest == 0)
 					USTPUTC(c, out);
-				} else {
-					if (arinest) {
-						syntax = ARISYNTAX;
-						dblquote = 0;
-					} else if (eofmark == NULL) {
-						syntax = BASESYNTAX;
-						dblquote = 0;
-					}
+				else {
+					if (state[level].category == TSTATE_ARITH)
+						state[level].syntax = ARISYNTAX;
+					else
+						state[level].syntax = BASESYNTAX;
 					quotef++;
 				}
 				break;
@@ -1147,30 +1234,33 @@ readtoken1(int firstc, char const *synta
 				PARSESUB();		/* parse substitution */
 				break;
 			case CENDVAR:	/* '}' */
-				if (varnest > 0) {
-					varnest--;
+				if (level > 0 &&
+				    (state[level].category == TSTATE_VAR_OLD ||
+				    state[level].category == TSTATE_VAR_NEW)) {
+					if (state[level].category == TSTATE_VAR_OLD)
+						state[level - 1].syntax = state[level].syntax;
+					else
+						newvarnest--;
+					level--;
 					USTPUTC(CTLENDVAR, out);
 				} else {
 					USTPUTC(c, out);
 				}
 				break;
 			case CLP:	/* '(' in arithmetic */
-				parenlevel++;
+				state[level].parenlevel++;
 				USTPUTC(c, out);
 				break;
 			case CRP:	/* ')' in arithmetic */
-				if (parenlevel > 0) {
+				if (state[level].parenlevel > 0) {
 					USTPUTC(c, out);
-					--parenlevel;
+					--state[level].parenlevel;
 				} else {
 					if (pgetc() == ')') {
-						if (--arinest == 0) {
+						if (level > 0 &&
+						    state[level].category == TSTATE_ARITH) {
+							level--;
 							USTPUTC(CTLENDARI, out);
-							syntax = prevsyntax;
-							if (syntax == DQSYNTAX)
-								dblquote = 1;
-							else
-								dblquote = 0;
 						} else
 							USTPUTC(')', out);
 					} else {
@@ -1184,13 +1274,15 @@ readtoken1(int firstc, char const *synta
 				}
 				break;
 			case CBQUOTE:	/* '`' */
-				out = parsebackq(out, &bqlist, 1, dblquote,
-						arinest || dblquote);
+				out = parsebackq(out, &bqlist, 1,
+				    state[level].syntax == DQSYNTAX &&
+				    (eofmark == NULL || newvarnest > 0),
+				    state[level].syntax == DQSYNTAX || state[level].syntax == ARISYNTAX);
 				break;
 			case CEOF:
 				goto endword;		/* exit outer loop */
 			default:
-				if (varnest == 0)
+				if (level == 0)
 					goto endword;	/* exit outer loop */
 				USTPUTC(c, out);
 			}
@@ -1198,14 +1290,17 @@ readtoken1(int firstc, char const *synta
 		}
 	}
 endword:
-	if (syntax == ARISYNTAX)
+	if (state[level].syntax == ARISYNTAX)
 		synerror("Missing '))'");
-	if (syntax != BASESYNTAX && eofmark == NULL)
+	if (state[level].syntax != BASESYNTAX && eofmark == NULL)
 		synerror("Unterminated quoted string");
-	if (varnest != 0) {
+	if (state[level].category == TSTATE_VAR_OLD ||
+	    state[level].category == TSTATE_VAR_NEW) {
 		startlinno = plinno;
 		synerror("Missing '}'");
 	}
+	if (state != state_static)
+		parser_temp_free_upto(state);
 	USTPUTC('\0', out);
 	len = out - stackblock();
 	out = stackblock();
@@ -1228,7 +1323,6 @@ endword:
 /* end of readtoken routine */
 
 
-
 /*
  * Check to see whether we are at the end of the here document.  When this
  * is called, c is set to the first character of the next input line.  If
@@ -1345,8 +1439,11 @@ parsesub: {
 			PARSEARITH();
 		} else {
 			pungetc();
-			out = parsebackq(out, &bqlist, 0, dblquote,
-					arinest || dblquote);
+			out = parsebackq(out, &bqlist, 0,
+			    state[level].syntax == DQSYNTAX &&
+			    (eofmark == NULL || newvarnest > 0),
+			    state[level].syntax == DQSYNTAX ||
+			    state[level].syntax == ARISYNTAX);
 		}
 	} else {
 		USTPUTC(CTLVAR, out);
@@ -1401,6 +1498,8 @@ parsesub: {
 				subtype = VSERROR;
 				if (c == '}')
 					pungetc();
+				else if (c == '\n' || c == PEOF)
+					synerror("Unexpected end of line in substitution");
 				else
 					USTPUTC(c, out);
 			} else {
@@ -1417,6 +1516,8 @@ parsesub: {
 			default:
 				p = strchr(types, c);
 				if (p == NULL) {
+					if (c == '\n' || c == PEOF)
+						synerror("Unexpected end of line in substitution");
 					if (flags == VSNUL)
 						STPUTC(':', out);
 					STPUTC(c, out);
@@ -1442,11 +1543,44 @@ parsesub: {
 			pungetc();
 		}
 		STPUTC('=', out);
-		if (subtype != VSLENGTH && (dblquote || arinest))
+		if (subtype != VSLENGTH && (state[level].syntax == DQSYNTAX ||
+		    state[level].syntax == ARISYNTAX))
 			flags |= VSQUOTE;
 		*(stackblock() + typeloc) = subtype | flags;
-		if (subtype != VSNORMAL)
-			varnest++;
+		if (subtype != VSNORMAL) {
+			if (level + 1 >= maxnest) {
+				maxnest *= 2;
+				if (state == state_static) {
+					state = parser_temp_alloc(
+					    maxnest * sizeof(*state));
+					memcpy(state, state_static,
+					    MAXNEST_STATIC * sizeof(*state));
+				} else
+					state = parser_temp_realloc(state,
+					    maxnest * sizeof(*state));
+			}
+			level++;
+			state[level].parenlevel = 0;
+			if (subtype == VSMINUS || subtype == VSPLUS ||
+			    subtype == VSQUESTION || subtype == VSASSIGN) {
+				/*
+				 * For operators that were in the Bourne shell,
+				 * inherit the double-quote state.
+				 */
+				state[level].syntax = state[level - 1].syntax;
+				state[level].category = TSTATE_VAR_OLD;
+			} else {
+				/*
+				 * The other operators take a pattern,
+				 * so go to BASESYNTAX.
+				 * Also, ' and " are now special, even
+				 * in here documents.
+				 */
+				state[level].syntax = BASESYNTAX;
+				state[level].category = TSTATE_VAR_NEW;
+				newvarnest++;
+			}
+		}
 	}
 	goto parsesub_return;
 }
@@ -1457,21 +1591,26 @@ parsesub: {
  */
 parsearith: {
 
-	if (++arinest == 1) {
-		prevsyntax = syntax;
-		syntax = ARISYNTAX;
-		USTPUTC(CTLARI, out);
-		if (dblquote)
-			USTPUTC('"',out);
-		else
-			USTPUTC(' ',out);
-	} else {
-		/*
-		 * we collapse embedded arithmetic expansion to
-		 * parenthesis, which should be equivalent
-		 */
-		USTPUTC('(', out);
+	if (level + 1 >= maxnest) {
+		maxnest *= 2;
+		if (state == state_static) {
+			state = parser_temp_alloc(
+			    maxnest * sizeof(*state));
+			memcpy(state, state_static,
+			    MAXNEST_STATIC * sizeof(*state));
+		} else
+			state = parser_temp_realloc(state,
+			    maxnest * sizeof(*state));
 	}
+	level++;
+	state[level].syntax = ARISYNTAX;
+	state[level].parenlevel = 0;
+	state[level].category = TSTATE_ARITH;
+	USTPUTC(CTLARI, out);
+	if (state[level - 1].syntax == DQSYNTAX)
+		USTPUTC('"',out);
+	else
+		USTPUTC(' ',out);
 	goto parsearith_return;
 }
 

Modified: user/kib/vm6/bin/sh/sh.1
==============================================================================
--- user/kib/vm6/bin/sh/sh.1	Mon Apr 19 19:25:17 2010	(r206855)
+++ user/kib/vm6/bin/sh/sh.1	Mon Apr 19 19:29:33 2010	(r206856)

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

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:49:39 2010
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 B49F11065689;
	Mon, 19 Apr 2010 19:49:39 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A37E78FC21;
	Mon, 19 Apr 2010 19:49:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJndow098406;
	Mon, 19 Apr 2010 19:49:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJndQf098404;
	Mon, 19 Apr 2010 19:49:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004191949.o3JJndQf098404@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:49:39 +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: r206857 - user/jmallett/octeon/sys/mips/mips
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, 19 Apr 2010 19:49:39 -0000

Author: jmallett
Date: Mon Apr 19 19:49:39 2010
New Revision: 206857
URL: http://svn.freebsd.org/changeset/base/206857

Log:
  Finally hit a pmap_kenter() of a still-valid address with a different mapping.
  Would be useful to track that down at some point.

Modified:
  user/jmallett/octeon/sys/mips/mips/pmap.c

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 19:29:33 2010	(r206856)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 19:49:39 2010	(r206857)
@@ -719,7 +719,7 @@ pmap_extract_and_hold(pmap_t pmap, vm_of
 pmap_kenter(vm_offset_t va, vm_paddr_t pa)
 {
 	pt_entry_t *pte;
-	pt_entry_t npte;
+	pt_entry_t opte, npte;
 
 #ifdef PMAP_DEBUG
 	printf("pmap_kenter:  va: %p -> pa: %p\n", (void *)va, (void *)pa);
@@ -732,9 +732,13 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p
 		npte |= PG_C_UC;
 
 	pte = pmap_pte(kernel_pmap, va);
-	KASSERT(!pte_test(pte, PG_V) || *pte == npte,
-		("pmap_kenter for %p with different valid entry", (void *)va));
+	opte = *pte;
 	*pte = npte;
+
+	if (pte_test(pte, PG_V) && opte != npte) {
+		/* XXX dcache wbinv?  */
+		pmap_update_page(kernel_pmap, va, npte);
+	}
 }
 
 /*

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 19:50:39 2010
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 A9D731065678;
	Mon, 19 Apr 2010 19:50:39 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 98F018FC12;
	Mon, 19 Apr 2010 19:50:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JJodQ2098646;
	Mon, 19 Apr 2010 19:50:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JJodwn098644;
	Mon, 19 Apr 2010 19:50:39 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004191950.o3JJodwn098644@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Mon, 19 Apr 2010 19:50:39 +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: r206858 - user/jmallett/octeon/sys/mips/mips
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, 19 Apr 2010 19:50:39 -0000

Author: jmallett
Date: Mon Apr 19 19:50:39 2010
New Revision: 206858
URL: http://svn.freebsd.org/changeset/base/206858

Log:
  Check the right valid bit.

Modified:
  user/jmallett/octeon/sys/mips/mips/pmap.c

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 19:49:39 2010	(r206857)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Mon Apr 19 19:50:39 2010	(r206858)
@@ -735,7 +735,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t p
 	opte = *pte;
 	*pte = npte;
 
-	if (pte_test(pte, PG_V) && opte != npte) {
+	if (pte_test(&opte, PG_V) && opte != npte) {
 		/* XXX dcache wbinv?  */
 		pmap_update_page(kernel_pmap, va, npte);
 	}

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 20:08:19 2010
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 15A94106566C;
	Mon, 19 Apr 2010 20:08:19 +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 04CE68FC31;
	Mon, 19 Apr 2010 20:08:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JK8I41002769;
	Mon, 19 Apr 2010 20:08:18 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JK8IBe002767;
	Mon, 19 Apr 2010 20:08:18 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192008.o3JK8IBe002767@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 20:08:18 +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: r206860 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 19 Apr 2010 20:08:19 -0000

Author: kmacy
Date: Mon Apr 19 20:08:18 2010
New Revision: 206860
URL: http://svn.freebsd.org/changeset/base/206860

Log:
  ensure that the page lock is held in pmap_remove_pde when setting/clearing flags

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 20:07:35 2010	(r206859)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 20:08:18 2010	(r206860)
@@ -2762,17 +2762,21 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		eva = sva + NBPDR;
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
 		    va < eva; va += PAGE_SIZE, m++) {
-			/*
-			 * XXX do we need to individually lock each page? 
-			 *
-			 */
-			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
-				vm_page_dirty(m);
-			if (oldpde & PG_A)
-				vm_page_flag_set(m, PG_REFERENCED);
-			if (TAILQ_EMPTY(&m->md.pv_list) &&
-			    TAILQ_EMPTY(&pvh->pv_list))
-				vm_page_flag_clear(m, PG_WRITEABLE);
+
+			if ((oldpde & (PG_M | PG_RW | PG_A)) ||
+			    (TAILQ_EMPTY(&m->md.pv_list) &&
+				TAILQ_EMPTY(&pvh->pv_list))) {
+				vm_page_lock(m);
+			
+				if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
+					vm_page_dirty(m);
+				if (oldpde & PG_A)
+					vm_page_flag_set(m, PG_REFERENCED);
+				if (TAILQ_EMPTY(&m->md.pv_list) &&
+				    TAILQ_EMPTY(&pvh->pv_list))
+					vm_page_flag_clear(m, PG_WRITEABLE);
+				vm_page_unlock(m);
+			}
 		}
 	}
 	if (pmap == kernel_pmap) {

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 20:41:14 2010
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 301A41065673;
	Mon, 19 Apr 2010 20:41:14 +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 1FB438FC29;
	Mon, 19 Apr 2010 20:41:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JKfEWA010050;
	Mon, 19 Apr 2010 20:41:14 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JKfEBD010048;
	Mon, 19 Apr 2010 20:41:14 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192041.o3JKfEBD010048@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 20:41:14 +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: r206861 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 20:41:14 -0000

Author: kmacy
Date: Mon Apr 19 20:41:13 2010
New Revision: 206861
URL: http://svn.freebsd.org/changeset/base/206861

Log:
  fix vm_pageout for the !VM_PAGE_LOCK case

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 20:08:18 2010	(r206860)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 20:41:13 2010	(r206861)
@@ -1043,7 +1043,7 @@ rescan0:
 			}
 			vm_page_lock_queues();
 unlock_and_continue:
-			vm_page_lock_assert(m, MA_NOTOWNED);
+			vm_page_lock_queues_assert_notowned();
 			VM_OBJECT_UNLOCK(object);
 			if (mp != NULL) {
 				vm_page_unlock_queues();

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 21:29:42 2010
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 8B3AF106566C;
	Mon, 19 Apr 2010 21:29:42 +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 7A4018FC0C;
	Mon, 19 Apr 2010 21:29:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JLTgos021286;
	Mon, 19 Apr 2010 21:29:42 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JLTgrB021284;
	Mon, 19 Apr 2010 21:29:42 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192129.o3JLTgrB021284@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 21:29:42 +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: r206873 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 19 Apr 2010 21:29:42 -0000

Author: kmacy
Date: Mon Apr 19 21:29:42 2010
New Revision: 206873
URL: http://svn.freebsd.org/changeset/base/206873

Log:
  fix style(9) inconsistency

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 21:02:54 2010	(r206872)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 21:29:42 2010	(r206873)
@@ -388,7 +388,7 @@ pmap_kmem_choose(vm_offset_t addr)
 	vm_offset_t newaddr = addr;
 
 	newaddr = (addr + (NBPDR - 1)) & ~(NBPDR - 1);
-	return newaddr;
+	return (newaddr);
 }
 
 /********************/
@@ -399,7 +399,7 @@ pmap_kmem_choose(vm_offset_t addr)
 static __inline vm_pindex_t
 pmap_pde_pindex(vm_offset_t va)
 {
-	return va >> PDRSHIFT;
+	return (va >> PDRSHIFT);
 }
 
 
@@ -458,7 +458,7 @@ pmap_pdpe(pmap_t pmap, vm_offset_t va)
 
 	pml4e = pmap_pml4e(pmap, va);
 	if ((*pml4e & PG_V) == 0)
-		return NULL;
+		return (NULL);
 	return (pmap_pml4e_to_pdpe(pml4e, va));
 }
 
@@ -480,7 +480,7 @@ pmap_pde(pmap_t pmap, vm_offset_t va)
 
 	pdpe = pmap_pdpe(pmap, va);
 	if (pdpe == NULL || (*pdpe & PG_V) == 0)
-		 return NULL;
+		return (NULL);
 	return (pmap_pdpe_to_pde(pdpe, va));
 }
 
@@ -502,7 +502,7 @@ pmap_pte(pmap_t pmap, vm_offset_t va)
 
 	pde = pmap_pde(pmap, va);
 	if (pde == NULL || (*pde & PG_V) == 0)
-		return NULL;
+		return (NULL);
 	if ((*pde & PG_PS) != 0)	/* compat with i386 pmap_pte() */
 		return ((pt_entry_t *)pde);
 	return (pmap_pde_to_pte(pde, va));
@@ -547,7 +547,7 @@ pa_tryrelock(pmap_t pmap, vm_paddr_t pa,
 		PA_UNLOCK(lockpa);
 	}
 	if (PA_TRYLOCK(pa))
-		return 0;
+		return (0);
 	PMAP_UNLOCK(pmap);
 	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
 	PA_LOCK(pa);
@@ -1395,7 +1395,7 @@ pmap_kextract(vm_offset_t va)
 			pa = (pa & PG_FRAME) | (va & PAGE_MASK);
 		}
 	}
-	return pa;
+	return (pa);
 }
 
 /***************************************************
@@ -1625,9 +1625,9 @@ pmap_unwire_pte_hold(pmap_t pmap, vm_off
 
 	--m->wire_count;
 	if (m->wire_count == 0)
-		return _pmap_unwire_pte_hold(pmap, va, m, free);
+		return (_pmap_unwire_pte_hold(pmap, va, m, free));
 	else
-		return 0;
+		return (0);
 }
 
 static int 
@@ -1635,6 +1635,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of
     vm_page_t *free)
 {
 
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	/*
 	 * unmap the page table page
 	 */
@@ -1654,7 +1655,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of
 		pd = pmap_pde(pmap, va);
 		*pd = 0;
 	}
-	--pmap->pm_stats.resident_count;
+	pmap->pm_stats.resident_count--;
 	if (m->pindex < NUPDE) {
 		/* We just released a PT, unhold the matching PD */
 		vm_page_t pdpg;
@@ -1683,7 +1684,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of
 	 */
 	pmap_add_delayed_free_list(m, free, TRUE);
 	
-	return 1;
+	return (1);
 }
 
 /*
@@ -1696,10 +1697,10 @@ pmap_unuse_pt(pmap_t pmap, vm_offset_t v
 	vm_page_t mpte;
 
 	if (va >= VM_MAXUSER_ADDRESS)
-		return 0;
+		return (0);
 	KASSERT(ptepde != 0, ("pmap_unuse_pt: ptepde != 0"));
 	mpte = PHYS_TO_VM_PAGE(ptepde & PG_FRAME);
-	return pmap_unwire_pte_hold(pmap, va, mpte, free);
+	return (pmap_unwire_pte_hold(pmap, va, mpte, free));
 }
 
 void
@@ -1771,6 +1772,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p
 	    (flags & (M_NOWAIT | M_WAITOK)) == M_WAITOK,
 	    ("_pmap_allocpte: flags is neither M_NOWAIT nor M_WAITOK"));
 
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	/*
 	 * Allocate a page table page.
 	 */
@@ -1890,7 +1892,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p
 
 	pmap->pm_stats.resident_count++;
 
-	return m;
+	return (m);
 }
 
 static vm_page_t
@@ -2198,6 +2200,7 @@ pmap_collect(pmap_t locked_pmap, struct 
 				PMAP_LOCK(pmap);
 			else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap))
 				continue;
+			PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 			pmap->pm_stats.resident_count--;
 			pde = pmap_pde(pmap, va);
 			KASSERT((*pde & PG_PS) == 0, ("pmap_collect: found"
@@ -2662,7 +2665,9 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 			pmap->pm_stats.resident_count++;
 	}
 	if (TAILQ_EMPTY(pv_list) && ((oldpde & PG_MANAGED) != 0)) {
-		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE)
+		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE) {
+			if (mpte == NULL && (va < VM_MAXUSER_ADDRESS))
+				pmap->pm_stats.resident_count--;
 			return (FALSE);
 	}
 	mptepa = VM_PAGE_TO_PHYS(mpte);
@@ -2818,7 +2823,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t 
 	 */
 	if (oldpte & PG_G)
 		pmap_invalidate_page(kernel_pmap, va);
-	pmap->pm_stats.resident_count -= 1;
+	pmap->pm_stats.resident_count--;
 	if (oldpte & PG_MANAGED) {
 		m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
 		vm_page_lock_assert(m, MA_OWNED);
@@ -3503,15 +3508,15 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 			ls_push(&ls, PMAP_LOCKPTR(pmap));
 		}
 	}
-	
-restart:
+
 	/*
 	 * In the case that a page table page is not
 	 * resident, we are creating it here.
 	 */
-	if (va < VM_MAXUSER_ADDRESS && mpte == NULL)
+	if (va < VM_MAXUSER_ADDRESS)
 		mpte = pmap_allocpte(pmap, lockedpa, va, M_WAITOK);
 
+restart:
 	pde = pmap_pde(pmap, va);
 	if (pde != NULL && (*pde & PG_V) != 0) {
 		if ((*pde & PG_PS) != 0)
@@ -3917,7 +3922,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 		pte_store(pte, pa | PG_V | PG_U);
 	else
 		pte_store(pte, pa | PG_V | PG_U | PG_MANAGED);
-	return mpte;
+	return (mpte);
 }
 
 /*
@@ -4311,12 +4316,12 @@ pmap_page_exists_quick(pmap_t pmap, vm_p
 	int loops = 0;
 
 	if (m->flags & PG_FICTITIOUS)
-		return FALSE;
+		return (FALSE);
 
 	vm_page_lock_assert(m, MA_OWNED);
 	TAILQ_FOREACH(pv, &m->md.pv_list, pv_list) {
 		if (PV_PMAP(pv) == pmap) {
-			return TRUE;
+			return (TRUE);
 		}
 		loops++;
 		if (loops >= 16)
@@ -5312,7 +5317,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 	if (pte != 0) {
 		val |= MINCORE_INCORE;
 		if ((pte & PG_MANAGED) == 0)
-			return val;
+			return (val);
 
 		m = PHYS_TO_VM_PAGE(pa);
 
@@ -5348,7 +5353,7 @@ pmap_mincore(pmap_t pmap, vm_offset_t ad
 			vm_page_unlock(m);
 		}
 	} 
-	return val;
+	return (val);
 }
 
 void

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 22:00:35 2010
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 88E7F1065673;
	Mon, 19 Apr 2010 22:00:35 +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 7909B8FC08;
	Mon, 19 Apr 2010 22:00:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JM0Z2f028127;
	Mon, 19 Apr 2010 22:00:35 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JM0ZqC028125;
	Mon, 19 Apr 2010 22:00:35 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192200.o3JM0ZqC028125@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 22:00:35 +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: r206874 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 22:00:35 -0000

Author: kmacy
Date: Mon Apr 19 22:00:35 2010
New Revision: 206874
URL: http://svn.freebsd.org/changeset/base/206874

Log:
  only assert that page lock is not held if we aren't shimming to the page queue mutex

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 21:29:42 2010	(r206873)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 22:00:35 2010	(r206874)
@@ -1057,7 +1057,9 @@ unlock_and_continue:
 			next = TAILQ_NEXT(&marker, pageq);
 			TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl,
 				     &marker, pageq);
+#ifdef VM_PAGE_LOCK
 			vm_page_lock_assert(m, MA_NOTOWNED);
+#endif			
 			continue;
 		}
 		vm_page_unlock(m);

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 22:01:59 2010
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 E30B3106564A;
	Mon, 19 Apr 2010 22:01:59 +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 D26B08FC12;
	Mon, 19 Apr 2010 22:01:59 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JM1xx1028464;
	Mon, 19 Apr 2010 22:01:59 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JM1xkJ028462;
	Mon, 19 Apr 2010 22:01:59 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192201.o3JM1xkJ028462@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 22:01:59 +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: r206875 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 19 Apr 2010 22:02:00 -0000

Author: kmacy
Date: Mon Apr 19 22:01:59 2010
New Revision: 206875
URL: http://svn.freebsd.org/changeset/base/206875

Log:
  ensure that the pmap lock is always held when modifying resident count

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 22:00:35 2010	(r206874)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Mon Apr 19 22:01:59 2010	(r206875)
@@ -314,7 +314,6 @@ ls_init(struct lock_stack *ls)
 	ls->ls_top = 0;
 }
 
-
 #define ls_push(ls, m)	_ls_push((ls), (m), LOCK_FILE, LOCK_LINE)
 
 static void
@@ -508,6 +507,21 @@ pmap_pte(pmap_t pmap, vm_offset_t va)
 	return (pmap_pde_to_pte(pde, va));
 }
 
+static __inline void
+pmap_resident_count_inc(pmap_t pmap, int count)
+{
+
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	pmap->pm_stats.resident_count += count;
+}
+
+static __inline void
+pmap_resident_count_dec(pmap_t pmap, int count)
+{
+
+	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	pmap->pm_stats.resident_count -= count;
+}
 
 PMAP_INLINE pt_entry_t *
 vtopte(vm_offset_t va)
@@ -1655,7 +1669,7 @@ _pmap_unwire_pte_hold(pmap_t pmap, vm_of
 		pd = pmap_pde(pmap, va);
 		*pd = 0;
 	}
-	pmap->pm_stats.resident_count--;
+	pmap_resident_count_dec(pmap, 1);
 	if (m->pindex < NUPDE) {
 		/* We just released a PT, unhold the matching PD */
 		vm_page_t pdpg;
@@ -1889,8 +1903,7 @@ _pmap_allocpte(pmap_t pmap, vm_paddr_t p
 		pd = &pd[ptepindex & ((1ul << NPDEPGSHIFT) - 1)];
 		*pd = VM_PAGE_TO_PHYS(m) | PG_U | PG_RW | PG_V | PG_A | PG_M;
 	}
-
-	pmap->pm_stats.resident_count++;
+	pmap_resident_count_inc(pmap, 1);
 
 	return (m);
 }
@@ -2201,7 +2214,7 @@ pmap_collect(pmap_t locked_pmap, struct 
 			else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap))
 				continue;
 			PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-			pmap->pm_stats.resident_count--;
+			pmap_resident_count_dec(pmap, 1);
 			pde = pmap_pde(pmap, va);
 			KASSERT((*pde & PG_PS) == 0, ("pmap_collect: found"
 			    " a 2mpage in page %p's pv list", m));
@@ -2662,13 +2675,14 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 			return (FALSE);
 		}
 		if (va < VM_MAXUSER_ADDRESS)
-			pmap->pm_stats.resident_count++;
+			pmap_resident_count_inc(pmap, 1);
 	}
 	if (TAILQ_EMPTY(pv_list) && ((oldpde & PG_MANAGED) != 0)) {
 		if (pmap_pv_list_try_alloc(pmap, NPTEPG-1, pv_list) == FALSE) {
 			if (mpte == NULL && (va < VM_MAXUSER_ADDRESS))
-				pmap->pm_stats.resident_count--;
+				pmap_resident_count_dec(pmap, 1);
 			return (FALSE);
+		}
 	}
 	mptepa = VM_PAGE_TO_PHYS(mpte);
 	firstpte = (pt_entry_t *)PHYS_TO_DMAP(mptepa);
@@ -2734,6 +2748,7 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 	    " in pmap %p", va, pmap);
 	return (TRUE);
 }
+	
 
 /*
  * pmap_remove_pde: do the things to unmap a superpage in a process
@@ -2760,7 +2775,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 	 */
 	if (oldpde & PG_G)
 		pmap_invalidate_page(kernel_pmap, sva);
-	pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
+	pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
 	if (oldpde & PG_MANAGED) {
 		pvh = pa_to_pvh(oldpde & PG_PS_FRAME);
 		pmap_pvh_free(pvh, pmap, sva);
@@ -2791,7 +2806,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		mpte = pmap_lookup_pt_page(pmap, sva);
 		if (mpte != NULL) {
 			pmap_remove_pt_page(pmap, mpte);
-			pmap->pm_stats.resident_count--;
+			pmap_resident_count_dec(pmap, 1);
 			KASSERT(mpte->wire_count == NPTEPG,
 			    ("pmap_remove_pde: pte page wire count error"));
 			mpte->wire_count = 0;
@@ -2823,7 +2838,7 @@ pmap_remove_pte(pmap_t pmap, pt_entry_t 
 	 */
 	if (oldpte & PG_G)
 		pmap_invalidate_page(kernel_pmap, va);
-	pmap->pm_stats.resident_count--;
+	pmap_resident_count_dec(pmap, 1);
 	if (oldpte & PG_MANAGED) {
 		m = PHYS_TO_VM_PAGE(oldpte & PG_FRAME);
 		vm_page_lock_assert(m, MA_OWNED);
@@ -3135,7 +3150,7 @@ pmap_remove_all(vm_page_t m)
 	while ((pv = TAILQ_FIRST(&m->md.pv_list)) != NULL) {
 		pmap = PV_PMAP(pv);
 		PMAP_LOCK(pmap);
-		pmap->pm_stats.resident_count--;
+		pmap_resident_count_dec(pmap, 1);
 		pde = pmap_pde(pmap, pv->pv_va);
 		KASSERT((*pde & PG_PS) == 0, ("pmap_remove_all: found"
 		    " a 2mpage in page %p's pv list", m));
@@ -3605,7 +3620,7 @@ restart:
 			     " va: 0x%lx", va));
 		}
 	} else
-		pmap->pm_stats.resident_count++;
+		pmap_resident_count_inc(pmap, 1);
 
 	/*
 	 * Enter on the PV list if part of our managed memory.
@@ -3751,7 +3766,7 @@ pmap_enter_pde(pmap_t pmap, vm_offset_t 
 	/*
 	 * Increment counters.
 	 */
-	pmap->pm_stats.resident_count += NBPDR / PAGE_SIZE;
+	pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE);
 
 	/*
 	 * Map the superpage.
@@ -3909,7 +3924,7 @@ pmap_enter_quick_locked(pmap_t pmap, vm_
 	/*
 	 * Increment counters
 	 */
-	pmap->pm_stats.resident_count++;
+	pmap_resident_count_inc(pmap, 1);
 
 	pa = VM_PAGE_TO_PHYS(m) | pmap_cache_bits(m->md.pat_mode, 0);
 	if ((prot & VM_PROT_EXECUTE) == 0)
@@ -4015,8 +4030,7 @@ pmap_object_init_pt(pmap_t pmap, vm_offs
 			if ((*pde & PG_V) == 0) {
 				pde_store(pde, pa | PG_PS | PG_M | PG_A |
 				    PG_U | PG_RW | PG_V);
-				pmap->pm_stats.resident_count += NBPDR /
-				    PAGE_SIZE;
+				pmap_resident_count_inc(pmap, NBPDR / PAGE_SIZE);
 				pmap_pde_mappings++;
 			} else {
 				/* Continue on if the PDE is already valid. */
@@ -4169,8 +4183,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 			    pmap_pv_insert_pde(dst_pmap, addr, srcptepaddr &
 			    PG_PS_FRAME))) {
 				*pde = srcptepaddr & ~PG_W;
-				dst_pmap->pm_stats.resident_count +=
-				    NBPDR / PAGE_SIZE;
+				pmap_resident_count_inc(dst_pmap, NBPDR / PAGE_SIZE);
 			} else
 				dstmpde->wire_count--;
 			PA_UNLOCK(pa);
@@ -4219,7 +4232,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 					 */
 					*dst_pte = ptetemp & ~(PG_W | PG_M |
 					    PG_A);
-					dst_pmap->pm_stats.resident_count++;
+					pmap_resident_count_inc(dst_pmap, 1);
 	 			} else {
 					free = NULL;
 					if (pmap_unwire_pte_hold(dst_pmap,
@@ -4499,7 +4512,7 @@ restart:
 				atomic_add_int(&pv_entry_count, -1);
 				pc->pc_map[field] |= bitmask;
 				if ((tpte & PG_PS) != 0) {
-					pmap->pm_stats.resident_count -= NBPDR / PAGE_SIZE;
+					pmap_resident_count_dec(pmap, NBPDR / PAGE_SIZE);
 					pvh = pa_to_pvh(tpte & PG_PS_FRAME);
 					TAILQ_REMOVE(&pvh->pv_list, pv, pv_list);
 					if (TAILQ_EMPTY(&pvh->pv_list)) {
@@ -4510,7 +4523,7 @@ restart:
 					mpte = pmap_lookup_pt_page(pmap, pv->pv_va);
 					if (mpte != NULL) {
 						pmap_remove_pt_page(pmap, mpte);
-						pmap->pm_stats.resident_count--;
+						pmap_resident_count_dec(pmap, 1);	
 						KASSERT(mpte->wire_count == NPTEPG,
 						    ("pmap_remove_pages: pte page wire count error"));
 						mpte->wire_count = 0;
@@ -4518,7 +4531,7 @@ restart:
 						atomic_subtract_int(&cnt.v_wire_count, 1);
 					}
 				} else {
-					pmap->pm_stats.resident_count--;
+					pmap_resident_count_dec(pmap, 1);
 					TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
 					if (TAILQ_EMPTY(&m->md.pv_list)) {
 						pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));

From owner-svn-src-user@FreeBSD.ORG  Mon Apr 19 22:15:41 2010
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 D9DA01065670;
	Mon, 19 Apr 2010 22:15:41 +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 A78FA8FC19;
	Mon, 19 Apr 2010 22:15:40 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3JMFeIh031748;
	Mon, 19 Apr 2010 22:15:40 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3JMFeKB031745;
	Mon, 19 Apr 2010 22:15:40 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004192215.o3JMFeKB031745@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Mon, 19 Apr 2010 22:15:40 +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: r206877 - user/kmacy/head_page_lock_2/sys/vm
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, 19 Apr 2010 22:15:42 -0000

Author: kmacy
Date: Mon Apr 19 22:15:40 2010
New Revision: 206877
URL: http://svn.freebsd.org/changeset/base/206877

Log:
  fix mistake in sanity check change to pageout

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_page.h
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Mon Apr 19 22:10:40 2010	(r206876)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Mon Apr 19 22:15:40 2010	(r206877)
@@ -276,9 +276,11 @@ extern struct vpglocks vm_page_queue_loc
 #ifdef VM_PAGE_LOCK
 #define	vm_page_lockptr(m)		pmap_page_lockptr(m)
 #define	vm_page_lock_queues_assert_notowned()   mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED)
+#define	vm_page_lock_assert_notowned(m)   vm_page_lock_assert((m), MA_NOTOWNED)
 #else
 #define	vm_page_lockptr(m)		(&vm_page_queue_mtx)
-#define	vm_page_lock_queues_assert_notowned()   
+#define	vm_page_lock_queues_assert_notowned()
+#define	vm_page_lock_assert_notowned()  
 #endif
 #define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m)))
 #define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m)))

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 22:10:40 2010	(r206876)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Mon Apr 19 22:15:40 2010	(r206877)
@@ -1043,7 +1043,7 @@ rescan0:
 			}
 			vm_page_lock_queues();
 unlock_and_continue:
-			vm_page_lock_queues_assert_notowned();
+			vm_page_lock_assert_notowned(m);
 			VM_OBJECT_UNLOCK(object);
 			if (mp != NULL) {
 				vm_page_unlock_queues();
@@ -1057,9 +1057,7 @@ unlock_and_continue:
 			next = TAILQ_NEXT(&marker, pageq);
 			TAILQ_REMOVE(&vm_page_queues[PQ_INACTIVE].pl,
 				     &marker, pageq);
-#ifdef VM_PAGE_LOCK
-			vm_page_lock_assert(m, MA_NOTOWNED);
-#endif			
+			vm_page_lock_assert_notowned(m);
 			continue;
 		}
 		vm_page_unlock(m);

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 03:02:55 2010
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 00228106566B;
	Tue, 20 Apr 2010 03:02:54 +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 E477F8FC12;
	Tue, 20 Apr 2010 03:02:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K32s6X095061;
	Tue, 20 Apr 2010 03:02:54 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K32sI0095059;
	Tue, 20 Apr 2010 03:02:54 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004200302.o3K32sI0095059@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 03:02: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: r206883 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 03:02:55 -0000

Author: kmacy
Date: Tue Apr 20 03:02:54 2010
New Revision: 206883
URL: http://svn.freebsd.org/changeset/base/206883

Log:
  remove gratuitous local variable checking pmap_remove_pte

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 01:25:18 2010	(r206882)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 03:02:54 2010	(r206883)
@@ -3076,7 +3076,6 @@ restart:
 
 		for (pte = pmap_pde_to_pte(pde, sva); sva != va_next; pte++,
 		    sva += PAGE_SIZE) {
-			int ret;
 
 			if (*pte == 0)
 				continue;
@@ -3091,9 +3090,7 @@ restart:
 			 */
 			if ((*pte & PG_G) == 0)
 				anyvalid = 1;
-			ret = pmap_remove_pte(pmap, pte, sva, ptpaddr, &free);
-
-			if (ret)
+			if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free))
 				break;
 		}
 	}

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 03:20:20 2010
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 DBC861065672;
	Tue, 20 Apr 2010 03:20:20 +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 CC1EF8FC2A;
	Tue, 20 Apr 2010 03:20:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K3KKxe098992;
	Tue, 20 Apr 2010 03:20:20 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K3KKKx098990;
	Tue, 20 Apr 2010 03:20:20 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004200320.o3K3KKKx098990@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 03:20:20 +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: r206884 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 03:20:20 -0000

Author: kmacy
Date: Tue Apr 20 03:20:20 2010
New Revision: 206884
URL: http://svn.freebsd.org/changeset/base/206884

Log:
  in pmap_protect only call tryrelock if the page is managed and either the accessed or modified bit is set

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 03:02:54 2010	(r206883)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 03:20:20 2010	(r206884)
@@ -3317,21 +3317,18 @@ retry:
 			obits = pbits = *pte;
 			if ((pbits & PG_V) == 0)
 				continue;
-			if (pbits & PG_MANAGED) {
-				m = NULL;
+			if ((pbits & PG_MANAGED) &&
+			    (pbits & (PG_M | PG_A))) {
 				if (pa_tryrelock(pmap, pbits & PG_FRAME, &pa))
 					goto restart;
+
+				m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
 				if (pbits & PG_A) {
-					m = PHYS_TO_VM_PAGE(pbits & PG_FRAME);
 					vm_page_flag_set(m, PG_REFERENCED);
 					pbits &= ~PG_A;
 				}
-				if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW)) {
-					if (m == NULL)
-						m = PHYS_TO_VM_PAGE(pbits &
-						    PG_FRAME);
+				if ((pbits & (PG_M | PG_RW)) == (PG_M | PG_RW))
 					vm_page_dirty(m);
-				}
 			}
 
 			if ((prot & VM_PROT_WRITE) == 0)

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 04:37:07 2010
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 ADC981065672;
	Tue, 20 Apr 2010 04:37:07 +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 9DAF88FC12;
	Tue, 20 Apr 2010 04:37:07 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K4b7w4015965;
	Tue, 20 Apr 2010 04:37:07 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K4b7EW015964;
	Tue, 20 Apr 2010 04:37:07 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004200437.o3K4b7EW015964@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 04:37:07 +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: r206886 - user/kmacy/head_page_lock_2/sys/vm
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, 20 Apr 2010 04:37:07 -0000

Author: kmacy
Date: Tue Apr 20 04:37:07 2010
New Revision: 206886
URL: http://svn.freebsd.org/changeset/base/206886

Log:
  The busy flag is protected by the object lock, don't need to hold page lock across it
  
  Pointed out by: alc@

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_object.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_object.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Tue Apr 20 04:16:39 2010	(r206885)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_object.c	Tue Apr 20 04:37:07 2010	(r206886)
@@ -1445,9 +1445,9 @@ retry:
 		}
 		vm_page_lock(m);
 		vm_page_rename(m, new_object, idx);
+		vm_page_unlock(m);
 		/* page automatically made dirty by rename and cache handled */
 		vm_page_busy(m);
-		vm_page_unlock(m);
 	}
 	if (orig_object->type == OBJT_SWAP) {
 		/*

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 06:04:56 2010
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 3A6A3106566C;
	Tue, 20 Apr 2010 06:04:56 +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 29ED08FC1A;
	Tue, 20 Apr 2010 06:04:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K64tBY035267;
	Tue, 20 Apr 2010 06:04:56 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K64tk7035266;
	Tue, 20 Apr 2010 06:04:55 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004200604.o3K64tk7035266@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 06:04:55 +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: r206887 - user/kmacy/head_page_lock_2/sys/vm
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, 20 Apr 2010 06:04:56 -0000

Author: kmacy
Date: Tue Apr 20 06:04:55 2010
New Revision: 206887
URL: http://svn.freebsd.org/changeset/base/206887

Log:
  fix typo in vm_page_lock_assert_notowned for the !VM_PAGE_LOCK case

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_page.h

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 20 04:37:07 2010	(r206886)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 20 06:04:55 2010	(r206887)
@@ -280,7 +280,7 @@ extern struct vpglocks vm_page_queue_loc
 #else
 #define	vm_page_lockptr(m)		(&vm_page_queue_mtx)
 #define	vm_page_lock_queues_assert_notowned()
-#define	vm_page_lock_assert_notowned()  
+#define	vm_page_lock_assert_notowned(m)  
 #endif
 #define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m)))
 #define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m)))

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 06:08:34 2010
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 BE5431065673;
	Tue, 20 Apr 2010 06:08:34 +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 ADA258FC08;
	Tue, 20 Apr 2010 06:08:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3K68Y8m036093;
	Tue, 20 Apr 2010 06:08:34 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3K68Ys6036091;
	Tue, 20 Apr 2010 06:08:34 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004200608.o3K68Ys6036091@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 06:08:34 +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: r206888 - user/kmacy/head_page_lock_2/sys/vm
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, 20 Apr 2010 06:08:34 -0000

Author: kmacy
Date: Tue Apr 20 06:08:34 2010
New Revision: 206888
URL: http://svn.freebsd.org/changeset/base/206888

Log:
  the re-introduction of pmap_release causes pain under page lock

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_map.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_map.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_map.c	Tue Apr 20 06:04:55 2010	(r206887)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_map.c	Tue Apr 20 06:08:34 2010	(r206888)
@@ -330,8 +330,10 @@ vmspace_dofree(struct vmspace *vm)
 	(void)vm_map_remove(&vm->vm_map, vm->vm_map.min_offset,
 	    vm->vm_map.max_offset);
 
+#ifndef VM_PAGE_LOCK
 	pmap_release(vmspace_pmap(vm));
 	vm->vm_map.pmap = NULL;
+#endif	
 	uma_zfree(vmspace_zone, vm);
 }
 

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 18:44:23 2010
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 E5A62106566C;
	Tue, 20 Apr 2010 18:44:23 +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 D54D58FC22;
	Tue, 20 Apr 2010 18:44:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KIiNDU012291;
	Tue, 20 Apr 2010 18:44:23 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KIiNd1012289;
	Tue, 20 Apr 2010 18:44:23 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004201844.o3KIiNd1012289@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 18:44:23 +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: r206907 - user/kmacy/head_page_lock_2/sys/vm
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, 20 Apr 2010 18:44:24 -0000

Author: kmacy
Date: Tue Apr 20 18:44:23 2010
New Revision: 206907
URL: http://svn.freebsd.org/changeset/base/206907

Log:
  the page queue mutex will always be held in vm_pageout_page_stats - turn to page lock assert to no-op on i386

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Tue Apr 20 18:43:23 2010	(r206906)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_pageout.c	Tue Apr 20 18:44:23 2010	(r206907)
@@ -1357,7 +1357,7 @@ vm_pageout_page_stats()
 			m = next;
 			continue;
 		}
-		vm_page_lock_assert(m, MA_NOTOWNED);
+		vm_page_lock_assert_notowned(m);
 		if (vm_page_trylock(m) == 0 || (object = m->object) == NULL) {
 			m = next;
 			continue;

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 20:09:46 2010
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 A2C23106564A;
	Tue, 20 Apr 2010 20:09:46 +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 794DB8FC18;
	Tue, 20 Apr 2010 20:09:46 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KK9kvc031126;
	Tue, 20 Apr 2010 20:09:46 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KK9kGX031125;
	Tue, 20 Apr 2010 20:09:46 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202009.o3KK9kGX031125@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 20:09:46 +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: r206910 - user/kmacy/head_page_lock_2/sys/vm
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, 20 Apr 2010 20:09:46 -0000

Author: kmacy
Date: Tue Apr 20 20:09:45 2010
New Revision: 206910
URL: http://svn.freebsd.org/changeset/base/206910

Log:
  replace conditional locking of page queue mutex with macros

Modified:
  user/kmacy/head_page_lock_2/sys/vm/vm_map.c
  user/kmacy/head_page_lock_2/sys/vm/vm_page.h

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_map.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_map.c	Tue Apr 20 19:30:12 2010	(r206909)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_map.c	Tue Apr 20 20:09:45 2010	(r206910)
@@ -1780,31 +1780,18 @@ vm_map_pmap_enter(vm_map_t map, vm_offse
 				p_start = p;
 			}
 		} else if (p_start != NULL) {
-#ifndef VM_PAGE_LOCK
-			if (!are_queues_locked) {
-				are_queues_locked = TRUE;
-				vm_page_lock_queues();
-			}
-#endif			
+			vm_page_lock_queues_cond(are_queues_locked);
 			pmap_enter_object(map->pmap, start, addr +
 			    ptoa(tmpidx), p_start, prot);
 			p_start = NULL;
 		}
 	}
 	if (p_start != NULL) {
-#ifndef VM_PAGE_LOCK
-		if (!are_queues_locked) {
-			are_queues_locked = TRUE;
-			vm_page_lock_queues();
-		}
-#endif		
+		vm_page_lock_queues_cond(are_queues_locked);
 		pmap_enter_object(map->pmap, start, addr + ptoa(psize),
 		    p_start, prot);
 	}
-#ifndef VM_PAGE_LOCK
-	if (are_queues_locked)
-		vm_page_unlock_queues();
-#endif	
+	vm_page_unlock_queues_cond(are_queues_locked);
 unlock_return:
 	VM_OBJECT_UNLOCK(object);
 }

Modified: user/kmacy/head_page_lock_2/sys/vm/vm_page.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 20 19:30:12 2010	(r206909)
+++ user/kmacy/head_page_lock_2/sys/vm/vm_page.h	Tue Apr 20 20:09:45 2010	(r206910)
@@ -272,15 +272,30 @@ extern struct vpglocks vm_page_queue_loc
 #define vm_page_lock_queues()   mtx_lock(&vm_page_queue_mtx)
 #define vm_page_unlock_queues() mtx_unlock(&vm_page_queue_mtx)
 #define	vm_page_trylock_queues() mtx_trylock(&vm_page_queue_mtx)
-
 #ifdef VM_PAGE_LOCK
-#define	vm_page_lockptr(m)		pmap_page_lockptr(m)
+#define	vm_page_lockptr(m)			pmap_page_lockptr(m)
 #define	vm_page_lock_queues_assert_notowned()   mtx_assert(&vm_page_queue_mtx, MA_NOTOWNED)
-#define	vm_page_lock_assert_notowned(m)   vm_page_lock_assert((m), MA_NOTOWNED)
+#define	vm_page_lock_assert_notowned(m)   	vm_page_lock_assert((m), MA_NOTOWNED)
+#define	vm_page_lock_queues_cond(x)
+#define	vm_page_unlock_queues_cond(x)
 #else
 #define	vm_page_lockptr(m)		(&vm_page_queue_mtx)
 #define	vm_page_lock_queues_assert_notowned()
 #define	vm_page_lock_assert_notowned(m)  
+#define	vm_page_lock_queues_cond(x)			\
+	do {						\
+		if (x == FALSE) {			\
+			are_queues_locked = TRUE;	\
+			vm_page_lock_queues();		\
+		}					\
+	} while (0)
+#define	vm_page_unlock_queues_cond(x)			\
+	do {						\
+		if (x == TRUE) {			\
+			are_queues_locked = FALSE;	\
+			vm_page_unlock_queues();	\
+		}					\
+	} while (0)
 #endif
 #define	vm_page_lock(m)		mtx_lock(vm_page_lockptr((m)))
 #define	vm_page_unlock(m)	mtx_unlock(vm_page_lockptr((m)))

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 20:58:01 2010
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 9A6A1106564A;
	Tue, 20 Apr 2010 20:58: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 899FB8FC12;
	Tue, 20 Apr 2010 20:58:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KKw1ac042276;
	Tue, 20 Apr 2010 20:58:01 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KKw163042274;
	Tue, 20 Apr 2010 20:58:01 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202058.o3KKw163042274@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 20:58:01 +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: r206919 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 20:58:01 -0000

Author: kmacy
Date: Tue Apr 20 20:58:01 2010
New Revision: 206919
URL: http://svn.freebsd.org/changeset/base/206919

Log:
  remove pmap_collect and most references to it

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 20:52:33 2010	(r206918)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 20:58:01 2010	(r206919)
@@ -2172,76 +2172,6 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, pv_entry
 SYSCTL_INT(_vm_pmap, OID_AUTO, pv_entry_spare, CTLFLAG_RD, &pv_entry_spare, 0,
 	"Current number of spare pv entries");
 
-static int pmap_collect_inactive, pmap_collect_active;
-
-SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_collect_inactive, CTLFLAG_RD, &pmap_collect_inactive, 0,
-	"Current number times pmap_collect called on inactive queue");
-SYSCTL_INT(_vm_pmap, OID_AUTO, pmap_collect_active, CTLFLAG_RD, &pmap_collect_active, 0,
-	"Current number times pmap_collect called on active queue");
-#endif
-
-/*
- * We are in a serious low memory condition.  Resort to
- * drastic measures to free some pages so we can allocate
- * another pv entry chunk.  This is normally called to
- * unmap inactive pages, and if necessary, active pages.
- *
- * We do not, however, unmap 2mpages because subsequent accesses will
- * allocate per-page pv entries until repromotion occurs, thereby
- * exacerbating the shortage of free pv entries.
- */
-#ifdef nomore
-static void
-pmap_collect(pmap_t locked_pmap, struct vpgqueues *vpq)
-{
-	struct md_page *pvh;
-	pd_entry_t *pde;
-	pmap_t pmap;
-	pt_entry_t *pte, tpte;
-	pv_entry_t next_pv, pv;
-	vm_offset_t va;
-	vm_page_t m, free;
-
-	TAILQ_FOREACH(m, &vpq->pl, pageq) {
-		if (m->hold_count || m->busy)
-			continue;
-		TAILQ_FOREACH_SAFE(pv, &m->md.pv_list, pv_list, next_pv) {
-			pmap = PV_PMAP(pv);
-			va = pv->pv_va;
-			/* Avoid deadlock and lock recursion. */
-			if (pmap > locked_pmap)
-				PMAP_LOCK(pmap);
-			else if (pmap != locked_pmap && !PMAP_TRYLOCK(pmap))
-				continue;
-			PMAP_LOCK_ASSERT(pmap, MA_OWNED);
-			pmap_resident_count_dec(pmap, 1);
-			pde = pmap_pde(pmap, va);
-			KASSERT((*pde & PG_PS) == 0, ("pmap_collect: found"
-			    " a 2mpage in page %p's pv list", m));
-			pte = pmap_pde_to_pte(pde, va);
-			tpte = pte_load_clear(pte);
-			KASSERT((tpte & PG_W) == 0,
-			    ("pmap_collect: wired pte %#lx", tpte));
-			if (tpte & PG_A)
-				vm_page_flag_set(m, PG_REFERENCED);
-			if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
-				vm_page_dirty(m);
-			free = NULL;
-			pmap_unuse_pt(pmap, va, *pde, &free);
-			pmap_invalidate_page(pmap, va);
-			pmap_free_zero_pages(free);
-			TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
-			if (TAILQ_EMPTY(&m->md.pv_list)) {
-				pvh = pa_to_pvh(VM_PAGE_TO_PHYS(m));
-				if (TAILQ_EMPTY(&pvh->pv_list))
-					vm_page_flag_clear(m, PG_WRITEABLE);
-			}
-			free_pv_entry(pmap, pv);
-			if (pmap != locked_pmap)
-				PMAP_UNLOCK(pmap);
-		}
-	}
-}
 #endif
 
 /*
@@ -2509,10 +2439,7 @@ pmap_pv_promote_pde(pmap_t pmap, vm_offs
 
 	/*
 	 * Transfer the first page's pv entry for this mapping to the
-	 * 2mpage's pv list.  Aside from avoiding the cost of a call
-	 * to get_pv_entry(), a transfer avoids the possibility that
-	 * get_pv_entry() calls pmap_collect() and that pmap_collect()
-	 * removes one of the mappings that is being promoted.
+	 * 2mpage's pv list. 
 	 */
 	m = PHYS_TO_VM_PAGE(pa);
 	va = trunc_2mpage(va);

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 21:16:19 2010
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 B51CE1065675;
	Tue, 20 Apr 2010 21:16:19 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8C3008FC25;
	Tue, 20 Apr 2010 21:16:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KLGJ3m046614;
	Tue, 20 Apr 2010 21:16:19 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KLGJfU046613;
	Tue, 20 Apr 2010 21:16:19 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004202116.o3KLGJfU046613@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 20 Apr 2010 21:16:19 +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: r206925 - user/delphij/libz
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, 20 Apr 2010 21:16:19 -0000

Author: delphij
Date: Tue Apr 20 21:16:19 2010
New Revision: 206925
URL: http://svn.freebsd.org/changeset/base/206925

Log:
  GC unused folder.

Deleted:
  user/delphij/libz/

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 21:17:53 2010
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 8CF1F106568E;
	Tue, 20 Apr 2010 21:17:53 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 63EBD8FC1F;
	Tue, 20 Apr 2010 21:17:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KLHrI0046989;
	Tue, 20 Apr 2010 21:17:53 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KLHr5W046988;
	Tue, 20 Apr 2010 21:17:53 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004202117.o3KLHr5W046988@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 20 Apr 2010 21:17:53 +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: r206926 - user/delphij/libz-8
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, 20 Apr 2010 21:17:53 -0000

Author: delphij
Date: Tue Apr 20 21:17:53 2010
New Revision: 206926
URL: http://svn.freebsd.org/changeset/base/206926

Log:
  Create a branch for libz in 8-STABLE so I can "cheery-pick" zlib
  enhancements without disturbing stable/8 build.

Added:
     - copied from r206925, stable/8/lib/libz/
Directory Properties:
  user/delphij/libz-8/   (props changed)

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 21:51:28 2010
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 BC2AE106564A;
	Tue, 20 Apr 2010 21:51:28 +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 ABB4A8FC13;
	Tue, 20 Apr 2010 21:51:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KLpSYF054995;
	Tue, 20 Apr 2010 21:51:28 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KLpSU3054992;
	Tue, 20 Apr 2010 21:51:28 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202151.o3KLpSU3054992@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 21:51:28 +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: r206936 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
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, 20 Apr 2010 21:51:28 -0000

Author: kmacy
Date: Tue Apr 20 21:51:28 2010
New Revision: 206936
URL: http://svn.freebsd.org/changeset/base/206936

Log:
  - comment "XXX" on  functions that may drop the pmap lock opening us up to race conditions
  - add generation counter to pmap to allow caller to know that the pmap lock was dropped

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 21:48:48 2010	(r206935)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 21:51:28 2010	(r206936)
@@ -566,6 +566,7 @@ pa_tryrelock(pmap_t pmap, vm_paddr_t pa,
 	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
 	PA_LOCK(pa);
 	PMAP_LOCK(pmap);
+	pmap->pm_gen_count++;
 
 	return (EAGAIN);
 }
@@ -2707,23 +2708,17 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		pvh = pa_to_pvh(oldpde & PG_PS_FRAME);
 		pmap_pvh_free(pvh, pmap, sva);
 		eva = sva + NBPDR;
+		panic("XXX - not properly locked");
 		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
 		    va < eva; va += PAGE_SIZE, m++) {
 
-			if ((oldpde & (PG_M | PG_RW | PG_A)) ||
-			    (TAILQ_EMPTY(&m->md.pv_list) &&
-				TAILQ_EMPTY(&pvh->pv_list))) {
-				vm_page_lock(m);
-			
-				if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
-					vm_page_dirty(m);
-				if (oldpde & PG_A)
-					vm_page_flag_set(m, PG_REFERENCED);
-				if (TAILQ_EMPTY(&m->md.pv_list) &&
-				    TAILQ_EMPTY(&pvh->pv_list))
-					vm_page_flag_clear(m, PG_WRITEABLE);
-				vm_page_unlock(m);
-			}
+			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
+				vm_page_dirty(m);
+			if (oldpde & PG_A)
+				vm_page_flag_set(m, PG_REFERENCED);
+			if (TAILQ_EMPTY(&m->md.pv_list) &&
+			    TAILQ_EMPTY(&pvh->pv_list))
+				vm_page_flag_clear(m, PG_WRITEABLE);
 		}
 	}
 	if (pmap == kernel_pmap) {
@@ -2991,6 +2986,11 @@ restart:
 				continue;
 			} else
 				ptpaddr = *pde;
+
+			/*
+			 * XXX do we need to check if pmap_demote_pde dropped the lock?
+			 *
+			 */
 		}
 
 		/*
@@ -3017,6 +3017,10 @@ restart:
 			 */
 			if ((*pte & PG_G) == 0)
 				anyvalid = 1;
+			/*
+			 * XXX check if the pmap lock was dropped - maybe we need 
+			 * to restart
+			 */
 			if (pmap_remove_pte(pmap, pte, sva, ptpaddr, &free))
 				break;
 		}
@@ -3091,7 +3095,13 @@ pmap_remove_all(vm_page_t m)
 		if ((tpte & (PG_M | PG_RW)) == (PG_M | PG_RW))
 			vm_page_dirty(m);
 		free = NULL;
+
+		/*
+		 * XXX pmap_unuse_pt can drop the pmap lock
+		 *
+		 */
 		pmap_unuse_pt(pmap, pv->pv_va, *pde, &free);
+
 		pmap_invalidate_page(pmap, pv->pv_va);
 		pmap_free_zero_pages(free);
 		TAILQ_REMOVE(&m->md.pv_list, pv, pv_list);
@@ -4004,6 +4014,9 @@ retry:
 	}
 	if ((*pde & PG_PS) != 0) {
 		if (!wired != ((*pde & PG_W) == 0)) {
+			/*
+			 * XXX do we need to check if the pmap lock was dropped
+			 */
 			if (!pmap_demote_pde(pmap, pde, va, &pv_list))
 				panic("pmap_change_wiring: demotion failed");
 		} else
@@ -4460,6 +4473,10 @@ restart:
 							vm_page_flag_clear(m, PG_WRITEABLE);
 					}
 				}
+				/*
+				 *
+				 * XXX check if the pmap lock has been dropped
+				 */
 				pmap_unuse_pt(pmap, pv->pv_va, ptepde, &free);
 			}
 		}
@@ -5104,6 +5121,10 @@ pmap_change_attr_locked(vm_offset_t va, 
 				tmpva += NBPDR;
 				continue;
 			}
+			/*
+			 * XXX do we need to check if the lock was dropped
+			 *
+			 */
 			if (!pmap_demote_pde(kernel_pmap, pde, tmpva, &pv_list))
 				return (ENOMEM);
 		}

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 21:48:48 2010	(r206935)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 21:51:28 2010	(r206936)
@@ -246,6 +246,7 @@ struct pmap {
 	pml4_entry_t		*pm_pml4;	/* KVA of level 4 page table */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	u_int			pm_active;	/* active on cpus */
+	u_int			pm_gen_count;	/* generation count (pmap lock dropped) */
 	/* spare u_int here due to padding */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 22:15:41 2010
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 D12A61065672;
	Tue, 20 Apr 2010 22:15:41 +0000 (UTC)
	(envelope-from delphij@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C1A968FC1A;
	Tue, 20 Apr 2010 22:15:41 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMFfVZ060628;
	Tue, 20 Apr 2010 22:15:41 GMT (envelope-from delphij@svn.freebsd.org)
Received: (from delphij@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMFfaY060626;
	Tue, 20 Apr 2010 22:15:41 GMT (envelope-from delphij@svn.freebsd.org)
Message-Id: <201004202215.o3KMFfaY060626@svn.freebsd.org>
From: Xin LI <delphij@FreeBSD.org>
Date: Tue, 20 Apr 2010 22:15:41 +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: r206941 - user/delphij/libz-8
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, 20 Apr 2010 22:15:41 -0000

Author: delphij
Date: Tue Apr 20 22:15:41 2010
New Revision: 206941
URL: http://svn.freebsd.org/changeset/base/206941

Log:
  MFC assembler version of match functions for amd64 and i386(*).
  
  This gives approximately 15% improvement on compression case.
  
  (*) i386 assembler version is enabled ONLY when MACHINE_CPU have
  'i686' which is not default on FreeBSD/i386.  One can specify
  for instance CPUTYPE=pentium4 in /etc/make.conf to get this
  feature.

Added:
     - copied from r206927, head/lib/libz/contrib/
Directory Properties:
  user/delphij/libz-8/contrib/   (props changed)
Modified:
  user/delphij/libz-8/Makefile

Modified: user/delphij/libz-8/Makefile
==============================================================================
--- user/delphij/libz-8/Makefile	Tue Apr 20 22:00:56 2010	(r206940)
+++ user/delphij/libz-8/Makefile	Tue Apr 20 22:15:41 2010	(r206941)
@@ -19,6 +19,18 @@ SRCS = adler32.c compress.c crc32.c gzio
        zutil.c inflate.c inftrees.c inffast.c zopen.c infback.c
 INCS=		zconf.h zlib.h
 
+.if ${MACHINE_ARCH} == "i386" && ${MACHINE_CPU:M*i686*}
+.PATH:		${.CURDIR}/contrib/asm686
+SRCS+=		match.S
+CFLAGS+=	-DASMV -DNO_UNDERLINE
+.endif
+
+.if ${MACHINE_ARCH} == "amd64"
+.PATH:		${.CURDIR}/contrib/gcc_gvmat64
+SRCS+=		gvmat64.S
+CFLAGS+=	-DASMV -DNO_UNDERLINE
+.endif
+
 minigzip:	all minigzip.o
 	$(CC) -o minigzip minigzip.o -L. -lz
 

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 22:24:36 2010
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 0261D1065673;
	Tue, 20 Apr 2010 22:24:36 +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 E67CB8FC0A;
	Tue, 20 Apr 2010 22:24:35 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMOZaj062624;
	Tue, 20 Apr 2010 22:24:35 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMOZeS062622;
	Tue, 20 Apr 2010 22:24:35 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202224.o3KMOZeS062622@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 22:24:35 +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: r206943 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 22:24:36 -0000

Author: kmacy
Date: Tue Apr 20 22:24:35 2010
New Revision: 206943
URL: http://svn.freebsd.org/changeset/base/206943

Log:
  acquire page lock in pmap_remove_pde if we need to change the page's flags

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:20:31 2010	(r206942)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:24:35 2010	(r206943)
@@ -2689,6 +2689,7 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 	pd_entry_t oldpde;
 	vm_offset_t eva, va;
 	vm_page_t m, mpte;
+	vm_paddr_t paddr, pa = 0;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	KASSERT((sva & PDRMASK) == 0,
@@ -2708,9 +2709,13 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 		pvh = pa_to_pvh(oldpde & PG_PS_FRAME);
 		pmap_pvh_free(pvh, pmap, sva);
 		eva = sva + NBPDR;
-		panic("XXX - not properly locked");
-		for (va = sva, m = PHYS_TO_VM_PAGE(oldpde & PG_PS_FRAME);
-		    va < eva; va += PAGE_SIZE, m++) {
+		paddr = oldpde & PG_PS_FRAME;
+		for (va = sva, m = PHYS_TO_VM_PAGE(paddr);
+		     va < eva; va += PAGE_SIZE, paddr += PAGE_SIZE, m++) {
+			if ((oldpde & PG_A) ||
+			    (TAILQ_EMPTY(&m->md.pv_list) &&
+				TAILQ_EMPTY(&pvh->pv_list)))
+				pa_tryrelock(pmap, paddr, &pa);
 
 			if ((oldpde & (PG_M | PG_RW)) == (PG_M | PG_RW))
 				vm_page_dirty(m);
@@ -2720,6 +2725,8 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 			    TAILQ_EMPTY(&pvh->pv_list))
 				vm_page_flag_clear(m, PG_WRITEABLE);
 		}
+		if (pa)
+			PA_UNLOCK(pa);
 	}
 	if (pmap == kernel_pmap) {
 		if (!pmap_demote_pde(pmap, pdq, sva, pv_list))

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 22:45:13 2010
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 56F9B106568C;
	Tue, 20 Apr 2010 22:45:13 +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 470438FC15;
	Tue, 20 Apr 2010 22:45:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMjDXU067275;
	Tue, 20 Apr 2010 22:45:13 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMjDmP067273;
	Tue, 20 Apr 2010 22:45:13 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202245.o3KMjDmP067273@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 22:45:13 +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: r206946 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 22:45:13 -0000

Author: kmacy
Date: Tue Apr 20 22:45:12 2010
New Revision: 206946
URL: http://svn.freebsd.org/changeset/base/206946

Log:
  only bump generation count if we acquire the pmap lock in the middle of a retry
  otherwise we know that the pmap state has not changed

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:43:53 2010	(r206945)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:45:12 2010	(r206946)
@@ -562,11 +562,12 @@ pa_tryrelock(pmap_t pmap, vm_paddr_t pa,
 	}
 	if (PA_TRYLOCK(pa))
 		return (0);
+	pmap->pm_flags |= PMAP_IN_RETRY;
 	PMAP_UNLOCK(pmap);
 	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
 	PA_LOCK(pa);
-	PMAP_LOCK(pmap);
-	pmap->pm_gen_count++;
+	mtx_lock(&(pmap)->pm_mtx);
+	pmap->pm_flags &= ~PMAP_IN_RETRY;
 
 	return (EAGAIN);
 }
@@ -2677,7 +2678,6 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 	return (TRUE);
 }
 	
-
 /*
  * pmap_remove_pde: do the things to unmap a superpage in a process
  */
@@ -3453,12 +3453,14 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	ls_init(&ls);
 	ls_push(&ls, PA_LOCKPTR(lockedpa));
 	ls_push(&ls, PMAP_LOCKPTR(pmap));
+	PMAP_UPDATE_GEN_COUNT(pmap);
 	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) {
 		while ((pv = get_pv_entry(pmap)) == NULL) {
 			ls_popa(&ls);
 			VM_WAIT;
 			ls_push(&ls, PA_LOCKPTR(lockedpa));
 			ls_push(&ls, PMAP_LOCKPTR(pmap));
+			PMAP_UPDATE_GEN_COUNT(pmap);
 		}
 	}
 
@@ -3484,6 +3486,7 @@ restart:
 		ls_popa(&ls);
 		ls_push(&ls, PA_LOCKPTR(lockedpa));
 		ls_push(&ls, PMAP_LOCKPTR(pmap));
+		PMAP_UPDATE_GEN_COUNT(pmap);
 		opalocked = FALSE;
 		opa = 0;
 		goto restart;
@@ -3503,6 +3506,7 @@ restart:
 				ls_push(&ls, PA_LOCKPTR(lockedpa));
 			}
 			ls_push(&ls, PMAP_LOCKPTR(pmap));
+			PMAP_UPDATE_GEN_COUNT(pmap);
 			goto restart;
 		}
 	}

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 22:46:23 2010
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 8076B1065677;
	Tue, 20 Apr 2010 22:46:23 +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 707B88FC13;
	Tue, 20 Apr 2010 22:46:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMkNAq067586;
	Tue, 20 Apr 2010 22:46:23 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMkN2h067584;
	Tue, 20 Apr 2010 22:46:23 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202246.o3KMkN2h067584@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 22:46:23 +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: r206947 - user/kmacy/head_page_lock_2/sys/amd64/include
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, 20 Apr 2010 22:46:23 -0000

Author: kmacy
Date: Tue Apr 20 22:46:23 2010
New Revision: 206947
URL: http://svn.freebsd.org/changeset/base/206947

Log:
  add generation macros and flag changes

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 22:45:12 2010	(r206946)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 22:46:23 2010	(r206947)
@@ -237,6 +237,8 @@ struct md_page {
 	int			pat_mode;
 };
 
+#define PMAP_IN_RETRY		0x1
+
 /*
  * The kernel virtual address (KVA) of the level 4 page table page is always
  * within the direct map (DMAP) region.
@@ -246,8 +248,8 @@ struct pmap {
 	pml4_entry_t		*pm_pml4;	/* KVA of level 4 page table */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	u_int			pm_active;	/* active on cpus */
-	u_int			pm_gen_count;	/* generation count (pmap lock dropped) */
-	/* spare u_int here due to padding */
+	uint16_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	uint16_t		pm_flags;
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */
 	vm_page_t		pm_free;	/* Temporary free pages. */
@@ -259,7 +261,18 @@ typedef struct pmap	*pmap_t;
 extern struct pmap	kernel_pmap_store;
 #define kernel_pmap	(&kernel_pmap_store)
 
-#define	PMAP_LOCK(pmap)		mtx_lock(&(pmap)->pm_mtx)
+#define PMAP_UPDATE_GEN_COUNT(pmap)				\
+	do {							\
+		if (pmap->pm_flags & PMAP_IN_RETRY)		\
+			pmap->pm_gen_count++;			\
+	} while (0)
+
+#define	PMAP_LOCK(pmap)						\
+	do {							\
+		mtx_lock(&(pmap)->pm_mtx);			\
+		PMAP_UPDATE_GEN_COUNT((pmap));			\
+	} while (0)
+
 #define	PMAP_LOCKPTR(pmap)	(&(pmap)->pm_mtx)
 
 #define	PMAP_LOCK_ASSERT(pmap, type)					\

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 22:59:56 2010
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 BC9051065673;
	Tue, 20 Apr 2010 22:59:56 +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 A15FD8FC12;
	Tue, 20 Apr 2010 22:59:56 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KMxu1e070904;
	Tue, 20 Apr 2010 22:59:56 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KMxuJN070901;
	Tue, 20 Apr 2010 22:59:56 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202259.o3KMxuJN070901@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 22:59:56 +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: r206953 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
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, 20 Apr 2010 22:59:56 -0000

Author: kmacy
Date: Tue Apr 20 22:59:56 2010
New Revision: 206953
URL: http://svn.freebsd.org/changeset/base/206953

Log:
  - handle multiple simultaneous relocks on a pmap using a counter
  - only return EAGAIN if the pmap lock was acquired by another caller
    in the meantime or another caller is in the middle of a retry

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:57:05 2010	(r206952)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 22:59:56 2010	(r206953)
@@ -213,6 +213,10 @@ static int pmap_tryrelock_restart;
 SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_restart, CTLFLAG_RD,
     &pmap_tryrelock_restart, 0, "Number of tryrelock restarts");
 
+static int pmap_tryrelock_race;
+SYSCTL_INT(_vm_pmap, OID_AUTO, tryrelock_race, CTLFLAG_RD,
+    &pmap_tryrelock_race, 0, "Number of tryrelock pmap race cases");
+
 
 static u_int64_t	KPTphys;	/* phys addr of kernel level 1 */
 static u_int64_t	KPDphys;	/* phys addr of kernel level 2 */
@@ -549,8 +553,10 @@ static int
 pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
 {
 	vm_paddr_t lockpa;
+	uint16_t gen_count;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
+	gen_count = pmap->pm_gen_count;
 	atomic_add_long((volatile long *)&pmap_tryrelock_calls, 1);
 	lockpa = *locked;
 	*locked = pa;
@@ -562,14 +568,20 @@ pa_tryrelock(pmap_t pmap, vm_paddr_t pa,
 	}
 	if (PA_TRYLOCK(pa))
 		return (0);
-	pmap->pm_flags |= PMAP_IN_RETRY;
+	pmap->pm_retry_depth++;
 	PMAP_UNLOCK(pmap);
 	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
 	PA_LOCK(pa);
 	mtx_lock(&(pmap)->pm_mtx);
-	pmap->pm_flags &= ~PMAP_IN_RETRY;
-
-	return (EAGAIN);
+	pmap->pm_retry_depth--;
+	if (pmap->pm_retry_depth)
+		pmap->pm_gen_count++;
+
+	if (gen_count != pmap->pm_gen_count) {
+		atomic_add_int((volatile int *)&pmap_tryrelock_race, 1);
+		return (EAGAIN);
+	}
+	return (0);
 }
 
 static u_int64_t

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 22:57:05 2010	(r206952)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Tue Apr 20 22:59:56 2010	(r206953)
@@ -237,8 +237,6 @@ struct md_page {
 	int			pat_mode;
 };
 
-#define PMAP_IN_RETRY		0x1
-
 /*
  * The kernel virtual address (KVA) of the level 4 page table page is always
  * within the direct map (DMAP) region.
@@ -249,7 +247,7 @@ struct pmap {
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	u_int			pm_active;	/* active on cpus */
 	uint16_t		pm_gen_count;	/* generation count (pmap lock dropped) */
-	uint16_t		pm_flags;
+	uint16_t		pm_retry_depth;	/* number of cases in retry */
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */
 	vm_page_t		pm_free;	/* Temporary free pages. */
@@ -263,7 +261,7 @@ extern struct pmap	kernel_pmap_store;
 
 #define PMAP_UPDATE_GEN_COUNT(pmap)				\
 	do {							\
-		if (pmap->pm_flags & PMAP_IN_RETRY)		\
+		if (pmap->pm_retry_depth)			\
 			pmap->pm_gen_count++;			\
 	} while (0)
 

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 23:35:20 2010
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 9E0BD106566C;
	Tue, 20 Apr 2010 23:35:20 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8CF678FC16;
	Tue, 20 Apr 2010 23:35:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KNZKmC078659;
	Tue, 20 Apr 2010 23:35:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KNZKH5078654;
	Tue, 20 Apr 2010 23:35:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004202335.o3KNZKH5078654@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Tue, 20 Apr 2010 23:35:20 +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: r206954 - user/jmallett/octeon/contrib/gcc/config/mips
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, 20 Apr 2010 23:35:20 -0000

Author: jmallett
Date: Tue Apr 20 23:35:20 2010
New Revision: 206954
URL: http://svn.freebsd.org/changeset/base/206954

Log:
  Teach our GCC a little bit about mips64r2.  This is enough to compile code
  from the Cavium SDK which needs the assembler in mips64r2, which our BU
  supports well enough for basic things.

Modified:
  user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h
  user/jmallett/octeon/contrib/gcc/config/mips/mips.c
  user/jmallett/octeon/contrib/gcc/config/mips/mips.h
  user/jmallett/octeon/contrib/gcc/config/mips/mips.md

Modified: user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h	Tue Apr 20 22:59:56 2010	(r206953)
+++ user/jmallett/octeon/contrib/gcc/config/mips/freebsd.h	Tue Apr 20 23:35:20 2010	(r206954)
@@ -231,13 +231,13 @@ Boston, MA 02110-1301, USA.  */
           builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");        \
 	  builtin_define ("__mips_isa_rev=1");			\
 	}							\
-/*      else if (ISA_MIPS64R2)					\
+      else if (ISA_MIPS64R2)					\
 	{							\
 	  builtin_define ("__mips=64");				\
           builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");        \
 	  builtin_define ("__mips_isa_rev=2");			\
 	}							\
-*/								\
+	    							\
       if (TARGET_HARD_FLOAT)					\
 	builtin_define ("__mips_hard_float");			\
       else if (TARGET_SOFT_FLOAT)				\

Modified: user/jmallett/octeon/contrib/gcc/config/mips/mips.c
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/mips.c	Tue Apr 20 22:59:56 2010	(r206953)
+++ user/jmallett/octeon/contrib/gcc/config/mips/mips.c	Tue Apr 20 23:35:20 2010	(r206954)
@@ -713,6 +713,7 @@ const struct mips_cpu_info mips_cpu_info
   { "mips32", PROCESSOR_4KC, 32 },
   { "mips32r2", PROCESSOR_M4K, 33 },
   { "mips64", PROCESSOR_5KC, 64 },
+  { "mips64r2", PROCESSOR_5KC, 65 },
 
   /* MIPS I */
   { "r3000", PROCESSOR_R3000, 1 },
@@ -4829,7 +4830,7 @@ override_options (void)
 	 issue those instructions unless instructed to do so by
 	 -mbranch-likely.  */
       if (ISA_HAS_BRANCHLIKELY
-	  && !(ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64)
+	  && !(ISA_MIPS32 || ISA_MIPS32R2 || ISA_MIPS64 || ISA_MIPS64R2)
 	  && !(TUNE_MIPS5500 || TUNE_SB1))
 	target_flags |= MASK_BRANCHLIKELY;
       else

Modified: user/jmallett/octeon/contrib/gcc/config/mips/mips.h
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/mips.h	Tue Apr 20 22:59:56 2010	(r206953)
+++ user/jmallett/octeon/contrib/gcc/config/mips/mips.h	Tue Apr 20 23:35:20 2010	(r206954)
@@ -199,6 +199,7 @@ extern const struct mips_rtx_cost_data *
 #define ISA_MIPS32		    (mips_isa == 32)
 #define ISA_MIPS32R2		    (mips_isa == 33)
 #define ISA_MIPS64                  (mips_isa == 64)
+#define	ISA_MIPS64R2		    (mips_isa == 65)
 
 /* Architecture target defines.  */
 #define TARGET_MIPS3900             (mips_arch == PROCESSOR_R3900)
@@ -380,6 +381,12 @@ extern const struct mips_rtx_cost_data *
 	  builtin_define ("__mips_isa_rev=1");			\
 	  builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");	\
 	}							\
+      else if (ISA_MIPS64R2)					\
+	{							\
+	  builtin_define ("__mips=64");				\
+	  builtin_define ("__mips_isa_rev=2");			\
+	  builtin_define ("_MIPS_ISA=_MIPS_ISA_MIPS64");	\
+	}							\
 								\
       if (TARGET_HARD_FLOAT)					\
 	builtin_define ("__mips_hard_float");			\
@@ -501,7 +508,11 @@ extern const struct mips_rtx_cost_data *
 #              if MIPS_ISA_DEFAULT == 64
 #                define MULTILIB_ISA_DEFAULT "mips64"
 #              else
-#                define MULTILIB_ISA_DEFAULT "mips1"
+#                if MIPS_ISA_DEFAULT == 65
+#                  define MULTILIB_ISA_DEFAULT "mips64r2"
+#                else
+#                  define MULTILIB_ISA_DEFAULT "mips1"
+#                endif
 #              endif
 #            endif
 #          endif
@@ -562,7 +573,8 @@ extern const struct mips_rtx_cost_data *
 				  || TARGET_MAD				\
                                   || ISA_MIPS32	                        \
                                   || ISA_MIPS32R2                       \
-                                  || ISA_MIPS64)                        \
+                                  || ISA_MIPS64                         \
+                                  || ISA_MIPS64R2)                      \
                                  && !TARGET_MIPS16)
 
 /* Generate three-operand multiply instructions for DImode.  */
@@ -584,7 +596,8 @@ extern const struct mips_rtx_cost_data *
 /* ISA has instructions for managing 64 bit fp and gp regs (e.g. mips3).  */
 #define ISA_HAS_64BIT_REGS	(ISA_MIPS3				\
 				 || ISA_MIPS4				\
-                                 || ISA_MIPS64)
+                                 || ISA_MIPS64				\
+				 || ISA_MIPS64R2)
 
 /* ISA has branch likely instructions (e.g. mips2).  */
 /* Disable branchlikely for tx39 until compare rewrite.  They haven't
@@ -595,7 +608,8 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_CONDMOVE        ((ISA_MIPS4				\
 				  || ISA_MIPS32	                        \
 				  || ISA_MIPS32R2                       \
-				  || ISA_MIPS64)			\
+				  || ISA_MIPS64				\
+				  || ISA_MIPS64R2)			\
                                  && !TARGET_MIPS5500                    \
 				 && !TARGET_MIPS16)
 
@@ -604,13 +618,15 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_8CC		(ISA_MIPS4				\
                          	 || ISA_MIPS32	                        \
                          	 || ISA_MIPS32R2                        \
-				 || ISA_MIPS64)
+				 || ISA_MIPS64				\
+				 || ISA_MIPS64R2)
 
 /* This is a catch all for other mips4 instructions: indexed load, the
    FP madd and msub instructions, and the FP recip and recip sqrt
    instructions.  */
 #define ISA_HAS_FP4             ((ISA_MIPS4				\
-				  || ISA_MIPS64)       			\
+				  || ISA_MIPS64				\
+				  || ISA_MIPS64R2)     			\
  				 && !TARGET_MIPS16)
 
 /* ISA has conditional trap instructions.  */
@@ -621,11 +637,13 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_MADD_MSUB       ((ISA_MIPS32				\
 				  || ISA_MIPS32R2			\
 				  || ISA_MIPS64				\
+				  || ISA_MIPS64R2			\
 				  ) && !TARGET_MIPS16)
 
 /* ISA has floating-point nmadd and nmsub instructions.  */
 #define ISA_HAS_NMADD_NMSUB	((ISA_MIPS4				\
-				  || ISA_MIPS64)       			\
+				  || ISA_MIPS64				\
+				  || ISA_MIPS64R2)			\
                                  && (!TARGET_MIPS5400 || TARGET_MAD)    \
 				 && ! TARGET_MIPS16)
 
@@ -633,11 +651,13 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_CLZ_CLO         ((ISA_MIPS32				\
                                   || ISA_MIPS32R2			\
                                   || ISA_MIPS64				\
+                                  || ISA_MIPS64R2			\
                                  ) && !TARGET_MIPS16)
 
 /* ISA has double-word count leading zeroes/ones instruction (not
    implemented).  */
 #define ISA_HAS_DCLZ_DCLO       (ISA_MIPS64				\
+				 || ISA_MIPS64R2			\
 				 && !TARGET_MIPS16)
 
 /* ISA has three operand multiply instructions that put
@@ -677,6 +697,7 @@ extern const struct mips_rtx_cost_data *
 /* ISA has 32-bit rotate right instruction.  */
 #define ISA_HAS_ROTR_SI         (!TARGET_MIPS16                         \
                                  && (ISA_MIPS32R2                       \
+                                     || ISA_MIPS64R2                    \
                                      || TARGET_MIPS5400                 \
                                      || TARGET_MIPS5500                 \
                                      || TARGET_SR71K                    \
@@ -694,7 +715,8 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_PREFETCH	((ISA_MIPS4				\
 				  || ISA_MIPS32				\
 				  || ISA_MIPS32R2			\
-				  || ISA_MIPS64)	       		\
+				  || ISA_MIPS64		       		\
+				  || ISA_MIPS64R2)	       		\
 				 && !TARGET_MIPS16)
 
 /* ISA has data indexed prefetch instructions.  This controls use of
@@ -702,7 +724,8 @@ extern const struct mips_rtx_cost_data *
    (prefx is a cop1x instruction, so can only be used if FP is
    enabled.)  */
 #define ISA_HAS_PREFETCHX       ((ISA_MIPS4				\
-				  || ISA_MIPS64)       			\
+				  || ISA_MIPS64				\
+				  || ISA_MIPS64R2)			\
  				 && !TARGET_MIPS16)
 
 /* True if trunc.w.s and trunc.w.d are real (not synthetic)
@@ -713,11 +736,13 @@ extern const struct mips_rtx_cost_data *
 /* ISA includes the MIPS32r2 seb and seh instructions.  */
 #define ISA_HAS_SEB_SEH         (!TARGET_MIPS16                        \
                                  && (ISA_MIPS32R2                      \
+				     || ISA_MIPS64R2			\
                                      ))
 
 /* ISA includes the MIPS32/64 rev 2 ext and ins instructions.  */
 #define ISA_HAS_EXT_INS         (!TARGET_MIPS16                        \
                                  && (ISA_MIPS32R2                      \
+				     || ISA_MIPS64R2		       \
                                      ))
 
 /* True if the result of a load is not available to the next instruction.
@@ -748,6 +773,7 @@ extern const struct mips_rtx_cost_data *
 #define ISA_HAS_HILO_INTERLOCKS	(ISA_MIPS32				\
 				 || ISA_MIPS32R2			\
 				 || ISA_MIPS64				\
+				 || ISA_MIPS64R2			\
 				 || TARGET_MIPS5500)
 
 /* Add -G xx support.  */

Modified: user/jmallett/octeon/contrib/gcc/config/mips/mips.md
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/mips.md	Tue Apr 20 22:59:56 2010	(r206953)
+++ user/jmallett/octeon/contrib/gcc/config/mips/mips.md	Tue Apr 20 23:35:20 2010	(r206954)
@@ -1041,7 +1041,8 @@
       || TARGET_MIPS9000
       || ISA_MIPS32
       || ISA_MIPS32R2
-      || ISA_MIPS64)
+      || ISA_MIPS64
+      || ISA_MIPS64R2)
     return "mul\t%0,%1,%2";
   return "mult\t%0,%1,%2";
 }

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 23:36:01 2010
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 735CE1065686;
	Tue, 20 Apr 2010 23:36: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 636988FC16;
	Tue, 20 Apr 2010 23:36:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KNa1jk078855;
	Tue, 20 Apr 2010 23:36:01 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KNa1WL078853;
	Tue, 20 Apr 2010 23:36:01 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004202336.o3KNa1WL078853@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Tue, 20 Apr 2010 23:36:01 +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: r206955 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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, 20 Apr 2010 23:36:01 -0000

Author: kmacy
Date: Tue Apr 20 23:36:01 2010
New Revision: 206955
URL: http://svn.freebsd.org/changeset/base/206955

Log:
  drop page lock if we leave the pmap copy loop

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 23:35:20 2010	(r206954)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Tue Apr 20 23:36:01 2010	(r206955)
@@ -4131,8 +4131,10 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 				continue;
 
 			dstmpde = pmap_allocpde(dst_pmap, pa, addr, M_NOWAIT);
-			if (dstmpde == NULL)
+			if (dstmpde == NULL) {
+				PA_UNLOCK(pa);
 				break;
+			}
 			pde = (pd_entry_t *)
 			    PHYS_TO_DMAP(VM_PAGE_TO_PHYS(dstmpde));
 			pde = &pde[pmap_pde_index(addr)];

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 23:42:58 2010
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 5E39C106564A;
	Tue, 20 Apr 2010 23:42:58 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4B9658FC0C;
	Tue, 20 Apr 2010 23:42:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KNgwq5080457;
	Tue, 20 Apr 2010 23:42:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KNgwKj080451;
	Tue, 20 Apr 2010 23:42:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004202342.o3KNgwKj080451@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Tue, 20 Apr 2010 23:42: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: r206957 - in
	user/jmallett/octeon/sys/contrib/octeon-sdk: . cvmx-malloc
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, 20 Apr 2010 23:42:58 -0000

Author: jmallett
Date: Tue Apr 20 23:42:57 2010
New Revision: 206957
URL: http://svn.freebsd.org/changeset/base/206957

Log:
  Bring in Cavium Simple Executive.  This will be properly vendor imported when
  committed to HEAD.

Added:
  user/jmallett/octeon/sys/contrib/octeon-sdk/
  user/jmallett/octeon/sys/contrib/octeon-sdk/README.txt
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmip.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-abi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-address.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init-linux.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-app-init.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asm.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-asx.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-atomic.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-bootloader.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-bootmem.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-bootmem.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-ciu.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cn3010-evb-hs5.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cn3010-evb-hs5.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-compactflash.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-compactflash.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-core.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-core.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-coremask.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-coremask.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-addresses.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-db-support.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-db.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-db.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-enums.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr-typedefs.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-csr.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cvmmem.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-dfa.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-dfa.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-dma-engine.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-dma-engine.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-ebt3000.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-ebt3000.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fau.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-flash.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-flash.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-gmx.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-gpio.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-board.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-check-defines.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-higig.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-interrupt-decodes.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-interrupt-handler.S
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-interrupt-rsl.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-interrupt.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-interrupt.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-iob.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-ipd.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-key.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-l2c.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-l2c.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-llm.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-llm.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-lmc.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-log-arc.S
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-log.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-log.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/README-malloc
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/arena.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/malloc.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/malloc.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-malloc/thread-m.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-mdio.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-mgmt-port.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-mgmt-port.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-mio.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-nand.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-nand.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-npi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-packet.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pci.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pcie.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pcie.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pip.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pow.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pow.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-raid.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-raid.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-resources.config
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-rng.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-rtc.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-rwlock.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-scratch.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-shared-linux-n32.ld
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-shared-linux-o32.ld
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-shared-linux.ld
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi4000.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spinlock.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-swap.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-sysinfo.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-sysinfo.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-thunder.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-thunder.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-tim.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-tim.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-tra.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-tra.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-twsi-raw.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-twsi-raw.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-twsi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-twsi.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-uart.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-usb.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-usb.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-utils.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-version.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-warn.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-warn.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-wqe.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-zip.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-zip.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-zone.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx.mk
  user/jmallett/octeon/sys/contrib/octeon-sdk/executive-config.h.template
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-feature.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-pci-console.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-pci-console.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/perfzilla_screen.png   (contents, props changed)

Added: user/jmallett/octeon/sys/contrib/octeon-sdk/README.txt
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/README.txt	Tue Apr 20 23:42:57 2010	(r206957)
@@ -0,0 +1,43 @@
+Readme for the Octeon Executive Library
+
+
+The Octeon Executive Library provides runtime support and hardware 
+abstraction for the Octeon processor.  The executive is composed of the 
+libcvmx.a library as well as header files that provide  
+functionality with inline functions.
+
+
+Usage:
+
+The libcvmx.a library is built for every application as part of the
+application build. (Please refer to the 'related pages' section of the 
+HTML documentation for more information on the build system.)  
+Applications using the executive should include the header files from
+$OCTEON_ROOT/target/include and link against the library that is built in 
+the local obj directory. Each file using the executive 
+should include the following two header files in order:
+
+#include "cvmx-config.h"
+#include "cvmx.h"
+
+The cvmx-config.h file contains configuration information for the 
+executive and is generated by the cvmx-config script from an 
+'executive-config.h' file. A sample version of this file is provided 
+in the executive directory as 'executive-config.h.template'.  
+
+Copy this file to 'executive-config.h' into the 'config' subdirectory 
+of the application directory and customize as required by the application. 
+Applications that don't use any simple executive functionality can omit 
+the cvmx-config.h header file. Please refer to the examples for a 
+demonstration of where to put the executive-config.h file and for an
+example of generated cvmx-config.h.
+
+For file specific information please see the documentation within the 
+source files or the HTML documentation provided in docs/html/index.html.
+The HTML documentation is automatically generated by Doxygen from the 
+source files.
+
+
+
+==========================================================================
+Please see the release notes for version specific information.

Added: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmip.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmip.h	Tue Apr 20 23:42:57 2010	(r206957)
@@ -0,0 +1,207 @@
+/***********************license start***************
+ *  Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
+ *  reserved.
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ *
+ *      * 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.
+ *
+ *      * Neither the name of Cavium Networks nor the names of
+ *        its contributors may be used to endorse or promote products
+ *        derived from this software without specific prior written
+ *        permission.
+ *
+ *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+ *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+ *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+ *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+ *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+ *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+ *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+ *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+ *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+ *
+ *
+ *  For any questions regarding licensing please contact marketing@caviumnetworks.com
+ *
+ ***********************license end**************************************/
+
+
+
+
+
+
+/**
+ * @file
+ *
+ * Cavium Networks Internet Protocol (IP)
+ *
+ * Definitions for the Internet Protocol (IP) support.
+ *
+ * <hr>$Revision: 41586 $<hr>
+ *
+ */
+
+#ifndef __CVMIP_H__
+#define __CVMIP_H__
+
+
+/*
+ * IP protocol values (1 byte)
+ *
+ */
+#define  CVMIP_PROTO_ICMP  1    /* Internet Control Message Protocol */
+#define  CVMIP_PROTO_TCP   6    /* Transmission Control Protocol */
+#define  CVMIP_PROTO_UDP  17    /* User Datagram Protocol */
+#define  CVMIP_PROTO_ESP  50    /* Encapsulated Security Payload */
+#define  CVMIP_PROTO_AH   51    /* Authentication Header */
+
+
+/**
+ * network packet header definitions
+ * (originally from octane_hw.h)
+ *
+ */
+
+/**
+ * UDP Packet header
+ */
+typedef struct {
+   union {
+      int32_t           s32     ;
+      uint32_t          u32     ;
+      struct {
+         uint16_t        src_prt ;
+         uint16_t        dst_prt ;
+      } s;
+   } prts;
+   uint16_t            len     ;
+   uint16_t            chksum  ;
+} cvmip_udp_hdr_t;
+
+/**
+ * TCP Packet header
+ */
+typedef struct {
+   uint16_t            src_prt ;
+   uint16_t            dst_prt ;
+   uint32_t            seq     ;
+   uint32_t            ack_seq ;
+   uint32_t            hlen    :4;
+   uint32_t            rsvd    :6;
+   uint32_t            urg     :1;
+   uint32_t            ack     :1;
+   uint32_t            psh     :1;
+   uint32_t            rst     :1;
+   uint32_t            syn     :1;
+   uint32_t            fin     :1;
+   uint16_t            win_sz  ;
+   uint16_t            chksum  ;
+   uint16_t            urg_ptr ;
+   uint32_t            junk    ;
+} cvmip_tcp_hdr_t;
+
+/**
+ * L4 Packet header
+ */
+typedef union {
+   cvmip_udp_hdr_t udphdr;
+   cvmip_tcp_hdr_t tcphdr;
+   struct {
+      union {
+         int32_t           s32    ;
+         uint32_t          u32    ;
+         struct {
+            uint16_t        src_prt;
+            uint16_t        dst_prt;
+         } s;
+      } prts;
+      uint16_t            len     ;
+      uint16_t            chksum  ;
+      char              dat[48] ; // 48 for IPv6 with no extension hdrs, 64 for IPv4 without options
+   } udp;
+   struct {
+      uint16_t            src_prt ;
+      uint16_t            dst_prt ;
+      uint32_t            seq     ;
+      uint32_t            ack_seq ;
+      uint32_t            hlen    :4;
+      uint32_t            rsvd    :6;
+      uint32_t            urg     :1;
+      uint32_t            ack     :1;
+      uint32_t            psh     :1;
+      uint32_t            rst     :1;
+      uint32_t            syn     :1;
+      uint32_t            fin     :1;
+      uint16_t            win_sz  ;
+      uint16_t            chksum  ;
+      uint16_t            urg_ptr ;
+      char              dat[36] ; // 36 for IPv6 with no extension hdrs, 52 for IPv6 without options
+   } tcp;
+} cvmip_l4_info_t;
+
+/**
+ * Special struct to add a pad to IPv4 header
+ */
+typedef struct {
+   uint32_t            pad;
+
+   uint32_t            version : 4;
+   uint32_t            hl      : 4;
+   uint8_t             tos     ;
+   uint16_t            len     ;
+
+   uint16_t            id      ;
+   uint32_t            mbz     : 1;
+   uint32_t            df      : 1;
+   uint32_t            mf      : 1;
+   uint32_t            off     :13;
+
+   uint8_t             ttl     ;
+   uint8_t             protocol;
+   uint16_t            chksum  ;
+
+   union {
+      uint64_t          u64;
+      struct {
+         uint32_t        src;
+         uint32_t        dst;
+      } s;
+   } src_dst;
+} cvmip_ipv4_hdr_t;
+
+/**
+ * IPv6 Packet header
+ */
+typedef struct {
+
+   uint32_t            version : 4;
+   uint32_t            v6class : 8;
+   uint32_t            flow    :20;
+
+   uint16_t            len     ;    // includes extension headers plus payload (add 40 to be equiv to v4 len field)
+   uint8_t             next_hdr;    // equivalent to the v4 protocol field
+   uint8_t             hop_lim ;    // equivalent to the v4 TTL field
+
+   union {
+      uint64_t          u64[4];
+      struct {
+         uint64_t        src[2];
+         uint64_t        dst[2];
+      } s;
+   } src_dst;
+
+} cvmip_ipv6_hdr_t;
+
+
+#endif /* __CVMIP_H__ */

Added: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-abi.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-abi.h	Tue Apr 20 23:42:57 2010	(r206957)
@@ -0,0 +1,92 @@
+/***********************license start***************
+ *  Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
+ *  reserved.
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ *
+ *      * 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.
+ *
+ *      * Neither the name of Cavium Networks nor the names of
+ *        its contributors may be used to endorse or promote products
+ *        derived from this software without specific prior written
+ *        permission.
+ *
+ *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+ *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+ *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+ *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+ *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+ *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+ *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+ *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+ *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+ *
+ *
+ *  For any questions regarding licensing please contact marketing@caviumnetworks.com
+ *
+ ***********************license end**************************************/
+
+
+
+
+
+
+/**
+ * @file
+ *
+ * This file defines macros for use in determining the current calling ABI.
+ *
+ * <hr>$Revision: 41586 $<hr>
+*/
+
+#ifndef __CVMX_ABI_H__
+#define __CVMX_ABI_H__
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/* Check for N32 ABI, defined for 32-bit Simple Exec applications
+   and Linux N32 ABI.*/
+#if (defined _ABIN32 && _MIPS_SIM == _ABIN32)
+#define CVMX_ABI_N32
+/* Check for N64 ABI, defined for 64-bit Linux toolchain. */
+#elif (defined _ABI64 && _MIPS_SIM == _ABI64)
+#define CVMX_ABI_N64
+/* Check for O32 ABI, defined for Linux 032 ABI, not supported yet. */
+#elif (defined _ABIO32 && _MIPS_SIM == _ABIO32)
+#define CVMX_ABI_O32
+/* Check for EABI ABI, defined for 64-bit Simple Exec applications. */
+#else
+#define CVMX_ABI_EABI
+#endif
+
+#ifndef __BYTE_ORDER
+    #if defined(__BIG_ENDIAN) && !defined(__LITTLE_ENDIAN)
+        #define __BYTE_ORDER __BIG_ENDIAN
+    #elif !defined(__BIG_ENDIAN) && defined(__LITTLE_ENDIAN)
+        #define __BYTE_ORDER __LITTLE_ENDIAN
+        #define __BIG_ENDIAN 4321
+    #elif !defined(__BIG_ENDIAN) && !defined(__LITTLE_ENDIAN)
+        #define __BIG_ENDIAN 4321
+        #define __BYTE_ORDER __BIG_ENDIAN
+    #else
+        #error Unable to determine Endian mode
+    #endif
+#endif
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif /* __CVMX_ABI_H__ */

Added: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h	Tue Apr 20 23:42:57 2010	(r206957)
@@ -0,0 +1,667 @@
+/***********************license start***************
+ *  Copyright (c) 2003-2009 Cavium Networks (support@cavium.com). All rights
+ *  reserved.
+ *
+ *
+ *  Redistribution and use in source and binary forms, with or without
+ *  modification, are permitted provided that the following conditions are
+ *  met:
+ *
+ *      * Redistributions of source code must retain the above copyright
+ *        notice, this list of conditions and the following disclaimer.
+ *
+ *      * 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.
+ *
+ *      * Neither the name of Cavium Networks nor the names of
+ *        its contributors may be used to endorse or promote products
+ *        derived from this software without specific prior written
+ *        permission.
+ *
+ *  TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ *  AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+ *  OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+ *  RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+ *  REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+ *  DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+ *  OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+ *  PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+ *  POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+ *  OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+ *
+ *
+ *  For any questions regarding licensing please contact marketing@caviumnetworks.com
+ *
+ ***********************license end**************************************/
+
+/**
+ * @file
+ * Functions for accessing memory and CSRs on Octeon when we are compiling
+ * natively.
+ *
+ * <hr>$Revision: 38306 $<hr>
+*/
+#ifndef __CVMX_ACCESS_NATIVE_H__
+#define __CVMX_ACCESS_NATIVE_H__
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/**
+ * Returns the Octeon processor ID.
+ *
+ * @return Octeon processor ID from COP0
+ */
+static inline uint32_t cvmx_get_proc_id(void)
+{
+#ifdef CVMX_BUILD_FOR_LINUX_USER
+    extern uint32_t cvmx_app_init_processor_id;
+    return cvmx_app_init_processor_id;
+#else
+    uint32_t id;
+    asm ("mfc0 %0, $15,0" : "=r" (id));
+    return id;
+#endif
+}
+
+/**
+ * Convert a memory pointer (void*) into a hardware compatable
+ * memory address (uint64_t). Octeon hardware widgets don't
+ * understand logical addresses.
+ *
+ * @param ptr    C style memory pointer
+ * @return Hardware physical address
+ */
+static inline uint64_t cvmx_ptr_to_phys(void *ptr)
+{
+    if (CVMX_ENABLE_PARAMETER_CHECKING)
+        cvmx_warn_if(ptr==NULL, "cvmx_ptr_to_phys() passed a NULL pointer\n");
+
+#ifdef CVMX_BUILD_FOR_UBOOT
+    /* U-boot is a special case, as it is running in error level, which disables the TLB completely.
+    ** U-boot may use kseg0 addresses, or may directly use physical addresses already */
+    return(CAST64(ptr) & 0x7FFFFFFF);
+#endif
+
+#ifdef __linux__
+    if (sizeof(void*) == 8)
+    {
+        /* We're running in 64 bit mode. Normally this means that we can use
+            40 bits of address space (the hardware limit). Unfortunately there
+            is one case were we need to limit this to 30 bits, sign extended
+            32 bit. Although these are 64 bits wide, only 30 bits can be used */
+        if ((CAST64(ptr) >> 62) == 3)
+            return CAST64(ptr) & cvmx_build_mask(30);
+        else
+            return CAST64(ptr) & cvmx_build_mask(40);
+    }
+    else
+    {
+#ifdef __KERNEL__
+	return (long)(ptr) & 0x1fffffff;
+#else
+        extern uint64_t linux_mem32_offset;
+        if (cvmx_likely(ptr))
+            return CAST64(ptr) - linux_mem32_offset;
+        else
+            return 0;
+#endif
+    }
+#elif defined(_WRS_KERNEL)
+	return (long)(ptr) & 0x7fffffff;
+#elif defined(VXWORKS_USER_MAPPINGS)
+    /* This mapping mode is used in vxWorks 5.5 to support 2GB of ram. The
+        2nd 256MB is mapped at 0x10000000 and the rest of memory is 1:1 */
+    uint64_t address = (long)ptr;
+    if (address & 0x80000000)
+        return address & 0x1fffffff;    /* KSEG pointers directly map the lower 256MB and bootbus */
+    else if ((address >= 0x10000000) && (address < 0x20000000))
+        return address + 0x400000000ull;   /* 256MB-512MB is a virtual mapping for the 2nd 256MB */
+    else
+        return address; /* Looks to be a 1:1 mapped userspace pointer */
+#else
+#if CVMX_USE_1_TO_1_TLB_MAPPINGS
+    /* We are assumung we're running the Simple Executive standalone. In this
+        mode the TLB is setup to perform 1:1 mapping and 32 bit sign extended
+        addresses are never used. Since we know all this, save the masking
+        cycles and do nothing */
+    return CAST64(ptr);
+#else
+
+    if (sizeof(void*) == 8)
+    {
+        /* We're running in 64 bit mode. Normally this means that we can use
+            40 bits of address space (the hardware limit). Unfortunately there
+            is one case were we need to limit this to 30 bits, sign extended
+            32 bit. Although these are 64 bits wide, only 30 bits can be used */
+        if ((CAST64(ptr) >> 62) == 3)
+            return CAST64(ptr) & cvmx_build_mask(30);
+        else
+            return CAST64(ptr) & cvmx_build_mask(40);
+    }
+    else
+	return (long)(ptr) & 0x7fffffff;
+
+#endif
+#endif
+}
+
+
+/**
+ * Convert a hardware physical address (uint64_t) into a
+ * memory pointer (void *).
+ *
+ * @param physical_address
+ *               Hardware physical address to memory
+ * @return Pointer to memory
+ */
+static inline void *cvmx_phys_to_ptr(uint64_t physical_address)
+{
+    if (CVMX_ENABLE_PARAMETER_CHECKING)
+        cvmx_warn_if(physical_address==0, "cvmx_phys_to_ptr() passed a zero address\n");
+
+#ifdef CVMX_BUILD_FOR_UBOOT
+    /* U-boot is a special case, as it is running in error level, which disables the TLB completely.
+    ** U-boot may use kseg0 addresses, or may directly use physical addresses already */
+    if (physical_address >= 0x80000000)
+        return NULL;
+    else
+        return CASTPTR(void, (physical_address & 0x7FFFFFFF));
+#endif
+
+#ifdef __linux__
+    if (sizeof(void*) == 8)
+    {
+        /* Just set the top bit, avoiding any TLB uglyness */
+        return CASTPTR(void, CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, physical_address));
+    }
+    else
+    {
+#ifdef __KERNEL__
+	return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+#else
+        extern uint64_t linux_mem32_offset;
+        if (cvmx_likely(physical_address))
+            return CASTPTR(void, physical_address + linux_mem32_offset);
+        else
+            return NULL;
+#endif
+    }
+#elif defined(_WRS_KERNEL)
+	return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+#elif defined(VXWORKS_USER_MAPPINGS)
+    /* This mapping mode is used in vxWorks 5.5 to support 2GB of ram. The
+        2nd 256MB is mapped at 0x10000000 and the rest of memory is 1:1 */
+    if ((physical_address >= 0x10000000) && (physical_address < 0x20000000))
+        return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+    else if ((physical_address >= 0x410000000ull) && (physical_address < 0x420000000ull))
+        return CASTPTR(void, physical_address - 0x400000000ull);
+    else
+        return CASTPTR(void, physical_address);
+#else
+
+#if CVMX_USE_1_TO_1_TLB_MAPPINGS
+        /* We are assumung we're running the Simple Executive standalone. In this
+            mode the TLB is setup to perform 1:1 mapping and 32 bit sign extended
+            addresses are never used. Since we know all this, save bit insert
+            cycles and do nothing */
+    return CASTPTR(void, physical_address);
+#else
+    /* Set the XKPHYS/KSEG0 bit as appropriate based on ABI */
+    if (sizeof(void*) == 8)
+        return CASTPTR(void, CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, physical_address));
+    else
+	return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+
+#endif
+
+#endif
+}
+
+
+/* The following #if controls the definition of the macro
+    CVMX_BUILD_WRITE64. This macro is used to build a store operation to
+    a full 64bit address. With a 64bit ABI, this can be done with a simple
+    pointer access. 32bit ABIs require more complicated assembly */
+#if defined(CVMX_ABI_N64) || defined(CVMX_ABI_EABI)
+
+/* We have a full 64bit ABI. Writing to a 64bit address can be done with
+    a simple volatile pointer */
+#define CVMX_BUILD_WRITE64(TYPE, ST)                                    \
+static inline void cvmx_write64_##TYPE(uint64_t addr, TYPE##_t val)     \
+{                                                                       \
+    *CASTPTR(volatile TYPE##_t, addr) = val;                            \
+}
+
+#elif defined(CVMX_ABI_N32)
+
+/* The N32 ABI passes all 64bit quantities in a single register, so it is
+    possible to use the arguments directly. We have to use inline assembly
+    for the actual store since a pointer would truncate the address */
+#define CVMX_BUILD_WRITE64(TYPE, ST)                                    \
+static inline void cvmx_write64_##TYPE(uint64_t addr, TYPE##_t val)     \
+{                                                                       \
+    asm volatile (ST " %[v], 0(%[c])" ::[v] "r" (val), [c] "r" (addr)); \
+}
+
+#elif defined(CVMX_ABI_O32)
+
+#ifdef __KERNEL__
+#define CVMX_BUILD_WRITE64(TYPE, LT) extern void cvmx_write64_##TYPE(uint64_t csr_addr, TYPE##_t val);
+#else
+
+/* Ok, now the ugly stuff starts. O32 splits 64bit quantities into two
+    separate registers. Assembly must be used to put them back together
+    before they're used. What should be a simple store becomes a
+    convoluted mess of shifts and ors */
+#define CVMX_BUILD_WRITE64(TYPE, ST)                                    \
+static inline void cvmx_write64_##TYPE(uint64_t csr_addr, TYPE##_t val) \
+{                                                                       \
+    if (sizeof(TYPE##_t) == 8)                                          \
+    {                                                                   \
+        uint32_t csr_addrh = csr_addr>>32;                              \
+        uint32_t csr_addrl = csr_addr;                                  \
+        uint32_t valh = (uint64_t)val>>32;                              \
+        uint32_t vall = val;                                            \
+        uint32_t tmp1;                                                  \
+        uint32_t tmp2;                                                  \
+        uint32_t tmp3;                                                  \
+                                                                        \
+        asm volatile (                                                  \
+            ".set push\n"                                             \
+            ".set mips64\n"                                             \
+            "dsll   %[tmp1], %[valh], 32\n"                             \
+            "dsll   %[tmp2], %[csrh], 32\n"                             \
+            "dsll   %[tmp3], %[vall], 32\n"                             \
+            "dsrl   %[tmp3], %[tmp3], 32\n"                             \
+            "or     %[tmp1], %[tmp1], %[tmp3]\n"                        \
+            "dsll   %[tmp3], %[csrl], 32\n"                             \
+            "dsrl   %[tmp3], %[tmp3], 32\n"                             \
+            "or     %[tmp2], %[tmp2], %[tmp3]\n"                        \
+            ST "    %[tmp1], 0(%[tmp2])\n"                              \
+            ".set pop\n"                                             \
+            : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2), [tmp3] "=&r" (tmp3)\
+            : [valh] "r" (valh), [vall] "r" (vall),                     \
+              [csrh] "r" (csr_addrh), [csrl] "r" (csr_addrl)            \
+        );                                                              \
+    }                                                                   \
+    else                                                                \
+    {                                                                   \
+        uint32_t csr_addrh = csr_addr>>32;                              \
+        uint32_t csr_addrl = csr_addr;                                  \
+        uint32_t tmp1;                                                  \
+        uint32_t tmp2;                                                  \
+                                                                        \
+        asm volatile (                                                  \
+            ".set push\n"                                             \
+            ".set mips64\n"                                             \
+            "dsll   %[tmp1], %[csrh], 32\n"                             \
+            "dsll   %[tmp2], %[csrl], 32\n"                             \
+            "dsrl   %[tmp2], %[tmp2], 32\n"                             \
+            "or     %[tmp1], %[tmp1], %[tmp2]\n"                        \
+            ST "    %[val], 0(%[tmp1])\n"                               \
+            ".set pop\n"                                             \
+            : [tmp1] "=&r" (tmp1), [tmp2] "=&r" (tmp2)                  \
+            : [val] "r" (val), [csrh] "r" (csr_addrh),                  \
+              [csrl] "r" (csr_addrl)                                    \
+        );                                                              \
+    }                                                                   \
+}
+
+#endif
+
+#else
+
+/* cvmx-abi.h didn't recognize the ABI. Force the compile to fail. */
+#error: Unsupported ABI
+
+#endif
+
+/* The following #if controls the definition of the macro
+    CVMX_BUILD_READ64. This macro is used to build a load operation from
+    a full 64bit address. With a 64bit ABI, this can be done with a simple
+    pointer access. 32bit ABIs require more complicated assembly */
+#if defined(CVMX_ABI_N64) || defined(CVMX_ABI_EABI)
+
+/* We have a full 64bit ABI. Writing to a 64bit address can be done with
+    a simple volatile pointer */
+#define CVMX_BUILD_READ64(TYPE, LT)                                     \
+static inline TYPE##_t cvmx_read64_##TYPE(uint64_t addr)                \
+{                                                                       \
+    return *CASTPTR(volatile TYPE##_t, addr);                           \
+}
+
+#elif defined(CVMX_ABI_N32)
+
+/* The N32 ABI passes all 64bit quantities in a single register, so it is
+    possible to use the arguments directly. We have to use inline assembly
+    for the actual store since a pointer would truncate the address */
+#define CVMX_BUILD_READ64(TYPE, LT)                                     \
+static inline TYPE##_t cvmx_read64_##TYPE(uint64_t addr)                \
+{                                                                       \
+    TYPE##_t val;                                                       \
+    asm volatile (LT " %[v], 0(%[c])": [v] "=r" (val) : [c] "r" (addr));\
+    return val;                                                         \
+}
+
+#elif defined(CVMX_ABI_O32)
+
+#ifdef __KERNEL__
+#define CVMX_BUILD_READ64(TYPE, LT) extern TYPE##_t cvmx_read64_##TYPE(uint64_t csr_addr);
+#else
+
+/* Ok, now the ugly stuff starts. O32 splits 64bit quantities into two
+    separate registers. Assembly must be used to put them back together
+    before they're used. What should be a simple load becomes a
+    convoluted mess of shifts and ors */
+#define CVMX_BUILD_READ64(TYPE, LT)                                     \
+static inline TYPE##_t cvmx_read64_##TYPE(uint64_t csr_addr)            \
+{                                                                       \
+    if (sizeof(TYPE##_t) == 8)                                          \
+    {                                                                   \
+        uint32_t csr_addrh = csr_addr>>32;                              \
+        uint32_t csr_addrl = csr_addr;                                  \
+        uint32_t valh;                                                  \
+        uint32_t vall;                                                  \
+                                                                        \
+        asm volatile (                                                  \
+            ".set push\n"                                               \
+            ".set mips64\n"                                             \
+            "dsll   %[valh], %[csrh], 32\n"                             \
+            "dsll   %[vall], %[csrl], 32\n"                             \
+            "dsrl   %[vall], %[vall], 32\n"                             \
+            "or     %[valh], %[valh], %[vall]\n"                        \
+            LT "    %[vall], 0(%[valh])\n"                              \
+            "dsrl   %[valh], %[vall], 32\n"                             \
+            "sll    %[vall], 0\n"                                       \
+            "sll    %[valh], 0\n"                                       \
+            ".set pop\n"                                                \
+            : [valh] "=&r" (valh), [vall] "=&r" (vall)                  \
+            : [csrh] "r" (csr_addrh), [csrl] "r" (csr_addrl)            \
+        );                                                              \
+        return ((uint64_t)valh<<32) | vall;                             \
+    }                                                                   \
+    else                                                                \
+    {                                                                   \
+        uint32_t csr_addrh = csr_addr>>32;                              \
+        uint32_t csr_addrl = csr_addr;                                  \
+        TYPE##_t val;                                                   \
+        uint32_t tmp;                                                   \
+                                                                        \
+        asm volatile (                                                  \
+            ".set push\n"                                             \
+            ".set mips64\n"                                             \
+            "dsll   %[val], %[csrh], 32\n"                              \
+            "dsll   %[tmp], %[csrl], 32\n"                              \
+            "dsrl   %[tmp], %[tmp], 32\n"                               \
+            "or     %[val], %[val], %[tmp]\n"                           \
+            LT "    %[val], 0(%[val])\n"                                \
+            ".set pop\n"                                             \
+            : [val] "=&r" (val), [tmp] "=&r" (tmp)                      \
+            : [csrh] "r" (csr_addrh), [csrl] "r" (csr_addrl)            \
+        );                                                              \
+        return val;                                                     \
+    }                                                                   \
+}
+
+#endif /* __KERNEL__ */
+
+#else
+
+/* cvmx-abi.h didn't recognize the ABI. Force the compile to fail. */
+#error: Unsupported ABI
+
+#endif
+
+/* The following defines 8 functions for writing to a 64bit address. Each
+    takes two arguments, the address and the value to write.
+    cvmx_write64_int64      cvmx_write64_uint64
+    cvmx_write64_int32      cvmx_write64_uint32
+    cvmx_write64_int16      cvmx_write64_uint16
+    cvmx_write64_int8       cvmx_write64_uint8 */
+CVMX_BUILD_WRITE64(int64, "sd");
+CVMX_BUILD_WRITE64(int32, "sw");
+CVMX_BUILD_WRITE64(int16, "sh");
+CVMX_BUILD_WRITE64(int8, "sb");
+CVMX_BUILD_WRITE64(uint64, "sd");
+CVMX_BUILD_WRITE64(uint32, "sw");
+CVMX_BUILD_WRITE64(uint16, "sh");
+CVMX_BUILD_WRITE64(uint8, "sb");
+
+/* The following defines 8 functions for reading from a 64bit address. Each
+    takes the address as the only argument
+    cvmx_read64_int64       cvmx_read64_uint64
+    cvmx_read64_int32       cvmx_read64_uint32
+    cvmx_read64_int16       cvmx_read64_uint16
+    cvmx_read64_int8        cvmx_read64_uint8 */
+CVMX_BUILD_READ64(int64, "ld");
+CVMX_BUILD_READ64(int32, "lw");
+CVMX_BUILD_READ64(int16, "lh");
+CVMX_BUILD_READ64(int8, "lb");
+CVMX_BUILD_READ64(uint64, "ld");
+CVMX_BUILD_READ64(uint32, "lw");
+CVMX_BUILD_READ64(uint16, "lhu");
+CVMX_BUILD_READ64(uint8, "lbu");
+
+static inline void cvmx_write_csr(uint64_t csr_addr, uint64_t val)
+{
+    cvmx_write64_uint64(csr_addr, val);
+
+    /* Perform an immediate read after every write to an RSL register to force
+        the write to complete. It doesn't matter what RSL read we do, so we
+        choose CVMX_MIO_BOOT_BIST_STAT because it is fast and harmless */
+    if ((csr_addr >> 40) == (0x800118))
+        cvmx_read64_uint64(CVMX_MIO_BOOT_BIST_STAT);
+}
+
+static inline void cvmx_write_io(uint64_t io_addr, uint64_t val)
+{
+    cvmx_write64_uint64(io_addr, val);
+}
+
+static inline uint64_t cvmx_read_csr(uint64_t csr_addr)
+{
+    return cvmx_read64_uint64(csr_addr);
+}
+
+static inline void cvmx_send_single(uint64_t data)
+{
+    const uint64_t CVMX_IOBDMA_SENDSINGLE = 0xffffffffffffa200ull;
+    cvmx_write64_uint64(CVMX_IOBDMA_SENDSINGLE, data);
+}
+
+static inline void cvmx_read_csr_async(uint64_t scraddr, uint64_t csr_addr)
+{
+    union
+    {
+        uint64_t    u64;
+        struct {
+            uint64_t    scraddr : 8;
+            uint64_t    len     : 8;
+            uint64_t    addr    :48;
+        } s;
+    } addr;
+    addr.u64 = csr_addr;
+    addr.s.scraddr = scraddr >> 3;
+    addr.s.len = 1;
+    cvmx_send_single(addr.u64);
+}
+
+
+/**
+ * Number of the Core on which the program is currently running. 
+ *
+ * @return Number of cores
+ */
+static inline unsigned int cvmx_get_core_num(void)
+{
+    unsigned int core_num;
+    CVMX_RDHWRNV(core_num, 0);
+    return core_num;
+}
+
+
+/**
+ * Returns the number of bits set in the provided value.
+ * Simple wrapper for POP instruction.
+ *
+ * @param val    32 bit value to count set bits in
+ *
+ * @return Number of bits set
+ */
+static inline uint32_t cvmx_pop(uint32_t val)
+{
+    uint32_t pop;
+    CVMX_POP(pop, val);
+    return pop;
+}
+
+
+/**
+ * Returns the number of bits set in the provided value.
+ * Simple wrapper for DPOP instruction.
+ *
+ * @param val    64 bit value to count set bits in
+ *
+ * @return Number of bits set
+ */
+static inline int cvmx_dpop(uint64_t val)
+{
+    int pop;
+    CVMX_DPOP(pop, val);
+    return pop;
+}
+
+
+/**
+ * Provide current cycle counter as a return value
+ *
+ * @return current cycle counter
+ */
+static inline uint64_t cvmx_get_cycle(void)
+{
+#if defined(CVMX_ABI_O32)
+    uint32_t tmp_low, tmp_hi;
+
+    asm volatile (
+               "   .set push                    \n"
+               "   .set mips64r2                \n"
+               "   .set noreorder               \n"
+               "   rdhwr %[tmpl], $31           \n"
+               "   dsrl  %[tmph], %[tmpl], 32   \n"
+               "   sll   %[tmpl], 0             \n"
+               "   sll   %[tmph], 0             \n"
+               "   .set pop                 \n"
+                  : [tmpl] "=&r" (tmp_low), [tmph] "=&r" (tmp_hi) : );
+
+    return(((uint64_t)tmp_hi << 32) + tmp_low);
+#else
+    uint64_t cycle;
+    CVMX_RDHWR(cycle, 31);
+    return(cycle);
+#endif
+}
+
+
+/**
+ * Reads a chip global cycle counter.  This counts CPU cycles since
+ * chip reset.  The counter is 64 bit.
+ * This register does not exist on CN38XX pass 1 silicion
+ *
+ * @return Global chip cycle count since chip reset.
+ */
+static inline uint64_t cvmx_get_cycle_global(void)
+{
+    if (OCTEON_IS_MODEL(OCTEON_CN38XX_PASS1))
+        return 0;
+    else
+        return cvmx_read64_uint64(CVMX_IPD_CLK_COUNT);
+}
+
+
+/**
+ * Wait for the specified number of cycle
+ *
+ * @param cycles
+ */
+static inline void cvmx_wait(uint64_t cycles)
+{
+    uint64_t done = cvmx_get_cycle() + cycles;
+
+    while (cvmx_get_cycle() < done)
+    {
+        /* Spin */
+    }
+}
+
+
+/**
+ * Wait for the specified number of micro seconds
+ *
+ * @param usec   micro seconds to wait
+ */
+static inline void cvmx_wait_usec(uint64_t usec)
+{
+    uint64_t done = cvmx_get_cycle() + usec * cvmx_sysinfo_get()->cpu_clock_hz / 1000000;
+    while (cvmx_get_cycle() < done)
+    {
+        /* Spin */
+    }
+}
+
+
+/**
+ * Perform a soft reset of Octeon
+ *
+ * @return
+ */
+static inline void cvmx_reset_octeon(void)
+{
+    cvmx_ciu_soft_rst_t ciu_soft_rst;
+    ciu_soft_rst.u64 = 0;
+    ciu_soft_rst.s.soft_rst = 1;
+    cvmx_write_csr(CVMX_CIU_SOFT_RST, ciu_soft_rst.u64);
+}
+
+
+/**
+ * Read a byte of fuse data
+ * @param byte_addr   address to read
+ *
+ * @return fuse value: 0 or 1
+ */
+static inline uint8_t cvmx_fuse_read_byte(int byte_addr)
+{
+    cvmx_mio_fus_rcmd_t read_cmd;
+
+    read_cmd.u64 = 0;
+    read_cmd.s.addr = byte_addr;
+    read_cmd.s.pend = 1;
+    cvmx_write_csr(CVMX_MIO_FUS_RCMD, read_cmd.u64);
+    while ((read_cmd.u64 = cvmx_read_csr(CVMX_MIO_FUS_RCMD)) && read_cmd.s.pend)
+        ;
+    return(read_cmd.s.dat);

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

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 23:45:09 2010
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 DB75E106577E;
	Tue, 20 Apr 2010 23:45:09 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C9C238FC26;
	Tue, 20 Apr 2010 23:45:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KNj9Ag081049;
	Tue, 20 Apr 2010 23:45:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KNj9iY081039;
	Tue, 20 Apr 2010 23:45:09 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004202345.o3KNj9iY081039@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Tue, 20 Apr 2010 23:45: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: r206959 - in user/jmallett/octeon/sys/mips: cavium
	cavium/dev/rgmii conf
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, 20 Apr 2010 23:45:09 -0000

Author: jmallett
Date: Tue Apr 20 23:45:09 2010
New Revision: 206959
URL: http://svn.freebsd.org/changeset/base/206959

Log:
  Move to using the SDK's version of spinlocks, chords and a few other things.

Added:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
Modified:
  user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.c
  user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.h
  user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c
  user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.h
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
  user/jmallett/octeon/sys/mips/conf/OCTEON1
  user/jmallett/octeon/sys/mips/conf/OCTEON1-32
  user/jmallett/octeon/sys/mips/conf/OCTEON1-o32

Added: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Tue Apr 20 23:45:09 2010	(r206959)
@@ -0,0 +1,7 @@
+#ifndef	_CVMX_CONFIG_H
+#define	_CVMX_CONFIG_H
+
+#define	asm		__asm
+#define	volatile	__volatile
+
+#endif /* !_CVMX_CONFIG_H */

Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.c	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.c	Tue Apr 20 23:45:09 2010	(r206959)
@@ -51,6 +51,10 @@ __FBSDID("$FreeBSD$");
 #include <vm/pmap.h>
 
 #include <mips/cavium/octeon_pcmap_regs.h>
+
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-spinlock.h>
+
 #include "octeon_fau.h"
 #include "octeon_fpa.h"
 #include "octeon_pko.h"
@@ -355,7 +359,7 @@ octeon_pko_status_t octeon_pko_config_po
             }
 
             sw_queues[queue].xmit_command_state = (buf_ptr << OCTEON_PKO_INDEX_BITS);
-            octeon_spinlock_init(&(sw_queues[queue].lock));
+            cvmx_spinlock_init(&(sw_queues[queue].lock));
 
 //#define DEBUG_TX
 

Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.h	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_pko.h	Tue Apr 20 23:45:09 2010	(r206959)
@@ -49,7 +49,6 @@
 #define ___OCTEON_PKO__H___
 
 
-
 /*
  * PKO Command Buffer Register.
  * Specify Pool-# and Size of each entry in Pool. For Output Cmd Buffers.
@@ -225,7 +224,7 @@ typedef union {
 typedef struct octeon_pko_sw_queue_info_t_
 {
     uint64_t xmit_command_state;
-    octeon_spinlock_t lock;
+    cvmx_spinlock_t lock;
     uint32_t pad[29];
 } octeon_pko_sw_queue_info_t;
 
@@ -260,7 +259,7 @@ static inline void octeon_pko_ring_doorb
    ptr.bits.is_io      = 1;
    ptr.bits.port       = port;
    ptr.bits.queue      = queue;
-   OCTEON_SYNCWS;
+   CVMX_SYNCWS;
    oct_write64(ptr.word64, len);
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.c	Tue Apr 20 23:45:09 2010	(r206959)
@@ -88,6 +88,10 @@ __FBSDID("$FreeBSD$");
 
 #include <mips/cavium/octeon_pcmap_regs.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-scratch.h>
+#include <contrib/octeon-sdk/cvmx-spinlock.h>
+
 #include "octeon_fau.h"
 #include "octeon_fpa.h"
 #include "octeon_ipd.h"
@@ -981,7 +985,7 @@ static u_int octeon_rgmx_pko_xmit_packet
     /*
      * Get the queue command ptr location from the per port per queue, pko info struct.
      */
-    octeon_spinlock_lock(&(sc->outq_ptr[queue].lock));
+    cvmx_spinlock_lock(&(sc->outq_ptr[queue].lock));
 #ifdef DEBUG_TX
     printf(" xmit: sc->outq_ptr[queue].xmit_command_state: 0x%llX  ", sc->outq_ptr[queue].xmit_command_state);
 #endif
@@ -1022,7 +1026,7 @@ static u_int octeon_rgmx_pko_xmit_packet
              * FPA pool for xmit-buffer-commands is empty.
              */
             sc->outq_ptr[queue].xmit_command_state -= 2;
-            octeon_spinlock_unlock(&(sc->outq_ptr[queue].lock));
+            cvmx_spinlock_unlock(&(sc->outq_ptr[queue].lock));
             return (0);
         }
 
@@ -1034,7 +1038,7 @@ static u_int octeon_rgmx_pko_xmit_packet
     /*
      * Unlock queue structures.
      */
-    octeon_spinlock_unlock(&(sc->outq_ptr[queue].lock));
+    cvmx_spinlock_unlock(&(sc->outq_ptr[queue].lock));
 
     /*
      * 2 words incremented in PKO. Ring the doorbell.

Modified: user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.h	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/cavium/dev/rgmii/octeon_rgmx.h	Tue Apr 20 23:45:09 2010	(r206959)
@@ -440,7 +440,7 @@ static inline void octeon_pow_tag_switch
 
     do
     {
-        OCTEON_CHORD_HEX(&switch_complete);
+        CVMX_MF_CHORD(switch_complete);
     } while (!switch_complete);
 
     return;
@@ -517,8 +517,8 @@ static inline octeon_wqe_t *octeon_pow_w
 {
     octeon_pow_tag_load_resp_t result;
 
-    OCTEON_SYNCIOBDMA;
-    result.word64 = oct_scratch_read64(scratch_addr);
+    CVMX_SYNCIOBDMA;
+    result.word64 = cvmx_scratch_read64(scratch_addr);
 
     if (result.s_work.no_work) {
         return NULL;

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Tue Apr 20 23:45:09 2010	(r206959)
@@ -62,26 +62,6 @@
 #define OCTEON_TMP_STR(x) OCTEON_TMP_STR2(x)
 #define OCTEON_TMP_STR2(x) #x
 
-#define OCTEON_PREFETCH_PREF0(address, offset) \
-	__asm __volatile (	".set mips64\n"	     \
-			".set noreorder\n"   \
-			"pref 0, " OCTEON_TMP_STR(offset) "(%0)\n" \
-			".set reorder\n"     \
-			".set mips0\n"	     \
-			 : \
-			 : "r" (address) );
-
-#define OCTEON_PREFETCH(address, offset) OCTEON_PREFETCH_PREF0(address,offset)
-
-#define OCTEON_PREFETCH0(address) OCTEON_PREFETCH(address, 0)
-#define OCTEON_PREFETCH128(address) OCTEON_PREFETCH(address, 128)
-
-#define OCTEON_SYNCIOBDMA __asm __volatile (".word 0x8f" : : :"memory")
-
-#define OCTEON_SYNCW	__asm __volatile (".word  0x10f" : : )
-#define OCTEON_SYNCW	__asm __volatile (".word  0x10f" : : )
-#define OCTEON_SYNCWS	__asm __volatile (".word  0x14f" : : )
-
 #if defined(__mips_n64)
 #define	oct_write64(a, v)	(*(volatile uint64_t *)(a) = (uint64_t)(v))
 #define	oct_write8_x8(a, v)	(*(volatile uint8_t *)(a) = (uint8_t)(v))
@@ -305,45 +285,6 @@ static inline void oct_write32 (uint64_t
 
 #define	oct_readint32(a)	((int32_t)oct_read32((a)))
 
-#define OCTEON_HW_BASE		((volatile uint64_t *) 0L)
-#define OCTEON_REG_OFFSET	(-4 * 1024ll)  /* local scratchpad reg base */
-#define OCTEON_SCRATCH_BASE	((volatile uint8_t *)(OCTEON_HW_BASE +	\
-                                                      OCTEON_REG_OFFSET))
-
-#define OCTEON_SCR_SCRATCH   8
-#define OCTEON_SCRATCH_0   16
-#define OCTEON_SCRATCH_1   24
-#define OCTEON_SCRATCH_2   32
-
-
-
-#define OCTEON_CHORD_HEX(dest_ptr)  \
-    ({ __asm __volatile( \
-            ".set push\n" \
-            ".set mips3\n" \
-            ".set noreorder\n" \
-            ".set noat\n" \
-	    ".word 0x7c02f03b \n"\
-            "nop\n" \
-            "nop\n" \
-            "nop\n" \
-            "nop\n" \
-            "sd $2,0(%0)\n" \
-            ".set pop" \
-            : /* no outputs */ : "r" (dest_ptr) : "$2"); \
-    })
-
-static inline uint64_t oct_scratch_read64 (uint64_t address)
-{
-    return(*((volatile uint64_t *)(OCTEON_SCRATCH_BASE + address)));
-}
-
-static inline void oct_scratch_write64 (uint64_t address, uint64_t value)
-{
-    *((volatile uint64_t *)(OCTEON_SCRATCH_BASE + address)) = value;
-}
-
-
 /*
  * Octeon Address Space Definitions
  */
@@ -552,63 +493,6 @@ static inline uint64_t octeon_build_bits
 }
 
 
-/**********************  simple spinlocks ***************/
-typedef struct {
-    volatile uint32_t value;
-} octeon_spinlock_t;
-
-// note - macros not expanded in inline ASM, so values hardcoded
-#define  OCTEON_SPINLOCK_UNLOCKED_VAL  0
-#define  OCTEON_SPINLOCK_LOCKED_VAL    1
-
-/**
- * Initialize a spinlock
- *
- * @param lock   Lock to initialize
- */
-static inline void octeon_spinlock_init(octeon_spinlock_t *lock)
-{
-    lock->value = OCTEON_SPINLOCK_UNLOCKED_VAL;
-}
-/**
- * Releases lock
- *
- * @param lock   pointer to lock structure
- */
-static inline void octeon_spinlock_unlock(octeon_spinlock_t *lock)
-{
-    OCTEON_SYNCWS;
-
-    lock->value = 0;
-    OCTEON_SYNCWS;
-}
-
-/**
- * Gets lock, spins until lock is taken
- *
- * @param lock   pointer to lock structure
- */
-static inline void octeon_spinlock_lock(octeon_spinlock_t *lock)
-{
-    unsigned int tmp;
-    __asm __volatile(
-    ".set noreorder         \n"
-    "1: ll   %1, %0  \n"
-    "   bnez %1, 1b     \n"
-    "   li   %1, 1      \n"
-    "   sc   %1, %0 \n"
-    "   beqz %1, 1b     \n"
-    "   nop                \n"
-    ".set reorder           \n"
-    :  "+m" (lock->value), "=&r" (tmp )
-    :
-    : "memory");
-}
-
-/********************** end simple spinlocks ***************/
-
-
-
 /* ------------------------------------------------------------------- *
  *                      octeon_get_chipid()                               *
  * ------------------------------------------------------------------- */
@@ -627,23 +511,6 @@ static inline uint32_t octeon_get_chipid
 }
 
 
-static inline uint32_t octeon_get_except_base_reg (void)
-{
-    uint32_t tmp;
-
-    __asm volatile (
-    "    .set mips64r2            \n"
-    "    .set noreorder         \n"
-    "    mfc0   %0, $15, 1  \n"
-    "    .set reorder           \n"
-     :  "=&r" (tmp) : );
-
-    return(tmp);
-}
-
-
-
-
 static inline unsigned int get_coremask (void)
 {
     return(~(oct_read64(OCTEON_CIU_PP_RST)) & 0xffff);
@@ -653,7 +520,7 @@ static inline unsigned int get_coremask 
 static inline uint32_t octeon_get_core_num (void)
 {
 
-    return (0x3FF & octeon_get_except_base_reg());
+    return (0x3FF & mips_rd_ebase());
 }
 
 
@@ -744,23 +611,6 @@ typedef union {
 #endif	/* LOCORE */
 
 
-/*
- * R4K Address space definitions
- */
-#define ADRSPC_K0BASE    (0x80000000)
-#define ADRSPC_K0SIZE    (0x20000000)
-#define ADRSPC_K1BASE    (0xA0000000)
-#define ADRSPC_K1SIZE    (0x20000000)
-#define ADRSPC_KSBASE    (0xC0000000)
-#define ADRSPC_KSSIZE    (0x20000000)
-#define ADRSPC_K3BASE    (0xE0000000)
-#define ADRSPC_K3SIZE    (0x20000000)
-#define ADRSPC_KUBASE    (0x00000000)
-#define ADRSPC_KUSIZE    (0x80000000)
-#define KSEG_MSB_ADDR    0xFFFFFFFF
-
-
-
 #define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
 
 

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1	Tue Apr 20 23:45:09 2010	(r206959)
@@ -28,7 +28,7 @@ machine		mips
 cpu		CPU_MIPS4KC
 ident		OCTEON1
 
-makeoptions	ARCH_FLAGS="-march=mips64"
+makeoptions	ARCH_FLAGS="-march=mips64r2"
 makeoptions	LDSCRIPT_NAME=ldscript.mips.octeon1
 
 # Don't build any modules yet.

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Tue Apr 20 23:45:09 2010	(r206959)
@@ -23,7 +23,7 @@ ident		OCTEON1
 
 # Don't build any modules yet.
 makeoptions	MODULES_OVERRIDE=""
-makeoptions	ARCH_FLAGS="-march=mips64"
+makeoptions	ARCH_FLAGS="-march=mips64r2"
 makeoptions     LDSCRIPT_NAME=ldscript.mips.octeon1
 
 makeoptions	KERNLOADADDR=0xffffffff81000000

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-o32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Tue Apr 20 23:43:32 2010	(r206958)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Tue Apr 20 23:45:09 2010	(r206959)
@@ -23,7 +23,7 @@ ident		OCTEON1
 
 # Don't build any modules yet.
 makeoptions	MODULES_OVERRIDE=""
-makeoptions	ARCH_FLAGS="-march=mips64"
+makeoptions	ARCH_FLAGS="-march=mips64r2"
 makeoptions     LDSCRIPT_NAME=ldscript.mips.octeon1
 
 makeoptions	KERNLOADADDR=0xffffffff81000000

From owner-svn-src-user@FreeBSD.ORG  Tue Apr 20 23:45:48 2010
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 E45BB106567D;
	Tue, 20 Apr 2010 23:45:48 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BAAE78FC39;
	Tue, 20 Apr 2010 23:45:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3KNjmcn081214;
	Tue, 20 Apr 2010 23:45:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3KNjmnv081211;
	Tue, 20 Apr 2010 23:45:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004202345.o3KNjmnv081211@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Tue, 20 Apr 2010 23:45:48 +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: r206960 - user/jmallett/octeon/sys/contrib/octeon-sdk
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, 20 Apr 2010 23:45:49 -0000

Author: jmallett
Date: Tue Apr 20 23:45:48 2010
New Revision: 206960
URL: http://svn.freebsd.org/changeset/base/206960

Log:
  Support building for FreeBSD's kernel.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.h

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h	Tue Apr 20 23:45:09 2010	(r206959)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h	Tue Apr 20 23:45:48 2010	(r206960)
@@ -103,6 +103,8 @@
     /* To build the simple exec toolchain runtime (newlib) library. We
        should only use features available on all Octeon models.  */
     #define CVMX_BUILD_FOR_TOOLCHAIN
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+    #define CVMX_BUILD_FOR_FREEBSD
 #else
     /* We are building a simple exec standalone image for Octeon */
     #define CVMX_BUILD_FOR_STANDALONE
@@ -187,6 +189,10 @@
     #include <string.h>
     #include <assert.h>
 
+#elif defined(CVMX_BUILD_FOR_FREEBSD)
+
+    #include <mips/cavium/cvmx_config.h>
+
 #else
 
     #error Unexpected CVMX_BUILD_FOR_* macro

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.h	Tue Apr 20 23:45:09 2010	(r206959)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/octeon-model.h	Tue Apr 20 23:45:48 2010	(r206960)
@@ -254,7 +254,7 @@ extern "C" {
        && (((chip_model) & OCTEON_58XX_MODEL_MASK) < ((arg_model) & OCTEON_58XX_MODEL_MASK))) \
     )))
 
-#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__))
+#if defined(USE_RUNTIME_MODEL_CHECKS) || defined(__U_BOOT__) || (defined(__linux__) && defined(__KERNEL__)) || (defined(__FreeBSD__) && defined(_KERNEL))
 
 /* NOTE: This for internal use only!!!!! */
 static inline int __octeon_is_model_runtime__(uint32_t model)

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 00:10:30 2010
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 9A2021065717;
	Wed, 21 Apr 2010 00:10:30 +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 89C928FC18;
	Wed, 21 Apr 2010 00:10:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L0AUJj086895;
	Wed, 21 Apr 2010 00:10:30 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L0AUNF086893;
	Wed, 21 Apr 2010 00:10:30 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004210010.o3L0AUNF086893@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Wed, 21 Apr 2010 00:10:30 +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: r206966 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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: Wed, 21 Apr 2010 00:10:30 -0000

Author: kmacy
Date: Wed Apr 21 00:10:30 2010
New Revision: 206966
URL: http://svn.freebsd.org/changeset/base/206966

Log:
  drop page lock when breaking out of pmap_copy loop

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 00:06:39 2010	(r206965)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 00:10:30 2010	(r206966)
@@ -4200,6 +4200,7 @@ pmap_copy(pmap_t dst_pmap, pmap_t src_pm
 					 	    addr);
 				    	    	pmap_free_zero_pages(free);
 					}
+					PA_UNLOCK(pa);
 					goto out;
 				}
 				PA_UNLOCK(pa);

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 01:39:52 2010
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 707E4106564A;
	Wed, 21 Apr 2010 01:39:52 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 553798FC14;
	Wed, 21 Apr 2010 01:39:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L1dqrF007527;
	Wed, 21 Apr 2010 01:39:52 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L1dqJL007523;
	Wed, 21 Apr 2010 01:39:52 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210139.o3L1dqJL007523@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 01:39:52 +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: r206974 - user/jmallett/octeon/sys/contrib/octeon-sdk
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: Wed, 21 Apr 2010 01:39:52 -0000

Author: jmallett
Date: Wed Apr 21 01:39:52 2010
New Revision: 206974
URL: http://svn.freebsd.org/changeset/base/206974

Log:
  o) Fix one case of missing CVMX_DONT_INCLUDE_CONFIG.
  o) Add physical<->virtual mapping code for FreeBSD kernel.
  o) Define away CVMX_SHARED when building for FreeBSD kernel.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h	Wed Apr 21 01:13:08 2010	(r206973)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-access-native.h	Wed Apr 21 01:39:52 2010	(r206974)
@@ -122,6 +122,8 @@ static inline uint64_t cvmx_ptr_to_phys(
         return address + 0x400000000ull;   /* 256MB-512MB is a virtual mapping for the 2nd 256MB */
     else
         return address; /* Looks to be a 1:1 mapped userspace pointer */
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+    return (pmap_kextract((vm_offset_t)ptr));
 #else
 #if CVMX_USE_1_TO_1_TLB_MAPPINGS
     /* We are assumung we're running the Simple Executive standalone. In this
@@ -201,6 +203,15 @@ static inline void *cvmx_phys_to_ptr(uin
         return CASTPTR(void, physical_address - 0x400000000ull);
     else
         return CASTPTR(void, physical_address);
+#elif defined(__FreeBSD__) && defined(_KERNEL)
+#if defined(__mips_n64)
+    return CASTPTR(void, CVMX_ADD_SEG(CVMX_MIPS_SPACE_XKPHYS, physical_address));
+#else
+    if (physical_address < 0x20000000)
+	return CASTPTR(void, CVMX_ADD_SEG32(CVMX_MIPS32_SPACE_KSEG0, physical_address));
+    else
+	panic("%s: mapping high address (%#jx) not yet supported.\n", __func__, (uintmax_t)physical_address);
+#endif
 #else
 
 #if CVMX_USE_1_TO_1_TLB_MAPPINGS

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h	Wed Apr 21 01:13:08 2010	(r206973)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h	Wed Apr 21 01:39:52 2010	(r206974)
@@ -92,8 +92,10 @@
 #ifndef __CVMX_CMD_QUEUE_H__
 #define __CVMX_CMD_QUEUE_H__
 
+#ifndef CVMX_DONT_INCLUDE_CONFIG
 #include "executive-config.h"
 #include "cvmx-config.h"
+#endif
 #include "cvmx-fpa.h"
 
 #ifdef	__cplusplus

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h	Wed Apr 21 01:13:08 2010	(r206973)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-platform.h	Wed Apr 21 01:39:52 2010	(r206974)
@@ -119,7 +119,11 @@
  * This is for data structures use by software ONLY,
  * as it is not 1-1 VA-PA mapped.
  */
+#if defined(CVMX_BUILD_FOR_FREEBSD)
+#define CVMX_SHARED
+#else
 #define CVMX_SHARED __attribute__ ((cvmx_shared))
+#endif
 
 
 #if defined(CVMX_BUILD_FOR_UBOOT)

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 01:43:50 2010
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 4AED21065670;
	Wed, 21 Apr 2010 01:43:50 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3951F8FC1A;
	Wed, 21 Apr 2010 01:43:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L1hoXM008433;
	Wed, 21 Apr 2010 01:43:50 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L1hoZW008426;
	Wed, 21 Apr 2010 01:43:50 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210143.o3L1hoZW008426@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 01:43:50 +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: r206975 - user/jmallett/octeon/sys/mips/cavium
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: Wed, 21 Apr 2010 01:43:50 -0000

Author: jmallett
Date: Wed Apr 21 01:43:49 2010
New Revision: 206975
URL: http://svn.freebsd.org/changeset/base/206975

Log:
  Move to using the SDK for more things.  This is incomplete at present and only
  boots multi-user with a single core.  Something goes amiss after the second
  core crashes.  This also disables the RGMII driver entirely as it is going to
  need substantially more work to move to the SDK.

Modified:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
  user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Wed Apr 21 01:43:49 2010	(r206975)
@@ -1,7 +1,18 @@
 #ifndef	_CVMX_CONFIG_H
 #define	_CVMX_CONFIG_H
 
+#include <sys/types.h>
+#include <sys/param.h>
+#include <sys/systm.h>
+
+#include <vm/vm.h>
+#include <vm/pmap.h>
+
+#include <machine/pmap.h>
+
 #define	asm		__asm
 #define	volatile	__volatile
 
+#define	CVMX_DONT_INCLUDE_CONFIG
+
 #endif /* !_CVMX_CONFIG_H */

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Wed Apr 21 01:43:49 2010	(r206975)
@@ -2,10 +2,6 @@
 # Octeon Support Files
 #
 mips/cavium/asm_octeon.S			optional smp
-mips/cavium/dev/rgmii/octeon_fpa.c		optional rgmii
-mips/cavium/dev/rgmii/octeon_ipd.c 		optional rgmii
-mips/cavium/dev/rgmii/octeon_pko.c		optional rgmii
-mips/cavium/dev/rgmii/octeon_rgmx.c		optional rgmii
 mips/cavium/obio.c				optional uart
 mips/cavium/octeon_ebt3000_cf.c			optional cf
 mips/cavium/octeon_machdep.c			standard
@@ -15,3 +11,11 @@ mips/cavium/uart_cpu_octeonusart.c		opti
 mips/cavium/uart_dev_oct16550.c			optional uart
 mips/mips/intr_machdep.c			standard
 mips/mips/tick.c				standard
+
+#mips/cavium/dev/rgmii/octeon_fpa.c		optional rgmii
+#mips/cavium/dev/rgmii/octeon_ipd.c 		optional rgmii
+#mips/cavium/dev/rgmii/octeon_pko.c		optional rgmii
+#mips/cavium/dev/rgmii/octeon_rgmx.c		optional rgmii
+mips/mips/tick.c				optional rgmii
+
+contrib/octeon-sdk/cvmx-sysinfo.c		standard

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 01:43:49 2010	(r206975)
@@ -70,6 +70,9 @@ __FBSDID("$FreeBSD$");
 #include <machine/trap.h>
 #include <machine/vmparam.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
+
 #if defined(__mips_n64) 
 #define MAX_APP_DESC_ADDR     0xffffffffafffffff
 #else
@@ -83,8 +86,6 @@ uint64_t ciu_get_en_reg_addr_new(int cor
 void ciu_dump_interrutps_enabled(int core_num, int intx, int enx, int ciu_ip);
 
 static void octeon_boot_params_init(register_t ptr);
-static uint64_t ciu_get_intr_sum_reg_addr(int core_num, int intx, int enx);
-static uint64_t ciu_get_intr_en_reg_addr(int core_num, int intx, int enx);
 
 void
 platform_cpu_init()
@@ -98,7 +99,7 @@ platform_cpu_init()
 void
 platform_reset(void)
 {
-	oct_write64(OCTEON_CIU_SOFT_RST, 1);
+	oct_write64(CVMX_CIU_SOFT_RST, 1);
 }
 
 void
@@ -195,23 +196,6 @@ octeon_debug_symbol(void)
 {
 }
 
-void
-octeon_ciu_stop_gtimer(int timer)
-{
-	oct_write64(OCTEON_CIU_GENTIMER_ADDR(timer), 0ll);
-}
-
-void
-octeon_ciu_start_gtimer(int timer, u_int one_shot, uint64_t time_cycles)
-{
-    	octeon_ciu_gentimer gentimer;
-
-        gentimer.word64 = 0;
-        gentimer.bits.one_shot = one_shot;
-        gentimer.bits.len = time_cycles - 1;
-        oct_write64(OCTEON_CIU_GENTIMER_ADDR(timer), gentimer.word64);
-}
-
 /*
  * octeon_ciu_reset
  *
@@ -220,294 +204,11 @@ octeon_ciu_start_gtimer(int timer, u_int
 void
 octeon_ciu_reset(void)
 {
-
-	octeon_ciu_stop_gtimer(CIU_GENTIMER_NUM_0);
-	octeon_ciu_stop_gtimer(CIU_GENTIMER_NUM_1);
-	octeon_ciu_stop_gtimer(CIU_GENTIMER_NUM_2);
-	octeon_ciu_stop_gtimer(CIU_GENTIMER_NUM_3);
-
-	ciu_disable_intr(CIU_THIS_CORE, CIU_INT_0, CIU_EN_0);
-	ciu_disable_intr(CIU_THIS_CORE, CIU_INT_0, CIU_EN_1);
-	ciu_disable_intr(CIU_THIS_CORE, CIU_INT_1, CIU_EN_0);
-	ciu_disable_intr(CIU_THIS_CORE, CIU_INT_1, CIU_EN_1);
-
-	ciu_clear_int_summary(CIU_THIS_CORE, CIU_INT_0, CIU_EN_0, 0ll);
-	ciu_clear_int_summary(CIU_THIS_CORE, CIU_INT_1, CIU_EN_0, 0ll);
-	ciu_clear_int_summary(CIU_THIS_CORE, CIU_INT_1, CIU_EN_1, 0ll);
-}
-
-/*
- * mips_disable_interrupt_controllers
- *
- * Disable interrupts in the CPU controller
- */
-void
-mips_disable_interrupt_controls(void)
-{
-	/*
-	 * Disable interrupts in CIU.
-	 */
-	octeon_ciu_reset();
-}
-
-/*
- * ciu_get_intr_sum_reg_addr
- */
-static uint64_t
-ciu_get_intr_sum_reg_addr(int core_num, int intx, int enx)
-{
-	uint64_t ciu_intr_sum_reg_addr;
-
-    	if (enx == CIU_EN_0)
-            	ciu_intr_sum_reg_addr = OCTEON_CIU_SUMMARY_BASE_ADDR +
-		    (core_num * 0x10) + (intx * 0x8);
-	else
-            	ciu_intr_sum_reg_addr = OCTEON_CIU_SUMMARY_INT1_ADDR;
-
-        return (ciu_intr_sum_reg_addr);
-}
-
-
-/*
- * ciu_get_intr_en_reg_addr
- */
-static uint64_t
-ciu_get_intr_en_reg_addr(int core_num, int intx, int enx)
-{
-	uint64_t ciu_intr_reg_addr;
-
-    	ciu_intr_reg_addr = OCTEON_CIU_ENABLE_BASE_ADDR + 
-	    ((enx == 0) ? 0x0 : 0x8) + (intx * 0x10) +  (core_num * 0x20);
-        return (ciu_intr_reg_addr);
-}
-
-
-
-
-/*
- * ciu_get_intr_reg_addr
- *
- * 200 ---int0,en0 ip2
- * 208 ---int0,en1 ip2 ----> this is wrong... this is watchdog
- * 
- * 210 ---int0,en0 ip3 --
- * 218 ---int0,en1 ip3 ----> same here.. .this is watchdog... right?
- * 
- * 220 ---int1,en0 ip2
- * 228 ---int1,en1 ip2
- * 230 ---int1,en0 ip3 --
- * 238 ---int1,en1 ip3
- *
- */
-uint64_t
-ciu_get_en_reg_addr_new(int corenum, int intx, int enx, int ciu_ip)
-{
-	uint64_t ciu_intr_reg_addr = OCTEON_CIU_ENABLE_BASE_ADDR;
-
-	/* XXX kasserts? */
-	if (enx < CIU_EN_0 || enx > CIU_EN_1) {
-		printf("%s: invalid enx value %d, should be %d or %d\n",
-		    __func__, enx, CIU_EN_0, CIU_EN_1);
-		return 0;
-	}
-	if (intx < CIU_INT_0 || intx > CIU_INT_1) {
-		printf("%s: invalid intx value %d, should be %d or %d\n",
-		    __func__, enx, CIU_INT_0, CIU_INT_1);
-		return 0;
-	}
-	if (ciu_ip < CIU_MIPS_IP2 || ciu_ip > CIU_MIPS_IP3) {
-		printf("%s: invalid ciu_ip value %d, should be %d or %d\n",
-		    __func__, ciu_ip, CIU_MIPS_IP2, CIU_MIPS_IP3);
-		return 0;
-	}
-
-	ciu_intr_reg_addr += (enx    * 0x8);
-	ciu_intr_reg_addr += (ciu_ip * 0x10);
-	ciu_intr_reg_addr += (intx   * 0x20);
-	return (ciu_intr_reg_addr);
-}
-
-/*
- * ciu_get_int_summary
- */
-uint64_t
-ciu_get_int_summary(int core_num, int intx, int enx)
-{
-	uint64_t ciu_intr_sum_reg_addr;
-
-	if (core_num == CIU_THIS_CORE)
-        	core_num = octeon_get_core_num();
-	ciu_intr_sum_reg_addr = ciu_get_intr_sum_reg_addr(core_num, intx, enx);
-	return (oct_read64(ciu_intr_sum_reg_addr));
-}
-
-//#define DEBUG_CIU 1
-
-#ifdef DEBUG_CIU
-#define DEBUG_CIU_SUM 1
-#define DEBUG_CIU_EN 1
-#endif
-
-
-/*
- * ciu_clear_int_summary
- */
-void
-ciu_clear_int_summary(int core_num, int intx, int enx, uint64_t write_bits)
-{
-	uint32_t cpu_status_bits;
-	uint64_t ciu_intr_sum_reg_addr;
-
-//#define DEBUG_CIU_SUM 1
-
-#ifdef DEBUG_CIU_SUM
-	uint64_t ciu_intr_sum_bits;
-#endif
-
-
-	if (core_num == CIU_THIS_CORE) {
-        	core_num = octeon_get_core_num();
-	}
-
-#ifdef DEBUG_CIU_SUM
-        printf(" CIU: core %u clear sum IntX %u  Enx %u  Bits: 0x%llX\n",
-	    core_num, intx, enx, write_bits);
-#endif
-
-	cpu_status_bits = intr_disable();
-
-	ciu_intr_sum_reg_addr = ciu_get_intr_sum_reg_addr(core_num, intx, enx);
-
-#ifdef DEBUG_CIU_SUM
-    	ciu_intr_sum_bits =  oct_read64(ciu_intr_sum_reg_addr);	/* unneeded dummy read */
-        printf(" CIU: status: 0x%X  reg_addr: 0x%llX   Val: 0x%llX   ->  0x%llX",
-	    cpu_status_bits, ciu_intr_sum_reg_addr, ciu_intr_sum_bits,
-	    ciu_intr_sum_bits | write_bits);
-#endif
-
-	oct_write64(ciu_intr_sum_reg_addr, write_bits);
-	oct_read64(OCTEON_MIO_BOOT_BIST_STAT);	/* Bus Barrier */
-
-#ifdef DEBUG_CIU_SUM
-        printf(" Readback: 0x%llX\n\n   ", (uint64_t) oct_read64(ciu_intr_sum_reg_addr));
-#endif
-    
-	intr_restore(cpu_status_bits);
-}
-
-/*
- * ciu_disable_intr
- */
-void
-ciu_disable_intr(int core_num, int intx, int enx)
-{
-	uint32_t cpu_status_bits;
-	uint64_t ciu_intr_reg_addr;
-
-	if (core_num == CIU_THIS_CORE)
-        	core_num = octeon_get_core_num();
-
-	cpu_status_bits = intr_disable();
-    
-	ciu_intr_reg_addr = ciu_get_intr_en_reg_addr(core_num, intx, enx);
-
-	oct_read64(ciu_intr_reg_addr);	/* Dummy read */
-
-	oct_write64(ciu_intr_reg_addr, 0LL);
-	oct_read64(OCTEON_MIO_BOOT_BIST_STAT);	/* Bus Barrier */
-
-	intr_restore(cpu_status_bits);
-}
-
-void
-ciu_dump_interrutps_enabled(int core_num, int intx, int enx, int ciu_ip)
-{
-
-	uint64_t ciu_intr_reg_addr;
-	uint64_t ciu_intr_bits;
-
-        if (core_num == CIU_THIS_CORE) {
-            	core_num = octeon_get_core_num();
-        }
-
-#ifndef OCTEON_SMP_1
-	ciu_intr_reg_addr = ciu_get_intr_en_reg_addr(core_num, intx, enx);
-#else
-	ciu_intr_reg_addr = ciu_get_en_reg_addr_new(core_num, intx, enx, ciu_ip);
-#endif
-
-        if (!ciu_intr_reg_addr) {
-            printf("Bad call to %s\n", __func__);
-            while(1);
-            return;
-        }
-
-	ciu_intr_bits =  oct_read64(ciu_intr_reg_addr);
-        printf(" CIU core %d  int: %d  en: %d  ip: %d  Add: %#llx  enabled: %#llx  SR: %x\n",
-	    core_num, intx, enx, ciu_ip, (unsigned long long)ciu_intr_reg_addr,
-	    (unsigned long long)ciu_intr_bits, mips_rd_status());
-}
-
-
-/*
- * ciu_enable_interrupts
- */
-void ciu_enable_interrupts(int core_num, int intx, int enx,
-    uint64_t set_these_interrupt_bits, int ciu_ip)
-{
-	uint32_t cpu_status_bits;
-	uint64_t ciu_intr_reg_addr;
-	uint64_t ciu_intr_bits;
-
-        if (core_num == CIU_THIS_CORE)
-            	core_num = octeon_get_core_num();
-
-//#define DEBUG_CIU_EN 1
-
-#ifdef DEBUG_CIU_EN
-        printf(" CIU: core %u enabling Intx %u  Enx %u IP %d  Bits: 0x%llX\n",
-	    core_num, intx, enx, ciu_ip, set_these_interrupt_bits);
-#endif
-
-	cpu_status_bits = intr_disable();
-
-#ifndef OCTEON_SMP_1
-	ciu_intr_reg_addr = ciu_get_intr_en_reg_addr(core_num, intx, enx);
-#else
-	ciu_intr_reg_addr = ciu_get_en_reg_addr_new(core_num, intx, enx, ciu_ip);
-#endif
-
-        if (!ciu_intr_reg_addr) {
-		printf("Bad call to %s\n", __func__);
-		while(1);
-		return;	/* XXX */
-        }
-
-	ciu_intr_bits =  oct_read64(ciu_intr_reg_addr);
-
-#ifdef DEBUG_CIU_EN
-        printf(" CIU: status: 0x%X  reg_addr: 0x%llX   Val: 0x%llX   ->  0x%llX",
-	    cpu_status_bits, ciu_intr_reg_addr, ciu_intr_bits, ciu_intr_bits | set_these_interrupt_bits);
-#endif
-	ciu_intr_bits |=  set_these_interrupt_bits;
-	oct_write64(ciu_intr_reg_addr, ciu_intr_bits);
-#ifdef SMP
-	mips_wbflush();
-#endif
-	oct_read64(OCTEON_MIO_BOOT_BIST_STAT);	/* Bus Barrier */
-
-#ifdef DEBUG_CIU_EN
-        printf(" Readback: 0x%llX\n\n   ",
-	    (uint64_t)oct_read64(ciu_intr_reg_addr));
-#endif
-
-	intr_restore(cpu_status_bits);
-}
-
-unsigned long
-octeon_get_clock_rate(void)
-{
-	return octeon_cpu_clock;
+	/* Disable all CIU interrupts by default */
+	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2), 0);
+	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2+1), 0);
+	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2), 0);
+	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2+1), 0);
 }
 
 static void
@@ -601,15 +302,15 @@ platform_start(__register_t a0, __regist
 	if (boothowto & RB_KDB)
 		kdb_enter(KDB_WHY_BOOTFLAGS, "Boot flags requested debugger");
 #endif
-	platform_counter_freq = octeon_get_clock_rate();
+	platform_counter_freq = cvmx_sysinfo_get()->cpu_clock_hz;
 	mips_timer_init_params(platform_counter_freq, 0);
 
 #ifdef SMP
 	/*
 	 * Clear any pending IPIs and enable the IPI interrupt.
 	 */
-	oct_write64(OCTEON_CIU_MBOX_CLRX(0), 0xffffffff);
-	ciu_enable_interrupts(0, CIU_INT_1, CIU_EN_0, OCTEON_CIU_ENABLE_MBOX_INTR, CIU_MIPS_IP3);
+	oct_write64(CVMX_CIU_MBOX_CLRX(0), 0xffffffff);
+	cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
 #endif
 }
 
@@ -642,7 +343,6 @@ platform_start(__register_t a0, __regist
 #define OCTEON_ARGV_MAX_ARGS            (64)
 #define OCTOEN_SERIAL_LEN 20
 
-
 typedef struct {
 	/* Start of block referenced by assembly code - do not change! */
 	uint32_t desc_version;
@@ -680,43 +380,10 @@ typedef struct {
 	uint64_t cvmx_desc_vaddr;
 } octeon_boot_descriptor_t;
 
-
-typedef struct {
-	uint32_t major_version;
-	uint32_t minor_version;
-
-	uint64_t stack_top;
-	uint64_t heap_base;
-	uint64_t heap_end;
-	uint64_t desc_vaddr;
-
-	uint32_t exception_base_addr;
-	uint32_t stack_size;
-	uint32_t flags;
-	uint32_t core_mask;
-	uint32_t dram_size;  /**< DRAM size in megabyes */
-	uint32_t phy_mem_desc_addr;  /**< physical address of free memory descriptor block*/
-	uint32_t debugger_flags_base_addr;  /**< used to pass flags from app to debugger */
-	uint32_t eclock_hz;  /**< CPU clock speed, in hz */
-	uint32_t dclock_hz;  /**< DRAM clock speed, in hz */
-	uint32_t spi_clock_hz;  /**< SPI4 clock in hz */
-	uint16_t board_type;
-	uint8_t board_rev_major;
-	uint8_t board_rev_minor;
-	uint16_t chip_type;
-	uint8_t chip_rev_major;
-	uint8_t chip_rev_minor;
-	char board_serial_number[OCTOEN_SERIAL_LEN];
-	uint8_t mac_addr_base[6];
-	uint8_t mac_addr_count;
-} cvmx_bootinfo_t;
-
-uint32_t octeon_cpu_clock;
 uint64_t octeon_dram;
-uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0, octeon_board_rev_major, octeon_board_rev_minor, octeon_board_type;
+static uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0;
 uint8_t octeon_mac_addr[6] = { 0 };
 int octeon_core_mask, octeon_mac_addr_count;
-int octeon_chip_rev_major = 0, octeon_chip_rev_minor = 0, octeon_chip_type = 0;
 
 static octeon_boot_descriptor_t *app_desc_ptr;
 static cvmx_bootinfo_t *cvmx_desc_ptr;
@@ -735,7 +402,7 @@ static cvmx_bootinfo_t *cvmx_desc_ptr;
 int
 octeon_board_real(void)
 {
-	switch (octeon_board_type) {
+	switch (cvmx_sysinfo_get()->board_type) {
 	case OCTEON_BOARD_TYPE_NONE:
 	case OCTEON_BOARD_TYPE_SIM:
 		return 0;
@@ -748,7 +415,7 @@ octeon_board_real(void)
 		 */
 		return 1;
 	default:
-		if (octeon_board_rev_major == 0)
+		if (cvmx_sysinfo_get()->board_rev_major == 0)
 			return 0;
 		return 1;
 	}
@@ -759,15 +426,15 @@ octeon_process_app_desc_ver_unknown(void
 {
     	printf(" Unknown Boot-Descriptor: Using Defaults\n");
 
-    	octeon_cpu_clock = OCTEON_CLOCK_DEFAULT;
         octeon_dram = OCTEON_DRAM_DEFAULT;
-        octeon_board_rev_major = octeon_board_rev_minor = octeon_board_type = 0;
         octeon_core_mask = 1;
-        octeon_chip_type = octeon_chip_rev_major = octeon_chip_rev_minor = 0;
         octeon_mac_addr[0] = 0x00; octeon_mac_addr[1] = 0x0f;
         octeon_mac_addr[2] = 0xb7; octeon_mac_addr[3] = 0x10;
         octeon_mac_addr[4] = 0x09; octeon_mac_addr[5] = 0x06;
         octeon_mac_addr_count = 1;
+
+	cvmx_sysinfo_minimal_initialize(NULL, CVMX_BOARD_TYPE_NULL,
+					0, 0, OCTEON_CLOCK_DEFAULT);
 }
 
 static int
@@ -792,13 +459,6 @@ octeon_process_app_desc_ver_6(void)
         }
 
         octeon_core_mask = cvmx_desc_ptr->core_mask;
-        octeon_cpu_clock  = cvmx_desc_ptr->eclock_hz;
-        octeon_board_type = cvmx_desc_ptr->board_type;
-        octeon_board_rev_major = cvmx_desc_ptr->board_rev_major;
-        octeon_board_rev_minor = cvmx_desc_ptr->board_rev_minor;
-        octeon_chip_type = cvmx_desc_ptr->chip_type;
-        octeon_chip_rev_major = cvmx_desc_ptr->chip_rev_major;
-        octeon_chip_rev_minor = cvmx_desc_ptr->chip_rev_minor;
         octeon_mac_addr[0] = cvmx_desc_ptr->mac_addr_base[0];
         octeon_mac_addr[1] = cvmx_desc_ptr->mac_addr_base[1];
         octeon_mac_addr[2] = cvmx_desc_ptr->mac_addr_base[2];
@@ -811,6 +471,15 @@ octeon_process_app_desc_ver_6(void)
             	octeon_dram = (uint64_t)app_desc_ptr->dram_size;
 	else
             	octeon_dram = (uint64_t)app_desc_ptr->dram_size << 20;
+
+	/*
+	 * XXX
+	 * We could pass in phy_mem_desc_ptr, but why bother?
+	 */
+	cvmx_sysinfo_minimal_initialize(NULL, cvmx_desc_ptr->board_type,
+					cvmx_desc_ptr->board_rev_major,
+					cvmx_desc_ptr->board_rev_minor,
+					cvmx_desc_ptr->eclock_hz);
         return 0;
 }
 
@@ -831,13 +500,19 @@ octeon_boot_params_init(register_t ptr)
         	octeon_process_app_desc_ver_unknown();
 
         printf("Boot Descriptor Ver: %u -> %u/%u",
-               octeon_bd_ver, octeon_cvmx_bd_ver/100, octeon_cvmx_bd_ver%100);
-        printf("  CPU clock: %uMHz  Core Mask: %#x\n", octeon_cpu_clock/1000000, octeon_core_mask);
+               octeon_bd_ver, octeon_cvmx_bd_ver / 100,
+	       octeon_cvmx_bd_ver % 100);
+        printf("  CPU clock: %uMHz  Core Mask: %#x\n",
+	       cvmx_sysinfo_get()->cpu_clock_hz / 1000000, octeon_core_mask);
         printf("  Dram: %u MB", (uint32_t)(octeon_dram >> 20));
         printf("  Board Type: %u  Revision: %u/%u\n",
-               octeon_board_type, octeon_board_rev_major, octeon_board_rev_minor);
+               cvmx_sysinfo_get()->board_type,
+	       cvmx_sysinfo_get()->board_rev_major,
+	       cvmx_sysinfo_get()->board_rev_minor);
+#if 0
         printf("  Octeon Chip: %u  Rev %u/%u",
                octeon_chip_type, octeon_chip_rev_major, octeon_chip_rev_minor);
+#endif
 
         printf("  Mac Address %02X.%02X.%02X.%02X.%02X.%02X (%d)\n",
 	    octeon_mac_addr[0], octeon_mac_addr[1], octeon_mac_addr[2],

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Wed Apr 21 01:43:49 2010	(r206975)
@@ -38,12 +38,15 @@ __FBSDID("$FreeBSD$");
 
 #include <mips/cavium/octeon_pcmap_regs.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
+
 unsigned octeon_ap_boot = ~0;
 
 void
 platform_ipi_send(int cpuid)
 {
-	oct_write64(OCTEON_CIU_MBOX_SETX(cpuid), 1);
+	oct_write64(CVMX_CIU_MBOX_SETX(cpuid), 1);
 	mips_wbflush();
 }
 
@@ -52,9 +55,9 @@ platform_ipi_clear(void)
 {
 	uint64_t action;
 
-	action = oct_read64(OCTEON_CIU_MBOX_CLRX(PCPU_GET(cpuid)));
+	action = oct_read64(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)));
 	KASSERT(action == 1, ("unexpected IPIs: %#jx", (uintmax_t)action));
-	oct_write64(OCTEON_CIU_MBOX_CLRX(PCPU_GET(cpuid)), action);
+	oct_write64(CVMX_CIU_MBOX_CLRX(PCPU_GET(cpuid)), action);
 }
 
 int
@@ -76,8 +79,8 @@ platform_init_ap(int cpuid)
 	 */
 	octeon_ciu_reset();
 
-	oct_write64(OCTEON_CIU_MBOX_CLRX(cpuid), 0xffffffff);
-	ciu_enable_interrupts(cpuid, CIU_INT_1, CIU_EN_0, OCTEON_CIU_ENABLE_MBOX_INTR, CIU_MIPS_IP3);
+	oct_write64(CVMX_CIU_MBOX_CLRX(cpuid), 0xffffffff);
+	cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
 
 	mips_wbflush();
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Wed Apr 21 01:43:49 2010	(r206975)
@@ -48,20 +48,12 @@
 
 #include "opt_cputype.h" 
 
-#define OCTEON_CACHE_LINE_SIZE	0x80	/* 128 bytes cache line size */
-#define IS_OCTEON_ALIGNED(p)	(!((u_long)(p) & 0x7f))
-#define OCTEON_ALIGN(p)		(((u_long)(p) + ((OCTEON_CACHE_LINE_SIZE) - 1)) & ~((OCTEON_CACHE_LINE_SIZE) - 1))
-
 #ifndef LOCORE
 
 /*
  * Utility inlines & macros
  */
 
-/* turn the variable name into a string */
-#define OCTEON_TMP_STR(x) OCTEON_TMP_STR2(x)
-#define OCTEON_TMP_STR2(x) #x
-
 #if defined(__mips_n64)
 #define	oct_write64(a, v)	(*(volatile uint64_t *)(a) = (uint64_t)(v))
 #define	oct_write8_x8(a, v)	(*(volatile uint8_t *)(a) = (uint8_t)(v))
@@ -359,19 +351,6 @@ static inline mipsx_addr_size octeon_ptr
 
 #define OCTEON_IO_SEG OCTEON_MIPS_SPACE_XKPHYS
 
-
-#define OCTEON_ADD_SEG(segment, add)	((((uint64_t)segment) << 62) | (add))
-
-#define OCTEON_ADD_IO_SEG(add)		OCTEON_ADD_SEG(OCTEON_IO_SEG, (add))
-#define OCTEON_ADDR_DID(did)		(OCTEON_ADDR_DIDSPACE(did) << 40)
-#define OCTEON_ADDR_DIDSPACE(did)	(((OCTEON_IO_SEG) << 22) | ((1ULL) << 8) | (did))
-#define OCTEON_ADDR_FULL_DID(did,subdid)	(((did) << 3) | (subdid))
-
-
-#define OCTEON_CIU_PP_RST	OCTEON_ADD_IO_SEG(0x0001070000000700ull)
-#define OCTEON_CIU_SOFT_RST	OCTEON_ADD_IO_SEG(0x0001070000000740ull)
-#define OCTEON_OCTEON_DID_TAG	12ULL
-
 /*
  * octeon_addr_t
  */
@@ -511,12 +490,6 @@ static inline uint32_t octeon_get_chipid
 }
 
 
-static inline unsigned int get_coremask (void)
-{
-    return(~(oct_read64(OCTEON_CIU_PP_RST)) & 0xffff);
-}
-
-
 static inline uint32_t octeon_get_core_num (void)
 {
 
@@ -577,37 +550,12 @@ extern void octeon_reset(void);
 extern void octeon_led_write_char0(char val);
 extern void octeon_led_run_wheel(int *pos, int led_position);
 extern void octeon_debug_symbol(void);
-extern void mips_disable_interrupt_controls(void);
-extern uint32_t octeon_cpu_clock;
 extern uint64_t octeon_dram;
-extern uint32_t octeon_bd_ver, octeon_board_rev_major, octeon_board_rev_minor, octeon_board_type;
 extern uint8_t octeon_mac_addr[6];
-extern int octeon_core_mask, octeon_mac_addr_count, octeon_chip_rev_major, octeon_chip_rev_minor, octeon_chip_type;
-extern void bzero_64(void *str, size_t len);
-extern void bzero_32(void *str, size_t len);
-extern void bzero_16(void *str, size_t len);
-extern void bzero_old(void *str, size_t len);
+extern int octeon_core_mask, octeon_mac_addr_count;
 extern void octeon_ciu_reset(void);
-extern void ciu_disable_intr(int core_num, int intx, int enx);
-extern void ciu_enable_interrupts (int core_num, int intx, int enx, uint64_t set_these_interrupt_bits, int ciu_ip);
-extern void ciu_clear_int_summary(int core_num, int intx, int enx, uint64_t write_bits);
-extern uint64_t ciu_get_int_summary(int core_num, int intx, int enx);
-extern void octeon_ciu_start_gtimer(int timer, u_int one_shot, uint64_t time_cycles);
-extern void octeon_ciu_stop_gtimer(int timer);
 extern int octeon_board_real(void);
 extern unsigned long octeon_get_clock_rate(void);
-
-typedef union {
-    uint64_t word64;
-    struct {
-        uint64_t reserved             : 27;     /* Not used */
-        uint64_t one_shot             : 1;      /* Oneshot ? */
-        uint64_t len                  : 36;     /* len of timer in clock cycles - 1 */
-    } bits;
-} octeon_ciu_gentimer;
-
-
-
 #endif	/* LOCORE */
 
 
@@ -645,96 +593,6 @@ typedef union {
 #define  OCTEON_FPA_QUEUES		8
 
 /*
- * Octeon FPA I/O Registers
- */
-#define  OCTEON_FPA_CTL_STATUS		0x8001180028000050ull
-#define  OCTEON_FPA_FPF_SIZE		0x8001180028000058ull
-#define  OCTEON_FPA_FPF_MARKS		0x8001180028000000ull
-#define  OCTEON_FPA_INT_SUMMARY		0x8001180028000040ull
-#define  OCTEON_FPA_INT_ENABLE		0x8001180028000048ull
-#define  OCTEON_FPA_QUEUE_AVAILABLE	0x8001180028000098ull
-#define  OCTEON_FPA_PAGE_INDEX		0x80011800280000f0ull
-
-/*
- * Octeon PKO Unit
- */
-#define	 OCTEON_PKO_REG_FLAGS		0x8001180050000000ull
-#define	 OCTEON_PKO_REG_READ_IDX	0x8001180050000008ull
-#define	 OCTEON_PKO_CMD_BUF		0x8001180050000010ull
-#define	 OCTEON_PKO_GMX_PORT_MODE	0x8001180050000018ull
-#define	 OCTEON_PKO_REG_CRC_ENABLE	0x8001180050000020ull
-#define	 OCTEON_PKO_QUEUE_MODE		0x8001180050000048ull
-#define  OCTEON_PKO_MEM_QUEUE_PTRS     	0x8001180050001000ull
-#define	 OCTEON_PKO_MEM_COUNT0		0x8001180050001080ull
-#define	 OCTEON_PKO_MEM_COUNT1		0x8001180050001088ull
-#define	 OCTEON_PKO_MEM_DEBUG0		0x8001180050001100ull
-#define	 OCTEON_PKO_MEM_DEBUG1		0x8001180050001108ull
-#define	 OCTEON_PKO_MEM_DEBUG2		0x8001180050001110ull
-#define	 OCTEON_PKO_MEM_DEBUG3		0x8001180050001118ull
-#define	 OCTEON_PKO_MEM_DEBUG4		0x8001180050001120ull
-#define	 OCTEON_PKO_MEM_DEBUG5		0x8001180050001128ull
-#define	 OCTEON_PKO_MEM_DEBUG6		0x8001180050001130ull
-#define	 OCTEON_PKO_MEM_DEBUG7		0x8001180050001138ull
-#define	 OCTEON_PKO_MEM_DEBUG8		0x8001180050001140ull
-#define	 OCTEON_PKO_MEM_DEBUG9		0x8001180050001148ull
-
-
-/*
- * Octeon IPD Unit
- */
-#define  OCTEON_IPD_1ST_MBUFF_SKIP		0x80014F0000000000ull
-#define  OCTEON_IPD_NOT_1ST_MBUFF_SKIP		0x80014F0000000008ull
-#define  OCTEON_IPD_PACKET_MBUFF_SIZE		0x80014F0000000010ull
-#define  OCTEON_IPD_1ST_NEXT_PTR_BACK		0x80014F0000000150ull
-#define  OCTEON_IPD_2ND_NEXT_PTR_BACK		0x80014F0000000158ull
-#define  OCTEON_IPD_WQE_FPA_QUEUE		0x80014F0000000020ull
-#define  OCTEON_IPD_CTL_STATUS			0x80014F0000000018ull
-#define	 OCTEON_IPD_QOSX_RED_MARKS(queue)      (0x80014F0000000178ull + ((queue) * 8))
-#define	 OCTEON_IPD_RED_Q_PARAM(queue)	       (0x80014F00000002E0ull + ((queue) * 8))
-#define	 OCTEON_IPD_PORT_BP_PAGE_COUNT(port)   (0x80014F0000000028ull + ((port) * 8))
-#define	 OCTEON_IPD_BP_PORT_RED_END		0x80014F0000000328ull
-#define	 OCTEON_IPD_RED_PORT_ENABLE		0x80014F00000002D8ull
-
-/*
- * Octeon CIU Unit
- */
-#define OCTEON_CIU_ENABLE_BASE_ADDR	0x8001070000000200ull
-#define OCTEON_CIU_SUMMARY_BASE_ADDR	0x8001070000000000ull
-#define OCTEON_CIU_SUMMARY_INT1_ADDR	0x8001070000000108ull
-
-#define OCTEON_CIU_MBOX_SETX(offset)    (0x8001070000000600ull+((offset)*8))
-#define OCTEON_CIU_MBOX_CLRX(offset)    (0x8001070000000680ull+((offset)*8))
-#define OCTEON_CIU_ENABLE_MBOX_INTR	 0x0000000300000000ull /* bits 32, 33 */
-
-#define CIU_MIPS_IP2		0
-#define CIU_MIPS_IP3		1
-
-#define CIU_INT_0		CIU_MIPS_IP2
-#define CIU_INT_1		CIU_MIPS_IP3
-
-#define CIU_EN_0		0
-#define CIU_EN_1		1
-
-#define CIU_THIS_CORE		-1
-
-#define CIU_UART_BITS_UART0		      (0x1ull << 34)		// Bit 34
-#define CIU_UART_BITS_UART1		      (0x1ull << 35)		// Bit 35
-#define CIU_GENTIMER_BITS_ENABLE(timer)	      (0x1ull << (52 + (timer)))	// Bit 52..55
-
-#define CIU_GENTIMER_NUM_0			0
-#define CIU_GENTIMER_NUM_1			1
-#define CIU_GENTIMER_NUM_2			2
-#define CIU_GENTIMER_NUM_3			3
-#define OCTEON_GENTIMER_ONESHOT			1
-#define OCTEON_GENTIMER_PERIODIC		0
-
-#define OCTEON_CIU_GENTIMER_ADDR(timer)	     (0x8001070000000480ull + ((timer) * 0x8))
-
-
-#define OCTEON_GENTIMER_LEN_1MS		(0x7a120ull)   /* Back of envelope. 500Mhz Octeon */ // FIXME IF WRONG
-#define OCTEON_GENTIMER_LEN_1SEC	((OCTEON_GENTIMER_LEN_1MS) * 1000)
-
-/*
  * Physical Memory Banks
  */
 /* 1st BANK */

Modified: user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c	Wed Apr 21 01:39:52 2010	(r206974)
+++ user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c	Wed Apr 21 01:43:49 2010	(r206975)
@@ -72,6 +72,9 @@ __FBSDID("$FreeBSD$");
 
 #include <mips/cavium/octeon_pcmap_regs.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
+
 #include "uart_if.h"
 
 /*
@@ -462,8 +465,16 @@ oct16550_bus_attach (struct uart_softc *
 	/*
 	 * Enable the interrupt in CIU.     // UART-x2 @ IP2
 	 */
-        ciu_enable_interrupts(0, CIU_INT_0, CIU_EN_0,
-                              (!unit) ? CIU_UART_BITS_UART0 : CIU_UART_BITS_UART1, CIU_MIPS_IP2);
+	switch (unit) {
+	case 0:
+		cvmx_interrupt_unmask_irq(CVMX_IRQ_UART0);
+		break;
+	case 1:
+		cvmx_interrupt_unmask_irq(CVMX_IRQ_UART1);
+		break;
+	default:
+		panic("%s: invalid UART %d", __func__, unit);
+	}
 	return (0);
 }
 
@@ -671,7 +682,7 @@ oct16550_bus_probe (struct uart_softc *s
 	int error;
 
 	bas = &sc->sc_bas;
-	bas->rclk = uart_oct16550_class.uc_rclk = octeon_cpu_clock;
+	bas->rclk = uart_oct16550_class.uc_rclk = cvmx_sysinfo_get()->cpu_clock_hz;
 
 	error = oct16550_probe(bas);
 	if (error) {

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 03:37:28 2010
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 8B3A71065670;
	Wed, 21 Apr 2010 03:37:28 +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 7B6D58FC1A;
	Wed, 21 Apr 2010 03:37:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L3bSiE034090;
	Wed, 21 Apr 2010 03:37:28 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L3bSYx034088;
	Wed, 21 Apr 2010 03:37:28 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004210337.o3L3bSYx034088@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Wed, 21 Apr 2010 03:37:28 +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: r206976 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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: Wed, 21 Apr 2010 03:37:28 -0000

Author: kmacy
Date: Wed Apr 21 03:37:28 2010
New Revision: 206976
URL: http://svn.freebsd.org/changeset/base/206976

Log:
  print gen_count if panicking

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 01:43:49 2010	(r206975)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 03:37:28 2010	(r206976)
@@ -2021,8 +2021,8 @@ pmap_release(pmap_t pmap)
 	vm_page_t m;
 
 	KASSERT(pmap->pm_stats.resident_count == 0,
-	    ("pmap_release: pmap resident count %ld != 0",
-	    pmap->pm_stats.resident_count));
+	    ("pmap_release: pmap resident count %ld != 0 gen_count == %d ",
+		pmap->pm_stats.resident_count, pmap->pm_gen_count));
 	KASSERT(pmap->pm_root == NULL,
 	    ("pmap_release: pmap has reserved page table page(s)"));
 

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 04:35:24 2010
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 3DF941065672;
	Wed, 21 Apr 2010 04:35:24 +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 1457E8FC16;
	Wed, 21 Apr 2010 04:35:24 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L4ZNW2046777;
	Wed, 21 Apr 2010 04:35:23 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L4ZNTb046774;
	Wed, 21 Apr 2010 04:35:23 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004210435.o3L4ZNTb046774@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Wed, 21 Apr 2010 04:35:23 +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: r206977 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
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: Wed, 21 Apr 2010 04:35:24 -0000

Author: kmacy
Date: Wed Apr 21 04:35:23 2010
New Revision: 206977
URL: http://svn.freebsd.org/changeset/base/206977

Log:
  simplify gen_count tracking

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 03:37:28 2010	(r206976)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 04:35:23 2010	(r206977)
@@ -553,7 +553,7 @@ static int
 pa_tryrelock(pmap_t pmap, vm_paddr_t pa, vm_paddr_t *locked)
 {
 	vm_paddr_t lockpa;
-	uint16_t gen_count;
+	uint32_t gen_count;
 
 	PMAP_LOCK_ASSERT(pmap, MA_OWNED);
 	gen_count = pmap->pm_gen_count;
@@ -568,16 +568,13 @@ pa_tryrelock(pmap_t pmap, vm_paddr_t pa,
 	}
 	if (PA_TRYLOCK(pa))
 		return (0);
-	pmap->pm_retry_depth++;
 	PMAP_UNLOCK(pmap);
 	atomic_add_int((volatile int *)&pmap_tryrelock_restart, 1);
 	PA_LOCK(pa);
-	mtx_lock(&(pmap)->pm_mtx);
-	pmap->pm_retry_depth--;
-	if (pmap->pm_retry_depth)
-		pmap->pm_gen_count++;
+	PMAP_LOCK(pmap);
 
-	if (gen_count != pmap->pm_gen_count) {
+	if (pmap->pm_gen_count != gen_count + 1) {
+		pmap->pm_retries++;
 		atomic_add_int((volatile int *)&pmap_tryrelock_race, 1);
 		return (EAGAIN);
 	}
@@ -2021,8 +2018,8 @@ pmap_release(pmap_t pmap)
 	vm_page_t m;
 
 	KASSERT(pmap->pm_stats.resident_count == 0,
-	    ("pmap_release: pmap resident count %ld != 0 gen_count == %d ",
-		pmap->pm_stats.resident_count, pmap->pm_gen_count));
+	    ("pmap_release: pmap resident count %ld != 0 retries == %d ",
+		pmap->pm_stats.resident_count, pmap->pm_retries));
 	KASSERT(pmap->pm_root == NULL,
 	    ("pmap_release: pmap has reserved page table page(s)"));
 

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Wed Apr 21 03:37:28 2010	(r206976)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Wed Apr 21 04:35:23 2010	(r206977)
@@ -246,8 +246,8 @@ struct pmap {
 	pml4_entry_t		*pm_pml4;	/* KVA of level 4 page table */
 	TAILQ_HEAD(,pv_chunk)	pm_pvchunk;	/* list of mappings in pmap */
 	u_int			pm_active;	/* active on cpus */
-	uint16_t		pm_gen_count;	/* generation count (pmap lock dropped) */
-	uint16_t		pm_retry_depth;	/* number of cases in retry */
+	uint32_t		pm_gen_count;	/* generation count (pmap lock dropped) */
+	u_int			pm_retries;
 	struct pmap_statistics	pm_stats;	/* pmap statistics */
 	vm_page_t		pm_root;	/* spare page table pages */
 	vm_page_t		pm_free;	/* Temporary free pages. */
@@ -261,8 +261,7 @@ extern struct pmap	kernel_pmap_store;
 
 #define PMAP_UPDATE_GEN_COUNT(pmap)				\
 	do {							\
-		if (pmap->pm_retry_depth)			\
-			pmap->pm_gen_count++;			\
+		pmap->pm_gen_count++;				\
 	} while (0)
 
 #define	PMAP_LOCK(pmap)						\

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 04:44:09 2010
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 32D691065670;
	Wed, 21 Apr 2010 04:44:09 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0998D8FC17;
	Wed, 21 Apr 2010 04:44:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L4i8bY048702;
	Wed, 21 Apr 2010 04:44:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L4i8dW048699;
	Wed, 21 Apr 2010 04:44:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210444.o3L4i8dW048699@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 04:44:08 +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: r206978 - user/jmallett/octeon/sys/mips/cavium
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: Wed, 21 Apr 2010 04:44:09 -0000

Author: jmallett
Date: Wed Apr 21 04:44:08 2010
New Revision: 206978
URL: http://svn.freebsd.org/changeset/base/206978

Log:
  Centralize and correct MBOX IRQ unmasking.  We want this to go to hard
  interrupt #1 not hard interrupt #0.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_mp.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 04:35:23 2010	(r206977)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 04:44:08 2010	(r206978)
@@ -209,6 +209,13 @@ octeon_ciu_reset(void)
 	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2+1), 0);
 	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2), 0);
 	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2+1), 0);
+
+#ifdef SMP
+	/* Enable the MBOX interrupts.  */
+	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2+1),
+		       (1ull << (CVMX_IRQ_MBOX0 - 8)) |
+		       (1ull << (CVMX_IRQ_MBOX1 - 8)));
+#endif
 }
 
 static void
@@ -307,10 +314,9 @@ platform_start(__register_t a0, __regist
 
 #ifdef SMP
 	/*
-	 * Clear any pending IPIs and enable the IPI interrupt.
+	 * Clear any pending IPIs.
 	 */
 	oct_write64(CVMX_CIU_MBOX_CLRX(0), 0xffffffff);
-	cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
 #endif
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_mp.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Wed Apr 21 04:35:23 2010	(r206977)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_mp.c	Wed Apr 21 04:44:08 2010	(r206978)
@@ -75,12 +75,14 @@ platform_init_ap(int cpuid)
 	mips_wr_ebase(0x80000000 | cpuid);
 
 	/*
-	 * Set up interrupts, clear IPIs and unmask the IPI interrupt.
+	 * Clear any pending IPIs.
 	 */
-	octeon_ciu_reset();
-
 	oct_write64(CVMX_CIU_MBOX_CLRX(cpuid), 0xffffffff);
-	cvmx_interrupt_unmask_irq(CVMX_IRQ_MBOX0);
+
+	/*
+	 * Set up interrupts.
+	 */
+	octeon_ciu_reset();
 
 	mips_wbflush();
 }

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 04:58:48 2010
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 CCD6A1065670;
	Wed, 21 Apr 2010 04:58:48 +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 BCDF48FC14;
	Wed, 21 Apr 2010 04:58:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L4wmHa051995;
	Wed, 21 Apr 2010 04:58:48 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L4wmUx051992;
	Wed, 21 Apr 2010 04:58:48 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004210458.o3L4wmUx051992@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Wed, 21 Apr 2010 04:58:48 +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: r206979 - in user/kmacy/head_page_lock_2/sys/amd64:
	amd64 include
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: Wed, 21 Apr 2010 04:58:48 -0000

Author: kmacy
Date: Wed Apr 21 04:58:48 2010
New Revision: 206979
URL: http://svn.freebsd.org/changeset/base/206979

Log:
   - print gen_count in panic
   - eliminate while{ }do(0) for one line macro

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 04:44:08 2010	(r206978)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Wed Apr 21 04:58:48 2010	(r206979)
@@ -2018,8 +2018,8 @@ pmap_release(pmap_t pmap)
 	vm_page_t m;
 
 	KASSERT(pmap->pm_stats.resident_count == 0,
-	    ("pmap_release: pmap resident count %ld != 0 retries == %d ",
-		pmap->pm_stats.resident_count, pmap->pm_retries));
+	    ("pmap_release: pmap resident count %ld != 0 retries == %d gen_count == %d",
+		pmap->pm_stats.resident_count, pmap->pm_retries, pmap->pm_gen_count));
 	KASSERT(pmap->pm_root == NULL,
 	    ("pmap_release: pmap has reserved page table page(s)"));
 

Modified: user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Wed Apr 21 04:44:08 2010	(r206978)
+++ user/kmacy/head_page_lock_2/sys/amd64/include/pmap.h	Wed Apr 21 04:58:48 2010	(r206979)
@@ -259,10 +259,7 @@ typedef struct pmap	*pmap_t;
 extern struct pmap	kernel_pmap_store;
 #define kernel_pmap	(&kernel_pmap_store)
 
-#define PMAP_UPDATE_GEN_COUNT(pmap)				\
-	do {							\
-		pmap->pm_gen_count++;				\
-	} while (0)
+#define PMAP_UPDATE_GEN_COUNT(pmap) (pmap)->pm_gen_count++
 
 #define	PMAP_LOCK(pmap)						\
 	do {							\

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 07:08:47 2010
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 3711A106564A;
	Wed, 21 Apr 2010 07:08:47 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 26F8D8FC19;
	Wed, 21 Apr 2010 07:08:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L78kAb080755;
	Wed, 21 Apr 2010 07:08:46 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L78kjC080753;
	Wed, 21 Apr 2010 07:08:46 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210708.o3L78kjC080753@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 07:08:46 +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: r206985 - user/jmallett/octeon/sys/mips/cavium
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: Wed, 21 Apr 2010 07:08:47 -0000

Author: jmallett
Date: Wed Apr 21 07:08:46 2010
New Revision: 206985
URL: http://svn.freebsd.org/changeset/base/206985

Log:
  Remove gratuitous manual interrupt disable.

Modified:
  user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c

Modified: user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c	Wed Apr 21 06:33:10 2010	(r206984)
+++ user/jmallett/octeon/sys/mips/cavium/uart_dev_oct16550.c	Wed Apr 21 07:08:46 2010	(r206985)
@@ -460,8 +460,6 @@ oct16550_bus_attach (struct uart_softc *
 	uart_setreg(bas, REG_IER, oct16550->ier);
 	uart_barrier(bas);
 
-	uint32_t status_bits = mips_rd_status();
-	mips_wr_status(status_bits & ~MIPS_SR_INT_IE);
 	/*
 	 * Enable the interrupt in CIU.     // UART-x2 @ IP2
 	 */

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 07:28:58 2010
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 245741065672;
	Wed, 21 Apr 2010 07:28:58 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1361B8FC13;
	Wed, 21 Apr 2010 07:28:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L7Swue085214;
	Wed, 21 Apr 2010 07:28:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L7SwYY085208;
	Wed, 21 Apr 2010 07:28:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210728.o3L7SwYY085208@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 07:28: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: r206986 - user/jmallett/octeon/sys/mips/cavium
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: Wed, 21 Apr 2010 07:28:58 -0000

Author: jmallett
Date: Wed Apr 21 07:28:57 2010
New Revision: 206986
URL: http://svn.freebsd.org/changeset/base/206986

Log:
  Move to using the SDK for UART stuff (not thrilled about using RBR for the base
  or hard-coding 1024 as the offset, but that's what the Simple Executive does.
  We can abstract this in a *reg.h in the near future at least.)

Modified:
  user/jmallett/octeon/sys/mips/cavium/obio.c
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
  user/jmallett/octeon/sys/mips/cavium/uart_bus_octeonusart.c
  user/jmallett/octeon/sys/mips/cavium/uart_cpu_octeonusart.c

Modified: user/jmallett/octeon/sys/mips/cavium/obio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/obio.c	Wed Apr 21 07:08:46 2010	(r206985)
+++ user/jmallett/octeon/sys/mips/cavium/obio.c	Wed Apr 21 07:28:57 2010	(r206986)
@@ -56,6 +56,8 @@ __FBSDID("$FreeBSD$");
 #include <mips/cavium/octeon_pcmap_regs.h>
 #include <mips/cavium/obiovar.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+
 extern struct bus_space octeon_uart_tag;
 
 int	obio_probe(device_t);
@@ -83,7 +85,13 @@ obio_attach(device_t dev)
 	struct obio_softc *sc = device_get_softc(dev);
 
 	sc->oba_st = mips_bus_space_generic;
-	sc->oba_addr = OCTEON_MIO_UART0;
+	/*
+	 * XXX
+	 * Here and elsewhere using RBR as a base address because it kind of
+	 * is, but that feels pretty sloppy.  Should consider adding a define
+	 * that's more semantic, at least.
+	 */
+	sc->oba_addr = CVMX_MIO_UARTX_RBR(0);
 	sc->oba_size = 0x10000;
 	sc->oba_rman.rm_type = RMAN_ARRAY;
 	sc->oba_rman.rm_descr = "OBIO I/O";
@@ -128,8 +136,7 @@ obio_alloc_resource(device_t bus, device
 	case SYS_RES_IOPORT:
 		rm = &sc->oba_rman;
 		bt = &octeon_uart_tag;
-		bh = device_get_unit(child) ?
-		    OCTEON_MIO_UART1 : OCTEON_MIO_UART0;
+		bh = CVMX_MIO_UARTX_RBR(device_get_unit(child));
 		start = bh;
 		break;
 	default:

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 07:08:46 2010	(r206985)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Wed Apr 21 07:28:57 2010	(r206986)
@@ -159,7 +159,7 @@ octeon_led_write_string(const char *str)
 			oct_write8_x8(ptr, *str++);
 		else
 			oct_write8_x8(ptr, ' ');
-		oct_read64(OCTEON_MIO_BOOT_BIST_STAT);
+		oct_read64(CVMX_MIO_BOOT_BIST_STAT);
 	}
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Wed Apr 21 07:08:46 2010	(r206985)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Wed Apr 21 07:28:57 2010	(r206986)
@@ -46,8 +46,6 @@
 #ifndef __OCTEON_PCMAP_REGS_H__
 #define __OCTEON_PCMAP_REGS_H__
 
-#include "opt_cputype.h" 
-
 #ifndef LOCORE
 
 /*
@@ -277,201 +275,6 @@ static inline void oct_write32 (uint64_t
 
 #define	oct_readint32(a)	((int32_t)oct_read32((a)))
 
-/*
- * Octeon Address Space Definitions
- */
-typedef enum {
-   OCTEON_MIPS_SPACE_XKSEG = 3LL,
-   OCTEON_MIPS_SPACE_XKPHYS = 2LL,
-   OCTEON_MIPS_SPACE_XSSEG = 1LL,
-   OCTEON_MIPS_SPACE_XUSEG = 0LL
-} octeon_mips_space_t;
-
-typedef enum {
-   OCTEON_MIPS_XKSEG_SPACE_KSEG0 = 0LL,
-   OCTEON_MIPS_XKSEG_SPACE_KSEG1 = 1LL,
-   OCTEON_MIPS_XKSEG_SPACE_SSEG = 2LL,
-   OCTEON_MIPS_XKSEG_SPACE_KSEG3 = 3LL
-} octeon_mips_xkseg_space_t;
-
-
-/*
-***********************************************************************
- * 32 bit mode alert
- * The kseg0 calc below might fail in xkphys.
- */
-
-/*
- * We limit the allocated device physical blocks to low mem. So use Kseg0
- */
-
-/*
- * Need to go back to kernel to find v->p mappings & vice-versa
- * We are getting non 1-1 mappings.
- * #define OCTEON_PTR2PHYS(addr)  ((unsigned long) addr & 0x7fffffff)
- */
-#define OCTEON_PTR2PHYS(addr) octeon_ptr_to_phys(addr)
-
-
-
-/*  PTR_SIZE == sizeof(uint32_t)  */
-
-#if defined(__mips_n32) || defined(__mips_o32)
-#define mipsx_addr_size				uint32_t	// u_int64
-#define MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT		30		// 62
-#define MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED	0x1fffffff	// 0x1fffffff
-#else
-#define mipsx_addr_size				uint64_t
-#define MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT		62
-#define MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED	0x1fffffffffffffff
-#endif
-
-
-#define octeon_ptr_to_phys(ptr)                                           \
-   (((((mipsx_addr_size) ptr) >> MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT) == 2) ? \
-    	((mipsx_addr_size) ptr & MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED)  :   \
-        (vtophys(ptr)))
-
-#ifdef CODE_FOR_64_BIT_NEEDED
-static inline mipsx_addr_size octeon_ptr_to_phys (void *ptr)
-{
-    if ((((mipsx_addr_size) ptr) >> MIPSX_ADDR_SIZE_KSEGX_BIT_SHIFT) == 2) {
-        /*
-         * KSEG0 based address ?
-         */
-        return ((mipsx_addr_size) ptr & MIPSX_ADDR_SIZE_KSEGX_MASK_REMOVED);
-    } else {
-        /*
-         * Ask kernel/vm to give us the phys translation.
-         */
-        return (vtophys(ptr));
-    }
-}
-#endif
-
-#define OCTEON_IO_SEG OCTEON_MIPS_SPACE_XKPHYS
-
-/*
- * octeon_addr_t
- */
-typedef union {
-   uint64_t         word64;
-
-   struct {
-       octeon_mips_space_t          R   : 2;
-       uint64_t               offset :62;
-   } sva; // mapped or unmapped virtual address
-
-   struct {
-       uint64_t               zeroes :33;
-       uint64_t               offset :31;
-   } suseg; // mapped USEG virtual addresses (typically)
-
-   struct {
-       uint64_t                ones  :33;
-       octeon_mips_xkseg_space_t   sp   : 2;
-       uint64_t               offset :29;
-   } sxkseg; // mapped or unmapped virtual address
-
-   struct {
-       octeon_mips_space_t         R    :2; // CVMX_MIPS_SPACE_XKPHYS in this case
-       uint64_t                 cca  : 3; // ignored by octeon
-       uint64_t                 mbz  :10;
-       uint64_t                  pa  :49; // physical address
-   } sxkphys; // physical address accessed through xkphys unmapped virtual address
-
-   struct {
-       uint64_t                 mbz  :15;
-       uint64_t                is_io : 1; // if set, the address is uncached and resides on MCB bus
-       uint64_t                 did  : 8; // the hardware ignores this field when is_io==0, else device ID
-       uint64_t                unaddr: 4; // the hardware ignores <39:36> in Octeon I
-       uint64_t               offset :36;
-   } sphys; // physical address
-
-    struct {
-        uint64_t               zeroes :24; // techically, <47:40> are dont-cares
-        uint64_t                unaddr: 4; // the hardware ignores <39:36> in Octeon I
-        uint64_t               offset :36;
-    } smem; // physical mem address
-
-    struct {
-        uint64_t                 mem_region  :2;
-        uint64_t                 mbz  :13;
-        uint64_t                is_io : 1; // 1 in this case
-        uint64_t                 did  : 8; // the hardware ignores this field when is_io==0, else device ID
-        uint64_t                unaddr: 4; // the hardware ignores <39:36> in Octeon I
-        uint64_t               offset :36;
-    } sio; // physical IO address
-
-    struct {
-        uint64_t                didspace : 24;
-        uint64_t                unused   : 40;
-    } sfilldidspace;
-
-} octeon_addr_t;
-
-
-typedef union {
-    uint64_t	    word64;
-    struct {
-        uint32_t    word32hi;
-        uint32_t    word32lo;
-    } bits;
-} octeon_word_t;
-
-
-
-
-/*
- * octeon_build_io_address
- *
- * Builds a memory address for I/O based on the Major 5bits and Sub DID 3bits
- */
-static inline uint64_t octeon_build_io_address (uint64_t major_did,
-                                                uint64_t sub_did)
-{
-    return ((0x1ull << 48) | (major_did << 43) | (sub_did << 40));
-}
-
-/*
- * octeon_build_mask
- *
- * Builds a bit mask given the required size in bits.
- *
- * @param bits   Number of bits in the mask
- * @return The mask
- */
-static inline uint64_t octeon_build_mask (uint64_t bits)
-{
-    return ~((~0x0ull) << bits);
-}
-
-/*
- * octeon_build_bits
- *
- * Perform mask and shift to place the supplied value into
- * the supplied bit rage.
- *
- * Example: octeon_build_bits(39,24,value)
- * <pre>
- * 6       5       4       3       3       2       1
- * 3       5       7       9       1       3       5       7      0
- * +-------+-------+-------+-------+-------+-------+-------+------+
- * 000000000000000000000000___________value000000000000000000000000
- * </pre>
- *
- * @param high_bit Highest bit value can occupy (inclusive) 0-63
- * @param low_bit  Lowest bit value can occupy inclusive 0-high_bit
- * @param value    Value to use
- * @return Value masked and shifted
- */
-static inline uint64_t octeon_build_bits (uint64_t high_bit, uint64_t low_bit,
-                                          uint64_t value)
-{
-    return ((value & octeon_build_mask(high_bit - low_bit + 1)) << low_bit);
-}
-
-
 /* ------------------------------------------------------------------- *
  *                      octeon_get_chipid()                               *
  * ------------------------------------------------------------------- */
@@ -480,63 +283,6 @@ static inline uint64_t octeon_build_bits
 #define OCTEON_CN3020_CHIP  0x000d0112
 #define OCTEON_CN5020_CHIP  0x000d0601
 
-static inline uint32_t octeon_get_chipid(void)
-{
-    uint32_t id;
-
-    __asm __volatile ("mfc0 %0, $15,0" : "=r" (id));
-
-    return (id);
-}
-
-
-static inline uint32_t octeon_get_core_num (void)
-{
-
-    return (0x3FF & mips_rd_ebase());
-}
-
-
-static inline uint64_t octeon_get_cycle(void)
-{
-
-/*  ABI == 32 */
-
-    uint32_t tmp_low, tmp_hi;
-
-    __asm __volatile (
-               "   .set push                  \n"
-               "   .set mips64r2                \n"
-               "   .set noreorder               \n"
-               "   rdhwr %[tmpl], $31           \n"
-               "   dadd  %[tmph], %[tmpl], $0   \n"
-               "   dsrl  %[tmph], 32            \n"
-               "   dsll  %[tmpl], 32            \n"
-               "   dsrl  %[tmpl], 32            \n"
-               "   .set pop                 \n"
-                  : [tmpl] "=&r" (tmp_low), [tmph] "=&r" (tmp_hi) : );
-
-    return(((uint64_t)tmp_hi << 32) + tmp_low);
-}
-
-
-/**
- * Wait for the specified number of cycle
- *
- * @param cycles
- */
-static inline void octeon_wait (uint64_t cycles)
-{
-    uint64_t done = octeon_get_cycle() + cycles;
-
-    while (octeon_get_cycle() < done)
-    {
-        /* Spin */
-    }
-}
-
-
-
 /*
  * octeon_machdep.c
  *
@@ -555,43 +301,16 @@ extern uint8_t octeon_mac_addr[6];
 extern int octeon_core_mask, octeon_mac_addr_count;
 extern void octeon_ciu_reset(void);
 extern int octeon_board_real(void);
-extern unsigned long octeon_get_clock_rate(void);
 #endif	/* LOCORE */
 
 
 #define OCTEON_CLOCK_DEFAULT (500 * 1000 * 1000)
 
-
-/*
- * Octeon Boot Bus BIST Status
- * Mostly used for dummy read to ensure all prev I/Os are write-complete.
- */
-#define  OCTEON_MIO_BOOT_BIST_STAT      0x80011800000000F8ull
-
-/*
- * Octeon UART unit
- */
-#define  OCTEON_MIO_UART0               0x8001180000000800ull
-#define  OCTEON_MIO_UART1               0x8001180000000C00ull
-#define  OCTEON_MIO_UART0_THR           0x8001180000000840ull
-#define  OCTEON_MIO_UART1_THR           0x8001180000000C40ull
-#define  OCTEON_MIO_UART0_LSR           0x8001180000000828ull
-#define  OCTEON_MIO_UART1_LSR           0x8001180000000C28ull
-#define  OCTEON_MIO_UART0_RBR           0x8001180000000800ull
-#define  OCTEON_MIO_UART1_RBR           0x8001180000000C00ull
-#define  OCTEON_MIO_UART0_USR           0x8001180000000938ull
-#define  OCTEON_MIO_UART1_USR           0x8001180000000D38ull
-#define  OCTEON_MIO_ADDR_HI24           0x800118
-#define  OCTEON_MIO_UART_SIZE           0x400ull
-
-
 /*
  * EBT3000 LED Unit
  */
 #define  OCTEON_CHAR_LED_BASE_ADDR	(0x1d020000 | (0x1ffffffffull << 31))
 
-#define  OCTEON_FPA_QUEUES		8
-
 /*
  * Physical Memory Banks
  */

Modified: user/jmallett/octeon/sys/mips/cavium/uart_bus_octeonusart.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/uart_bus_octeonusart.c	Wed Apr 21 07:08:46 2010	(r206985)
+++ user/jmallett/octeon/sys/mips/cavium/uart_bus_octeonusart.c	Wed Apr 21 07:28:57 2010	(r206986)
@@ -55,6 +55,8 @@ __FBSDID("$FreeBSD$");
 
 #include <mips/cavium/octeon_pcmap_regs.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+
 #include "uart_if.h"
 
 extern struct uart_class uart_oct16550_class;
@@ -101,7 +103,12 @@ uart_octeon_probe(device_t dev)
 	sc->sc_sysdev = SLIST_FIRST(&uart_sysdevs);
 	bcopy(&sc->sc_sysdev->bas, &sc->sc_bas, sizeof(sc->sc_bas));
 	sc->sc_bas.bst = uart_bus_space_mem;
-	if (bus_space_map(sc->sc_bas.bst, OCTEON_MIO_UART0, OCTEON_MIO_UART_SIZE,
+	/*
+	 * XXX
+	 * RBR isn't really a great base address and it'd be great to not have
+	 * a hard-coded 1024.
+	 */
+	if (bus_space_map(sc->sc_bas.bst, CVMX_MIO_UARTX_RBR(0), 1024,
 	    0, &sc->sc_bas.bsh) != 0)
 		return (ENXIO);
 	return (uart_bus_probe(dev, sc->sc_bas.regshft, 0, 0, unit));

Modified: user/jmallett/octeon/sys/mips/cavium/uart_cpu_octeonusart.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/uart_cpu_octeonusart.c	Wed Apr 21 07:08:46 2010	(r206985)
+++ user/jmallett/octeon/sys/mips/cavium/uart_cpu_octeonusart.c	Wed Apr 21 07:28:57 2010	(r206986)
@@ -43,27 +43,11 @@ __FBSDID("$FreeBSD$");
 
 #include <mips/cavium/octeon_pcmap_regs.h>
 
+#include <contrib/octeon-sdk/cvmx.h>
+
 bus_space_tag_t uart_bus_space_io;
 bus_space_tag_t uart_bus_space_mem;
 
-#include <sys/cdefs.h>
-__FBSDID("$FreeBSD$");
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/bus.h>
-#include <sys/kernel.h>
-#include <sys/malloc.h>
-#include <sys/ktr.h>
-
-#include <vm/vm.h>
-#include <vm/pmap.h>
-#include <vm/vm_kern.h>
-#include <vm/vm_extern.h>
-
-#include <machine/bus.h>
-#include <machine/cache.h>
-
 /*
  * Specailized uart bus space.  We present a 1 apart byte oriented
  * bus to the outside world, but internally translate to/from the 8-apart
@@ -175,7 +159,8 @@ uart_cpu_getdev(int devtype, struct uart
 	 */
 	di->ops = uart_getops(class);
 	di->bas.chan = 0;
-	if (bus_space_map(di->bas.bst, OCTEON_MIO_UART0, OCTEON_MIO_UART_SIZE,
+	/* XXX */
+	if (bus_space_map(di->bas.bst, CVMX_MIO_UARTX_RBR(0), 1024,
 	    0, &di->bas.bsh) != 0)
 		return (ENXIO);
 	di->bas.regshft = 0;

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 07:39:12 2010
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 379BC106566C;
	Wed, 21 Apr 2010 07:39:12 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2775A8FC25;
	Wed, 21 Apr 2010 07:39:12 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3L7dCAc087486;
	Wed, 21 Apr 2010 07:39:12 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3L7dCrh087484;
	Wed, 21 Apr 2010 07:39:12 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004210739.o3L7dCrh087484@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 07:39: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: r206987 - user/jmallett/octeon/sys/contrib/octeon-sdk
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: Wed, 21 Apr 2010 07:39:12 -0000

Author: jmallett
Date: Wed Apr 21 07:39:11 2010
New Revision: 206987
URL: http://svn.freebsd.org/changeset/base/206987

Log:
  More CVMX_DONT_INCLUDE_CONFIG.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h	Wed Apr 21 07:28:57 2010	(r206986)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h	Wed Apr 21 07:39:11 2010	(r206987)
@@ -52,8 +52,10 @@
 #ifndef __CVMX_HELPER_H__
 #define __CVMX_HELPER_H__
 
+#ifndef CVMX_DONT_INCLUDE_CONFIG
 #include "executive-config.h"
 #include "cvmx-config.h"
+#endif
 #include "cvmx-fpa.h"
 #include "cvmx-wqe.h"
 

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 21:21:20 2010
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 45983106566C;
	Wed, 21 Apr 2010 21:21:20 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 33B3C8FC08;
	Wed, 21 Apr 2010 21:21:20 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LLLK13071678;
	Wed, 21 Apr 2010 21:21:20 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LLLJqm071665;
	Wed, 21 Apr 2010 21:21:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212121.o3LLLJqm071665@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 21:21:19 +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: r207018 - user/jmallett/octeon/sys/contrib/octeon-sdk
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: Wed, 21 Apr 2010 21:21:20 -0000

Author: jmallett
Date: Wed Apr 21 21:21:19 2010
New Revision: 207018
URL: http://svn.freebsd.org/changeset/base/207018

Log:
  o) Fix for compiles that don't use a config file.  It may be that we should juse
     use config files, but I'm still sort of blundering along with this.
  o) Get rid of some nested externs and in one case reshuffle include order to avoid
     the need for it.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.h
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.h	Wed Apr 21 21:21:19 2010	(r207018)
@@ -170,6 +170,8 @@ typedef struct
     __cvmx_cmd_queue_state_t state[(CVMX_CMD_QUEUE_END>>16) * 256];
 } __cvmx_cmd_queue_all_state_t;
 
+extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
+
 /**
  * Initialize a command queue for use. The initial FPA buffer is
  * allocated and the hardware unit is configured to point to the
@@ -248,7 +250,6 @@ static inline int __cvmx_cmd_queue_get_i
  */
 static inline void __cvmx_cmd_queue_lock(cvmx_cmd_queue_id_t queue_id, __cvmx_cmd_queue_state_t *qptr)
 {
-    extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
     int tmp;
     int my_ticket;
     CVMX_PREFETCH(qptr, 0);
@@ -306,7 +307,6 @@ static inline void __cvmx_cmd_queue_unlo
  */
 static inline __cvmx_cmd_queue_state_t *__cvmx_cmd_queue_get_state(cvmx_cmd_queue_id_t queue_id)
 {
-    extern CVMX_SHARED __cvmx_cmd_queue_all_state_t *__cvmx_cmd_queue_state_ptr;
     if (CVMX_ENABLE_PARAMETER_CHECKING)
     {
         if (cvmx_unlikely(queue_id >= CVMX_CMD_QUEUE_END))

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-errata.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -51,9 +51,6 @@
  *
  * <hr>$Revision: 42150 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-
 #include "cvmx.h"
 #include "cvmx-fpa.h"
 #include "cvmx-pip.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-fpa.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -48,8 +48,6 @@
  *
  * <hr>$Revision: 41586 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-bootmem.h"
 #include "cvmx-fpa.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,8 +49,6 @@
  *
  * <hr>$Revision: 41586 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
 #ifdef CVMX_ENABLE_PKO_FUNCTIONS
 
 #include "cvmx.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-npi.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,14 +49,10 @@
  *
  * <hr>$Revision: 41586 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-helper.h"
 
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /**
  * @INTERNAL
  * Probe a NPI interface and determine the number of ports

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-rgmii.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,10 +49,6 @@
  *
  * <hr>$Revision: 42417 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-sysinfo.h"
 #include "cvmx-mdio.h"
@@ -60,6 +56,7 @@
 #include "cvmx-helper.h"
 #include "cvmx-helper-board.h"
 
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /**
  * @INTERNAL
  * Probe RGMII ports and determine the number present

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-sgmii.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,17 +49,13 @@
  *
  * <hr>$Revision: 42417 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-sysinfo.h"
 #include "cvmx-mdio.h"
 #include "cvmx-helper.h"
 #include "cvmx-helper-board.h"
 
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /**
  * @INTERNAL
  * Perform initialization required only once for an SGMII port.

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-spi.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,15 +49,12 @@
  *
  * <hr>$Revision: 42417 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-spi.h"
 #include "cvmx-sysinfo.h"
 #include "cvmx-helper.h"
 
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /* CVMX_HELPER_SPI_TIMEOUT is used to determine how long the SPI initialization
     routines wait for SPI training. You can override the value using
     executive-config.h if necessary */

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -48,8 +48,6 @@
  *
  * <hr>$Revision: 42493 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-bootmem.h"
 #include "cvmx-fpa.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.h	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-util.h	Wed Apr 21 21:21:19 2010	(r207018)
@@ -157,8 +157,6 @@ static inline int cvmx_helper_get_first_
  */
 static inline int cvmx_helper_get_last_ipd_port (int interface)
 {
-    extern int cvmx_helper_ports_on_interface (int interface);
-
     return (cvmx_helper_get_first_ipd_port (interface) +
   	    cvmx_helper_ports_on_interface (interface) - 1);
 }

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-xaui.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -49,14 +49,10 @@
  *
  * <hr>$Revision: 42417 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-helper.h"
 
-
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /**
  * @INTERNAL
  * Probe a XAUI interface and determine the number of ports

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.c	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.c	Wed Apr 21 21:21:19 2010	(r207018)
@@ -48,8 +48,6 @@
  *
  * <hr>$Revision: 42150 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-bootmem.h"
 #include "cvmx-fpa.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h	Wed Apr 21 20:05:49 2010	(r207017)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper.h	Wed Apr 21 21:21:19 2010	(r207018)
@@ -99,7 +99,6 @@ typedef union
 #include "cvmx-helper-rgmii.h"
 #include "cvmx-helper-sgmii.h"
 #include "cvmx-helper-spi.h"
-#include "cvmx-helper-util.h"
 #include "cvmx-helper-xaui.h"
 
 /**
@@ -252,6 +251,8 @@ extern int cvmx_helper_interface_probe(i
  */
 extern int cvmx_helper_configure_loopback(int ipd_port, int enable_internal, int enable_external);
 
+#include "cvmx-helper-util.h"
+
 #endif /* CVMX_ENABLE_PKO_FUNCTIONS */
 
 #ifdef	__cplusplus

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 21:21:52 2010
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 DA2331065678;
	Wed, 21 Apr 2010 21:21:52 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C90A58FC0A;
	Wed, 21 Apr 2010 21:21:52 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LLLqDd071815;
	Wed, 21 Apr 2010 21:21:52 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LLLqTn071813;
	Wed, 21 Apr 2010 21:21:52 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212121.o3LLLqTn071813@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 21:21:52 +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: r207019 - user/jmallett/octeon/sys/mips/cavium
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: Wed, 21 Apr 2010 21:21:52 -0000

Author: jmallett
Date: Wed Apr 21 21:21:52 2010
New Revision: 207019
URL: http://svn.freebsd.org/changeset/base/207019

Log:
  Bring in some default config file bits, many of which are wrong, but all of
  which are required to not get warnings at compile time.

Modified:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Wed Apr 21 21:21:19 2010	(r207018)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Wed Apr 21 21:21:52 2010	(r207019)
@@ -1,3 +1,41 @@
+/***********************license start***************
+ * Copyright (c) 2003-2008 Cavium Networks (support@cavium.com). All rights
+ * reserved.
+ *
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ *       notice, this list of conditions and the following disclaimer.
+ *
+ *     * 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.
+ *
+ *     * Neither the name of Cavium Networks nor the names of
+ *       its contributors may be used to endorse or promote products
+ *       derived from this software without specific prior written
+ *       permission.
+ *
+ * TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+ * AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+ * OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+ * RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+ * REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+ * DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+ * OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+ * PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+ * POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+ * OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+ *
+ *
+ * For any questions regarding licensing please contact marketing@caviumnetworks.com
+ *
+ ***********************license end**************************************/
+
 #ifndef	_CVMX_CONFIG_H
 #define	_CVMX_CONFIG_H
 
@@ -11,8 +49,125 @@
 #include <machine/pmap.h>
 
 #define	asm		__asm
-#define	volatile	__volatile
 
 #define	CVMX_DONT_INCLUDE_CONFIG
 
+#define CVMX_FPA_PACKET_POOL			0
+#define CVMX_FPA_WQE_POOL			1
+#define CVMX_FPA_OUTPUT_BUFFER_POOL		2
+#define CVMX_FPA_WQE_POOL_SIZE			(1 *  CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE	(8 *  CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_PACKET_POOL_SIZE		(16 * CVMX_CACHE_LINE_SIZE)
+
+/* Define to enable the use of simple executive packet output functions.
+** For packet I/O setup enable the helper functions below. 
+*/ 
+#define CVMX_ENABLE_PKO_FUNCTIONS
+
+/* Define to enable the use of simple executive helper functions. These
+** include many harware setup functions.  See cvmx-helper.[ch] for
+** details.
+*/
+#define CVMX_ENABLE_HELPER_FUNCTIONS
+
+/* CVMX_HELPER_FIRST_MBUFF_SKIP is the number of bytes to reserve before
+** the beginning of the packet. If necessary, override the default  
+** here.  See the IPD section of the hardware manual for MBUFF SKIP 
+** details.*/ 
+#define CVMX_HELPER_FIRST_MBUFF_SKIP 184
+
+/* CVMX_HELPER_NOT_FIRST_MBUFF_SKIP is the number of bytes to reserve in each
+** chained packet element. If necessary, override the default here */
+#define CVMX_HELPER_NOT_FIRST_MBUFF_SKIP 0
+
+/* CVMX_HELPER_ENABLE_BACK_PRESSURE controls whether back pressure is enabled
+** for all input ports. This controls if IPD sends backpressure to all ports if
+** Octeon's FPA pools don't have enough packet or work queue entries. Even when
+** this is off, it is still possible to get backpressure from individual
+** hardware ports. When configuring backpressure, also check
+** CVMX_HELPER_DISABLE_*_BACKPRESSURE below. If necessary, override the default
+** here */
+#define CVMX_HELPER_ENABLE_BACK_PRESSURE 1
+
+/* CVMX_HELPER_ENABLE_IPD controls if the IPD is enabled in the helper
+**  function. Once it is enabled the hardware starts accepting packets. You
+**  might want to skip the IPD enable if configuration changes are need
+**  from the default helper setup. If necessary, override the default here */
+#define CVMX_HELPER_ENABLE_IPD 1
+
+/* CVMX_HELPER_INPUT_TAG_TYPE selects the type of tag that the IPD assigns
+** to incoming packets. */
+#define CVMX_HELPER_INPUT_TAG_TYPE CVMX_POW_TAG_TYPE_ORDERED
+
+/* The following select which fields are used by the PIP to generate
+** the tag on INPUT
+** 0: don't include
+** 1: include */
+#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_IP	0
+#define CVMX_HELPER_INPUT_TAG_IPV6_DST_IP   	0
+#define CVMX_HELPER_INPUT_TAG_IPV6_SRC_PORT 	0
+#define CVMX_HELPER_INPUT_TAG_IPV6_DST_PORT 	0
+#define CVMX_HELPER_INPUT_TAG_IPV6_NEXT_HEADER 	0
+#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_IP	0
+#define CVMX_HELPER_INPUT_TAG_IPV4_DST_IP   	0
+#define CVMX_HELPER_INPUT_TAG_IPV4_SRC_PORT 	0
+#define CVMX_HELPER_INPUT_TAG_IPV4_DST_PORT 	0
+#define CVMX_HELPER_INPUT_TAG_IPV4_PROTOCOL	0
+#define CVMX_HELPER_INPUT_TAG_INPUT_PORT	1
+
+/* Select skip mode for input ports */
+#define CVMX_HELPER_INPUT_PORT_SKIP_MODE	CVMX_PIP_PORT_CFG_MODE_SKIPL2
+
+/* Define the number of queues per output port */
+#define CVMX_HELPER_PKO_QUEUES_PER_PORT_INTERFACE0	1
+#define CVMX_HELPER_PKO_QUEUES_PER_PORT_INTERFACE1	1
+
+/* Configure PKO to use per-core queues (PKO lockless operation). 
+** Please see the related SDK documentation for PKO that illustrates 
+** how to enable and configure this option. */
+//#define CVMX_ENABLE_PKO_LOCKLESS_OPERATION 1
+//#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0 8
+//#define CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1 8
+
+/* Force backpressure to be disabled.  This overrides all other
+** backpressure configuration */
+#define CVMX_HELPER_DISABLE_RGMII_BACKPRESSURE 1
+
+/* Disable the SPI4000's processing of backpressure packets and backpressure
+** generation. When this is 1, the SPI4000 will not stop sending packets when
+** receiving backpressure. It will also not generate backpressure packets when
+** its internal FIFOs are full. */
+#define CVMX_HELPER_DISABLE_SPI4000_BACKPRESSURE 1
+
+/* CVMX_HELPER_SPI_TIMEOUT is used to determine how long the SPI initialization
+** routines wait for SPI training. You can override the value using
+** executive-config.h if necessary */
+#define CVMX_HELPER_SPI_TIMEOUT 10
+
+/* Select the number of low latency memory ports (interfaces) that
+** will be configured.  Valid values are 1 and 2.
+*/
+#define CVMX_LLM_CONFIG_NUM_PORTS 2
+
+/* Enable the fix for PKI-100 errata ("Size field is 8 too large in WQE and next
+** pointers"). If CVMX_ENABLE_LEN_M8_FIX is set to 0, the fix for this errata will 
+** not be enabled. 
+** 0: Fix is not enabled
+** 1: Fix is enabled, if supported by hardware
+*/
+#define CVMX_ENABLE_LEN_M8_FIX  1
+
+#if defined(CVMX_ENABLE_HELPER_FUNCTIONS) && !defined(CVMX_ENABLE_PKO_FUNCTIONS)
+#define CVMX_ENABLE_PKO_FUNCTIONS
+#endif
+
+/************************* Config Specific Defines ************************/
+#define CVMX_LLM_NUM_PORTS 1
+#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE0 1			/**< PKO queues per port for interface 0 (ports 0-15) */
+#define CVMX_PKO_QUEUES_PER_PORT_INTERFACE1 1			/**< PKO queues per port for interface 1 (ports 16-31) */
+#define CVMX_PKO_MAX_PORTS_INTERFACE0 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE0 /**< Limit on the number of PKO ports enabled for interface 0 */
+#define CVMX_PKO_MAX_PORTS_INTERFACE1 CVMX_HELPER_PKO_MAX_PORTS_INTERFACE1 /**< Limit on the number of PKO ports enabled for interface 1 */
+#define CVMX_PKO_QUEUES_PER_PORT_PCI 1				/**< PKO queues per port for PCI (ports 32-35) */
+#define CVMX_PKO_QUEUES_PER_PORT_LOOP 1				/**< PKO queues per port for Loop devices (ports 36-39) */
+
 #endif /* !_CVMX_CONFIG_H */

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 22:16:06 2010
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 470511065672;
	Wed, 21 Apr 2010 22:16:06 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D36978FC15;
	Wed, 21 Apr 2010 22:16:05 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LMG5KB083999;
	Wed, 21 Apr 2010 22:16:05 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LMG5Sl083997;
	Wed, 21 Apr 2010 22:16:05 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212216.o3LMG5Sl083997@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 22:16:05 +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: r207022 -
	user/jmallett/octeon/gnu/usr.bin/binutils/libbfd
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: Wed, 21 Apr 2010 22:16:06 -0000

Author: jmallett
Date: Wed Apr 21 22:16:05 2010
New Revision: 207022
URL: http://svn.freebsd.org/changeset/base/207022

Log:
  Add MIPS 9K and Octeon architecture types.

Modified:
  user/jmallett/octeon/gnu/usr.bin/binutils/libbfd/bfd.h

Modified: user/jmallett/octeon/gnu/usr.bin/binutils/libbfd/bfd.h
==============================================================================
--- user/jmallett/octeon/gnu/usr.bin/binutils/libbfd/bfd.h	Wed Apr 21 21:57:03 2010	(r207021)
+++ user/jmallett/octeon/gnu/usr.bin/binutils/libbfd/bfd.h	Wed Apr 21 22:16:05 2010	(r207022)
@@ -1546,10 +1546,12 @@ enum bfd_architecture
 #define bfd_mach_mips6000              6000
 #define bfd_mach_mips7000              7000
 #define bfd_mach_mips8000              8000
+#define bfd_mach_mips9000              9000
 #define bfd_mach_mips10000             10000
 #define bfd_mach_mips12000             12000
 #define bfd_mach_mips16                16
 #define bfd_mach_mips5                 5
+#define bfd_mach_mips_octeon           6502
 #define bfd_mach_mips_sb1              12310201 /* octal 'SB', 01 */
 #define bfd_mach_mipsisa32             32
 #define bfd_mach_mipsisa32r2           33

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 22:17:26 2010
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 5A3D61065672;
	Wed, 21 Apr 2010 22:17:26 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 47BB28FC12;
	Wed, 21 Apr 2010 22:17:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LMHQlp084338;
	Wed, 21 Apr 2010 22:17:26 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LMHQ0s084329;
	Wed, 21 Apr 2010 22:17:26 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212217.o3LMHQ0s084329@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 22:17:26 +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: r207023 - in user/jmallett/octeon/contrib/binutils: bfd
	include/elf include/opcode opcodes
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: Wed, 21 Apr 2010 22:17:26 -0000

Author: jmallett
Date: Wed Apr 21 22:17:25 2010
New Revision: 207023
URL: http://svn.freebsd.org/changeset/base/207023

Log:
  Update based on Cavium Octeon SDK 1.7.2 toolchain sources.

Modified:
  user/jmallett/octeon/contrib/binutils/bfd/archures.c
  user/jmallett/octeon/contrib/binutils/bfd/bfd-in2.h
  user/jmallett/octeon/contrib/binutils/bfd/cpu-mips.c
  user/jmallett/octeon/contrib/binutils/bfd/elfxx-mips.c
  user/jmallett/octeon/contrib/binutils/include/elf/mips.h
  user/jmallett/octeon/contrib/binutils/include/opcode/mips.h
  user/jmallett/octeon/contrib/binutils/opcodes/mips-dis.c
  user/jmallett/octeon/contrib/binutils/opcodes/mips-opc.c
  user/jmallett/octeon/contrib/binutils/opcodes/mips16-opc.c

Modified: user/jmallett/octeon/contrib/binutils/bfd/archures.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/bfd/archures.c	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/bfd/archures.c	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,6 +1,6 @@
 /* BFD library support routines for architectures.
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003
+   2000, 2001, 2002, 2003, 2004, 2005, 2006
    Free Software Foundation, Inc.
    Hacked by John Gilmore and Steve Chamberlain of Cygnus Support.
 
@@ -18,7 +18,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -141,10 +141,12 @@ DESCRIPTION
 .#define bfd_mach_mips6000		6000
 .#define bfd_mach_mips7000		7000
 .#define bfd_mach_mips8000		8000
+.#define bfd_mach_mips9000		9000
 .#define bfd_mach_mips10000		10000
 .#define bfd_mach_mips12000		12000
 .#define bfd_mach_mips16		16
 .#define bfd_mach_mips5                 5
+.#define bfd_mach_mips_octeon           6502
 .#define bfd_mach_mips_sb1              12310201 {* octal 'SB', 01 *}
 .#define bfd_mach_mipsisa32             32
 .#define bfd_mach_mipsisa32r2           33

Modified: user/jmallett/octeon/contrib/binutils/bfd/bfd-in2.h
==============================================================================
--- user/jmallett/octeon/contrib/binutils/bfd/bfd-in2.h	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/bfd/bfd-in2.h	Wed Apr 21 22:17:25 2010	(r207023)
@@ -8,7 +8,8 @@
 /* Main header file for the bfd library -- portable access to object files.
 
    Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006
+   Free Software Foundation, Inc.
 
    Contributed by Cygnus Support.
 
@@ -26,7 +27,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #ifndef __BFD_H_SEEN__
 #define __BFD_H_SEEN__

Modified: user/jmallett/octeon/contrib/binutils/bfd/cpu-mips.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/bfd/cpu-mips.c	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/bfd/cpu-mips.c	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,6 +1,6 @@
 /* bfd back-end for mips support
    Copyright 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001,
-   2002, 2003 Free Software Foundation, Inc.
+   2002, 2003, 2004 Free Software Foundation, Inc.
    Written by Steve Chamberlain of Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -17,7 +17,7 @@ GNU General Public License for more deta
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #include "bfd.h"
 #include "sysdep.h"
@@ -76,6 +76,7 @@ enum
   I_mips6000,
   I_mips7000,
   I_mips8000,
+  I_mips9000,
   I_mips10000,
   I_mips12000,
   I_mips16,
@@ -84,6 +85,7 @@ enum
   I_mipsisa32r2,
   I_mipsisa64,
   I_mipsisa64r2,
+  I_mipsocteon,
   I_sb1,
 };
 
@@ -108,6 +110,7 @@ static const bfd_arch_info_type arch_inf
   N (32, 32, bfd_mach_mips6000, "mips:6000",      FALSE, NN(I_mips6000)),
   N (64, 64, bfd_mach_mips7000, "mips:7000",      FALSE, NN(I_mips7000)),
   N (64, 64, bfd_mach_mips8000, "mips:8000",      FALSE, NN(I_mips8000)),
+  N (64, 64, bfd_mach_mips9000, "mips:9000",      FALSE, NN(I_mips9000)),
   N (64, 64, bfd_mach_mips10000,"mips:10000",     FALSE, NN(I_mips10000)),
   N (64, 64, bfd_mach_mips12000,"mips:12000",     FALSE, NN(I_mips12000)),
   N (64, 64, bfd_mach_mips16,   "mips:16",        FALSE, NN(I_mips16)),
@@ -116,6 +119,7 @@ static const bfd_arch_info_type arch_inf
   N (32, 32, bfd_mach_mipsisa32r2,"mips:isa32r2", FALSE, NN(I_mipsisa32r2)),
   N (64, 64, bfd_mach_mipsisa64,  "mips:isa64",   FALSE, NN(I_mipsisa64)),
   N (64, 64, bfd_mach_mipsisa64r2,"mips:isa64r2", FALSE, NN(I_mipsisa64r2)),
+  N (64, 64, bfd_mach_mips_octeon,"mips:octeon",  FALSE, NN(I_mipsocteon)),
   N (64, 64, bfd_mach_mips_sb1, "mips:sb1",       FALSE, 0),
 };
 

Modified: user/jmallett/octeon/contrib/binutils/bfd/elfxx-mips.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/bfd/elfxx-mips.c	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/bfd/elfxx-mips.c	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,6 +1,6 @@
 /* MIPS-specific support for ELF
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003 Free Software Foundation, Inc.
+   2003, 2004, 2005, 2006 Free Software Foundation, Inc.
 
    Most of the information added by Ian Lance Taylor, Cygnus Support,
    <ian@cygnus.com>.
@@ -23,7 +23,7 @@
 
    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /* This file handles functionality common to the different MIPS ABI's.  */
 
@@ -4088,6 +4088,12 @@ _bfd_elf_mips_mach (flagword flags)
     case E_MIPS_MACH_5500:
       return bfd_mach_mips5500;
 
+    case E_MIPS_MACH_9000:
+      return bfd_mach_mips9000;
+
+    case E_MIPS_MACH_OCTEON:
+      return bfd_mach_mips_octeon;
+
     case E_MIPS_MACH_SB1:
       return bfd_mach_mips_sb1;
 
@@ -7142,6 +7148,10 @@ mips_set_isa_flags (bfd *abfd)
       val = E_MIPS_ARCH_4 | E_MIPS_MACH_5500;
       break;
 
+    case bfd_mach_mips9000:
+      val = E_MIPS_ARCH_4 | E_MIPS_MACH_9000;
+      break;
+
     case bfd_mach_mips5000:
     case bfd_mach_mips7000:
     case bfd_mach_mips8000:
@@ -7154,6 +7164,10 @@ mips_set_isa_flags (bfd *abfd)
       val = E_MIPS_ARCH_5;
       break;
 
+    case bfd_mach_mips_octeon:
+      val = E_MIPS_ARCH_64R2 | E_MIPS_MACH_OCTEON;
+      break;
+
     case bfd_mach_mips_sb1:
       val = E_MIPS_ARCH_64 | E_MIPS_MACH_SB1;
       break;
@@ -8856,6 +8870,9 @@ struct mips_mach_extension {
    are ordered topologically with MIPS I extensions listed last.  */
 
 static const struct mips_mach_extension mips_mach_extensions[] = {
+  /* MIPS64r2 extensions.  */
+  { bfd_mach_mips_octeon, bfd_mach_mipsisa64r2 },
+
   /* MIPS64 extensions.  */
   { bfd_mach_mipsisa64r2, bfd_mach_mipsisa64 },
   { bfd_mach_mips_sb1, bfd_mach_mipsisa64 },
@@ -8879,6 +8896,7 @@ static const struct mips_mach_extension 
   { bfd_mach_mips10000, bfd_mach_mips8000 },
   { bfd_mach_mips5000, bfd_mach_mips8000 },
   { bfd_mach_mips7000, bfd_mach_mips8000 },
+  { bfd_mach_mips9000, bfd_mach_mips8000 },
 
   /* VR4100 extensions.  */
   { bfd_mach_mips4120, bfd_mach_mips4100 },
@@ -8913,11 +8931,26 @@ mips_mach_extends_p (unsigned long base,
 {
   size_t i;
 
-  for (i = 0; extension != base && i < ARRAY_SIZE (mips_mach_extensions); i++)
+  if (extension == base)
+    return TRUE;
+
+  if (base == bfd_mach_mipsisa32
+      && mips_mach_extends_p (bfd_mach_mipsisa64, extension))
+    return TRUE;
+
+  if (base == bfd_mach_mipsisa32r2
+      && mips_mach_extends_p (bfd_mach_mipsisa64r2, extension))
+    return TRUE;
+
+  for (i = 0; i < ARRAY_SIZE (mips_mach_extensions); i++)
     if (extension == mips_mach_extensions[i].extension)
-      extension = mips_mach_extensions[i].base;
+      {
+	extension = mips_mach_extensions[i].base;
+	if (extension == base)
+	  return TRUE;
+      }
 
-  return extension == base;
+  return FALSE;
 }
 
 

Modified: user/jmallett/octeon/contrib/binutils/include/elf/mips.h
==============================================================================
--- user/jmallett/octeon/contrib/binutils/include/elf/mips.h	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/include/elf/mips.h	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,5 +1,6 @@
 /* MIPS ELF support for BFD.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004, 2005
    Free Software Foundation, Inc.
 
    By Ian Lance Taylor, Cygnus Support, <ian@cygnus.com>, from
@@ -20,7 +21,7 @@ GNU General Public License for more deta
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 /* This file holds definitions specific to the MIPS ELF ABI.  Note
    that most of this is not actually implemented by BFD.  */
@@ -187,8 +188,10 @@ END_RELOC_NUMBERS (R_MIPS_maxext)
 #define E_MIPS_MACH_4120	0x00870000
 #define E_MIPS_MACH_4111	0x00880000
 #define E_MIPS_MACH_SB1         0x008a0000
+#define E_MIPS_MACH_OCTEON	0x008b0000
 #define E_MIPS_MACH_5400	0x00910000
 #define E_MIPS_MACH_5500	0x00980000
+#define E_MIPS_MACH_9000	0x00990000
 
 /* Processor specific section indices.  These sections do not actually
    exist.  Symbols with a st_shndx field corresponding to one of these

Modified: user/jmallett/octeon/contrib/binutils/include/opcode/mips.h
==============================================================================
--- user/jmallett/octeon/contrib/binutils/include/opcode/mips.h	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/include/opcode/mips.h	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,5 +1,6 @@
 /* mips.h.  Mips opcode list for GDB, the GNU debugger.
-   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+   2003, 2004, 2005
    Free Software Foundation, Inc.
    Contributed by Ralph Campbell and OSF
    Commented and modified by Ian Lance Taylor, Cygnus Support
@@ -18,7 +19,7 @@ the GNU General Public License for more 
 
 You should have received a copy of the GNU General Public License
 along with this file; see the file COPYING.  If not, write to the Free
-Software Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
 
 #ifndef _MIPS_H_
 #define _MIPS_H_
@@ -89,6 +90,8 @@ Software Foundation, 59 Temple Place - S
 #define OP_SH_CODE20		6
 #define OP_MASK_SHAMT		0x1f
 #define OP_SH_SHAMT		6
+#define OP_MASK_BITIND          OP_MASK_RT
+#define OP_SH_BITIND            OP_SH_RT
 #define OP_MASK_FD		0x1f
 #define OP_SH_FD		6
 #define OP_MASK_TARGET		0x3ffffff
@@ -147,6 +150,38 @@ Software Foundation, 59 Temple Place - S
 #define OP_MASK_EXTMSBD		0x1f	/* "ext" MSBD.  */
 #define OP_SH_EXTMSBD		11
 
+/* MIPS DSP ASE */
+#define OP_SH_DSPACC		11
+#define OP_MASK_DSPACC  	0x3
+#define OP_SH_DSPACC_S  	21
+#define OP_MASK_DSPACC_S	0x3
+#define OP_SH_DSPSFT		20
+#define OP_MASK_DSPSFT  	0x3f
+#define OP_SH_DSPSFT_7  	19
+#define OP_MASK_DSPSFT_7	0x7f
+#define OP_SH_SA3		21
+#define OP_MASK_SA3		0x7
+#define OP_SH_SA4		21
+#define OP_MASK_SA4		0xf
+#define OP_SH_IMM8		16
+#define OP_MASK_IMM8		0xff
+#define OP_SH_IMM10		16
+#define OP_MASK_IMM10		0x3ff
+#define OP_SH_WRDSP		11
+#define OP_MASK_WRDSP		0x3f
+#define OP_SH_RDDSP		16
+#define OP_MASK_RDDSP		0x3f
+
+/* MIPS MT ASE */
+#define OP_SH_MT_U		5
+#define OP_MASK_MT_U		0x1
+#define OP_SH_MT_H		4
+#define OP_MASK_MT_H		0x1
+#define OP_SH_MTACC_T		18
+#define OP_MASK_MTACC_T		0x3
+#define OP_SH_MTACC_D		13
+#define OP_MASK_MTACC_D		0x3
+
 #define	OP_OP_COP0		0x10
 #define	OP_OP_COP1		0x11
 #define	OP_OP_COP2		0x12
@@ -192,6 +227,8 @@ struct mips_opcode
      of bits describing the instruction, notably any relevant hazard
      information.  */
   unsigned long pinfo;
+  /* A collection of additional bits describing the instruction. */
+  unsigned long pinfo2;
   /* A collection of bits describing the instruction sets of which this
      instruction or macro is a member. */
   unsigned long membership;
@@ -207,6 +244,8 @@ struct mips_opcode
 
    "<" 5 bit shift amount (OP_*_SHAMT)
    ">" shift amount between 32 and 63, stored after subtracting 32 (OP_*_SHAMT)
+   "^" 5 bit bit index amount (OP_*_BITIND)
+   "~" bit index between 32 and 63, stored after subtracting 32 (OP_*_BITIND)
    "a" 26 bit target address (OP_*_TARGET)
    "b" 5 bit base register (OP_*_RS)
    "c" 10 bit breakpoint code (OP_*_CODE)
@@ -231,6 +270,7 @@ struct mips_opcode
    "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
    "J" 19 bit wait function code (OP_*_CODE19)
    "x" accept and ignore register name
+   "y" 10 bit signed const (OP_*_CODE2)
    "z" must be zero register
    "K" 5 bit Hardware Register (rdhwr instruction) (OP_*_RD)
    "+A" 5 bit ins/ext position, which becomes LSB (OP_*_SHAMT).
@@ -293,6 +333,28 @@ struct mips_opcode
    "Y"	MDMX source register (OP_*_FS)
    "Z"	MDMX source register (OP_*_FT)
 
+   DSP ASE usage:
+   "3" 3 bit unsigned immediate (OP_*_SA3)
+   "4" 4 bit unsigned immediate (OP_*_SA4)
+   "5" 8 bit unsigned immediate (OP_*_IMM8)
+   "6" 5 bit unsigned immediate (OP_*_RS)
+   "7" 2 bit dsp accumulator register (OP_*_DSPACC)
+   "8" 6 bit unsigned immediate (OP_*_WRDSP)
+   "9" 2 bit dsp accumulator register (OP_*_DSPACC_S)
+   "0" 6 bit signed immediate (OP_*_DSPSFT)
+   ":" 7 bit signed immediate (OP_*_DSPSFT_7)
+   "'" 6 bit unsigned immediate (OP_*_RDDSP)
+   "@" 10 bit signed immediate (OP_*_IMM10)
+
+   MT ASE usage:
+   "!" 1 bit immediate at bit 5
+   "$" 1 bit immediate at bit 4
+   "*" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_T)
+   "&" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_D)
+   "g" 5 bit coprocessor 1 and 2 destination register (OP_*_RD)
+   "+t" 5 bit coprocessor 0 destination register (OP_*_RT)
+   "+T" 5 bit coprocessor 0 destination register (OP_*_RT) - disassembly only
+
    Other:
    "()" parens surrounding optional value
    ","  separates operands
@@ -300,13 +362,15 @@ struct mips_opcode
    "+"  Start of extension sequence.
 
    Characters used so far, for quick reference when adding more:
-   "%[]<>(),+"
+   "34567890"
+   "%[]<>(),+:'@!$*&^~"
    "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
-   "abcdefhijklopqrstuvwxz"
+   "abcdefghijklopqrstuvwxyz"
 
    Extension character sequences used so far ("+" followed by the
    following), for quick reference when adding more:
-   "ABCDEFGHI"
+   "ABCDEFGHIT"
+   "t"
 */
 
 /* These are the bits which may be set in the pinfo field of an
@@ -376,10 +440,16 @@ struct mips_opcode
 #define INSN_MULT                   0x40000000
 /* Instruction synchronize shared memory.  */
 #define INSN_SYNC		    0x80000000
-/* Instruction reads MDMX accumulator.  XXX FIXME: No bits left!  */
-#define INSN_READ_MDMX_ACC	    0
-/* Instruction writes MDMX accumulator.  XXX FIXME: No bits left!  */
-#define INSN_WRITE_MDMX_ACC	    0
+
+/* These are the bits which may be set in the pinfo2 field of an
+   instruction. */
+
+/* Instruction is a simple alias (I.E. "move" for daddu/addu/or) */
+#define	INSN2_ALIAS		    0x00000001
+/* Instruction reads MDMX accumulator. */
+#define INSN2_READ_MDMX_ACC	    0x00000002
+/* Instruction writes MDMX accumulator. */
+#define INSN2_WRITE_MDMX_ACC	    0x00000004
 
 /* Instruction is actually a macro.  It should be ignored by the
    disassembler, and requires special treatment by the assembler.  */
@@ -402,8 +472,10 @@ struct mips_opcode
 #define INSN_ISA64R2              0x00000100
 
 /* Masks used for MIPS-defined ASEs.  */
-#define INSN_ASE_MASK		  0x0000f000
+#define INSN_ASE_MASK		  0x0400f000
 
+/* DSP ASE */ 
+#define INSN_DSP                  0x00001000
 /* MIPS 16 ASE */
 #define INSN_MIPS16               0x00002000
 /* MIPS-3D ASE */
@@ -433,6 +505,10 @@ struct mips_opcode
 #define INSN_5400		  0x01000000
 /* NEC VR5500 instruction.  */
 #define INSN_5500		  0x02000000
+/* MT ASE */
+#define INSN_MT                   0x04000000
+/* Cavium Networks Octeon instruction. */
+#define INSN_OCTEON		  0x08000000
 
 /* MIPS ISA defines, use instead of hardcoding ISA level.  */
 
@@ -470,6 +546,7 @@ struct mips_opcode
 #define CPU_R6000	6000
 #define CPU_RM7000	7000
 #define CPU_R8000	8000
+#define CPU_RM9000	9000
 #define CPU_R10000	10000
 #define CPU_R12000	12000
 #define CPU_MIPS16	16
@@ -479,6 +556,7 @@ struct mips_opcode
 #define CPU_MIPS64      64
 #define CPU_MIPS64R2	65
 #define CPU_SB1         12310201        /* octal 'SB', 01.  */
+#define CPU_OCTEON	6502
 
 /* Test for membership in an ISA including chip specific ISAs.  INSN
    is pointer to an element of the opcode table; ISA is the specified
@@ -489,12 +567,14 @@ struct mips_opcode
     (((insn)->membership & isa) != 0					\
      || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0)	\
      || (cpu == CPU_RM7000 && ((insn)->membership & INSN_4650) != 0)	\
+     || (cpu == CPU_RM9000 && ((insn)->membership & INSN_4650) != 0)	\
      || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0)	\
      || (cpu == CPU_VR4100 && ((insn)->membership & INSN_4100) != 0)	\
      || (cpu == CPU_R3900 && ((insn)->membership & INSN_3900) != 0)	\
      || ((cpu == CPU_R10000 || cpu == CPU_R12000)			\
 	 && ((insn)->membership & INSN_10000) != 0)			\
      || (cpu == CPU_SB1 && ((insn)->membership & INSN_SB1) != 0)	\
+     || (cpu == CPU_OCTEON && ((insn)->membership & INSN_OCTEON) != 0)  \
      || (cpu == CPU_R4111 && ((insn)->membership & INSN_4111) != 0)	\
      || (cpu == CPU_VR4120 && ((insn)->membership & INSN_4120) != 0)	\
      || (cpu == CPU_VR5400 && ((insn)->membership & INSN_5400) != 0)	\
@@ -654,6 +734,8 @@ enum
   M_S_DOB,
   M_S_DAB,
   M_S_S,
+  M_SAA_AB,
+  M_SAAD_AB,
   M_SC_AB,
   M_SCD_AB,
   M_SD_A,
@@ -857,7 +939,14 @@ extern int bfd_mips_num_opcodes;
    "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8)
    "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5)
    "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5)
-   */
+   "m" 7 bit register list for save instruction (18 bit extended)
+   "M" 7 bit register list for restore instruction (18 bit extended)
+  */
+
+/* Save/restore encoding for the args field when all 4 registers are
+   either saved as arguments or saved/restored as statics.  */
+#define MIPS16_ALL_ARGS    0xe
+#define MIPS16_ALL_STATICS 0xb
 
 /* For the mips16, we use the same opcode table format and a few of
    the same flags.  However, most of the flags are different.  */

Modified: user/jmallett/octeon/contrib/binutils/opcodes/mips-dis.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/opcodes/mips-dis.c	Wed Apr 21 22:16:05 2010	(r207022)
+++ user/jmallett/octeon/contrib/binutils/opcodes/mips-dis.c	Wed Apr 21 22:17:25 2010	(r207023)
@@ -1,24 +1,25 @@
 /* Print mips instructions for GDB, the GNU debugger, or for objdump.
    Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-   2000, 2001, 2002, 2003
+   2000, 2001, 2002, 2003, 2005
    Free Software Foundation, Inc.
    Contributed by Nobuyuki Hikichi(hikichi@sra.co.jp).
 
-This file is part of GDB, GAS, and the GNU binutils.
+   This file is part of GDB, GAS, and the GNU binutils.
 
-This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
-(at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
+   MA 02110-1301, USA.  */
 
 #include "sysdep.h"
 #include "dis-asm.h"
@@ -40,96 +41,95 @@ Foundation, Inc., 59 Temple Place - Suit
 /* Mips instructions are at maximum this many bytes long.  */
 #define INSNLEN 4
 
-static void set_default_mips_dis_options
-  PARAMS ((struct disassemble_info *));
-static void parse_mips_dis_option
-  PARAMS ((const char *, unsigned int));
-static void parse_mips_dis_options
-  PARAMS ((const char *));
-static int _print_insn_mips
-  PARAMS ((bfd_vma, struct disassemble_info *, enum bfd_endian));
-static int print_insn_mips
-  PARAMS ((bfd_vma, unsigned long int, struct disassemble_info *));
-static void print_insn_args
-  PARAMS ((const char *, unsigned long, bfd_vma, struct disassemble_info *));
-static int print_insn_mips16
-  PARAMS ((bfd_vma, struct disassemble_info *));
-static int is_newabi
-  PARAMS ((Elf_Internal_Ehdr *));
-static void print_mips16_insn_arg
-  PARAMS ((int, const struct mips_opcode *, int, bfd_boolean, int, bfd_vma,
-	   struct disassemble_info *));
+/* Generate Octeon/MIPS unaligned load and store instructions. */
+#ifdef INCLUDE_OCTEON_USEUN
+int octeon_use_unalign = 1;
+#else
+int octeon_use_unalign = 0;
+#endif
+
 
 /* FIXME: These should be shared with gdb somehow.  */
 
-struct mips_cp0sel_name {
-	unsigned int cp0reg;
-	unsigned int sel;
-	const char * const name;
+struct mips_cp0sel_name
+{
+  unsigned int cp0reg;
+  unsigned int sel;
+  const char * const name;
 };
 
 /* The mips16 register names.  */
-static const char * const mips16_reg_names[] = {
+static const char * const mips16_reg_names[] =
+{
   "s0", "s1", "v0", "v1", "a0", "a1", "a2", "a3"
 };
 
-static const char * const mips_gpr_names_numeric[32] = {
+static const char * const mips_gpr_names_numeric[32] =
+{
   "$0",   "$1",   "$2",   "$3",   "$4",   "$5",   "$6",   "$7",
   "$8",   "$9",   "$10",  "$11",  "$12",  "$13",  "$14",  "$15",
   "$16",  "$17",  "$18",  "$19",  "$20",  "$21",  "$22",  "$23",
   "$24",  "$25",  "$26",  "$27",  "$28",  "$29",  "$30",  "$31"
 };
 
-static const char * const mips_gpr_names_oldabi[32] = {
+static const char * const mips_gpr_names_oldabi[32] =
+{
   "zero", "at",   "v0",   "v1",   "a0",   "a1",   "a2",   "a3",
   "t0",   "t1",   "t2",   "t3",   "t4",   "t5",   "t6",   "t7",
   "s0",   "s1",   "s2",   "s3",   "s4",   "s5",   "s6",   "s7",
   "t8",   "t9",   "k0",   "k1",   "gp",   "sp",   "s8",   "ra"
 };
 
-static const char * const mips_gpr_names_newabi[32] = {
+static const char * const mips_gpr_names_newabi[32] =
+{
   "zero", "at",   "v0",   "v1",   "a0",   "a1",   "a2",   "a3",
   "a4",   "a5",   "a6",   "a7",   "t0",   "t1",   "t2",   "t3",
   "s0",   "s1",   "s2",   "s3",   "s4",   "s5",   "s6",   "s7",
   "t8",   "t9",   "k0",   "k1",   "gp",   "sp",   "s8",   "ra"
 };
 
-static const char * const mips_fpr_names_numeric[32] = {
+static const char * const mips_fpr_names_numeric[32] =
+{
   "$f0",  "$f1",  "$f2",  "$f3",  "$f4",  "$f5",  "$f6",  "$f7",
   "$f8",  "$f9",  "$f10", "$f11", "$f12", "$f13", "$f14", "$f15",
   "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",
   "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31"
 };
 
-static const char * const mips_fpr_names_32[32] = {
+static const char * const mips_fpr_names_32[32] =
+{
   "fv0",  "fv0f", "fv1",  "fv1f", "ft0",  "ft0f", "ft1",  "ft1f",
   "ft2",  "ft2f", "ft3",  "ft3f", "fa0",  "fa0f", "fa1",  "fa1f",
   "ft4",  "ft4f", "ft5",  "ft5f", "fs0",  "fs0f", "fs1",  "fs1f",
   "fs2",  "fs2f", "fs3",  "fs3f", "fs4",  "fs4f", "fs5",  "fs5f"
 };
 
-static const char * const mips_fpr_names_n32[32] = {
+static const char * const mips_fpr_names_n32[32] =
+{
   "fv0",  "ft14", "fv1",  "ft15", "ft0",  "ft1",  "ft2",  "ft3",
   "ft4",  "ft5",  "ft6",  "ft7",  "fa0",  "fa1",  "fa2",  "fa3",
   "fa4",  "fa5",  "fa6",  "fa7",  "fs0",  "ft8",  "fs1",  "ft9",
   "fs2",  "ft10", "fs3",  "ft11", "fs4",  "ft12", "fs5",  "ft13"
 };
 
-static const char * const mips_fpr_names_64[32] = {
+static const char * const mips_fpr_names_64[32] =
+{
   "fv0",  "ft12", "fv1",  "ft13", "ft0",  "ft1",  "ft2",  "ft3",
   "ft4",  "ft5",  "ft6",  "ft7",  "fa0",  "fa1",  "fa2",  "fa3",
   "fa4",  "fa5",  "fa6",  "fa7",  "ft8",  "ft9",  "ft10", "ft11",
   "fs0",  "fs1",  "fs2",  "fs3",  "fs4",  "fs5",  "fs6",  "fs7"
 };
 
-static const char * const mips_cp0_names_numeric[32] = {
+static const char * const mips_cp0_names_numeric[32] =
+{
   "$0",   "$1",   "$2",   "$3",   "$4",   "$5",   "$6",   "$7",
   "$8",   "$9",   "$10",  "$11",  "$12",  "$13",  "$14",  "$15",
   "$16",  "$17",  "$18",  "$19",  "$20",  "$21",  "$22",  "$23",
   "$24",  "$25",  "$26",  "$27",  "$28",  "$29",  "$30",  "$31"
 };
 
-static const char * const mips_cp0_names_mips3264[32] = {
+static const char * const mips_cp0_names_mips3264[32] =
+{
   "c0_index",     "c0_random",    "c0_entrylo0",  "c0_entrylo1",
   "c0_context",   "c0_pagemask",  "c0_wired",     "$7",
   "c0_badvaddr",  "c0_count",     "c0_entryhi",   "c0_compare",
@@ -140,7 +140,8 @@ static const char * const mips_cp0_names
   "c0_taglo",     "c0_taghi",     "c0_errorepc",  "c0_desave",
 };
 
-static const struct mips_cp0sel_name mips_cp0sel_names_mips3264[] = {
+static const struct mips_cp0sel_name mips_cp0sel_names_mips3264[] =
+{
   { 16, 1, "c0_config1"		},
   { 16, 2, "c0_config2"		},
   { 16, 3, "c0_config3"		},
@@ -172,7 +173,8 @@ static const struct mips_cp0sel_name mip
   { 29, 1, "c0_datahi"		}
 };
 
-static const char * const mips_cp0_names_mips3264r2[32] = {
+static const char * const mips_cp0_names_mips3264r2[32] =
+{
   "c0_index",     "c0_random",    "c0_entrylo0",  "c0_entrylo1",
   "c0_context",   "c0_pagemask",  "c0_wired",     "c0_hwrena",
   "c0_badvaddr",  "c0_count",     "c0_entryhi",   "c0_compare",
@@ -183,7 +185,8 @@ static const char * const mips_cp0_names
   "c0_taglo",     "c0_taghi",     "c0_errorepc",  "c0_desave",
 };
 
-static const struct mips_cp0sel_name mips_cp0sel_names_mips3264r2[] = {
+static const struct mips_cp0sel_name mips_cp0sel_names_mips3264r2[] =
+{
   {  4, 1, "c0_contextconfig"	},
   {  5, 1, "c0_pagegrain"	},
   { 12, 1, "c0_intctl"		},
@@ -238,7 +241,8 @@ static const struct mips_cp0sel_name mip
 };
 
 /* SB-1: MIPS64 (mips_cp0_names_mips3264) with minor mods.  */
-static const char * const mips_cp0_names_sb1[32] = {
+static const char * const mips_cp0_names_sb1[32] =
+{
   "c0_index",     "c0_random",    "c0_entrylo0",  "c0_entrylo1",
   "c0_context",   "c0_pagemask",  "c0_wired",     "$7",
   "c0_badvaddr",  "c0_count",     "c0_entryhi",   "c0_compare",
@@ -249,7 +253,8 @@ static const char * const mips_cp0_names
   "c0_taglo_i",   "c0_taghi_i",   "c0_errorepc",  "c0_desave",
 };
 
-static const struct mips_cp0sel_name mips_cp0sel_names_sb1[] = {
+static const struct mips_cp0sel_name mips_cp0sel_names_sb1[] =
+{
   { 16, 1, "c0_config1"		},
   { 18, 1, "c0_watchlo,1"	},
   { 19, 1, "c0_watchhi,1"	},
@@ -273,14 +278,46 @@ static const struct mips_cp0sel_name mip
   { 29, 3, "c0_datahi_d"	},
 };
 
-static const char * const mips_hwr_names_numeric[32] = {
+static const char * const mips_cp0_names_octeon[32] = {
+  "c0_index",     "c0_random",    "c0_entrylo0",  "c0_entrylo1",
+  "c0_context",   "c0_pagemask",  "c0_wired",     "c0_hwrena",
+  "c0_badvaddr",  "c0_count",     "c0_entryhi",   "c0_compare",
+  "c0_status",    "c0_cause",     "c0_epc",       "c0_prid",
+  "c0_config",    "$17",          "c0_watchlo",   "c0_watchhi",
+  "c0_xcontext",  "$21",          "c0_mdebug",    "c0_debug",
+  "c0_depc",      "c0_perfcnt",   "$26",          "c0_cacheerr",
+  "c0_taglo",     "c0_taghi",     "c0_errorepc",  "c0_desave",
+};
+
+static const struct mips_cp0sel_name mips_cp0sel_names_octeon[] = {
+  { 5,  1, "c0_pagegrain"               },
+  { 9,  6, "c0_cvmcount"                },
+  { 9,  7, "c0_cvmctl"                  },
+  { 11, 7, "c0_cvmmemctl"               },
+  { 12, 1, "c0_intctl"                  },
+  { 12, 2, "c0_srsctl"                  },
+  { 15, 1, "c0_ebase"                   },
+  { 16, 1, "c0_config1",                },
+  { 16, 2, "c0_config2",                },
+  { 16, 3, "c0_config3",                },
+  { 18, 1, "c0_watchlo,1"               },
+  { 19, 1, "c0_watchhi,1"               },
+  { 25, 2, "c0_perfcnt,2"               },
+  { 27, 1, "c0_cacheerr,1"              },
+  { 28, 3, "c0_datalo"                  },
+  { 29, 3, "c0_datahi"                  },
+};
+
+static const char * const mips_hwr_names_numeric[32] =
+{
   "$0",   "$1",   "$2",   "$3",   "$4",   "$5",   "$6",   "$7",
   "$8",   "$9",   "$10",  "$11",  "$12",  "$13",  "$14",  "$15",
   "$16",  "$17",  "$18",  "$19",  "$20",  "$21",  "$22",  "$23",
   "$24",  "$25",  "$26",  "$27",  "$28",  "$29",  "$30",  "$31"
 };
 
-static const char * const mips_hwr_names_mips3264r2[32] = {
+static const char * const mips_hwr_names_mips3264r2[32] =
+{
   "hwr_cpunum",   "hwr_synci_step", "hwr_cc",     "hwr_ccres",
   "$4",          "$5",            "$6",           "$7",
   "$8",   "$9",   "$10",  "$11",  "$12",  "$13",  "$14",  "$15",
@@ -288,20 +325,23 @@ static const char * const mips_hwr_names
   "$24",  "$25",  "$26",  "$27",  "$28",  "$29",  "$30",  "$31"
 };
 
-struct mips_abi_choice {
-  const char *name;
+struct mips_abi_choice
+{
+  const char * name;
   const char * const *gpr_names;
   const char * const *fpr_names;
 };
 
-struct mips_abi_choice mips_abi_choices[] = {
+struct mips_abi_choice mips_abi_choices[] =
+{
   { "numeric", mips_gpr_names_numeric, mips_fpr_names_numeric },
   { "32", mips_gpr_names_oldabi, mips_fpr_names_32 },
   { "n32", mips_gpr_names_newabi, mips_fpr_names_n32 },
   { "64", mips_gpr_names_newabi, mips_fpr_names_64 },
 };
 
-struct mips_arch_choice {
+struct mips_arch_choice
+{
   const char *name;
   int bfd_mach_valid;
   unsigned long bfd_mach;
@@ -313,7 +353,8 @@ struct mips_arch_choice {
   const char * const *hwr_names;
 };
 
-const struct mips_arch_choice mips_arch_choices[] = {
+const struct mips_arch_choice mips_arch_choices[] =
+{
   { "numeric",	0, 0, 0, 0,
     mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
 
@@ -366,26 +407,26 @@ const struct mips_arch_choice mips_arch_
      MIPS32 Architecture_ (MIPS Document Number MD00082, Revision 0.95),
      page 1.  */
   { "mips32",	1, bfd_mach_mipsisa32, CPU_MIPS32,
-    ISA_MIPS32 | INSN_MIPS16,
+    ISA_MIPS32 | INSN_MIPS16 | INSN_DSP,
     mips_cp0_names_mips3264,
     mips_cp0sel_names_mips3264, ARRAY_SIZE (mips_cp0sel_names_mips3264),
     mips_hwr_names_numeric },
 
   { "mips32r2",	1, bfd_mach_mipsisa32r2, CPU_MIPS32R2,
-    ISA_MIPS32R2 | INSN_MIPS16,
+    ISA_MIPS32R2 | INSN_MIPS16 | INSN_DSP | INSN_MT,
     mips_cp0_names_mips3264r2,
     mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2),
     mips_hwr_names_mips3264r2 },
 
   /* For stock MIPS64, disassemble all applicable MIPS-specified ASEs.  */
   { "mips64",	1, bfd_mach_mipsisa64, CPU_MIPS64,
-    ISA_MIPS64 | INSN_MIPS16 | INSN_MIPS3D | INSN_MDMX,
+    ISA_MIPS64 | INSN_MIPS16 | INSN_MIPS3D | INSN_MDMX | INSN_DSP,
     mips_cp0_names_mips3264,
     mips_cp0sel_names_mips3264, ARRAY_SIZE (mips_cp0sel_names_mips3264),
     mips_hwr_names_numeric },
 
   { "mips64r2",	1, bfd_mach_mipsisa64r2, CPU_MIPS64R2,
-    ISA_MIPS64R2 | INSN_MIPS16 | INSN_MIPS3D | INSN_MDMX,
+    ISA_MIPS64R2 | INSN_MIPS16 | INSN_MIPS3D | INSN_MDMX | INSN_DSP,
     mips_cp0_names_mips3264r2,
     mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2),
     mips_hwr_names_mips3264r2 },
@@ -396,6 +437,11 @@ const struct mips_arch_choice mips_arch_
     mips_cp0sel_names_sb1, ARRAY_SIZE (mips_cp0sel_names_sb1),
     mips_hwr_names_numeric },
 
+  { "octeon",   1, bfd_mach_mips_octeon, CPU_OCTEON,
+    ISA_MIPS64R2 | INSN_OCTEON, mips_cp0_names_octeon,
+    mips_cp0sel_names_octeon, ARRAY_SIZE (mips_cp0sel_names_octeon),
+    mips_hwr_names_numeric },
+
   /* This entry, mips16, is here only for ISA/processor selection; do
      not print its name.  */
   { "",		1, bfd_mach_mips16, CPU_MIPS16, ISA_MIPS3 | INSN_MIPS16,
@@ -414,53 +460,39 @@ static const struct mips_cp0sel_name *mi
 static int mips_cp0sel_names_len;
 static const char * const *mips_hwr_names;
 
-static const struct mips_abi_choice *choose_abi_by_name
-  PARAMS ((const char *, unsigned int));
-static const struct mips_arch_choice *choose_arch_by_name
-  PARAMS ((const char *, unsigned int));
-static const struct mips_arch_choice *choose_arch_by_number
-  PARAMS ((unsigned long));
-static const struct mips_cp0sel_name *lookup_mips_cp0sel_name
-  PARAMS ((const struct mips_cp0sel_name *, unsigned int, unsigned int,
-	   unsigned int));
+/* Other options */
+static int no_aliases;	/* If set disassemble as most general inst.  */
 
 static const struct mips_abi_choice *
-choose_abi_by_name (name, namelen)
-     const char *name;
-     unsigned int namelen;
+choose_abi_by_name (const char *name, unsigned int namelen)
 {
   const struct mips_abi_choice *c;
   unsigned int i;
 
   for (i = 0, c = NULL; i < ARRAY_SIZE (mips_abi_choices) && c == NULL; i++)
-    {
-      if (strncmp (mips_abi_choices[i].name, name, namelen) == 0
-	  && strlen (mips_abi_choices[i].name) == namelen)
-	c = &mips_abi_choices[i];
-    }
+    if (strncmp (mips_abi_choices[i].name, name, namelen) == 0
+	&& strlen (mips_abi_choices[i].name) == namelen)
+      c = &mips_abi_choices[i];
+
   return c;
 }
 
 static const struct mips_arch_choice *
-choose_arch_by_name (name, namelen)
-     const char *name;
-     unsigned int namelen;
+choose_arch_by_name (const char *name, unsigned int namelen)
 {
   const struct mips_arch_choice *c = NULL;
   unsigned int i;
 
   for (i = 0, c = NULL; i < ARRAY_SIZE (mips_arch_choices) && c == NULL; i++)
-    {
-      if (strncmp (mips_arch_choices[i].name, name, namelen) == 0
-	  && strlen (mips_arch_choices[i].name) == namelen)
-	c = &mips_arch_choices[i];
-    }
+    if (strncmp (mips_arch_choices[i].name, name, namelen) == 0
+	&& strlen (mips_arch_choices[i].name) == namelen)
+      c = &mips_arch_choices[i];
+
   return c;
 }
 
 static const struct mips_arch_choice *
-choose_arch_by_number (mach)
-     unsigned long mach;
+choose_arch_by_number (unsigned long mach)
 {
   static unsigned long hint_bfd_mach;
   static const struct mips_arch_choice *hint_arch_choice;
@@ -487,9 +519,24 @@ choose_arch_by_number (mach)
   return c;
 }
 
-void
-set_default_mips_dis_options (info)
-     struct disassemble_info *info;
+/* Check if the object uses NewABI conventions.  */
+
+static int
+is_newabi (Elf_Internal_Ehdr *header)
+{
+  /* There are no old-style ABIs which use 64-bit ELF.  */
+  if (header->e_ident[EI_CLASS] == ELFCLASS64)
+    return 1;
+
+  /* If a 32-bit ELF file, n32 is a new-style ABI.  */
+  if ((header->e_flags & EF_MIPS_ABI2) != 0)
+    return 1;
+
+  return 0;
+}
+
+static void
+set_default_mips_dis_options (struct disassemble_info *info)
 {
   const struct mips_arch_choice *chosen_arch;
 
@@ -503,6 +550,7 @@ set_default_mips_dis_options (info)
   mips_cp0sel_names = NULL;
   mips_cp0sel_names_len = 0;
   mips_hwr_names = mips_hwr_names_numeric;
+  no_aliases = 0;
 
   /* If an ELF "newabi" binary, use the n32/(n)64 GPR names.  */
   if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
@@ -534,22 +582,37 @@ set_default_mips_dis_options (info)
 #endif
 }
 
-void
-parse_mips_dis_option (option, len)
-     const char *option;
-     unsigned int len;
+static void
+parse_mips_dis_option (const char *option, unsigned int len)
 {
   unsigned int i, optionlen, vallen;
   const char *val;
   const struct mips_abi_choice *chosen_abi;
   const struct mips_arch_choice *chosen_arch;
 
-  /* Look for the = that delimits the end of the option name.  */
-  for (i = 0; i < len; i++)
+  if (strcmp ("octeon-useun", option) == 0)
     {
-      if (option[i] == '=')
-	break;
+      octeon_use_unalign = 1;
+      return;
+    }
+  if (strcmp ("no-octeon-useun", option) == 0)
+    {
+      octeon_use_unalign = 0;
+      return;
+    }
+
+  /* Try to match options that are simple flags */
+  if (strncmp (option, "no-aliases", 10) == 0)
+    {
+      no_aliases = 1;
+      return;
     }
+  
+  /* Look for the = that delimits the end of the option name.  */
+  for (i = 0; i < len; i++)
+    if (option[i] == '=')
+      break;
+
   if (i == 0)		/* Invalid option: no name before '='.  */
     return;
   if (i == len)		/* Invalid option: no '='.  */
@@ -561,8 +624,8 @@ parse_mips_dis_option (option, len)
   val = option + (optionlen + 1);
   vallen = len - (optionlen + 1);
 
-  if (strncmp("gpr-names", option, optionlen) == 0
-      && strlen("gpr-names") == optionlen)
+  if (strncmp ("gpr-names", option, optionlen) == 0
+      && strlen ("gpr-names") == optionlen)
     {
       chosen_abi = choose_abi_by_name (val, vallen);
       if (chosen_abi != NULL)
@@ -570,8 +633,8 @@ parse_mips_dis_option (option, len)
       return;
     }
 
-  if (strncmp("fpr-names", option, optionlen) == 0
-      && strlen("fpr-names") == optionlen)
+  if (strncmp ("fpr-names", option, optionlen) == 0
+      && strlen ("fpr-names") == optionlen)
     {
       chosen_abi = choose_abi_by_name (val, vallen);
       if (chosen_abi != NULL)

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

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 22:18:27 2010
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 82134106564A;
	Wed, 21 Apr 2010 22:18:27 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 58A208FC19;
	Wed, 21 Apr 2010 22:18:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LMIR90084607;
	Wed, 21 Apr 2010 22:18:27 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LMIRau084604;
	Wed, 21 Apr 2010 22:18:27 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212218.o3LMIRau084604@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 22:18:27 +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: r207024 - user/jmallett/octeon/contrib/gcc/config/mips
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: Wed, 21 Apr 2010 22:18:27 -0000

Author: jmallett
Date: Wed Apr 21 22:18:27 2010
New Revision: 207024
URL: http://svn.freebsd.org/changeset/base/207024

Log:
  Add "octeon" processor as a MIPS64R2 variant.

Modified:
  user/jmallett/octeon/contrib/gcc/config/mips/mips.c
  user/jmallett/octeon/contrib/gcc/config/mips/mips.h

Modified: user/jmallett/octeon/contrib/gcc/config/mips/mips.c
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/mips.c	Wed Apr 21 22:17:25 2010	(r207023)
+++ user/jmallett/octeon/contrib/gcc/config/mips/mips.c	Wed Apr 21 22:18:27 2010	(r207024)
@@ -763,6 +763,9 @@ const struct mips_cpu_info mips_cpu_info
   { "sb1a", PROCESSOR_SB1A, 64 },
   { "sr71000", PROCESSOR_SR71000, 64 },
 
+  /* MIPS64R2 */
+  { "octeon", PROCESSOR_OCTEON, 65 },
+
   /* End marker */
   { 0, 0, 0 }
 };
@@ -9944,6 +9947,7 @@ mips_issue_rate (void)
     case PROCESSOR_R5500:
     case PROCESSOR_R7000:
     case PROCESSOR_R9000:
+    case PROCESSOR_OCTEON:
       return 2;
 
     case PROCESSOR_SB1:

Modified: user/jmallett/octeon/contrib/gcc/config/mips/mips.h
==============================================================================
--- user/jmallett/octeon/contrib/gcc/config/mips/mips.h	Wed Apr 21 22:17:25 2010	(r207023)
+++ user/jmallett/octeon/contrib/gcc/config/mips/mips.h	Wed Apr 21 22:18:27 2010	(r207024)
@@ -41,6 +41,7 @@ enum processor_type {
   PROCESSOR_24K,
   PROCESSOR_24KX,
   PROCESSOR_M4K,
+  PROCESSOR_OCTEON,
   PROCESSOR_R3900,
   PROCESSOR_R6000,
   PROCESSOR_R4000,
@@ -213,6 +214,7 @@ extern const struct mips_rtx_cost_data *
 #define TARGET_SB1                  (mips_arch == PROCESSOR_SB1		\
 				     || mips_arch == PROCESSOR_SB1A)
 #define TARGET_SR71K                (mips_arch == PROCESSOR_SR71000)
+#define TARGET_OCTEON               (mips_arch == PROCESSOR_OCTEON)
 
 /* Scheduling target defines.  */
 #define TUNE_MIPS3000               (mips_tune == PROCESSOR_R3000)
@@ -228,6 +230,7 @@ extern const struct mips_rtx_cost_data *
 #define TUNE_MIPS9000               (mips_tune == PROCESSOR_R9000)
 #define TUNE_SB1                    (mips_tune == PROCESSOR_SB1		\
 				     || mips_tune == PROCESSOR_SB1A)
+#define TUNE_OCTEON                 (mips_tune == PROCESSOR_OCTEON)
 
 /* True if the pre-reload scheduler should try to create chains of
    multiply-add or multiply-subtract instructions.  For example,

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 22:32:25 2010
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 A9FAB1065673;
	Wed, 21 Apr 2010 22:32:25 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 94E4B8FC29;
	Wed, 21 Apr 2010 22:32:25 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LMWPkS087713;
	Wed, 21 Apr 2010 22:32:25 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LMWPfq087711;
	Wed, 21 Apr 2010 22:32:25 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212232.o3LMWPfq087711@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 22:32:25 +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: r207025 -
	user/jmallett/octeon/contrib/binutils/gas/config
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: Wed, 21 Apr 2010 22:32:25 -0000

Author: jmallett
Date: Wed Apr 21 22:32:25 2010
New Revision: 207025
URL: http://svn.freebsd.org/changeset/base/207025

Log:
  Recognize -march=octeon.

Modified:
  user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c

Modified: user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c	Wed Apr 21 22:18:27 2010	(r207024)
+++ user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c	Wed Apr 21 22:32:25 2010	(r207025)
@@ -14188,6 +14188,9 @@ static const struct mips_cpu_info mips_c
   /* Broadcom SB-1 CPU core */
   { "sb1",            0,      ISA_MIPS64,     CPU_SB1 },
 
+  /* Cavium Networks Octeon CPU core */
+  { "octeon",         0,      ISA_MIPS64R2,   CPU_OCTEON },
+
   /* End marker */
   { NULL, 0, 0, 0 }
 };

From owner-svn-src-user@FreeBSD.ORG  Wed Apr 21 23:47:04 2010
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 A15841065676;
	Wed, 21 Apr 2010 23:47:04 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 900688FC1D;
	Wed, 21 Apr 2010 23:47:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3LNl4qK004546;
	Wed, 21 Apr 2010 23:47:04 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3LNl4th004543;
	Wed, 21 Apr 2010 23:47:04 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004212347.o3LNl4th004543@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Wed, 21 Apr 2010 23:47:04 +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: r207028 -
	user/jmallett/octeon/contrib/binutils/gas/config
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: Wed, 21 Apr 2010 23:47:04 -0000

Author: jmallett
Date: Wed Apr 21 23:47:04 2010
New Revision: 207028
URL: http://svn.freebsd.org/changeset/base/207028

Log:
  Merge from Octeon cnusers SDK 1.7.2.
  
  XXX Some of these changes may be due to structural changes in binutils between
  our version and the version that the SDK is based on; I have not yet done any
  correctness checking, though I did take some small effort to minimize deltas.

Modified:
  user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c
  user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.h

Modified: user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c
==============================================================================
--- user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c	Wed Apr 21 23:03:26 2010	(r207027)
+++ user/jmallett/octeon/contrib/binutils/gas/config/tc-mips.c	Wed Apr 21 23:47:04 2010	(r207028)
@@ -1,6 +1,6 @@
 /* tc-mips.c -- assemble code for a MIPS chip.
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003, 2004 Free Software Foundation, Inc.
+   2003, 2004, 2005 Free Software Foundation, Inc.
    Contributed by the OSF and Ralph Campbell.
    Written by Keith Knowles and Ralph Campbell, working independently.
    Modified for ECOFF and R4000 support by Ian Lance Taylor of Cygnus
@@ -20,8 +20,8 @@
 
    You should have received a copy of the GNU General Public License
    along with GAS; see the file COPYING.  If not, write to the Free
-   Software Foundation, 59 Temple Place - Suite 330, Boston, MA
-   02111-1307, USA.  */
+   Software Foundation, 51 Franklin Street - Fifth Floor, Boston, MA
+   02110-1301, USA.  */
 
 #include "as.h"
 #include "config.h"
@@ -33,6 +33,7 @@
 #include "opcode/mips.h"
 #include "itbl-ops.h"
 #include "dwarf2dbg.h"
+#include "dw2gencfi.h"
 
 #ifdef DEBUG
 #define DBG(x) printf x
@@ -83,6 +84,25 @@ int mips_flag_pdr = FALSE;
 int mips_flag_pdr = TRUE;
 #endif
 
+/* Control generation of error message for unsupported instructions in
+   Octeon. Octeon does not have floating point, and all the instructions
+   that use floating point registers are not allowed in Elf targets but 
+   are allowed in Linux targets by default.  */
+#ifdef OCTEON_ERROR_ON_UNSUPPORTED
+static int octeon_error_on_unsupported = 1;
+#else
+static int octeon_error_on_unsupported = 0;
+#endif
+
+/* Control generation of Octeon/MIPS unaligned load/store instructions.
+   For ELF target, default to Octeon load/store instructions.
+   For Linux target, default to MIPS load/store instructions.  */
+#ifdef OCTEON_USE_UNALIGN
+static int octeon_use_unalign = 1;
+#else
+static int octeon_use_unalign = 0;
+#endif
+
 #include "ecoff.h"
 
 #if defined (OBJ_ELF) || defined (OBJ_MAYBE_ELF)
@@ -111,9 +131,7 @@ static char *mips_regmask_frag;
 extern int target_big_endian;
 
 /* The name of the readonly data section.  */
-#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_aout_flavour \
-			    ? ".data" \
-			    : OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
+#define RDATA_SECTION_NAME (OUTPUT_FLAVOR == bfd_target_ecoff_flavour \
 			    ? ".rdata" \
 			    : OUTPUT_FLAVOR == bfd_target_coff_flavour \
 			    ? ".rdata" \
@@ -121,6 +139,43 @@ extern int target_big_endian;
 			    ? ".rodata" \
 			    : (abort (), ""))
 
+/* Information about an instruction, including its format, operands
+   and fixups.  */
+struct mips_cl_insn
+{
+  /* The opcode's entry in mips_opcodes or mips16_opcodes.  */
+  const struct mips_opcode *insn_mo;
+
+  /* True if this is a mips16 instruction and if we want the extended
+     form of INSN_MO.  */
+  bfd_boolean use_extend;
+
+  /* The 16-bit extension instruction to use when USE_EXTEND is true.  */
+  unsigned short extend;
+
+  /* The 16-bit or 32-bit bitstring of the instruction itself.  This is
+     a copy of INSN_MO->match with the operands filled in.  */
+  unsigned long insn_opcode;
+
+  /* The frag that contains the instruction.  */
+  struct frag *frag;
+
+  /* The offset into FRAG of the first instruction byte.  */
+  long where;
+
+  /* The relocs associated with the instruction, if any.  */
+  fixS *fixp[3];
+
+  /* True if this entry cannot be moved from its current position.  */
+  unsigned int fixed_p : 1;
+
+  /* True if this instruction occured in a .set noreorder block.  */
+  unsigned int noreorder_p : 1;
+
+  /* True for mips16 instructions that jump to an absolute address.  */
+  unsigned int mips16_absolute_jump_p : 1;
+};
+
 /* The ABI to use.  */
 enum mips_abi_level
 {
@@ -138,6 +193,10 @@ static enum mips_abi_level mips_abi = NO
 /* Whether or not we have code that can call pic code.  */
 int mips_abicalls = FALSE;
 
+/* Whether or not we have code which can be put into a shared
+   library.  */
+static bfd_boolean mips_in_shared = TRUE;
+
 /* This is the set of options which may be modified by the .set
    pseudo-op.  We use a struct so that .set push and .set pop are more
    reliable.  */
@@ -153,6 +212,8 @@ struct mips_set_options
      command line options, and based on the default architecture.  */
   int ase_mips3d;
   int ase_mdmx;
+  int ase_dsp;
+  int ase_mt;
   /* Whether we are assembling for the mips16 processor.  0 if we are
      not, 1 if we are, and -1 if the value has not been initialized.
      Changed by `.set mips16' and `.set nomips16', and the -mips16 and
@@ -187,6 +248,8 @@ struct mips_set_options
   /* MIPS architecture (CPU) type.  Changed by .set arch=FOO, the -march
      command line option, and the default CPU.  */
   int arch;
+  /* True if ".set sym32" is in effect.  */
+  bfd_boolean sym32;
 };
 
 /* True if -mgp32 was passed.  */
@@ -201,7 +264,7 @@ static int file_mips_fp32 = -1;
 
 static struct mips_set_options mips_opts =
 {
-  ISA_UNKNOWN, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN
+  ISA_UNKNOWN, -1, -1, -1, -1, -1, 0, 0, 0, 0, 0, 0, 0, 0, CPU_UNKNOWN, FALSE
 };
 
 /* These variables are filled in with the masks of registers used.
@@ -225,6 +288,14 @@ static int file_ase_mips3d;
    command line (e.g., by -march).  */
 static int file_ase_mdmx;
 
+/* True if -mdsp was passed or implied by arguments passed on the
+   command line (e.g., by -march).  */
+static int file_ase_dsp;
+
+/* True if -mmt was passed or implied by arguments passed on the
+   command line (e.g., by -march).  */
+static int file_ase_mt;
+
 /* The argument of the -march= flag.  The architecture we are assembling.  */
 static int file_mips_arch = CPU_UNKNOWN;
 static const char *mips_arch_string;
@@ -268,6 +339,12 @@ static int mips_32bitmode = 0;
    || (ISA) == ISA_MIPS64R2	\
    )
 
+/* Return true if ISA supports ins instructions. */
+#define ISA_HAS_INS(ISA) ( \
+  (ISA) == ISA_MIPS32R2    \
+  || (ISA) == ISA_MIPS64R2 \
+  )
+
 #define HAVE_32BIT_GPRS		                   \
     (mips_opts.gp32 || ! ISA_HAS_64BIT_REGS (mips_opts.isa))
 
@@ -284,15 +361,16 @@ static int mips_32bitmode = 0;
 /* True if relocations are stored in-place.  */
 #define HAVE_IN_PLACE_ADDENDS (!HAVE_NEWABI)
 
-/* We can only have 64bit addresses if the object file format
-   supports it.  */
-#define HAVE_32BIT_ADDRESSES                           \
-   (HAVE_32BIT_GPRS                                    \
-    || ((bfd_arch_bits_per_address (stdoutput) == 32   \
-         || ! HAVE_64BIT_OBJECTS)                      \
-        && mips_pic != EMBEDDED_PIC))
-
-#define HAVE_64BIT_ADDRESSES (! HAVE_32BIT_ADDRESSES)
+/* The ABI-derived address size.  */
+#define HAVE_64BIT_ADDRESSES \
+  (HAVE_64BIT_GPRS && (mips_abi == EABI_ABI || mips_abi == N64_ABI))
+#define HAVE_32BIT_ADDRESSES (!HAVE_64BIT_ADDRESSES)
+
+/* The size of symbolic constants (i.e., expressions of the form
+   "SYMBOL" or "SYMBOL + OFFSET").  */
+#define HAVE_32BIT_SYMBOLS \
+  (HAVE_32BIT_ADDRESSES || !HAVE_64BIT_OBJECTS || mips_opts.sym32)
+#define HAVE_64BIT_SYMBOLS (!HAVE_32BIT_SYMBOLS)
 
 /* Addresses are loaded in different ways, depending on the address size
    in use.  The n32 ABI Documentation also mandates the use of additions
@@ -322,6 +400,14 @@ static int mips_32bitmode = 0;
 #define CPU_HAS_MDMX(cpu)	(FALSE                 \
 				 )
 
+/* Return true if the given CPU supports the DSP ASE.  */
+#define CPU_HAS_DSP(cpu)	(FALSE                 \
+				 )
+
+/* Return true if the given CPU supports the MT ASE.  */
+#define CPU_HAS_MT(cpu)		(FALSE                 \
+				 )
+
 /* True if CPU has a dror instruction.  */
 #define CPU_HAS_DROR(CPU)	((CPU) == CPU_VR5400 || (CPU) == CPU_VR5500)
 
@@ -349,7 +435,6 @@ static int mips_32bitmode = 0;
    || mips_opts.arch == CPU_R10000                    \
    || mips_opts.arch == CPU_R12000                    \
    || mips_opts.arch == CPU_RM7000                    \
-   || mips_opts.arch == CPU_SB1                       \
    || mips_opts.arch == CPU_VR5500                    \
    )
 
@@ -360,8 +445,6 @@ static int mips_32bitmode = 0;
    level I.  */
 #define gpr_interlocks \
   (mips_opts.isa != ISA_MIPS1  \
-   || mips_opts.arch == CPU_VR5400  \
-   || mips_opts.arch == CPU_VR5500  \
    || mips_opts.arch == CPU_R3900)
 
 /* Whether the processor uses hardware interlocks to avoid delays
@@ -377,9 +460,6 @@ static int mips_32bitmode = 0;
     && mips_opts.isa != ISA_MIPS2                     \
     && mips_opts.isa != ISA_MIPS3)                    \
    || mips_opts.arch == CPU_R4300                     \
-   || mips_opts.arch == CPU_VR5400                    \
-   || mips_opts.arch == CPU_VR5500                    \
-   || mips_opts.arch == CPU_SB1                       \
    )
 
 /* Whether the processor uses hardware interlocks to protect reads
@@ -521,44 +601,27 @@ static int mips_optimize = 2;
    equivalent to seeing no -g option at all.  */
 static int mips_debug = 0;
 
-/* The previous instruction.  */
-static struct mips_cl_insn prev_insn;
-
-/* The instruction before prev_insn.  */
-static struct mips_cl_insn prev_prev_insn;
+/* The maximum number of NOPs needed to avoid the VR4130 mflo/mfhi errata.  */
+#define MAX_VR4130_NOPS 4
 
-/* If we don't want information for prev_insn or prev_prev_insn, we
-   point the insn_mo field at this dummy integer.  */
-static const struct mips_opcode dummy_opcode = { NULL, NULL, 0, 0, 0, 0 };
+/* The maximum number of NOPs needed to fill delay slots.  */
+#define MAX_DELAY_NOPS 2
 
-/* Non-zero if prev_insn is valid.  */
-static int prev_insn_valid;
+/* The maximum number of NOPs needed for any purpose.  */
+#define MAX_NOPS 4
 
-/* The frag for the previous instruction.  */
-static struct frag *prev_insn_frag;
+/* A list of previous instructions, with index 0 being the most recent.
+   We need to look back MAX_NOPS instructions when filling delay slots
+   or working around processor errata.  We need to look back one
+   instruction further if we're thinking about using history[0] to
+   fill a branch delay slot.  */
+static struct mips_cl_insn history[1 + MAX_NOPS];
 
-/* The offset into prev_insn_frag for the previous instruction.  */
-static long prev_insn_where;
+/* Nop instructions used by emit_nop.  */
+static struct mips_cl_insn nop_insn, mips16_nop_insn;
 
-/* The reloc type for the previous instruction, if any.  */
-static bfd_reloc_code_real_type prev_insn_reloc_type[3];
-
-/* The reloc for the previous instruction, if any.  */
-static fixS *prev_insn_fixp[3];
-
-/* Non-zero if the previous instruction was in a delay slot.  */
-static int prev_insn_is_delay_slot;
-
-/* Non-zero if the previous instruction was in a .set noreorder.  */
-static int prev_insn_unreordered;
-
-/* Non-zero if the previous instruction uses an extend opcode (if
-   mips16).  */
-static int prev_insn_extended;
-
-/* Non-zero if the previous previous instruction was in a .set
-   noreorder.  */
-static int prev_prev_insn_unreordered;
+/* The appropriate nop for the current mode.  */
+#define NOP_INSN (mips_opts.mips16 ? &mips16_nop_insn : &nop_insn)
 
 /* If this is set, it points to a frag holding nop instructions which
    were inserted before the start of a noreorder section.  If those
@@ -625,8 +688,29 @@ static const unsigned int mips16_to_32_r
   16, 17, 2, 3, 4, 5, 6, 7
 };
 
+/* Classifies the kind of instructions we're interested in when
+   implementing -mfix-vr4120.  */
+enum fix_vr4120_class {
+  FIX_VR4120_MACC,
+  FIX_VR4120_DMACC,
+  FIX_VR4120_MULT,
+  FIX_VR4120_DMULT,
+  FIX_VR4120_DIV,
+  FIX_VR4120_MTHILO,
+  NUM_FIX_VR4120_CLASSES
+};
+
+/* Given two FIX_VR4120_* values X and Y, bit Y of element X is set if
+   there must be at least one other instruction between an instruction
+   of type X and an instruction of type Y.  */
+static unsigned int vr4120_conflicts[NUM_FIX_VR4120_CLASSES];
+
+/* True if -mfix-vr4120 is in force.  */
 static int mips_fix_vr4120;
 
+/* ...likewise -mfix-vr4130.  */
+static int mips_fix_vr4130;
+
 /* We don't relax branches by default, since this causes us to expand
    `la .l2 - .l1' if there's a branch between .l1 and .l2, because we
    fail to compute the offset before expanding the macro to the most
@@ -820,6 +904,41 @@ static int mips_relax_branch;
   (((x) &~ (offsetT) 0x7fff) == 0					\
    || (((x) &~ (offsetT) 0x7fff) == ~ (offsetT) 0x7fff))
 
+/* Is the given value a zero-extended 32-bit value?  Or a negated one?  */
+#define IS_ZEXT_32BIT_NUM(x)						\
+  (((x) &~ (offsetT) 0xffffffff) == 0					\
+   || (((x) &~ (offsetT) 0xffffffff) == ~ (offsetT) 0xffffffff))
+
+/* Replace bits MASK << SHIFT of STRUCT with the equivalent bits in
+   VALUE << SHIFT.  VALUE is evaluated exactly once.  */
+#define INSERT_BITS(STRUCT, VALUE, MASK, SHIFT) \
+  (STRUCT) = (((STRUCT) & ~((MASK) << (SHIFT))) \
+	      | (((VALUE) & (MASK)) << (SHIFT)))
+
+/* Extract bits MASK << SHIFT from STRUCT and shift them right
+   SHIFT places.  */
+#define EXTRACT_BITS(STRUCT, MASK, SHIFT) \
+  (((STRUCT) >> (SHIFT)) & (MASK))
+
+/* Change INSN's opcode so that the operand given by FIELD has value VALUE.
+   INSN is a mips_cl_insn structure and VALUE is evaluated exactly once.
+
+   include/opcode/mips.h specifies operand fields using the macros
+   OP_MASK_<FIELD> and OP_SH_<FIELD>.  The MIPS16 equivalents start
+   with "MIPS16OP" instead of "OP".  */
+#define INSERT_OPERAND(FIELD, INSN, VALUE) \
+  INSERT_BITS ((INSN).insn_opcode, VALUE, OP_MASK_##FIELD, OP_SH_##FIELD)
+#define MIPS16_INSERT_OPERAND(FIELD, INSN, VALUE) \
+  INSERT_BITS ((INSN).insn_opcode, VALUE, \
+		MIPS16OP_MASK_##FIELD, MIPS16OP_SH_##FIELD)
+
+/* Extract the operand given by FIELD from mips_cl_insn INSN.  */
+#define EXTRACT_OPERAND(FIELD, INSN) \
+  EXTRACT_BITS ((INSN).insn_opcode, OP_MASK_##FIELD, OP_SH_##FIELD)
+#define MIPS16_EXTRACT_OPERAND(FIELD, INSN) \
+  EXTRACT_BITS ((INSN).insn_opcode, \
+		MIPS16OP_MASK_##FIELD, \
+		MIPS16OP_SH_##FIELD)
 
 /* Global variables used when generating relaxable macros.  See the
    comment above RELAX_ENCODE for more details about how relaxation
@@ -866,7 +985,7 @@ enum mips_regclass { MIPS_GR_REG, MIPS_F
 
 static void append_insn
   (struct mips_cl_insn *ip, expressionS *p, bfd_reloc_code_real_type *r);
-static void mips_no_prev_insn (int);
+static void mips_no_prev_insn (void);
 static void mips16_macro_build
   (expressionS *, const char *, const char *, va_list);
 static void load_register (int, expressionS *, int);
@@ -1092,8 +1211,6 @@ mips_target_format (void)
 {
   switch (OUTPUT_FLAVOR)
     {
-    case bfd_target_aout_flavour:
-      return target_big_endian ? "a.out-mips-big" : "a.out-mips-little";
     case bfd_target_ecoff_flavour:
       return target_big_endian ? "ecoff-bigmips" : ECOFF_LITTLE_FORMAT;
     case bfd_target_coff_flavour:
@@ -1127,6 +1244,174 @@ mips_target_format (void)
     }
 }
 
+/* Return the length of instruction INSN.  */
+
+static inline unsigned int
+insn_length (const struct mips_cl_insn *insn)
+{
+  if (!mips_opts.mips16)
+    return 4;
+  return insn->mips16_absolute_jump_p || insn->use_extend ? 4 : 2;
+}
+
+/* Initialise INSN from opcode entry MO.  Leave its position unspecified.  */
+
+static void
+create_insn (struct mips_cl_insn *insn, const struct mips_opcode *mo)
+{
+  size_t i;
+
+  insn->insn_mo = mo;
+  insn->use_extend = FALSE;
+  insn->extend = 0;
+  insn->insn_opcode = mo->match;
+  insn->frag = NULL;
+  insn->where = 0;
+  for (i = 0; i < ARRAY_SIZE (insn->fixp); i++)
+    insn->fixp[i] = NULL;
+  insn->fixed_p = (mips_opts.noreorder > 0);
+  insn->noreorder_p = (mips_opts.noreorder > 0);
+  insn->mips16_absolute_jump_p = 0;
+}
+
+/* Install INSN at the location specified by its "frag" and "where" fields.  */
+
+static void
+install_insn (const struct mips_cl_insn *insn)
+{
+  char *f = insn->frag->fr_literal + insn->where;
+  if (!mips_opts.mips16)
+    md_number_to_chars (f, insn->insn_opcode, 4);
+  else if (insn->mips16_absolute_jump_p)
+    {
+      md_number_to_chars (f, insn->insn_opcode >> 16, 2);
+      md_number_to_chars (f + 2, insn->insn_opcode & 0xffff, 2);
+    }
+  else
+    {
+      if (insn->use_extend)
+	{
+	  md_number_to_chars (f, 0xf000 | insn->extend, 2);
+	  f += 2;
+	}
+      md_number_to_chars (f, insn->insn_opcode, 2);
+    }
+}
+
+/* Move INSN to offset WHERE in FRAG.  Adjust the fixups accordingly
+   and install the opcode in the new location.  */
+
+static void
+move_insn (struct mips_cl_insn *insn, fragS *frag, long where)
+{
+  size_t i;
+
+  insn->frag = frag;
+  insn->where = where;
+  for (i = 0; i < ARRAY_SIZE (insn->fixp); i++)
+    if (insn->fixp[i] != NULL)
+      {
+	insn->fixp[i]->fx_frag = frag;
+	insn->fixp[i]->fx_where = where;
+      }
+  install_insn (insn);
+}
+
+/* Add INSN to the end of the output.  */
+
+static void
+add_fixed_insn (struct mips_cl_insn *insn)
+{
+  char *f = frag_more (insn_length (insn));
+  move_insn (insn, frag_now, f - frag_now->fr_literal);
+}
+
+/* Start a variant frag and move INSN to the start of the variant part,
+   marking it as fixed.  The other arguments are as for frag_var.  */
+
+static void
+add_relaxed_insn (struct mips_cl_insn *insn, int max_chars, int var,
+		  relax_substateT subtype, symbolS *symbol, offsetT offset)
+{
+  frag_grow (max_chars);
+  move_insn (insn, frag_now, frag_more (0) - frag_now->fr_literal);
+  insn->fixed_p = 1;
+  frag_var (rs_machine_dependent, max_chars, var,
+	    subtype, symbol, offset, NULL);
+}
+
+/* Insert N copies of INSN into the history buffer, starting at
+   position FIRST.  Neither FIRST nor N need to be clipped.  */
+
+static void
+insert_into_history (unsigned int first, unsigned int n,
+		     const struct mips_cl_insn *insn)
+{
+  if (mips_relax.sequence != 2)
+    {
+      unsigned int i;
+
+      for (i = ARRAY_SIZE (history); i-- > first;)
+	if (i >= first + n)
+	  history[i] = history[i - n];
+	else
+	  history[i] = *insn;
+    }
+}
+
+/* Emit a nop instruction, recording it in the history buffer.  */
+
+static void
+emit_nop (void)
+{
+  add_fixed_insn (NOP_INSN);
+  insert_into_history (0, 1, NOP_INSN);
+}
+
+/* Initialize vr4120_conflicts.  There is a bit of duplication here:
+   the idea is to make it obvious at a glance that each errata is
+   included.  */
+
+static void
+init_vr4120_conflicts (void)
+{
+#define CONFLICT(FIRST, SECOND) \
+    vr4120_conflicts[FIX_VR4120_##FIRST] |= 1 << FIX_VR4120_##SECOND
+
+  /* Errata 21 - [D]DIV[U] after [D]MACC */
+  CONFLICT (MACC, DIV);
+  CONFLICT (DMACC, DIV);
+
+  /* Errata 23 - Continuous DMULT[U]/DMACC instructions.  */
+  CONFLICT (DMULT, DMULT);
+  CONFLICT (DMULT, DMACC);
+  CONFLICT (DMACC, DMULT);
+  CONFLICT (DMACC, DMACC);
+
+  /* Errata 24 - MT{LO,HI} after [D]MACC */
+  CONFLICT (MACC, MTHILO);
+  CONFLICT (DMACC, MTHILO);
+
+  /* VR4181A errata MD(1): "If a MULT, MULTU, DMULT or DMULTU
+     instruction is executed immediately after a MACC or DMACC
+     instruction, the result of [either instruction] is incorrect."  */
+  CONFLICT (MACC, MULT);
+  CONFLICT (MACC, DMULT);
+  CONFLICT (DMACC, MULT);
+  CONFLICT (DMACC, DMULT);
+
+  /* VR4181A errata MD(4): "If a MACC or DMACC instruction is
+     executed immediately after a DMULT, DMULTU, DIV, DIVU,
+     DDIV or DDIVU instruction, the result of the MACC or
+     DMACC instruction is incorrect.".  */
+  CONFLICT (DMULT, MACC);
+  CONFLICT (DMULT, DMACC);
+  CONFLICT (DIV, MACC);
+  CONFLICT (DIV, DMACC);
+
+#undef CONFLICT
+}
+
 /* This function is called once, at assembler startup time.  It should
    set up all the tables, etc. that the MD part of the assembler will need.  */
 
@@ -1137,6 +1422,13 @@ md_begin (void)
   int i = 0;
   int broken = 0;
 
+  if (mips_pic != NO_PIC)
+    {
+      if (g_switch_seen && g_switch_value != 0)
+	as_bad (_("-G may not be used in position-independent code"));
+      g_switch_value = 0;
+    }
+
   if (! bfd_set_arch_mach (stdoutput, bfd_arch_mips, file_mips_arch))
     as_warn (_("Could not set architecture and machine"));
 
@@ -1160,6 +1452,11 @@ md_begin (void)
 	    {
 	      if (!validate_mips_insn (&mips_opcodes[i]))
 		broken = 1;
+	      if (nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0)
+		{
+		  create_insn (&nop_insn, mips_opcodes + i);
+		  nop_insn.fixed_p = 1;
+		}
 	    }
 	  ++i;
 	}
@@ -1187,6 +1484,11 @@ md_begin (void)
 		       mips16_opcodes[i].name, mips16_opcodes[i].args);
 	      broken = 1;
 	    }
+	  if (mips16_nop_insn.insn_mo == NULL && strcmp (name, "nop") == 0)
+	    {
+	      create_insn (&mips16_nop_insn, mips16_opcodes + i);
+	      mips16_nop_insn.fixed_p = 1;
+	    }
 	  ++i;
 	}
       while (i < bfd_mips16_num_opcodes
@@ -1239,7 +1541,7 @@ md_begin (void)
 				       &zero_address_frag));
     }
 
-  mips_no_prev_insn (FALSE);
+  mips_no_prev_insn ();
 
   mips_gprmask = 0;
   mips_cprmask[0] = 0;
@@ -1250,15 +1552,15 @@ md_begin (void)
   /* set the default alignment for the text section (2**2) */
   record_alignment (text_section, 2);
 
-  if (USE_GLOBAL_POINTER_OPT)
-    bfd_set_gp_size (stdoutput, g_switch_value);
+  bfd_set_gp_size (stdoutput, g_switch_value);
 
   if (OUTPUT_FLAVOR == bfd_target_elf_flavour)
     {
       /* On a native system, sections must be aligned to 16 byte
-	 boundaries.  When configured for an embedded ELF target, we
+         boundaries.  When configured for an embedded ELF target, we
 	 don't bother.  */
-      if (strcmp (TARGET_OS, "elf") != 0)
+      if (strcmp (TARGET_OS, "elf") != 0
+	  && strcmp (TARGET_OS, "vxworks") != 0)
 	{
 	  (void) bfd_set_section_alignment (stdoutput, text_section, 4);
 	  (void) bfd_set_section_alignment (stdoutput, data_section, 4);
@@ -1346,6 +1648,9 @@ md_begin (void)
 
   if (! ECOFF_DEBUGGING)
     md_obj_begin ();
+
+  if (mips_fix_vr4120)
+    init_vr4120_conflicts ();
 }
 
 void
@@ -1408,8 +1713,8 @@ md_assemble (char *str)
 }
 
 /* Return true if the given relocation might need a matching %lo().
-   Note that R_MIPS_GOT16 relocations only need a matching %lo() when
-   applied to local symbols.  */
+   This is only "might" because SVR4 R_MIPS_GOT16 relocations only
+   need a matching %lo() when applied to local symbols.  */
 
 static inline bfd_boolean
 reloc_needs_lo_p (bfd_reloc_code_real_type reloc)
@@ -1434,7 +1739,7 @@ fixup_has_matching_lo_p (fixS *fixp)
    of register.  */
 
 static int
-insn_uses_reg (struct mips_cl_insn *ip, unsigned int reg,
+insn_uses_reg (const struct mips_cl_insn *ip, unsigned int reg,
 	       enum mips_regclass class)
 {
   if (class == MIPS16_REG)
@@ -1459,38 +1764,33 @@ insn_uses_reg (struct mips_cl_insn *ip, 
 	 because there is no instruction that sets both $f0 and $f1
 	 and requires a delay.  */
       if ((ip->insn_mo->pinfo & INSN_READ_FPR_S)
-	  && ((((ip->insn_opcode >> OP_SH_FS) & OP_MASK_FS) &~(unsigned)1)
+	  && ((EXTRACT_OPERAND (FS, *ip) & ~(unsigned) 1)
 	      == (reg &~ (unsigned) 1)))
 	return 1;
       if ((ip->insn_mo->pinfo & INSN_READ_FPR_T)
-	  && ((((ip->insn_opcode >> OP_SH_FT) & OP_MASK_FT) &~(unsigned)1)
+	  && ((EXTRACT_OPERAND (FT, *ip) & ~(unsigned) 1)
 	      == (reg &~ (unsigned) 1)))
 	return 1;
     }
   else if (! mips_opts.mips16)
     {
       if ((ip->insn_mo->pinfo & INSN_READ_GPR_S)
-	  && ((ip->insn_opcode >> OP_SH_RS) & OP_MASK_RS) == reg)
+	  && EXTRACT_OPERAND (RS, *ip) == reg)
 	return 1;
       if ((ip->insn_mo->pinfo & INSN_READ_GPR_T)
-	  && ((ip->insn_opcode >> OP_SH_RT) & OP_MASK_RT) == reg)
+	  && EXTRACT_OPERAND (RT, *ip) == reg)
 	return 1;
     }
   else
     {
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_X)
-	  && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RX)
-				    & MIPS16OP_MASK_RX)]
-	      == reg))
+	  && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, *ip)] == reg)
 	return 1;
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Y)
-	  && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_RY)
-				    & MIPS16OP_MASK_RY)]
-	      == reg))
+	  && mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RY, *ip)] == reg)
 	return 1;
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_Z)
-	  && (mips16_to_32_reg_map[((ip->insn_opcode >> MIPS16OP_SH_MOVE32Z)
-				    & MIPS16OP_MASK_MOVE32Z)]
+	  && (mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (MOVE32Z, *ip)]
 	      == reg))
 	return 1;
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_T) && reg == TREG)
@@ -1500,8 +1800,7 @@ insn_uses_reg (struct mips_cl_insn *ip, 
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_31) && reg == RA)
 	return 1;
       if ((ip->insn_mo->pinfo & MIPS16_INSN_READ_GPR_X)
-	  && ((ip->insn_opcode >> MIPS16OP_SH_REGR32)
-	      & MIPS16OP_MASK_REGR32) == reg)
+	  && MIPS16_EXTRACT_OPERAND (REGR32, *ip) == reg)
 	return 1;
     }
 
@@ -1516,7 +1815,7 @@ reg_needs_delay (unsigned int reg)
 {
   unsigned long prev_pinfo;
 
-  prev_pinfo = prev_insn.insn_mo->pinfo;
+  prev_pinfo = history[0].insn_mo->pinfo;
   if (! mips_opts.noreorder
       && (((prev_pinfo & INSN_LOAD_MEMORY_DELAY)
 	   && ! gpr_interlocks)
@@ -1527,13 +1826,33 @@ reg_needs_delay (unsigned int reg)
 	 delay the use of general register rt for one instruction.  */
       /* Itbl support may require additional care here.  */
       know (prev_pinfo & INSN_WRITE_GPR_T);
-      if (reg == ((prev_insn.insn_opcode >> OP_SH_RT) & OP_MASK_RT))
+      if (reg == EXTRACT_OPERAND (RT, history[0]))
 	return 1;
     }
 
   return 0;
 }
 
+/* Move all labels in insn_labels to the current insertion point.  */
+
+static void
+mips_move_labels (void)
+{
+  struct insn_label_list *l;
+  valueT val;
+
+  for (l = insn_labels; l != NULL; l = l->next)
+    {
+      assert (S_GET_SEGMENT (l->label) == now_seg);
+      symbol_set_frag (l->label, frag_now);
+      val = (valueT) frag_now_fix ();
+      /* mips16 text labels are stored as odd.  */
+      if (mips_opts.mips16)
+	++val;
+      S_SET_VALUE (l->label, val);
+    }
+}
+
 /* Mark instruction labels in mips16 mode.  This permits the linker to
    handle them specially, such as generating jalx instructions when
    needed.  We also make them odd for the duration of the assembly, in
@@ -1609,6 +1928,273 @@ relax_end (void)
   mips_relax.sequence = 0;
 }
 
+/* Classify an instruction according to the FIX_VR4120_* enumeration.
+   Return NUM_FIX_VR4120_CLASSES if the instruction isn't affected
+   by VR4120 errata.  */
+
+static unsigned int
+classify_vr4120_insn (const char *name)
+{
+  if (strncmp (name, "macc", 4) == 0)
+    return FIX_VR4120_MACC;
+  if (strncmp (name, "dmacc", 5) == 0)
+    return FIX_VR4120_DMACC;
+  if (strncmp (name, "mult", 4) == 0)
+    return FIX_VR4120_MULT;
+  if (strncmp (name, "dmult", 5) == 0)
+    return FIX_VR4120_DMULT;
+  if (strstr (name, "div"))
+    return FIX_VR4120_DIV;
+  if (strcmp (name, "mtlo") == 0 || strcmp (name, "mthi") == 0)
+    return FIX_VR4120_MTHILO;
+  return NUM_FIX_VR4120_CLASSES;
+}
+
+/* Return the number of instructions that must separate INSN1 and INSN2,
+   where INSN1 is the earlier instruction.  Return the worst-case value
+   for any INSN2 if INSN2 is null.  */
+
+static unsigned int
+insns_between (const struct mips_cl_insn *insn1,
+	       const struct mips_cl_insn *insn2)
+{
+  unsigned long pinfo1, pinfo2;
+
+  /* This function needs to know which pinfo flags are set for INSN2
+     and which registers INSN2 uses.  The former is stored in PINFO2 and
+     the latter is tested via INSN2_USES_REG.  If INSN2 is null, PINFO2
+     will have every flag set and INSN2_USES_REG will always return true.  */
+  pinfo1 = insn1->insn_mo->pinfo;
+  pinfo2 = insn2 ? insn2->insn_mo->pinfo : ~0U;
+
+#define INSN2_USES_REG(REG, CLASS) \
+   (insn2 == NULL || insn_uses_reg (insn2, REG, CLASS))
+
+  /* For most targets, write-after-read dependencies on the HI and LO
+     registers must be separated by at least two instructions.  */
+  if (!hilo_interlocks)
+    {
+      if ((pinfo1 & INSN_READ_LO) && (pinfo2 & INSN_WRITE_LO))
+	return 2;
+      if ((pinfo1 & INSN_READ_HI) && (pinfo2 & INSN_WRITE_HI))
+	return 2;
+    }
+
+  /* If we're working around r7000 errata, there must be two instructions
+     between an mfhi or mflo and any instruction that uses the result.  */
+  if (mips_7000_hilo_fix
+      && MF_HILO_INSN (pinfo1)
+      && INSN2_USES_REG (EXTRACT_OPERAND (RD, *insn1), MIPS_GR_REG))
+    return 2;
+
+  /* If working around VR4120 errata, check for combinations that need
+     a single intervening instruction.  */
+  if (mips_fix_vr4120)
+    {
+      unsigned int class1, class2;
+
+      class1 = classify_vr4120_insn (insn1->insn_mo->name);
+      if (class1 != NUM_FIX_VR4120_CLASSES && vr4120_conflicts[class1] != 0)
+	{
+	  if (insn2 == NULL)
+	    return 1;
+	  class2 = classify_vr4120_insn (insn2->insn_mo->name);
+	  if (vr4120_conflicts[class1] & (1 << class2))
+	    return 1;
+	}
+    }
+
+  if (!mips_opts.mips16)
+    {
+      /* Check for GPR or coprocessor load delays.  All such delays
+	 are on the RT register.  */
+      /* Itbl support may require additional care here.  */
+      if ((!gpr_interlocks && (pinfo1 & INSN_LOAD_MEMORY_DELAY))
+	  || (!cop_interlocks && (pinfo1 & INSN_LOAD_COPROC_DELAY)))
+	{
+	  know (pinfo1 & INSN_WRITE_GPR_T);
+	  if (INSN2_USES_REG (EXTRACT_OPERAND (RT, *insn1), MIPS_GR_REG))
+	    return 1;
+	}
+
+      /* Check for generic coprocessor hazards.
+
+	 This case is not handled very well.  There is no special
+	 knowledge of CP0 handling, and the coprocessors other than
+	 the floating point unit are not distinguished at all.  */
+      /* Itbl support may require additional care here. FIXME!
+	 Need to modify this to include knowledge about
+	 user specified delays!  */
+      else if ((!cop_interlocks && (pinfo1 & INSN_COPROC_MOVE_DELAY))
+	       || (!cop_mem_interlocks && (pinfo1 & INSN_COPROC_MEMORY_DELAY)))
+	{
+	  /* Handle cases where INSN1 writes to a known general coprocessor
+	     register.  There must be a one instruction delay before INSN2
+	     if INSN2 reads that register, otherwise no delay is needed.  */
+	  if (pinfo1 & INSN_WRITE_FPR_T)
+	    {
+	      if (INSN2_USES_REG (EXTRACT_OPERAND (FT, *insn1), MIPS_FP_REG))
+		return 1;
+	    }
+	  else if (pinfo1 & INSN_WRITE_FPR_S)
+	    {
+	      if (INSN2_USES_REG (EXTRACT_OPERAND (FS, *insn1), MIPS_FP_REG))
+		return 1;
+	    }
+	  else
+	    {
+	      /* Read-after-write dependencies on the control registers
+		 require a two-instruction gap.  */
+	      if ((pinfo1 & INSN_WRITE_COND_CODE)
+		  && (pinfo2 & INSN_READ_COND_CODE))
+		return 2;
+
+	      /* We don't know exactly what INSN1 does.  If INSN2 is
+		 also a coprocessor instruction, assume there must be
+		 a one instruction gap.  */
+	      if (pinfo2 & INSN_COP)
+		return 1;
+	    }
+	}
+
+      /* Check for read-after-write dependencies on the coprocessor
+	 control registers in cases where INSN1 does not need a general
+	 coprocessor delay.  This means that INSN1 is a floating point
+	 comparison instruction.  */
+      /* Itbl support may require additional care here.  */
+      else if (!cop_interlocks
+	       && (pinfo1 & INSN_WRITE_COND_CODE)
+	       && (pinfo2 & INSN_READ_COND_CODE))
+	return 1;
+    }
+
+#undef INSN2_USES_REG
+
+  return 0;
+}
+
+/* Return the number of nops that would be needed to work around the
+   VR4130 mflo/mfhi errata if instruction INSN immediately followed
+   the MAX_VR4130_NOPS instructions described by HISTORY.  */
+
+static int
+nops_for_vr4130 (const struct mips_cl_insn *history,
+		 const struct mips_cl_insn *insn)
+{
+  int i, j, reg;
+
+  /* Check if the instruction writes to HI or LO.  MTHI and MTLO
+     are not affected by the errata.  */
+  if (insn != 0
+      && ((insn->insn_mo->pinfo & (INSN_WRITE_HI | INSN_WRITE_LO)) == 0
+	  || strcmp (insn->insn_mo->name, "mtlo") == 0
+	  || strcmp (insn->insn_mo->name, "mthi") == 0))
+    return 0;
+
+  /* Search for the first MFLO or MFHI.  */
+  for (i = 0; i < MAX_VR4130_NOPS; i++)
+    if (!history[i].noreorder_p && MF_HILO_INSN (history[i].insn_mo->pinfo))
+      {
+	/* Extract the destination register.  */
+	if (mips_opts.mips16)
+	  reg = mips16_to_32_reg_map[MIPS16_EXTRACT_OPERAND (RX, history[i])];
+	else
+	  reg = EXTRACT_OPERAND (RD, history[i]);
+
+	/* No nops are needed if INSN reads that register.  */
+	if (insn != NULL && insn_uses_reg (insn, reg, MIPS_GR_REG))
+	  return 0;
+
+	/* ...or if any of the intervening instructions do.  */
+	for (j = 0; j < i; j++)
+	  if (insn_uses_reg (&history[j], reg, MIPS_GR_REG))
+	    return 0;
+
+	return MAX_VR4130_NOPS - i;
+      }
+  return 0;
+}
+
+/* Return the number of nops that would be needed if instruction INSN
+   immediately followed the MAX_NOPS instructions given by HISTORY,
+   where HISTORY[0] is the most recent instruction.  If INSN is null,
+   return the worse-case number of nops for any instruction.  */
+
+static int
+nops_for_insn (const struct mips_cl_insn *history,
+	       const struct mips_cl_insn *insn)
+{
+  int i, nops, tmp_nops;
+
+  nops = 0;
+  for (i = 0; i < MAX_DELAY_NOPS; i++)
+    if (!history[i].noreorder_p)
+      {
+	tmp_nops = insns_between (history + i, insn) - i;
+	if (tmp_nops > nops)
+	  nops = tmp_nops;
+      }
+
+  if (mips_fix_vr4130)
+    {
+      tmp_nops = nops_for_vr4130 (history, insn);
+      if (tmp_nops > nops)
+	nops = tmp_nops;
+    }
+
+  return nops;
+}
+
+/* The variable arguments provide NUM_INSNS extra instructions that
+   might be added to HISTORY.  Return the largest number of nops that
+   would be needed after the extended sequence.  */
+
+static int
+nops_for_sequence (int num_insns, const struct mips_cl_insn *history, ...)
+{
+  va_list args;
+  struct mips_cl_insn buffer[MAX_NOPS];
+  struct mips_cl_insn *cursor;
+  int nops;
+

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

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:12:04 2010
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 64E081065672;
	Thu, 22 Apr 2010 00:12:04 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 4AFA18FC0A;
	Thu, 22 Apr 2010 00:12:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0C4cH010255;
	Thu, 22 Apr 2010 00:12:04 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0C4tX010249;
	Thu, 22 Apr 2010 00:12:04 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220012.o3M0C4tX010249@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:12:04 +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: r207029 - user/jmallett/octeon/sys/contrib/octeon-sdk
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: Thu, 22 Apr 2010 00:12:04 -0000

Author: jmallett
Date: Thu Apr 22 00:12:03 2010
New Revision: 207029
URL: http://svn.freebsd.org/changeset/base/207029

Log:
  Fix build of these files with the current configuration scheme.

Modified:
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.c
  user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.c

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.c	Wed Apr 21 23:47:04 2010	(r207028)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-cmd-queue.c	Thu Apr 22 00:12:03 2010	(r207029)
@@ -49,7 +49,6 @@
  *
  * <hr>$Revision: 42150 $<hr>
  */
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-fpa.h"
 #include "cvmx-cmd-queue.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.c	Wed Apr 21 23:47:04 2010	(r207028)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-fpa.c	Thu Apr 22 00:12:03 2010	(r207029)
@@ -50,7 +50,6 @@
  *
  */
 
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-fpa.h"
 #include "cvmx-ipd.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c	Wed Apr 21 23:47:04 2010	(r207028)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-helper-loop.c	Thu Apr 22 00:12:03 2010	(r207029)
@@ -49,12 +49,11 @@
  *
  * <hr>$Revision: 41586 $<hr>
  */
-#ifdef CVMX_ENABLE_PKO_FUNCTIONS
-
 #include "cvmx.h"
 #include "cvmx-helper.h"
 
 
+#ifdef CVMX_ENABLE_PKO_FUNCTIONS
 /**
  * @INTERNAL
  * Probe a LOOP interface and determine the number of ports

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.c	Wed Apr 21 23:47:04 2010	(r207028)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-pko.c	Thu Apr 22 00:12:03 2010	(r207029)
@@ -48,8 +48,6 @@
  *
  * <hr>$Revision: 42150 $<hr>
  */
-#include "executive-config.h"
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-pko.h"
 #include "cvmx-sysinfo.h"

Modified: user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.c
==============================================================================
--- user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.c	Wed Apr 21 23:47:04 2010	(r207028)
+++ user/jmallett/octeon/sys/contrib/octeon-sdk/cvmx-spi.c	Thu Apr 22 00:12:03 2010	(r207029)
@@ -48,7 +48,6 @@
  *
  * <hr>$Revision: 41586 $<hr>
  */
-#include "cvmx-config.h"
 #include "cvmx.h"
 #include "cvmx-mio.h"
 #include "cvmx-pko.h"

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:12:58 2010
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 AEBB7106564A;
	Thu, 22 Apr 2010 00:12:58 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 85FA58FC18;
	Thu, 22 Apr 2010 00:12:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0CwnA010489;
	Thu, 22 Apr 2010 00:12:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0CwBq010487;
	Thu, 22 Apr 2010 00:12:58 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220012.o3M0CwBq010487@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:12: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: r207030 - user/jmallett/octeon/sys/mips/cavium
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: Thu, 22 Apr 2010 00:12:58 -0000

Author: jmallett
Date: Thu Apr 22 00:12:58 2010
New Revision: 207030
URL: http://svn.freebsd.org/changeset/base/207030

Log:
  o) Include stdarg.
  o) Make our pool configuration look more like the standard ones, and satisfy
     cvmx-fpa*.c with numbered pool definitions.

Modified:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 00:12:03 2010	(r207029)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 00:12:58 2010	(r207030)
@@ -47,18 +47,12 @@
 #include <vm/pmap.h>
 
 #include <machine/pmap.h>
+#include <machine/stdarg.h>
 
 #define	asm		__asm
 
 #define	CVMX_DONT_INCLUDE_CONFIG
 
-#define CVMX_FPA_PACKET_POOL			0
-#define CVMX_FPA_WQE_POOL			1
-#define CVMX_FPA_OUTPUT_BUFFER_POOL		2
-#define CVMX_FPA_WQE_POOL_SIZE			(1 *  CVMX_CACHE_LINE_SIZE)
-#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE	(8 *  CVMX_CACHE_LINE_SIZE)
-#define CVMX_FPA_PACKET_POOL_SIZE		(16 * CVMX_CACHE_LINE_SIZE)
-
 /* Define to enable the use of simple executive packet output functions.
 ** For packet I/O setup enable the helper functions below. 
 */ 
@@ -170,4 +164,23 @@
 #define CVMX_PKO_QUEUES_PER_PORT_PCI 1				/**< PKO queues per port for PCI (ports 32-35) */
 #define CVMX_PKO_QUEUES_PER_PORT_LOOP 1				/**< PKO queues per port for Loop devices (ports 36-39) */
 
+/************************* FPA allocation *********************************/
+/* Pool sizes in bytes, must be multiple of a cache line */
+#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_4_SIZE (0 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_5_SIZE (0 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_6_SIZE (0 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_7_SIZE (0 * CVMX_CACHE_LINE_SIZE)
+
+/* Pools in use */
+#define CVMX_FPA_PACKET_POOL                (0)             /**< Packet buffers */
+#define CVMX_FPA_PACKET_POOL_SIZE           CVMX_FPA_POOL_0_SIZE
+#define CVMX_FPA_WQE_POOL                   (1)             /**< Work queue entrys */
+#define CVMX_FPA_WQE_POOL_SIZE              CVMX_FPA_POOL_1_SIZE
+#define CVMX_FPA_OUTPUT_BUFFER_POOL         (2)             /**< PKO queue command buffers */
+#define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    CVMX_FPA_POOL_2_SIZE
+
 #endif /* !_CVMX_CONFIG_H */

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:14:48 2010
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 4993B106564A;
	Thu, 22 Apr 2010 00:14:48 +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 215C68FC19;
	Thu, 22 Apr 2010 00:14:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0Em9M010938;
	Thu, 22 Apr 2010 00:14:48 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0Em1S010937;
	Thu, 22 Apr 2010 00:14:48 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220014.o3M0Em1S010937@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:14:48 +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: r207031 - user/kmacy/HEAD_ECMP
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: Thu, 22 Apr 2010 00:14:48 -0000

Author: kmacy
Date: Thu Apr 22 00:14:47 2010
New Revision: 207031
URL: http://svn.freebsd.org/changeset/base/207031

Log:
  stale

Deleted:
  user/kmacy/HEAD_ECMP/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:15:05 2010
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 03E54106564A;
	Thu, 22 Apr 2010 00:15:05 +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 CFA9F8FC0C;
	Thu, 22 Apr 2010 00:15:04 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0F4pC011049;
	Thu, 22 Apr 2010 00:15:04 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0F4Jt011048;
	Thu, 22 Apr 2010 00:15:04 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220015.o3M0F4Jt011048@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:15:04 +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: r207032 - user/kmacy/HEAD_fast_multi_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: Thu, 22 Apr 2010 00:15:05 -0000

Author: kmacy
Date: Thu Apr 22 00:15:04 2010
New Revision: 207032
URL: http://svn.freebsd.org/changeset/base/207032

Log:
  stale

Deleted:
  user/kmacy/HEAD_fast_multi_xmit/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:15:29 2010
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 DA6E91065674;
	Thu, 22 Apr 2010 00:15:29 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CA70E8FC25;
	Thu, 22 Apr 2010 00:15:29 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0FTJX011185;
	Thu, 22 Apr 2010 00:15:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0FTCY011180;
	Thu, 22 Apr 2010 00:15:29 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220015.o3M0FTCY011180@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:15:29 +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: r207033 - in user/jmallett/octeon/sys/mips: cavium conf
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: Thu, 22 Apr 2010 00:15:29 -0000

Author: jmallett
Date: Thu Apr 22 00:15:29 2010
New Revision: 207033
URL: http://svn.freebsd.org/changeset/base/207033

Log:
  o) Comment out RGMII driver.
  o) Build a large amount of the Simple Executive code in for a mythical "octe"
     driver.
     XXX Not thrilled about including cvmx-bootmem.c.  Looks like Linux probably
         does this, too, but I'd be much happier providing an implementation of
         the bootmem API in mips/cavium/ somewhere.  But that's a concern for
         once there's actually something functional.

Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/conf/OCTEON1
  user/jmallett/octeon/sys/mips/conf/OCTEON1-32
  user/jmallett/octeon/sys/mips/conf/OCTEON1-o32

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 22 00:15:04 2010	(r207032)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 22 00:15:29 2010	(r207033)
@@ -16,6 +16,25 @@ mips/mips/tick.c				standard
 #mips/cavium/dev/rgmii/octeon_ipd.c 		optional rgmii
 #mips/cavium/dev/rgmii/octeon_pko.c		optional rgmii
 #mips/cavium/dev/rgmii/octeon_rgmx.c		optional rgmii
-mips/mips/tick.c				optional rgmii
+
+contrib/octeon-sdk/cvmx-bootmem.c		optional octe
+contrib/octeon-sdk/cvmx-cmd-queue.c		optional octe
+contrib/octeon-sdk/cvmx-fpa.c			optional octe
+contrib/octeon-sdk/cvmx-helper.c		optional octe
+contrib/octeon-sdk/cvmx-helper-board.c		optional octe
+contrib/octeon-sdk/cvmx-helper-errata.c		optional octe
+contrib/octeon-sdk/cvmx-helper-fpa.c		optional octe
+contrib/octeon-sdk/cvmx-helper-loop.c		optional octe
+contrib/octeon-sdk/cvmx-helper-npi.c		optional octe
+contrib/octeon-sdk/cvmx-helper-rgmii.c		optional octe
+contrib/octeon-sdk/cvmx-helper-sgmii.c		optional octe
+contrib/octeon-sdk/cvmx-helper-spi.c		optional octe
+contrib/octeon-sdk/cvmx-helper-util.c		optional octe
+contrib/octeon-sdk/cvmx-helper-xaui.c		optional octe
+contrib/octeon-sdk/cvmx-pko.c			optional octe
+contrib/octeon-sdk/cvmx-spi.c			optional octe
+contrib/octeon-sdk/cvmx-spi4000.c		optional octe
+contrib/octeon-sdk/cvmx-twsi.c			optional octe
+contrib/octeon-sdk/cvmx-warn.c			optional octe
 
 contrib/octeon-sdk/cvmx-sysinfo.c		standard

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1	Thu Apr 22 00:15:04 2010	(r207032)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1	Thu Apr 22 00:15:29 2010	(r207033)
@@ -28,7 +28,7 @@ machine		mips
 cpu		CPU_MIPS4KC
 ident		OCTEON1
 
-makeoptions	ARCH_FLAGS="-march=mips64r2"
+makeoptions	ARCH_FLAGS="-march=octeon"
 makeoptions	LDSCRIPT_NAME=ldscript.mips.octeon1
 
 # Don't build any modules yet.
@@ -82,7 +82,8 @@ device		ether
 device		md
 device		uart
 nodevice	uart_ns8250
-device		rgmii
+device		octe
+#device		rgmii
 #options 	VERBOSE_SYSINIT
 
 device		bpf

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Thu Apr 22 00:15:04 2010	(r207032)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Thu Apr 22 00:15:29 2010	(r207033)
@@ -23,7 +23,7 @@ ident		OCTEON1
 
 # Don't build any modules yet.
 makeoptions	MODULES_OVERRIDE=""
-makeoptions	ARCH_FLAGS="-march=mips64r2"
+makeoptions	ARCH_FLAGS="-march=octeon"
 makeoptions     LDSCRIPT_NAME=ldscript.mips.octeon1
 
 makeoptions	KERNLOADADDR=0xffffffff81000000
@@ -72,7 +72,8 @@ device		ether
 device		md
 device		uart
 nodevice	uart_ns8250
-device		rgmii
+#device		rgmii
+device		octe
 #options 	VERBOSE_SYSINIT
 
 device		bpf

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-o32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Thu Apr 22 00:15:04 2010	(r207032)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Thu Apr 22 00:15:29 2010	(r207033)
@@ -23,7 +23,7 @@ ident		OCTEON1
 
 # Don't build any modules yet.
 makeoptions	MODULES_OVERRIDE=""
-makeoptions	ARCH_FLAGS="-march=mips64r2"
+makeoptions	ARCH_FLAGS="-march=octeon"
 makeoptions     LDSCRIPT_NAME=ldscript.mips.octeon1
 
 makeoptions	KERNLOADADDR=0xffffffff81000000
@@ -72,7 +72,8 @@ device		ether
 device		md
 device		uart
 nodevice	uart_ns8250
-device		rgmii
+device		octe
+#device		rgmii
 #options 	VERBOSE_SYSINIT
 
 device		bpf

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:15:39 2010
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 E6746106567C;
	Thu, 22 Apr 2010 00:15:39 +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 BE5838FC16;
	Thu, 22 Apr 2010 00:15:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0Fdxl011253;
	Thu, 22 Apr 2010 00:15:39 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0FdZm011252;
	Thu, 22 Apr 2010 00:15:39 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220015.o3M0FdZm011252@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:15:39 +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: r207034 - user/kmacy/HEAD_flowtable
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: Thu, 22 Apr 2010 00:15:40 -0000

Author: kmacy
Date: Thu Apr 22 00:15:39 2010
New Revision: 207034
URL: http://svn.freebsd.org/changeset/base/207034

Log:
  stale

Deleted:
  user/kmacy/HEAD_flowtable/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:16:49 2010
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 A59991065674;
	Thu, 22 Apr 2010 00:16:49 +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 7D7A88FC15;
	Thu, 22 Apr 2010 00:16:49 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0Gndh011565;
	Thu, 22 Apr 2010 00:16:49 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0GnxF011564;
	Thu, 22 Apr 2010 00:16:49 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220016.o3M0GnxF011564@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:16:49 +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: r207035 - user/kmacy/HEAD_fast_net
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: Thu, 22 Apr 2010 00:16:49 -0000

Author: kmacy
Date: Thu Apr 22 00:16:49 2010
New Revision: 207035
URL: http://svn.freebsd.org/changeset/base/207035

Log:
  stale

Deleted:
  user/kmacy/HEAD_fast_net/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:17:39 2010
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 74DA7106564A;
	Thu, 22 Apr 2010 00:17:39 +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 4CC1B8FC0C;
	Thu, 22 Apr 2010 00:17:39 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0Hc2Z011823;
	Thu, 22 Apr 2010 00:17:38 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0HcOZ011822;
	Thu, 22 Apr 2010 00:17:38 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220017.o3M0HcOZ011822@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:17:38 +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: r207036 - 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: Thu, 22 Apr 2010 00:17:39 -0000

Author: kmacy
Date: Thu Apr 22 00:17:38 2010
New Revision: 207036
URL: http://svn.freebsd.org/changeset/base/207036

Log:
  stale

Deleted:
  user/kmacy/HEAD_fast_xmit/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:18:31 2010
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 E39EC1065702;
	Thu, 22 Apr 2010 00:18:31 +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 BB8168FC1B;
	Thu, 22 Apr 2010 00:18:31 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0IVKH012126;
	Thu, 22 Apr 2010 00:18:31 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0IVEW012125;
	Thu, 22 Apr 2010 00:18:31 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220018.o3M0IVEW012125@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:18:31 +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: r207037 - user/kmacy/HEAD_multi_tx
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: Thu, 22 Apr 2010 00:18:32 -0000

Author: kmacy
Date: Thu Apr 22 00:18:31 2010
New Revision: 207037
URL: http://svn.freebsd.org/changeset/base/207037

Log:
  stale

Deleted:
  user/kmacy/HEAD_multi_tx/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:19:01 2010
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 D280E1065672;
	Thu, 22 Apr 2010 00:19: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 AA59C8FC28;
	Thu, 22 Apr 2010 00:19:01 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0J1k8012294;
	Thu, 22 Apr 2010 00:19:01 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0J1JX012293;
	Thu, 22 Apr 2010 00:19:01 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220019.o3M0J1JX012293@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:19:01 +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: r207038 - user/kmacy/releng_8_old
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: Thu, 22 Apr 2010 00:19:01 -0000

Author: kmacy
Date: Thu Apr 22 00:19:01 2010
New Revision: 207038
URL: http://svn.freebsd.org/changeset/base/207038

Log:
  stale

Deleted:
  user/kmacy/releng_8_old/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:21:30 2010
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 DFC1E106566B;
	Thu, 22 Apr 2010 00:21:30 +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 B78738FC14;
	Thu, 22 Apr 2010 00:21:30 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0LUNA012946;
	Thu, 22 Apr 2010 00:21:30 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0LUqR012945;
	Thu, 22 Apr 2010 00:21:30 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004220021.o3M0LUqR012945@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:21:30 +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: r207039 - user/kmacy/head_arpv2
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: Thu, 22 Apr 2010 00:21:31 -0000

Author: kmacy
Date: Thu Apr 22 00:21:30 2010
New Revision: 207039
URL: http://svn.freebsd.org/changeset/base/207039

Log:
  stale

Deleted:
  user/kmacy/head_arpv2/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 00:38:07 2010
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 13250106566B;
	Thu, 22 Apr 2010 00:38:07 +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 DEBDD8FC14;
	Thu, 22 Apr 2010 00:38:06 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M0c6fd016818;
	Thu, 22 Apr 2010 00:38:06 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M0c6vZ016817;
	Thu, 22 Apr 2010 00:38:06 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201004220038.o3M0c6vZ016817@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Thu, 22 Apr 2010 00:38: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: r207043 - user/edwin/ncal
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: Thu, 22 Apr 2010 00:38:07 -0000

Author: edwin
Date: Thu Apr 22 00:38:06 2010
New Revision: 207043
URL: http://svn.freebsd.org/changeset/base/207043

Log:
  Remove obsolete project.

Deleted:
  user/edwin/ncal/Makefile
  user/edwin/ncal/ncal.1
  user/edwin/ncal/ncal.c

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 01:10:53 2010
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 AC753106564A;
	Thu, 22 Apr 2010 01:10:53 +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 819EC8FC16;
	Thu, 22 Apr 2010 01:10:53 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M1ArWo024001;
	Thu, 22 Apr 2010 01:10:53 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M1ArpC024000;
	Thu, 22 Apr 2010 01:10:53 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201004220110.o3M1ArpC024000@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Thu, 22 Apr 2010 01:10:53 +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: r207044 - in user/edwin/tzcode: regression
	tzcode2008e-head-2008e tzcode2008e-head-2008g
	tzcode2008e-releng7-2004a tzcode2008e-releng7-2008g
	tzcode2008e/head tzcode2008e/releng-7
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: Thu, 22 Apr 2010 01:10:53 -0000

Author: edwin
Date: Thu Apr 22 01:10:53 2010
New Revision: 207044
URL: http://svn.freebsd.org/changeset/base/207044

Log:
  Remove an old project.

Deleted:
  user/edwin/tzcode/regression/
  user/edwin/tzcode/tzcode2008e-head-2008e/
  user/edwin/tzcode/tzcode2008e-head-2008g/
  user/edwin/tzcode/tzcode2008e-releng7-2004a/
  user/edwin/tzcode/tzcode2008e-releng7-2008g/
  user/edwin/tzcode/tzcode2008e/head/
  user/edwin/tzcode/tzcode2008e/releng-7/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 01:12:28 2010
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 B5EC2106566C;
	Thu, 22 Apr 2010 01:12:28 +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 8D2918FC08;
	Thu, 22 Apr 2010 01:12:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M1CSr5024382;
	Thu, 22 Apr 2010 01:12:28 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M1CSNt024381;
	Thu, 22 Apr 2010 01:12:28 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201004220112.o3M1CSNt024381@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Thu, 22 Apr 2010 01:12:28 +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: r207045 - in user/edwin/tzcode: tzcode2008e
	tzcode2008e-head-2004a
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: Thu, 22 Apr 2010 01:12:28 -0000

Author: edwin
Date: Thu Apr 22 01:12:28 2010
New Revision: 207045
URL: http://svn.freebsd.org/changeset/base/207045

Log:
  Remove an old project

Deleted:
  user/edwin/tzcode/tzcode2008e/
  user/edwin/tzcode/tzcode2008e-head-2004a/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 02:21:58 2010
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 73D091065672;
	Thu, 22 Apr 2010 02:21:58 +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 4B1238FC17;
	Thu, 22 Apr 2010 02:21:58 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M2Lw2b039729;
	Thu, 22 Apr 2010 02:21:58 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M2LwN4039728;
	Thu, 22 Apr 2010 02:21:58 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201004220221.o3M2LwN4039728@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Thu, 22 Apr 2010 02:21: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: r207048 - user/edwin/ncal
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: Thu, 22 Apr 2010 02:21:58 -0000

Author: edwin
Date: Thu Apr 22 02:21:58 2010
New Revision: 207048
URL: http://svn.freebsd.org/changeset/base/207048

Log:
  Remove an old project.

Deleted:
  user/edwin/ncal/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 02:31:23 2010
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 F3AE21065677;
	Thu, 22 Apr 2010 02:31:22 +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 CAC9C8FC19;
	Thu, 22 Apr 2010 02:31:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M2VMaY041813;
	Thu, 22 Apr 2010 02:31:22 GMT (envelope-from edwin@svn.freebsd.org)
Received: (from edwin@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M2VMme041812;
	Thu, 22 Apr 2010 02:31:22 GMT (envelope-from edwin@svn.freebsd.org)
Message-Id: <201004220231.o3M2VMme041812@svn.freebsd.org>
From: Edwin Groothuis <edwin@FreeBSD.org>
Date: Thu, 22 Apr 2010 02:31:22 +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: r207049 - user/edwin/releasenotes
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: Thu, 22 Apr 2010 02:31:23 -0000

Author: edwin
Date: Thu Apr 22 02:31:22 2010
New Revision: 207049
URL: http://svn.freebsd.org/changeset/base/207049

Log:
  Remove an old project

Deleted:
  user/edwin/releasenotes/

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 02:53:50 2010
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 44EF4106564A;
	Thu, 22 Apr 2010 02:53:50 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3257F8FC12;
	Thu, 22 Apr 2010 02:53:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M2roOe046858;
	Thu, 22 Apr 2010 02:53:50 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M2roBv046847;
	Thu, 22 Apr 2010 02:53:50 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220253.o3M2roBv046847@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 02:53:50 +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: r207050 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 02:53:50 -0000

Author: jmallett
Date: Thu Apr 22 02:53:49 2010
New Revision: 207050
URL: http://svn.freebsd.org/changeset/base/207050

Log:
  Add the BSD-licensed version of the Linux Octeon Ethernet driver.
  
  I'll be porting this to FreeBSD in the coming days.
  
  Submitted by:	imp

Added:
  user/jmallett/octeon/sys/mips/cavium/octe/
  user/jmallett/octeon/sys/mips/cavium/octe/Kconfig
  user/jmallett/octeon/sys/mips/cavium/octe/Makefile
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-sgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-xaui.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h

Added: user/jmallett/octeon/sys/mips/cavium/octe/Kconfig
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/Kconfig	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,12 @@
+config CAVIUM_ETHERNET
+	tristate "Cavium Networks Octeon Ethernet support"
+	depends on CPU_CAVIUM_OCTEON
+	select MII
+	help
+	  This driver supports the builtin ethernet ports on Cavium
+	  Networks products in the Octeon family. This driver supports the
+	  CN3XXX and CN5XXX Octeon processors.
+
+	  To compile this driver as a module, choose M here.  The module
+	  will be called cavium-ethernet.
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/Makefile
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/Makefile	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,56 @@
+# Author: Cavium Networks info@caviumnetworks.com
+#
+# Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+# reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+#       notice, this list of conditions and the following disclaimer.
+#
+#     * 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.
+#
+#     * Neither the name of Cavium Networks nor the names of
+#       its contributors may be used to endorse or promote products
+#       derived from this software without specific prior written
+#       permission.
+#
+# TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+# AND WITH ALL FAULTS AND CAVIUM NETWORKS MAKES NO PROMISES, REPRESENTATIONS
+# OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH
+# RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY
+# REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT
+# DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES
+# OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR
+# PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET
+# POSSESSION OR CORRESPONDENCE TO DESCRIPTION.  THE ENTIRE RISK ARISING OUT
+# OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+# Common flags to be passed for driver compilation
+EXTRA_CFLAGS += -Winline -Wall \
+	-I arch/mips/cavium-octeon/gpl-executive/config \
+	-I $(srctree)/arch/mips/cavium-octeon/gpl-executive/config \
+	-I ${OCTEON_ROOT}/target/include
+
+obj-${CONFIG_CAVIUM_ETHERNET} :=  cavium-ethernet.o
+
+cavium-ethernet-objs := ethernet.o
+cavium-ethernet-objs += ethernet-common.o
+cavium-ethernet-objs += ethernet-mdio.o
+cavium-ethernet-objs += ethernet-mem.o
+cavium-ethernet-objs += ethernet-proc.o
+cavium-ethernet-objs += ethernet-rgmii.o
+cavium-ethernet-objs += ethernet-rx.o
+cavium-ethernet-objs += ethernet-sgmii.o
+cavium-ethernet-objs += ethernet-spi.o
+cavium-ethernet-objs += ethernet-tx.o
+cavium-ethernet-objs += ethernet-xaui.o
+
+clean:
+	rm -rf .*.cmd *.mod.c *.o *.ko .tmp_versions
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,167 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+
+/**
+ * @file
+ * External interface for the Cavium Octeon ethernet driver.
+ *
+ * $Id: cavium-ethernet.h 41589 2009-03-19 19:58:58Z cchavva $
+ *
+ */
+#ifndef CAVIUM_ETHERNET_H
+#define CAVIUM_ETHERNET_H
+
+/**
+ * These enumerations are the return codes for the Ethernet
+ * driver intercept callback. Depending on the return code,
+ * the ethernet driver will continue processing in different
+ * ways.
+ */
+typedef enum {
+	CVM_OCT_PASS,               /**< The ethernet driver will pass the packet
+					to the kernel, just as if the intercept
+					callback didn't exist */
+	CVM_OCT_DROP,               /**< The ethernet driver will drop the packet,
+					cleaning of the work queue entry and the
+					skbuff */
+	CVM_OCT_TAKE_OWNERSHIP_WORK,/**< The intercept callback takes over
+					ownership of the work queue entry. It is
+					the responsibility of the callback to free
+					the work queue entry and all associated
+					packet buffers. The ethernet driver will
+					dispose of the skbuff without affecting the
+					work queue entry */
+	CVM_OCT_TAKE_OWNERSHIP_SKB  /**< The intercept callback takes over
+					ownership of the skbuff. The work queue
+					entry and packet buffer will be disposed of
+					in a way keeping the skbuff valid */
+} cvm_oct_callback_result_t;
+
+
+/**
+ * The is the definition of the Ethernet driver intercept
+ * callback. The callback receives three parameters and
+ * returns a struct cvm_oct_callback_result code.
+ *
+ * The first parameter is the linux device for the ethernet
+ * port the packet came in on.
+ * The second parameter is the raw work queue entry from the
+ * hardware.
+ * Th third parameter is the packet converted into a Linux
+ * skbuff.
+ */
+typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct net_device *dev, void *work_queue_entry, struct sk_buff *skb);
+
+/**
+ * This is the definition of the Ethernet driver's private
+ * driver state stored in netdev_priv(dev).
+ */
+typedef struct {
+	int                     port;           /* PKO hardware output port */
+	int                     queue;          /* PKO hardware queue for the port */
+	int                     fau;            /* Hardware fetch and add to count outstanding tx buffers */
+	int                     imode;          /* Type of port. This is one of the enums in cvmx_helper_interface_mode_t */
+	struct sk_buff_head     tx_free_list[16];/* List of outstanding tx buffers per queue */
+	/* Keeping intercept_cb close the the part of stats that is most often modified helps throughput. */
+	cvm_oct_callback_t      intercept_cb;   /* Optional intecept callback defined above */
+	struct net_device_stats stats;          /* Device statistics */
+	struct mii_if_info      mii_info;       /* Generic MII info structure */
+	uint64_t                link_info;      /* Last negotiated link state */
+	void (*poll)(struct net_device *dev);   /* Called periodically to check link status */
+} cvm_oct_private_t;
+
+
+/**
+ * Registers a intercept callback for the names ethernet
+ * device. It returns the Linux device structure for the
+ * ethernet port. Usign a callback of NULL will remove
+ * the callback. Note that this callback must not disturb
+ * scratch. It will be called with SYNCIOBDMAs in progress
+ * and userspace may be using scratch. It also must not
+ * disturb the group mask.
+ *
+ * @param device_name
+ *                 Device name to register for. (Example: "eth0")
+ * @param callback Intercept callback to set.
+ * @return Device structure for the ethernet port or NULL on failure.
+ */
+struct net_device *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback);
+
+
+/**
+ * Free a work queue entry received in a intercept callback.
+ *
+ * @param work_queue_entry
+ *               Work queue entry to free
+ * @return Zero on success, Negative on failure.
+ */
+int cvm_oct_free_work(void *work_queue_entry);
+
+
+/**
+ * Transmit a work queue entry out of the ethernet port. Both
+ * the work queue entry and the packet data can optionally be
+ * freed. The work will be freed on error as well.
+ *
+ * @param dev     Device to transmit out.
+ * @param work_queue_entry
+ *                Work queue entry to send
+ * @param do_free True if the work queue entry and packet data should be
+ *                freed. If false, neither will be freed.
+ * @param qos     Index into the queues for this port to transmit on. This
+ *                is used to implement QoS if their are multiple queues per
+ *                port. This parameter must be between 0 and the number of
+ *                queues per port minus 1. Values outside of this range will
+ *                be change to zero.
+ *
+ * @return Zero on success, negative on failure.
+ */
+int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, int do_free, int qos);
+
+
+/**
+ * Transmit a work queue entry out of the ethernet port. Both
+ * the work queue entry and the packet data can optionally be
+ * freed. The work will be freed on error as well. This simply
+ * wraps cvmx_oct_transmit_qos() for backwards compatability.
+ *
+ * @param dev     Device to transmit out.
+ * @param work_queue_entry
+ *                Work queue entry to send
+ * @param do_free True if the work queue entry and packet data should be
+ *                freed. If false, neither will be freed.
+ *
+ * @return Zero on success, negative on failure.
+ */
+static inline int cvm_oct_transmit(struct net_device *dev, void *work_queue_entry, int do_free)
+{
+	return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0);
+}
+
+#endif

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,275 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+#include <linux/kernel.h>
+#include <linux/mii.h>
+#include <net/dst.h>
+
+#include "wrapper-cvmx-includes.h"
+#include "ethernet-headers.h"
+
+extern int octeon_is_simulation(void);
+extern cvmx_bootinfo_t *octeon_bootinfo;
+extern int pow_send_group;
+extern int always_use_pow;
+extern char pow_send_list[];
+
+
+/**
+ * Get the low level ethernet statistics
+ *
+ * @param dev    Device to get the statistics from
+ * @return Pointer to the statistics
+ */
+static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
+{
+	cvmx_pip_port_status_t rx_status;
+	cvmx_pko_port_status_t tx_status;
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+
+	if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
+		if (octeon_is_simulation()) {
+			/* The simulator doesn't support statistics */
+			memset(&rx_status, 0, sizeof(rx_status));
+			memset(&tx_status, 0, sizeof(tx_status));
+		} else {
+		cvmx_pip_get_port_status(priv->port, 1, &rx_status);
+		cvmx_pko_get_port_status(priv->port, 1, &tx_status);
+		}
+
+		priv->stats.rx_packets      += rx_status.inb_packets;
+		priv->stats.tx_packets      += tx_status.packets;
+		priv->stats.rx_bytes        += rx_status.inb_octets;
+		priv->stats.tx_bytes        += tx_status.octets;
+		priv->stats.multicast       += rx_status.multicast_packets;
+		priv->stats.rx_crc_errors   += rx_status.inb_errors;
+		priv->stats.rx_frame_errors += rx_status.fcs_align_err_packets;
+
+		/* The drop counter must be incremented atomically since the RX
+		   tasklet also increments it */
+#ifdef CONFIG_64BIT
+		cvmx_atomic_add64_nosync(&priv->stats.rx_dropped, rx_status.dropped_packets);
+#else
+		cvmx_atomic_add32_nosync((int32_t *)&priv->stats.rx_dropped, rx_status.dropped_packets);
+#endif
+	}
+
+	return &priv->stats;
+}
+
+
+/**
+ * Set the multicast list. Currently unimplemented.
+ *
+ * @param dev    Device to work on
+ */
+static void cvm_oct_common_set_multicast_list(struct net_device *dev)
+{
+	cvmx_gmxx_prtx_cfg_t gmx_cfg;
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int interface = INTERFACE(priv->port);
+	int index = INDEX(priv->port);
+
+	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
+		cvmx_gmxx_rxx_adr_ctl_t control;
+		control.u64 = 0;
+		control.s.bcst = 1;     /* Allow broadcast MAC addresses */
+
+		if (dev->mc_list || (dev->flags&IFF_ALLMULTI) ||
+		    (dev->flags & IFF_PROMISC))
+			control.s.mcst = 2; /* Force accept multicast packets */
+		else
+			control.s.mcst = 1; /* Force reject multicat packets */
+
+		if (dev->flags & IFF_PROMISC)
+			control.s.cam_mode = 0; /* Reject matches if promisc. Since CAM is shut off, should accept everything */
+		else
+			control.s.cam_mode = 1; /* Filter packets based on the CAM */
+
+		gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
+		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
+
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface), control.u64);
+		if (dev->flags&IFF_PROMISC)
+			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 0);
+		else
+			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 1);
+
+		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
+	}
+}
+
+
+/**
+ * Set the hardware MAC address for a device
+ *
+ * @param dev    Device to change the MAC address for
+ * @param addr   Address structure to change it too. MAC address is addr + 2.
+ * @return Zero on success
+ */
+static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvmx_gmxx_prtx_cfg_t gmx_cfg;
+	int interface = INTERFACE(priv->port);
+	int index = INDEX(priv->port);
+
+	memcpy(dev->dev_addr, addr + 2, 6);
+
+	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
+		int i;
+		uint8_t *ptr = addr;
+		uint64_t mac = 0;
+		for (i = 0; i < 6; i++)
+			mac = (mac<<8) | (uint64_t)(ptr[i+2]);
+
+		gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
+		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
+
+		cvmx_write_csr(CVMX_GMXX_SMACX(index, interface), mac);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM0(index, interface), ptr[2]);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM1(index, interface), ptr[3]);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM2(index, interface), ptr[4]);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), ptr[5]);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), ptr[6]);
+		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), ptr[7]);
+		cvm_oct_common_set_multicast_list(dev);
+		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
+	}
+	return 0;
+}
+
+
+/**
+ * Change the link MTU. Unimplemented
+ *
+ * @param dev     Device to change
+ * @param new_mtu The new MTU
+ * @return Zero on success
+ */
+static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int interface = INTERFACE(priv->port);
+	int index = INDEX(priv->port);
+#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
+	int vlan_bytes = 4;
+#else
+	int vlan_bytes = 0;
+#endif
+
+	/* Limit the MTU to make sure the ethernet packets are between 64 bytes
+	   and 65535 bytes */
+	if ((new_mtu + 14 + 4 + vlan_bytes < 64) || (new_mtu + 14 + 4 + vlan_bytes > 65392)) {
+		printk("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes);
+		return -EINVAL;
+	}
+	dev->mtu = new_mtu;
+
+	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
+		int max_packet = new_mtu + 14 + 4 + vlan_bytes; /* Add ethernet header and FCS, and VLAN if configured. */
+
+		if (OCTEON_IS_MODEL(OCTEON_CN3XXX) || OCTEON_IS_MODEL(OCTEON_CN58XX)) {
+			/* Signal errors on packets larger than the MTU */
+			cvmx_write_csr(CVMX_GMXX_RXX_FRM_MAX(index, interface), max_packet);
+		} else {
+			/* Set the hardware to truncate packets larger than the MTU and
+				smaller the 64 bytes */
+			cvmx_pip_frm_len_chkx_t frm_len_chk;
+			frm_len_chk.u64 = 0;
+			frm_len_chk.s.minlen = 64;
+			frm_len_chk.s.maxlen = max_packet;
+			cvmx_write_csr(CVMX_PIP_FRM_LEN_CHKX(interface), frm_len_chk.u64);
+		}
+		/* Set the hardware to truncate packets larger than the MTU. The
+		   jabber register must be set to a multiple of 8 bytes, so round up */
+		cvmx_write_csr(CVMX_GMXX_RXX_JABBER(index, interface), (max_packet + 7) & ~7u);
+	}
+	return 0;
+}
+
+
+/**
+ * Per network device initialization
+ *
+ * @param dev    Device to initialize
+ * @return Zero on success
+ */
+int cvm_oct_common_init(struct net_device *dev)
+{
+	static int count;
+	char mac[8] = {0x00, 0x00,
+		octeon_bootinfo->mac_addr_base[0],
+		octeon_bootinfo->mac_addr_base[1],
+		octeon_bootinfo->mac_addr_base[2],
+		octeon_bootinfo->mac_addr_base[3],
+		octeon_bootinfo->mac_addr_base[4],
+		octeon_bootinfo->mac_addr_base[5] + count};
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+
+
+	/* Force the interface to use the POW send if always_use_pow was
+	   specified or it is in the pow send list */
+	if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, dev->name)))
+		priv->queue = -1;
+
+	if (priv->queue != -1) {
+		dev->hard_start_xmit = cvm_oct_xmit;
+		if (USE_HW_TCPUDP_CHECKSUM)
+			dev->features |= NETIF_F_IP_CSUM;
+	} else
+		dev->hard_start_xmit = cvm_oct_xmit_pow;
+	count++;
+
+	dev->get_stats          = cvm_oct_common_get_stats;
+	dev->set_mac_address    = cvm_oct_common_set_mac_address;
+	dev->set_multicast_list = cvm_oct_common_set_multicast_list;
+	dev->change_mtu         = cvm_oct_common_change_mtu;
+	dev->do_ioctl           = cvm_oct_ioctl;
+	dev->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
+	SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops);
+#ifdef CONFIG_NET_POLL_CONTROLLER
+	dev->poll_controller    = cvm_oct_poll_controller;
+#endif
+
+	cvm_oct_mdio_setup_device(dev);
+	dev->set_mac_address(dev, mac);
+	dev->change_mtu(dev, dev->mtu);
+
+	/* Zero out stats for port so we won't mistakenly show counters from the
+	   bootloader */
+	memset(dev->get_stats(dev), 0, sizeof(struct net_device_stats));
+
+	return 0;
+}
+
+void cvm_oct_common_uninit(struct net_device *dev)
+{
+    /* Currently nothing to do */
+}
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,32 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+
+int cvm_oct_common_init(struct net_device *dev);
+void cvm_oct_common_uninit(struct net_device *dev);
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,108 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+
+/*
+ * A few defines are used to control the operation of this driver:
+ *  CONFIG_CAVIUM_RESERVE32
+ *      This kernel config options controls the amount of memory configured
+ *      in a wired TLB entry for all processes to share. If this is set, the
+ *      driver will use this memory instead of kernel memory for pools. This
+ *      allows 32bit userspace application to access the buffers, but also
+ *      requires all received packets to be copied.
+ *  CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS
+ *      This kernel config option allows the user to control the number of
+ *      packet and work queue buffers allocated by the driver. If this is zero,
+ *      the driver uses the default from below.
+ *  USE_SKBUFFS_IN_HW
+ *      Tells the driver to populate the packet buffers with kernel skbuffs.
+ *      This allows the driver to receive packets without copying them. It also
+ *      means that 32bit userspace can't access the packet buffers.
+ *  USE_32BIT_SHARED
+ *      This define tells the driver to allocate memory for buffers from the
+ *      32bit sahred region instead of the kernel memory space.
+ *  USE_HW_TCPUDP_CHECKSUM
+ *      Controls if the Octeon TCP/UDP checksum engine is used for packet
+ *      output. If this is zero, the kernel will perform the checksum in
+ *      software.
+ *  USE_MULTICORE_RECEIVE
+ *      Process receive interrupts on multiple cores. This spreads the network
+ *      load across the first 8 processors. If ths is zero, only one core
+ *      processes incomming packets.
+ *  USE_ASYNC_IOBDMA
+ *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
+ *      IOBDMAs to issue IO accesses without stalling. Set this to zero
+ *      to disable this. Note that IOBDMAs require CVMSEG.
+ *  REUSE_SKBUFFS_WITHOUT_FREE
+ *      Allows the TX path to free an skbuff into the FPA hardware pool. This
+ *      can significantly improve performance for forwarding and bridging, but
+ *      may be somewhat dangerous. Checks are made, but if any buffer is reused
+ *      without the proper Linux cleanup, the networking stack may have very
+ *      bizarre bugs.
+ */
+#ifndef CONFIG_CAVIUM_RESERVE32
+#define CONFIG_CAVIUM_RESERVE32 0
+#endif
+
+#if CONFIG_CAVIUM_RESERVE32
+	#define USE_32BIT_SHARED            1
+	#define USE_SKBUFFS_IN_HW           0
+	#define REUSE_SKBUFFS_WITHOUT_FREE  0
+#else
+	#define USE_32BIT_SHARED            0
+	#define USE_SKBUFFS_IN_HW           1
+	#ifdef CONFIG_NETFILTER
+		#define REUSE_SKBUFFS_WITHOUT_FREE  0
+	#else
+		#define REUSE_SKBUFFS_WITHOUT_FREE  1
+	#endif
+#endif
+
+#define INTERRUPT_LIMIT             10000   /* Max interrupts per second per core */
+/*#define INTERRUPT_LIMIT             0     *//* Don't limit the number of interrupts */
+#define USE_HW_TCPUDP_CHECKSUM      1
+#define USE_MULTICORE_RECEIVE       1
+#define USE_RED                     1	/* Enable Random Early Dropping under load */
+#define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
+#define USE_10MBPS_PREAMBLE_WORKAROUND 1    /* Allow SW based preamble removal at 10Mbps to workaround PHYs giving us bad preambles */
+#define DONT_WRITEBACK(x)           (x) /* Use this to have all FPA frees also tell the L2 not to write data to memory */
+/*#define DONT_WRITEBACK(x)         0   *//* Use this to not have FPA frees control L2 */
+
+#define MAX_RX_PACKETS 120 /* Maximum number of packets to process per interrupt. */
+#define MAX_OUT_QUEUE_DEPTH 1000
+
+#ifndef CONFIG_SMP
+#undef USE_MULTICORE_RECEIVE
+#define USE_MULTICORE_RECEIVE 0
+#endif
+
+#define IP_PROTOCOL_TCP             6
+#define IP_PROTOCOL_UDP             0x11
+#define FAU_NUM_PACKET_BUFFERS_TO_FREE (CVMX_FAU_REG_END - sizeof(uint32_t))
+#define TOTAL_NUMBER_OF_PORTS       (CVMX_PIP_NUM_INPUT_PORTS+1)
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-headers.h	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,42 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+#ifndef __ETHERNET_HEADERS_H__
+#define __ETHERNET_HEADERS_H__
+
+#include "cavium-ethernet.h"
+#include "ethernet-common.h"
+#include "ethernet-defines.h"
+#include "ethernet-mdio.h"
+#include "ethernet-mem.h"
+#include "ethernet-proc.h"
+#include "ethernet-rx.h"
+#include "ethernet-tx.h"
+#include "ethernet-util.h"
+
+#endif

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,234 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+#include <linux/kernel.h>
+#include <linux/ethtool.h>
+#include <linux/mii.h>
+#include <net/dst.h>
+
+#include "cvmx-sysinfo.h"
+#include "wrapper-cvmx-includes.h"
+#include "ethernet-headers.h"
+
+DECLARE_MUTEX(mdio_sem);
+
+
+/**
+ * Perform an MII read. Called by the generic MII routines
+ *
+ * @param dev      Device to perform read for
+ * @param phy_id   The MII phy id
+ * @param location Register location to read
+ * @return Result from the read or zero on failure
+ */
+static int cvm_oct_mdio_read(struct net_device *dev, int phy_id, int location)
+{
+	cvmx_smi_cmd_t          smi_cmd;
+	cvmx_smi_rd_dat_t       smi_rd;
+
+	smi_cmd.u64 = 0;
+	smi_cmd.s.phy_op = 1;
+	smi_cmd.s.phy_adr = phy_id;
+	smi_cmd.s.reg_adr = location;
+	cvmx_write_csr(CVMX_SMI_CMD, smi_cmd.u64);
+
+	do {
+		if (!in_interrupt())
+			yield();
+		smi_rd.u64 = cvmx_read_csr(CVMX_SMI_RD_DAT);
+	} while (smi_rd.s.pending);
+
+	if (smi_rd.s.val)
+		return smi_rd.s.dat;
+	else
+		return 0;
+}
+
+static int cvm_oct_mdio_dummy_read(struct net_device *dev, int phy_id, int location)
+{
+    return 0xffff;
+}
+
+
+/**
+ * Perform an MII write. Called by the generic MII routines
+ *
+ * @param dev      Device to perform write for
+ * @param phy_id   The MII phy id
+ * @param location Register location to write
+ * @param val      Value to write
+ */
+static void cvm_oct_mdio_write(struct net_device *dev, int phy_id, int location, int val)
+{
+	cvmx_smi_cmd_t          smi_cmd;
+	cvmx_smi_wr_dat_t       smi_wr;
+
+	smi_wr.u64 = 0;
+	smi_wr.s.dat = val;
+	cvmx_write_csr(CVMX_SMI_WR_DAT, smi_wr.u64);
+
+	smi_cmd.u64 = 0;
+	smi_cmd.s.phy_op = 0;
+	smi_cmd.s.phy_adr = phy_id;
+	smi_cmd.s.reg_adr = location;
+	cvmx_write_csr(CVMX_SMI_CMD, smi_cmd.u64);
+
+	do {
+		if (!in_interrupt())
+			yield();
+		smi_wr.u64 = cvmx_read_csr(CVMX_SMI_WR_DAT);
+	} while (smi_wr.s.pending);
+}
+
+static void cvm_oct_mdio_dummy_write(struct net_device *dev, int phy_id, int location, int val)
+{
+}
+
+
+static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+{
+	strcpy(info->driver, "cavium-ethernet");
+	strcpy(info->version, OCTEON_SDK_VERSION_STRING);
+	strcpy(info->bus_info, "Builtin");
+}
+
+
+static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int ret; 
+
+	down(&mdio_sem);
+	ret = mii_ethtool_gset(&priv->mii_info, cmd);
+	up(&mdio_sem);
+
+	return ret;
+}
+
+
+static int cvm_oct_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int ret;
+
+	down(&mdio_sem);
+	ret =  mii_ethtool_sset(&priv->mii_info, cmd);
+	up(&mdio_sem);
+
+	return ret;
+}
+
+
+static int cvm_oct_nway_reset(struct net_device *dev)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int ret;
+	
+	down(&mdio_sem);
+	ret = mii_nway_restart(&priv->mii_info);
+	up(&mdio_sem);
+
+	return ret; 
+}
+
+
+static u32 cvm_oct_get_link(struct net_device *dev)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	u32 ret;
+
+	down(&mdio_sem);
+	ret = mii_link_ok(&priv->mii_info);
+	up(&mdio_sem);
+
+	return ret; 
+}
+
+
+struct ethtool_ops cvm_oct_ethtool_ops = {
+	.get_drvinfo    = cvm_oct_get_drvinfo,
+	.get_settings   = cvm_oct_get_settings,
+	.set_settings   = cvm_oct_set_settings,
+	.nway_reset     = cvm_oct_nway_reset,
+	.get_link       = cvm_oct_get_link,
+	.get_sg         = ethtool_op_get_sg,
+	.get_tx_csum    = ethtool_op_get_tx_csum,
+};
+
+
+/**
+ * IOCTL support for PHY control
+ *
+ * @param dev    Device to change
+ * @param rq     the request
+ * @param cmd    the command
+ * @return Zero on success
+ */
+int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+{
+	cvm_oct_private_t      *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	struct mii_ioctl_data  *data = if_mii(rq);
+	unsigned int            duplex_chg;
+	int ret;
+
+	down(&mdio_sem);
+	ret = generic_mii_ioctl(&priv->mii_info, data, cmd, &duplex_chg);
+	up(&mdio_sem);
+
+	return ret; 
+}
+
+
+/**
+ * Setup the MDIO device structures
+ *
+ * @param dev    Device to setup
+ *
+ * @return Zero on success, negative on failure
+ */
+int cvm_oct_mdio_setup_device(struct net_device *dev)
+{
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	int phy_id = cvmx_helper_board_get_mii_address(priv->port);
+	if (phy_id != -1) {
+		priv->mii_info.dev = dev;
+		priv->mii_info.phy_id = phy_id;
+		priv->mii_info.phy_id_mask = 0xff;
+		priv->mii_info.supports_gmii = 1;
+		priv->mii_info.reg_num_mask = 0x1f;
+		priv->mii_info.mdio_read = cvm_oct_mdio_read;
+		priv->mii_info.mdio_write = cvm_oct_mdio_write;
+	} else {
+		/* Supply dummy MDIO routines so the kernel won't crash
+		   if the user tries to read them */
+		priv->mii_info.mdio_read = cvm_oct_mdio_dummy_read;
+		priv->mii_info.mdio_write = cvm_oct_mdio_dummy_write;
+	}
+	return 0;
+}
+

Added: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Thu Apr 22 02:53:49 2010	(r207050)
@@ -0,0 +1,49 @@
+/*************************************************************************
+Copyright (c) 2003-2007  Cavium Networks (support@cavium.com). All rights
+reserved.
+
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+    * Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+    * 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.
+
+    * Neither the name of Cavium Networks nor the names of
+      its contributors may be used to endorse or promote products
+      derived from this software without specific prior written
+      permission.
+
+This Software, including technical data, may be subject to U.S. export  control laws, including the U.S. Export Administration Act and its  associated regulations, and may be subject to export or import  regulations in other countries.
+
+TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
+AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
+
+*************************************************************************/
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/netdevice.h>
+#include <linux/init.h>
+#include <linux/etherdevice.h>
+#include <linux/ip.h>
+#include <linux/string.h>
+#include <linux/ethtool.h>
+#include <linux/mii.h>
+#include <linux/seq_file.h>
+#include <linux/proc_fs.h>
+#include <net/dst.h>
+#ifdef CONFIG_XFRM
+#include <linux/xfrm.h>
+#include <net/xfrm.h>
+#endif  /* CONFIG_XFRM */
+
+extern struct ethtool_ops cvm_oct_ethtool_ops;
+int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);

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

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 02:54:51 2010
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 C35D5106566B;
	Thu, 22 Apr 2010 02:54:51 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id B13E48FC1B;
	Thu, 22 Apr 2010 02:54:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M2sp3J047130;
	Thu, 22 Apr 2010 02:54:51 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M2spwW047118;
	Thu, 22 Apr 2010 02:54:51 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220254.o3M2spwW047118@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 02:54:51 +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: r207051 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 02:54:51 -0000

Author: jmallett
Date: Thu Apr 22 02:54:51 2010
New Revision: 207051
URL: http://svn.freebsd.org/changeset/base/207051

Log:
  Do some trivial substitutions and comment out a few pieces of optional code
  sufficient to get a few files to compile.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-sgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-xaui.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Thu Apr 22 02:54:51 2010	(r207051)
@@ -49,18 +49,18 @@ typedef enum {
 					callback didn't exist */
 	CVM_OCT_DROP,               /**< The ethernet driver will drop the packet,
 					cleaning of the work queue entry and the
-					skbuff */
+					mbuf */
 	CVM_OCT_TAKE_OWNERSHIP_WORK,/**< The intercept callback takes over
 					ownership of the work queue entry. It is
 					the responsibility of the callback to free
 					the work queue entry and all associated
 					packet buffers. The ethernet driver will
-					dispose of the skbuff without affecting the
+					dispose of the mbuf without affecting the
 					work queue entry */
 	CVM_OCT_TAKE_OWNERSHIP_SKB  /**< The intercept callback takes over
-					ownership of the skbuff. The work queue
+					ownership of the mbuf. The work queue
 					entry and packet buffer will be disposed of
-					in a way keeping the skbuff valid */
+					in a way keeping the mbuf valid */
 } cvm_oct_callback_result_t;
 
 
@@ -74,26 +74,35 @@ typedef enum {
  * The second parameter is the raw work queue entry from the
  * hardware.
  * Th third parameter is the packet converted into a Linux
- * skbuff.
+ * mbuf.
  */
-typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct net_device *dev, void *work_queue_entry, struct sk_buff *skb);
+typedef cvm_oct_callback_result_t (*cvm_oct_callback_t)(struct ifnet *ifp, void *work_queue_entry, struct mbuf *m);
 
 /**
  * This is the definition of the Ethernet driver's private
- * driver state stored in netdev_priv(dev).
+ * driver state stored in ifp->if_softc.
  */
 typedef struct {
 	int                     port;           /* PKO hardware output port */
 	int                     queue;          /* PKO hardware queue for the port */
 	int                     fau;            /* Hardware fetch and add to count outstanding tx buffers */
 	int                     imode;          /* Type of port. This is one of the enums in cvmx_helper_interface_mode_t */
-	struct sk_buff_head     tx_free_list[16];/* List of outstanding tx buffers per queue */
+	struct mbuf             *tx_free_list[16];/* List of outstanding tx buffers per queue */
 	/* Keeping intercept_cb close the the part of stats that is most often modified helps throughput. */
 	cvm_oct_callback_t      intercept_cb;   /* Optional intecept callback defined above */
-	struct net_device_stats stats;          /* Device statistics */
+#if 0
+	struct ifnet_stats stats;          /* Device statistics */
 	struct mii_if_info      mii_info;       /* Generic MII info structure */
+#endif
 	uint64_t                link_info;      /* Last negotiated link state */
-	void (*poll)(struct net_device *dev);   /* Called periodically to check link status */
+	void (*poll)(struct ifnet *ifp);   /* Called periodically to check link status */
+
+	/*
+	 * XXX/juli
+	 * I think we'll need to wrap these with the normal ifnet glue.
+	 */
+	int (*open)(struct ifnet *ifp);
+	int (*stop)(struct ifnet *ifp);
 } cvm_oct_private_t;
 
 
@@ -111,7 +120,7 @@ typedef struct {
  * @param callback Intercept callback to set.
  * @return Device structure for the ethernet port or NULL on failure.
  */
-struct net_device *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback);
+struct ifnet *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback);
 
 
 /**
@@ -142,7 +151,7 @@ int cvm_oct_free_work(void *work_queue_e
  *
  * @return Zero on success, negative on failure.
  */
-int cvm_oct_transmit_qos(struct net_device *dev, void *work_queue_entry, int do_free, int qos);
+int cvm_oct_transmit_qos(struct ifnet *ifp, void *work_queue_entry, int do_free, int qos);
 
 
 /**
@@ -159,9 +168,9 @@ int cvm_oct_transmit_qos(struct net_devi
  *
  * @return Zero on success, negative on failure.
  */
-static inline int cvm_oct_transmit(struct net_device *dev, void *work_queue_entry, int do_free)
+static inline int cvm_oct_transmit(struct ifnet *ifp, void *work_queue_entry, int do_free)
 {
-	return cvm_oct_transmit_qos(dev, work_queue_entry, do_free, 0);
+	return cvm_oct_transmit_qos(ifp, work_queue_entry, do_free, 0);
 }
 
 #endif

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -26,9 +26,17 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/mii.h>
-#include <net/dst.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
@@ -46,11 +54,12 @@ extern char pow_send_list[];
  * @param dev    Device to get the statistics from
  * @return Pointer to the statistics
  */
-static struct net_device_stats *cvm_oct_common_get_stats(struct net_device *dev)
+#if 0
+static struct ifnet_stats *cvm_oct_common_get_stats(struct ifnet *ifp)
 {
 	cvmx_pip_port_status_t rx_status;
 	cvmx_pko_port_status_t tx_status;
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
 	if (priv->port < CVMX_PIP_NUM_INPUT_PORTS) {
 		if (octeon_is_simulation()) {
@@ -81,6 +90,7 @@ static struct net_device_stats *cvm_oct_
 
 	return &priv->stats;
 }
+#endif
 
 
 /**
@@ -88,10 +98,11 @@ static struct net_device_stats *cvm_oct_
  *
  * @param dev    Device to work on
  */
-static void cvm_oct_common_set_multicast_list(struct net_device *dev)
+static void cvm_oct_common_set_multicast_list(struct ifnet *ifp)
 {
+#if 0
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 
@@ -100,13 +111,13 @@ static void cvm_oct_common_set_multicast
 		control.u64 = 0;
 		control.s.bcst = 1;     /* Allow broadcast MAC addresses */
 
-		if (dev->mc_list || (dev->flags&IFF_ALLMULTI) ||
-		    (dev->flags & IFF_PROMISC))
+		if (ifp->mc_list || (ifp->flags&IFF_ALLMULTI) ||
+		    (ifp->flags & IFF_PROMISC))
 			control.s.mcst = 2; /* Force accept multicast packets */
 		else
 			control.s.mcst = 1; /* Force reject multicat packets */
 
-		if (dev->flags & IFF_PROMISC)
+		if (ifp->flags & IFF_PROMISC)
 			control.s.cam_mode = 0; /* Reject matches if promisc. Since CAM is shut off, should accept everything */
 		else
 			control.s.cam_mode = 1; /* Filter packets based on the CAM */
@@ -115,13 +126,14 @@ static void cvm_oct_common_set_multicast
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
 
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CTL(index, interface), control.u64);
-		if (dev->flags&IFF_PROMISC)
+		if (ifp->flags&IFF_PROMISC)
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 0);
 		else
 			cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM_EN(index, interface), 1);
 
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 	}
+#endif
 }
 
 
@@ -132,15 +144,13 @@ static void cvm_oct_common_set_multicast
  * @param addr   Address structure to change it too. MAC address is addr + 2.
  * @return Zero on success
  */
-static int cvm_oct_common_set_mac_address(struct net_device *dev, void *addr)
+static int cvm_oct_common_set_mac_address(struct ifnet *ifp, void *addr)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 
-	memcpy(dev->dev_addr, addr + 2, 6);
-
 	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
 		int i;
 		uint8_t *ptr = addr;
@@ -158,7 +168,7 @@ static int cvm_oct_common_set_mac_addres
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM3(index, interface), ptr[5]);
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM4(index, interface), ptr[6]);
 		cvmx_write_csr(CVMX_GMXX_RXX_ADR_CAM5(index, interface), ptr[7]);
-		cvm_oct_common_set_multicast_list(dev);
+		cvm_oct_common_set_multicast_list(ifp);
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64);
 	}
 	return 0;
@@ -172,9 +182,9 @@ static int cvm_oct_common_set_mac_addres
  * @param new_mtu The new MTU
  * @return Zero on success
  */
-static int cvm_oct_common_change_mtu(struct net_device *dev, int new_mtu)
+static int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
@@ -186,10 +196,10 @@ static int cvm_oct_common_change_mtu(str
 	/* Limit the MTU to make sure the ethernet packets are between 64 bytes
 	   and 65535 bytes */
 	if ((new_mtu + 14 + 4 + vlan_bytes < 64) || (new_mtu + 14 + 4 + vlan_bytes > 65392)) {
-		printk("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes);
+		printf("MTU must be between %d and %d.\n", 64-14-4-vlan_bytes, 65392-14-4-vlan_bytes);
 		return -EINVAL;
 	}
-	dev->mtu = new_mtu;
+	ifp->if_mtu = new_mtu;
 
 	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
 		int max_packet = new_mtu + 14 + 4 + vlan_bytes; /* Add ethernet header and FCS, and VLAN if configured. */
@@ -220,7 +230,7 @@ static int cvm_oct_common_change_mtu(str
  * @param dev    Device to initialize
  * @return Zero on success
  */
-int cvm_oct_common_init(struct net_device *dev)
+int cvm_oct_common_init(struct ifnet *ifp)
 {
 	static int count;
 	char mac[8] = {0x00, 0x00,
@@ -230,45 +240,56 @@ int cvm_oct_common_init(struct net_devic
 		octeon_bootinfo->mac_addr_base[3],
 		octeon_bootinfo->mac_addr_base[4],
 		octeon_bootinfo->mac_addr_base[5] + count};
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
 
 	/* Force the interface to use the POW send if always_use_pow was
 	   specified or it is in the pow send list */
-	if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, dev->name)))
+	if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, if_name(ifp))))
 		priv->queue = -1;
 
+	ifp->if_mtu = ETHERMTU;
+
+#if 0
 	if (priv->queue != -1) {
-		dev->hard_start_xmit = cvm_oct_xmit;
+		ifp->hard_start_xmit = cvm_oct_xmit;
 		if (USE_HW_TCPUDP_CHECKSUM)
-			dev->features |= NETIF_F_IP_CSUM;
+			ifp->features |= NETIF_F_IP_CSUM;
 	} else
-		dev->hard_start_xmit = cvm_oct_xmit_pow;
+		ifp->hard_start_xmit = cvm_oct_xmit_pow;
+#endif
 	count++;
 
-	dev->get_stats          = cvm_oct_common_get_stats;
-	dev->set_mac_address    = cvm_oct_common_set_mac_address;
-	dev->set_multicast_list = cvm_oct_common_set_multicast_list;
-	dev->change_mtu         = cvm_oct_common_change_mtu;
-	dev->do_ioctl           = cvm_oct_ioctl;
-	dev->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
-	SET_ETHTOOL_OPS(dev, &cvm_oct_ethtool_ops);
+#if 0
+	ifp->get_stats          = cvm_oct_common_get_stats;
+	ifp->set_mac_address    = cvm_oct_common_set_mac_address;
+	ifp->set_multicast_list = cvm_oct_common_set_multicast_list;
+	ifp->change_mtu         = cvm_oct_common_change_mtu;
+	ifp->do_ioctl           = cvm_oct_ioctl;
+	ifp->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
+	SET_ETHTOOL_OPS(ifp, &cvm_oct_ethtool_ops);
 #ifdef CONFIG_NET_POLL_CONTROLLER
-	dev->poll_controller    = cvm_oct_poll_controller;
+	ifp->poll_controller    = cvm_oct_poll_controller;
+#endif
 #endif
 
-	cvm_oct_mdio_setup_device(dev);
-	dev->set_mac_address(dev, mac);
-	dev->change_mtu(dev, dev->mtu);
+	cvm_oct_mdio_setup_device(ifp);
+
+	cvm_oct_common_set_mac_address(ifp, mac);
+	cvm_oct_common_change_mtu(ifp, ifp->if_mtu);
 
+#if 0
 	/* Zero out stats for port so we won't mistakenly show counters from the
 	   bootloader */
-	memset(dev->get_stats(dev), 0, sizeof(struct net_device_stats));
+	memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats));
+#endif
+
+	ether_ifattach(ifp, mac);
 
 	return 0;
 }
 
-void cvm_oct_common_uninit(struct net_device *dev)
+void cvm_oct_common_uninit(struct ifnet *ifp)
 {
     /* Currently nothing to do */
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Thu Apr 22 02:54:51 2010	(r207051)
@@ -27,6 +27,18 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 
 *************************************************************************/
 
-int cvm_oct_common_init(struct net_device *dev);
-void cvm_oct_common_uninit(struct net_device *dev);
+int cvm_oct_common_init(struct ifnet *ifp);
+void cvm_oct_common_uninit(struct ifnet *ifp);
 
+/*
+ * XXX/juli
+ * These belong elsewhere but we can't stomach the nested extern.
+ */
+int cvm_oct_rgmii_init(struct ifnet *ifp);
+void cvm_oct_rgmii_uninit(struct ifnet *ifp);
+int cvm_oct_sgmii_init(struct ifnet *ifp);
+void cvm_oct_sgmii_uninit(struct ifnet *ifp);
+int cvm_oct_spi_init(struct ifnet *ifp);
+void cvm_oct_spi_uninit(struct ifnet *ifp);
+int cvm_oct_xaui_init(struct ifnet *ifp);
+void cvm_oct_xaui_uninit(struct ifnet *ifp);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 02:54:51 2010	(r207051)
@@ -39,8 +39,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
  *      This kernel config option allows the user to control the number of
  *      packet and work queue buffers allocated by the driver. If this is zero,
  *      the driver uses the default from below.
- *  USE_SKBUFFS_IN_HW
- *      Tells the driver to populate the packet buffers with kernel skbuffs.
+ *  USE_MBUFS_IN_HW
+ *      Tells the driver to populate the packet buffers with kernel mbufs.
  *      This allows the driver to receive packets without copying them. It also
  *      means that 32bit userspace can't access the packet buffers.
  *  USE_32BIT_SHARED
@@ -58,8 +58,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
  *      Use asynchronous IO access to hardware. This uses Octeon's asynchronous
  *      IOBDMAs to issue IO accesses without stalling. Set this to zero
  *      to disable this. Note that IOBDMAs require CVMSEG.
- *  REUSE_SKBUFFS_WITHOUT_FREE
- *      Allows the TX path to free an skbuff into the FPA hardware pool. This
+ *  REUSE_MBUFS_WITHOUT_FREE
+ *      Allows the TX path to free an mbuf into the FPA hardware pool. This
  *      can significantly improve performance for forwarding and bridging, but
  *      may be somewhat dangerous. Checks are made, but if any buffer is reused
  *      without the proper Linux cleanup, the networking stack may have very
@@ -71,15 +71,15 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 
 #if CONFIG_CAVIUM_RESERVE32
 	#define USE_32BIT_SHARED            1
-	#define USE_SKBUFFS_IN_HW           0
-	#define REUSE_SKBUFFS_WITHOUT_FREE  0
+	#define USE_MBUFS_IN_HW           0
+	#define REUSE_MBUFS_WITHOUT_FREE  0
 #else
 	#define USE_32BIT_SHARED            0
-	#define USE_SKBUFFS_IN_HW           1
+	#define USE_MBUFS_IN_HW           1
 	#ifdef CONFIG_NETFILTER
-		#define REUSE_SKBUFFS_WITHOUT_FREE  0
+		#define REUSE_MBUFS_WITHOUT_FREE  0
 	#else
-		#define REUSE_SKBUFFS_WITHOUT_FREE  1
+		#define REUSE_MBUFS_WITHOUT_FREE  1
 	#endif
 #endif
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -26,10 +26,18 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <net/dst.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/mutex.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "cvmx-sysinfo.h"
 #include "wrapper-cvmx-includes.h"
@@ -46,7 +54,7 @@ DECLARE_MUTEX(mdio_sem);
  * @param location Register location to read
  * @return Result from the read or zero on failure
  */
-static int cvm_oct_mdio_read(struct net_device *dev, int phy_id, int location)
+static int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location)
 {
 	cvmx_smi_cmd_t          smi_cmd;
 	cvmx_smi_rd_dat_t       smi_rd;
@@ -69,7 +77,7 @@ static int cvm_oct_mdio_read(struct net_
 		return 0;
 }
 
-static int cvm_oct_mdio_dummy_read(struct net_device *dev, int phy_id, int location)
+static int cvm_oct_mdio_dummy_read(struct ifnet *ifp, int phy_id, int location)
 {
     return 0xffff;
 }
@@ -83,7 +91,7 @@ static int cvm_oct_mdio_dummy_read(struc
  * @param location Register location to write
  * @param val      Value to write
  */
-static void cvm_oct_mdio_write(struct net_device *dev, int phy_id, int location, int val)
+static void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val)
 {
 	cvmx_smi_cmd_t          smi_cmd;
 	cvmx_smi_wr_dat_t       smi_wr;
@@ -105,12 +113,12 @@ static void cvm_oct_mdio_write(struct ne
 	} while (smi_wr.s.pending);
 }
 
-static void cvm_oct_mdio_dummy_write(struct net_device *dev, int phy_id, int location, int val)
+static void cvm_oct_mdio_dummy_write(struct ifnet *ifp, int phy_id, int location, int val)
 {
 }
 
 
-static void cvm_oct_get_drvinfo(struct net_device *dev, struct ethtool_drvinfo *info)
+static void cvm_oct_get_drvinfo(struct ifnet *ifp, struct ethtool_drvinfo *info)
 {
 	strcpy(info->driver, "cavium-ethernet");
 	strcpy(info->version, OCTEON_SDK_VERSION_STRING);
@@ -118,9 +126,9 @@ static void cvm_oct_get_drvinfo(struct n
 }
 
 
-static int cvm_oct_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int cvm_oct_get_settings(struct ifnet *ifp, struct ethtool_cmd *cmd)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret; 
 
 	down(&mdio_sem);
@@ -131,9 +139,9 @@ static int cvm_oct_get_settings(struct n
 }
 
 
-static int cvm_oct_set_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+static int cvm_oct_set_settings(struct ifnet *ifp, struct ethtool_cmd *cmd)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret;
 
 	down(&mdio_sem);
@@ -144,9 +152,9 @@ static int cvm_oct_set_settings(struct n
 }
 
 
-static int cvm_oct_nway_reset(struct net_device *dev)
+static int cvm_oct_nway_reset(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret;
 	
 	down(&mdio_sem);
@@ -157,9 +165,9 @@ static int cvm_oct_nway_reset(struct net
 }
 
 
-static u32 cvm_oct_get_link(struct net_device *dev)
+static u32 cvm_oct_get_link(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	u32 ret;
 
 	down(&mdio_sem);
@@ -189,9 +197,9 @@ struct ethtool_ops cvm_oct_ethtool_ops =
  * @param cmd    the command
  * @return Zero on success
  */
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
+int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd)
 {
-	cvm_oct_private_t      *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t      *priv = (cvm_oct_private_t *)ifp->if_softc;
 	struct mii_ioctl_data  *data = if_mii(rq);
 	unsigned int            duplex_chg;
 	int ret;
@@ -211,9 +219,9 @@ int cvm_oct_ioctl(struct net_device *dev
  *
  * @return Zero on success, negative on failure
  */
-int cvm_oct_mdio_setup_device(struct net_device *dev)
+int cvm_oct_mdio_setup_device(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int phy_id = cvmx_helper_board_get_mii_address(priv->port);
 	if (phy_id != -1) {
 		priv->mii_info.dev = dev;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Thu Apr 22 02:54:51 2010	(r207051)
@@ -26,6 +26,7 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
+#if 0
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
@@ -42,8 +43,9 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <linux/xfrm.h>
 #include <net/xfrm.h>
 #endif  /* CONFIG_XFRM */
+#endif
 
 extern struct ethtool_ops cvm_oct_ethtool_ops;
-int cvm_oct_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
-int cvm_oct_mdio_setup_device(struct net_device *dev);
+int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd);
+int cvm_oct_mdio_setup_device(struct ifnet *ifp);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -35,26 +35,26 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "ethernet-headers.h"
 
 /**
- * Fill the supplied hardware pool with skbuffs
+ * Fill the supplied hardware pool with mbufs
  *
- * @param pool     Pool to allocate an skbuff for
+ * @param pool     Pool to allocate an mbuf for
  * @param size     Size of the buffer needed for the pool
  * @param elements Number of buffers to allocate
  */
-static int cvm_oct_fill_hw_skbuff(int pool, int size, int elements)
+static int cvm_oct_fill_hw_mbuf(int pool, int size, int elements)
 {
 	int freed = elements;
 	while (freed) {
 
-		struct sk_buff *skb = dev_alloc_skb(size + 128);
-		if (unlikely(skb == NULL)) {
-			pr_warning("Failed to allocate skb for hardware pool %d\n", pool);
+		struct mbuf *m = dev_alloc_m(size + 128);
+		if (unlikely(m == NULL)) {
+			pr_warning("Failed to allocate m for hardware pool %d\n", pool);
 			break;
 		}
 
-		skb_reserve(skb, 128 - (((unsigned long)skb->data) & 0x7f));
-		*(struct sk_buff **)(skb->data - sizeof(void *)) = skb;
-		cvmx_fpa_free(skb->data, pool, DONT_WRITEBACK(size/128));
+		m_reserve(m, 128 - (((unsigned long)m->data) & 0x7f));
+		*(struct mbuf **)(m->data - sizeof(void *)) = m;
+		cvmx_fpa_free(m->data, pool, DONT_WRITEBACK(size/128));
 		freed--;
 	}
 	return (elements - freed);
@@ -62,29 +62,29 @@ static int cvm_oct_fill_hw_skbuff(int po
 
 
 /**
- * Free the supplied hardware pool of skbuffs
+ * Free the supplied hardware pool of mbufs
  *
- * @param pool     Pool to allocate an skbuff for
+ * @param pool     Pool to allocate an mbuf for
  * @param size     Size of the buffer needed for the pool
  * @param elements Number of buffers to allocate
  */
-static void cvm_oct_free_hw_skbuff(int pool, int size, int elements)
+static void cvm_oct_free_hw_mbuf(int pool, int size, int elements)
 {
 	char *memory;
 
 	do {
 		memory = cvmx_fpa_alloc(pool);
 		if (memory) {
-			struct sk_buff *skb = *(struct sk_buff **)(memory - sizeof(void *));
+			struct mbuf *m = *(struct mbuf **)(memory - sizeof(void *));
 			elements--;
-			dev_kfree_skb(skb);
+			dev_kfree_m(m);
 		}
 	} while (memory);
 
 	if (elements < 0)
-		printk("Warning: Freeing of pool %u had too many skbuffs (%d)\n", pool, elements);
+		printf("Warning: Freeing of pool %u had too many mbufs (%d)\n", pool, elements);
 	else if (elements > 0)
-		printk("Warning: Freeing of pool %u is missing %d skbuffs\n", pool, elements);
+		printf("Warning: Freeing of pool %u is missing %d mbufs\n", pool, elements);
 }
 
 
@@ -111,7 +111,7 @@ static int cvm_oct_fill_hw_memory(int po
 		if (memory == NULL)
 			panic("Unable to allocate %u bytes for FPA pool %d\n", elements*size, pool);
 
-		printk("Memory range %p - %p reserved for hardware\n", memory, memory + elements*size - 1);
+		printf("Memory range %p - %p reserved for hardware\n", memory, memory + elements*size - 1);
 
 		while (freed) {
 			cvmx_fpa_free(memory, pool, 0);
@@ -145,7 +145,7 @@ static int cvm_oct_fill_hw_memory(int po
 static void cvm_oct_free_hw_memory(int pool, int size, int elements)
 {
 	if (USE_32BIT_SHARED) {
-		printk("Warning: 32 shared memory is not freeable\n");
+		printf("Warning: 32 shared memory is not freeable\n");
 	} else {
 		char *memory;
 		do {
@@ -157,9 +157,9 @@ static void cvm_oct_free_hw_memory(int p
 		} while (memory);
 
 		if (elements < 0)
-			printk("Freeing of pool %u had too many buffers (%d)\n", pool, elements);
+			printf("Freeing of pool %u had too many buffers (%d)\n", pool, elements);
 		else if (elements > 0)
-			printk("Warning: Freeing of pool %u is missing %d buffers\n", pool, elements);
+			printf("Warning: Freeing of pool %u is missing %d buffers\n", pool, elements);
 	}
 }
 
@@ -167,8 +167,8 @@ static void cvm_oct_free_hw_memory(int p
 int cvm_oct_mem_fill_fpa(int pool, int size, int elements)
 {
 	int freed;
-	if (USE_SKBUFFS_IN_HW)
-		freed = cvm_oct_fill_hw_skbuff(pool, size, elements);
+	if (USE_MBUFS_IN_HW)
+		freed = cvm_oct_fill_hw_mbuf(pool, size, elements);
 	else
 		freed = cvm_oct_fill_hw_memory(pool, size, elements);
 	return (freed);
@@ -176,8 +176,8 @@ int cvm_oct_mem_fill_fpa(int pool, int s
 
 void cvm_oct_mem_empty_fpa(int pool, int size, int elements)
 {
-	if (USE_SKBUFFS_IN_HW)
-		cvm_oct_free_hw_skbuff(pool, size, elements);
+	if (USE_MBUFS_IN_HW)
+		cvm_oct_free_hw_mbuf(pool, size, elements);
 	else
 		cvm_oct_free_hw_memory(pool, size, elements);
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-proc.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -35,99 +35,99 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
-extern struct net_device *cvm_oct_device[];
+extern struct ifnet *cvm_oct_device[];
 
 
-static unsigned long long cvm_oct_stats_read_switch(struct net_device *dev, int phy_id, int offset)
+static unsigned long long cvm_oct_stats_read_switch(struct ifnet *ifp, int phy_id, int offset)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
-	priv->mii_info.mdio_write(dev, phy_id, 0x1d, 0xcc00 | offset);
-	return ((uint64_t)priv->mii_info.mdio_read(dev, phy_id, 0x1e)<<16) | (uint64_t)priv->mii_info.mdio_read(dev, phy_id, 0x1f);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+	priv->mii_info.mdio_write(ifp, phy_id, 0x1d, 0xcc00 | offset);
+	return ((uint64_t)priv->mii_info.mdio_read(ifp, phy_id, 0x1e)<<16) | (uint64_t)priv->mii_info.mdio_read(ifp, phy_id, 0x1f);
 }
 
 static int cvm_oct_stats_switch_show(struct seq_file *m, void *v)
 {
 	static const int ports[] = {0, 1, 2, 3, 9, -1};
-	struct net_device *dev = cvm_oct_device[0];
+	struct ifnet *ifp = cvm_oct_device[0];
 	int index = 0;
 
 	while (ports[index] != -1) {
 
 		/* Latch port */
-		cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
-		priv->mii_info.mdio_write(dev, 0x1b, 0x1d, 0xdc00 | ports[index]);
+		cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+		priv->mii_info.mdio_write(ifp, 0x1b, 0x1d, 0xdc00 | ports[index]);
 		seq_printf(m, "\nSwitch Port %d\n", ports[index]);
 		seq_printf(m, "InGoodOctets:   %12llu\t"
 			   "OutOctets:      %12llu\t"
 			   "64 Octets:      %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x00) | (cvm_oct_stats_read_switch(dev, 0x1b, 0x01)<<32),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x0E) | (cvm_oct_stats_read_switch(dev, 0x1b, 0x0F)<<32),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x08));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x00) | (cvm_oct_stats_read_switch(ifp, 0x1b, 0x01)<<32),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x0E) | (cvm_oct_stats_read_switch(ifp, 0x1b, 0x0F)<<32),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x08));
 
 		seq_printf(m, "InBadOctets:    %12llu\t"
 			   "OutUnicast:     %12llu\t"
 			   "65-127 Octets:  %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x02),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x10),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x09));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x02),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x10),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x09));
 
 		seq_printf(m, "InUnicast:      %12llu\t"
 			   "OutBroadcasts:  %12llu\t"
 			   "128-255 Octets: %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x04),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x13),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x0A));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x04),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x13),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x0A));
 
 		seq_printf(m, "InBroadcasts:   %12llu\t"
 			   "OutMulticasts:  %12llu\t"
 			   "256-511 Octets: %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x06),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x12),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x0B));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x06),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x12),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x0B));
 
 		seq_printf(m, "InMulticasts:   %12llu\t"
 			   "OutPause:       %12llu\t"
 			   "512-1023 Octets:%12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x07),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x15),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x0C));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x07),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x15),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x0C));
 
 		seq_printf(m, "InPause:        %12llu\t"
 			   "Excessive:      %12llu\t"
 			   "1024-Max Octets:%12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x16),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x11),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x0D));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x16),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x11),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x0D));
 
 		seq_printf(m, "InUndersize:    %12llu\t"
 			   "Collisions:     %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x18),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1E));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x18),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1E));
 
 		seq_printf(m, "InFragments:    %12llu\t"
 			   "Deferred:       %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x19),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x05));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x19),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x05));
 
 		seq_printf(m, "InOversize:     %12llu\t"
 			   "Single:         %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1A),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x14));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1A),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x14));
 
 		seq_printf(m, "InJabber:       %12llu\t"
 			   "Multiple:       %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1B),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x17));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1B),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x17));
 
 		seq_printf(m, "In RxErr:       %12llu\t"
 			   "OutFCSErr:      %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1C),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x03));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1C),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x03));
 
 		seq_printf(m, "InFCSErr:       %12llu\t"
 			   "Late:           %12llu\n",
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1D),
-			   cvm_oct_stats_read_switch(dev, 0x1b, 0x1F));
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1D),
+			   cvm_oct_stats_read_switch(ifp, 0x1b, 0x1F));
 		index++;
 	}
 	return 0;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -35,15 +35,15 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "ethernet-headers.h"
 
 extern int octeon_is_simulation(void);
-extern struct net_device *cvm_oct_device[];
+extern struct ifnet *cvm_oct_device[];
 
 DEFINE_SPINLOCK(global_register_lock);
 
 static int number_rgmii_ports;
 
-static void cvm_oct_rgmii_poll(struct net_device *dev)
+static void cvm_oct_rgmii_poll(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	unsigned long flags;
 	cvmx_helper_link_info_t link_info;
 
@@ -86,7 +86,7 @@ static void cvm_oct_rgmii_poll(struct ne
 
 				/* Clear any error bits */
 				cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), gmxx_rxx_int_reg.u64);
-				DEBUGPRINT("%s: Using 10Mbps with software preamble removal\n", dev->name);
+				DEBUGPRINT("%s: Using 10Mbps with software preamble removal\n", if_name(ifp));
 			}
 		}
 		spin_unlock_irqrestore(&global_register_lock, flags);
@@ -125,32 +125,32 @@ static void cvm_oct_rgmii_poll(struct ne
 	/* Tell Linux */
 	if (link_info.s.link_up) {
 
-		if (!netif_carrier_ok(dev))
-			netif_carrier_on(dev);
+		if (!netif_carrier_ok(ifp))
+			netif_carrier_on(ifp);
 		if (priv->queue != -1)
 			DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
-				   dev->name, link_info.s.speed,
+				   if_name(ifp), link_info.s.speed,
 				   (link_info.s.full_duplex) ? "Full" : "Half",
 				   priv->port, priv->queue);
 		else
 			DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, POW\n",
-				   dev->name, link_info.s.speed,
+				   if_name(ifp), link_info.s.speed,
 				   (link_info.s.full_duplex) ? "Full" : "Half",
 				   priv->port);
 	} else {
 
-		if (netif_carrier_ok(dev))
-			netif_carrier_off(dev);
-		DEBUGPRINT("%s: Link down\n", dev->name);
+		if (netif_carrier_ok(ifp))
+			netif_carrier_off(ifp);
+		DEBUGPRINT("%s: Link down\n", if_name(ifp));
 	}
 }
 
 
-static irqreturn_t cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
+static int cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
 {
 	cvmx_npi_rsl_int_blocks_t rsl_int_blocks;
 	int index;
-	irqreturn_t return_status = IRQ_NONE;
+	int return_status = IRQ_NONE;
 
 	rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
 
@@ -168,9 +168,9 @@ static irqreturn_t cvm_oct_rgmii_rml_int
 			/* Poll the port if inband status changed */
 			if (gmx_rx_int_reg.s.phy_dupx || gmx_rx_int_reg.s.phy_link || gmx_rx_int_reg.s.phy_spd) {
 
-				struct net_device *dev = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)];
-				if (dev)
-					cvm_oct_rgmii_poll(dev);
+				struct ifnet *ifp = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)];
+				if (ifp)
+					cvm_oct_rgmii_poll(ifp);
 				gmx_rx_int_reg.u64 = 0;
 				gmx_rx_int_reg.s.phy_dupx = 1;
 				gmx_rx_int_reg.s.phy_link = 1;
@@ -195,9 +195,9 @@ static irqreturn_t cvm_oct_rgmii_rml_int
 			/* Poll the port if inband status changed */
 			if (gmx_rx_int_reg.s.phy_dupx || gmx_rx_int_reg.s.phy_link || gmx_rx_int_reg.s.phy_spd) {
 
-				struct net_device *dev = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)];
-				if (dev)
-					cvm_oct_rgmii_poll(dev);
+				struct ifnet *ifp = cvm_oct_device[cvmx_helper_get_ipd_port(interface, index)];
+				if (ifp)
+					cvm_oct_rgmii_poll(ifp);
 				gmx_rx_int_reg.u64 = 0;
 				gmx_rx_int_reg.s.phy_dupx = 1;
 				gmx_rx_int_reg.s.phy_link = 1;
@@ -211,10 +211,10 @@ static irqreturn_t cvm_oct_rgmii_rml_int
 }
 
 
-static int cvm_oct_rgmii_open(struct net_device *dev)
+static int cvm_oct_rgmii_open(struct ifnet *ifp)
 {
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 	cvmx_helper_link_info_t link_info;
@@ -226,16 +226,16 @@ static int cvm_oct_rgmii_open(struct net
         if (!octeon_is_simulation()) {
              link_info = cvmx_helper_link_get(priv->port);
              if (!link_info.s.link_up)
-                netif_carrier_off(dev);
+                netif_carrier_off(ifp);
         }
 
 	return 0;
 }
 
-static int cvm_oct_rgmii_stop(struct net_device *dev)
+static int cvm_oct_rgmii_stop(struct ifnet *ifp)
 {
 	cvmx_gmxx_prtx_cfg_t gmx_cfg;
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 
@@ -245,15 +245,15 @@ static int cvm_oct_rgmii_stop(struct net
 	return 0;
 }
 
-int cvm_oct_rgmii_init(struct net_device *dev)
+int cvm_oct_rgmii_init(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int r;
 
-	cvm_oct_common_init(dev);
-	dev->open = cvm_oct_rgmii_open;
-	dev->stop = cvm_oct_rgmii_stop;
-	dev->stop(dev);
+	cvm_oct_common_init(ifp);
+	ifp->open = cvm_oct_rgmii_open;
+	ifp->stop = cvm_oct_rgmii_stop;
+	ifp->stop(ifp);
 
 	/* Due to GMX errata in CN3XXX series chips, it is necessary to take the
 	   link down immediately whne the PHY changes state. In order to do this
@@ -289,10 +289,10 @@ int cvm_oct_rgmii_init(struct net_device
 	return 0;
 }
 
-void cvm_oct_rgmii_uninit(struct net_device *dev)
+void cvm_oct_rgmii_uninit(struct ifnet *ifp)
 {
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(dev);
-	cvm_oct_common_uninit(dev);
+	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+	cvm_oct_common_uninit(ifp);
 
 	/* Only true RGMII ports need to be polled. In GMII mode, port 0 is really
 	   a RGMII port */

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Thu Apr 22 02:53:49 2010	(r207050)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Thu Apr 22 02:54:51 2010	(r207051)
@@ -49,7 +49,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "ethernet-headers.h"
 
 extern int pow_receive_group;
-extern struct net_device *cvm_oct_device[];
+extern struct ifnet *cvm_oct_device[];
 struct cvm_tasklet_wrapper
 {
 	struct tasklet_struct t;

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

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 06:38:14 2010
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 363FD1065670;
	Thu, 22 Apr 2010 06:38:14 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 22CCB8FC0C;
	Thu, 22 Apr 2010 06:38:14 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M6cEpA096468;
	Thu, 22 Apr 2010 06:38:14 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M6cE71096463;
	Thu, 22 Apr 2010 06:38:14 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220638.o3M6cE71096463@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 06:38:14 +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: r207052 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 06:38:14 -0000

Author: jmallett
Date: Thu Apr 22 06:38:13 2010
New Revision: 207052
URL: http://svn.freebsd.org/changeset/base/207052

Log:
  o) A cursory swing at mbuf usage in ethernet-rx.c.
  o) Lock and link state changes.
  o) Don't do math with void pointers.
  o) Comment out interrupt-handling and tasklet code for the time being.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 02:54:51 2010	(r207051)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 06:38:13 2010	(r207052)
@@ -88,7 +88,11 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #define USE_HW_TCPUDP_CHECKSUM      1
 #define USE_MULTICORE_RECEIVE       1
 #define USE_RED                     1	/* Enable Random Early Dropping under load */
+#if 0
 #define USE_ASYNC_IOBDMA            (CONFIG_CAVIUM_OCTEON_CVMSEG_SIZE > 0)
+#else
+#define USE_ASYNC_IOBDMA            0
+#endif
 #define USE_10MBPS_PREAMBLE_WORKAROUND 1    /* Allow SW based preamble removal at 10Mbps to workaround PHYs giving us bad preambles */
 #define DONT_WRITEBACK(x)           (x) /* Use this to have all FPA frees also tell the L2 not to write data to memory */
 /*#define DONT_WRITEBACK(x)         0   *//* Use this to not have FPA frees control L2 */

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Thu Apr 22 02:54:51 2010	(r207051)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Thu Apr 22 06:38:13 2010	(r207052)
@@ -26,10 +26,19 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/mii.h>
-#include <net/dst.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/lock.h>
+#include <sys/mutex.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
@@ -37,19 +46,20 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 extern int octeon_is_simulation(void);
 extern struct ifnet *cvm_oct_device[];
 
-DEFINE_SPINLOCK(global_register_lock);
+static struct mtx global_register_lock;
+MTX_SYSINIT(global_register_lock, &global_register_lock,
+	    "RGMII Global", MTX_SPIN);
 
 static int number_rgmii_ports;
 
 static void cvm_oct_rgmii_poll(struct ifnet *ifp)
 {
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	unsigned long flags;
 	cvmx_helper_link_info_t link_info;
 
 	/* Take the global register lock since we are going to touch
 	   registers that affect more than one port */
-	spin_lock_irqsave(&global_register_lock, flags);
+	mtx_lock_spin(&global_register_lock);
 
 	link_info = cvmx_helper_link_get(priv->port);
 	if (link_info.u64 == priv->link_info) {
@@ -89,7 +99,7 @@ static void cvm_oct_rgmii_poll(struct if
 				DEBUGPRINT("%s: Using 10Mbps with software preamble removal\n", if_name(ifp));
 			}
 		}
-		spin_unlock_irqrestore(&global_register_lock, flags);
+		mtx_unlock_spin(&global_register_lock);
 		return;
 	}
 
@@ -120,13 +130,12 @@ static void cvm_oct_rgmii_poll(struct if
 
 	link_info = cvmx_helper_link_autoconf(priv->port);
 	priv->link_info = link_info.u64;
-	spin_unlock_irqrestore(&global_register_lock, flags);
+	mtx_unlock_spin(&global_register_lock);
 
 	/* Tell Linux */
 	if (link_info.s.link_up) {
 
-		if (!netif_carrier_ok(ifp))
-			netif_carrier_on(ifp);
+		if_link_state_change(ifp, LINK_STATE_UP);
 		if (priv->queue != -1)
 			DEBUGPRINT("%s: %u Mbps %s duplex, port %2d, queue %2d\n",
 				   if_name(ifp), link_info.s.speed,
@@ -139,13 +148,13 @@ static void cvm_oct_rgmii_poll(struct if
 				   priv->port);
 	} else {
 
-		if (netif_carrier_ok(ifp))
-			netif_carrier_off(ifp);
+		if_link_state_change(ifp, LINK_STATE_DOWN);
 		DEBUGPRINT("%s: Link down\n", if_name(ifp));
 	}
 }
 
 
+#if 0
 static int cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
 {
 	cvmx_npi_rsl_int_blocks_t rsl_int_blocks;
@@ -209,6 +218,7 @@ static int cvm_oct_rgmii_rml_interrupt(i
 	}
 	return return_status;
 }
+#endif
 
 
 static int cvm_oct_rgmii_open(struct ifnet *ifp)
@@ -226,7 +236,9 @@ static int cvm_oct_rgmii_open(struct ifn
         if (!octeon_is_simulation()) {
              link_info = cvmx_helper_link_get(priv->port);
              if (!link_info.s.link_up)
-                netif_carrier_off(ifp);
+		if_link_state_change(ifp, LINK_STATE_DOWN);
+	     else
+		if_link_state_change(ifp, LINK_STATE_UP);
         }
 
 	return 0;
@@ -248,12 +260,14 @@ static int cvm_oct_rgmii_stop(struct ifn
 int cvm_oct_rgmii_init(struct ifnet *ifp)
 {
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+#if 0
 	int r;
+#endif
 
 	cvm_oct_common_init(ifp);
-	ifp->open = cvm_oct_rgmii_open;
-	ifp->stop = cvm_oct_rgmii_stop;
-	ifp->stop(ifp);
+	priv->open = cvm_oct_rgmii_open;
+	priv->stop = cvm_oct_rgmii_stop;
+	priv->stop(ifp);
 
 	/* Due to GMX errata in CN3XXX series chips, it is necessary to take the
 	   link down immediately whne the PHY changes state. In order to do this
@@ -261,7 +275,9 @@ int cvm_oct_rgmii_init(struct ifnet *ifp
 	   This may cause problems if the PHY doesn't implement inband status
 	   properly */
 	if (number_rgmii_ports == 0) {
+#if 0
 		r = request_irq(OCTEON_IRQ_RML, cvm_oct_rgmii_rml_interrupt, IRQF_SHARED, "RGMII", &number_rgmii_ports);
+#endif
 	}
 	number_rgmii_ports++;
 
@@ -316,7 +332,9 @@ void cvm_oct_rgmii_uninit(struct ifnet *
 
 	/* Remove the interrupt handler when the last port is removed */
 	number_rgmii_ports--;
+#if 0
 	if (number_rgmii_ports == 0)
 		free_irq(OCTEON_IRQ_RML, &number_rgmii_ports);
+#endif
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Thu Apr 22 02:54:51 2010	(r207051)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Thu Apr 22 06:38:13 2010	(r207052)
@@ -26,30 +26,24 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/cache.h>
-#include <linux/netdevice.h>
-#include <linux/init.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/prefetch.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif  /* CONFIG_XFRM */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
 extern int pow_receive_group;
 extern struct ifnet *cvm_oct_device[];
+#if 0
 struct cvm_tasklet_wrapper
 {
 	struct tasklet_struct t;
@@ -60,6 +54,7 @@ struct cvm_tasklet_wrapper
  * cache lines containing the locks. */
 
 static struct cvm_tasklet_wrapper cvm_oct_tasklet[NR_CPUS]; // __cacheline_aligned_in_smp;
+#endif
 
 /**
  * Interrupt handler. The interrupt occurs whenever the POW
@@ -72,6 +67,7 @@ static struct cvm_tasklet_wrapper cvm_oc
  */
 int cvm_oct_do_interrupt(int cpl, void *dev_id)
 {
+#if 0
 	/* Acknowledge the interrupt */
 	if (INTERRUPT_LIMIT)
 		cvmx_write_csr(CVMX_POW_WQ_INT, 1<<pow_receive_group);
@@ -81,6 +77,8 @@ int cvm_oct_do_interrupt(int cpl, void *
 	tasklet_schedule(&cvm_oct_tasklet[smp_processor_id()].t);
 	preempt_enable();
 	return IRQ_HANDLED;
+#endif
+	panic("%s: not yet implemented.", __func__);
 }
 
 
@@ -208,18 +206,20 @@ void cvm_oct_tasklet_rx(unsigned long un
 	while (1) {
 		struct mbuf *m = NULL;
 		cvm_oct_callback_result_t callback_result;
-		int m_in_hw;
+		int mbuf_in_hw;
 		cvmx_wqe_t *work;
 
 		if (USE_ASYNC_IOBDMA) {
 			work = cvmx_pow_work_response_async(CVMX_SCR_SCRATCH);
 		} else {
-			if ((INTERRUPT_LIMIT == 0) || likely(rx_count < MAX_RX_PACKETS))
+			if ((INTERRUPT_LIMIT == 0) || (rx_count < MAX_RX_PACKETS))
 				work = cvmx_pow_work_request_sync(CVMX_POW_NO_WAIT);
 			else
 				work = NULL;
 		}
+#if 0
 		prefetch(work);
+#endif
 		if (work == NULL)
 			break;
 
@@ -227,7 +227,7 @@ void cvm_oct_tasklet_rx(unsigned long un
 		   This way the RX can't starve the TX task. */
 		if (USE_ASYNC_IOBDMA) {
 
-			if ((INTERRUPT_LIMIT == 0) || likely(rx_count < MAX_RX_PACKETS))
+			if ((INTERRUPT_LIMIT == 0) || (rx_count < MAX_RX_PACKETS))
 				cvmx_pow_work_request_async_nocheck(CVMX_SCR_SCRATCH, CVMX_POW_NO_WAIT);
 			else {
 				cvmx_scratch_write64(CVMX_SCR_SCRATCH, 0x8000000000000000ull);
@@ -235,11 +235,13 @@ void cvm_oct_tasklet_rx(unsigned long un
 			}
 		}
 
-		m_in_hw = USE_MBUFS_IN_HW && work->word2.s.bufs == 1;
-		if (likely(m_in_hw)) {
+		mbuf_in_hw = USE_MBUFS_IN_HW && work->word2.s.bufs == 1;
+		if ((mbuf_in_hw)) {
 			m = *(struct mbuf **)(cvm_oct_get_buffer_ptr(work->packet_ptr) - sizeof(void *));
+#if 0
 			CVMX_PREFETCH(m, offsetof(struct mbuf, head));
 			CVMX_PREFETCH(m, offsetof(struct mbuf, len));
+#endif
 		}
 		CVMX_PREFETCH(cvm_oct_device[work->ipprt], 0);
 		//CVMX_PREFETCH(m, 0);
@@ -247,28 +249,25 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 		rx_count++;
 		/* Immediately throw away all packets with receive errors */
-		if (unlikely(work->word2.snoip.rcv_error)) {
+		if ((work->word2.snoip.rcv_error)) {
 			if (cvm_oct_check_rcv_error(work))
 				continue;
 		}
 
 		/* We can only use the zero copy path if mbufs are in the FPA pool
 		   and the packet fits in a single buffer */
-		if (likely(m_in_hw)) {
-			/* This calculation was changed in case the m header is using a
-			   different address aliasing type than the buffer. It doesn't make
-			   any differnece now, but the new one is more correct */
-			m->data = m->head + work->packet_ptr.s.addr - cvmx_ptr_to_phys(m->head);
-			CVMX_PREFETCH(m->data, 0);
-			m->len = work->len;
-			m_set_tail_pointer(m, m->len);
+		if ((mbuf_in_hw)) {
+			CVMX_PREFETCH(m->m_data, 0);
+
+			m->m_pkthdr.len = m->m_len = work->len;
+
 			packet_not_copied = 1;
 		} else {
 
 			/* We have to copy the packet. First allocate an
 			   mbuf for it */
-			m = dev_alloc_m(work->len);
-			if (!m) {
+			MGETHDR(m, M_DONTWAIT, MT_DATA);
+			if (m == NULL) {
 				DEBUGPRINT("Port %d failed to allocate mbuf, packet dropped\n", work->ipprt);
 				cvm_oct_free_work(work);
 				continue;
@@ -276,7 +275,7 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 			/* Check if we've received a packet that was entirely
 			   stored in the work entry. This is untested */
-			if (unlikely(work->word2.s.bufs == 0)) {
+			if ((work->word2.s.bufs == 0)) {
 				uint8_t *ptr = work->packet_data;
 
 				if (cvmx_likely(!work->word2.s.not_IP)) {
@@ -287,7 +286,7 @@ void cvm_oct_tasklet_rx(unsigned long un
 					else
 						ptr += 6;
 				}
-				memcpy(m_put(m, work->len), ptr, work->len);
+				panic("%s: not yet implemented; copy in small packet.", __func__);
 				/* No packet buffers to free */
 			} else {
 				int segments = work->word2.s.bufs;
@@ -309,7 +308,10 @@ void cvm_oct_tasklet_rx(unsigned long un
 					if (segment_size > len)
 						segment_size = len;
 					/* Copy the data into the packet */
+					panic("%s: not yet implemented; copy in packet segments.", __func__);
+#if 0
 					memcpy(m_put(m, segment_size), cvmx_phys_to_ptr(segment_ptr.s.addr), segment_size);
+#endif
 					/* Reduce the amount of bytes left
 					   to copy */
 					len -= segment_size;
@@ -319,31 +321,21 @@ void cvm_oct_tasklet_rx(unsigned long un
 			packet_not_copied = 0;
 		}
 
-		if (likely((work->ipprt < TOTAL_NUMBER_OF_PORTS) &&
+		if (((work->ipprt < TOTAL_NUMBER_OF_PORTS) &&
 		    cvm_oct_device[work->ipprt])) {
 			struct ifnet *ifp = cvm_oct_device[work->ipprt];
 			cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
 			/* Only accept packets for devices
 			   that are currently up */
-			if (likely(ifp->flags & IFF_UP)) {
-				m->protocol = eth_type_trans(m, dev);
-				m->dev = dev;
-
-				if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error))
-					m->ip_summed = CHECKSUM_NONE;
-				else
-					m->ip_summed = CHECKSUM_UNNECESSARY;
-
-				/* Increment RX stats for virtual ports */
-				if (work->ipprt >= CVMX_PIP_NUM_INPUT_PORTS) {
-#ifdef CONFIG_64BIT
-					cvmx_atomic_add64_nosync(&priv->stats.rx_packets, 1);
-					cvmx_atomic_add64_nosync(&priv->stats.rx_bytes, m->len);
-#else
-					cvmx_atomic_add32_nosync((int32_t *)&priv->stats.rx_packets, 1);
-					cvmx_atomic_add32_nosync((int32_t *)&priv->stats.rx_bytes, m->len);
-#endif
+			if ((ifp->if_flags & IFF_UP)) {
+				m->m_pkthdr.rcvif = ifp;
+
+				if ((work->word2.s.not_IP || work->word2.s.IP_exc || work->word2.s.L4_error))
+					m->m_pkthdr.csum_flags = 0; /* XXX */
+				else {
+					m->m_pkthdr.csum_flags = CSUM_IP_CHECKED | CSUM_IP_VALID | CSUM_DATA_VALID | CSUM_PSEUDO_HDR;
+					m->m_pkthdr.csum_data = 0xffff;
 				}
 
 				if (priv->intercept_cb) {
@@ -351,32 +343,33 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 					switch (callback_result) {
 					case CVM_OCT_PASS:
-						netif_receive_m(m);
+						ifp->if_ipackets++;
+
+						(*ifp->if_input)(ifp, m);
 						break;
 					case CVM_OCT_DROP:
-						dev_kfree_m_irq(m);
-#ifdef CONFIG_64BIT
-						cvmx_atomic_add64_nosync(&priv->stats.rx_dropped, 1);
-#else
-						cvmx_atomic_add32_nosync((int32_t *)&priv->stats.rx_dropped, 1);
-#endif
+						m_freem(m);
+						ifp->if_ierrors++;
 						break;
 					case CVM_OCT_TAKE_OWNERSHIP_WORK:
 						/* Interceptor stole our work, but
 						   we need to free the mbuf */
-						if (USE_MBUFS_IN_HW && likely(packet_not_copied)) {
+						if (USE_MBUFS_IN_HW && (packet_not_copied)) {
 							/* We can't free the mbuf since its data is
 							the same as the work. In this case we don't
 							do anything */
 						} else
-							dev_kfree_m_irq(m);
+							m_freem(m);
 						break;
 					case CVM_OCT_TAKE_OWNERSHIP_SKB:
 						/* Interceptor stole our packet */
 						break;
 					}
 				} else {
-					netif_receive_m(m);
+					ifp->if_ipackets++;
+
+					(*ifp->if_input)(ifp, m);
+
 					callback_result = CVM_OCT_PASS;
 				}
 			} else {
@@ -385,19 +378,14 @@ void cvm_oct_tasklet_rx(unsigned long un
 				DEBUGPRINT("%s: Device not up, packet dropped\n",
 					   if_name(ifp));
 				*/
-#ifdef CONFIG_64BIT
-				cvmx_atomic_add64_nosync(&priv->stats.rx_dropped, 1);
-#else
-				cvmx_atomic_add32_nosync((int32_t *)&priv->stats.rx_dropped, 1);
-#endif
-				dev_kfree_m_irq(m);
+				m_freem(m);
 				callback_result = CVM_OCT_DROP;
 			}
 		} else {
 			/* Drop any packet received for a device that
 			   doesn't exist */
 			DEBUGPRINT("Port %d not controlled by Linux, packet dropped\n", work->ipprt);
-			dev_kfree_m_irq(m);
+			m_freem(m);
 			callback_result = CVM_OCT_DROP;
 		}
 
@@ -407,7 +395,7 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 			/* Check to see if the mbuf and work share
 			   the same packet buffer */
-			if (USE_MBUFS_IN_HW && likely(packet_not_copied)) {
+			if (USE_MBUFS_IN_HW && (packet_not_copied)) {
 				/* This buffer needs to be replaced, increment
 				the number of buffers we need to free by one */
 				cvmx_fau_atomic_add32(
@@ -451,17 +439,21 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 void cvm_oct_rx_initialize(void)
 {
+#if 0
 	int i;
 	/* Initialize all of the tasklets */
 	for (i = 0; i < NR_CPUS; i++)
 		tasklet_init(&cvm_oct_tasklet[i].t, cvm_oct_tasklet_rx, 0);
+#endif
 }
 
 void cvm_oct_rx_shutdown(void)
 {
+#if 0
 	int i;
 	/* Shutdown all of the tasklets */
 	for (i = 0; i < NR_CPUS; i++)
 		tasklet_kill(&cvm_oct_tasklet[i].t);
+#endif
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Thu Apr 22 02:54:51 2010	(r207051)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Thu Apr 22 06:38:13 2010	(r207052)
@@ -26,10 +26,17 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/mii.h>
-#include <net/dst.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
@@ -37,6 +44,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 static int number_spi_ports;
 static int need_retrain[2] = {0, 0};
 
+#if 0
 static int cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
 {
 	int return_status = IRQ_NONE;
@@ -175,6 +183,7 @@ static int cvm_oct_spi_rml_interrupt(int
 
 	return return_status;
 }
+#endif
 
 static void cvm_oct_spi_enable_error_reporting(int interface)
 {
@@ -243,12 +252,16 @@ static void cvm_oct_spi_poll(struct ifne
 
 int cvm_oct_spi_init(struct ifnet *ifp)
 {
+#if 0
 	int r;
+#endif
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
 	if (number_spi_ports == 0) {
+#if 0
 		r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt, IRQF_SHARED,
 				"SPI", &number_spi_ports);
+#endif
 	}
 	number_spi_ports++;
 
@@ -271,6 +284,8 @@ void cvm_oct_spi_uninit(struct ifnet *if
 			cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
 			cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
 		}
+#if 0
 		free_irq(8 + 46, &number_spi_ports);
+#endif
 	}
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h	Thu Apr 22 02:54:51 2010	(r207051)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-util.h	Thu Apr 22 06:38:13 2010	(r207052)
@@ -36,7 +36,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
  * @param packet_ptr Packet data hardware address
  * @return Packet buffer pointer
  */
-static inline void *cvm_oct_get_buffer_ptr(cvmx_buf_ptr_t packet_ptr)
+static inline char *cvm_oct_get_buffer_ptr(cvmx_buf_ptr_t packet_ptr)
 {
 	return cvmx_phys_to_ptr(((packet_ptr.s.addr >> 7) - packet_ptr.s.back) << 7);
 }

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 06:38:43 2010
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 5EBAE1065670;
	Thu, 22 Apr 2010 06:38:43 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 49EB78FC08;
	Thu, 22 Apr 2010 06:38:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M6chki096608;
	Thu, 22 Apr 2010 06:38:43 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M6ch93096606;
	Thu, 22 Apr 2010 06:38:43 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220638.o3M6ch93096606@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 06:38:43 +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: r207053 - user/jmallett/octeon/sys/mips/cavium
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: Thu, 22 Apr 2010 06:38:43 -0000

Author: jmallett
Date: Thu Apr 22 06:38:43 2010
New Revision: 207053
URL: http://svn.freebsd.org/changeset/base/207053

Log:
  Trivial scratch register and FAU definitions.

Modified:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 06:38:13 2010	(r207052)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 06:38:43 2010	(r207053)
@@ -183,4 +183,9 @@
 #define CVMX_FPA_OUTPUT_BUFFER_POOL         (2)             /**< PKO queue command buffers */
 #define CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE    CVMX_FPA_POOL_2_SIZE
 
+/*************************  FAU allocation ********************************/
+#define	CVMX_FAU_REG_END                    2048
+
+#define	CVMX_SCR_SCRATCH                    0
+
 #endif /* !_CVMX_CONFIG_H */

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 06:56:49 2010
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 03D8A106567D;
	Thu, 22 Apr 2010 06:56:49 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E4DA08FC1A;
	Thu, 22 Apr 2010 06:56:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M6umHB000780;
	Thu, 22 Apr 2010 06:56:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M6umPV000778;
	Thu, 22 Apr 2010 06:56:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220656.o3M6umPV000778@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 06:56:48 +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: r207054 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 06:56:49 -0000

Author: jmallett
Date: Thu Apr 22 06:56:48 2010
New Revision: 207054
URL: http://svn.freebsd.org/changeset/base/207054

Log:
  Comment out most of this file, make the rest compile.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Thu Apr 22 06:38:43 2010	(r207053)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Thu Apr 22 06:56:48 2010	(r207054)
@@ -26,22 +26,17 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/init.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif  /* CONFIG_XFRM */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
@@ -77,8 +72,10 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	int32_t in_use;
 	int32_t buffers_to_free;
 #if REUSE_MBUFS_WITHOUT_FREE
+#if 0
 	unsigned char *fpa_head;
 #endif
+#endif
 
 	/* Prefetch the private data structure.
 	   It is larger that one cache line */
@@ -118,7 +115,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	   68 bytes whenever we are in half duplex mode. We don't handle
 	   the case of having a small packet but no room to add the padding.
 	   The kernel should always give us at least a cache line */
-	if ((m->len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
+	if ((m->m_pkthdr.len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
 		cvmx_gmxx_prtx_cfg_t gmx_prt_cfg;
 		int interface = INTERFACE(priv->port);
 		int index = INDEX(priv->port);
@@ -127,24 +124,33 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 			/* We only need to pad packet in half duplex mode */
 			gmx_prt_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
 			if (gmx_prt_cfg.s.duplex == 0) {
+				panic("%s: small packet padding not yet implemented.", __func__);
+#if 0
 				int add_bytes = 64 - m->len;
 				if ((m_tail_pointer(m) + add_bytes) <= m_end_pointer(m))
 					memset(__m_put(m, add_bytes), 0, add_bytes);
+#endif
 			}
 		}
 	}
 
 	/* Build the PKO buffer pointer */
+	/*
+	 * XXX/juli
+	 * Implement mbuf loading.
+	 */
+#if 0
 	hw_buffer.u64 = 0;
-	hw_buffer.s.addr = cvmx_ptr_to_phys(m->data);
+	hw_buffer.s.addr = cvmx_ptr_to_phys(m->m_data);
 	hw_buffer.s.pool = 0;
 	hw_buffer.s.size = (unsigned long)m_end_pointer(m) - (unsigned long)m->head;
+#endif
 
 	/* Build the PKO command */
 	pko_command.u64 = 0;
 	pko_command.s.n2 = 1; /* Don't pollute L2 with the outgoing packet */
 	pko_command.s.segs = 1;
-	pko_command.s.total_bytes = m->len;
+	pko_command.s.total_bytes = m->m_pkthdr.len;
 	pko_command.s.size0 = CVMX_FAU_OP_SIZE_32;
 	pko_command.s.subone0 = 1;
 
@@ -158,6 +164,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	   the define REUSE_MBUFS_WITHOUT_FREE. The reuse of buffers has
 	   shown a 25% increase in performance under some loads */
 #if REUSE_MBUFS_WITHOUT_FREE
+#if 0
 	fpa_head = m->head + 128 - ((unsigned long)m->head&0x7f);
 	if (unlikely(m->data < fpa_head)) {
 		/*
@@ -241,9 +248,13 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 #endif /* CONFIG_NET_SCHED */
 
 dont_put_mbuf_in_hw:
+#else
+#endif
+	panic("%s: not ready for REUSE_MBUFS_WITHOUT_FREE yet.", __func__);
 #endif /* REUSE_MBUFS_WITHOUT_FREE */
 
 	/* Check if we can use the hardware checksumming */
+#if 0
 	if (USE_HW_TCPUDP_CHECKSUM && (m->protocol == htons(ETH_P_IP)) &&
 	    (ip_hdr(m)->version == 4) && (ip_hdr(m)->ihl == 5) &&
 	    ((ip_hdr(m)->frag_off == 0) || (ip_hdr(m)->frag_off == 1<<14)) &&
@@ -251,6 +262,7 @@ dont_put_mbuf_in_hw:
 		/* Use hardware checksum calc */
 		pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1;
 	}
+#endif
 
 	if (USE_ASYNC_IOBDMA) {
 		/* Get the number of mbufs in use by the hardware */
@@ -273,7 +285,8 @@ dont_put_mbuf_in_hw:
 	cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, CVMX_PKO_LOCK_CMD_QUEUE);
 
 	/* Drop this packet if we have too many already queued to the HW */
-	if (unlikely(m_queue_len(&priv->tx_free_list[qos]) >= MAX_OUT_QUEUE_DEPTH)) {
+#if 0
+	if ((m_queue_len(&priv->tx_free_list[qos]) >= MAX_OUT_QUEUE_DEPTH)) {
 		/*
 		DEBUGPRINT("%s: Tx dropped. Too many queued\n", if_name(ifp));
 		*/
@@ -281,7 +294,10 @@ dont_put_mbuf_in_hw:
 	}
 	/* Send the packet to the output queue */
 	else
-	if (unlikely(cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
+#else
+	panic("%s: free queues really not implemented.", __func__);
+#endif
+	if ((cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
 		DEBUGPRINT("%s: Failed to send the packet\n", if_name(ifp));
 		dropped = 1;
 	}
@@ -292,26 +308,28 @@ dont_put_mbuf_in_hw:
 		cvmx_scratch_write64(CVMX_SCR_SCRATCH+8, old_scratch2);
 	}
 
-	if (unlikely(dropped)) {
-		dev_kfree_m_any(m);
+	if ((dropped)) {
+		m_freem(m);
 		cvmx_fau_atomic_add32(priv->fau+qos*4, -1);
-		priv->stats.tx_dropped++;
+		ifp->if_oerrors++;
 	} else {
 		if (USE_MBUFS_IN_HW) {
 			/* Put this packet on the queue to be freed later */
 			if (pko_command.s.dontfree)
-				m_queue_tail(&priv->tx_free_list[qos], m);
+				panic("%s: need to queue mbuf to free it later.", __func__);
 			else {
 				cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
 				cvmx_fau_atomic_add32(priv->fau+qos*4, -1);
 			}
 		} else {
 			/* Put this packet on the queue to be freed later */
-			m_queue_tail(&priv->tx_free_list[qos], m);
+			panic("%s: need to queue mbuf to free it later. (2)", __func__);
 		}
 	}
 
 	/* Free mbufs not in use by the hardware, possibly two at a time */
+	panic("%s: need to free queued mbufs.", __func__);
+#if 0
 	if (m_queue_len(&priv->tx_free_list[qos]) > in_use) {
 		spin_lock(&priv->tx_free_list[qos].lock);
 		/* Check again now that we have the lock. It might have changed */
@@ -321,6 +339,7 @@ dont_put_mbuf_in_hw:
 			dev_kfree_m(__m_dequeue(&priv->tx_free_list[qos]));
 		spin_unlock(&priv->tx_free_list[qos].lock);
 	}
+#endif
 
 	return 0;
 }
@@ -336,26 +355,26 @@ dont_put_mbuf_in_hw:
 int cvm_oct_xmit_pow(struct mbuf *m, struct ifnet *ifp)
 {
 	cvm_oct_private_t  *priv = (cvm_oct_private_t *)ifp->if_softc;
-	void               *packet_buffer;
-	void               *copy_location;
+	char               *packet_buffer;
+	char               *copy_location;
 
 	/* Get a work queue entry */
 	cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
-	if (unlikely(work == NULL)) {
+	if ((work == NULL)) {
 		DEBUGPRINT("%s: Failed to allocate a work queue entry\n", if_name(ifp));
-		priv->stats.tx_dropped++;
-		dev_kfree_m(m);
+		ifp->if_oerrors++;
+		m_freem(m);
 		return 0;
 	}
 
 	/* Get a packet buffer */
 	packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
-	if (unlikely(packet_buffer == NULL)) {
+	if ((packet_buffer == NULL)) {
 		DEBUGPRINT("%s: Failed to allocate a packet buffer\n",
 			   if_name(ifp));
 		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
-		priv->stats.tx_dropped++;
-		dev_kfree_m(m);
+		ifp->if_oerrors++;
+		m_freem(m);
 		return 0;
 	}
 
@@ -370,12 +389,18 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 	/* We have to copy the packet since whoever processes this packet
 	   will free it to a hardware pool. We can't use the trick of
 	   counting outstanding packets like in cvm_oct_xmit */
+#if 0
 	memcpy(copy_location, m->data, m->len);
+#else
+	panic("%s: need to implement mbuf loading.", __func__);
+#endif
 
 	/* Fill in some of the work queue fields. We may need to add more
 	   if the software at the other end needs them */
+#if 0
 	work->hw_chksum     = m->csum;
-	work->len           = m->len;
+#endif
+	work->len           = m->m_pkthdr.len;
 	work->ipprt         = priv->port;
 	work->qos           = priv->port & 0x7;
 	work->grp           = pow_send_group;
@@ -389,6 +414,7 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 	work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
 	work->packet_ptr.s.back = (copy_location - packet_buffer)>>7;
 
+#if 0
 	if (m->protocol == htons(ETH_P_IP)) {
 		work->word2.s.ip_offset     = 14;
 		#if 0
@@ -437,12 +463,13 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 		#endif
 		memcpy(work->packet_data, m->data, sizeof(work->packet_data));
 	}
+#endif
 
 	/* Submit the packet to the POW */
 	cvmx_pow_work_submit(work, work->tag, work->tag_type, work->qos, work->grp);
-	priv->stats.tx_packets++;
-	priv->stats.tx_bytes += m->len;
-	dev_kfree_m(m);
+	ifp->if_opackets++;
+	ifp->if_obytes += m->m_pkthdr.len;
+	m_freem(m);
 	return 0;
 }
 
@@ -467,14 +494,13 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
  */
 int cvm_oct_transmit_qos(struct ifnet *ifp, void *work_queue_entry, int do_free, int qos)
 {
-	unsigned long              flags;
 	cvmx_buf_ptr_t             hw_buffer;
 	cvmx_pko_command_word0_t   pko_command;
 	int                        dropped;
 	cvm_oct_private_t         *priv = (cvm_oct_private_t *)ifp->if_softc;
 	cvmx_wqe_t                *work = work_queue_entry;
 
-	if (!(ifp->flags & IFF_UP)) {
+	if (!(ifp->if_flags & IFF_UP)) {
 		DEBUGPRINT("%s: Device not up\n", if_name(ifp));
 		if (do_free)
 			cvm_oct_free_work(work);
@@ -496,7 +522,7 @@ int cvm_oct_transmit_qos(struct ifnet *i
 	/* Start off assuming no drop */
 	dropped = 0;
 
-	local_irq_save(flags);
+	critical_enter();
 	cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, CVMX_PKO_LOCK_CMD_QUEUE);
 
 	/* Build the PKO buffer pointer */
@@ -514,29 +540,28 @@ int cvm_oct_transmit_qos(struct ifnet *i
 	pko_command.s.total_bytes = work->len;
 
 	/* Check if we can use the hardware checksumming */
-	if (unlikely(work->word2.s.not_IP || work->word2.s.IP_exc))
+	if ((work->word2.s.not_IP || work->word2.s.IP_exc))
 		pko_command.s.ipoffp1 = 0;
 	else
-		pko_command.s.ipoffp1 = sizeof(struct ethhdr) + 1;
+		pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1;
 
 	/* Send the packet to the output queue */
-	if (unlikely(cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
+	if ((cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
 		DEBUGPRINT("%s: Failed to send the packet\n", if_name(ifp));
 		dropped = -1;
 	}
-	local_irq_restore(flags);
+	critical_exit();
 
-	if (unlikely(dropped)) {
+	if ((dropped)) {
 		if (do_free)
 			cvm_oct_free_work(work);
-		priv->stats.tx_dropped++;
+		ifp->if_oerrors++;
 	} else
 	if (do_free)
 		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
 
 	return dropped;
 }
-EXPORT_SYMBOL(cvm_oct_transmit_qos);
 
 
 /**
@@ -546,6 +571,7 @@ EXPORT_SYMBOL(cvm_oct_transmit_qos);
  */
 void cvm_oct_tx_shutdown(struct ifnet *ifp)
 {
+#if 0
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	unsigned long flags;
 	int qos;
@@ -556,4 +582,7 @@ void cvm_oct_tx_shutdown(struct ifnet *i
 			dev_kfree_m_any(__m_dequeue(&priv->tx_free_list[qos]));
 		spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
 	}
+#else
+	panic("%s: not yet implemented.", __func__);
+#endif
 }

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 06:59:00 2010
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 41BCB106566B;
	Thu, 22 Apr 2010 06:59:00 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2FE918FC15;
	Thu, 22 Apr 2010 06:59:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3M6x0AX001331;
	Thu, 22 Apr 2010 06:59:00 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3M6x0LU001328;
	Thu, 22 Apr 2010 06:59:00 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004220659.o3M6x0LU001328@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 06:59: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: r207055 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 06:59:00 -0000

Author: jmallett
Date: Thu Apr 22 06:58:59 2010
New Revision: 207055
URL: http://svn.freebsd.org/changeset/base/207055

Log:
  Use FreeBSD spelling of SMP option.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 06:56:48 2010	(r207054)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Thu Apr 22 06:58:59 2010	(r207055)
@@ -100,7 +100,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #define MAX_RX_PACKETS 120 /* Maximum number of packets to process per interrupt. */
 #define MAX_OUT_QUEUE_DEPTH 1000
 
-#ifndef CONFIG_SMP
+#ifndef SMP
 #undef USE_MULTICORE_RECEIVE
 #define USE_MULTICORE_RECEIVE 0
 #endif

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 06:56:48 2010	(r207054)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 06:58:59 2010	(r207055)
@@ -182,7 +182,7 @@ static __init void cvm_oct_configure_com
 	/* Register an IRQ hander for to receive POW interrupts */
 	r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", cvm_oct_device);
 
-#ifdef CONFIG_SMP
+#ifdef SMP
 	if (USE_MULTICORE_RECEIVE) {
 		preempt_disable();
 		{

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 20:54:33 2010
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 4DF8C106566B;
	Thu, 22 Apr 2010 20:54:33 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3B0B08FC15;
	Thu, 22 Apr 2010 20:54:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MKsXth089136;
	Thu, 22 Apr 2010 20:54:33 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MKsWAu089135;
	Thu, 22 Apr 2010 20:54:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004222054.o3MKsWAu089135@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 20:54:32 +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: r207073 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 20:54:33 -0000

Author: jmallett
Date: Thu Apr 22 20:54:32 2010
New Revision: 207073
URL: http://svn.freebsd.org/changeset/base/207073

Log:
  Comment out, port, etc., to make the main module compile.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Thu Apr 22 20:46:39 2010	(r207072)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Thu Apr 22 20:54:32 2010	(r207073)
@@ -103,6 +103,9 @@ typedef struct {
 	 */
 	int (*open)(struct ifnet *ifp);
 	int (*stop)(struct ifnet *ifp);
+
+	int (*init)(struct ifnet *ifp);
+	void (*uninit)(struct ifnet *ifp);
 } cvm_oct_private_t;
 
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 20:46:39 2010	(r207072)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 20:54:32 2010	(r207073)
@@ -25,42 +25,62 @@ This Software, including technical data,
 TO THE MAXIMUM EXTENT PERMITTED BY LAW, THE SOFTWARE IS PROVIDED "AS IS"
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/mii.h>
-#include <net/dst.h>
-#include <asm/delay.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/conf.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+#include <sys/module.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
+#include <net/if_types.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
+/*
+ * XXX/juli
+ * Convert 0444 to tunables, 0644 to sysctls.
+ */
 #if defined(CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS) && CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS
 int num_packet_buffers = CONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS;
 #else
 int num_packet_buffers = 1024;
 #endif
+#if 0
 module_param(num_packet_buffers, int, 0444);
 MODULE_PARM_DESC(num_packet_buffers, "\n"
 		 "\t\tNumber of packet buffers to allocate and store in the\n"
 		 "\t\tFPA. By default, 1024 packet buffers are used unless\n"
 		 "\t\tCONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS is defined.");
+#endif
 
 int pow_receive_group = 15;
+#if 0
 module_param(pow_receive_group, int, 0444);
 MODULE_PARM_DESC(pow_receive_group, "\n"
 		 "\t\tPOW group to receive packets from. All ethernet hardware\n"
 		 "\t\twill be configured to send incomming packets to this POW\n"
 		 "\t\tgroup. Also any other software can submit packets to this\n"
 		 "\t\tgroup for the kernel to process.");
+#endif
 
 int pow_send_group = -1;
+#if 0
 module_param(pow_send_group, int, 0644);
 MODULE_PARM_DESC(pow_send_group, "\n"
 		 "\t\tPOW group to send packets to other software on. This\n"
 		 "\t\tcontrols the creation of the virtual device pow0.\n"
 		 "\t\talways_use_pow also depends on this value.");
+#endif
 
 int always_use_pow;
+#if 0
 module_param(always_use_pow, int, 0444);
 MODULE_PARM_DESC(always_use_pow, "\n"
 		 "\t\tWhen set, always send to the pow group. This will cause\n"
@@ -71,8 +91,10 @@ MODULE_PARM_DESC(always_use_pow, "\n"
 		 "\t\tto allow a CVMX app to intercept all packets from the\n"
 		 "\t\tlinux kernel. You must specify pow_send_group along with\n"
 		 "\t\tthis option.");
+#endif
 
 char pow_send_list[128] = "";
+#if 0
 module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
 MODULE_PARM_DESC(pow_send_list, "\n"
 		 "\t\tComma separated list of ethernet devices that should use the\n"
@@ -81,14 +103,17 @@ MODULE_PARM_DESC(pow_send_list, "\n"
 		 "\t\tprecedence over this list. For example, setting this to\n"
 		 "\t\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
 		 "\t\tusing the pow_send_group.");
+#endif
 
 
+#if 0
 static int disable_core_queueing = 1;
 module_param(disable_core_queueing, int, 0444);
 MODULE_PARM_DESC(disable_core_queueing, "\n"
 		"\t\tWhen set the networking core's tx_queue_len is set to zero.  This\n"
 		"\t\tallows packets to be sent without lock contention in the packet scheduler\n"
 		"\t\tresulting in some cases in improved throughput.\n");
+#endif
 
 extern int octeon_is_simulation(void);
 
@@ -98,10 +123,16 @@ extern int octeon_is_simulation(void);
  */
 extern cvmx_bootinfo_t *octeon_bootinfo;
 
+/*
+ * XXX
+ * This should be a per-if callout?
+ */
+#if 0
 /**
  * Periodic timer to check auto negotiation
  */
 static struct timer_list cvm_oct_poll_timer;
+#endif
 
 /**
  * Array of every ethernet device owned by this driver indexed by
@@ -109,7 +140,9 @@ static struct timer_list cvm_oct_poll_ti
  */
 struct ifnet *cvm_oct_device[TOTAL_NUMBER_OF_PORTS];
 
+#if 0
 extern struct semaphore mdio_sem;
+#endif
 
 
 /**
@@ -117,25 +150,33 @@ extern struct semaphore mdio_sem;
  *
  * @param arg    Device to check
  */
+#if 0
 static void cvm_do_timer(unsigned long arg)
 {
 	static int port;
 	if (port < CVMX_PIP_NUM_INPUT_PORTS) {
 		if (cvm_oct_device[port]) {
 			int queues_per_port;
+#if 0
 			int qos;
-			cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(cvm_oct_device[port]);
+#endif
+			cvm_oct_private_t *priv = (cvm_oct_private_t *)cvm_oct_device[port]->if_softc;
 			if (priv->poll) 
 			{
+#if 0
 				/* skip polling if we don't get the lock */
 				if(!down_trylock(&mdio_sem)) {
 					priv->poll(cvm_oct_device[port]);
 					up(&mdio_sem);
 				}
+#else
+				panic("%s: wrap priv->poll with an mdio lock.", __func__);
+#endif
 			}
 
 			queues_per_port = cvmx_pko_get_num_queues(port);
 			/* Drain any pending packets in the free list */
+#if 0
 			for (qos = 0; qos < queues_per_port; qos++) {
 				if (m_queue_len(&priv->tx_free_list[qos])) {
 					spin_lock(&priv->tx_free_list[qos].lock);
@@ -144,27 +185,41 @@ static void cvm_do_timer(unsigned long a
 					spin_unlock(&priv->tx_free_list[qos].lock);
 				}
 			}
+#else
+			panic("%s: need to implement Tx queue draining.", __func__);
+#endif
+#if 0
 			cvm_oct_device[port]->get_stats(cvm_oct_device[port]);
+#else
+			panic("%s: need to implement stats getting.", __func__);
+#endif
 		}
 		port++;
+#if 0
 		/* Poll the next port in a 50th of a second.
 		   This spreads the polling of ports out a little bit */
 		mod_timer(&cvm_oct_poll_timer, jiffies + HZ/50);
+#endif
 	} else {
 		port = 0;
+#if 0
 		/* All ports have been polled. Start the next iteration through
 		   the ports in one second */
 		mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
+#endif
 	}
 }
+#endif
 
 
 /**
  * Configure common hardware for all interfaces
  */
-static __init void cvm_oct_configure_common_hw(void)
+static void cvm_oct_configure_common_hw(void)
 {
+#if 0
 	int r;
+#endif
 	/* Setup the FPA */
 	cvmx_fpa_enable();
 	cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers);
@@ -179,11 +234,14 @@ static __init void cvm_oct_configure_com
 	if (!octeon_is_simulation())
 		cvmx_write_csr(CVMX_SMI_EN, 1);
 
+#if 0
 	/* Register an IRQ hander for to receive POW interrupts */
 	r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", cvm_oct_device);
+#endif
 
 #ifdef SMP
 	if (USE_MULTICORE_RECEIVE) {
+#if 0
 		preempt_disable();
 		{
 			int cpu;
@@ -198,6 +256,9 @@ static __init void cvm_oct_configure_com
 			}
 		}
 		preempt_enable();
+#else
+		panic("%s: need to implement CPU enumeration.", __func__);
+#endif
 	}
 #endif
 }
@@ -217,6 +278,7 @@ static __init void cvm_oct_configure_com
  * @param callback Intercept callback to set.
  * @return Device structure for the ethernet port or NULL on failure.
  */
+#if 0
 struct ifnet *cvm_oct_register_callback(const char *device_name, cvm_oct_callback_t callback)
 {
 	int port;
@@ -224,7 +286,7 @@ struct ifnet *cvm_oct_register_callback(
 	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
 		if (cvm_oct_device[port] &&
 		    (strcmp(device_name, cvm_oct_device[port]->name) == 0)) {
-			cvm_oct_private_t *priv = (cvm_oct_private_t *)netdev_priv(cvm_oct_device[port]);
+			cvm_oct_private_t *priv = (cvm_oct_private_t *)cvm_oct_device[port]->if_softc;
 			priv->intercept_cb = callback;
 			wmb();
 			return cvm_oct_device[port];
@@ -233,7 +295,7 @@ struct ifnet *cvm_oct_register_callback(
 
 	return NULL;
 }
-EXPORT_SYMBOL(cvm_oct_register_callback);
+#endif
 
 
 /**
@@ -252,7 +314,7 @@ int cvm_oct_free_work(void *work_queue_e
 
 	while (segments--) {
 		cvmx_buf_ptr_t next_ptr = *(cvmx_buf_ptr_t *)cvmx_phys_to_ptr(segment_ptr.s.addr-8);
-		if (unlikely(!segment_ptr.s.i))
+		if (__predict_false(!segment_ptr.s.i))
 			cvmx_fpa_free(cvm_oct_get_buffer_ptr(segment_ptr), segment_ptr.s.pool, DONT_WRITEBACK(CVMX_FPA_PACKET_POOL_SIZE/128));
 		segment_ptr = next_ptr;
 	}
@@ -260,7 +322,6 @@ int cvm_oct_free_work(void *work_queue_e
 
 	return 0;
 }
-EXPORT_SYMBOL(cvm_oct_free_work);
 
 
 /**
@@ -269,13 +330,16 @@ EXPORT_SYMBOL(cvm_oct_free_work);
  *
  * @return Zero on success
  */
-static int __init cvm_oct_init_module(void)
+static int cvm_oct_init_module(void)
 {
+	device_t dev;
 	int num_interfaces;
 	int interface;
 	int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
 	int qos;
 
+	dev = NULL;
+
 	printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING);
 
 	cvm_oct_proc_initialize();
@@ -307,26 +371,31 @@ static int __init cvm_oct_init_module(vo
 
 	if ((pow_send_group != -1)) {
 		struct ifnet *ifp;
+
 		printf("\tConfiguring device for POW only access\n");
-		dev = alloc_etherdev(sizeof(cvm_oct_private_t));
+		ifp = if_alloc(IFT_ETHER);
 		if (ifp) {
 			/* Initialize the device private structure. */
-			cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-			memset(priv, 0, sizeof(cvm_oct_private_t));
-
-			ifp->init = cvm_oct_common_init;
+			cvm_oct_private_t *priv;
+			
+			priv = malloc(sizeof(cvm_oct_private_t), M_TEMP, M_WAITOK | M_ZERO);
+			priv->init = cvm_oct_common_init;
 			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
 			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
 			priv->queue = -1;
-			device_set_desc(ifp, "Cavium Octeon POW Ethernet");
+			device_set_desc(dev, "Cavium Octeon POW Ethernet");
+#if 0
 			for (qos = 0; qos < 16; qos++)
 				m_queue_head_init(&priv->tx_free_list[qos]);
+#endif
 
-			if (register_netdev(ifp) < 0) {
+			ifp->if_softc = priv;
+
+			if (priv->init(ifp) < 0) {
 				printf("\t\tFailed to register ethernet device for POW\n");
-				kfree(ifp);
+				panic("%s: need to free ifp.", __func__);
 			} else {
-				cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = dev;
+				cvm_oct_device[CVMX_PIP_NUM_INPUT_PORTS] = ifp;
 				printf("\t\t%s: POW send group %d, receive group %d\n",
 				if_name(ifp), pow_send_group, pow_receive_group);
 			}
@@ -343,25 +412,30 @@ static int __init cvm_oct_init_module(vo
 
 		for (port = cvmx_helper_get_ipd_port(interface, 0); port < cvmx_helper_get_ipd_port(interface, num_ports); port++) {
 			cvm_oct_private_t *priv;
-			struct ifnet *ifp = alloc_etherdev(sizeof(cvm_oct_private_t));
-			if (!dev) {
+			struct ifnet *ifp;
+			
+			ifp = if_alloc(IFT_ETHER);
+			if (!ifp) {
 				printf("\t\tFailed to allocate ethernet device for port %d\n", port);
 				continue;
 			}
+			/* XXX/juli set max send q len.  */
+#if 0
 			if (disable_core_queueing)
 				ifp->tx_queue_len = 0;
+#endif
 
 			/* Initialize the device private structure. */
-			priv = (cvm_oct_private_t *)ifp->if_softc;
-			memset(priv, 0, sizeof(cvm_oct_private_t));
-
+			priv = malloc(sizeof(cvm_oct_private_t), M_TEMP, M_WAITOK | M_ZERO);
 			priv->imode = imode;
 			priv->port = port;
 			priv->queue = cvmx_pko_get_base_queue(priv->port);
 			priv->intercept_cb = NULL;
 			priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
+#if 0
 			for (qos = 0; qos < 16; qos++)
 				m_queue_head_init(&priv->tx_free_list[qos]);
+#endif
 			for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++)
 				cvmx_fau_atomic_write32(priv->fau+qos*4, 0);
 
@@ -374,57 +448,59 @@ static int __init cvm_oct_init_module(vo
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_NPI:
-				ifp->init = cvm_oct_common_init;
-				ifp->uninit = cvm_oct_common_uninit;
-				device_set_desc(ifp, "Cavium Octeon NPI Ethernet");
+				priv->init = cvm_oct_common_init;
+				priv->uninit = cvm_oct_common_uninit;
+				device_set_desc(dev, "Cavium Octeon NPI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_XAUI:
-				ifp->init = cvm_oct_xaui_init;
-				ifp->uninit = cvm_oct_xaui_uninit;
-				device_set_desc(ifp, "Cavium Octeon XAUI Ethernet");
+				priv->init = cvm_oct_xaui_init;
+				priv->uninit = cvm_oct_xaui_uninit;
+				device_set_desc(dev, "Cavium Octeon XAUI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_LOOP:
-				ifp->init = cvm_oct_common_init;
-				ifp->uninit = cvm_oct_common_uninit;
-				device_set_desc(ifp, "Cavium Octeon LOOP Ethernet");
+				priv->init = cvm_oct_common_init;
+				priv->uninit = cvm_oct_common_uninit;
+				device_set_desc(dev, "Cavium Octeon LOOP Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SGMII:
-				ifp->init = cvm_oct_sgmii_init;
-				ifp->uninit = cvm_oct_sgmii_uninit;
-				device_set_desc(ifp, "Cavium Octeon SGMII Ethernet");
+				priv->init = cvm_oct_sgmii_init;
+				priv->uninit = cvm_oct_sgmii_uninit;
+				device_set_desc(dev, "Cavium Octeon SGMII Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SPI:
-				ifp->init = cvm_oct_spi_init;
-				ifp->uninit = cvm_oct_spi_uninit;
-				device_set_desc(ifp, "Cavium Octeon SPI Ethernet");
+				priv->init = cvm_oct_spi_init;
+				priv->uninit = cvm_oct_spi_uninit;
+				device_set_desc(dev, "Cavium Octeon SPI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_RGMII:
-				ifp->init = cvm_oct_rgmii_init;
-				ifp->uninit = cvm_oct_rgmii_uninit;
-				device_set_desc(ifp, "Cavium Octeon RGMII Ethernet");
+				priv->init = cvm_oct_rgmii_init;
+				priv->uninit = cvm_oct_rgmii_uninit;
+				device_set_desc(dev, "Cavium Octeon RGMII Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_GMII:
-				ifp->init = cvm_oct_rgmii_init;
-				ifp->uninit = cvm_oct_rgmii_uninit;
-				device_set_desc(ifp, "Cavium Octeon GMII Ethernet");
+				priv->init = cvm_oct_rgmii_init;
+				priv->uninit = cvm_oct_rgmii_uninit;
+				device_set_desc(dev, "Cavium Octeon GMII Ethernet");
 				break;
 			}
 
-			if (!ifp->init) {
-				kfree(ifp);
+			ifp->if_softc = priv;
+
+			if (!priv->init) {
+				panic("%s: unsupported device type, need to free ifp.", __func__);
 			} else
-			if (register_netdev(ifp) < 0) {
+			if (priv->init(ifp) < 0) {
 				printf("\t\tFailed to register ethernet device for interface %d, port %d\n",
 				interface, priv->port);
-				kfree(ifp);
+				panic("%s: init failed, need to free ifp.", __func__);
 			} else {
-				cvm_oct_device[priv->port] = dev;
+				cvm_oct_device[priv->port] = ifp;
 				fau -= cvmx_pko_get_num_queues(priv->port) * sizeof(uint32_t);
 			}
 		}
@@ -441,11 +517,13 @@ static int __init cvm_oct_init_module(vo
 		cvmx_write_csr(CVMX_POW_WQ_INT_THRX(pow_receive_group), 0x1001);
 	}
 
+#if 0
 	/* Enable the poll timer for checking RGMII status */
 	init_timer(&cvm_oct_poll_timer);
 	cvm_oct_poll_timer.data = 0;
 	cvm_oct_poll_timer.function = cvm_do_timer;
 	mod_timer(&cvm_oct_poll_timer, jiffies + HZ);
+#endif
 
 	return 0;
 }
@@ -456,7 +534,7 @@ static int __init cvm_oct_init_module(vo
  *
  * @return Zero on success
  */
-static void __exit cvm_oct_cleanup_module(void)
+static void cvm_oct_cleanup_module(void)
 {
 	int port;
 
@@ -465,10 +543,14 @@ static void __exit cvm_oct_cleanup_modul
 
 	cvmx_ipd_disable();
 
+#if 0
 	/* Free the interrupt handler */
 	free_irq(8 + pow_receive_group, cvm_oct_device);
+#endif
 
+#if 0
 	del_timer(&cvm_oct_poll_timer);
+#endif
 	cvm_oct_rx_shutdown();
 	cvmx_pko_disable();
 
@@ -476,8 +558,12 @@ static void __exit cvm_oct_cleanup_modul
 	for (port = 0; port < TOTAL_NUMBER_OF_PORTS; port++) {
 		if (cvm_oct_device[port]) {
 			cvm_oct_tx_shutdown(cvm_oct_device[port]);
+#if 0
 			unregister_netdev(cvm_oct_device[port]);
 			kfree(cvm_oct_device[port]);
+#else
+			panic("%s: need to detach and free interface.", __func__);
+#endif
 			cvm_oct_device[port] = NULL;
 		}
 	}
@@ -494,14 +580,21 @@ static void __exit cvm_oct_cleanup_modul
 		cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
 }
 
-/* Note that this module is covered by the GPL even though the files are
-    under a BSD style license. The GPL is inherited from the CVMX files
-    used by this driver. If you would like to use the module under the
-    Cavium proprietary license, you must change the makefile to include
-    the proprietary CVMX files. */
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Cavium Networks <support@caviumnetworks.com>");
-MODULE_DESCRIPTION("Cavium Networks Octeon ethernet driver.");
-module_init(cvm_oct_init_module);
-module_exit(cvm_oct_cleanup_module);
-
+static int
+cvm_oct_modevent(module_t mod __unused, int type, void *data __unused)
+{
+	switch(type) {
+	case MOD_LOAD:
+		cvm_oct_init_module();
+		break;
+	case MOD_UNLOAD:
+	case MOD_SHUTDOWN:
+		cvm_oct_cleanup_module();
+		break;
+	default:
+		return (EOPNOTSUPP);
+        }
+	return (0);
+}
+DEV_MODULE(octe, cvm_oct_modevent, NULL);
+MODULE_VERSION(octe, 1);

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 21:03:15 2010
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 3EC27106566C;
	Thu, 22 Apr 2010 21:03:15 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 2D1BA8FC1D;
	Thu, 22 Apr 2010 21:03:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3ML3FQG091149;
	Thu, 22 Apr 2010 21:03:15 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3ML3FeC091147;
	Thu, 22 Apr 2010 21:03:15 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004222103.o3ML3FeC091147@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 21:03:15 +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: r207074 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 21:03:15 -0000

Author: jmallett
Date: Thu Apr 22 21:03:14 2010
New Revision: 207074
URL: http://svn.freebsd.org/changeset/base/207074

Log:
  Correct locking, but make compile by commenting out nearly everything until I
  add our MII infrastructure to this driver.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Thu Apr 22 20:54:32 2010	(r207073)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Thu Apr 22 21:03:14 2010	(r207074)
@@ -34,18 +34,22 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
+#include <sys/lock.h>
 #include <sys/mutex.h>
 
 #include <net/ethernet.h>
 #include <net/if.h>
 
-#include "cvmx-sysinfo.h"
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
-DECLARE_MUTEX(mdio_sem);
+static struct mtx mdio_mtx;
+MTX_SYSINIT(cvm_oct_mdio, &mdio_mtx, "MDIO", MTX_DEF);
 
+#define	MDIO_LOCK()	mtx_lock(&mdio_mtx)
+#define	MDIO_UNLOCK()	mtx_unlock(&mdio_mtx)
 
+#if 0
 /**
  * Perform an MII read. Called by the generic MII routines
  *
@@ -131,9 +135,9 @@ static int cvm_oct_get_settings(struct i
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret; 
 
-	down(&mdio_sem);
+	MDIO_LOCK();
 	ret = mii_ethtool_gset(&priv->mii_info, cmd);
-	up(&mdio_sem);
+	MDIO_UNLOCK();
 
 	return ret;
 }
@@ -144,9 +148,9 @@ static int cvm_oct_set_settings(struct i
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret;
 
-	down(&mdio_sem);
+	MDIO_LOCK();
 	ret =  mii_ethtool_sset(&priv->mii_info, cmd);
-	up(&mdio_sem);
+	MDIO_UNLOCK();
 
 	return ret;
 }
@@ -157,9 +161,9 @@ static int cvm_oct_nway_reset(struct ifn
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int ret;
 	
-	down(&mdio_sem);
+	MDIO_LOCK();
 	ret = mii_nway_restart(&priv->mii_info);
-	up(&mdio_sem);
+	MDIO_UNLOCK();
 
 	return ret; 
 }
@@ -170,9 +174,9 @@ static u32 cvm_oct_get_link(struct ifnet
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	u32 ret;
 
-	down(&mdio_sem);
+	MDIO_LOCK();
 	ret = mii_link_ok(&priv->mii_info);
-	up(&mdio_sem);
+	MDIO_UNLOCK();
 
 	return ret; 
 }
@@ -187,6 +191,7 @@ struct ethtool_ops cvm_oct_ethtool_ops =
 	.get_sg         = ethtool_op_get_sg,
 	.get_tx_csum    = ethtool_op_get_tx_csum,
 };
+#endif
 
 
 /**
@@ -199,16 +204,20 @@ struct ethtool_ops cvm_oct_ethtool_ops =
  */
 int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd)
 {
+#if 0
 	cvm_oct_private_t      *priv = (cvm_oct_private_t *)ifp->if_softc;
 	struct mii_ioctl_data  *data = if_mii(rq);
 	unsigned int            duplex_chg;
 	int ret;
 
-	down(&mdio_sem);
+	MDIO_LOCK();
 	ret = generic_mii_ioctl(&priv->mii_info, data, cmd, &duplex_chg);
-	up(&mdio_sem);
+	MDIO_UNLOCK();
 
 	return ret; 
+#else
+	panic("%s: not yet implemented.", __func__);
+#endif
 }
 
 
@@ -224,6 +233,7 @@ int cvm_oct_mdio_setup_device(struct ifn
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int phy_id = cvmx_helper_board_get_mii_address(priv->port);
 	if (phy_id != -1) {
+#if 0
 		priv->mii_info.dev = dev;
 		priv->mii_info.phy_id = phy_id;
 		priv->mii_info.phy_id_mask = 0xff;
@@ -231,11 +241,9 @@ int cvm_oct_mdio_setup_device(struct ifn
 		priv->mii_info.reg_num_mask = 0x1f;
 		priv->mii_info.mdio_read = cvm_oct_mdio_read;
 		priv->mii_info.mdio_write = cvm_oct_mdio_write;
-	} else {
-		/* Supply dummy MDIO routines so the kernel won't crash
-		   if the user tries to read them */
-		priv->mii_info.mdio_read = cvm_oct_mdio_dummy_read;
-		priv->mii_info.mdio_write = cvm_oct_mdio_dummy_write;
+#else
+		panic("%s: need add MII hooks.", __func__);
+#endif
 	}
 	return 0;
 }

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 21:10:22 2010
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 77725106564A;
	Thu, 22 Apr 2010 21:10:22 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 650E78FC14;
	Thu, 22 Apr 2010 21:10:22 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MLAMiY092751;
	Thu, 22 Apr 2010 21:10:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MLAMsQ092748;
	Thu, 22 Apr 2010 21:10:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004222110.o3MLAMsQ092748@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 21:10:22 +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: r207075 - user/jmallett/octeon/sys/mips/cavium/octe
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: Thu, 22 Apr 2010 21:10:22 -0000

Author: jmallett
Date: Thu Apr 22 21:10:22 2010
New Revision: 207075
URL: http://svn.freebsd.org/changeset/base/207075

Log:
  Comment out a bunch of stuff.  Now, except for the procfs module, all of this
  driver compiles and linking is only held back by trivial BSP differences in
  FreeBSD and Linux.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 21:03:14 2010	(r207074)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 21:10:22 2010	(r207075)
@@ -26,10 +26,17 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/mii.h>
-#include <net/dst.h>
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/socket.h>
+
+#include <net/ethernet.h>
+#include <net/if.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
@@ -46,15 +53,19 @@ static int cvm_oct_fill_hw_mbuf(int pool
 	int freed = elements;
 	while (freed) {
 
+#if 0
 		struct mbuf *m = dev_alloc_m(size + 128);
-		if (unlikely(m == NULL)) {
-			pr_warning("Failed to allocate m for hardware pool %d\n", pool);
+		if (__predict_false(m == NULL)) {
+			printf("Failed to allocate m for hardware pool %d\n", pool);
 			break;
 		}
 
 		m_reserve(m, 128 - (((unsigned long)m->data) & 0x7f));
 		*(struct mbuf **)(m->data - sizeof(void *)) = m;
 		cvmx_fpa_free(m->data, pool, DONT_WRITEBACK(size/128));
+#else
+		panic("%s: need to implement mbuf allocation.", __func__);
+#endif
 		freed--;
 	}
 	return (elements - freed);
@@ -77,7 +88,7 @@ static void cvm_oct_free_hw_mbuf(int poo
 		if (memory) {
 			struct mbuf *m = *(struct mbuf **)(memory - sizeof(void *));
 			elements--;
-			dev_kfree_m(m);
+			m_freem(m);
 		}
 	} while (memory);
 
@@ -104,6 +115,7 @@ static int cvm_oct_fill_hw_memory(int po
 	int freed = elements;
 
 	if (USE_32BIT_SHARED) {
+#if 0
 		extern uint64_t octeon_reserve32_memory;
 
 		memory = cvmx_bootmem_alloc_range(elements*size, 128, octeon_reserve32_memory,
@@ -118,12 +130,19 @@ static int cvm_oct_fill_hw_memory(int po
 			memory += size;
 			freed--;
 		}
+#else
+		panic("%s: may need to implement using shared memory.", __func__);
+#endif
 	} else {
 		while (freed) {
 			/* We need to force alignment to 128 bytes here */
+#if 0
 			memory = kmalloc(size + 127, GFP_ATOMIC);
-			if (unlikely(memory == NULL)) {
-				pr_warning("Unable to allocate %u bytes for FPA pool %d\n", elements*size, pool);
+#else
+			panic("%s: not yet implemented.", __func__);
+#endif
+			if (__predict_false(memory == NULL)) {
+				printf("Unable to allocate %u bytes for FPA pool %d\n", elements*size, pool);
 				break;
 			}
 			memory = (char *)(((unsigned long)memory+127) & -128);
@@ -152,7 +171,11 @@ static void cvm_oct_free_hw_memory(int p
 			memory = cvmx_fpa_alloc(pool);
 			if (memory) {
 				elements--;
+#if 0
 				kfree(phys_to_virt(cvmx_ptr_to_phys(memory)));
+#else
+				panic("%s: not yet implemented.", __func__);
+#endif
 			}
 		} while (memory);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 21:03:14 2010	(r207074)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 21:10:22 2010	(r207075)
@@ -342,7 +342,9 @@ static int cvm_oct_init_module(void)
 
 	printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING);
 
+#if 0
 	cvm_oct_proc_initialize();
+#endif
 	cvm_oct_rx_initialize();
 	cvm_oct_configure_common_hw();
 
@@ -569,7 +571,9 @@ static void cvm_oct_cleanup_module(void)
 	}
 
 	cvmx_pko_shutdown();
+#if 0
 	cvm_oct_proc_shutdown();
+#endif
 
 	cvmx_ipd_free_ptr();
 

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 21:17:00 2010
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 964FD1065672;
	Thu, 22 Apr 2010 21:17:00 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 840EB8FC18;
	Thu, 22 Apr 2010 21:17:00 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MLH0iC094296;
	Thu, 22 Apr 2010 21:17:00 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MLH0de094291;
	Thu, 22 Apr 2010 21:17:00 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004222117.o3MLH0de094291@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 21:17: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: r207076 - user/jmallett/octeon/sys/mips/cavium
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: Thu, 22 Apr 2010 21:17:00 -0000

Author: jmallett
Date: Thu Apr 22 21:17:00 2010
New Revision: 207076
URL: http://svn.freebsd.org/changeset/base/207076

Log:
  o) Modify our Octeon BSP to provide octeon_bootinfo so that the Linux Ethernet
     driver can access it.
  o) Likewise, rename octeon_board_real to octeon_is_simulation.
  o) Add the files entries to compile the Linux Ethernet driver.  It panics due
     to unimplemented code at startup now.

Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
  user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 22 21:10:22 2010	(r207075)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Thu Apr 22 21:17:00 2010	(r207076)
@@ -17,6 +17,17 @@ mips/mips/tick.c				standard
 #mips/cavium/dev/rgmii/octeon_pko.c		optional rgmii
 #mips/cavium/dev/rgmii/octeon_rgmx.c		optional rgmii
 
+mips/cavium/octe/ethernet.c			optional octe
+mips/cavium/octe/ethernet-common.c		optional octe
+mips/cavium/octe/ethernet-mdio.c		optional octe
+mips/cavium/octe/ethernet-mem.c			optional octe
+mips/cavium/octe/ethernet-rgmii.c		optional octe
+mips/cavium/octe/ethernet-rx.c			optional octe
+mips/cavium/octe/ethernet-sgmii.c		optional octe
+mips/cavium/octe/ethernet-spi.c			optional octe
+mips/cavium/octe/ethernet-tx.c			optional octe
+mips/cavium/octe/ethernet-xaui.c		optional octe
+
 contrib/octeon-sdk/cvmx-bootmem.c		optional octe
 contrib/octeon-sdk/cvmx-cmd-queue.c		optional octe
 contrib/octeon-sdk/cvmx-fpa.c			optional octe

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Thu Apr 22 21:10:22 2010	(r207075)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_ebt3000_cf.c	Thu Apr 22 21:17:00 2010	(r207076)
@@ -558,7 +558,7 @@ static void cf_swap_ascii (unsigned char
 
 static int cf_probe (device_t dev)
 {
-    	if (!octeon_board_real()) return 1;
+    	if (octeon_is_simulation()) return 1;
 
 	if (device_get_unit(dev) != 0) {
                 panic("can't attach more devices\n");
@@ -585,7 +585,7 @@ static void cf_identify (driver_t *drv, 
 	int count = 0;
         octeon_mio_boot_reg_cfgx_t cfg;
 
-    	if (!octeon_board_real())
+    	if (octeon_is_simulation())
 		return;
 
 	base_addr = (void *) MIPS_PHYS_TO_KSEG0(OCTEON_CF_COMMON_BASE_ADDR);
@@ -664,7 +664,7 @@ static int cf_attach (device_t dev)
 {
 	struct cf_priv *cf_priv;
 
-    	if (!octeon_board_real()) return 1;
+    	if (octeon_is_simulation()) return 1;
 
 	cf_priv = device_get_softc(dev);
 	cf_priv->dev = dev;

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Thu Apr 22 21:10:22 2010	(r207075)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Thu Apr 22 21:17:00 2010	(r207076)
@@ -107,7 +107,7 @@ octeon_led_write_char(int char_position,
 {
 	uint64_t ptr = (OCTEON_CHAR_LED_BASE_ADDR | 0xf8);
 
-	if (!octeon_board_real())
+	if (octeon_is_simulation())
 		return;
 
 	char_position &= 0x7;  /* only 8 chars */
@@ -120,7 +120,7 @@ octeon_led_write_char0(char val)
 {
 	uint64_t ptr = (OCTEON_CHAR_LED_BASE_ADDR | 0xf8);
 
-	if (!octeon_board_real())
+	if (octeon_is_simulation())
 		return;
 	oct_write8_x8(ptr, val);
 }
@@ -131,7 +131,7 @@ octeon_led_write_hexchar(int char_positi
 	uint64_t ptr = (OCTEON_CHAR_LED_BASE_ADDR | 0xf8);
 	char char1, char2;
 
-	if (!octeon_board_real())
+	if (octeon_is_simulation())
 		return;
 
 	char1 = (hexval >> 4) & 0x0f; char1 = (char1 < 10)?char1+'0':char1+'7';
@@ -151,7 +151,7 @@ octeon_led_write_string(const char *str)
 	uint64_t ptr = (OCTEON_CHAR_LED_BASE_ADDR | 0xf8);
 	int i;
 
-	if (!octeon_board_real())
+	if (octeon_is_simulation())
 		return;
 
 	for (i=0; i<8; i++, ptr++) {
@@ -168,7 +168,7 @@ static char progress[8] = { '-', '/', '|
 void
 octeon_led_run_wheel(int *prog_count, int led_position)
 {
-	if (!octeon_board_real())
+	if (octeon_is_simulation())
 		return;
 	octeon_led_write_char(led_position, progress[*prog_count]);
 	*prog_count += 1;
@@ -223,7 +223,7 @@ octeon_memory_init(void)
 {
 	uint32_t realmem_bytes;
 
-	if (octeon_board_real()) {
+	if (!octeon_is_simulation()) {
 		realmem_bytes = (octeon_dram - PAGE_SIZE);
 		realmem_bytes &= ~(PAGE_SIZE - 1);
 	} else {
@@ -232,7 +232,7 @@ octeon_memory_init(void)
 	}
 	/* phys_avail regions are in bytes */
 	phys_avail[0] = (MIPS_KSEG0_TO_PHYS((vm_offset_t)&end) + PAGE_SIZE) & ~(PAGE_SIZE - 1);
-	if (octeon_board_real()) {
+	if (!octeon_is_simulation()) {
 		if (realmem_bytes > OCTEON_DRAM_FIRST_256_END)
 			phys_avail[1] = OCTEON_DRAM_FIRST_256_END;
 		else
@@ -257,7 +257,7 @@ octeon_memory_init(void)
 	 *
 	 */
 	physmem = btoc(phys_avail[1] - phys_avail[0]);
-	if ((octeon_board_real()) &&
+	if ((!octeon_is_simulation()) &&
 	    (realmem_bytes > OCTEON_DRAM_FIRST_256_END)) {
 		/* take out the upper non-cached 1/2 */
 		realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
@@ -390,9 +390,9 @@ uint64_t octeon_dram;
 static uint32_t octeon_bd_ver = 0, octeon_cvmx_bd_ver = 0;
 uint8_t octeon_mac_addr[6] = { 0 };
 int octeon_core_mask, octeon_mac_addr_count;
+cvmx_bootinfo_t *octeon_bootinfo;
 
 static octeon_boot_descriptor_t *app_desc_ptr;
-static cvmx_bootinfo_t *cvmx_desc_ptr;
 
 #define OCTEON_BOARD_TYPE_NONE 			0
 #define OCTEON_BOARD_TYPE_SIM  			1
@@ -404,14 +404,13 @@ static cvmx_bootinfo_t *cvmx_desc_ptr;
 #define OCTEON_DRAM_MIN	     30
 #define OCTEON_DRAM_MAX	     3000
 
-
 int
-octeon_board_real(void)
+octeon_is_simulation(void)
 {
 	switch (cvmx_sysinfo_get()->board_type) {
 	case OCTEON_BOARD_TYPE_NONE:
 	case OCTEON_BOARD_TYPE_SIM:
-		return 0;
+		return 1;
 	case OCTEON_BOARD_TYPE_CN3010_EVB_HS5:
 		/*
 		 * XXX
@@ -419,11 +418,11 @@ octeon_board_real(void)
 		 * despite its being rather real.  Disable the revision check
 		 * for type 11.
 		 */
-		return 1;
+		return 0;
 	default:
 		if (cvmx_sysinfo_get()->board_rev_major == 0)
-			return 0;
-		return 1;
+			return 1;
+		return 0;
 	}
 }
 
@@ -449,29 +448,29 @@ octeon_process_app_desc_ver_6(void)
 	/* XXX Why is 0x00000000ffffffffULL a bad value?  */
 	if (app_desc_ptr->cvmx_desc_vaddr == 0 ||
 	    app_desc_ptr->cvmx_desc_vaddr == 0xfffffffful) {
-            	printf ("Bad cvmx_desc_ptr %p\n", cvmx_desc_ptr);
+            	printf ("Bad octeon_bootinfo %p\n", octeon_bootinfo);
                 return 1;
 	}
-    	cvmx_desc_ptr =
+    	octeon_bootinfo =
 	    (cvmx_bootinfo_t *)(intptr_t)app_desc_ptr->cvmx_desc_vaddr;
-        cvmx_desc_ptr =
-	    (cvmx_bootinfo_t *) ((intptr_t)cvmx_desc_ptr | MIPS_KSEG0_START);
-        octeon_cvmx_bd_ver = (cvmx_desc_ptr->major_version * 100) +
-	    cvmx_desc_ptr->minor_version;
-        if (cvmx_desc_ptr->major_version != 1) {
+        octeon_bootinfo =
+	    (cvmx_bootinfo_t *) ((intptr_t)octeon_bootinfo | MIPS_KSEG0_START);
+        octeon_cvmx_bd_ver = (octeon_bootinfo->major_version * 100) +
+	    octeon_bootinfo->minor_version;
+        if (octeon_bootinfo->major_version != 1) {
             	panic("Incompatible CVMX descriptor from bootloader: %d.%d %p\n",
-                       (int) cvmx_desc_ptr->major_version,
-                       (int) cvmx_desc_ptr->minor_version, cvmx_desc_ptr);
+                       (int) octeon_bootinfo->major_version,
+                       (int) octeon_bootinfo->minor_version, octeon_bootinfo);
         }
 
-        octeon_core_mask = cvmx_desc_ptr->core_mask;
-        octeon_mac_addr[0] = cvmx_desc_ptr->mac_addr_base[0];
-        octeon_mac_addr[1] = cvmx_desc_ptr->mac_addr_base[1];
-        octeon_mac_addr[2] = cvmx_desc_ptr->mac_addr_base[2];
-        octeon_mac_addr[3] = cvmx_desc_ptr->mac_addr_base[3];
-        octeon_mac_addr[4] = cvmx_desc_ptr->mac_addr_base[4];
-        octeon_mac_addr[5] = cvmx_desc_ptr->mac_addr_base[5];
-        octeon_mac_addr_count = cvmx_desc_ptr->mac_addr_count;
+        octeon_core_mask = octeon_bootinfo->core_mask;
+        octeon_mac_addr[0] = octeon_bootinfo->mac_addr_base[0];
+        octeon_mac_addr[1] = octeon_bootinfo->mac_addr_base[1];
+        octeon_mac_addr[2] = octeon_bootinfo->mac_addr_base[2];
+        octeon_mac_addr[3] = octeon_bootinfo->mac_addr_base[3];
+        octeon_mac_addr[4] = octeon_bootinfo->mac_addr_base[4];
+        octeon_mac_addr[5] = octeon_bootinfo->mac_addr_base[5];
+        octeon_mac_addr_count = octeon_bootinfo->mac_addr_count;
 
         if (app_desc_ptr->dram_size > 16*1024*1024)
             	octeon_dram = (uint64_t)app_desc_ptr->dram_size;
@@ -482,10 +481,10 @@ octeon_process_app_desc_ver_6(void)
 	 * XXX
 	 * We could pass in phy_mem_desc_ptr, but why bother?
 	 */
-	cvmx_sysinfo_minimal_initialize(NULL, cvmx_desc_ptr->board_type,
-					cvmx_desc_ptr->board_rev_major,
-					cvmx_desc_ptr->board_rev_minor,
-					cvmx_desc_ptr->eclock_hz);
+	cvmx_sysinfo_minimal_initialize(NULL, octeon_bootinfo->board_type,
+					octeon_bootinfo->board_rev_major,
+					octeon_bootinfo->board_rev_minor,
+					octeon_bootinfo->eclock_hz);
         return 0;
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Thu Apr 22 21:10:22 2010	(r207075)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_pcmap_regs.h	Thu Apr 22 21:17:00 2010	(r207076)
@@ -300,7 +300,7 @@ extern uint64_t octeon_dram;
 extern uint8_t octeon_mac_addr[6];
 extern int octeon_core_mask, octeon_mac_addr_count;
 extern void octeon_ciu_reset(void);
-extern int octeon_board_real(void);
+extern int octeon_is_simulation(void);
 #endif	/* LOCORE */
 
 

From owner-svn-src-user@FreeBSD.ORG  Thu Apr 22 23:58:08 2010
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 4F81E1065672;
	Thu, 22 Apr 2010 23:58:08 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 3E0288FC18;
	Thu, 22 Apr 2010 23:58:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3MNw8DB030666;
	Thu, 22 Apr 2010 23:58:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3MNw836030662;
	Thu, 22 Apr 2010 23:58:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004222358.o3MNw836030662@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Thu, 22 Apr 2010 23:58:08 +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: r207083 - in user/jmallett/octeon/sys/mips/cavium: .
	octe
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: Thu, 22 Apr 2010 23:58:08 -0000

Author: jmallett
Date: Thu Apr 22 23:58:07 2010
New Revision: 207083
URL: http://svn.freebsd.org/changeset/base/207083

Log:
  o) Reduce the size of packet pool items so that we can use a single mbuf
     cluster to satisfy it.
  o) Code to fill the FPA with mbufs.

Modified:
  user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c

Modified: user/jmallett/octeon/sys/mips/cavium/cvmx_config.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 23:51:01 2010	(r207082)
+++ user/jmallett/octeon/sys/mips/cavium/cvmx_config.h	Thu Apr 22 23:58:07 2010	(r207083)
@@ -166,7 +166,7 @@
 
 /************************* FPA allocation *********************************/
 /* Pool sizes in bytes, must be multiple of a cache line */
-#define CVMX_FPA_POOL_0_SIZE (16 * CVMX_CACHE_LINE_SIZE)
+#define CVMX_FPA_POOL_0_SIZE (15 * CVMX_CACHE_LINE_SIZE)
 #define CVMX_FPA_POOL_1_SIZE (1 * CVMX_CACHE_LINE_SIZE)
 #define CVMX_FPA_POOL_2_SIZE (8 * CVMX_CACHE_LINE_SIZE)
 #define CVMX_FPA_POOL_3_SIZE (0 * CVMX_CACHE_LINE_SIZE)

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 23:51:01 2010	(r207082)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mem.c	Thu Apr 22 23:58:07 2010	(r207083)
@@ -52,20 +52,17 @@ static int cvm_oct_fill_hw_mbuf(int pool
 {
 	int freed = elements;
 	while (freed) {
+		KASSERT(size <= MCLBYTES - 128, ("mbuf clusters are too small"));
 
-#if 0
-		struct mbuf *m = dev_alloc_m(size + 128);
+		struct mbuf *m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
 		if (__predict_false(m == NULL)) {
-			printf("Failed to allocate m for hardware pool %d\n", pool);
+			printf("Failed to allocate mbuf for hardware pool %d\n", pool);
 			break;
 		}
 
-		m_reserve(m, 128 - (((unsigned long)m->data) & 0x7f));
-		*(struct mbuf **)(m->data - sizeof(void *)) = m;
-		cvmx_fpa_free(m->data, pool, DONT_WRITEBACK(size/128));
-#else
-		panic("%s: need to implement mbuf allocation.", __func__);
-#endif
+		m->m_data += 128 - (((uintptr_t)m->m_data) & 0x7f);
+		*(struct mbuf **)(m->m_data - sizeof(void *)) = m;
+		cvmx_fpa_free(m->m_data, pool, DONT_WRITEBACK(size/128));
 		freed--;
 	}
 	return (elements - freed);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Thu Apr 22 23:51:01 2010	(r207082)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Thu Apr 22 23:58:07 2010	(r207083)
@@ -565,7 +565,7 @@ int cvm_oct_transmit_qos(struct ifnet *i
 
 
 /**
- * This function frees all m that are currenty queued for TX.
+ * This function frees all mbufs that are currenty queued for TX.
  *
  * @param dev    Device being shutdown
  */

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 00:11:39 2010
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 9A75B106566C;
	Fri, 23 Apr 2010 00:11:38 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7EC908FC0A;
	Fri, 23 Apr 2010 00:11:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N0Bch2033693;
	Fri, 23 Apr 2010 00:11:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N0Bcac033690;
	Fri, 23 Apr 2010 00:11:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230011.o3N0Bcac033690@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 00:11:38 +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: r207084 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 00:11:39 -0000

Author: jmallett
Date: Fri Apr 23 00:11:38 2010
New Revision: 207084
URL: http://svn.freebsd.org/changeset/base/207084

Log:
  Fix some SMP stuff.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Thu Apr 22 23:58:07 2010	(r207083)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Fri Apr 23 00:11:38 2010	(r207084)
@@ -34,6 +34,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
+#include <sys/smp.h>
 
 #include <net/ethernet.h>
 #include <net/if.h>
@@ -53,7 +54,7 @@ struct cvm_tasklet_wrapper
  * throughput even though in theory it would reduce contantion on the
  * cache lines containing the locks. */
 
-static struct cvm_tasklet_wrapper cvm_oct_tasklet[NR_CPUS]; // __cacheline_aligned_in_smp;
+static struct cvm_tasklet_wrapper cvm_oct_tasklet[MAXCPU]; // __cacheline_aligned_in_smp;
 #endif
 
 /**
@@ -442,7 +443,7 @@ void cvm_oct_rx_initialize(void)
 #if 0
 	int i;
 	/* Initialize all of the tasklets */
-	for (i = 0; i < NR_CPUS; i++)
+	for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
 		tasklet_init(&cvm_oct_tasklet[i].t, cvm_oct_tasklet_rx, 0);
 #endif
 }
@@ -452,7 +453,7 @@ void cvm_oct_rx_shutdown(void)
 #if 0
 	int i;
 	/* Shutdown all of the tasklets */
-	for (i = 0; i < NR_CPUS; i++)
+	for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
 		tasklet_kill(&cvm_oct_tasklet[i].t);
 #endif
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Thu Apr 22 23:58:07 2010	(r207083)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 00:11:38 2010	(r207084)
@@ -35,6 +35,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/module.h>
+#include <sys/smp.h>
 
 #include <net/ethernet.h>
 #include <net/if.h>
@@ -241,24 +242,20 @@ static void cvm_oct_configure_common_hw(
 
 #ifdef SMP
 	if (USE_MULTICORE_RECEIVE) {
-#if 0
-		preempt_disable();
+		critical_enter();
 		{
 			int cpu;
-			for (cpu = 0; cpu < NR_CPUS; cpu++) {
-				if (cpu_online(cpu) &&
-				   (cpu != smp_processor_id())) {
+			for (cpu = 0; cpu < mp_maxid; cpu++) {
+				if (!CPU_ABSENT(cpu) &&
+				   (cpu != PCPU_GET(cpuid))) {
 					cvmx_ciu_intx0_t en;
-					en.u64 = cvmx_read_csr(CVMX_CIU_INTX_EN0(cpu_logical_map(cpu)*2));
+					en.u64 = cvmx_read_csr(CVMX_CIU_INTX_EN0(cpu*2));
 					en.s.workq |= (1<<pow_receive_group);
-					cvmx_write_csr(CVMX_CIU_INTX_EN0(cpu_logical_map(cpu)*2), en.u64);
+					cvmx_write_csr(CVMX_CIU_INTX_EN0(cpu*2), en.u64);
 				}
 			}
 		}
-		preempt_enable();
-#else
-		panic("%s: need to implement CPU enumeration.", __func__);
-#endif
+		critical_exit();
 	}
 #endif
 }

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 00:41:47 2010
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 D90C0106566B;
	Fri, 23 Apr 2010 00:41:47 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C82878FC14;
	Fri, 23 Apr 2010 00:41:47 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N0flcP040513;
	Fri, 23 Apr 2010 00:41:47 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N0flTv040511;
	Fri, 23 Apr 2010 00:41:47 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230041.o3N0flTv040511@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 00:41: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: r207087 - user/jmallett/octeon/sys/mips/cavium
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: Fri, 23 Apr 2010 00:41:48 -0000

Author: jmallett
Date: Fri Apr 23 00:41:47 2010
New Revision: 207087
URL: http://svn.freebsd.org/changeset/base/207087

Log:
  Use the SDK's bootmem module to get physical memory mapping rather than
  constructing it by hand.  By using bootmem, we make it possible for the
  SDK to use memory below where the kernel is loaded for its own bookkeeping
  and such.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 00:34:59 2010	(r207086)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 00:41:47 2010	(r207087)
@@ -71,6 +71,7 @@ __FBSDID("$FreeBSD$");
 #include <machine/vmparam.h>
 
 #include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-bootmem.h>
 #include <contrib/octeon-sdk/cvmx-interrupt.h>
 
 #if defined(__mips_n64) 
@@ -221,57 +222,47 @@ octeon_ciu_reset(void)
 static void
 octeon_memory_init(void)
 {
-	uint32_t realmem_bytes;
+	vm_paddr_t phys_end;
+	int64_t addr;
+	unsigned i;
 
-	if (!octeon_is_simulation()) {
-		realmem_bytes = (octeon_dram - PAGE_SIZE);
-		realmem_bytes &= ~(PAGE_SIZE - 1);
-	} else {
+	phys_end = round_page(MIPS_KSEG0_TO_PHYS((vm_offset_t)&end));
+
+	if (octeon_is_simulation()) {
 		/* Simulator we limit to 96 meg */
-		realmem_bytes = (96 << 20);
-	}
-	/* phys_avail regions are in bytes */
-	phys_avail[0] = (MIPS_KSEG0_TO_PHYS((vm_offset_t)&end) + PAGE_SIZE) & ~(PAGE_SIZE - 1);
-	if (!octeon_is_simulation()) {
-		if (realmem_bytes > OCTEON_DRAM_FIRST_256_END)
-			phys_avail[1] = OCTEON_DRAM_FIRST_256_END;
-		else
-			phys_avail[1] = realmem_bytes;
-		realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
-		realmem_bytes &= ~(PAGE_SIZE - 1);
-	} else {
-		/* Simulator gets 96Meg period. */
-		phys_avail[1] = (96 << 20);
+		phys_avail[0] = phys_end;
+		phys_avail[1] = 96 << 20;
+
+		physmem = phys_avail[1] - phys_avail[0];
+		return;
 	}
-	/*-
-	 * Octeon Memory looks as follows:
-         *   PA
-	 * 0000 0000 to                                       0x0 0000 0000 0000
-	 * 0FFF FFFF      First 256 MB memory   Maps to       0x0 0000 0FFF FFFF
-	 *
-	 * 1000 0000 to                                       0x1 0000 1000 0000
-	 * 1FFF FFFF      Uncached Bu I/O space.converted to  0x1 0000 1FFF FFFF
-	 *
-	 * 2FFF FFFF to            Cached                     0x0 0000 2000 0000
-	 * FFFF FFFF      all dram mem above the first 512M   0x3 FFFF FFFF FFFF
-	 *
+
+	/*
+	 * Allocate memory from bootmem 1MB at a time and merge
+	 * adjacent entries.
 	 */
-	physmem = btoc(phys_avail[1] - phys_avail[0]);
-	if ((!octeon_is_simulation()) &&
-	    (realmem_bytes > OCTEON_DRAM_FIRST_256_END)) {
-		/* take out the upper non-cached 1/2 */
-		realmem_bytes -= OCTEON_DRAM_FIRST_256_END;
-		realmem_bytes &= ~(PAGE_SIZE - 1);
-		/* Now map the rest of the memory */
-		phys_avail[2] = 0x20000000;
-		phys_avail[3] = ((uint32_t) 0x20000000 + realmem_bytes);
-		physmem += btoc(phys_avail[3] - phys_avail[2]);
-	}
-	realmem = physmem;
+	i = 0;
+	while (i < PHYS_AVAIL_ENTRIES) {
+		addr = cvmx_bootmem_phy_alloc(1 << 20, phys_end,
+					      ~(vm_paddr_t)0, PAGE_SIZE, 0);
+		if (addr == -1)
+			break;
+
+		physmem += 1 << 20;
+
+		if (i > 0 && phys_avail[i - 1] == addr) {
+			phys_avail[i - 1] += 1 << 20;
+			continue;
+		}
 
-	printf("Total DRAM Size %#X\n", (uint32_t) octeon_dram);
-	printf("Bank 0 = %#08lX   ->  %#08lX\n", (long)phys_avail[0], (long)phys_avail[1]);
-	printf("Bank 1 = %#08lX   ->  %#08lX\n", (long)phys_avail[2], (long)phys_avail[3]);
+		printf("phys_avail[%u] = { %#jx - %#jx }\n", i / 2, addr,
+		       addr + (1 << 20));
+
+		phys_avail[i + 0] = addr;
+		phys_avail[i + 1] = addr + (1 << 20);
+
+		i += 2;
+	}
 }
 
 void
@@ -445,6 +436,8 @@ octeon_process_app_desc_ver_unknown(void
 static int
 octeon_process_app_desc_ver_6(void)
 {
+	void *phy_mem_desc_ptr;
+
 	/* XXX Why is 0x00000000ffffffffULL a bad value?  */
 	if (app_desc_ptr->cvmx_desc_vaddr == 0 ||
 	    app_desc_ptr->cvmx_desc_vaddr == 0xfffffffful) {
@@ -477,11 +470,10 @@ octeon_process_app_desc_ver_6(void)
 	else
             	octeon_dram = (uint64_t)app_desc_ptr->dram_size << 20;
 
-	/*
-	 * XXX
-	 * We could pass in phy_mem_desc_ptr, but why bother?
-	 */
-	cvmx_sysinfo_minimal_initialize(NULL, octeon_bootinfo->board_type,
+	phy_mem_desc_ptr =
+	    (void *)MIPS_PHYS_TO_KSEG0(octeon_bootinfo->phy_mem_desc_addr);
+	cvmx_sysinfo_minimal_initialize(phy_mem_desc_ptr,
+					octeon_bootinfo->board_type,
 					octeon_bootinfo->board_rev_major,
 					octeon_bootinfo->board_rev_minor,
 					octeon_bootinfo->eclock_hz);
@@ -504,6 +496,10 @@ octeon_boot_params_init(register_t ptr)
         if (bad_desc)
         	octeon_process_app_desc_ver_unknown();
 
+	if (cvmx_sysinfo_get()->phy_mem_desc_ptr == NULL)
+		panic("Your boot loader did not supply a memory descriptor.\n");
+	cvmx_bootmem_init(cvmx_sysinfo_get()->phy_mem_desc_ptr);
+
         printf("Boot Descriptor Ver: %u -> %u/%u",
                octeon_bd_ver, octeon_cvmx_bd_ver / 100,
 	       octeon_cvmx_bd_ver % 100);

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 01:22:48 2010
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 CCE291065674;
	Fri, 23 Apr 2010 01:22:48 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BCCE48FC14;
	Fri, 23 Apr 2010 01:22:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N1Mmtg049528;
	Fri, 23 Apr 2010 01:22:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N1MmLR049526;
	Fri, 23 Apr 2010 01:22:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230122.o3N1MmLR049526@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 01:22:48 +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: r207088 - user/jmallett/octeon/sys/mips/cavium
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: Fri, 23 Apr 2010 01:22:48 -0000

Author: jmallett
Date: Fri Apr 23 01:22:48 2010
New Revision: 207088
URL: http://svn.freebsd.org/changeset/base/207088

Log:
  Remove a misleading printf.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 00:41:47 2010	(r207087)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 01:22:48 2010	(r207088)
@@ -255,9 +255,6 @@ octeon_memory_init(void)
 			continue;
 		}
 
-		printf("phys_avail[%u] = { %#jx - %#jx }\n", i / 2, addr,
-		       addr + (1 << 20));
-
 		phys_avail[i + 0] = addr;
 		phys_avail[i + 1] = addr + (1 << 20);
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 01:45:38 2010
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 CE59D106566B;
	Fri, 23 Apr 2010 01:45:38 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id BCF958FC12;
	Fri, 23 Apr 2010 01:45:38 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N1jcvJ054576;
	Fri, 23 Apr 2010 01:45:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N1jcmb054571;
	Fri, 23 Apr 2010 01:45:38 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230145.o3N1jcmb054571@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 01:45:38 +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: r207090 - in user/jmallett/octeon/sys/mips/cavium: .
	octe
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: Fri, 23 Apr 2010 01:45:38 -0000

Author: jmallett
Date: Fri Apr 23 01:45:38 2010
New Revision: 207090
URL: http://svn.freebsd.org/changeset/base/207090

Log:
  Use a pseudo-bus to manage the octe interfaces and punt, for now, on giving
  them each their own device_t.

Added:
  user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 01:34:01 2010	(r207089)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 01:45:38 2010	(r207090)
@@ -27,6 +27,7 @@ mips/cavium/octe/ethernet-sgmii.c		optio
 mips/cavium/octe/ethernet-spi.c			optional octe
 mips/cavium/octe/ethernet-tx.c			optional octe
 mips/cavium/octe/ethernet-xaui.c		optional octe
+mips/cavium/octe/octebus.c			optional octe
 
 contrib/octeon-sdk/cvmx-bootmem.c		optional octe
 contrib/octeon-sdk/cvmx-cmd-queue.c		optional octe

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Fri Apr 23 01:34:01 2010	(r207089)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Fri Apr 23 01:45:38 2010	(r207090)
@@ -30,6 +30,9 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 int cvm_oct_common_init(struct ifnet *ifp);
 void cvm_oct_common_uninit(struct ifnet *ifp);
 
+int cvm_oct_init_module(void);
+void cvm_oct_cleanup_module(void);
+
 /*
  * XXX/juli
  * These belong elsewhere but we can't stomach the nested extern.

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 01:34:01 2010	(r207089)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 01:45:38 2010	(r207090)
@@ -327,16 +327,14 @@ int cvm_oct_free_work(void *work_queue_e
  *
  * @return Zero on success
  */
-static int cvm_oct_init_module(void)
+int cvm_oct_init_module(void)
 {
-	device_t dev;
+	int ifnum;
 	int num_interfaces;
 	int interface;
 	int fau = FAU_NUM_PACKET_BUFFERS_TO_FREE;
 	int qos;
 
-	dev = NULL;
-
 	printf("cavium-ethernet: %s\n", OCTEON_SDK_VERSION_STRING);
 
 #if 0
@@ -365,6 +363,8 @@ static int cvm_oct_init_module(void)
 
 	memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
 
+	ifnum = 0;
+
 	/* Initialize the FAU used for counting packet buffers that need to be freed */
 	cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
 
@@ -382,7 +382,9 @@ static int cvm_oct_init_module(void)
 			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
 			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
 			priv->queue = -1;
-			device_set_desc(dev, "Cavium Octeon POW Ethernet");
+
+			if_initname(ifp, "octe", ifnum++);
+			if_printf(ifp, "Cavium Octeon POW Ethernet\n");
 #if 0
 			for (qos = 0; qos < 16; qos++)
 				m_queue_head_init(&priv->tx_free_list[qos]);
@@ -438,6 +440,8 @@ static int cvm_oct_init_module(void)
 			for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++)
 				cvmx_fau_atomic_write32(priv->fau+qos*4, 0);
 
+			if_initname(ifp, "octe", ifnum++);
+
 			switch (priv->imode) {
 
 			/* These types don't support ports to IPD/PKO */
@@ -449,43 +453,43 @@ static int cvm_oct_init_module(void)
 			case CVMX_HELPER_INTERFACE_MODE_NPI:
 				priv->init = cvm_oct_common_init;
 				priv->uninit = cvm_oct_common_uninit;
-				device_set_desc(dev, "Cavium Octeon NPI Ethernet");
+				if_printf(ifp, "Cavium Octeon NPI Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_XAUI:
 				priv->init = cvm_oct_xaui_init;
 				priv->uninit = cvm_oct_xaui_uninit;
-				device_set_desc(dev, "Cavium Octeon XAUI Ethernet");
+				if_printf(ifp, "Cavium Octeon XAUI Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_LOOP:
 				priv->init = cvm_oct_common_init;
 				priv->uninit = cvm_oct_common_uninit;
-				device_set_desc(dev, "Cavium Octeon LOOP Ethernet");
+				if_printf(ifp, "Cavium Octeon LOOP Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SGMII:
 				priv->init = cvm_oct_sgmii_init;
 				priv->uninit = cvm_oct_sgmii_uninit;
-				device_set_desc(dev, "Cavium Octeon SGMII Ethernet");
+				if_printf(ifp, "Cavium Octeon SGMII Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SPI:
 				priv->init = cvm_oct_spi_init;
 				priv->uninit = cvm_oct_spi_uninit;
-				device_set_desc(dev, "Cavium Octeon SPI Ethernet");
+				if_printf(ifp, "Cavium Octeon SPI Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_RGMII:
 				priv->init = cvm_oct_rgmii_init;
 				priv->uninit = cvm_oct_rgmii_uninit;
-				device_set_desc(dev, "Cavium Octeon RGMII Ethernet");
+				if_printf(ifp, "Cavium Octeon RGMII Ethernet\n");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_GMII:
 				priv->init = cvm_oct_rgmii_init;
 				priv->uninit = cvm_oct_rgmii_uninit;
-				device_set_desc(dev, "Cavium Octeon GMII Ethernet");
+				if_printf(ifp, "Cavium Octeon GMII Ethernet\n");
 				break;
 			}
 
@@ -533,7 +537,7 @@ static int cvm_oct_init_module(void)
  *
  * @return Zero on success
  */
-static void cvm_oct_cleanup_module(void)
+void cvm_oct_cleanup_module(void)
 {
 	int port;
 
@@ -580,22 +584,3 @@ static void cvm_oct_cleanup_module(void)
 	if (CVMX_FPA_OUTPUT_BUFFER_POOL != CVMX_FPA_PACKET_POOL)
 		cvm_oct_mem_empty_fpa(CVMX_FPA_OUTPUT_BUFFER_POOL, CVMX_FPA_OUTPUT_BUFFER_POOL_SIZE, 128);
 }
-
-static int
-cvm_oct_modevent(module_t mod __unused, int type, void *data __unused)
-{
-	switch(type) {
-	case MOD_LOAD:
-		cvm_oct_init_module();
-		break;
-	case MOD_UNLOAD:
-	case MOD_SHUTDOWN:
-		cvm_oct_cleanup_module();
-		break;
-	default:
-		return (EOPNOTSUPP);
-        }
-	return (0);
-}
-DEV_MODULE(octe, cvm_oct_modevent, NULL);
-MODULE_VERSION(octe, 1);

Added: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 01:45:38 2010	(r207090)
@@ -0,0 +1,115 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Cavium Octeon Ethernet pseudo-bus attachment.
+ *
+ * XXX Would be nice to have a device for each iface.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/lock.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+
+#include "ethernet-common.h"
+
+static void		octebus_identify(driver_t *drv, device_t parent);
+static int		octebus_probe(device_t dev);
+static int		octebus_attach(device_t dev);
+static int		octebus_detach(device_t dev);
+static int		octebus_shutdown(device_t dev);
+
+static device_method_t octebus_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_identify,	octebus_identify),
+	DEVMETHOD(device_probe,		octebus_probe),
+	DEVMETHOD(device_attach,	octebus_attach),
+	DEVMETHOD(device_detach,	octebus_detach),
+	DEVMETHOD(device_shutdown,	octebus_shutdown),
+
+	{ 0, 0 }
+};
+
+static driver_t octebus_driver = {
+	"octebus",
+	octebus_methods,
+	1,
+};
+
+static devclass_t octebus_devclass;
+
+DRIVER_MODULE(octebus, nexus, octebus_driver, octebus_devclass, 0, 0);
+
+static void
+octebus_identify(driver_t *drv, device_t parent)
+{
+	BUS_ADD_CHILD(parent, 0, "octebus", 0);
+}
+
+static int
+octebus_probe(device_t dev)
+{
+	if (device_get_unit(dev) != 0)
+		return (ENXIO);
+	device_set_desc(dev, "Cavium Octeon Ethernet pseudo-bus");
+	return (0);
+}
+
+static int
+octebus_attach(device_t dev)
+{
+	int rv;
+
+	rv = cvm_oct_init_module();
+	if (rv != 0)
+		return (ENXIO);
+	return (0);
+}
+
+static int
+octebus_detach(device_t dev)
+{
+	cvm_oct_cleanup_module();
+	return (0);
+}
+
+static int
+octebus_shutdown(device_t dev)
+{
+	return (octebus_detach(dev));
+}

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 02:05:34 2010
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 9B9C9106564A;
	Fri, 23 Apr 2010 02:05:34 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8B7AE8FC15;
	Fri, 23 Apr 2010 02:05:34 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N25YLb059029;
	Fri, 23 Apr 2010 02:05:34 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N25YmO059027;
	Fri, 23 Apr 2010 02:05:34 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230205.o3N25YmO059027@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 02:05:34 +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: r207091 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 02:05:34 -0000

Author: jmallett
Date: Fri Apr 23 02:05:34 2010
New Revision: 207091
URL: http://svn.freebsd.org/changeset/base/207091

Log:
  Comment out a panic; no device infrastructure to hook MII up to.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Fri Apr 23 01:45:38 2010	(r207090)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Fri Apr 23 02:05:34 2010	(r207091)
@@ -230,10 +230,14 @@ int cvm_oct_ioctl(struct ifnet *ifp, str
  */
 int cvm_oct_mdio_setup_device(struct ifnet *ifp)
 {
+	/*
+	 * XXX/juli
+	 * Once we have a device_t for this interface, attach the MII bus to it.
+	 */
+#if 0
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int phy_id = cvmx_helper_board_get_mii_address(priv->port);
 	if (phy_id != -1) {
-#if 0
 		priv->mii_info.dev = dev;
 		priv->mii_info.phy_id = phy_id;
 		priv->mii_info.phy_id_mask = 0xff;
@@ -241,10 +245,8 @@ int cvm_oct_mdio_setup_device(struct ifn
 		priv->mii_info.reg_num_mask = 0x1f;
 		priv->mii_info.mdio_read = cvm_oct_mdio_read;
 		priv->mii_info.mdio_write = cvm_oct_mdio_write;
-#else
-		panic("%s: need add MII hooks.", __func__);
-#endif
 	}
+#endif
 	return 0;
 }
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 02:17:23 2010
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 273D11065672;
	Fri, 23 Apr 2010 02:17:23 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1737C8FC16;
	Fri, 23 Apr 2010 02:17:23 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N2HMEK061696;
	Fri, 23 Apr 2010 02:17:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N2HMbg061694;
	Fri, 23 Apr 2010 02:17:22 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230217.o3N2HMbg061694@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 02:17:22 +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: r207092 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 02:17:23 -0000

Author: jmallett
Date: Fri Apr 23 02:17:22 2010
New Revision: 207092
URL: http://svn.freebsd.org/changeset/base/207092

Log:
  Since we don't treat the MAC address like a 64-bit word in this routine,
  don't prepend 2 bytes of 0 to it.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 02:05:34 2010	(r207091)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 02:17:22 2010	(r207092)
@@ -156,7 +156,7 @@ static int cvm_oct_common_set_mac_addres
 		uint8_t *ptr = addr;
 		uint64_t mac = 0;
 		for (i = 0; i < 6; i++)
-			mac = (mac<<8) | (uint64_t)(ptr[i+2]);
+			mac = (mac<<8) | (uint64_t)(ptr[i]);
 
 		gmx_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
 		cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64 & ~1ull);
@@ -233,7 +233,7 @@ static int cvm_oct_common_change_mtu(str
 int cvm_oct_common_init(struct ifnet *ifp)
 {
 	static int count;
-	char mac[8] = {0x00, 0x00,
+	char mac[6] = {
 		octeon_bootinfo->mac_addr_base[0],
 		octeon_bootinfo->mac_addr_base[1],
 		octeon_bootinfo->mac_addr_base[2],

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 02:31:28 2010
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 B21CA106566B;
	Fri, 23 Apr 2010 02:31:28 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id A17818FC21;
	Fri, 23 Apr 2010 02:31:28 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N2VS1q064848;
	Fri, 23 Apr 2010 02:31:28 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N2VSQa064846;
	Fri, 23 Apr 2010 02:31:28 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230231.o3N2VSQa064846@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 02:31:28 +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: r207093 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 02:31:28 -0000

Author: jmallett
Date: Fri Apr 23 02:31:28 2010
New Revision: 207093
URL: http://svn.freebsd.org/changeset/base/207093

Log:
  o) Convert some module parameters to tunables.  (One should be a sysctl.)
  o) If we create a POW device, call it pow0 rather than throwing off the
     numbering of all of the octe* devices.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 02:17:22 2010	(r207092)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 02:31:28 2010	(r207093)
@@ -53,37 +53,30 @@ int num_packet_buffers = CONFIG_CAVIUM_O
 #else
 int num_packet_buffers = 1024;
 #endif
-#if 0
-module_param(num_packet_buffers, int, 0444);
-MODULE_PARM_DESC(num_packet_buffers, "\n"
+TUNABLE_INT("hw.octe.num_packet_buffers", &num_packet_buffers);
+/*
 		 "\t\tNumber of packet buffers to allocate and store in the\n"
 		 "\t\tFPA. By default, 1024 packet buffers are used unless\n"
-		 "\t\tCONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS is defined.");
-#endif
+		 "\t\tCONFIG_CAVIUM_OCTEON_NUM_PACKET_BUFFERS is defined." */
 
 int pow_receive_group = 15;
-#if 0
-module_param(pow_receive_group, int, 0444);
-MODULE_PARM_DESC(pow_receive_group, "\n"
+TUNABLE_INT("hw.octe.pow_receive_group", &pow_receive_group);
+/*
 		 "\t\tPOW group to receive packets from. All ethernet hardware\n"
 		 "\t\twill be configured to send incomming packets to this POW\n"
 		 "\t\tgroup. Also any other software can submit packets to this\n"
-		 "\t\tgroup for the kernel to process.");
-#endif
+		 "\t\tgroup for the kernel to process." */
 
-int pow_send_group = -1;
-#if 0
-module_param(pow_send_group, int, 0644);
-MODULE_PARM_DESC(pow_send_group, "\n"
+int pow_send_group = -1; /* XXX Should be a sysctl.  */
+TUNABLE_INT("hw.octe.pow_send_group", &pow_send_group);
+/*
 		 "\t\tPOW group to send packets to other software on. This\n"
 		 "\t\tcontrols the creation of the virtual device pow0.\n"
-		 "\t\talways_use_pow also depends on this value.");
-#endif
+		 "\t\talways_use_pow also depends on this value." */
 
 int always_use_pow;
-#if 0
-module_param(always_use_pow, int, 0444);
-MODULE_PARM_DESC(always_use_pow, "\n"
+TUNABLE_INT("hw.octe.always_use_pow", &always_use_pow);
+/*
 		 "\t\tWhen set, always send to the pow group. This will cause\n"
 		 "\t\tpackets sent to real ethernet devices to be sent to the\n"
 		 "\t\tPOW group instead of the hardware. Unless some other\n"
@@ -91,30 +84,25 @@ MODULE_PARM_DESC(always_use_pow, "\n"
 		 "\t\treceived from the low level hardware. Use this option\n"
 		 "\t\tto allow a CVMX app to intercept all packets from the\n"
 		 "\t\tlinux kernel. You must specify pow_send_group along with\n"
-		 "\t\tthis option.");
-#endif
+		 "\t\tthis option." */
 
 char pow_send_list[128] = "";
-#if 0
-module_param_string(pow_send_list, pow_send_list, sizeof(pow_send_list), 0444);
-MODULE_PARM_DESC(pow_send_list, "\n"
+TUNABLE_STRING("hw.octe.pow_send_list", pow_send_list, sizeof pow_send_list);
+/*
 		 "\t\tComma separated list of ethernet devices that should use the\n"
 		 "\t\tPOW for transmit instead of the actual ethernet hardware. This\n"
 		 "\t\tis a per port version of always_use_pow. always_use_pow takes\n"
 		 "\t\tprecedence over this list. For example, setting this to\n"
 		 "\t\t\"eth2,spi3,spi7\" would cause these three devices to transmit\n"
-		 "\t\tusing the pow_send_group.");
-#endif
+		 "\t\tusing the pow_send_group." */
 
 
-#if 0
 static int disable_core_queueing = 1;
-module_param(disable_core_queueing, int, 0444);
-MODULE_PARM_DESC(disable_core_queueing, "\n"
+TUNABLE_INT("hw.octe.disable_core_queueing", &disable_core_queueing);
+/*
 		"\t\tWhen set the networking core's tx_queue_len is set to zero.  This\n"
 		"\t\tallows packets to be sent without lock contention in the packet scheduler\n"
-		"\t\tresulting in some cases in improved throughput.\n");
-#endif
+		"\t\tresulting in some cases in improved throughput.\n" */
 
 extern int octeon_is_simulation(void);
 
@@ -363,8 +351,6 @@ int cvm_oct_init_module(void)
 
 	memset(cvm_oct_device, 0, sizeof(cvm_oct_device));
 
-	ifnum = 0;
-
 	/* Initialize the FAU used for counting packet buffers that need to be freed */
 	cvmx_fau_atomic_write32(FAU_NUM_PACKET_BUFFERS_TO_FREE, 0);
 
@@ -383,7 +369,7 @@ int cvm_oct_init_module(void)
 			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
 			priv->queue = -1;
 
-			if_initname(ifp, "octe", ifnum++);
+			if_initname(ifp, "pow", 0);
 			if_printf(ifp, "Cavium Octeon POW Ethernet\n");
 #if 0
 			for (qos = 0; qos < 16; qos++)
@@ -405,6 +391,7 @@ int cvm_oct_init_module(void)
 		}
 	}
 
+	ifnum = 0;
 	num_interfaces = cvmx_helper_get_number_of_interfaces();
 	for (interface = 0; interface < num_interfaces; interface++) {
 		cvmx_helper_interface_mode_t imode = cvmx_helper_interface_get_mode(interface);

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 06:01:26 2010
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 86CE2106564A;
	Fri, 23 Apr 2010 06:01:26 +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 76DB98FC13;
	Fri, 23 Apr 2010 06:01:26 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N61QZn011429;
	Fri, 23 Apr 2010 06:01:26 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N61QPf011427;
	Fri, 23 Apr 2010 06:01:26 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004230601.o3N61QPf011427@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Fri, 23 Apr 2010 06:01:26 +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: r207097 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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: Fri, 23 Apr 2010 06:01:26 -0000

Author: kmacy
Date: Fri Apr 23 06:01:26 2010
New Revision: 207097
URL: http://svn.freebsd.org/changeset/base/207097

Log:
  - don't check page queue in get_pv_entry it no longer applies
  - add comment about pv_list in demote

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Fri Apr 23 03:37:39 2010	(r207096)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Fri Apr 23 06:01:26 2010	(r207097)
@@ -2272,8 +2272,7 @@ get_pv_entry(pmap_t pmap)
 		}
 	}
 	/* No free items, allocate another chunk */
-	m = vm_page_alloc(NULL, colour, (pq == &vm_page_queues[PQ_ACTIVE] ?
-	    VM_ALLOC_SYSTEM : VM_ALLOC_NORMAL) | VM_ALLOC_NOOBJ |
+	m = vm_page_alloc(NULL, colour, VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ |
 	    VM_ALLOC_WIRED);
 	if (m == NULL) {
 		PV_STAT(pc_chunk_tryfail++);
@@ -2738,6 +2737,11 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 			PA_UNLOCK(pa);
 	}
 	if (pmap == kernel_pmap) {
+		/*
+		 *
+		 * Our inability to fail here implies that we should
+		 * always be passed a pv_list if pmap == kernel_pmap
+		 */
 		if (!pmap_demote_pde(pmap, pdq, sva, pv_list))
 			panic("pmap_remove_pde: failed demotion");
 	} else {

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 07:32:42 2010
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 EE8801065672;
	Fri, 23 Apr 2010 07:32:42 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id DDB9D8FC0C;
	Fri, 23 Apr 2010 07:32:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N7Wg5b031431;
	Fri, 23 Apr 2010 07:32:42 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N7WgON031429;
	Fri, 23 Apr 2010 07:32:42 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230732.o3N7WgON031429@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 07:32:42 +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: r207098 - user/jmallett/octeon/sys/mips/cavium
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: Fri, 23 Apr 2010 07:32:43 -0000

Author: jmallett
Date: Fri Apr 23 07:32:42 2010
New Revision: 207098
URL: http://svn.freebsd.org/changeset/base/207098

Log:
  Store realmem and physmem in pages.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c

Modified: user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 06:01:26 2010	(r207097)
+++ user/jmallett/octeon/sys/mips/cavium/octeon_machdep.c	Fri Apr 23 07:32:42 2010	(r207098)
@@ -233,7 +233,7 @@ octeon_memory_init(void)
 		phys_avail[0] = phys_end;
 		phys_avail[1] = 96 << 20;
 
-		physmem = phys_avail[1] - phys_avail[0];
+		realmem = physmem = btoc(phys_avail[1] - phys_avail[0]);
 		return;
 	}
 
@@ -248,7 +248,7 @@ octeon_memory_init(void)
 		if (addr == -1)
 			break;
 
-		physmem += 1 << 20;
+		physmem += btoc(1 << 20);
 
 		if (i > 0 && phys_avail[i - 1] == addr) {
 			phys_avail[i - 1] += 1 << 20;
@@ -260,6 +260,8 @@ octeon_memory_init(void)
 
 		i += 2;
 	}
+
+	realmem = physmem;
 }
 
 void

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 08:49:16 2010
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 8F215106566C;
	Fri, 23 Apr 2010 08:49:16 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 7CA8D8FC13;
	Fri, 23 Apr 2010 08:49:16 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N8nG9b048503;
	Fri, 23 Apr 2010 08:49:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N8nG0F048497;
	Fri, 23 Apr 2010 08:49:16 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230849.o3N8nG0F048497@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 08:49:16 +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: r207104 - in user/jmallett/octeon/sys/mips: cavium
	cavium/octe conf
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: Fri, 23 Apr 2010 08:49:16 -0000

Author: jmallett
Date: Fri Apr 23 08:49:16 2010
New Revision: 207104
URL: http://svn.freebsd.org/changeset/base/207104

Log:
  o) Add a bus, ciu, which provides access to the Octeon interrupt controller to
     devices that hang off of it and which passes everything else through to
     nexus.  It should likely be a nexus subclass instead of a bus in the
     hierarchy, but this will do for now.
  o) While here fix octe build.

Added:
  user/jmallett/octeon/sys/mips/cavium/ciu.c
Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
  user/jmallett/octeon/sys/mips/conf/OCTEON1.hints

Added: user/jmallett/octeon/sys/mips/cavium/ciu.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/ciu.c	Fri Apr 23 08:49:16 2010	(r207104)
@@ -0,0 +1,332 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#include <sys/cdefs.h>
+__FBSDID("$FreeBSD: user/jmallett/octeon/sys/mips/cavium/ciu.c 206986 2010-04-21 07:28:57Z jmallett $");
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/interrupt.h>
+#include <sys/kernel.h>
+#include <sys/module.h>
+#include <sys/rman.h>
+#include <sys/malloc.h>
+
+#include <machine/bus.h>
+
+#include <contrib/octeon-sdk/cvmx.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
+
+/*
+ * This bus sits between devices/buses and nexus and handles CIU interrupts
+ * and passes everything else through.  It should really be a nexus subclass
+ * or something, but for now this will be sufficient.
+ */
+
+#define	CIU_IRQ_HARD		(0)
+
+#define	CIU_IRQ_EN0_BEGIN	CVMX_IRQ_WORKQ0
+#define	CIU_IRQ_EN0_END		(CVMX_IRQ_BOOTDMA + 1)
+
+#define	CIU_IRQ_EN1_BEGIN	CVMX_IRQ_WDOG0
+#define	CIU_IRQ_EN1_END		(CVMX_IRQ_WDOG15 + 1)
+
+struct ciu_softc {
+	struct rman irq_rman;
+	struct resource *ciu_irq;
+};
+
+static struct intr_event *ciu_en0_intr_events[CIU_IRQ_EN0_END - CIU_IRQ_EN0_BEGIN];
+static struct intr_event *ciu_en1_intr_events[CIU_IRQ_EN1_END - CIU_IRQ_EN1_BEGIN];
+
+static int		ciu_probe(device_t);
+static int		ciu_attach(device_t);
+static struct resource	*ciu_alloc_resource(device_t, device_t, int, int *,
+					    u_long, u_long, u_long, u_int);
+static int		ciu_setup_intr(device_t, device_t, struct resource *,
+				       int, driver_filter_t *, driver_intr_t *,
+				       void *, void **);
+static void		ciu_hinted_child(device_t, const char *, int);
+
+static void		ciu_en0_intr_mask(void *);
+static void		ciu_en0_intr_unmask(void *);
+
+static void		ciu_en1_intr_mask(void *);
+static void		ciu_en1_intr_unmask(void *);
+
+static int		ciu_intr(void *);
+
+static int
+ciu_probe(device_t dev)
+{
+	if (device_get_unit(dev) != 0)
+		return (ENXIO);
+
+	device_set_desc(dev, "Cavium Octeon Central Interrupt Unit");
+	return (0);
+}
+
+static int
+ciu_attach(device_t dev)
+{
+	struct ciu_softc *sc;
+	int error;
+	int rid;
+
+	sc = device_get_softc(dev);
+
+	rid = 0;
+	sc->ciu_irq = bus_alloc_resource(dev, SYS_RES_IRQ, &rid, CIU_IRQ_HARD,
+					 CIU_IRQ_HARD, 1, RF_ACTIVE);
+	if (sc->ciu_irq == NULL) {
+		device_printf(dev, "could not allocate irq%d\n", CIU_IRQ_HARD);
+		return (ENXIO);
+	}
+
+	error = bus_setup_intr(dev, sc->ciu_irq, INTR_TYPE_MISC, ciu_intr,
+			       NULL, sc, NULL);
+	if (error != 0) {
+		device_printf(dev, "bus_setup_intr failed: %d\n", error);
+		return (error);
+	}
+
+	sc->irq_rman.rm_type = RMAN_ARRAY;
+	sc->irq_rman.rm_descr = "CIU IRQ";
+	
+	error = rman_init(&sc->irq_rman);
+	if (error != 0)
+		return (error);
+
+	/*
+	 * We have two contiguous IRQ regions, use a single rman.
+	 */
+	error = rman_manage_region(&sc->irq_rman, CIU_IRQ_EN0_BEGIN,
+				   CIU_IRQ_EN1_END);
+	if (error != 0)
+		return (error);
+
+	bus_generic_probe(dev);
+	bus_generic_attach(dev);
+
+	return (0);
+}
+
+static struct resource *
+ciu_alloc_resource(device_t bus, device_t child, int type, int *rid,
+		   u_long start, u_long end, u_long count, u_int flags)
+{
+	struct resource *res;
+	struct ciu_softc *sc;
+	
+	sc = device_get_softc(bus);
+
+	switch (type) {
+	case SYS_RES_IRQ:
+		break;
+	default:
+		return (bus_alloc_resource(device_get_parent(bus), type, rid,
+					   start, end, count, flags));
+	}
+
+	/*
+	 * One interrupt at a time for now.
+	 */
+	if (start != end)
+		return (NULL);
+
+	res = rman_reserve_resource(&sc->irq_rman, start, end, count, flags,
+				    child);
+	if (res != NULL)
+		return (res);
+
+	return (NULL);
+}
+
+static int
+ciu_setup_intr(device_t bus, device_t child, struct resource *res, int flags,
+	       driver_filter_t *filter, driver_intr_t *intr, void *arg,
+	       void **cookiep)
+{
+	struct intr_event *event, **eventp;
+	void (*mask_func)(void *);
+	void (*unmask_func)(void *);
+	int error;
+	int irq;
+
+	irq = rman_get_start(res);
+	if (irq < CIU_IRQ_EN0_END) {
+		eventp = &ciu_en0_intr_events[irq - CIU_IRQ_EN0_BEGIN];
+		mask_func = ciu_en0_intr_mask;
+		unmask_func = ciu_en0_intr_unmask;
+	} else {
+		eventp = &ciu_en1_intr_events[irq - CIU_IRQ_EN1_BEGIN];
+		mask_func = ciu_en1_intr_mask;
+		unmask_func = ciu_en1_intr_unmask;
+	}
+
+	if ((event = *eventp) == NULL) {
+		error = intr_event_create(eventp, (void *)(uintptr_t)irq, 0,
+		    irq, mask_func, unmask_func, NULL, NULL, "int%d", irq);
+		if (error != 0)
+			return (error);
+
+		event = *eventp;
+
+		unmask_func((void *)(uintptr_t)irq);
+	}
+
+	intr_event_add_handler(event, device_get_nameunit(child),
+	    filter, intr, arg, intr_priority(flags), flags, cookiep);
+
+	return (0);
+}
+
+static void
+ciu_hinted_child(device_t bus, const char *dname, int dunit)
+{
+	BUS_ADD_CHILD(bus, 0, dname, dunit);
+}
+
+static void
+ciu_en0_intr_mask(void *arg)
+{
+	uint64_t mask;
+	int irq;
+
+	irq = (uintptr_t)arg;
+	mask = cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2));
+	mask &= ~(1ull << (irq - CIU_IRQ_EN0_BEGIN));
+	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2), mask);
+}
+
+static void
+ciu_en0_intr_unmask(void *arg)
+{
+	uint64_t mask;
+	int irq;
+
+	irq = (uintptr_t)arg;
+	mask = cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2));
+	mask |= 1ull << (irq - CIU_IRQ_EN0_BEGIN);
+	cvmx_write_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2), mask);
+}
+
+static void
+ciu_en1_intr_mask(void *arg)
+{
+	uint64_t mask;
+	int irq;
+
+	irq = (uintptr_t)arg;
+	mask = cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2));
+	mask &= ~(1ull << (irq - CIU_IRQ_EN1_BEGIN));
+	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2), mask);
+}
+
+static void
+ciu_en1_intr_unmask(void *arg)
+{
+	uint64_t mask;
+	int irq;
+
+	irq = (uintptr_t)arg;
+	mask = cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2));
+	mask |= 1ull << (irq - CIU_IRQ_EN1_BEGIN);
+	cvmx_write_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2), mask);
+}
+
+static int
+ciu_intr(void *arg)
+{
+	struct ciu_softc *sc;
+	uint64_t en0_sum, en1_sum;
+	uint64_t en0_mask, en1_mask;
+	int irq_index;
+	int error;
+
+	sc = arg;
+	(void)sc;
+
+	en0_sum = cvmx_read_csr(CVMX_CIU_INTX_SUM0(cvmx_get_core_num()*2));
+	en1_sum = cvmx_read_csr(CVMX_CIU_INT_SUM1);
+
+	en0_mask = cvmx_read_csr(CVMX_CIU_INTX_EN0(cvmx_get_core_num()*2));
+	en1_mask = cvmx_read_csr(CVMX_CIU_INTX_EN1(cvmx_get_core_num()*2));
+
+	en0_sum &= en0_mask;
+	en1_sum &= en1_mask;
+
+	if (en0_sum == 0 && en1_sum == 0)
+		return (FILTER_STRAY);
+
+	irq_index = 0;
+	for (irq_index = 0; en0_sum != 0; irq_index++, en0_sum >>= 1) {
+		if ((en0_sum & 1) == 0)
+			continue;
+
+		error = intr_event_handle(ciu_en0_intr_events[irq_index], NULL);
+		if (error != 0)
+			printf("%s: stray en0 irq%d\n", __func__, irq_index);
+	}
+
+	irq_index = 0;
+	for (irq_index = 0; en1_sum != 0; irq_index++, en1_sum >>= 1) {
+		if ((en1_sum & 1) == 0)
+			continue;
+
+		error = intr_event_handle(ciu_en1_intr_events[irq_index], NULL);
+		if (error != 0)
+			printf("%s: stray en1 irq%d\n", __func__, irq_index);
+	}
+
+	return (FILTER_HANDLED);
+}
+
+static device_method_t ciu_methods[] = {
+	DEVMETHOD(device_probe,		ciu_probe),
+	DEVMETHOD(device_attach,	ciu_attach),
+
+	DEVMETHOD(bus_alloc_resource,	ciu_alloc_resource),
+	DEVMETHOD(bus_activate_resource,bus_generic_activate_resource),
+	DEVMETHOD(bus_setup_intr,	ciu_setup_intr),
+	DEVMETHOD(bus_teardown_intr,	bus_generic_teardown_intr),
+
+	DEVMETHOD(bus_add_child,	bus_generic_add_child),
+	DEVMETHOD(bus_hinted_child,	ciu_hinted_child),
+
+	{ 0, 0 }
+};
+
+static driver_t ciu_driver = {
+	"ciu",
+	ciu_methods,
+	sizeof(struct ciu_softc),
+};
+static devclass_t ciu_devclass;
+DRIVER_MODULE(ciu, nexus, ciu_driver, ciu_devclass, 0, 0);

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 08:46:42 2010	(r207103)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 08:49:16 2010	(r207104)
@@ -2,6 +2,7 @@
 # Octeon Support Files
 #
 mips/cavium/asm_octeon.S			optional smp
+mips/cavium/ciu.c				standard
 mips/cavium/obio.c				optional uart
 mips/cavium/octeon_ebt3000_cf.c			optional cf
 mips/cavium/octeon_machdep.c			standard

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 08:46:42 2010	(r207103)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 08:49:16 2010	(r207104)
@@ -87,7 +87,7 @@ TUNABLE_INT("hw.octe.always_use_pow", &a
 		 "\t\tthis option." */
 
 char pow_send_list[128] = "";
-TUNABLE_STRING("hw.octe.pow_send_list", pow_send_list, sizeof pow_send_list);
+TUNABLE_STR("hw.octe.pow_send_list", pow_send_list, sizeof pow_send_list);
 /*
 		 "\t\tComma separated list of ethernet devices that should use the\n"
 		 "\t\tPOW for transmit instead of the actual ethernet hardware. This\n"

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 08:46:42 2010	(r207103)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 08:49:16 2010	(r207104)
@@ -73,7 +73,7 @@ static driver_t octebus_driver = {
 
 static devclass_t octebus_devclass;
 
-DRIVER_MODULE(octebus, nexus, octebus_driver, octebus_devclass, 0, 0);
+DRIVER_MODULE(octebus, ciu, octebus_driver, octebus_devclass, 0, 0);
 
 static void
 octebus_identify(driver_t *drv, device_t parent)

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1.hints
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Fri Apr 23 08:46:42 2010	(r207103)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1.hints	Fri Apr 23 08:49:16 2010	(r207104)
@@ -2,6 +2,7 @@
 # device.hints
 # All these values are complete nonsense...
 hw.uart.console="io:0x1"
+hint.ciu.0.at="nexus"
 hint.obio.0.at="nexus"
 hint.obio.0.maddr="0x1"
 hint.obio.0.msize="0x1"

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 09:29:32 2010
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 372F8106564A;
	Fri, 23 Apr 2010 09:29:32 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 249A08FC25;
	Fri, 23 Apr 2010 09:29:32 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3N9TV4i057773;
	Fri, 23 Apr 2010 09:29:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3N9TVg3057769;
	Fri, 23 Apr 2010 09:29:31 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004230929.o3N9TVg3057769@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 09:29:31 +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: r207107 - in user/jmallett/octeon/sys/mips/cavium: .
	octe
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: Fri, 23 Apr 2010 09:29:32 -0000

Author: jmallett
Date: Fri Apr 23 09:29:30 2010
New Revision: 207107
URL: http://svn.freebsd.org/changeset/base/207107

Log:
  o) Add device attachments for octe and pow devices.
     XXX It would be nice if bus_add_child had a default that returned NULL
         instead of, seemingly, a nonzero errno.

Added:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c
Modified:
  user/jmallett/octeon/sys/mips/cavium/files.octeon1
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebus.c

Modified: user/jmallett/octeon/sys/mips/cavium/files.octeon1
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/files.octeon1	Fri Apr 23 09:29:30 2010	(r207107)
@@ -28,6 +28,7 @@ mips/cavium/octe/ethernet-sgmii.c		optio
 mips/cavium/octe/ethernet-spi.c			optional octe
 mips/cavium/octe/ethernet-tx.c			optional octe
 mips/cavium/octe/ethernet-xaui.c		optional octe
+mips/cavium/octe/octe.c				optional octe
 mips/cavium/octe/octebus.c			optional octe
 
 contrib/octeon-sdk/cvmx-bootmem.c		optional octe

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Fri Apr 23 09:29:30 2010	(r207107)
@@ -98,9 +98,11 @@ typedef struct {
 	void (*poll)(struct ifnet *ifp);   /* Called periodically to check link status */
 
 	/*
-	 * XXX/juli
-	 * I think we'll need to wrap these with the normal ifnet glue.
+	 * FreeBSD additions.
 	 */
+	device_t dev;
+	struct ifnet *ifp;
+
 	int (*open)(struct ifnet *ifp);
 	int (*stop)(struct ifnet *ifp);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 09:29:30 2010	(r207107)
@@ -242,6 +242,7 @@ int cvm_oct_common_init(struct ifnet *if
 		octeon_bootinfo->mac_addr_base[5] + count};
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
+	device_attach(priv->dev);
 
 	/* Force the interface to use the POW send if always_use_pow was
 	   specified or it is in the pow send list */
@@ -284,6 +285,7 @@ int cvm_oct_common_init(struct ifnet *if
 	memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats));
 #endif
 
+	if_initname(ifp, device_get_name(priv->dev), device_get_unit(priv->dev));
 	ether_ifattach(ifp, mac);
 
 	return 0;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Fri Apr 23 09:29:30 2010	(r207107)
@@ -30,7 +30,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 int cvm_oct_common_init(struct ifnet *ifp);
 void cvm_oct_common_uninit(struct ifnet *ifp);
 
-int cvm_oct_init_module(void);
+int cvm_oct_init_module(device_t);
 void cvm_oct_cleanup_module(void);
 
 /*

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 09:29:30 2010	(r207107)
@@ -315,8 +315,9 @@ int cvm_oct_free_work(void *work_queue_e
  *
  * @return Zero on success
  */
-int cvm_oct_init_module(void)
+int cvm_oct_init_module(device_t bus)
 {
+	device_t dev;
 	int ifnum;
 	int num_interfaces;
 	int interface;
@@ -358,19 +359,24 @@ int cvm_oct_init_module(void)
 		struct ifnet *ifp;
 
 		printf("\tConfiguring device for POW only access\n");
-		ifp = if_alloc(IFT_ETHER);
-		if (ifp) {
+		dev = BUS_ADD_CHILD(bus, 0, "pow", 0);
+		if (dev != NULL)
+			ifp = if_alloc(IFT_ETHER);
+		if (dev != NULL && ifp != NULL) {
 			/* Initialize the device private structure. */
 			cvm_oct_private_t *priv;
-			
-			priv = malloc(sizeof(cvm_oct_private_t), M_TEMP, M_WAITOK | M_ZERO);
+
+			device_probe(dev);
+			priv = device_get_softc(dev);
+			priv->dev = dev;
+			priv->ifp = ifp;
 			priv->init = cvm_oct_common_init;
 			priv->imode = CVMX_HELPER_INTERFACE_MODE_DISABLED;
 			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
 			priv->queue = -1;
 
 			if_initname(ifp, "pow", 0);
-			if_printf(ifp, "Cavium Octeon POW Ethernet\n");
+			device_set_desc(dev, "Cavium Octeon POW Ethernet\n");
 #if 0
 			for (qos = 0; qos < 16; qos++)
 				m_queue_head_init(&priv->tx_free_list[qos]);
@@ -402,8 +408,10 @@ int cvm_oct_init_module(void)
 			cvm_oct_private_t *priv;
 			struct ifnet *ifp;
 			
-			ifp = if_alloc(IFT_ETHER);
-			if (!ifp) {
+			dev = BUS_ADD_CHILD(bus, 0, "octe", ifnum++);
+			if (dev != NULL)
+				ifp = if_alloc(IFT_ETHER);
+			if (dev == NULL || ifp == NULL) {
 				printf("\t\tFailed to allocate ethernet device for port %d\n", port);
 				continue;
 			}
@@ -414,7 +422,10 @@ int cvm_oct_init_module(void)
 #endif
 
 			/* Initialize the device private structure. */
-			priv = malloc(sizeof(cvm_oct_private_t), M_TEMP, M_WAITOK | M_ZERO);
+			device_probe(dev);
+			priv = device_get_softc(dev);
+			priv->dev = dev;
+			priv->ifp = ifp;
 			priv->imode = imode;
 			priv->port = port;
 			priv->queue = cvmx_pko_get_base_queue(priv->port);
@@ -427,8 +438,6 @@ int cvm_oct_init_module(void)
 			for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++)
 				cvmx_fau_atomic_write32(priv->fau+qos*4, 0);
 
-			if_initname(ifp, "octe", ifnum++);
-
 			switch (priv->imode) {
 
 			/* These types don't support ports to IPD/PKO */
@@ -440,43 +449,43 @@ int cvm_oct_init_module(void)
 			case CVMX_HELPER_INTERFACE_MODE_NPI:
 				priv->init = cvm_oct_common_init;
 				priv->uninit = cvm_oct_common_uninit;
-				if_printf(ifp, "Cavium Octeon NPI Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon NPI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_XAUI:
 				priv->init = cvm_oct_xaui_init;
 				priv->uninit = cvm_oct_xaui_uninit;
-				if_printf(ifp, "Cavium Octeon XAUI Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon XAUI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_LOOP:
 				priv->init = cvm_oct_common_init;
 				priv->uninit = cvm_oct_common_uninit;
-				if_printf(ifp, "Cavium Octeon LOOP Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon LOOP Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SGMII:
 				priv->init = cvm_oct_sgmii_init;
 				priv->uninit = cvm_oct_sgmii_uninit;
-				if_printf(ifp, "Cavium Octeon SGMII Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon SGMII Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_SPI:
 				priv->init = cvm_oct_spi_init;
 				priv->uninit = cvm_oct_spi_uninit;
-				if_printf(ifp, "Cavium Octeon SPI Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon SPI Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_RGMII:
 				priv->init = cvm_oct_rgmii_init;
 				priv->uninit = cvm_oct_rgmii_uninit;
-				if_printf(ifp, "Cavium Octeon RGMII Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon RGMII Ethernet");
 				break;
 
 			case CVMX_HELPER_INTERFACE_MODE_GMII:
 				priv->init = cvm_oct_rgmii_init;
 				priv->uninit = cvm_oct_rgmii_uninit;
-				if_printf(ifp, "Cavium Octeon GMII Ethernet\n");
+				device_set_desc(dev, "Cavium Octeon GMII Ethernet");
 				break;
 			}
 

Added: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Fri Apr 23 09:29:30 2010	(r207107)
@@ -0,0 +1,107 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+/*
+ * Cavium Octeon Ethernet devices.
+ */
+
+#include <sys/param.h>
+#include <sys/systm.h>
+#include <sys/bus.h>
+#include <sys/endian.h>
+#include <sys/kernel.h>
+#include <sys/mbuf.h>
+#include <sys/lock.h>
+#include <sys/module.h>
+#include <sys/mutex.h>
+#include <sys/rman.h>
+#include <sys/socket.h>
+#include <sys/sockio.h>
+#include <sys/sysctl.h>
+
+#include "wrapper-cvmx-includes.h"
+#include "cavium-ethernet.h"
+
+static int		octe_probe(device_t dev);
+static int		octe_attach(device_t dev);
+static int		octe_detach(device_t dev);
+static int		octe_shutdown(device_t dev);
+
+static device_method_t octe_methods[] = {
+	/* Device interface */
+	DEVMETHOD(device_probe,		octe_probe),
+	DEVMETHOD(device_attach,	octe_attach),
+	DEVMETHOD(device_detach,	octe_detach),
+	DEVMETHOD(device_shutdown,	octe_shutdown),
+
+	{ 0, 0 }
+};
+
+static driver_t octe_driver = {
+	"octe",
+	octe_methods,
+	sizeof (cvm_oct_private_t),
+};
+
+static devclass_t octe_devclass;
+
+DRIVER_MODULE(octe, octebus, octe_driver, octe_devclass, 0, 0);
+
+static driver_t pow_driver = {
+	"pow",
+	octe_methods,
+	sizeof (cvm_oct_private_t),
+};
+
+static devclass_t pow_devclass;
+
+DRIVER_MODULE(pow, octebus, pow_driver, pow_devclass, 0, 0);
+
+static int
+octe_probe(device_t dev)
+{
+	return (0);
+}
+
+static int
+octe_attach(device_t dev)
+{
+	return (0);
+}
+
+static int
+octe_detach(device_t dev)
+{
+	return (0);
+}
+
+static int
+octe_shutdown(device_t dev)
+{
+	return (octe_detach(dev));
+}

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 09:09:39 2010	(r207106)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 09:29:30 2010	(r207107)
@@ -28,8 +28,6 @@
 
 /*
  * Cavium Octeon Ethernet pseudo-bus attachment.
- *
- * XXX Would be nice to have a device for each iface.
  */
 
 #include <sys/param.h>
@@ -62,6 +60,9 @@ static device_method_t octebus_methods[]
 	DEVMETHOD(device_detach,	octebus_detach),
 	DEVMETHOD(device_shutdown,	octebus_shutdown),
 
+	/* Bus interface.  */
+	DEVMETHOD(bus_add_child,	bus_generic_add_child),
+
 	{ 0, 0 }
 };
 
@@ -95,9 +96,10 @@ octebus_attach(device_t dev)
 {
 	int rv;
 
-	rv = cvm_oct_init_module();
+	rv = cvm_oct_init_module(dev);
 	if (rv != 0)
 		return (ENXIO);
+
 	return (0);
 }
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 10:10:27 2010
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 9BD581065673;
	Fri, 23 Apr 2010 10:10:27 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 51C298FC17;
	Fri, 23 Apr 2010 10:10:27 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NAAR80066856;
	Fri, 23 Apr 2010 10:10:27 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NAARIG066849;
	Fri, 23 Apr 2010 10:10:27 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231010.o3NAARIG066849@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 10:10:27 +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: r207109 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 10:10:27 -0000

Author: jmallett
Date: Fri Apr 23 10:10:26 2010
New Revision: 207109
URL: http://svn.freebsd.org/changeset/base/207109

Log:
  Connect up the receive interrupt.

Added:
  user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h
Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
  user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Fri Apr 23 09:44:30 2010	(r207108)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Fri Apr 23 10:10:26 2010	(r207109)
@@ -35,6 +35,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/smp.h>
+#include <sys/taskqueue.h>
 
 #include <net/ethernet.h>
 #include <net/if.h>
@@ -44,18 +45,9 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 
 extern int pow_receive_group;
 extern struct ifnet *cvm_oct_device[];
-#if 0
-struct cvm_tasklet_wrapper
-{
-	struct tasklet_struct t;
-};// ____cacheline_aligned_in_smp;
 
-/* Aligning the tasklet_struct on cachline boundries seems to decrease
- * throughput even though in theory it would reduce contantion on the
- * cache lines containing the locks. */
-
-static struct cvm_tasklet_wrapper cvm_oct_tasklet[MAXCPU]; // __cacheline_aligned_in_smp;
-#endif
+static struct task cvm_oct_task;
+static struct taskqueue *cvm_oct_taskq;
 
 /**
  * Interrupt handler. The interrupt occurs whenever the POW
@@ -66,20 +58,15 @@ static struct cvm_tasklet_wrapper cvm_oc
  * @param regs
  * @return
  */
-int cvm_oct_do_interrupt(int cpl, void *dev_id)
+int cvm_oct_do_interrupt(void *dev_id)
 {
-#if 0
 	/* Acknowledge the interrupt */
 	if (INTERRUPT_LIMIT)
 		cvmx_write_csr(CVMX_POW_WQ_INT, 1<<pow_receive_group);
 	else
 		cvmx_write_csr(CVMX_POW_WQ_INT, 0x10001<<pow_receive_group);
-	preempt_disable();
-	tasklet_schedule(&cvm_oct_tasklet[smp_processor_id()].t);
-	preempt_enable();
-	return IRQ_HANDLED;
-#endif
-	panic("%s: not yet implemented.", __func__);
+	taskqueue_enqueue(cvm_oct_taskq, &cvm_oct_task);
+	return FILTER_HANDLED;
 }
 
 
@@ -94,9 +81,7 @@ int cvm_oct_do_interrupt(int cpl, void *
  */
 void cvm_oct_poll_controller(struct ifnet *ifp)
 {
-	preempt_disable();
-	tasklet_schedule(&cvm_oct_tasklet[smp_processor_id()].t);
-	preempt_enable();
+	taskqueue_enqueue(cvm_oct_taskq, &cvm_oct_task);
 }
 #endif
 
@@ -177,7 +162,7 @@ static inline int cvm_oct_check_rcv_erro
  *
  * @param unused
  */
-void cvm_oct_tasklet_rx(unsigned long unused)
+void cvm_oct_tasklet_rx(void *context, int pending)
 {
 	const int           coreid = cvmx_get_core_num();
 	uint64_t            old_group_mask;
@@ -440,21 +425,17 @@ void cvm_oct_tasklet_rx(unsigned long un
 
 void cvm_oct_rx_initialize(void)
 {
-#if 0
-	int i;
-	/* Initialize all of the tasklets */
-	for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
-		tasklet_init(&cvm_oct_tasklet[i].t, cvm_oct_tasklet_rx, 0);
-#endif
+	TASK_INIT(&cvm_oct_task, 0, cvm_oct_tasklet_rx, NULL);
+
+	cvm_oct_taskq = taskqueue_create_fast("oct_rx", M_NOWAIT,
+					      taskqueue_thread_enqueue,
+					      &cvm_oct_taskq);
+	taskqueue_start_threads(&cvm_oct_taskq, min(mp_ncpus, MAXCPU),
+				PI_NET, "octe taskq");
 }
 
 void cvm_oct_rx_shutdown(void)
 {
-#if 0
-	int i;
-	/* Shutdown all of the tasklets */
-	for (i = 0; i < min(mp_ncpus, MAXCPU); i++)
-		tasklet_kill(&cvm_oct_tasklet[i].t);
-#endif
+	panic("%s: not yet implemented.", __func__);
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h	Fri Apr 23 09:44:30 2010	(r207108)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.h	Fri Apr 23 10:10:26 2010	(r207109)
@@ -27,9 +27,9 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 
 *************************************************************************/
 
-int cvm_oct_do_interrupt(int cpl, void *dev_id);
+int cvm_oct_do_interrupt(void *dev_id);
 void cvm_oct_poll_controller(struct ifnet *ifp);
-void cvm_oct_tasklet_rx(unsigned long unused);
+void cvm_oct_tasklet_rx(void *context, int pending);
 
 void cvm_oct_rx_initialize(void);
 void cvm_oct_rx_shutdown(void);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 09:44:30 2010	(r207108)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 10:10:26 2010	(r207109)
@@ -32,6 +32,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/conf.h>
 #include <sys/endian.h>
 #include <sys/kernel.h>
+#include <sys/rman.h>
 #include <sys/mbuf.h>
 #include <sys/socket.h>
 #include <sys/module.h>
@@ -44,6 +45,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
+#include "octebusvar.h"
+
 /*
  * XXX/juli
  * Convert 0444 to tunables, 0644 to sysctls.
@@ -204,11 +207,14 @@ static void cvm_do_timer(unsigned long a
 /**
  * Configure common hardware for all interfaces
  */
-static void cvm_oct_configure_common_hw(void)
+static void cvm_oct_configure_common_hw(device_t bus)
 {
-#if 0
-	int r;
-#endif
+	struct octebus_softc *sc;
+	int error;
+	int rid;
+
+        sc = device_get_softc(bus);
+
 	/* Setup the FPA */
 	cvmx_fpa_enable();
 	cvm_oct_mem_fill_fpa(CVMX_FPA_PACKET_POOL, CVMX_FPA_PACKET_POOL_SIZE, num_packet_buffers);
@@ -223,10 +229,25 @@ static void cvm_oct_configure_common_hw(
 	if (!octeon_is_simulation())
 		cvmx_write_csr(CVMX_SMI_EN, 1);
 
-#if 0
 	/* Register an IRQ hander for to receive POW interrupts */
-	r = request_irq(OCTEON_IRQ_WORKQ0 + pow_receive_group, cvm_oct_do_interrupt, IRQF_SHARED, "Ethernet", cvm_oct_device);
-#endif
+        rid = 0;
+        sc->sc_rx_irq = bus_alloc_resource(bus, SYS_RES_IRQ, &rid,
+					   CVMX_IRQ_WORKQ0 + pow_receive_group,
+					   CVMX_IRQ_WORKQ0 + pow_receive_group,
+					   1, RF_ACTIVE);
+        if (sc->sc_rx_irq == NULL) {
+                device_printf(bus, "could not allocate workq irq");
+		return;
+        }
+
+        error = bus_setup_intr(bus, sc->sc_rx_irq, INTR_TYPE_NET,
+			       cvm_oct_do_interrupt, NULL, cvm_oct_device,
+			       NULL);
+        if (error != 0) {
+                device_printf(bus, "could not setup workq irq");
+		return;
+        }
+
 
 #ifdef SMP
 	if (USE_MULTICORE_RECEIVE) {
@@ -330,7 +351,7 @@ int cvm_oct_init_module(device_t bus)
 	cvm_oct_proc_initialize();
 #endif
 	cvm_oct_rx_initialize();
-	cvm_oct_configure_common_hw();
+	cvm_oct_configure_common_hw(bus);
 
 	cvmx_helper_initialize_packet_io_global();
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 09:44:30 2010	(r207108)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 10:10:26 2010	(r207109)
@@ -46,6 +46,8 @@
 
 #include "ethernet-common.h"
 
+#include "octebusvar.h"
+
 static void		octebus_identify(driver_t *drv, device_t parent);
 static int		octebus_probe(device_t dev);
 static int		octebus_attach(device_t dev);
@@ -69,7 +71,7 @@ static device_method_t octebus_methods[]
 static driver_t octebus_driver = {
 	"octebus",
 	octebus_methods,
-	1,
+	sizeof (struct octebus_softc),
 };
 
 static devclass_t octebus_devclass;

Added: user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h	Fri Apr 23 10:10:26 2010	(r207109)
@@ -0,0 +1,36 @@
+/*-
+ * Copyright (c) 2010 Juli Mallett <jmallett@FreeBSD.org>
+ * 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.
+ *
+ * $FreeBSD$
+ */
+
+#ifndef	_CAVIUM_OCTE_OCTEBUSVAR_H_
+#define	_CAVIUM_OCTE_OCTEBUSVAR_H_
+
+struct octebus_softc {
+	struct resource *sc_rx_irq;
+};
+
+#endif /* !_CAVIUM_OCTE_OCTEBUSVAR_H_ */

Modified: user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h	Fri Apr 23 09:44:30 2010	(r207108)
+++ user/jmallett/octeon/sys/mips/cavium/octe/wrapper-cvmx-includes.h	Fri Apr 23 10:10:26 2010	(r207109)
@@ -43,5 +43,6 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <contrib/octeon-sdk/cvmx-app-init.h>
 #include <contrib/octeon-sdk/cvmx-helper.h>
 #include <contrib/octeon-sdk/cvmx-helper-board.h>
+#include <contrib/octeon-sdk/cvmx-interrupt.h>
 
 #endif

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 10:22:11 2010
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 DF07C106566C;
	Fri, 23 Apr 2010 10:22:10 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id CD8E08FC1C;
	Fri, 23 Apr 2010 10:22:10 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NAMA2i070257;
	Fri, 23 Apr 2010 10:22:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NAMAMJ070252;
	Fri, 23 Apr 2010 10:22:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231022.o3NAMAMJ070252@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 10:22: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: r207110 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 10:22:11 -0000

Author: jmallett
Date: Fri Apr 23 10:22:10 2010
New Revision: 207110
URL: http://svn.freebsd.org/changeset/base/207110

Log:
  o) Turn some pr_err into printf.  They should likely use log(), but that will
     have to wait.
  o) Convert SPI module to use proper interrupt allocation mechanism.
  o) Use the FreeBSD spelling of unlikely in a few places in ethernet-tx.c; it
     would be good for me to go back over my first few diffs that removed the
     use of likely() and unlikely() and convert those to __predict_*().

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Fri Apr 23 10:10:26 2010	(r207109)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Fri Apr 23 10:22:10 2010	(r207110)
@@ -33,6 +33,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/endian.h>
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
+#include <sys/rman.h>
 #include <sys/socket.h>
 
 #include <net/ethernet.h>
@@ -41,13 +42,14 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
+#include "octebusvar.h"
+
 static int number_spi_ports;
 static int need_retrain[2] = {0, 0};
 
-#if 0
-static int cvm_oct_spi_rml_interrupt(int cpl, void *dev_id)
+static int cvm_oct_spi_rml_interrupt(void *dev_id)
 {
-	int return_status = IRQ_NONE;
+	int return_status = FILTER_STRAY;
 	cvmx_npi_rsl_int_blocks_t rsl_int_blocks;
 
 	/* Check and see if this interrupt was caused by the GMX block */
@@ -63,27 +65,27 @@ static int cvm_oct_spi_rml_interrupt(int
 
 			spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(1));
 			if (spx_int_reg.s.spf)
-				pr_err("SPI1: SRX Spi4 interface down\n");
+				printf("SPI1: SRX Spi4 interface down\n");
 			if (spx_int_reg.s.calerr)
-				pr_err("SPI1: SRX Spi4 Calendar table parity error\n");
+				printf("SPI1: SRX Spi4 Calendar table parity error\n");
 			if (spx_int_reg.s.syncerr)
-				pr_err("SPI1: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n");
+				printf("SPI1: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n");
 			if (spx_int_reg.s.diperr)
-				pr_err("SPI1: SRX Spi4 DIP4 error\n");
+				printf("SPI1: SRX Spi4 DIP4 error\n");
 			if (spx_int_reg.s.tpaovr)
-				pr_err("SPI1: SRX Selected port has hit TPA overflow\n");
+				printf("SPI1: SRX Selected port has hit TPA overflow\n");
 			if (spx_int_reg.s.rsverr)
-				pr_err("SPI1: SRX Spi4 reserved control word detected\n");
+				printf("SPI1: SRX Spi4 reserved control word detected\n");
 			if (spx_int_reg.s.drwnng)
-				pr_err("SPI1: SRX Spi4 receive FIFO drowning/overflow\n");
+				printf("SPI1: SRX Spi4 receive FIFO drowning/overflow\n");
 			if (spx_int_reg.s.clserr)
-				pr_err("SPI1: SRX Spi4 packet closed on non-16B alignment without EOP\n");
+				printf("SPI1: SRX Spi4 packet closed on non-16B alignment without EOP\n");
 			if (spx_int_reg.s.spiovr)
-				pr_err("SPI1: SRX Spi4 async FIFO overflow\n");
+				printf("SPI1: SRX Spi4 async FIFO overflow\n");
 			if (spx_int_reg.s.abnorm)
-				pr_err("SPI1: SRX Abnormal packet termination (ERR bit)\n");
+				printf("SPI1: SRX Abnormal packet termination (ERR bit)\n");
 			if (spx_int_reg.s.prtnxa)
-				pr_err("SPI1: SRX Port out of range\n");
+				printf("SPI1: SRX Port out of range\n");
 		}
 
 		stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(1));
@@ -92,29 +94,29 @@ static int cvm_oct_spi_rml_interrupt(int
 
 			stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(1));
 			if (stx_int_reg.s.syncerr)
-				pr_err("SPI1: STX Interface encountered a fatal error\n");
+				printf("SPI1: STX Interface encountered a fatal error\n");
 			if (stx_int_reg.s.frmerr)
-				pr_err("SPI1: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n");
+				printf("SPI1: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n");
 			if (stx_int_reg.s.unxfrm)
-				pr_err("SPI1: STX Unexpected framing sequence\n");
+				printf("SPI1: STX Unexpected framing sequence\n");
 			if (stx_int_reg.s.nosync)
-				pr_err("SPI1: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n");
+				printf("SPI1: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n");
 			if (stx_int_reg.s.diperr)
-				pr_err("SPI1: STX DIP2 error on the Spi4 Status channel\n");
+				printf("SPI1: STX DIP2 error on the Spi4 Status channel\n");
 			if (stx_int_reg.s.datovr)
-				pr_err("SPI1: STX Spi4 FIFO overflow error\n");
+				printf("SPI1: STX Spi4 FIFO overflow error\n");
 			if (stx_int_reg.s.ovrbst)
-				pr_err("SPI1: STX Transmit packet burst too big\n");
+				printf("SPI1: STX Transmit packet burst too big\n");
 			if (stx_int_reg.s.calpar1)
-				pr_err("SPI1: STX Calendar Table Parity Error Bank1\n");
+				printf("SPI1: STX Calendar Table Parity Error Bank1\n");
 			if (stx_int_reg.s.calpar0)
-				pr_err("SPI1: STX Calendar Table Parity Error Bank0\n");
+				printf("SPI1: STX Calendar Table Parity Error Bank0\n");
 		}
 
 		cvmx_write_csr(CVMX_SPXX_INT_MSK(1), 0);
 		cvmx_write_csr(CVMX_STXX_INT_MSK(1), 0);
 		need_retrain[1] = 1;
-		return_status = IRQ_HANDLED;
+		return_status = FILTER_HANDLED;
 	}
 
 	if (rsl_int_blocks.s.spx0) { /* 18 - SPX0_INT_REG & STX0_INT_REG */
@@ -127,27 +129,27 @@ static int cvm_oct_spi_rml_interrupt(int
 
 			spx_int_reg.u64 &= cvmx_read_csr(CVMX_SPXX_INT_MSK(0));
 			if (spx_int_reg.s.spf)
-				pr_err("SPI0: SRX Spi4 interface down\n");
+				printf("SPI0: SRX Spi4 interface down\n");
 			if (spx_int_reg.s.calerr)
-				pr_err("SPI0: SRX Spi4 Calendar table parity error\n");
+				printf("SPI0: SRX Spi4 Calendar table parity error\n");
 			if (spx_int_reg.s.syncerr)
-				pr_err("SPI0: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n");
+				printf("SPI0: SRX Consecutive Spi4 DIP4 errors have exceeded SPX_ERR_CTL[ERRCNT]\n");
 			if (spx_int_reg.s.diperr)
-				pr_err("SPI0: SRX Spi4 DIP4 error\n");
+				printf("SPI0: SRX Spi4 DIP4 error\n");
 			if (spx_int_reg.s.tpaovr)
-				pr_err("SPI0: SRX Selected port has hit TPA overflow\n");
+				printf("SPI0: SRX Selected port has hit TPA overflow\n");
 			if (spx_int_reg.s.rsverr)
-				pr_err("SPI0: SRX Spi4 reserved control word detected\n");
+				printf("SPI0: SRX Spi4 reserved control word detected\n");
 			if (spx_int_reg.s.drwnng)
-				pr_err("SPI0: SRX Spi4 receive FIFO drowning/overflow\n");
+				printf("SPI0: SRX Spi4 receive FIFO drowning/overflow\n");
 			if (spx_int_reg.s.clserr)
-				pr_err("SPI0: SRX Spi4 packet closed on non-16B alignment without EOP\n");
+				printf("SPI0: SRX Spi4 packet closed on non-16B alignment without EOP\n");
 			if (spx_int_reg.s.spiovr)
-				pr_err("SPI0: SRX Spi4 async FIFO overflow\n");
+				printf("SPI0: SRX Spi4 async FIFO overflow\n");
 			if (spx_int_reg.s.abnorm)
-				pr_err("SPI0: SRX Abnormal packet termination (ERR bit)\n");
+				printf("SPI0: SRX Abnormal packet termination (ERR bit)\n");
 			if (spx_int_reg.s.prtnxa)
-				pr_err("SPI0: SRX Port out of range\n");
+				printf("SPI0: SRX Port out of range\n");
 		}
 
 		stx_int_reg.u64 = cvmx_read_csr(CVMX_STXX_INT_REG(0));
@@ -156,34 +158,33 @@ static int cvm_oct_spi_rml_interrupt(int
 
 			stx_int_reg.u64 &= cvmx_read_csr(CVMX_STXX_INT_MSK(0));
 			if (stx_int_reg.s.syncerr)
-				pr_err("SPI0: STX Interface encountered a fatal error\n");
+				printf("SPI0: STX Interface encountered a fatal error\n");
 			if (stx_int_reg.s.frmerr)
-				pr_err("SPI0: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n");
+				printf("SPI0: STX FRMCNT has exceeded STX_DIP_CNT[MAXFRM]\n");
 			if (stx_int_reg.s.unxfrm)
-				pr_err("SPI0: STX Unexpected framing sequence\n");
+				printf("SPI0: STX Unexpected framing sequence\n");
 			if (stx_int_reg.s.nosync)
-				pr_err("SPI0: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n");
+				printf("SPI0: STX ERRCNT has exceeded STX_DIP_CNT[MAXDIP]\n");
 			if (stx_int_reg.s.diperr)
-				pr_err("SPI0: STX DIP2 error on the Spi4 Status channel\n");
+				printf("SPI0: STX DIP2 error on the Spi4 Status channel\n");
 			if (stx_int_reg.s.datovr)
-				pr_err("SPI0: STX Spi4 FIFO overflow error\n");
+				printf("SPI0: STX Spi4 FIFO overflow error\n");
 			if (stx_int_reg.s.ovrbst)
-				pr_err("SPI0: STX Transmit packet burst too big\n");
+				printf("SPI0: STX Transmit packet burst too big\n");
 			if (stx_int_reg.s.calpar1)
-				pr_err("SPI0: STX Calendar Table Parity Error Bank1\n");
+				printf("SPI0: STX Calendar Table Parity Error Bank1\n");
 			if (stx_int_reg.s.calpar0)
-				pr_err("SPI0: STX Calendar Table Parity Error Bank0\n");
+				printf("SPI0: STX Calendar Table Parity Error Bank0\n");
 		}
 
 		cvmx_write_csr(CVMX_SPXX_INT_MSK(0), 0);
 		cvmx_write_csr(CVMX_STXX_INT_MSK(0), 0);
 		need_retrain[0] = 1;
-		return_status = IRQ_HANDLED;
+		return_status = FILTER_HANDLED;
 	}
 
 	return return_status;
 }
-#endif
 
 static void cvm_oct_spi_enable_error_reporting(int interface)
 {
@@ -252,16 +253,30 @@ static void cvm_oct_spi_poll(struct ifne
 
 int cvm_oct_spi_init(struct ifnet *ifp)
 {
-#if 0
-	int r;
-#endif
+	struct octebus_softc *sc;
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
+	int error;
+	int rid;
 
 	if (number_spi_ports == 0) {
-#if 0
-		r = request_irq(OCTEON_IRQ_RML, cvm_oct_spi_rml_interrupt, IRQF_SHARED,
-				"SPI", &number_spi_ports);
-#endif
+		sc = device_get_softc(device_get_parent(priv->dev));
+
+		rid = 0;
+		sc->sc_spi_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ, &rid,
+						    CVMX_IRQ_RML, CVMX_IRQ_RML,
+						    1, RF_ACTIVE);
+		if (sc->sc_spi_irq == NULL) {
+			device_printf(sc->sc_dev, "could not allocate SPI irq");
+			return ENXIO;
+		}
+
+		error = bus_setup_intr(sc->sc_dev, sc->sc_spi_irq, INTR_TYPE_NET,
+				       cvm_oct_spi_rml_interrupt, NULL,
+				       &number_spi_ports, NULL);
+		if (error != 0) {
+			device_printf(sc->sc_dev, "could not setup SPI irq");
+			return error;
+		}
 	}
 	number_spi_ports++;
 
@@ -284,8 +299,6 @@ void cvm_oct_spi_uninit(struct ifnet *if
 			cvmx_write_csr(CVMX_SPXX_INT_MSK(interface), 0);
 			cvmx_write_csr(CVMX_STXX_INT_MSK(interface), 0);
 		}
-#if 0
-		free_irq(8 + 46, &number_spi_ports);
-#endif
+		panic("%s: IRQ release not yet implemented.", __func__);
 	}
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Fri Apr 23 10:10:26 2010	(r207109)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Fri Apr 23 10:22:10 2010	(r207110)
@@ -166,49 +166,49 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 #if REUSE_MBUFS_WITHOUT_FREE
 #if 0
 	fpa_head = m->head + 128 - ((unsigned long)m->head&0x7f);
-	if (unlikely(m->data < fpa_head)) {
+	if (__predict_false(m->data < fpa_head)) {
 		/*
 		printf("TX buffer beginning can't meet FPA alignment constraints\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely((m_end_pointer(m) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
+	if (__predict_false((m_end_pointer(m) - fpa_head) < CVMX_FPA_PACKET_POOL_SIZE)) {
 		/*
 		printf("TX buffer isn't large enough for the FPA\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m_shared(m))) {
+	if (__predict_false(m_shared(m))) {
 		/*
 		printf("TX buffer sharing data with someone else\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m_cloned(m))) {
+	if (__predict_false(m_cloned(m))) {
 		/*
 		printf("TX buffer has been cloned\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m_header_cloned(m))) {
+	if (__predict_false(m_header_cloned(m))) {
 		/*
 		printf("TX buffer header has been cloned\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m->destructor)) {
+	if (__predict_false(m->destructor)) {
 		/*
 		printf("TX buffer has a destructor\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m_shinfo(m)->nr_frags)) {
+	if (__predict_false(m_shinfo(m)->nr_frags)) {
 		/*
 		printf("TX buffer has fragments\n");
 		*/
 		goto dont_put_mbuf_in_hw;
 	}
-	if (unlikely(m->truesize != sizeof(*m) + m_end_pointer(m) - m->head)) {
+	if (__predict_false(m->truesize != sizeof(*m) + m_end_pointer(m) - m->head)) {
 		/*
 		printf("TX buffer truesize has been changed\n");
 		*/

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebus.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 10:10:26 2010	(r207109)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebus.c	Fri Apr 23 10:22:10 2010	(r207110)
@@ -96,8 +96,12 @@ octebus_probe(device_t dev)
 static int
 octebus_attach(device_t dev)
 {
+	struct octebus_softc *sc;
 	int rv;
 
+	sc = device_get_softc(dev);
+	sc->sc_dev = dev;
+
 	rv = cvm_oct_init_module(dev);
 	if (rv != 0)
 		return (ENXIO);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h	Fri Apr 23 10:10:26 2010	(r207109)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h	Fri Apr 23 10:22:10 2010	(r207110)
@@ -30,7 +30,9 @@
 #define	_CAVIUM_OCTE_OCTEBUSVAR_H_
 
 struct octebus_softc {
+	device_t sc_dev;
 	struct resource *sc_rx_irq;
+	struct resource *sc_spi_irq;
 };
 
 #endif /* !_CAVIUM_OCTE_OCTEBUSVAR_H_ */

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 10:27:49 2010
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 E55E61065672;
	Fri, 23 Apr 2010 10:27:48 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D44768FC17;
	Fri, 23 Apr 2010 10:27:48 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NARmLB071529;
	Fri, 23 Apr 2010 10:27:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NARmla071526;
	Fri, 23 Apr 2010 10:27:48 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231027.o3NARmla071526@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 10:27:48 +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: r207111 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 10:27:49 -0000

Author: jmallett
Date: Fri Apr 23 10:27:48 2010
New Revision: 207111
URL: http://svn.freebsd.org/changeset/base/207111

Log:
  Hook up RGMII RML interrupts.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Fri Apr 23 10:22:10 2010	(r207110)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Fri Apr 23 10:27:48 2010	(r207111)
@@ -33,6 +33,7 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include <sys/endian.h>
 #include <sys/kernel.h>
 #include <sys/mbuf.h>
+#include <sys/rman.h>
 #include <sys/socket.h>
 #include <sys/lock.h>
 #include <sys/mutex.h>
@@ -43,6 +44,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #include "wrapper-cvmx-includes.h"
 #include "ethernet-headers.h"
 
+#include "octebusvar.h"
+
 extern int octeon_is_simulation(void);
 extern struct ifnet *cvm_oct_device[];
 
@@ -154,12 +157,11 @@ static void cvm_oct_rgmii_poll(struct if
 }
 
 
-#if 0
-static int cvm_oct_rgmii_rml_interrupt(int cpl, void *dev_id)
+static int cvm_oct_rgmii_rml_interrupt(void *dev_id)
 {
 	cvmx_npi_rsl_int_blocks_t rsl_int_blocks;
 	int index;
-	int return_status = IRQ_NONE;
+	int return_status = FILTER_STRAY;
 
 	rsl_int_blocks.u64 = cvmx_read_csr(CVMX_NPI_RSL_INT_BLOCKS);
 
@@ -185,7 +187,7 @@ static int cvm_oct_rgmii_rml_interrupt(i
 				gmx_rx_int_reg.s.phy_link = 1;
 				gmx_rx_int_reg.s.phy_spd = 1;
 				cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), gmx_rx_int_reg.u64);
-				return_status = IRQ_HANDLED;
+				return_status = FILTER_HANDLED;
 			}
 		}
 	}
@@ -212,13 +214,12 @@ static int cvm_oct_rgmii_rml_interrupt(i
 				gmx_rx_int_reg.s.phy_link = 1;
 				gmx_rx_int_reg.s.phy_spd = 1;
 				cvmx_write_csr(CVMX_GMXX_RXX_INT_REG(index, interface), gmx_rx_int_reg.u64);
-				return_status = IRQ_HANDLED;
+				return_status = FILTER_HANDLED;
 			}
 		}
 	}
 	return return_status;
 }
-#endif
 
 
 static int cvm_oct_rgmii_open(struct ifnet *ifp)
@@ -259,10 +260,10 @@ static int cvm_oct_rgmii_stop(struct ifn
 
 int cvm_oct_rgmii_init(struct ifnet *ifp)
 {
+	struct octebus_softc *sc;
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-#if 0
-	int r;
-#endif
+	int error;
+	int rid;
 
 	cvm_oct_common_init(ifp);
 	priv->open = cvm_oct_rgmii_open;
@@ -275,9 +276,24 @@ int cvm_oct_rgmii_init(struct ifnet *ifp
 	   This may cause problems if the PHY doesn't implement inband status
 	   properly */
 	if (number_rgmii_ports == 0) {
-#if 0
-		r = request_irq(OCTEON_IRQ_RML, cvm_oct_rgmii_rml_interrupt, IRQF_SHARED, "RGMII", &number_rgmii_ports);
-#endif
+		sc = device_get_softc(device_get_parent(priv->dev));
+
+		rid = 0;
+		sc->sc_rgmii_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ, &rid,
+						      CVMX_IRQ_RML, CVMX_IRQ_RML,
+						      1, RF_ACTIVE);
+		if (sc->sc_rgmii_irq == NULL) {
+			device_printf(sc->sc_dev, "could not allocate RGMII irq");
+			return ENXIO;
+		}
+
+		error = bus_setup_intr(sc->sc_dev, sc->sc_rgmii_irq, INTR_TYPE_NET,
+				       cvm_oct_rgmii_rml_interrupt, NULL,
+				       &number_rgmii_ports, NULL);
+		if (error != 0) {
+			device_printf(sc->sc_dev, "could not setup RGMII irq");
+			return error;
+		}
 	}
 	number_rgmii_ports++;
 
@@ -332,9 +348,7 @@ void cvm_oct_rgmii_uninit(struct ifnet *
 
 	/* Remove the interrupt handler when the last port is removed */
 	number_rgmii_ports--;
-#if 0
 	if (number_rgmii_ports == 0)
-		free_irq(OCTEON_IRQ_RML, &number_rgmii_ports);
-#endif
+		panic("%s: need to implement IRQ release.", __func__);
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h	Fri Apr 23 10:22:10 2010	(r207110)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octebusvar.h	Fri Apr 23 10:27:48 2010	(r207111)
@@ -31,7 +31,10 @@
 
 struct octebus_softc {
 	device_t sc_dev;
+
 	struct resource *sc_rx_irq;
+
+	struct resource *sc_rgmii_irq;
 	struct resource *sc_spi_irq;
 };
 

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 10:33:33 2010
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 1EAD1106566B;
	Fri, 23 Apr 2010 10:33:33 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0DAFC8FC19;
	Fri, 23 Apr 2010 10:33:33 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NAXWxT072823;
	Fri, 23 Apr 2010 10:33:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NAXWa4072818;
	Fri, 23 Apr 2010 10:33:32 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004231033.o3NAXWa4072818@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 10:33:32 +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: r207112 - user/jmallett/octeon/sys/mips/cavium/octe
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: Fri, 23 Apr 2010 10:33:33 -0000

Author: jmallett
Date: Fri Apr 23 10:33:32 2010
New Revision: 207112
URL: http://svn.freebsd.org/changeset/base/207112

Log:
  o) Style cleanups.
  o) Set INTR_MPSAFE.
  o) Set a few interface flags and note interface fields that are not yet set.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 10:27:48 2010	(r207111)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Fri Apr 23 10:33:32 2010	(r207112)
@@ -261,6 +261,15 @@ int cvm_oct_common_init(struct ifnet *if
 #endif
 	count++;
 
+	/*
+	 * XXX
+	 * Need to set:
+	 * 	if_init
+	 * 	if_ioctl
+	 * 	if_start
+	 */
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+
 #if 0
 	ifp->get_stats          = cvm_oct_common_get_stats;
 	ifp->set_mac_address    = cvm_oct_common_set_mac_address;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Fri Apr 23 10:27:48 2010	(r207111)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rgmii.c	Fri Apr 23 10:33:32 2010	(r207112)
@@ -279,15 +279,17 @@ int cvm_oct_rgmii_init(struct ifnet *ifp
 		sc = device_get_softc(device_get_parent(priv->dev));
 
 		rid = 0;
-		sc->sc_rgmii_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ, &rid,
-						      CVMX_IRQ_RML, CVMX_IRQ_RML,
-						      1, RF_ACTIVE);
+		sc->sc_rgmii_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ,
+						      &rid, CVMX_IRQ_RML,
+						      CVMX_IRQ_RML, 1,
+						      RF_ACTIVE);
 		if (sc->sc_rgmii_irq == NULL) {
 			device_printf(sc->sc_dev, "could not allocate RGMII irq");
 			return ENXIO;
 		}
 
-		error = bus_setup_intr(sc->sc_dev, sc->sc_rgmii_irq, INTR_TYPE_NET,
+		error = bus_setup_intr(sc->sc_dev, sc->sc_rgmii_irq,
+				       INTR_TYPE_NET | INTR_MPSAFE,
 				       cvm_oct_rgmii_rml_interrupt, NULL,
 				       &number_rgmii_ports, NULL);
 		if (error != 0) {

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Fri Apr 23 10:27:48 2010	(r207111)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-spi.c	Fri Apr 23 10:33:32 2010	(r207112)
@@ -262,15 +262,17 @@ int cvm_oct_spi_init(struct ifnet *ifp)
 		sc = device_get_softc(device_get_parent(priv->dev));
 
 		rid = 0;
-		sc->sc_spi_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ, &rid,
-						    CVMX_IRQ_RML, CVMX_IRQ_RML,
-						    1, RF_ACTIVE);
+		sc->sc_spi_irq = bus_alloc_resource(sc->sc_dev, SYS_RES_IRQ,
+						    &rid, CVMX_IRQ_RML,
+						    CVMX_IRQ_RML, 1,
+						    RF_ACTIVE);
 		if (sc->sc_spi_irq == NULL) {
 			device_printf(sc->sc_dev, "could not allocate SPI irq");
 			return ENXIO;
 		}
 
-		error = bus_setup_intr(sc->sc_dev, sc->sc_spi_irq, INTR_TYPE_NET,
+		error = bus_setup_intr(sc->sc_dev, sc->sc_spi_irq,
+				       INTR_TYPE_NET | INTR_MPSAFE,
 				       cvm_oct_spi_rml_interrupt, NULL,
 				       &number_spi_ports, NULL);
 		if (error != 0) {

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 10:27:48 2010	(r207111)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Fri Apr 23 10:33:32 2010	(r207112)
@@ -240,7 +240,7 @@ static void cvm_oct_configure_common_hw(
 		return;
         }
 
-        error = bus_setup_intr(bus, sc->sc_rx_irq, INTR_TYPE_NET,
+        error = bus_setup_intr(bus, sc->sc_rx_irq, INTR_TYPE_NET | INTR_MPSAFE,
 			       cvm_oct_do_interrupt, NULL, cvm_oct_device,
 			       NULL);
         if (error != 0) {

From owner-svn-src-user@FreeBSD.ORG  Fri Apr 23 23:09:18 2010
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 7B53F106566B;
	Fri, 23 Apr 2010 23:09:18 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 5FDFE8FC08;
	Fri, 23 Apr 2010 23:09:18 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3NN9IwF042195;
	Fri, 23 Apr 2010 23:09:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3NN9IU8042191;
	Fri, 23 Apr 2010 23:09:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004232309.o3NN9IU8042191@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Fri, 23 Apr 2010 23:09:18 +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: r207136 - in user/jmallett/octeon/sys/mips: include mips
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: Fri, 23 Apr 2010 23:09:18 -0000

Author: jmallett
Date: Fri Apr 23 23:09:18 2010
New Revision: 207136
URL: http://svn.freebsd.org/changeset/base/207136

Log:
  o) Insert nops after disabling interrupts to avoid getting interrupted.
  o) When changing wiring, in addition to maybe setting PG_W, maybe clear it.
  o) Get rid of lmem locks, since this is all CPU local now, and remove pinning
     and simply disable interrupts.
  o) Likewise, don't possibly cause an IPI for lmem, since interrupts are
     disabled at that point.  Besides, they operate on inherently per-CPU VAs.

Modified:
  user/jmallett/octeon/sys/mips/include/pmap.h
  user/jmallett/octeon/sys/mips/mips/exception.S
  user/jmallett/octeon/sys/mips/mips/pmap.c

Modified: user/jmallett/octeon/sys/mips/include/pmap.h
==============================================================================
--- user/jmallett/octeon/sys/mips/include/pmap.h	Fri Apr 23 22:42:49 2010	(r207135)
+++ user/jmallett/octeon/sys/mips/include/pmap.h	Fri Apr 23 23:09:18 2010	(r207136)
@@ -112,12 +112,6 @@ extern struct pmap	kernel_pmap_store;
 #define	PMAP_TRYLOCK(pmap)	mtx_trylock(&(pmap)->pm_mtx)
 #define	PMAP_UNLOCK(pmap)	mtx_unlock(&(pmap)->pm_mtx)
 
-#define PMAP_LGMEM_LOCK_INIT(sysmap) mtx_init(&(sysmap)->lock, "pmap-lgmem", \
-				    "per-cpu-map", (MTX_DEF| MTX_DUPOK))
-#define PMAP_LGMEM_LOCK(sysmap) mtx_lock(&(sysmap)->lock)
-#define PMAP_LGMEM_UNLOCK(sysmap) mtx_unlock(&(sysmap)->lock)
-#define PMAP_LGMEM_DESTROY(sysmap) mtx_destroy(&(sysmap)->lock)
-
 /*
  * For each vm_page_t, there is a list of all currently valid virtual
  * mappings of that page.  An entry is a pv_entry_t, the list is pv_table.

Modified: user/jmallett/octeon/sys/mips/mips/exception.S
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/exception.S	Fri Apr 23 22:42:49 2010	(r207135)
+++ user/jmallett/octeon/sys/mips/mips/exception.S	Fri Apr 23 23:09:18 2010	(r207136)
@@ -241,13 +241,15 @@ SlowFault:
 	or      a0, a0, a2	        ; \
 	li      a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
 	and     a0, a0, a2              ; \
-        mtc0    a0, COP_0_STATUS_REG    
+        mtc0    a0, COP_0_STATUS_REG    ; \
+	ITLBNOPFIX
 #else
 #define CLEAR_STATUS \
 	mfc0    a0, COP_0_STATUS_REG    ;\
 	li      a2, ~(MIPS_SR_INT_IE | MIPS_SR_EXL | SR_KSU_USER)   ; \
 	and     a0, a0, a2              ; \
-	mtc0	a0, COP_0_STATUS_REG
+	mtc0	a0, COP_0_STATUS_REG	; \
+	ITLBNOPFIX
 #endif
 
 /*

Modified: user/jmallett/octeon/sys/mips/mips/pmap.c
==============================================================================
--- user/jmallett/octeon/sys/mips/mips/pmap.c	Fri Apr 23 22:42:49 2010	(r207135)
+++ user/jmallett/octeon/sys/mips/mips/pmap.c	Fri Apr 23 23:09:18 2010	(r207136)
@@ -198,7 +198,6 @@ static void pmap_update_page_action(void
 
 #if !defined(__mips_n64)
 struct local_sysmaps {
-	struct mtx lock;
 	vm_offset_t base;
 	uint16_t valid1, valid2;
 };
@@ -218,28 +217,24 @@ caddr_t virtual_sys_start = (caddr_t)0;
 	struct local_sysmaps *sysm;					\
 	pt_entry_t *pte, npte;						\
 									\
+	intr = intr_disable();						\
 	cpu = PCPU_GET(cpuid);						\
 	sysm = &sysmap_lmem[cpu];					\
-	PMAP_LGMEM_LOCK(sysm);						\
-	intr = intr_disable();						\
-	sched_pin();							\
 	va = sysm->base;						\
 	npte = TLBLO_PA_TO_PFN(phys) |					\
 	    PG_D | PG_V | PG_G | PG_W | PG_C_CNC;			\
 	pte = pmap_pte(kernel_pmap, va);				\
 	*pte = npte;							\
-	sysm->valid1 = 1;
+	sysm->valid1 = 1
 
 #define	PMAP_LMEM_MAP2(va1, phys1, va2, phys2)				\
 	int cpu;							\
 	struct local_sysmaps *sysm;					\
 	pt_entry_t *pte, npte;						\
 									\
+	intr = intr_disable();						\
 	cpu = PCPU_GET(cpuid);						\
 	sysm = &sysmap_lmem[cpu];					\
-	PMAP_LGMEM_LOCK(sysm);						\
-	intr = intr_disable();						\
-	sched_pin();							\
 	va1 = sysm->base;						\
 	va2 = sysm->base + PAGE_SIZE;					\
 	npte = TLBLO_PA_TO_PFN(phys2) |					\
@@ -251,20 +246,18 @@ caddr_t virtual_sys_start = (caddr_t)0;
 	pte = pmap_pte(kernel_pmap, va2);				\
 	*pte = npte;							\
 	sysm->valid1 = 1;						\
-	sysm->valid2 = 1;
+	sysm->valid2 = 1
 
 #define	PMAP_LMEM_UNMAP()						\
 	pte = pmap_pte(kernel_pmap, sysm->base);			\
 	*pte = PG_G;							\
-	pmap_invalidate_page(kernel_pmap, sysm->base);			\
+	tlb_invalidate_address(kernel_pmap, sysm->base);		\
 	sysm->valid1 = 0;						\
 	pte = pmap_pte(kernel_pmap, sysm->base + PAGE_SIZE);		\
 	*pte = PG_G;							\
-	pmap_invalidate_page(kernel_pmap, sysm->base + PAGE_SIZE);	\
+	tlb_invalidate_address(kernel_pmap, sysm->base + PAGE_SIZE);	\
 	sysm->valid2 = 0;						\
-	sched_unpin();							\
-	intr_restore(intr);						\
-	PMAP_LGMEM_UNLOCK(sysm);
+	intr_restore(intr)
 
 #endif
 
@@ -451,7 +444,6 @@ again:
 			sysmap_lmem[i].base = virtual_avail;
 			virtual_avail += PAGE_SIZE * 2;
 			sysmap_lmem[i].valid1 = sysmap_lmem[i].valid2 = 0;
-			PMAP_LGMEM_LOCK_INIT(&sysmap_lmem[i]);
 		}
 	}
 	virtual_sys_start = (caddr_t)virtual_avail;
@@ -2181,6 +2173,8 @@ pmap_change_wiring(pmap_t pmap, vm_offse
 	 */
 	if (wired)
 		pte_set(pte, PG_W);
+	else
+		pte_clear(pte, PG_W);
 	PMAP_UNLOCK(pmap);
 }
 

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 05:03:42 2010
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 B88541065674;
	Sat, 24 Apr 2010 05:03:42 +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 A62438FC0C;
	Sat, 24 Apr 2010 05:03:42 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O53g3V028737;
	Sat, 24 Apr 2010 05:03:42 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O53g0D028732;
	Sat, 24 Apr 2010 05:03:42 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004240503.o3O53g0D028732@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Sat, 24 Apr 2010 05:03:42 +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: r207140 - in user/kmacy/head_page_lock_2/sys:
	amd64/amd64 kern 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: Sat, 24 Apr 2010 05:03:42 -0000

Author: kmacy
Date: Sat Apr 24 05:03:42 2010
New Revision: 207140
URL: http://svn.freebsd.org/changeset/base/207140

Log:
  generalize lock stack operations and move to subr_lock.c

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
  user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
  user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
  user/kmacy/head_page_lock_2/sys/sys/lock.h

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 03:11:35 2010	(r207139)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 05:03:42 2010	(r207140)
@@ -305,77 +305,6 @@ CTASSERT(1 << PDESHIFT == sizeof(pd_entr
 CTASSERT(1 << PTESHIFT == sizeof(pt_entry_t));
 
 
-#define LS_MAX		4
-struct lock_stack {
-	struct mtx *ls_array[LS_MAX];
-	int ls_top;
-};
-
-static void
-ls_init(struct lock_stack *ls)
-{
-
-	ls->ls_top = 0;
-}
-
-#define ls_push(ls, m)	_ls_push((ls), (m), LOCK_FILE, LOCK_LINE)
-
-static void
-_ls_push(struct lock_stack *ls, struct mtx *lock, char *file, int line)
-{
-
-	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
-	
-	ls->ls_array[ls->ls_top] = lock;
-	ls->ls_top++;
-#if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE)	
-	_mtx_lock_flags(lock, 0, file, line);
-#else
-	_get_sleep_lock(lock, curthread, 0, file, line);
-#endif
-}
-
-static int
-ls_trypush(struct lock_stack *ls, struct mtx *lock)
-{
-
-	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
-
-	if (mtx_trylock(lock) == 0)
-		return (0);
-	
-	ls->ls_array[ls->ls_top] = lock;
-	ls->ls_top++;
-	return (1);
-}
-
-#ifdef notyet
-static void
-ls_pop(struct lock_stack *ls)
-{
-	struct mtx *lock;
-
-	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
-
-	ls->ls_top--;
-	lock = ls->ls_array[ls->ls_top];
-	mtx_unlock(lock);
-}
-#endif
-
-static void
-ls_popa(struct lock_stack *ls)
-{
-	struct mtx *lock;
-
-	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
-
-	while (ls->ls_top > 0) {
-		ls->ls_top--;
-		lock = ls->ls_array[ls->ls_top];
-		mtx_unlock(lock);
-	}
-}
 #ifdef INVARIANTS
 extern void kdb_backtrace(void);
 #endif
@@ -3464,15 +3393,19 @@ pmap_enter(pmap_t pmap, vm_offset_t va, 
 	opa = 0;
 	opalocked = FALSE;
 	ls_init(&ls);
-	ls_push(&ls, PA_LOCKPTR(lockedpa));
-	ls_push(&ls, PMAP_LOCKPTR(pmap));
+	ls_push(&ls, &lock_class_mtx_sleep,
+	    (struct lock_object *)PA_LOCKPTR(lockedpa));
+	ls_push(&ls, &lock_class_mtx_sleep,
+	    (struct lock_object *)PMAP_LOCKPTR(pmap));
 	PMAP_UPDATE_GEN_COUNT(pmap);
 	if ((m->flags & (PG_FICTITIOUS | PG_UNMANAGED)) == 0) {
 		while ((pv = get_pv_entry(pmap)) == NULL) {
 			ls_popa(&ls);
 			VM_WAIT;
-			ls_push(&ls, PA_LOCKPTR(lockedpa));
-			ls_push(&ls, PMAP_LOCKPTR(pmap));
+			ls_push(&ls, &lock_class_mtx_sleep,
+			    (struct lock_object *)PA_LOCKPTR(lockedpa));
+			ls_push(&ls, &lock_class_mtx_sleep,
+			    (struct lock_object *)PMAP_LOCKPTR(pmap));
 			PMAP_UPDATE_GEN_COUNT(pmap);
 		}
 	}
@@ -3497,8 +3430,10 @@ restart:
 	origpte = *pte;
 	if (opa && (opa != (origpte & PG_FRAME))) {
 		ls_popa(&ls);
-		ls_push(&ls, PA_LOCKPTR(lockedpa));
-		ls_push(&ls, PMAP_LOCKPTR(pmap));
+		ls_push(&ls, &lock_class_mtx_sleep,
+			    (struct lock_object *)PA_LOCKPTR(lockedpa));
+		ls_push(&ls, &lock_class_mtx_sleep,
+			    (struct lock_object *)PMAP_LOCKPTR(pmap));
 		PMAP_UPDATE_GEN_COUNT(pmap);
 		opalocked = FALSE;
 		opa = 0;
@@ -3508,17 +3443,23 @@ restart:
 	opa = origpte & PG_FRAME;
 	if (opa && (opa != lockedpa) && (opalocked == FALSE)) {
 		opalocked = TRUE;
-		if (ls_trypush(&ls, PA_LOCKPTR(opa)) == 0) {
+		if (ls_trypush(&ls, &lock_class_mtx_sleep,
+			(struct lock_object *)PA_LOCKPTR(opa)) == 0) {
 			ls_popa(&ls);
 			if ((uintptr_t)PA_LOCKPTR(lockedpa) <
 			    (uintptr_t)PA_LOCKPTR(opa)) {
-				ls_push(&ls, PA_LOCKPTR(lockedpa));
-				ls_push(&ls, PA_LOCKPTR(opa));
+				ls_push(&ls, &lock_class_mtx_sleep,
+				    (struct lock_object *)PA_LOCKPTR(lockedpa));
+				ls_push(&ls, &lock_class_mtx_sleep,
+				    (struct lock_object *)PA_LOCKPTR(opa));
 			} else {
-				ls_push(&ls, PA_LOCKPTR(opa));
-				ls_push(&ls, PA_LOCKPTR(lockedpa));
+				ls_push(&ls, &lock_class_mtx_sleep,
+				    (struct lock_object *)PA_LOCKPTR(opa));
+				ls_push(&ls, &lock_class_mtx_sleep,
+				    (struct lock_object *)PA_LOCKPTR(lockedpa));
 			}
-			ls_push(&ls, PMAP_LOCKPTR(pmap));
+			ls_push(&ls, &lock_class_mtx_sleep,
+			    (struct lock_object *)PMAP_LOCKPTR(pmap));
 			PMAP_UPDATE_GEN_COUNT(pmap);
 			goto restart;
 		}

Modified: user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Sat Apr 24 03:11:35 2010	(r207139)
+++ user/kmacy/head_page_lock_2/sys/kern/kern_mutex.c	Sat Apr 24 05:03:42 2010	(r207140)
@@ -90,6 +90,8 @@ static void	assert_mtx(struct lock_objec
 static void	db_show_mtx(struct lock_object *lock);
 #endif
 static void	lock_mtx(struct lock_object *lock, int how);
+static void	lock_full_mtx(struct lock_object *lock, char *file, int line);
+static int	trylock_mtx(struct lock_object *lock);
 static void	lock_spin(struct lock_object *lock, int how);
 #ifdef KDTRACE_HOOKS
 static int	owner_mtx(struct lock_object *lock, struct thread **owner);
@@ -112,6 +114,10 @@ struct lock_class lock_class_mtx_sleep =
 #ifdef KDTRACE_HOOKS
 	.lc_owner = owner_mtx,
 #endif
+	.lc_lock_full = lock_full_mtx,
+	.lc_trylock = trylock_mtx,
+	
+	
 };
 struct lock_class lock_class_mtx_spin = {
 	.lc_name = "spin mutex",
@@ -148,6 +154,25 @@ lock_mtx(struct lock_object *lock, int h
 }
 
 void
+lock_full_mtx(struct lock_object *lock, char *file, int line)
+{
+
+#if LOCK_DEBUG > 0 || defined(MUTEX_NOINLINE)
+	_mtx_lock_flags((struct mtx *)lock, 0, file, line);
+#else
+	_get_sleep_lock((struct mtx *)lock, curthread, 0, file, line);
+#endif	
+	
+}
+
+int
+trylock_mtx(struct lock_object *lock)
+{
+
+	return (mtx_trylock((struct mtx *)lock));
+}
+
+void
 lock_spin(struct lock_object *lock, int how)
 {
 
@@ -160,7 +185,7 @@ unlock_mtx(struct lock_object *lock)
 	struct mtx *m;
 
 	m = (struct mtx *)lock;
-	mtx_assert(m, MA_OWNED | MA_NOTRECURSED);
+	mtx_assert(m, MA_OWNED);
 	mtx_unlock(m);
 	return (0);
 }

Modified: user/kmacy/head_page_lock_2/sys/kern/subr_lock.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/kern/subr_lock.c	Sat Apr 24 03:11:35 2010	(r207139)
+++ user/kmacy/head_page_lock_2/sys/kern/subr_lock.c	Sat Apr 24 05:03:42 2010	(r207140)
@@ -667,3 +667,69 @@ SYSCTL_PROC(_debug_lock_prof, OID_AUTO, 
     NULL, 0, enable_lock_prof, "I", "Enable lock profiling");
 
 #endif
+
+void
+ls_init(struct lock_stack *ls)
+{
+
+	ls->ls_top = 0;
+}
+
+void
+_ls_push(struct lock_stack *ls, struct lock_class *class, struct lock_object *lock,
+    char *file, int line)
+{
+
+	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
+	
+	ls->ls_array[ls->ls_top].lse_lock = lock;
+	ls->ls_array[ls->ls_top].lse_class = class;
+	ls->ls_top++;
+	class->lc_lock_full(lock, file, line);
+}
+
+int
+ls_trypush(struct lock_stack *ls, struct lock_class *class, struct lock_object *lock)
+{
+
+	KASSERT(ls->ls_top < LS_MAX, ("lock stack overflow"));
+
+	if (class->lc_trylock(lock) == 0)
+		return (0);
+	
+	ls->ls_array[ls->ls_top].lse_lock = lock;
+	ls->ls_array[ls->ls_top].lse_class = class;
+	ls->ls_top++;
+	return (1);
+}
+
+void
+ls_pop(struct lock_stack *ls)
+{
+	struct lock_object *lock;
+	struct lock_class *class;
+
+	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
+
+	ls->ls_top--;
+	lock = ls->ls_array[ls->ls_top].lse_lock;
+	class = ls->ls_array[ls->ls_top].lse_class;	
+	class->lc_unlock(lock);
+}
+
+void
+ls_popa(struct lock_stack *ls)
+{
+	struct lock_object *lock;
+	struct lock_class *class;
+
+	KASSERT(ls->ls_top > 0, ("lock stack underflow"));
+
+	while (ls->ls_top > 0) {
+		ls->ls_top--;
+		lock = ls->ls_array[ls->ls_top].lse_lock;
+		class = ls->ls_array[ls->ls_top].lse_class;
+		class->lc_unlock(lock);
+	}
+}
+

Modified: user/kmacy/head_page_lock_2/sys/sys/lock.h
==============================================================================
--- user/kmacy/head_page_lock_2/sys/sys/lock.h	Sat Apr 24 03:11:35 2010	(r207139)
+++ user/kmacy/head_page_lock_2/sys/sys/lock.h	Sat Apr 24 05:03:42 2010	(r207140)
@@ -63,6 +63,8 @@ struct lock_class {
 	void	(*lc_lock)(struct lock_object *lock, int how);
 	int	(*lc_owner)(struct lock_object *lock, struct thread **owner);
 	int	(*lc_unlock)(struct lock_object *lock);
+	void	(*lc_lock_full)(struct lock_object *lock, char *file, int line);
+	int	(*lc_trylock)(struct lock_object *lock);
 };
 
 #define	LC_SLEEPLOCK	0x00000001	/* Sleep lock. */
@@ -222,6 +224,29 @@ void	witness_releaseok(struct lock_objec
 const char *witness_file(struct lock_object *);
 void	witness_thread_exit(struct thread *);
 
+
+#define LS_MAX		4
+struct lock_stack_entry {
+	struct lock_object	*lse_lock;
+	struct lock_class	*lse_class;
+};
+
+struct lock_stack {
+	struct lock_stack_entry ls_array[LS_MAX];
+	int ls_top;
+};
+
+
+#define ls_push(ls, class, m)	_ls_push((ls), (class), (m), LOCK_FILE, LOCK_LINE)
+
+void	ls_init(struct lock_stack *ls);
+void 	_ls_push(struct lock_stack *ls, struct lock_class *class,
+    struct lock_object *lock, char *file, int line);
+int 	ls_trypush(struct lock_stack *ls, struct lock_class *class,
+    struct lock_object *lock);
+void 	ls_pop(struct lock_stack *ls);
+void 	ls_popa(struct lock_stack *ls);
+
 #ifdef	WITNESS
 
 /* Flags for witness_warn(). */

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 09:41:54 2010
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 99F60106564A;
	Sat, 24 Apr 2010 09:41:54 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 8A5008FC2A;
	Sat, 24 Apr 2010 09:41:54 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O9fs0k090060;
	Sat, 24 Apr 2010 09:41:54 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O9frh0090058;
	Sat, 24 Apr 2010 09:41:53 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004240941.o3O9frh0090058@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 09:41:53 +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: r207147 - user/jmallett/octeon/sys/conf
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: Sat, 24 Apr 2010 09:41:54 -0000

Author: jmallett
Date: Sat Apr 24 09:41:53 2010
New Revision: 207147
URL: http://svn.freebsd.org/changeset/base/207147

Log:
  Push up inline limits; the Octeon SDK does a scandalous amount of inlining.

Modified:
  user/jmallett/octeon/sys/conf/kern.pre.mk

Modified: user/jmallett/octeon/sys/conf/kern.pre.mk
==============================================================================
--- user/jmallett/octeon/sys/conf/kern.pre.mk	Sat Apr 24 08:04:37 2010	(r207146)
+++ user/jmallett/octeon/sys/conf/kern.pre.mk	Sat Apr 24 09:41:53 2010	(r207147)
@@ -91,8 +91,8 @@ CFLAGS=	${COPTFLAGS} ${C_DIALECT} ${DEBU
 CFLAGS+= ${INCLUDES} -D_KERNEL -DHAVE_KERNEL_OPTION_HEADERS -include opt_global.h
 .if ${CC} != "icc"
 CFLAGS+= -fno-common -finline-limit=${INLINE_LIMIT}
-CFLAGS+= --param inline-unit-growth=100
-CFLAGS+= --param large-function-growth=1000
+CFLAGS+= --param inline-unit-growth=1000
+CFLAGS+= --param large-function-growth=100000
 WERROR?= -Werror
 .endif
 

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 09:43:11 2010
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 14C1C1065670;
	Sat, 24 Apr 2010 09:43:11 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 048C68FC1A;
	Sat, 24 Apr 2010 09:43:11 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O9hAtw090406;
	Sat, 24 Apr 2010 09:43:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O9hADg090402;
	Sat, 24 Apr 2010 09:43:10 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004240943.o3O9hADg090402@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 09:43: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: r207148 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 09:43:11 -0000

Author: jmallett
Date: Sat Apr 24 09:43:10 2010
New Revision: 207148
URL: http://svn.freebsd.org/changeset/base/207148

Log:
  Add rather meaningless ifmedia interface; need to do an ioctl interface next.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 09:41:53 2010	(r207147)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 09:43:10 2010	(r207148)
@@ -37,6 +37,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #ifndef CAVIUM_ETHERNET_H
 #define CAVIUM_ETHERNET_H
 
+#include <net/if_media.h>
+
 /**
  * These enumerations are the return codes for the Ethernet
  * driver intercept callback. Depending on the return code,
@@ -108,6 +110,8 @@ typedef struct {
 
 	int (*init)(struct ifnet *ifp);
 	void (*uninit)(struct ifnet *ifp);
+
+	struct ifmedia media;
 } cvm_oct_private_t;
 
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 09:41:53 2010	(r207147)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 09:43:10 2010	(r207148)
@@ -294,7 +294,6 @@ int cvm_oct_common_init(struct ifnet *if
 	memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats));
 #endif
 
-	if_initname(ifp, device_get_name(priv->dev), device_get_unit(priv->dev));
 	ether_ifattach(ifp, mac);
 
 	return 0;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 09:41:53 2010	(r207147)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 09:43:10 2010	(r207148)
@@ -28,6 +28,8 @@
 
 /*
  * Cavium Octeon Ethernet devices.
+ *
+ * XXX This file should be moved to if_octe.c
  */
 
 #include <sys/param.h>
@@ -44,6 +46,9 @@
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
 
+#include <net/if.h>
+#include <net/if_types.h>
+
 #include "wrapper-cvmx-includes.h"
 #include "cavium-ethernet.h"
 
@@ -52,6 +57,9 @@ static int		octe_attach(device_t dev);
 static int		octe_detach(device_t dev);
 static int		octe_shutdown(device_t dev);
 
+static int		octe_medchange(struct ifnet *ifp);
+static void		octe_medstat(struct ifnet *ifp, struct ifmediareq *ifm);
+
 static device_method_t octe_methods[] = {
 	/* Device interface */
 	DEVMETHOD(device_probe,		octe_probe),
@@ -91,6 +99,18 @@ octe_probe(device_t dev)
 static int
 octe_attach(device_t dev)
 {
+	struct ifnet *ifp;
+	cvm_oct_private_t *priv;
+
+	priv = device_get_softc(dev);
+	ifp = priv->ifp;
+
+	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
+
+	ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
+	ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+	ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+
 	return (0);
 }
 
@@ -105,3 +125,49 @@ octe_shutdown(device_t dev)
 {
 	return (octe_detach(dev));
 }
+
+static int
+octe_medchange(struct ifnet *ifp)
+{
+	return (ENOTSUP);
+}
+
+static void
+octe_medstat(struct ifnet *ifp, struct ifmediareq *ifm)
+{
+	cvm_oct_private_t *priv;
+	cvmx_helper_link_info_t link_info;
+
+	ifm->ifm_status = IFM_AVALID;
+	ifm->ifm_active = IFT_ETHER;
+
+	priv = ifp->if_softc;
+	priv->poll(ifp);
+
+	link_info.u64 = priv->link_info;
+
+        if (!link_info.s.link_up)
+		return;
+
+	ifm->ifm_status |= IFM_ACTIVE;
+
+	switch (link_info.s.speed) {
+	case 10:
+		ifm->ifm_active |= IFM_10_T;
+		break;
+	case 100:
+		ifm->ifm_active |= IFM_100_TX;
+		break;
+	case 1000:
+		ifm->ifm_active |= IFM_1000_T;
+		break;
+	case 10000:
+		ifm->ifm_active |= IFM_10G_T;
+		break;
+	}
+
+	if (link_info.s.full_duplex)
+		ifm->ifm_active |= IFM_FDX;
+	else
+		ifm->ifm_active |= IFM_HDX;
+}

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 09:57:20 2010
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 0B0441065673;
	Sat, 24 Apr 2010 09:57:20 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id D5B2A8FC25;
	Sat, 24 Apr 2010 09:57:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O9vIvE093670;
	Sat, 24 Apr 2010 09:57:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O9vIfG093668;
	Sat, 24 Apr 2010 09:57:18 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004240957.o3O9vIfG093668@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 09:57:18 +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: r207149 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 09:57:20 -0000

Author: jmallett
Date: Sat Apr 24 09:57:18 2010
New Revision: 207149
URL: http://svn.freebsd.org/changeset/base/207149

Log:
  Add a stub ioctl, enough to call our not-quite-right medstat function.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 09:43:10 2010	(r207148)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 09:57:18 2010	(r207149)
@@ -46,19 +46,22 @@
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
 
+#include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_types.h>
 
 #include "wrapper-cvmx-includes.h"
 #include "cavium-ethernet.h"
 
-static int		octe_probe(device_t dev);
-static int		octe_attach(device_t dev);
-static int		octe_detach(device_t dev);
-static int		octe_shutdown(device_t dev);
+static int		octe_probe(device_t);
+static int		octe_attach(device_t);
+static int		octe_detach(device_t);
+static int		octe_shutdown(device_t);
 
-static int		octe_medchange(struct ifnet *ifp);
-static void		octe_medstat(struct ifnet *ifp, struct ifmediareq *ifm);
+static int		octe_medchange(struct ifnet *);
+static void		octe_medstat(struct ifnet *, struct ifmediareq *);
+
+static int		octe_ioctl(struct ifnet *, u_long, caddr_t);
 
 static device_method_t octe_methods[] = {
 	/* Device interface */
@@ -111,6 +114,8 @@ octe_attach(device_t dev)
 	ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
 
+	ifp->if_ioctl = octe_ioctl;
+
 	return (0);
 }
 
@@ -138,10 +143,13 @@ octe_medstat(struct ifnet *ifp, struct i
 	cvm_oct_private_t *priv;
 	cvmx_helper_link_info_t link_info;
 
+	priv = ifp->if_softc;
+
 	ifm->ifm_status = IFM_AVALID;
 	ifm->ifm_active = IFT_ETHER;
 
-	priv = ifp->if_softc;
+	if (priv->poll == NULL)
+		return;
 	priv->poll(ifp);
 
 	link_info.u64 = priv->link_info;
@@ -171,3 +179,29 @@ octe_medstat(struct ifnet *ifp, struct i
 	else
 		ifm->ifm_active |= IFM_HDX;
 }
+
+static int
+octe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
+{
+	cvm_oct_private_t *priv;
+	struct ifreq *ifr;
+	int error;
+
+	priv = ifp->if_softc;
+	ifr = (struct ifreq *)data;
+
+	switch (cmd) {
+	case SIOCSIFMEDIA:
+	case SIOCGIFMEDIA:
+		error = ifmedia_ioctl(ifp, ifr, &priv->media, cmd);
+		if (error != 0)
+			return (error);
+		return (0);
+	
+	default:
+		error = ether_ioctl(ifp, cmd, data);
+		if (error != 0)
+			return (error);
+		return (0);
+	}
+}

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 10:22:08 2010
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 D3C49106564A;
	Sat, 24 Apr 2010 10:22:08 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id C32868FC13;
	Sat, 24 Apr 2010 10:22:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OAM8Zk002163;
	Sat, 24 Apr 2010 10:22:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OAM8NQ002158;
	Sat, 24 Apr 2010 10:22:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004241022.o3OAM8NQ002158@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 10:22:08 +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: r207150 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 10:22:08 -0000

Author: jmallett
Date: Sat Apr 24 10:22:08 2010
New Revision: 207150
URL: http://svn.freebsd.org/changeset/base/207150

Log:
  o) Move interface flags management to octe.c.
  o) Allow MTU changing.
  o) Add trivial init/stop methods.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 09:57:18 2010	(r207149)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 10:22:08 2010	(r207150)
@@ -112,6 +112,7 @@ typedef struct {
 	void (*uninit)(struct ifnet *ifp);
 
 	struct ifmedia media;
+	int if_flags;
 } cvm_oct_private_t;
 
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 09:57:18 2010	(r207149)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 10:22:08 2010	(r207150)
@@ -182,7 +182,7 @@ static int cvm_oct_common_set_mac_addres
  * @param new_mtu The new MTU
  * @return Zero on success
  */
-static int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu)
+int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu)
 {
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 	int interface = INTERFACE(priv->port);
@@ -261,20 +261,10 @@ int cvm_oct_common_init(struct ifnet *if
 #endif
 	count++;
 
-	/*
-	 * XXX
-	 * Need to set:
-	 * 	if_init
-	 * 	if_ioctl
-	 * 	if_start
-	 */
-	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
-
 #if 0
 	ifp->get_stats          = cvm_oct_common_get_stats;
 	ifp->set_mac_address    = cvm_oct_common_set_mac_address;
 	ifp->set_multicast_list = cvm_oct_common_set_multicast_list;
-	ifp->change_mtu         = cvm_oct_common_change_mtu;
 	ifp->do_ioctl           = cvm_oct_ioctl;
 	ifp->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
 	SET_ETHTOOL_OPS(ifp, &cvm_oct_ethtool_ops);

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Sat Apr 24 09:57:18 2010	(r207149)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.h	Sat Apr 24 10:22:08 2010	(r207150)
@@ -30,6 +30,8 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 int cvm_oct_common_init(struct ifnet *ifp);
 void cvm_oct_common_uninit(struct ifnet *ifp);
 
+int cvm_oct_common_change_mtu(struct ifnet *ifp, int new_mtu);
+
 int cvm_oct_init_module(device_t);
 void cvm_oct_cleanup_module(void);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 09:57:18 2010	(r207149)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 10:22:08 2010	(r207150)
@@ -30,6 +30,8 @@
  * Cavium Octeon Ethernet devices.
  *
  * XXX This file should be moved to if_octe.c
+ * XXX The driver may have sufficient locking but we need locking to protect
+ *     the interfaces presented here, right?
  */
 
 #include <sys/param.h>
@@ -53,11 +55,16 @@
 #include "wrapper-cvmx-includes.h"
 #include "cavium-ethernet.h"
 
+#include "ethernet-common.h"
+
 static int		octe_probe(device_t);
 static int		octe_attach(device_t);
 static int		octe_detach(device_t);
 static int		octe_shutdown(device_t);
 
+static void		octe_init(void *);
+static void		octe_stop(void *);
+
 static int		octe_medchange(struct ifnet *);
 static void		octe_medstat(struct ifnet *, struct ifmediareq *);
 
@@ -114,8 +121,12 @@ octe_attach(device_t dev)
 	ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
 	ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
 
+	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
+	ifp->if_init = octe_init;
 	ifp->if_ioctl = octe_ioctl;
 
+	priv->if_flags = ifp->if_flags;
+
 	return (0);
 }
 
@@ -131,6 +142,32 @@ octe_shutdown(device_t dev)
 	return (octe_detach(dev));
 }
 
+static void
+octe_init(void *arg)
+{
+	struct ifnet *ifp;
+	cvm_oct_private_t *priv;
+
+	priv = arg;
+	ifp = priv->ifp;
+
+	if (priv->open != NULL)
+		priv->open(ifp);
+}
+
+static void
+octe_stop(void *arg)
+{
+	struct ifnet *ifp;
+	cvm_oct_private_t *priv;
+
+	priv = arg;
+	ifp = priv->ifp;
+
+	if (priv->stop != NULL)
+		priv->stop(ifp);
+}
+
 static int
 octe_medchange(struct ifnet *ifp)
 {
@@ -191,6 +228,23 @@ octe_ioctl(struct ifnet *ifp, u_long cmd
 	ifr = (struct ifreq *)data;
 
 	switch (cmd) {
+	case SIOCSIFFLAGS:
+		if ((ifp->if_flags & IFF_UP) != 0) {
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
+				octe_init(ifp);
+		} else {
+			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
+				octe_stop(ifp);
+		}
+		priv->if_flags = ifp->if_flags;
+		return (0);
+
+	case SIOCSIFMTU:
+		error = cvm_oct_common_change_mtu(ifp, ifr->ifr_mtu);
+		if (error != 0)
+			return (EINVAL);
+		return (0);
+
 	case SIOCSIFMEDIA:
 	case SIOCGIFMEDIA:
 		error = ifmedia_ioctl(ifp, ifr, &priv->media, cmd);

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 19:51:08 2010
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 43596106564A;
	Sat, 24 Apr 2010 19:51:08 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 314D68FC1A;
	Sat, 24 Apr 2010 19:51:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OJp8dj029712;
	Sat, 24 Apr 2010 19:51:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OJp81u029710;
	Sat, 24 Apr 2010 19:51:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004241951.o3OJp81u029710@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 19:51:07 +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: r207157 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 19:51:08 -0000

Author: jmallett
Date: Sat Apr 24 19:51:07 2010
New Revision: 207157
URL: http://svn.freebsd.org/changeset/base/207157

Log:
  o) Move more interface initialization into octe.c.
  o) Add MII support.
  o) Fix how octe_init() and octe_stop() are called within octe.c.
  
  This is enough to get link status reported correctly (XXX only on interfaces
  that are marked UP, though; an interface that's never marked UP is forced into
  10M mode and is inoperable in the bootloader without a cold boot) and to
  receive packets, although the content of those packets is just garbage.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 18:13:12 2010	(r207156)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 19:51:07 2010	(r207157)
@@ -85,6 +85,9 @@ typedef cvm_oct_callback_result_t (*cvm_
  * driver state stored in ifp->if_softc.
  */
 typedef struct {
+	/* XXX FreeBSD device softcs must start with an ifnet pointer.  */
+	struct ifnet *ifp;
+
 	int                     port;           /* PKO hardware output port */
 	int                     queue;          /* PKO hardware queue for the port */
 	int                     fau;            /* Hardware fetch and add to count outstanding tx buffers */
@@ -103,7 +106,7 @@ typedef struct {
 	 * FreeBSD additions.
 	 */
 	device_t dev;
-	struct ifnet *ifp;
+	device_t miibus;
 
 	int (*open)(struct ifnet *ifp);
 	int (*stop)(struct ifnet *ifp);
@@ -111,6 +114,9 @@ typedef struct {
 	int (*init)(struct ifnet *ifp);
 	void (*uninit)(struct ifnet *ifp);
 
+	uint8_t mac[6];
+	int phy_id;
+
 	struct ifmedia media;
 	int if_flags;
 } cvm_oct_private_t;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 18:13:12 2010	(r207156)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 19:51:07 2010	(r207157)
@@ -151,6 +151,8 @@ static int cvm_oct_common_set_mac_addres
 	int interface = INTERFACE(priv->port);
 	int index = INDEX(priv->port);
 
+	memcpy(priv->mac, addr, 6);
+
 	if ((interface < 2) && (cvmx_helper_interface_get_mode(interface) != CVMX_HELPER_INTERFACE_MODE_SPI)) {
 		int i;
 		uint8_t *ptr = addr;
@@ -242,8 +244,6 @@ int cvm_oct_common_init(struct ifnet *if
 		octeon_bootinfo->mac_addr_base[5] + count};
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
 
-	device_attach(priv->dev);
-
 	/* Force the interface to use the POW send if always_use_pow was
 	   specified or it is in the pow send list */
 	if ((pow_send_group != -1) && (always_use_pow || strstr(pow_send_list, if_name(ifp))))
@@ -265,9 +265,7 @@ int cvm_oct_common_init(struct ifnet *if
 	ifp->get_stats          = cvm_oct_common_get_stats;
 	ifp->set_mac_address    = cvm_oct_common_set_mac_address;
 	ifp->set_multicast_list = cvm_oct_common_set_multicast_list;
-	ifp->do_ioctl           = cvm_oct_ioctl;
 	ifp->features           |= NETIF_F_LLTX; /* We do our own locking, Linux doesn't need to */
-	SET_ETHTOOL_OPS(ifp, &cvm_oct_ethtool_ops);
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	ifp->poll_controller    = cvm_oct_poll_controller;
 #endif
@@ -284,7 +282,7 @@ int cvm_oct_common_init(struct ifnet *if
 	memset(ifp->get_stats(ifp), 0, sizeof(struct ifnet_stats));
 #endif
 
-	ether_ifattach(ifp, mac);
+	device_attach(priv->dev);
 
 	return 0;
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Sat Apr 24 18:13:12 2010	(r207156)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.c	Sat Apr 24 19:51:07 2010	(r207157)
@@ -49,7 +49,6 @@ MTX_SYSINIT(cvm_oct_mdio, &mdio_mtx, "MD
 #define	MDIO_LOCK()	mtx_lock(&mdio_mtx)
 #define	MDIO_UNLOCK()	mtx_unlock(&mdio_mtx)
 
-#if 0
 /**
  * Perform an MII read. Called by the generic MII routines
  *
@@ -58,11 +57,12 @@ MTX_SYSINIT(cvm_oct_mdio, &mdio_mtx, "MD
  * @param location Register location to read
  * @return Result from the read or zero on failure
  */
-static int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location)
+int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location)
 {
 	cvmx_smi_cmd_t          smi_cmd;
 	cvmx_smi_rd_dat_t       smi_rd;
 
+	MDIO_LOCK();
 	smi_cmd.u64 = 0;
 	smi_cmd.s.phy_op = 1;
 	smi_cmd.s.phy_adr = phy_id;
@@ -70,22 +70,21 @@ static int cvm_oct_mdio_read(struct ifne
 	cvmx_write_csr(CVMX_SMI_CMD, smi_cmd.u64);
 
 	do {
+#if 0
 		if (!in_interrupt())
 			yield();
+#endif
 		smi_rd.u64 = cvmx_read_csr(CVMX_SMI_RD_DAT);
 	} while (smi_rd.s.pending);
 
+	MDIO_UNLOCK();
+
 	if (smi_rd.s.val)
 		return smi_rd.s.dat;
 	else
 		return 0;
 }
 
-static int cvm_oct_mdio_dummy_read(struct ifnet *ifp, int phy_id, int location)
-{
-    return 0xffff;
-}
-
 
 /**
  * Perform an MII write. Called by the generic MII routines
@@ -95,11 +94,12 @@ static int cvm_oct_mdio_dummy_read(struc
  * @param location Register location to write
  * @param val      Value to write
  */
-static void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val)
+void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val)
 {
 	cvmx_smi_cmd_t          smi_cmd;
 	cvmx_smi_wr_dat_t       smi_wr;
 
+	MDIO_LOCK();
 	smi_wr.u64 = 0;
 	smi_wr.s.dat = val;
 	cvmx_write_csr(CVMX_SMI_WR_DAT, smi_wr.u64);
@@ -111,116 +111,15 @@ static void cvm_oct_mdio_write(struct if
 	cvmx_write_csr(CVMX_SMI_CMD, smi_cmd.u64);
 
 	do {
+#if 0
 		if (!in_interrupt())
 			yield();
+#endif
 		smi_wr.u64 = cvmx_read_csr(CVMX_SMI_WR_DAT);
 	} while (smi_wr.s.pending);
-}
-
-static void cvm_oct_mdio_dummy_write(struct ifnet *ifp, int phy_id, int location, int val)
-{
-}
-
-
-static void cvm_oct_get_drvinfo(struct ifnet *ifp, struct ethtool_drvinfo *info)
-{
-	strcpy(info->driver, "cavium-ethernet");
-	strcpy(info->version, OCTEON_SDK_VERSION_STRING);
-	strcpy(info->bus_info, "Builtin");
-}
-
-
-static int cvm_oct_get_settings(struct ifnet *ifp, struct ethtool_cmd *cmd)
-{
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	int ret; 
-
-	MDIO_LOCK();
-	ret = mii_ethtool_gset(&priv->mii_info, cmd);
-	MDIO_UNLOCK();
-
-	return ret;
-}
-
-
-static int cvm_oct_set_settings(struct ifnet *ifp, struct ethtool_cmd *cmd)
-{
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	int ret;
-
-	MDIO_LOCK();
-	ret =  mii_ethtool_sset(&priv->mii_info, cmd);
-	MDIO_UNLOCK();
-
-	return ret;
-}
-
-
-static int cvm_oct_nway_reset(struct ifnet *ifp)
-{
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	int ret;
-	
-	MDIO_LOCK();
-	ret = mii_nway_restart(&priv->mii_info);
 	MDIO_UNLOCK();
-
-	return ret; 
 }
 
-
-static u32 cvm_oct_get_link(struct ifnet *ifp)
-{
-	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	u32 ret;
-
-	MDIO_LOCK();
-	ret = mii_link_ok(&priv->mii_info);
-	MDIO_UNLOCK();
-
-	return ret; 
-}
-
-
-struct ethtool_ops cvm_oct_ethtool_ops = {
-	.get_drvinfo    = cvm_oct_get_drvinfo,
-	.get_settings   = cvm_oct_get_settings,
-	.set_settings   = cvm_oct_set_settings,
-	.nway_reset     = cvm_oct_nway_reset,
-	.get_link       = cvm_oct_get_link,
-	.get_sg         = ethtool_op_get_sg,
-	.get_tx_csum    = ethtool_op_get_tx_csum,
-};
-#endif
-
-
-/**
- * IOCTL support for PHY control
- *
- * @param dev    Device to change
- * @param rq     the request
- * @param cmd    the command
- * @return Zero on success
- */
-int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd)
-{
-#if 0
-	cvm_oct_private_t      *priv = (cvm_oct_private_t *)ifp->if_softc;
-	struct mii_ioctl_data  *data = if_mii(rq);
-	unsigned int            duplex_chg;
-	int ret;
-
-	MDIO_LOCK();
-	ret = generic_mii_ioctl(&priv->mii_info, data, cmd, &duplex_chg);
-	MDIO_UNLOCK();
-
-	return ret; 
-#else
-	panic("%s: not yet implemented.", __func__);
-#endif
-}
-
-
 /**
  * Setup the MDIO device structures
  *
@@ -230,23 +129,10 @@ int cvm_oct_ioctl(struct ifnet *ifp, str
  */
 int cvm_oct_mdio_setup_device(struct ifnet *ifp)
 {
-	/*
-	 * XXX/juli
-	 * Once we have a device_t for this interface, attach the MII bus to it.
-	 */
-#if 0
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	int phy_id = cvmx_helper_board_get_mii_address(priv->port);
-	if (phy_id != -1) {
-		priv->mii_info.dev = dev;
-		priv->mii_info.phy_id = phy_id;
-		priv->mii_info.phy_id_mask = 0xff;
-		priv->mii_info.supports_gmii = 1;
-		priv->mii_info.reg_num_mask = 0x1f;
-		priv->mii_info.mdio_read = cvm_oct_mdio_read;
-		priv->mii_info.mdio_write = cvm_oct_mdio_write;
-	}
-#endif
+
+	priv->phy_id = cvmx_helper_board_get_mii_address(priv->port);
+
 	return 0;
 }
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Sat Apr 24 18:13:12 2010	(r207156)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-mdio.h	Sat Apr 24 19:51:07 2010	(r207157)
@@ -26,26 +26,8 @@ TO THE MAXIMUM EXTENT PERMITTED BY LAW, 
 AND WITH ALL FAULTS AND CAVIUM  NETWORKS MAKES NO PROMISES, REPRESENTATIONS OR WARRANTIES, EITHER EXPRESS, IMPLIED, STATUTORY, OR OTHERWISE, WITH RESPECT TO THE SOFTWARE, INCLUDING ITS CONDITION, ITS CONFORMITY TO ANY REPRESENTATION OR DESCRIPTION, OR THE EXISTENCE OF ANY LATENT OR PATENT DEFECTS, AND CAVIUM SPECIFICALLY DISCLAIMS ALL IMPLIED (IF ANY) WARRANTIES OF TITLE, MERCHANTABILITY, NONINFRINGEMENT, FITNESS FOR A PARTICULAR PURPOSE, LACK OF VIRUSES, ACCURACY OR COMPLETENESS, QUIET ENJOYMENT, QUIET POSSESSION OR CORRESPONDENCE TO DESCRIPTION. THE ENTIRE  RISK ARISING OUT OF USE OR PERFORMANCE OF THE SOFTWARE LIES WITH YOU.
 
 *************************************************************************/
-#if 0
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/netdevice.h>
-#include <linux/init.h>
-#include <linux/etherdevice.h>
-#include <linux/ip.h>
-#include <linux/string.h>
-#include <linux/ethtool.h>
-#include <linux/mii.h>
-#include <linux/seq_file.h>
-#include <linux/proc_fs.h>
-#include <net/dst.h>
-#ifdef CONFIG_XFRM
-#include <linux/xfrm.h>
-#include <net/xfrm.h>
-#endif  /* CONFIG_XFRM */
-#endif
 
-extern struct ethtool_ops cvm_oct_ethtool_ops;
-int cvm_oct_ioctl(struct ifnet *ifp, struct ifreq *rq, int cmd);
+int cvm_oct_mdio_read(struct ifnet *ifp, int phy_id, int location);
+void cvm_oct_mdio_write(struct ifnet *ifp, int phy_id, int location, int val);
 int cvm_oct_mdio_setup_device(struct ifnet *ifp);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 18:13:12 2010	(r207156)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 19:51:07 2010	(r207157)
@@ -50,21 +50,34 @@
 
 #include <net/ethernet.h>
 #include <net/if.h>
+#include <net/if_media.h>
 #include <net/if_types.h>
 
+#include <dev/mii/mii.h>
+#include <dev/mii/miivar.h>
+
 #include "wrapper-cvmx-includes.h"
 #include "cavium-ethernet.h"
 
 #include "ethernet-common.h"
+#include "ethernet-mdio.h"
+
+#include "miibus_if.h"
 
 static int		octe_probe(device_t);
 static int		octe_attach(device_t);
 static int		octe_detach(device_t);
 static int		octe_shutdown(device_t);
 
+static int		octe_miibus_readreg(device_t, int, int);
+static int		octe_miibus_writereg(device_t, int, int, int);
+
 static void		octe_init(void *);
 static void		octe_stop(void *);
 
+static int		octe_mii_medchange(struct ifnet *);
+static void		octe_mii_medstat(struct ifnet *, struct ifmediareq *);
+
 static int		octe_medchange(struct ifnet *);
 static void		octe_medstat(struct ifnet *, struct ifmediareq *);
 
@@ -77,6 +90,10 @@ static device_method_t octe_methods[] = 
 	DEVMETHOD(device_detach,	octe_detach),
 	DEVMETHOD(device_shutdown,	octe_shutdown),
 
+	/* MII interface */
+	DEVMETHOD(miibus_readreg,	octe_miibus_readreg),
+	DEVMETHOD(miibus_writereg,	octe_miibus_writereg),
+
 	{ 0, 0 }
 };
 
@@ -89,6 +106,7 @@ static driver_t octe_driver = {
 static devclass_t octe_devclass;
 
 DRIVER_MODULE(octe, octebus, octe_driver, octe_devclass, 0, 0);
+DRIVER_MODULE(miibus, octe, miibus_driver, miibus_devclass, 0, 0);
 
 static driver_t pow_driver = {
 	"pow",
@@ -111,6 +129,7 @@ octe_attach(device_t dev)
 {
 	struct ifnet *ifp;
 	cvm_oct_private_t *priv;
+	int error;
 
 	priv = device_get_softc(dev);
 	ifp = priv->ifp;
@@ -118,8 +137,18 @@ octe_attach(device_t dev)
 	if_initname(ifp, device_get_name(dev), device_get_unit(dev));
 
 	ifmedia_init(&priv->media, 0, octe_medchange, octe_medstat);
-	ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
-	ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+	if (priv->phy_id == -1) {
+		ifmedia_add(&priv->media, IFM_ETHER | IFM_AUTO, 0, NULL);
+		ifmedia_set(&priv->media, IFM_ETHER | IFM_AUTO);
+	} else {
+		error = mii_phy_probe(dev, &priv->miibus, octe_mii_medchange,
+				      octe_mii_medstat);
+		if (error != 0) {
+			device_printf(dev, "could not find PHY!\n");
+			/* XXX Cleanup.  */
+			return (error);
+		}
+	}
 
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_init = octe_init;
@@ -127,6 +156,8 @@ octe_attach(device_t dev)
 
 	priv->if_flags = ifp->if_flags;
 
+	ether_ifattach(ifp, priv->mac);
+
 	return (0);
 }
 
@@ -142,6 +173,28 @@ octe_shutdown(device_t dev)
 	return (octe_detach(dev));
 }
 
+static int
+octe_miibus_readreg(device_t dev, int phy, int reg)
+{
+	cvm_oct_private_t *priv;
+
+	priv = device_get_softc(dev);
+
+	return (cvm_oct_mdio_read(priv->ifp, phy, reg));
+}
+
+static int
+octe_miibus_writereg(device_t dev, int phy, int reg, int val)
+{
+	cvm_oct_private_t *priv;
+
+	priv = device_get_softc(dev);
+
+	cvm_oct_mdio_write(priv->ifp, phy, reg, val);
+
+	return (0);
+}
+
 static void
 octe_init(void *arg)
 {
@@ -151,8 +204,13 @@ octe_init(void *arg)
 	priv = arg;
 	ifp = priv->ifp;
 
+	octe_stop(priv);
+
 	if (priv->open != NULL)
 		priv->open(ifp);
+
+	if (priv->miibus != NULL)
+		mii_mediachg(device_get_softc(priv->miibus));
 }
 
 static void
@@ -169,6 +227,40 @@ octe_stop(void *arg)
 }
 
 static int
+octe_mii_medchange(struct ifnet *ifp)
+{
+	cvm_oct_private_t *priv;
+	struct mii_data *mii;
+
+	priv = ifp->if_softc;
+	mii = device_get_softc(priv->miibus);
+
+	if (mii->mii_instance) {
+		struct mii_softc *miisc;
+
+		LIST_FOREACH(miisc, &mii->mii_phys, mii_list)
+			mii_phy_reset(miisc);
+	}
+	mii_mediachg(mii);
+
+	return (0);
+}
+
+static void
+octe_mii_medstat(struct ifnet *ifp, struct ifmediareq *ifm)
+{
+	cvm_oct_private_t *priv;
+	struct mii_data *mii;
+
+	priv = ifp->if_softc;
+	mii = device_get_softc(priv->miibus);
+
+	mii_pollstat(mii);
+	ifm->ifm_active = mii->mii_media_active;
+	ifm->ifm_status = mii->mii_media_status;
+}
+
+static int
 octe_medchange(struct ifnet *ifp)
 {
 	return (ENOTSUP);
@@ -221,6 +313,7 @@ static int
 octe_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data)
 {
 	cvm_oct_private_t *priv;
+	struct mii_data *mii;
 	struct ifreq *ifr;
 	int error;
 
@@ -231,10 +324,10 @@ octe_ioctl(struct ifnet *ifp, u_long cmd
 	case SIOCSIFFLAGS:
 		if ((ifp->if_flags & IFF_UP) != 0) {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) == 0)
-				octe_init(ifp);
+				octe_init(priv);
 		} else {
 			if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0)
-				octe_stop(ifp);
+				octe_stop(priv);
 		}
 		priv->if_flags = ifp->if_flags;
 		return (0);
@@ -247,6 +340,13 @@ octe_ioctl(struct ifnet *ifp, u_long cmd
 
 	case SIOCSIFMEDIA:
 	case SIOCGIFMEDIA:
+		if (priv->miibus != NULL) {
+			mii = device_get_softc(priv->miibus);
+			error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, cmd);
+			if (error != 0)
+				return (error);
+			return (0);
+		}
 		error = ifmedia_ioctl(ifp, ifr, &priv->media, cmd);
 		if (error != 0)
 			return (error);

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 19:52:08 2010
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 331A3106564A;
	Sat, 24 Apr 2010 19:52:08 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 229F38FC0C;
	Sat, 24 Apr 2010 19:52:08 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OJq8cr029947;
	Sat, 24 Apr 2010 19:52:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OJq88M029943;
	Sat, 24 Apr 2010 19:52:08 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004241952.o3OJq88M029943@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 19:52:07 +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: r207158 - user/jmallett/octeon/sys/mips/conf
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: Sat, 24 Apr 2010 19:52:08 -0000

Author: jmallett
Date: Sat Apr 24 19:52:07 2010
New Revision: 207158
URL: http://svn.freebsd.org/changeset/base/207158

Log:
  Add miibus to Octeon configurations, the octe device needs it.

Modified:
  user/jmallett/octeon/sys/mips/conf/OCTEON1
  user/jmallett/octeon/sys/mips/conf/OCTEON1-32
  user/jmallett/octeon/sys/mips/conf/OCTEON1-o32

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1	Sat Apr 24 19:51:07 2010	(r207157)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1	Sat Apr 24 19:52:07 2010	(r207158)
@@ -76,6 +76,7 @@ options		INVARIANT_SUPPORT	#Extra sanity
 #options		WITNESS			#Enable checks to detect deadlocks and cycles
 #options		WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
 
+device          miibus          # MII bus support
 #XXXimp device		genclock
 device		loop
 device		ether

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Sat Apr 24 19:51:07 2010	(r207157)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-32	Sat Apr 24 19:52:07 2010	(r207158)
@@ -66,6 +66,7 @@ options		INVARIANT_SUPPORT	#Extra sanity
 #options		WITNESS			#Enable checks to detect deadlocks and cycles
 #options		WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
 
+device          miibus          # MII bus support
 #XXXimp device		genclock
 device		loop
 device		ether

Modified: user/jmallett/octeon/sys/mips/conf/OCTEON1-o32
==============================================================================
--- user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Sat Apr 24 19:51:07 2010	(r207157)
+++ user/jmallett/octeon/sys/mips/conf/OCTEON1-o32	Sat Apr 24 19:52:07 2010	(r207158)
@@ -66,6 +66,7 @@ options		INVARIANT_SUPPORT	#Extra sanity
 #options		WITNESS			#Enable checks to detect deadlocks and cycles
 #options		WITNESS_SKIPSPIN	#Don't run witness on spinlocks for speed
 
+device          miibus          # MII bus support
 #XXXimp device		genclock
 device		loop
 device		ether

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 20:39:19 2010
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 3231D1065670;
	Sat, 24 Apr 2010 20:39:19 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 21F1F8FC16;
	Sat, 24 Apr 2010 20:39:19 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OKdJKI040376;
	Sat, 24 Apr 2010 20:39:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OKdJi6040374;
	Sat, 24 Apr 2010 20:39:19 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004242039.o3OKdJi6040374@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 20:39:19 +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: r207159 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 20:39:19 -0000

Author: jmallett
Date: Sat Apr 24 20:39:18 2010
New Revision: 207159
URL: http://svn.freebsd.org/changeset/base/207159

Log:
  o) Uncomment some prefetches.
  o) Adjust m_data by the offset within the buffer of the packet.
  
  Now packet receive actually works.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Sat Apr 24 19:52:07 2010	(r207158)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-rx.c	Sat Apr 24 20:39:18 2010	(r207159)
@@ -203,9 +203,7 @@ void cvm_oct_tasklet_rx(void *context, i
 			else
 				work = NULL;
 		}
-#if 0
-		prefetch(work);
-#endif
+		CVMX_PREFETCH(work, 0);
 		if (work == NULL)
 			break;
 
@@ -224,10 +222,8 @@ void cvm_oct_tasklet_rx(void *context, i
 		mbuf_in_hw = USE_MBUFS_IN_HW && work->word2.s.bufs == 1;
 		if ((mbuf_in_hw)) {
 			m = *(struct mbuf **)(cvm_oct_get_buffer_ptr(work->packet_ptr) - sizeof(void *));
-#if 0
-			CVMX_PREFETCH(m, offsetof(struct mbuf, head));
-			CVMX_PREFETCH(m, offsetof(struct mbuf, len));
-#endif
+			CVMX_PREFETCH(m, offsetof(struct mbuf, m_data));
+			CVMX_PREFETCH(m, offsetof(struct mbuf, m_pkthdr));
 		}
 		CVMX_PREFETCH(cvm_oct_device[work->ipprt], 0);
 		//CVMX_PREFETCH(m, 0);
@@ -248,6 +244,12 @@ void cvm_oct_tasklet_rx(void *context, i
 			m->m_pkthdr.len = m->m_len = work->len;
 
 			packet_not_copied = 1;
+
+			/*
+			 * Adjust the data pointer based on the offset
+			 * of the packet within the buffer.
+			 */
+			m->m_data += (work->packet_ptr.s.back << 7) + (work->packet_ptr.s.addr & 0x7f);
 		} else {
 
 			/* We have to copy the packet. First allocate an

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 21:05:09 2010
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 236E51065690;
	Sat, 24 Apr 2010 21:05:09 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 0F50D8FC12;
	Sat, 24 Apr 2010 21:05:09 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OL59uQ046184;
	Sat, 24 Apr 2010 21:05:09 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OL58E5046168;
	Sat, 24 Apr 2010 21:05:08 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004242105.o3OL58E5046168@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat, 24 Apr 2010 21:05:08 +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: r207160 - in user/kib/vm6: . bin/ln contrib/tzdata etc
	etc/devd etc/mtree include lib lib/libc/stdlib lib/libpkg
	lib/libufs lib/libz release/powerpc sbin/devd sbin/dumpfs
	sbin/fsck_ffs ...
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: Sat, 24 Apr 2010 21:05:09 -0000

Author: kib
Date: Sat Apr 24 21:05:08 2010
New Revision: 207160
URL: http://svn.freebsd.org/changeset/base/207160

Log:
  IFC

Added:
  user/kib/vm6/lib/libpkg/
     - copied from r207158, head/lib/libpkg/
  user/kib/vm6/sbin/fsck_ffs/suj.c
     - copied unchanged from r207158, head/sbin/fsck_ffs/suj.c
  user/kib/vm6/tools/regression/bin/sh/expansion/trim3.0
     - copied unchanged from r207158, head/tools/regression/bin/sh/expansion/trim3.0
  user/kib/vm6/tools/test/testfloat/
     - copied from r207158, head/tools/test/testfloat/
Deleted:
  user/kib/vm6/sys/cddl/dev/cyclic/amd64/
  user/kib/vm6/usr.sbin/pkg_install/lib/
Modified:
  user/kib/vm6/Makefile.inc1
  user/kib/vm6/bin/ln/ln.c
  user/kib/vm6/contrib/tzdata/africa
  user/kib/vm6/contrib/tzdata/asia
  user/kib/vm6/contrib/tzdata/southamerica
  user/kib/vm6/etc/devd.conf
  user/kib/vm6/etc/devd/uath.conf
  user/kib/vm6/etc/mtree/BSD.usr.dist
  user/kib/vm6/include/stdlib.h
  user/kib/vm6/lib/Makefile
  user/kib/vm6/lib/libc/stdlib/realpath.3
  user/kib/vm6/lib/libc/stdlib/realpath.c
  user/kib/vm6/lib/libufs/Makefile
  user/kib/vm6/lib/libufs/cgroup.c
  user/kib/vm6/lib/libufs/inode.c
  user/kib/vm6/lib/libufs/libufs.h
  user/kib/vm6/lib/libufs/sblock.c
  user/kib/vm6/lib/libufs/type.c
  user/kib/vm6/lib/libz/ChangeLog
  user/kib/vm6/lib/libz/README
  user/kib/vm6/lib/libz/crc32.c
  user/kib/vm6/lib/libz/deflate.c
  user/kib/vm6/lib/libz/deflate.h
  user/kib/vm6/lib/libz/gzguts.h
  user/kib/vm6/lib/libz/gzlib.c
  user/kib/vm6/lib/libz/inffast.c
  user/kib/vm6/lib/libz/inffast.h
  user/kib/vm6/lib/libz/inftrees.c
  user/kib/vm6/lib/libz/inftrees.h
  user/kib/vm6/lib/libz/trees.c
  user/kib/vm6/lib/libz/trees.h
  user/kib/vm6/lib/libz/zconf.h
  user/kib/vm6/lib/libz/zlib.3
  user/kib/vm6/lib/libz/zlib.h
  user/kib/vm6/lib/libz/zutil.c
  user/kib/vm6/lib/libz/zutil.h
  user/kib/vm6/release/powerpc/boot_crunch.conf
  user/kib/vm6/sbin/devd/devd.conf.5
  user/kib/vm6/sbin/dumpfs/dumpfs.c
  user/kib/vm6/sbin/fsck_ffs/Makefile
  user/kib/vm6/sbin/fsck_ffs/fsck.h
  user/kib/vm6/sbin/fsck_ffs/gjournal.c
  user/kib/vm6/sbin/fsck_ffs/main.c
  user/kib/vm6/sbin/fsck_ffs/pass5.c
  user/kib/vm6/sbin/fsdb/fsdb.c
  user/kib/vm6/sbin/fsdb/fsdbutil.c
  user/kib/vm6/sbin/geom/class/part/geom_part.c
  user/kib/vm6/sbin/geom/class/part/gpart.8
  user/kib/vm6/sbin/hastctl/Makefile
  user/kib/vm6/sbin/hastd/Makefile
  user/kib/vm6/sbin/hastd/hast_proto.c
  user/kib/vm6/sbin/ping6/ping6.8
  user/kib/vm6/sbin/ping6/ping6.c
  user/kib/vm6/sbin/tunefs/Makefile
  user/kib/vm6/sbin/tunefs/tunefs.8
  user/kib/vm6/sbin/tunefs/tunefs.c
  user/kib/vm6/share/examples/Makefile
  user/kib/vm6/share/misc/committers-src.dot
  user/kib/vm6/share/mk/bsd.cpu.mk
  user/kib/vm6/share/mk/bsd.libnames.mk
  user/kib/vm6/sys/amd64/amd64/bpf_jit_machdep.c
  user/kib/vm6/sys/amd64/amd64/bpf_jit_machdep.h
  user/kib/vm6/sys/amd64/amd64/local_apic.c
  user/kib/vm6/sys/amd64/amd64/pmap.c
  user/kib/vm6/sys/amd64/conf/GENERIC
  user/kib/vm6/sys/amd64/ia32/ia32_signal.c
  user/kib/vm6/sys/amd64/include/proc.h
  user/kib/vm6/sys/arm/arm/pmap.c
  user/kib/vm6/sys/arm/conf/DB-78XXX
  user/kib/vm6/sys/arm/conf/DB-88F5XXX
  user/kib/vm6/sys/arm/conf/DB-88F6XXX
  user/kib/vm6/sys/arm/conf/HL200
  user/kib/vm6/sys/arm/conf/KB920X
  user/kib/vm6/sys/arm/conf/LN2410SBC
  user/kib/vm6/sys/arm/conf/SHEEVAPLUG
  user/kib/vm6/sys/arm/include/proc.h
  user/kib/vm6/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  user/kib/vm6/sys/cddl/dev/cyclic/i386/cyclic_machdep.c
  user/kib/vm6/sys/compat/freebsd32/freebsd32.h
  user/kib/vm6/sys/compat/freebsd32/freebsd32_misc.c
  user/kib/vm6/sys/compat/freebsd32/freebsd32_util.h
  user/kib/vm6/sys/conf/files.sparc64
  user/kib/vm6/sys/conf/files.sun4v
  user/kib/vm6/sys/conf/kern.pre.mk
  user/kib/vm6/sys/conf/kmod.mk
  user/kib/vm6/sys/dev/age/if_age.c
  user/kib/vm6/sys/dev/alc/if_alc.c
  user/kib/vm6/sys/dev/ale/if_ale.c
  user/kib/vm6/sys/dev/drm/ati_pcigart.c
  user/kib/vm6/sys/dev/drm/drmP.h
  user/kib/vm6/sys/dev/drm/drm_bufs.c
  user/kib/vm6/sys/dev/drm/drm_context.c
  user/kib/vm6/sys/dev/drm/drm_drv.c
  user/kib/vm6/sys/dev/drm/drm_hashtab.c
  user/kib/vm6/sys/dev/drm/drm_memory.c
  user/kib/vm6/sys/dev/drm/drm_mm.c
  user/kib/vm6/sys/dev/drm/drm_scatter.c
  user/kib/vm6/sys/dev/drm/drm_sman.c
  user/kib/vm6/sys/dev/drm/drm_sysctl.c
  user/kib/vm6/sys/dev/drm/drm_vm.c
  user/kib/vm6/sys/dev/drm/i915_dma.c
  user/kib/vm6/sys/dev/drm/mach64_dma.c
  user/kib/vm6/sys/dev/drm/mga_dma.c
  user/kib/vm6/sys/dev/drm/mga_warp.c
  user/kib/vm6/sys/dev/drm/r128_cce.c
  user/kib/vm6/sys/dev/drm/r128_state.c
  user/kib/vm6/sys/dev/drm/r600_blit.c
  user/kib/vm6/sys/dev/drm/r600_cp.c
  user/kib/vm6/sys/dev/drm/radeon_cp.c
  user/kib/vm6/sys/dev/drm/radeon_cs.c
  user/kib/vm6/sys/dev/drm/radeon_state.c
  user/kib/vm6/sys/dev/drm/savage_bci.c
  user/kib/vm6/sys/dev/drm/via_dma.c
  user/kib/vm6/sys/dev/drm/via_map.c
  user/kib/vm6/sys/dev/drm/via_mm.c
  user/kib/vm6/sys/dev/fxp/if_fxp.c
  user/kib/vm6/sys/dev/iwn/if_iwn.c
  user/kib/vm6/sys/dev/msk/if_msk.c
  user/kib/vm6/sys/dev/nfe/if_nfe.c
  user/kib/vm6/sys/dev/sge/if_sge.c
  user/kib/vm6/sys/dev/sis/if_sis.c
  user/kib/vm6/sys/dev/sound/usb/uaudio.c
  user/kib/vm6/sys/dev/usb/controller/ehci.c
  user/kib/vm6/sys/dev/usb/controller/uhci.c
  user/kib/vm6/sys/dev/usb/controller/uss820dci.c
  user/kib/vm6/sys/dev/usb/input/atp.c
  user/kib/vm6/sys/dev/usb/input/uhid.c
  user/kib/vm6/sys/dev/usb/input/ukbd.c
  user/kib/vm6/sys/dev/usb/input/ums.c
  user/kib/vm6/sys/dev/usb/misc/udbp.c
  user/kib/vm6/sys/dev/usb/net/if_aue.c
  user/kib/vm6/sys/dev/usb/net/if_axe.c
  user/kib/vm6/sys/dev/usb/net/if_cdce.c
  user/kib/vm6/sys/dev/usb/net/if_cue.c
  user/kib/vm6/sys/dev/usb/net/if_kue.c
  user/kib/vm6/sys/dev/usb/net/if_rue.c
  user/kib/vm6/sys/dev/usb/net/if_udav.c
  user/kib/vm6/sys/dev/usb/serial/u3g.c
  user/kib/vm6/sys/dev/usb/serial/ubsa.c
  user/kib/vm6/sys/dev/usb/serial/ubser.c
  user/kib/vm6/sys/dev/usb/serial/uchcom.c
  user/kib/vm6/sys/dev/usb/serial/uftdi.c
  user/kib/vm6/sys/dev/usb/serial/ulpt.c
  user/kib/vm6/sys/dev/usb/serial/umodem.c
  user/kib/vm6/sys/dev/usb/serial/umoscom.c
  user/kib/vm6/sys/dev/usb/serial/uplcom.c
  user/kib/vm6/sys/dev/usb/serial/usb_serial.c
  user/kib/vm6/sys/dev/usb/serial/uslcom.c
  user/kib/vm6/sys/dev/usb/serial/uvisor.c
  user/kib/vm6/sys/dev/usb/serial/uvscom.c
  user/kib/vm6/sys/dev/usb/storage/umass.c
  user/kib/vm6/sys/dev/usb/storage/urio.c
  user/kib/vm6/sys/dev/usb/storage/ustorage_fs.c
  user/kib/vm6/sys/dev/usb/usb_compat_linux.c
  user/kib/vm6/sys/dev/usb/usb_debug.h
  user/kib/vm6/sys/dev/usb/usb_dev.c
  user/kib/vm6/sys/dev/usb/usb_device.c
  user/kib/vm6/sys/dev/usb/usb_device.h
  user/kib/vm6/sys/dev/usb/usb_freebsd.h
  user/kib/vm6/sys/dev/usb/usb_generic.c
  user/kib/vm6/sys/dev/usb/usb_hub.c
  user/kib/vm6/sys/dev/usb/usb_request.c
  user/kib/vm6/sys/dev/usb/usb_transfer.c
  user/kib/vm6/sys/dev/usb/usb_transfer.h
  user/kib/vm6/sys/dev/usb/wlan/if_rum.c
  user/kib/vm6/sys/dev/usb/wlan/if_run.c
  user/kib/vm6/sys/dev/usb/wlan/if_ural.c
  user/kib/vm6/sys/dev/usb/wlan/if_zyd.c
  user/kib/vm6/sys/fs/nfs/nfs_var.h
  user/kib/vm6/sys/fs/nfsclient/nfs.h
  user/kib/vm6/sys/fs/nfsclient/nfs_clbio.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clnfsiod.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clnode.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clrpcops.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clstate.c
  user/kib/vm6/sys/fs/nfsclient/nfs_clvnops.c
  user/kib/vm6/sys/fs/pseudofs/pseudofs_vnops.c
  user/kib/vm6/sys/geom/geom_subr.c
  user/kib/vm6/sys/geom/part/g_part.c
  user/kib/vm6/sys/geom/part/g_part_apm.c
  user/kib/vm6/sys/geom/part/g_part_bsd.c
  user/kib/vm6/sys/geom/part/g_part_gpt.c
  user/kib/vm6/sys/geom/part/g_part_if.m
  user/kib/vm6/sys/geom/part/g_part_mbr.c
  user/kib/vm6/sys/geom/part/g_part_pc98.c
  user/kib/vm6/sys/geom/part/g_part_vtoc8.c
  user/kib/vm6/sys/i386/conf/GENERIC
  user/kib/vm6/sys/i386/conf/XBOX
  user/kib/vm6/sys/i386/i386/bpf_jit_machdep.c
  user/kib/vm6/sys/i386/i386/bpf_jit_machdep.h
  user/kib/vm6/sys/i386/i386/local_apic.c
  user/kib/vm6/sys/i386/i386/pmap.c
  user/kib/vm6/sys/i386/include/proc.h
  user/kib/vm6/sys/i386/xen/pmap.c
  user/kib/vm6/sys/ia64/conf/GENERIC
  user/kib/vm6/sys/ia64/ia64/pmap.c
  user/kib/vm6/sys/ia64/include/proc.h
  user/kib/vm6/sys/kern/kern_clock.c
  user/kib/vm6/sys/kern/kern_descrip.c
  user/kib/vm6/sys/kern/kern_proc.c
  user/kib/vm6/sys/kern/kern_shutdown.c
  user/kib/vm6/sys/kern/subr_bus.c
  user/kib/vm6/sys/kern/vfs_bio.c
  user/kib/vm6/sys/kern/vfs_cache.c
  user/kib/vm6/sys/kern/vfs_subr.c
  user/kib/vm6/sys/mips/conf/SENTRY5
  user/kib/vm6/sys/mips/conf/SWARM
  user/kib/vm6/sys/mips/conf/XLR
  user/kib/vm6/sys/mips/include/proc.h
  user/kib/vm6/sys/mips/include/vmparam.h
  user/kib/vm6/sys/mips/mips/exception.S
  user/kib/vm6/sys/mips/mips/pmap.c
  user/kib/vm6/sys/mips/mips/tick.c
  user/kib/vm6/sys/mips/sibyte/sb_machdep.c
  user/kib/vm6/sys/modules/cyclic/Makefile
  user/kib/vm6/sys/netinet/ip_input.c
  user/kib/vm6/sys/netinet/sctp_asconf.c
  user/kib/vm6/sys/netinet/sctp_indata.c
  user/kib/vm6/sys/netinet/sctputil.c
  user/kib/vm6/sys/pc98/cbus/clock.c
  user/kib/vm6/sys/pc98/conf/GENERIC
  user/kib/vm6/sys/powerpc/aim/mmu_oea.c
  user/kib/vm6/sys/powerpc/aim/mmu_oea64.c
  user/kib/vm6/sys/powerpc/booke/pmap.c
  user/kib/vm6/sys/powerpc/conf/GENERIC
  user/kib/vm6/sys/powerpc/conf/MPC85XX
  user/kib/vm6/sys/powerpc/include/proc.h
  user/kib/vm6/sys/powerpc/powerpc/mmu_if.m
  user/kib/vm6/sys/powerpc/powerpc/pmap_dispatch.c
  user/kib/vm6/sys/sparc64/conf/GENERIC
  user/kib/vm6/sys/sparc64/include/proc.h
  user/kib/vm6/sys/sparc64/sparc64/pmap.c
  user/kib/vm6/sys/sun4v/conf/GENERIC
  user/kib/vm6/sys/sun4v/include/proc.h
  user/kib/vm6/sys/sun4v/sun4v/pmap.c
  user/kib/vm6/sys/sys/buf.h
  user/kib/vm6/sys/sys/dtrace_bsd.h
  user/kib/vm6/sys/sys/mount.h
  user/kib/vm6/sys/sys/thr.h
  user/kib/vm6/sys/sys/user.h
  user/kib/vm6/sys/ufs/ffs/ffs_alloc.c
  user/kib/vm6/sys/ufs/ffs/ffs_balloc.c
  user/kib/vm6/sys/ufs/ffs/ffs_extern.h
  user/kib/vm6/sys/ufs/ffs/ffs_inode.c
  user/kib/vm6/sys/ufs/ffs/ffs_snapshot.c
  user/kib/vm6/sys/ufs/ffs/ffs_softdep.c
  user/kib/vm6/sys/ufs/ffs/ffs_subr.c
  user/kib/vm6/sys/ufs/ffs/ffs_vfsops.c
  user/kib/vm6/sys/ufs/ffs/ffs_vnops.c
  user/kib/vm6/sys/ufs/ffs/fs.h
  user/kib/vm6/sys/ufs/ffs/softdep.h
  user/kib/vm6/sys/ufs/ufs/dinode.h
  user/kib/vm6/sys/ufs/ufs/inode.h
  user/kib/vm6/sys/ufs/ufs/ufs_dirhash.c
  user/kib/vm6/sys/ufs/ufs/ufs_extern.h
  user/kib/vm6/sys/ufs/ufs/ufs_lookup.c
  user/kib/vm6/sys/ufs/ufs/ufs_vnops.c
  user/kib/vm6/sys/ufs/ufs/ufsmount.h
  user/kib/vm6/sys/vm/pmap.h
  user/kib/vm6/sys/vm/vm_mmap.c
  user/kib/vm6/sys/vm/vm_pageout.c
  user/kib/vm6/sys/x86/isa/clock.c
  user/kib/vm6/tools/regression/bpf/bpf_filter/tests/test0083.h
  user/kib/vm6/tools/test/README
  user/kib/vm6/tools/tools/netrate/tcpp/tcpp_client.c
  user/kib/vm6/tools/tools/netrate/tcpp/tcpp_server.c
  user/kib/vm6/usr.bin/stat/stat.1
  user/kib/vm6/usr.bin/stat/stat.c
  user/kib/vm6/usr.sbin/config/configvers.h
  user/kib/vm6/usr.sbin/config/mkmakefile.c
  user/kib/vm6/usr.sbin/makefs/ffs/ffs_bswap.c
  user/kib/vm6/usr.sbin/pkg_install/Makefile
  user/kib/vm6/usr.sbin/pkg_install/Makefile.inc
  user/kib/vm6/usr.sbin/pkg_install/add/Makefile
  user/kib/vm6/usr.sbin/pkg_install/add/extract.c
  user/kib/vm6/usr.sbin/pkg_install/add/futil.c
  user/kib/vm6/usr.sbin/pkg_install/add/main.c
  user/kib/vm6/usr.sbin/pkg_install/add/perform.c
  user/kib/vm6/usr.sbin/pkg_install/create/Makefile
  user/kib/vm6/usr.sbin/pkg_install/create/main.c
  user/kib/vm6/usr.sbin/pkg_install/create/perform.c
  user/kib/vm6/usr.sbin/pkg_install/create/pl.c
  user/kib/vm6/usr.sbin/pkg_install/delete/Makefile
  user/kib/vm6/usr.sbin/pkg_install/delete/main.c
  user/kib/vm6/usr.sbin/pkg_install/delete/perform.c
  user/kib/vm6/usr.sbin/pkg_install/info/Makefile
  user/kib/vm6/usr.sbin/pkg_install/info/info.h
  user/kib/vm6/usr.sbin/pkg_install/info/main.c
  user/kib/vm6/usr.sbin/pkg_install/info/perform.c
  user/kib/vm6/usr.sbin/pkg_install/info/show.c
  user/kib/vm6/usr.sbin/pkg_install/updating/Makefile
  user/kib/vm6/usr.sbin/pkg_install/updating/main.c
  user/kib/vm6/usr.sbin/pkg_install/version/Makefile
  user/kib/vm6/usr.sbin/pkg_install/version/main.c
  user/kib/vm6/usr.sbin/pkg_install/version/perform.c
  user/kib/vm6/usr.sbin/pmcstat/pmcpl_calltree.c
  user/kib/vm6/usr.sbin/sade/disks.c
  user/kib/vm6/usr.sbin/sade/menus.c
  user/kib/vm6/usr.sbin/sysinstall/disks.c
  user/kib/vm6/usr.sbin/sysinstall/menus.c
  user/kib/vm6/usr.sbin/sysinstall/tcpip.c
Directory Properties:
  user/kib/vm6/   (props changed)
  user/kib/vm6/contrib/gnu-sort/   (props changed)
  user/kib/vm6/contrib/tzcode/stdtime/   (props changed)
  user/kib/vm6/contrib/tzcode/zic/   (props changed)
  user/kib/vm6/contrib/tzdata/   (props changed)
  user/kib/vm6/lib/libz/   (props changed)
  user/kib/vm6/sys/contrib/x86emu/   (props changed)
  user/kib/vm6/sys/mips/rmi/debug.h   (props changed)
  user/kib/vm6/sys/mips/rmi/msgring.h   (props changed)
  user/kib/vm6/sys/mips/rmi/shared_structs.h   (props changed)
  user/kib/vm6/sys/mips/rmi/shared_structs_func.h   (props changed)
  user/kib/vm6/sys/mips/rmi/shared_structs_offsets.h   (props changed)

Modified: user/kib/vm6/Makefile.inc1
==============================================================================
--- user/kib/vm6/Makefile.inc1	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/Makefile.inc1	Sat Apr 24 21:05:08 2010	(r207160)
@@ -259,7 +259,7 @@ WMAKEENV=	${CROSSENV} \
 		VERSION="${VERSION}" \
 		INSTALL="sh ${.CURDIR}/tools/install.sh" \
 		PATH=${TMPPATH}
-.if ${MK_CDDL} == "no" || defined(NO_CTF)
+.if ${MK_CDDL} == "no"
 WMAKEENV+=	NO_CTF=1
 .endif
 WMAKE=		${WMAKEENV} ${MAKE} -f Makefile.inc1 DESTDIR=${WORLDTMP}
@@ -780,7 +780,7 @@ buildkernel:
 	@echo "--------------------------------------------------------------"
 	cd ${KRNLOBJDIR}/${_kernel}; \
 	    MAKESRCPATH=${KERNSRCDIR}/dev/aic7xxx/aicasm \
-	    ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS -DNO_CTF \
+	    ${MAKE} SSP_CFLAGS= -DNO_CPU_CFLAGS \
 	    -f ${KERNSRCDIR}/dev/aic7xxx/aicasm/Makefile
 # XXX - Gratuitously builds aicasm in the ``makeoptions NO_MODULES'' case.
 .if !defined(MODULES_WITH_WORLD) && !defined(NO_MODULES) && exists(${KERNSRCDIR}/modules)
@@ -1111,7 +1111,7 @@ _prebuild_libs=	${_kerberos5_lib_libasn1
 		${_kerberos5_lib_libhx509} ${_kerberos5_lib_libkrb5} \
 		${_kerberos5_lib_libroken} \
 		lib/libbz2 lib/libcom_err lib/libcrypt \
-		lib/libexpat \
+		lib/libexpat lib/libfetch \
 		${_lib_libgssapi} ${_lib_libipx} \
 		lib/libkiconv lib/libkvm lib/libmd \
 		lib/ncurses/ncurses lib/ncurses/ncursesw \
@@ -1138,6 +1138,7 @@ _cddl_lib= cddl/lib
 _secure_lib_libcrypto= secure/lib/libcrypto
 _secure_lib_libssl= secure/lib/libssl
 lib/libradius__L secure/lib/libssl__L: secure/lib/libcrypto__L
+lib/libfetch__L: secure/lib/libcrypto__L secure/lib/libssl__L lib/libmd__L
 .if ${MK_OPENSSH} != "no"
 _secure_lib_libssh= secure/lib/libssh
 secure/lib/libssh__L: lib/libz__L secure/lib/libcrypto__L lib/libcrypt__L
@@ -1173,7 +1174,7 @@ _lib_libypclnt=	lib/libypclnt
 .endif
 
 .if ${MK_OPENSSL} == "no"
-lib/libradius__L: lib/libmd__L
+lib/libfetch__L lib/libradius__L: lib/libmd__L
 .endif
 
 .for _lib in ${_prereq_libs}

Modified: user/kib/vm6/bin/ln/ln.c
==============================================================================
--- user/kib/vm6/bin/ln/ln.c	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/bin/ln/ln.c	Sat Apr 24 21:05:08 2010	(r207160)
@@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$");
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
+#include <libgen.h>
 #include <limits.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -226,6 +227,7 @@ linkit(const char *source, const char *t
 	int ch, exists, first;
 	char path[PATH_MAX];
 	char wbuf[PATH_MAX];
+	char bbuf[PATH_MAX];
 
 	if (!sflag) {
 		/* If source doesn't exist, quit now. */
@@ -248,11 +250,9 @@ linkit(const char *source, const char *t
 	if (isdir ||
 	    (lstat(target, &sb) == 0 && S_ISDIR(sb.st_mode)) ||
 	    (!hflag && stat(target, &sb) == 0 && S_ISDIR(sb.st_mode))) {
-		if ((p = strrchr(source, '/')) == NULL)
-			p = source;
-		else
-			++p;
-		if (snprintf(path, sizeof(path), "%s/%s", target, p) >=
+		if (strlcpy(bbuf, source, sizeof(bbuf)) >= sizeof(bbuf) ||
+		    (p = basename(bbuf)) == NULL ||
+		    snprintf(path, sizeof(path), "%s/%s", target, p) >=
 		    (ssize_t)sizeof(path)) {
 			errno = ENAMETOOLONG;
 			warn("%s", source);
@@ -276,15 +276,14 @@ linkit(const char *source, const char *t
 			 * absolute path of the source, by appending `source'
 			 * to the parent directory of the target.
 			 */
-			p = strrchr(target, '/');
-			if (p != NULL)
-				p++;
-			else
-				p = target;
-			(void)snprintf(wbuf, sizeof(wbuf), "%.*s%s",
-			    (int)(p - target), target, source);
-			if (stat(wbuf, &sb) != 0)
-				warn("warning: %s", source);
+			strlcpy(bbuf, target, sizeof(bbuf));
+			p = dirname(bbuf);
+			if (p != NULL) {
+				(void)snprintf(wbuf, sizeof(wbuf), "%s/%s",
+						p, source);
+				if (stat(wbuf, &sb) != 0)
+					warn("warning: %s", source);
+			}
 		}
 	}
 

Modified: user/kib/vm6/contrib/tzdata/africa
==============================================================================
--- user/kib/vm6/contrib/tzdata/africa	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/contrib/tzdata/africa	Sat Apr 24 21:05:08 2010	(r207160)
@@ -1,5 +1,5 @@
 # <pre>
-# @(#)africa	8.23
+# @(#)africa	8.26
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -680,6 +680,21 @@ Zone	Indian/Mayotte	3:00:56 -	LMT	1911 J
 # http://www.worldtimezone.com/dst_news/dst_news_morocco03.html
 # </a>
 
+# From Steffen Thorsen (2010-04-13):
+# Several news media in Morocco report that the Ministry of Modernization
+# of Public Sectors has announced that Morocco will have DST from
+# 2010-05-02 to 2010-08-08.
+#
+# Example:
+# <a href="http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html">
+# http://www.lavieeco.com/actualites/4099-le-maroc-passera-a-l-heure-d-ete-gmt1-le-2-mai.html
+# </a>
+# (French)
+# Our page:
+# <a href="http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html">
+# http://www.timeanddate.com/news/time/morocco-starts-dst-2010.html
+# </a>
+
 # RULE	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 
 Rule	Morocco	1939	only	-	Sep	12	 0:00	1:00	S
@@ -701,6 +716,8 @@ Rule	Morocco	2008	only	-	Jun	 1	 0:00	1:
 Rule	Morocco	2008	only	-	Sep	 1	 0:00	0	-
 Rule	Morocco	2009	only	-	Jun	 1	 0:00	1:00	S
 Rule	Morocco	2009	only	-	Aug	 21	 0:00	0	-
+Rule	Morocco	2010	only	-	May	 2	 0:00	1:00	S
+Rule	Morocco	2010	only	-	Aug	 8	 0:00	0	-
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone Africa/Casablanca	-0:30:20 -	LMT	1913 Oct 26
 			 0:00	Morocco	WE%sT	1984 Mar 16
@@ -942,6 +959,24 @@ Zone	Africa/Lome	0:04:52 -	LMT	1893
 # Therefore, the standard time will be kept unchanged the whole year long."
 # So foregoing DST seems to be an exception (albeit one that may be repeated in the  future).
 
+# From Alexander Krivenyshev (2010-03-27):
+# According to some news reports Tunis confirmed not to use DST in 2010
+#
+# (translation):
+# "The Tunisian government has decided to abandon DST, which was scheduled on
+# Sunday...
+# Tunisian authorities had suspended the DST for the first time last year also
+# coincided with the month of Ramadan..."
+#
+# (in Arabic)
+# <a href="http://www.moheet.com/show_news.aspx?nid=358861&pg=1">
+# http://www.moheet.com/show_news.aspx?nid=358861&pg=1
+# <a href="http://www.almadenahnews.com/newss/news.php?c=118&id=38036">
+# http://www.almadenahnews.com/newss/news.php?c=118&id=38036
+# or
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_tunis02.html">
+# http://www.worldtimezone.com/dst_news/dst_news_tunis02.html
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Tunisia	1939	only	-	Apr	15	23:00s	1:00	S
 Rule	Tunisia	1939	only	-	Nov	18	23:00s	0	-
@@ -968,8 +1003,7 @@ Rule	Tunisia	2005	only	-	May	 1	 0:00s	1
 Rule	Tunisia	2005	only	-	Sep	30	 1:00s	0	-
 Rule	Tunisia	2006	2008	-	Mar	lastSun	 2:00s	1:00	S
 Rule	Tunisia	2006	2008	-	Oct	lastSun	 2:00s	0	-
-Rule	Tunisia	2010	max	-	Mar	lastSun	 2:00s	1:00	S
-Rule	Tunisia	2010	max	-	Oct	lastSun	 2:00s	0	-
+
 # Shanks & Pottenger give 0:09:20 for Paris Mean Time; go with Howse's
 # more precise 0:09:21.
 # Shanks & Pottenger say the 1911 switch was on Mar 9; go with Howse's Mar 11.

Modified: user/kib/vm6/contrib/tzdata/asia
==============================================================================
--- user/kib/vm6/contrib/tzdata/asia	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/contrib/tzdata/asia	Sat Apr 24 21:05:08 2010	(r207160)
@@ -1,4 +1,4 @@
-# @(#)asia	8.58
+# @(#)asia	8.60
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -566,6 +566,28 @@ Zone	Asia/Hong_Kong	7:36:36 -	LMT	1904 O
 # was still controlled by Japan.  This is hard to believe, but we don't
 # have any other information.
 
+# From smallufo (2010-04-03):
+# According to Taiwan's CWB,
+# <a href="http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm">
+# http://www.cwb.gov.tw/V6/astronomy/cdata/summert.htm
+# </a>
+# Taipei has DST in 1979 between July 1st and Sep 30.
+
+# From Arthur David Olson (2010-04-07):
+# Here's Google's translation of the table at the bottom of the "summert.htm" page:
+# Decade 	                                                    Name                      Start and end date
+# Republic of China 34 years to 40 years (AD 1945-1951 years) Summer Time               May 1 to September 30 
+# 41 years of the Republic of China (AD 1952)                 Daylight Saving Time      March 1 to October 31 
+# Republic of China 42 years to 43 years (AD 1953-1954 years) Daylight Saving Time      April 1 to October 31 
+# In the 44 years to 45 years (AD 1955-1956 years)            Daylight Saving Time      April 1 to September 30 
+# Republic of China 46 years to 48 years (AD 1957-1959)       Summer Time               April 1 to September 30 
+# Republic of China 49 years to 50 years (AD 1960-1961)       Summer Time               June 1 to September 30 
+# Republic of China 51 years to 62 years (AD 1962-1973 years) Stop Summer Time 
+# Republic of China 63 years to 64 years (1974-1975 AD)       Daylight Saving Time      April 1 to September 30 
+# Republic of China 65 years to 67 years (1976-1978 AD)       Stop Daylight Saving Time 
+# Republic of China 68 years (AD 1979)                        Daylight Saving Time      July 1 to September 30 
+# Republic of China since 69 years (AD 1980)                  Stop Daylight Saving Time
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule	Taiwan	1945	1951	-	May	1	0:00	1:00	D
 Rule	Taiwan	1945	1951	-	Oct	1	0:00	0	S
@@ -576,8 +598,9 @@ Rule	Taiwan	1955	1961	-	Oct	1	0:00	0	S
 Rule	Taiwan	1960	1961	-	Jun	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Apr	1	0:00	1:00	D
 Rule	Taiwan	1974	1975	-	Oct	1	0:00	0	S
-Rule	Taiwan	1980	only	-	Jun	30	0:00	1:00	D
-Rule	Taiwan	1980	only	-	Sep	30	0:00	0	S
+Rule	Taiwan	1979	only	-	Jun	30	0:00	1:00	D
+Rule	Taiwan	1979	only	-	Sep	30	0:00	0	S
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Taipei	8:06:00 -	LMT	1896 # or Taibei or T'ai-pei
 			8:00	Taiwan	C%sT
@@ -1912,13 +1935,35 @@ Zone	Asia/Muscat	3:54:20 -	LMT	1920
 # [T]he German Consulate General in Karachi reported me today that Pakistan
 # will go back to standard time on 1st of November.
 
+# From Steffen Thorsen (2010-03-26):
+# Steffen Thorsen wrote:
+# > On Thursday (2010-03-25) it was announced that DST would start in
+# > Pakistan on 2010-04-01.
+# >
+# > Then today, the president said that they might have to revert the
+# > decision if it is not supported by the parliament. So at the time
+# > being, it seems unclear if DST will be actually observed or not - but
+# > April 1 could be a more likely date than April 15.
+# Now, it seems that the decision to not observe DST in final:
+#
+# "Govt Withdraws Plan To Advance Clocks"
+# <a href="http://www.apakistannews.com/govt-withdraws-plan-to-advance-clocks-172041">
+# http://www.apakistannews.com/govt-withdraws-plan-to-advance-clocks-172041
+# </a>
+#
+# "People laud PM's announcement to end DST"
+# <a href="http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2">
+# http://www.app.com.pk/en_/index.php?option=com_content&task=view&id=99374&Itemid=2
+# </a>
+
 # Rule	NAME	FROM	TO	TYPE	IN	ON	AT	SAVE	LETTER/S
 Rule Pakistan	2002	only	-	Apr	Sun>=2	0:01	1:00	S
 Rule Pakistan	2002	only	-	Oct	Sun>=2	0:01	0	-
 Rule Pakistan	2008	only	-	Jun	1	0:00	1:00	S
 Rule Pakistan	2008	only	-	Nov	1	0:00	0	-
-Rule Pakistan	2009	max	-	Apr	15	0:00	1:00	S
-Rule Pakistan	2009	max	-	Nov	1	0:00	0	-
+Rule Pakistan	2009	only	-	Apr	15	0:00	1:00	S
+Rule Pakistan	2009	only	-	Nov	1	0:00	0	-
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 Zone	Asia/Karachi	4:28:12 -	LMT	1907
 			5:30	-	IST	1942 Sep

Modified: user/kib/vm6/contrib/tzdata/southamerica
==============================================================================
--- user/kib/vm6/contrib/tzdata/southamerica	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/contrib/tzdata/southamerica	Sat Apr 24 21:05:08 2010	(r207160)
@@ -1,5 +1,5 @@
 # <pre>
-# @(#)southamerica	8.43
+# @(#)southamerica	8.44
 # This file is in the public domain, so clarified as of
 # 2009-05-17 by Arthur David Olson.
 
@@ -437,6 +437,27 @@ Rule	Arg	2008	only	-	Oct	Sun>=15	0:00	1:
 # of the country calls it "ART".
 # ...
 
+# From Alexander Krivenyshev (2010-04-09):
+# According to news reports from El Diario de la Republica Province San
+# Luis, Argentina (standard time UTC-04) will keep Daylight Saving Time
+# after April 11, 2010--will continue to have same time as rest of
+# Argentina (UTC-3) (no DST).
+#
+# Confirmaron la pr&oacute;rroga del huso horario de verano (Spanish)
+# <a href="http://www.eldiariodelarepublica.com/index.php?option=com_content&task=view&id=29383&Itemid=9">
+# http://www.eldiariodelarepublica.com/index.php?option=com_content&task=view&id=29383&Itemid=9
+# </a>
+# or (some English translation):
+# <a href="http://www.worldtimezone.com/dst_news/dst_news_argentina08.html">
+# http://www.worldtimezone.com/dst_news/dst_news_argentina08.html
+# </a>
+
+# From Mariano Absatz (2010-04-12):
+# yes...I can confirm this...and given that San Luis keeps calling
+# UTC-03:00 "summer time", we should't just let San Luis go back to "Arg"
+# rules...San Luis is still using "Western ARgentina Time" and it got
+# stuck on Summer daylight savings time even though the summer is over.
+
 # Zone	NAME		GMTOFF	RULES	FORMAT	[UNTIL]
 #
 # Buenos Aires (BA), Capital Federal (CF),
@@ -570,8 +591,8 @@ Zone America/Argentina/Mendoza -4:35:16 
 #
 # San Luis (SL)
 
-Rule	SanLuis	2008	max	-	Mar	Sun>=8	0:00	0	-
-Rule	SanLuis	2007	max	-	Oct	Sun>=8	0:00	1:00	S
+Rule	SanLuis	2008	2009	-	Mar	Sun>=8	0:00	0	-
+Rule	SanLuis	2007	2009	-	Oct	Sun>=8	0:00	1:00	S
 
 Zone America/Argentina/San_Luis -4:25:24 - LMT	1894 Oct 31
 			-4:16:48 -	CMT	1920 May

Modified: user/kib/vm6/etc/devd.conf
==============================================================================
--- user/kib/vm6/etc/devd.conf	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/etc/devd.conf	Sat Apr 24 21:05:08 2010	(r207160)
@@ -138,12 +138,14 @@ attach 100 {
 # This entry starts the ColdSync tool in daemon mode. Make sure you have an up
 # to date /usr/local/etc/palms. We override the 'listen' settings for port and
 # type in /usr/local/etc/coldsync.conf.
-attach 100 {
-	device-name "ugen[0-9]+";
-	match "vendor" "0x082d";
-	match "product" "0x0100";
-	match "release" "0x0100";
-	action "/usr/local/bin/coldsync -md -p /dev/$device-name -t usb";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x082d";
+	match "product"		"0x0100";
+	match "release"		"0x0100";
+	action "/usr/local/bin/coldsync -md -p /dev/$cdev -t usb";
 };
 
 #

Modified: user/kib/vm6/etc/devd/uath.conf
==============================================================================
--- user/kib/vm6/etc/devd/uath.conf	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/etc/devd/uath.conf	Sat Apr 24 21:05:08 2010	(r207160)
@@ -4,117 +4,143 @@
 
 # Accton
 #   SMCWUSB-G and SMCWUSBT-G2
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x083a";
-	match "product" "(0x4505|0x4507)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x083a";
+	match "product"		"(0x4505|0x4507)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x168c";
-	match "product" "0x0002";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x168c";
+	match "product"		"0x0002";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Atheros Communications
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cf3";
-	match "product" "(0x0002|0x0004|0x0006)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cf3";
+	match "product"		"(0x0002|0x0004|0x0006)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Conceptronic
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0d8e";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0d8e";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #   DWL-AG132, DWL-G132 and DWL-AG122
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x2001";
-	match "product" "(0x3a01|0x3a03|0x3a05)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x2001";
+	match "product"		"(0x3a01|0x3a03|0x3a05)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # D-Link
 #  DWA-120
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x07d1";
-	match "product" "0x3a0c";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x07d1";
+	match "product"		"0x3a0c";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Gigaset
 #   SMCWUSBT-G
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1690";
-	match "product" "(0x0711|0x0713)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1690";
+	match "product"		"(0x0711|0x0713)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Global Sun Technology
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x16ab";
-	match "product" "(0x7802|0x7812)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x16ab";
+	match "product"		"(0x7802|0x7812)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # BayNETGEAR
 #   WG111U
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0846";
-	match "product" "0x4301";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0846";
+	match "product"		"0x4301";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Netgear
 #   WG111T and WPN111
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1385";
-	match "product" "(0x4251|0x5f01)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1385";
+	match "product"		"(0x4251|0x5f01)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # U-MEDIA Communications
 #   TEW-444UB and AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x157e";
-	match "product" "(0x3007|0x3206)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x157e";
+	match "product"		"(0x3007|0x3206)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Wistron NeWeb
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x1435";
-	match "product" "(0x0827|0x0829)";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x1435";
+	match "product"		"(0x0827|0x0829)";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };
 
 # Z-Com
 #   AR5523
-attach 100 {
-	device-name "ugen[0-9.]+";
-	match "vendor" "0x0cde";
-	match "product" "0x0013";
-	action "/usr/sbin/uathload -d /dev/$device-name";
+notify 100 {
+	match "system"		"USB";
+	match "subsystem"	"DEVICE";
+	match "type"		"ATTACH";
+	match "vendor"		"0x0cde";
+	match "product"		"0x0013";
+	action "/usr/sbin/uathload -d /dev/$cdev";
 };

Modified: user/kib/vm6/etc/mtree/BSD.usr.dist
==============================================================================
--- user/kib/vm6/etc/mtree/BSD.usr.dist	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/etc/mtree/BSD.usr.dist	Sat Apr 24 21:05:08 2010	(r207160)
@@ -219,6 +219,8 @@
             ..
             ibcs2
             ..
+            indent
+            ..
             ipfilter
             ..
             ipfw

Modified: user/kib/vm6/include/stdlib.h
==============================================================================
--- user/kib/vm6/include/stdlib.h	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/include/stdlib.h	Sat Apr 24 21:05:08 2010	(r207160)
@@ -155,6 +155,7 @@ void	 _Exit(int) __dead2;
 #if __POSIX_VISIBLE /* >= ??? */
 int	 posix_memalign(void **, size_t, size_t); /* (ADV) */
 int	 rand_r(unsigned *);			/* (TSF) */
+char	*realpath(const char * __restrict, char * __restrict);
 int	 setenv(const char *, const char *, int);
 int	 unsetenv(const char *);
 #endif
@@ -201,7 +202,6 @@ int	 posix_openpt(int);
 char	*ptsname(int);
 int	 putenv(char *);
 long	 random(void);
-char	*realpath(const char *, char resolved_path[]);
 unsigned short
 	*seed48(unsigned short[3]);
 #ifndef _SETKEY_DECLARED

Modified: user/kib/vm6/lib/Makefile
==============================================================================
--- user/kib/vm6/lib/Makefile	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/lib/Makefile	Sat Apr 24 21:05:08 2010	(r207160)
@@ -85,6 +85,7 @@ SUBDIR=	${SUBDIR_ORDERED} \
 	libopie \
 	libpam \
 	libpcap \
+	${_libpkg} \
 	${_libpmc} \
 	libproc \
 	librt \
@@ -197,6 +198,10 @@ _libmp=		libmp
 _libpmc=	libpmc
 .endif
 
+.if ${MK_PKGTOOLS} != "no"
+_libpkg=	libpkg
+.endif
+
 .if ${MK_SENDMAIL} != "no"
 _libmilter=	libmilter
 _libsm=		libsm

Modified: user/kib/vm6/lib/libc/stdlib/realpath.3
==============================================================================
--- user/kib/vm6/lib/libc/stdlib/realpath.3	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/lib/libc/stdlib/realpath.3	Sat Apr 24 21:05:08 2010	(r207160)
@@ -31,7 +31,7 @@
 .\"     @(#)realpath.3	8.2 (Berkeley) 2/16/94
 .\" $FreeBSD$
 .\"
-.Dd February 16, 1994
+.Dd April 19, 2010
 .Dt REALPATH 3
 .Os
 .Sh NAME
@@ -43,7 +43,7 @@
 .In sys/param.h
 .In stdlib.h
 .Ft "char *"
-.Fn realpath "const char *pathname" "char resolved_path[PATH_MAX]"
+.Fn realpath "const char *pathname" "char *resolved_path"
 .Sh DESCRIPTION
 The
 .Fn realpath
@@ -56,15 +56,16 @@ and
 in
 .Fa pathname ,
 and copies the resulting absolute pathname into
-the memory referenced by
+the memory pointed to by
 .Fa resolved_path .
 The
 .Fa resolved_path
 argument
 .Em must
-refer to a buffer capable of storing at least
+point to a buffer capable of storing at least
 .Dv PATH_MAX
-characters.
+characters, or be
+.Dv NULL .
 .Pp
 The
 .Fn realpath
@@ -82,13 +83,22 @@ The
 function returns
 .Fa resolved_path
 on success.
+If the function was supplied
+.Dv NULL
+as
+.Fa resolved_path ,
+and operation did not cause errors, the returned value is
+a null-terminated string in a buffer allocated by a call to
+.Fn malloc 3 .
 If an error occurs,
 .Fn realpath
 returns
 .Dv NULL ,
-and
+and if
 .Fa resolved_path
-contains the pathname which caused the problem.
+is not
+.Dv NULL ,
+the array that it points to contains the pathname which caused the problem.
 .Sh ERRORS
 The function
 .Fn realpath
@@ -113,6 +123,11 @@ when given a relative
 .Fa pathname .
 .Sh "SEE ALSO"
 .Xr getcwd 3
+.Sh STANDARDS
+The
+.Fn realpath
+function conforms to
+.St -p1003.1-2001 .
 .Sh HISTORY
 The
 .Fn realpath

Modified: user/kib/vm6/lib/libc/stdlib/realpath.c
==============================================================================
--- user/kib/vm6/lib/libc/stdlib/realpath.c	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/lib/libc/stdlib/realpath.c	Sat Apr 24 21:05:08 2010	(r207160)
@@ -43,23 +43,37 @@ __FBSDID("$FreeBSD$");
 #include "un-namespace.h"
 
 /*
- * char *realpath(const char *path, char resolved[PATH_MAX]);
- *
  * Find the real name of path, by removing all ".", ".." and symlink
  * components.  Returns (resolved) on success, or (NULL) on failure,
  * in which case the path which caused trouble is left in (resolved).
  */
 char *
-realpath(const char *path, char resolved[PATH_MAX])
+realpath(const char * __restrict path, char * __restrict resolved)
 {
 	struct stat sb;
 	char *p, *q, *s;
 	size_t left_len, resolved_len;
 	unsigned symlinks;
-	int serrno, slen;
+	int serrno, slen, m;
 	char left[PATH_MAX], next_token[PATH_MAX], symlink[PATH_MAX];
 
+	if (path == NULL) {
+		errno = EINVAL;
+		return (NULL);
+	}
+	if (path[0] == '\0') {
+		errno = ENOENT;
+		return (NULL);
+	}
 	serrno = errno;
+	if (resolved == NULL) {
+		resolved = malloc(PATH_MAX);
+		if (resolved == NULL)
+			return (NULL);
+		m = 1;
+	} else
+		m = 0;
+
 	symlinks = 0;
 	if (path[0] == '/') {
 		resolved[0] = '/';
@@ -70,13 +84,18 @@ realpath(const char *path, char resolved
 		left_len = strlcpy(left, path + 1, sizeof(left));
 	} else {
 		if (getcwd(resolved, PATH_MAX) == NULL) {
-			strlcpy(resolved, ".", PATH_MAX);
+			if (m)
+				free(resolved);
+			else
+				strlcpy(resolved, ".", PATH_MAX);
 			return (NULL);
 		}
 		resolved_len = strlen(resolved);
 		left_len = strlcpy(left, path, sizeof(left));
 	}
 	if (left_len >= sizeof(left) || resolved_len >= PATH_MAX) {
+		if (m)
+			free(resolved);
 		errno = ENAMETOOLONG;
 		return (NULL);
 	}
@@ -92,6 +111,8 @@ realpath(const char *path, char resolved
 		p = strchr(left, '/');
 		s = p ? p : left + left_len;
 		if (s - left >= sizeof(next_token)) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -102,6 +123,8 @@ realpath(const char *path, char resolved
 			memmove(left, s + 1, left_len + 1);
 		if (resolved[resolved_len - 1] != '/') {
 			if (resolved_len + 1 >= PATH_MAX) {
+				if (m)
+					free(resolved);
 				errno = ENAMETOOLONG;
 				return (NULL);
 			}
@@ -133,6 +156,8 @@ realpath(const char *path, char resolved
 		 */
 		resolved_len = strlcat(resolved, next_token, PATH_MAX);
 		if (resolved_len >= PATH_MAX) {
+			if (m)
+				free(resolved);
 			errno = ENAMETOOLONG;
 			return (NULL);
 		}
@@ -141,16 +166,23 @@ realpath(const char *path, char resolved
 				errno = serrno;
 				return (resolved);
 			}
+			if (m)
+				free(resolved);
 			return (NULL);
 		}
 		if (S_ISLNK(sb.st_mode)) {
 			if (symlinks++ > MAXSYMLINKS) {
+				if (m)
+					free(resolved);
 				errno = ELOOP;
 				return (NULL);
 			}
 			slen = readlink(resolved, symlink, sizeof(symlink) - 1);
-			if (slen < 0)
+			if (slen < 0) {
+				if (m)
+					free(resolved);
 				return (NULL);
+			}
 			symlink[slen] = '\0';
 			if (symlink[0] == '/') {
 				resolved[1] = 0;
@@ -171,6 +203,8 @@ realpath(const char *path, char resolved
 			if (p != NULL) {
 				if (symlink[slen - 1] != '/') {
 					if (slen + 1 >= sizeof(symlink)) {
+						if (m)
+							free(resolved);
 						errno = ENAMETOOLONG;
 						return (NULL);
 					}
@@ -179,6 +213,8 @@ realpath(const char *path, char resolved
 				}
 				left_len = strlcat(symlink, left, sizeof(left));
 				if (left_len >= sizeof(left)) {
+					if (m)
+						free(resolved);
 					errno = ENAMETOOLONG;
 					return (NULL);
 				}

Modified: user/kib/vm6/lib/libufs/Makefile
==============================================================================
--- user/kib/vm6/lib/libufs/Makefile	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/lib/libufs/Makefile	Sat Apr 24 21:05:08 2010	(r207160)
@@ -3,7 +3,7 @@
 LIB=	ufs
 SHLIBDIR?= /lib
 
-SRCS=	block.c cgroup.c inode.c sblock.c type.c
+SRCS=	block.c cgroup.c inode.c sblock.c type.c ffs_subr.c ffs_tables.c
 INCS=	libufs.h
 
 MAN=	bread.3 cgread.3 libufs.3 sbread.3 ufs_disk_close.3
@@ -16,8 +16,11 @@ MLINKS+= ufs_disk_close.3 ufs_disk_fillo
 MLINKS+= ufs_disk_close.3 ufs_disk_fillout_blank.3
 MLINKS+= ufs_disk_close.3 ufs_disk_write.3
 
-WARNS?=	3
+.PATH:  ${.CURDIR}/../../sys/ufs/ffs
 
+WARNS?=	2
+
+DEBUG_FLAGS = -g
 CFLAGS+= -D_LIBUFS
 .if defined(LIBUFS_DEBUG)
 CFLAGS+= -D_LIBUFS_DEBUGGING

Modified: user/kib/vm6/lib/libufs/cgroup.c
==============================================================================
--- user/kib/vm6/lib/libufs/cgroup.c	Sat Apr 24 20:39:18 2010	(r207159)
+++ user/kib/vm6/lib/libufs/cgroup.c	Sat Apr 24 21:05:08 2010	(r207160)
@@ -40,11 +40,143 @@ __FBSDID("$FreeBSD$");
 #include <errno.h>
 #include <fcntl.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
 
 #include <libufs.h>
 
+ufs2_daddr_t
+cgballoc(struct uufsd *disk)
+{
+	u_int8_t *blksfree;
+	struct cg *cgp;
+	struct fs *fs;
+	long bno;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	blksfree = cg_blksfree(cgp);
+	for (bno = 0; bno < fs->fs_fpg / fs->fs_frag; bno++)
+		if (ffs_isblock(fs, blksfree, bno))
+			goto gotit;
+	return (0);
+gotit:
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nbfree--;
+	ffs_clrblock(fs, blksfree, (long)bno);
+	ffs_clusteracct(fs, cgp, bno, -1);
+	cgp->cg_cs.cs_nbfree--;
+	fs->fs_cstotal.cs_nbfree--;
+	fs->fs_fmod = 1;
+	return (cgbase(fs, cgp->cg_cgx) + blkstofrags(fs, bno));
+}
+
+int
+cgbfree(struct uufsd *disk, ufs2_daddr_t bno, long size)
+{
+	u_int8_t *blksfree;
+	struct fs *fs;
+	struct cg *cgp;
+	ufs1_daddr_t fragno, cgbno;
+	int i, cg, blk, frags, bbase;
+
+	fs = &disk->d_fs;
+	cg = dtog(fs, bno);
+	if (cgread1(disk, cg) != 1)
+		return (-1);
+	cgp = &disk->d_cg;
+	cgbno = dtogd(fs, bno);
+	blksfree = cg_blksfree(cgp);
+	if (size == fs->fs_bsize) {
+		fragno = fragstoblks(fs, cgbno);
+		ffs_setblock(fs, blksfree, fragno);
+		ffs_clusteracct(fs, cgp, fragno, 1);
+		cgp->cg_cs.cs_nbfree++;
+		fs->fs_cstotal.cs_nbfree++;
+		fs->fs_cs(fs, cg).cs_nbfree++;
+	} else {
+		bbase = cgbno - fragnum(fs, cgbno);
+		/*
+		 * decrement the counts associated with the old frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, -1);
+		/*
+		 * deallocate the fragment
+		 */
+		frags = numfrags(fs, size);
+		for (i = 0; i < frags; i++)
+			setbit(blksfree, cgbno + i);
+		cgp->cg_cs.cs_nffree += i;
+		fs->fs_cstotal.cs_nffree += i;
+		fs->fs_cs(fs, cg).cs_nffree += i;
+		/*
+		 * add back in counts associated with the new frags
+		 */
+		blk = blkmap(fs, blksfree, bbase);
+		ffs_fragacct(fs, blk, cgp->cg_frsum, 1);
+		/*
+		 * if a complete block has been reassembled, account for it
+		 */
+		fragno = fragstoblks(fs, bbase);
+		if (ffs_isblock(fs, blksfree, fragno)) {
+			cgp->cg_cs.cs_nffree -= fs->fs_frag;
+			fs->fs_cstotal.cs_nffree -= fs->fs_frag;
+			fs->fs_cs(fs, cg).cs_nffree -= fs->fs_frag;
+			ffs_clusteracct(fs, cgp, fragno, 1);
+			cgp->cg_cs.cs_nbfree++;
+			fs->fs_cstotal.cs_nbfree++;
+			fs->fs_cs(fs, cg).cs_nbfree++;
+		}
+	}
+	return cgwrite(disk);
+}
+
+ino_t
+cgialloc(struct uufsd *disk)
+{
+	struct ufs2_dinode *dp2;
+	u_int8_t *inosused;
+	struct cg *cgp;
+	struct fs *fs;
+	ino_t ino;
+	int i;
+
+	fs = &disk->d_fs;
+	cgp = &disk->d_cg;
+	inosused = cg_inosused(cgp);
+	for (ino = 0; ino < fs->fs_ipg / NBBY; ino++)
+		if (isclr(inosused, ino))
+			goto gotit;
+	return (0);
+gotit:
+	if (fs->fs_magic == FS_UFS2_MAGIC &&
+	    ino + INOPB(fs) > cgp->cg_initediblk &&
+	    cgp->cg_initediblk < cgp->cg_niblk) {
+		char block[MAXBSIZE];
+		bzero(block, (int)fs->fs_bsize);
+		dp2 = (struct ufs2_dinode *)&block;
+		for (i = 0; i < INOPB(fs); i++) {
+			dp2->di_gen = arc4random() / 2 + 1;
+			dp2++;
+		}
+		if (bwrite(disk, ino_to_fsba(fs,
+		    cgp->cg_cgx * fs->fs_ipg + cgp->cg_initediblk),
+		    block, fs->fs_bsize))
+			return (0);
+		cgp->cg_initediblk += INOPB(fs);
+	}
+
+	setbit(inosused, ino);
+	cgp->cg_irotor = ino;
+	cgp->cg_cs.cs_nifree--;
+	fs->fs_cstotal.cs_nifree--;
+	fs->fs_cs(fs, cgp->cg_cgx).cs_nifree--;
+	fs->fs_fmod = 1;
+
+	return (ino + (cgp->cg_cgx * fs->fs_ipg));
+}
+
 int
 cgread(struct uufsd *disk)
 {
@@ -55,14 +187,12 @@ int
 cgread1(struct uufsd *disk, int c)
 {
 	struct fs *fs;
-	off_t ccg;
 
 	fs = &disk->d_fs;
 
 	if ((unsigned)c >= fs->fs_ncg) {
 		return (0);
 	}
-	ccg = fsbtodb(fs, cgtod(fs, c)) * disk->d_bsize;
 	if (bread(disk, fsbtodb(fs, cgtod(fs, c)), disk->d_cgunion.d_buf,
 	    fs->fs_bsize) == -1) {
 		ERROR(disk, "unable to read cylinder group");
@@ -73,6 +203,12 @@ cgread1(struct uufsd *disk, int c)
 }
 
 int
+cgwrite(struct uufsd *disk)
+{
+	return (cgwrite1(disk, disk->d_lcg));

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

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 21:20:43 2010
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 C8426106568D;
	Sat, 24 Apr 2010 21:20:43 +0000 (UTC) (envelope-from kib@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id AD6718FC1A;
	Sat, 24 Apr 2010 21:20:43 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OLKhCT049700;
	Sat, 24 Apr 2010 21:20:43 GMT (envelope-from kib@svn.freebsd.org)
Received: (from kib@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OLKhrB049697;
	Sat, 24 Apr 2010 21:20:43 GMT (envelope-from kib@svn.freebsd.org)
Message-Id: <201004242120.o3OLKhrB049697@svn.freebsd.org>
From: Konstantin Belousov <kib@FreeBSD.org>
Date: Sat, 24 Apr 2010 21:20:43 +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: r207162 - in user/kib/vm6/sys: ufs/ffs vm
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: Sat, 24 Apr 2010 21:20:44 -0000

Author: kib
Date: Sat Apr 24 21:20:43 2010
New Revision: 207162
URL: http://svn.freebsd.org/changeset/base/207162

Log:
  Drop SUID/SGID on writes in ffs_extend.
  Unconditionally call VOP_EXTEND first time in write loop to let it
  drop s bits.

Modified:
  user/kib/vm6/sys/ufs/ffs/ffs_vnops.c
  user/kib/vm6/sys/vm/vm_readwrite.c

Modified: user/kib/vm6/sys/ufs/ffs/ffs_vnops.c
==============================================================================
--- user/kib/vm6/sys/ufs/ffs/ffs_vnops.c	Sat Apr 24 21:17:07 2010	(r207161)
+++ user/kib/vm6/sys/ufs/ffs/ffs_vnops.c	Sat Apr 24 21:20:43 2010	(r207162)
@@ -175,6 +175,18 @@ struct vop_vector ffs_fifoops2 = {
 	.vop_vptofh =		ffs_vptofh,
 };
 
+static void
+ffs_drop_suid(struct inode *ip, struct ucred *cred)
+{
+
+	if (ip->i_mode & (ISUID | ISGID)) {
+		if (priv_check_cred(cred, PRIV_VFS_RETAINSUGID, 0)) {
+			ip->i_mode &= ~(ISUID | ISGID);
+			DIP_SET(ip, i_mode, ip->i_mode);
+		}
+	}
+}
+
 /*
  * Synch an open file.
  */
@@ -818,13 +830,8 @@ ffs_write(ap)
 	 * we clear the setuid and setgid bits as a precaution against
 	 * tampering.
 	 */
-	if ((ip->i_mode & (ISUID | ISGID)) && resid > uio->uio_resid &&
-	    ap->a_cred) {
-		if (priv_check_cred(ap->a_cred, PRIV_VFS_RETAINSUGID, 0)) {
-			ip->i_mode &= ~(ISUID | ISGID);
-			DIP_SET(ip, i_mode, ip->i_mode);
-		}
-	}
+	if (resid > uio->uio_resid && ap->a_cred != NULL)
+		ffs_drop_suid(ip, ap->a_cred);
 	if (error) {
 		if (ioflag & IO_UNIT) {
 			(void)ffs_truncate(vp, osize,
@@ -1829,6 +1836,7 @@ ffs_extend(struct vop_extend_args *ap)
 	ip->i_size = size;
 	DIP_SET(ip, i_size, size);
 	ip->i_flag |= IN_CHANGE | IN_UPDATE;
+	ffs_drop_suid(ip, ap->a_cred);
 	return (0);
 
  slow:
@@ -1847,5 +1855,7 @@ ffs_extend(struct vop_extend_args *ap)
 		error = ffs_update(vp, 1);
 	} else
 		bawrite(bp);
+	if (error == 0)
+		ffs_drop_suid(ip, ap->a_cred);
 	return (error);
 }

Modified: user/kib/vm6/sys/vm/vm_readwrite.c
==============================================================================
--- user/kib/vm6/sys/vm/vm_readwrite.c	Sat Apr 24 21:17:07 2010	(r207161)
+++ user/kib/vm6/sys/vm/vm_readwrite.c	Sat Apr 24 21:20:43 2010	(r207162)
@@ -718,7 +718,7 @@ vnode_pager_write(struct vnode *vp, stru
 	ssize_t size, size1, osize, osize1, resid, sresid, written;
 	int error, vn_locked, wpmax, wp, i, pflags;
 	u_int bits;
-	boolean_t vnode_locked, freed, freed1;
+	boolean_t vnode_locked, freed, freed1, first_extend;
 	struct thread *td;
 
 	if (ioflags & (IO_EXT|IO_INVAL|IO_DIRECT))
@@ -734,6 +734,7 @@ vnode_pager_write(struct vnode *vp, stru
 	vn_locked = VOP_ISLOCKED(vp);
 	vnode_locked = TRUE;
 	error = 0;
+	first_extend = TRUE;
 
 	/*
 	 * Reversed logic from vnode_generic_putpages().
@@ -840,7 +841,7 @@ vnode_pager_write(struct vnode *vp, stru
 		/*
 		 * Extend the file if writing past end.
 		 */
-		if (osize1 < uio->uio_offset + size) {
+		if (osize1 < uio->uio_offset + size || first_extend) {
 			if (VOP_ISLOCKED(vp) != LK_EXCLUSIVE) {
 				VOP_UNLOCK(vp, 0);
 				vnode_locked = FALSE;
@@ -856,6 +857,7 @@ vnode_pager_write(struct vnode *vp, stru
 			vattr.va_size = uio->uio_offset + size;
 			error = VOP_EXTEND(vp, td->td_ucred, uio->uio_offset +
 			    size, ioflags);
+			first_extend = FALSE;
 		}
 		if (error != 0)
 			break;

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 22:01:15 2010
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 A133C1065672;
	Sat, 24 Apr 2010 22:01:15 +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 77F7C8FC2B;
	Sat, 24 Apr 2010 22:01:15 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OM1F9K058735;
	Sat, 24 Apr 2010 22:01:15 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OM1FCO058733;
	Sat, 24 Apr 2010 22:01:15 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004242201.o3OM1FCO058733@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Sat, 24 Apr 2010 22:01:15 +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: r207164 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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: Sat, 24 Apr 2010 22:01:15 -0000

Author: kmacy
Date: Sat Apr 24 22:01:15 2010
New Revision: 207164
URL: http://svn.freebsd.org/changeset/base/207164

Log:
  - lock page that we're holding in pmap_extract_and_hold
  - remove stale pmap_collect comment
  
  suggested by: kib@
  
  - remove extra white space before pmap_remove_pte

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 21:36:52 2010	(r207163)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 22:01:15 2010	(r207164)
@@ -1300,7 +1300,8 @@ retry:
 	if (pdep != NULL && (pde = *pdep)) {
 		if (pde & PG_PS) {
 			if ((pde & PG_RW) || (prot & VM_PROT_WRITE) == 0) {
-				if (pa_tryrelock(pmap, pde & PG_PS_FRAME, &pa))
+				if (pa_tryrelock(pmap, (pde & PG_PS_FRAME) |
+				       (va & PDRMASK), &pa))
 					goto retry;
 
 				m = PHYS_TO_VM_PAGE((pde & PG_PS_FRAME) |
@@ -2356,7 +2357,6 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 		TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 		vm_page_unlock(m);
 	} while (va < va_last);
-
 }
 
 /*
@@ -2599,12 +2599,9 @@ pmap_demote_pde(pmap_t pmap, pd_entry_t 
 
 	/*
 	 * Demote the pv entry.  This depends on the earlier demotion
-	 * of the mapping.  Specifically, the (re)creation of a per-
-	 * page pv entry might trigger the execution of pmap_collect(),
-	 * which might reclaim a newly (re)created per-page pv entry
-	 * and destroy the associated mapping.  In order to destroy
-	 * the mapping, the PDE must have already changed from mapping
-	 * the 2mpage to referencing the page table page.
+	 * of the mapping.  In order to destroy the mapping, the PDE
+	 * must have already changed from mapping the 2mpage to
+	 * referencing the page table page.
 	 */
 	if ((oldpde & PG_MANAGED) != 0)
 		pmap_pv_demote_pde(pmap, va, oldpde & PG_PS_FRAME, pv_list);
@@ -2688,7 +2685,6 @@ pmap_remove_pde(pmap_t pmap, pd_entry_t 
 	return (pmap_unuse_pt(pmap, sva, *pmap_pdpe(pmap, sva), free));
 }
 
-
 /*
  * pmap_remove_pte: do the things to unmap a page in a process
  */

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 22:09:14 2010
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 06E95106566B;
	Sat, 24 Apr 2010 22:09:14 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id E99468FC15;
	Sat, 24 Apr 2010 22:09:13 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OM9Dgn060520;
	Sat, 24 Apr 2010 22:09:13 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OM9D7F060513;
	Sat, 24 Apr 2010 22:09:13 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004242209.o3OM9D7F060513@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 22:09:13 +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: r207165 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 22:09:14 -0000

Author: jmallett
Date: Sat Apr 24 22:09:13 2010
New Revision: 207165
URL: http://svn.freebsd.org/changeset/base/207165

Log:
  o) Disable REUSE_MBUFS_WITHOUT_FREE rather than commenting out the implementation.
  o) Basic transmit support.  Enough to send a DHCP request and get a response and
     go on a bit before panicking.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/cavium-ethernet.h	Sat Apr 24 22:09:13 2010	(r207165)
@@ -92,12 +92,10 @@ typedef struct {
 	int                     queue;          /* PKO hardware queue for the port */
 	int                     fau;            /* Hardware fetch and add to count outstanding tx buffers */
 	int                     imode;          /* Type of port. This is one of the enums in cvmx_helper_interface_mode_t */
-	struct mbuf             *tx_free_list[16];/* List of outstanding tx buffers per queue */
 	/* Keeping intercept_cb close the the part of stats that is most often modified helps throughput. */
 	cvm_oct_callback_t      intercept_cb;   /* Optional intecept callback defined above */
 #if 0
 	struct ifnet_stats stats;          /* Device statistics */
-	struct mii_if_info      mii_info;       /* Generic MII info structure */
 #endif
 	uint64_t                link_info;      /* Last negotiated link state */
 	void (*poll)(struct ifnet *ifp);   /* Called periodically to check link status */
@@ -117,6 +115,8 @@ typedef struct {
 	uint8_t mac[6];
 	int phy_id;
 
+	struct ifqueue tx_free_queue[16];
+
 	struct ifmedia media;
 	int if_flags;
 } cvm_oct_private_t;

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-common.c	Sat Apr 24 22:09:13 2010	(r207165)
@@ -253,11 +253,9 @@ int cvm_oct_common_init(struct ifnet *if
 
 #if 0
 	if (priv->queue != -1) {
-		ifp->hard_start_xmit = cvm_oct_xmit;
 		if (USE_HW_TCPUDP_CHECKSUM)
 			ifp->features |= NETIF_F_IP_CSUM;
-	} else
-		ifp->hard_start_xmit = cvm_oct_xmit_pow;
+	}
 #endif
 	count++;
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-defines.h	Sat Apr 24 22:09:13 2010	(r207165)
@@ -76,11 +76,15 @@ AND WITH ALL FAULTS AND CAVIUM  NETWORKS
 #else
 	#define USE_32BIT_SHARED            0
 	#define USE_MBUFS_IN_HW           1
+#if 0
 	#ifdef CONFIG_NETFILTER
 		#define REUSE_MBUFS_WITHOUT_FREE  0
 	#else
 		#define REUSE_MBUFS_WITHOUT_FREE  1
 	#endif
+#else
+	#define REUSE_MBUFS_WITHOUT_FREE  0
+#endif
 #endif
 
 #define INTERRUPT_LIMIT             10000   /* Max interrupts per second per core */

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Sat Apr 24 22:09:13 2010	(r207165)
@@ -72,10 +72,8 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	int32_t in_use;
 	int32_t buffers_to_free;
 #if REUSE_MBUFS_WITHOUT_FREE
-#if 0
 	unsigned char *fpa_head;
 #endif
-#endif
 
 	/* Prefetch the private data structure.
 	   It is larger that one cache line */
@@ -115,7 +113,7 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	   68 bytes whenever we are in half duplex mode. We don't handle
 	   the case of having a small packet but no room to add the padding.
 	   The kernel should always give us at least a cache line */
-	if ((m->m_pkthdr.len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
+	if (__predict_false(m->m_pkthdr.len < 64) && OCTEON_IS_MODEL(OCTEON_CN3XXX)) {
 		cvmx_gmxx_prtx_cfg_t gmx_prt_cfg;
 		int interface = INTERFACE(priv->port);
 		int index = INDEX(priv->port);
@@ -124,27 +122,25 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 			/* We only need to pad packet in half duplex mode */
 			gmx_prt_cfg.u64 = cvmx_read_csr(CVMX_GMXX_PRTX_CFG(index, interface));
 			if (gmx_prt_cfg.s.duplex == 0) {
-				panic("%s: small packet padding not yet implemented.", __func__);
-#if 0
-				int add_bytes = 64 - m->len;
-				if ((m_tail_pointer(m) + add_bytes) <= m_end_pointer(m))
-					memset(__m_put(m, add_bytes), 0, add_bytes);
-#endif
+				static uint8_t pad[64];
+
+				if (!m_append(m, sizeof pad - m->m_pkthdr.len, pad))
+					printf("%s: unable to padd small packet.", __func__);
 			}
 		}
 	}
 
 	/* Build the PKO buffer pointer */
-	/*
-	 * XXX/juli
-	 * Implement mbuf loading.
-	 */
-#if 0
+	if (m->m_pkthdr.len != m->m_len) {
+		m = m_defrag(m, M_DONTWAIT);
+		if (m->m_pkthdr.len != m->m_len)
+			panic("%s: need to load multiple segments.", __func__);
+	}
+
 	hw_buffer.u64 = 0;
 	hw_buffer.s.addr = cvmx_ptr_to_phys(m->m_data);
 	hw_buffer.s.pool = 0;
-	hw_buffer.s.size = (unsigned long)m_end_pointer(m) - (unsigned long)m->head;
-#endif
+	hw_buffer.s.size = m->m_len;
 
 	/* Build the PKO command */
 	pko_command.u64 = 0;
@@ -164,7 +160,6 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 	   the define REUSE_MBUFS_WITHOUT_FREE. The reuse of buffers has
 	   shown a 25% increase in performance under some loads */
 #if REUSE_MBUFS_WITHOUT_FREE
-#if 0
 	fpa_head = m->head + 128 - ((unsigned long)m->head&0x7f);
 	if (__predict_false(m->data < fpa_head)) {
 		/*
@@ -248,9 +243,6 @@ int cvm_oct_xmit(struct mbuf *m, struct 
 #endif /* CONFIG_NET_SCHED */
 
 dont_put_mbuf_in_hw:
-#else
-#endif
-	panic("%s: not ready for REUSE_MBUFS_WITHOUT_FREE yet.", __func__);
 #endif /* REUSE_MBUFS_WITHOUT_FREE */
 
 	/* Check if we can use the hardware checksumming */
@@ -285,19 +277,12 @@ dont_put_mbuf_in_hw:
 	cvmx_pko_send_packet_prepare(priv->port, priv->queue + qos, CVMX_PKO_LOCK_CMD_QUEUE);
 
 	/* Drop this packet if we have too many already queued to the HW */
-#if 0
-	if ((m_queue_len(&priv->tx_free_list[qos]) >= MAX_OUT_QUEUE_DEPTH)) {
-		/*
-		DEBUGPRINT("%s: Tx dropped. Too many queued\n", if_name(ifp));
-		*/
+	if (_IF_QFULL(&priv->tx_free_queue[qos])) {
 		dropped = 1;
 	}
 	/* Send the packet to the output queue */
 	else
-#else
-	panic("%s: free queues really not implemented.", __func__);
-#endif
-	if ((cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
+	if (__predict_false(cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
 		DEBUGPRINT("%s: Failed to send the packet\n", if_name(ifp));
 		dropped = 1;
 	}
@@ -308,7 +293,7 @@ dont_put_mbuf_in_hw:
 		cvmx_scratch_write64(CVMX_SCR_SCRATCH+8, old_scratch2);
 	}
 
-	if ((dropped)) {
+	if (__predict_false(dropped)) {
 		m_freem(m);
 		cvmx_fau_atomic_add32(priv->fau+qos*4, -1);
 		ifp->if_oerrors++;
@@ -316,30 +301,26 @@ dont_put_mbuf_in_hw:
 		if (USE_MBUFS_IN_HW) {
 			/* Put this packet on the queue to be freed later */
 			if (pko_command.s.dontfree)
-				panic("%s: need to queue mbuf to free it later.", __func__);
+				IF_ENQUEUE(&priv->tx_free_queue[qos], m);
 			else {
 				cvmx_fau_atomic_add32(FAU_NUM_PACKET_BUFFERS_TO_FREE, -1);
 				cvmx_fau_atomic_add32(priv->fau+qos*4, -1);
 			}
 		} else {
 			/* Put this packet on the queue to be freed later */
-			panic("%s: need to queue mbuf to free it later. (2)", __func__);
+			IF_ENQUEUE(&priv->tx_free_queue[qos], m);
 		}
 	}
 
-	/* Free mbufs not in use by the hardware, possibly two at a time */
-	panic("%s: need to free queued mbufs.", __func__);
-#if 0
-	if (m_queue_len(&priv->tx_free_list[qos]) > in_use) {
-		spin_lock(&priv->tx_free_list[qos].lock);
-		/* Check again now that we have the lock. It might have changed */
-		if (m_queue_len(&priv->tx_free_list[qos]) > in_use)
-			dev_kfree_m(__m_dequeue(&priv->tx_free_list[qos]));
-		if (m_queue_len(&priv->tx_free_list[qos]) > in_use)
-			dev_kfree_m(__m_dequeue(&priv->tx_free_list[qos]));
-		spin_unlock(&priv->tx_free_list[qos].lock);
+	/* Free mbufs not in use by the hardware */
+	if (_IF_QLEN(&priv->tx_free_queue[qos]) > in_use) {
+		IF_LOCK(&priv->tx_free_queue[qos]);
+		while (_IF_QLEN(&priv->tx_free_queue[qos]) > in_use) {
+			_IF_DEQUEUE(&priv->tx_free_queue[qos], m);
+			m_freem(m);
+		}
+		IF_UNLOCK(&priv->tx_free_queue[qos]);
 	}
-#endif
 
 	return 0;
 }
@@ -360,7 +341,7 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 
 	/* Get a work queue entry */
 	cvmx_wqe_t *work = cvmx_fpa_alloc(CVMX_FPA_WQE_POOL);
-	if ((work == NULL)) {
+	if (__predict_false(work == NULL)) {
 		DEBUGPRINT("%s: Failed to allocate a work queue entry\n", if_name(ifp));
 		ifp->if_oerrors++;
 		m_freem(m);
@@ -369,7 +350,7 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 
 	/* Get a packet buffer */
 	packet_buffer = cvmx_fpa_alloc(CVMX_FPA_PACKET_POOL);
-	if ((packet_buffer == NULL)) {
+	if (__predict_false(packet_buffer == NULL)) {
 		DEBUGPRINT("%s: Failed to allocate a packet buffer\n",
 			   if_name(ifp));
 		cvmx_fpa_free(work, CVMX_FPA_WQE_POOL, DONT_WRITEBACK(1));
@@ -389,11 +370,7 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 	/* We have to copy the packet since whoever processes this packet
 	   will free it to a hardware pool. We can't use the trick of
 	   counting outstanding packets like in cvm_oct_xmit */
-#if 0
-	memcpy(copy_location, m->data, m->len);
-#else
-	panic("%s: need to implement mbuf loading.", __func__);
-#endif
+	m_copydata(m, 0, m->m_pkthdr.len, copy_location);
 
 	/* Fill in some of the work queue fields. We may need to add more
 	   if the software at the other end needs them */
@@ -414,6 +391,7 @@ int cvm_oct_xmit_pow(struct mbuf *m, str
 	work->packet_ptr.s.size = CVMX_FPA_PACKET_POOL_SIZE;
 	work->packet_ptr.s.back = (copy_location - packet_buffer)>>7;
 
+	panic("%s: POW transmit not quite implemented yet.", __func__);
 #if 0
 	if (m->protocol == htons(ETH_P_IP)) {
 		work->word2.s.ip_offset     = 14;
@@ -540,19 +518,19 @@ int cvm_oct_transmit_qos(struct ifnet *i
 	pko_command.s.total_bytes = work->len;
 
 	/* Check if we can use the hardware checksumming */
-	if ((work->word2.s.not_IP || work->word2.s.IP_exc))
+	if (__predict_false(work->word2.s.not_IP || work->word2.s.IP_exc))
 		pko_command.s.ipoffp1 = 0;
 	else
 		pko_command.s.ipoffp1 = ETHER_HDR_LEN + 1;
 
 	/* Send the packet to the output queue */
-	if ((cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
+	if (__predict_false(cvmx_pko_send_packet_finish(priv->port, priv->queue + qos, pko_command, hw_buffer, CVMX_PKO_LOCK_CMD_QUEUE))) {
 		DEBUGPRINT("%s: Failed to send the packet\n", if_name(ifp));
 		dropped = -1;
 	}
 	critical_exit();
 
-	if ((dropped)) {
+	if (__predict_false(dropped)) {
 		if (do_free)
 			cvm_oct_free_work(work);
 		ifp->if_oerrors++;
@@ -571,18 +549,10 @@ int cvm_oct_transmit_qos(struct ifnet *i
  */
 void cvm_oct_tx_shutdown(struct ifnet *ifp)
 {
-#if 0
 	cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc;
-	unsigned long flags;
 	int qos;
 
 	for (qos = 0; qos < 16; qos++) {
-		spin_lock_irqsave(&priv->tx_free_list[qos].lock, flags);
-		while (m_queue_len(&priv->tx_free_list[qos]))
-			dev_kfree_m_any(__m_dequeue(&priv->tx_free_list[qos]));
-		spin_unlock_irqrestore(&priv->tx_free_list[qos].lock, flags);
+		IF_DRAIN(&priv->tx_free_queue[qos]);
 	}
-#else
-	panic("%s: not yet implemented.", __func__);
-#endif
 }

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet.c	Sat Apr 24 22:09:13 2010	(r207165)
@@ -396,12 +396,7 @@ int cvm_oct_init_module(device_t bus)
 			priv->port = CVMX_PIP_NUM_INPUT_PORTS;
 			priv->queue = -1;
 
-			if_initname(ifp, "pow", 0);
 			device_set_desc(dev, "Cavium Octeon POW Ethernet\n");
-#if 0
-			for (qos = 0; qos < 16; qos++)
-				m_queue_head_init(&priv->tx_free_list[qos]);
-#endif
 
 			ifp->if_softc = priv;
 
@@ -452,10 +447,6 @@ int cvm_oct_init_module(device_t bus)
 			priv->queue = cvmx_pko_get_base_queue(priv->port);
 			priv->intercept_cb = NULL;
 			priv->fau = fau - cvmx_pko_get_num_queues(port) * 4;
-#if 0
-			for (qos = 0; qos < 16; qos++)
-				m_queue_head_init(&priv->tx_free_list[qos]);
-#endif
 			for (qos = 0; qos < cvmx_pko_get_num_queues(port); qos++)
 				cvmx_fau_atomic_write32(priv->fau+qos*4, 0);
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 22:01:15 2010	(r207164)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 22:09:13 2010	(r207165)
@@ -48,6 +48,7 @@
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
 
+#include <net/bpf.h>
 #include <net/ethernet.h>
 #include <net/if.h>
 #include <net/if_media.h>
@@ -60,7 +61,9 @@
 #include "cavium-ethernet.h"
 
 #include "ethernet-common.h"
+#include "ethernet-defines.h"
 #include "ethernet-mdio.h"
+#include "ethernet-tx.h"
 
 #include "miibus_if.h"
 
@@ -74,6 +77,7 @@ static int		octe_miibus_writereg(device_
 
 static void		octe_init(void *);
 static void		octe_stop(void *);
+static void		octe_start(struct ifnet *);
 
 static int		octe_mii_medchange(struct ifnet *);
 static void		octe_mii_medstat(struct ifnet *, struct ifmediareq *);
@@ -129,6 +133,7 @@ octe_attach(device_t dev)
 {
 	struct ifnet *ifp;
 	cvm_oct_private_t *priv;
+	unsigned qos;
 	int error;
 
 	priv = device_get_softc(dev);
@@ -153,11 +158,21 @@ octe_attach(device_t dev)
 	ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST;
 	ifp->if_init = octe_init;
 	ifp->if_ioctl = octe_ioctl;
+	ifp->if_start = octe_start;
 
 	priv->if_flags = ifp->if_flags;
 
+	for (qos = 0; qos < 16; qos++) {
+		mtx_init(&priv->tx_free_queue[qos].ifq_mtx, ifp->if_xname, "octe tx free queue", MTX_DEF);
+		IFQ_SET_MAXLEN(&priv->tx_free_queue[qos], MAX_OUT_QUEUE_DEPTH);
+	}
+
 	ether_ifattach(ifp, priv->mac);
 
+	IFQ_SET_MAXLEN(&ifp->if_snd, 16);
+	ifp->if_snd.ifq_drv_maxlen = 16; /* XXX */
+	IFQ_SET_READY(&ifp->if_snd);
+
 	return (0);
 }
 
@@ -211,6 +226,9 @@ octe_init(void *arg)
 
 	if (priv->miibus != NULL)
 		mii_mediachg(device_get_softc(priv->miibus));
+
+        ifp->if_drv_flags |= IFF_DRV_RUNNING;
+        ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
 }
 
 static void
@@ -224,6 +242,46 @@ octe_stop(void *arg)
 
 	if (priv->stop != NULL)
 		priv->stop(ifp);
+
+	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
+}
+
+static void
+octe_start(struct ifnet *ifp)
+{
+	cvm_oct_private_t *priv;
+	struct mbuf *m;
+	int error;
+
+	priv = ifp->if_softc;
+
+	if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING)
+		return;
+
+	while (!IFQ_DRV_IS_EMPTY(&ifp->if_snd)) {
+		IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
+
+		if (priv->queue != -1) {
+			error = cvm_oct_xmit(m, ifp);
+		} else {
+			error = cvm_oct_xmit_pow(m, ifp);
+		}
+
+		if (error != 0) {
+			/*
+			 * XXX
+			 * Need to implement freeing and clearing of
+			 * OACTIVE at some point.
+			 *
+			 * XXX
+			 * Incremenet errors?  Maybe make xmit functions
+			 * not free the packets?
+			 */
+			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+		}
+
+		BPF_MTAP(ifp, m);
+	}
 }
 
 static int
@@ -283,7 +341,7 @@ octe_medstat(struct ifnet *ifp, struct i
 
 	link_info.u64 = priv->link_info;
 
-        if (!link_info.s.link_up)
+	if (!link_info.s.link_up)
 		return;
 
 	ifm->ifm_status |= IFM_ACTIVE;

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 22:23:50 2010
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 2B7C2106566C;
	Sat, 24 Apr 2010 22:23:50 +0000 (UTC)
	(envelope-from jmallett@FreeBSD.org)
Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c])
	by mx1.freebsd.org (Postfix) with ESMTP id 1BA548FC0C;
	Sat, 24 Apr 2010 22:23:50 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OMNoDM063815;
	Sat, 24 Apr 2010 22:23:50 GMT
	(envelope-from jmallett@svn.freebsd.org)
Received: (from jmallett@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OMNnRp063812;
	Sat, 24 Apr 2010 22:23:49 GMT
	(envelope-from jmallett@svn.freebsd.org)
Message-Id: <201004242223.o3OMNnRp063812@svn.freebsd.org>
From: Juli Mallett <jmallett@FreeBSD.org>
Date: Sat, 24 Apr 2010 22:23:49 +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: r207167 - user/jmallett/octeon/sys/mips/cavium/octe
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: Sat, 24 Apr 2010 22:23:50 -0000

Author: jmallett
Date: Sat Apr 24 22:23:49 2010
New Revision: 207167
URL: http://svn.freebsd.org/changeset/base/207167

Log:
  o) Return nonzero if we drop the outgoing packet.
  o) Do not continue trying to transmit packets if we drop a packet outgoing.

Modified:
  user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
  user/jmallett/octeon/sys/mips/cavium/octe/octe.c

Modified: user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Sat Apr 24 22:16:01 2010	(r207166)
+++ user/jmallett/octeon/sys/mips/cavium/octe/ethernet-tx.c	Sat Apr 24 22:23:49 2010	(r207167)
@@ -322,7 +322,7 @@ dont_put_mbuf_in_hw:
 		IF_UNLOCK(&priv->tx_free_queue[qos]);
 	}
 
-	return 0;
+	return dropped;
 }
 
 

Modified: user/jmallett/octeon/sys/mips/cavium/octe/octe.c
==============================================================================
--- user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 22:16:01 2010	(r207166)
+++ user/jmallett/octeon/sys/mips/cavium/octe/octe.c	Sat Apr 24 22:23:49 2010	(r207167)
@@ -278,6 +278,7 @@ octe_start(struct ifnet *ifp)
 			 * not free the packets?
 			 */
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
+			return;
 		}
 
 		BPF_MTAP(ifp, m);

From owner-svn-src-user@FreeBSD.ORG  Sat Apr 24 22:31:51 2010
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 75F34106566B;
	Sat, 24 Apr 2010 22:31:51 +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 660D68FC13;
	Sat, 24 Apr 2010 22:31:51 +0000 (UTC)
Received: from svn.freebsd.org (localhost [127.0.0.1])
	by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3OMVp09065624;
	Sat, 24 Apr 2010 22:31:51 GMT (envelope-from kmacy@svn.freebsd.org)
Received: (from kmacy@localhost)
	by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3OMVphU065622;
	Sat, 24 Apr 2010 22:31:51 GMT (envelope-from kmacy@svn.freebsd.org)
Message-Id: <201004242231.o3OMVphU065622@svn.freebsd.org>
From: Kip Macy <kmacy@FreeBSD.org>
Date: Sat, 24 Apr 2010 22:31:51 +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: r207169 - user/kmacy/head_page_lock_2/sys/amd64/amd64
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: Sat, 24 Apr 2010 22:31:51 -0000

Author: kmacy
Date: Sat Apr 24 22:31:51 2010
New Revision: 207169
URL: http://svn.freebsd.org/changeset/base/207169

Log:
  add some comments regarding locking in demotion during pmap_remove

Modified:
  user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c

Modified: user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c
==============================================================================
--- user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 22:24:26 2010	(r207168)
+++ user/kmacy/head_page_lock_2/sys/amd64/amd64/pmap.c	Sat Apr 24 22:31:51 2010	(r207169)
@@ -2336,7 +2336,12 @@ pmap_pv_demote_pde(pmap_t pmap, vm_offse
 	vm_page_lock(m);
 	TAILQ_INSERT_TAIL(&m->md.pv_list, pv, pv_list);
 	vm_page_unlock(m);
-	
+	/* We open ourselves up to an LOR by doing the page lock acquisitions
+	 * with the pmap lock held - which raises the question as to whether
+	 * we should use pa_tryrelock (can the pmap be corrupted if we allow it
+	 * to be changed during a demotion?) or should we lock the entire range
+	 * in advance? Either option is a bit awkward.
+	 */
 	/* Instantiate the remaining NPTEPG - 1 pv entries. */
 	va_last = va + NBPDR - PAGE_SIZE;
 	do {
@@ -2908,6 +2913,13 @@ restart:
 		 * Check for large page.
 		 */
 		if ((ptpaddr & PG_PS) != 0) {
+			/*
+			 * I think we only need this in case pmap_demote_pde
+			 * is called and the page is managed, so in principle
+			 * we should check if the page is managed - but we
+			 * also potentially need the whole range so this
+			 * acquisition may provide no benefit at all
+			 */
 			if (pa_tryrelock(pmap, ptpaddr & PG_FRAME, &pa)) {
 				va_next = sva;
 				continue;