CVS commit: src/share/man/man9

2017-02-21 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb 21 19:53:49 UTC 2017

Modified Files:
src/share/man/man9: ieee80211_radiotap.9

Log Message:
Fix PR standards/51989: the extension bit extends the presence bitmap
by 32 bits, not 64.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/share/man/man9/ieee80211_radiotap.9

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

Modified files:

Index: src/share/man/man9/ieee80211_radiotap.9
diff -u src/share/man/man9/ieee80211_radiotap.9:1.15 src/share/man/man9/ieee80211_radiotap.9:1.16
--- src/share/man/man9/ieee80211_radiotap.9:1.15	Tue Mar 18 18:20:40 2014
+++ src/share/man/man9/ieee80211_radiotap.9	Tue Feb 21 19:53:49 2017
@@ -1,4 +1,4 @@
-.\" $NetBSD: ieee80211_radiotap.9,v 1.15 2014/03/18 18:20:40 riastradh Exp $
+.\" $NetBSD: ieee80211_radiotap.9,v 1.16 2017/02/21 19:53:49 dyoung Exp $
 .\"
 .\" Copyright (c) 2004	Bruce M. Simpson ,
 .\"			Darron Broad .
@@ -218,7 +218,7 @@ This bit is reserved for any future exte
 structure.
 A driver sets
 .Dv IEEE80211_RADIOTAP_EXT
-to extend the it_present bitmap by another 64 bits.
+to extend the it_present bitmap by another 32 bits.
 The bitmap can be extended by multiples of 32 bits to 96, 128, 160
 bits or longer, by setting
 .Dv IEEE80211_RADIOTAP_EXT



CVS commit: othersrc/external/bsd/arfe

2016-01-25 Thread David Young
al/bsd/arfe/dt/README:1.13
--- othersrc/external/bsd/arfe/dt/README:1.12	Thu Dec  3 03:29:01 2015
+++ othersrc/external/bsd/arfe/dt/README	Tue Jan 26 02:22:57 2016
@@ -1,5 +1,5 @@
-$ARFE: README 303 2015-12-03 03:26:34Z dyoung $
-$NetBSD: README,v 1.12 2015/12/03 03:29:01 dyoung Exp $
+$ARFE: README 323 2016-01-25 20:29:30Z dyoung $
+$NetBSD: README,v 1.13 2016/01/26 02:22:57 dyoung Exp $
 
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where the numbers, "symbols" starting with a letter or

Index: othersrc/external/bsd/arfe/dt/core.c
diff -u othersrc/external/bsd/arfe/dt/core.c:1.6 othersrc/external/bsd/arfe/dt/core.c:1.7
--- othersrc/external/bsd/arfe/dt/core.c:1.6	Sat Dec  5 08:44:10 2015
+++ othersrc/external/bsd/arfe/dt/core.c	Tue Jan 26 02:22:57 2016
@@ -1,5 +1,5 @@
-/* $NetBSD: core.c,v 1.6 2015/12/05 08:44:10 wiz Exp $ */
-/* $ARFE: core.c 302 2015-12-02 23:44:24Z dyoung $ */
+/* $NetBSD: core.c,v 1.7 2016/01/26 02:22:57 dyoung Exp $ */
+/* $ARFE: core.c 323 2016-01-25 20:29:30Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -32,6 +32,7 @@
 #include 
 #include 
 #include 
+#include 	/* for getopt(3) */
 
 #include 	/* for MAX() */
 #include 
@@ -41,12 +42,27 @@
 #include 	/* for inet_net_pton */
 #include 	/* for inet_net_pton */
 
-#include "core.h"
-#include "dec.h"
-#include "hex.h"
-#include "ipv4.h"
-#include "macaddr.h"
-#include "sym.h"
+#include "hlog/hlog.h"
+#include "dt/core.h"
+#include "dt/dec.h"
+#include "dt/eol.h"
+#include "dt/hex.h"
+#include "dt/ipv4.h"
+#include "dt/macaddr.h"
+#include "dt/space.h"
+#include "dt/sym.h"
+
+typedef struct _cbuf {
+	char string[sizeof("Space")];
+} cbuf_t;
+
+typedef struct _indices {
+	ssize_t i, j;
+} indices_t;
+
+typedef struct _score {
+	ssize_t del, ins, least, match;
+} score_t;
 
 union freeslice;
 typedef union freeslice freeslice_t;
@@ -60,13 +76,33 @@ static bool freeslices_initialized __ali
 static freeslice_t *first_freeslice __aligned(COHERENCY_UNIT);
 static freeslice_t freeslices[2048];
 
-static const int gap_open = 1, gap_extend = 6;
+static const int gap_open = 12, gap_extend = 2;
+#define	INFINITY	(SSIZE_MAX / 2)
 static const subcell_t infinity = {
-	  .score = SSIZE_MAX / 2
-	, .gaps = SSIZE_MAX / 2
+	  .score = INFINITY
 	, .splitn = 0
 };
 
+HLOG_SINK_DECL(match_candidate);
+HLOG_SINK_SHORT_DEFN(match_candidate, all);
+
+HLOG_SINK_DECL(match_clocc);
+HLOG_SINK_DECL(match_dec);
+HLOG_SINK_DECL(match_hex);
+HLOG_SINK_DECL(match_space);
+HLOG_SINK_DECL(match_sym);
+
+HLOG_SINK_SHORT_DEFN(match_clocc, all);
+HLOG_SINK_SHORT_DEFN(match_dec, match_clocc);
+HLOG_SINK_SHORT_DEFN(match_hex, match_clocc);
+HLOG_SINK_SHORT_DEFN(match_sym, match_clocc);
+HLOG_SINK_SHORT_DEFN(match_space, match_clocc);
+
+HLOG_SINK_DECL(find_clocc);
+HLOG_SINK_DECL(find_dec);
+HLOG_SINK_SHORT_DEFN(find_clocc, all);
+HLOG_SINK_SHORT_DEFN(find_dec, find_clocc);
+
 static void
 init_freeslices(void)
 {
@@ -125,15 +161,15 @@ file_to_slice(const char *fn)
 	void *p;
 
 	if (fd == -1)
-		err(EXIT_FAILURE, "%s: open", __func__);
+		err(EXIT_FAILURE, "%s: open(\"%s\")", __func__, fn);
 	
 	if (fstat(fd, ) == -1)
-		err(EXIT_FAILURE, "%s: stat", __func__);
+		err(EXIT_FAILURE, "%s: fstat [%s]", __func__, fn);
 
 	p = mmap(NULL, st.st_size, PROT_READ, MAP_SHARED|MAP_FILE, fd, 0);
 
 	if (p == MAP_FAILED)
-		err(EXIT_FAILURE, "%s: mmap", __func__);
+		err(EXIT_FAILURE, "%s: mmap [%s]", __func__, fn);
 
 	return newslice(p, st.st_size);
 }
@@ -345,6 +381,25 @@ clocc_hash(const slice_t *s, const clocc
 	return hash;
 }
 
+static bool
+cloccs_are_equal(const slice_t *ls, const slice_t *rs,
+const clocc_t *locc, const clocc_t *rocc)
+{
+	int i, n;
+
+	dbg_assert(locc->first <= locc->last);
+
+	if (locc->last - locc->first != rocc->last - rocc->first)
+		return false; 
+
+	n = locc->last - locc->first + 1;
+	for (i = 0; i < n; i++) {
+		if (get(ls, locc->first + i) != get(rs, rocc->first + i))
+			return false;
+	}
+	return true;
+}
+
 /* Look up the class occurrence `occ` on slice `s` in the class occurrences
  * `occs` occurring on slice `os`.
  */
@@ -356,18 +411,9 @@ clocc_cross_lookup(cloccs_t *occs, const
 	unsigned int hash = clocc_hash(s, occ);
 	clocc_bucket_t *bkt = >bucket[hash % __arraycount(tbl->bucket)];
 	clocc_t *bocc;
-	int i, n;
 
 	TAILQ_FOREACH(bocc, bkt, bucket) {
-		assert(bocc->first <= bocc->last);
-		if (bocc->last - bocc->first != occ->last - occ->first)
-			continue; 
-		n = bocc->last - bocc->first + 1;
-		for (i = 0; i < n; i++) {
-			if (get(os, bocc->first + i) != get(s, occ->first + i))
-break;
-		}
-		if (i == n)
+		if (cloccs_are_equal(o

CVS commit: othersrc/external/bsd/arfe

2015-12-02 Thread David Young
hexadecimal numbers (with and without an 0x-prefix) and decimal numbers.
 When DT emits the LCS, it replaces matched pairs of decimal numbers with
 their difference, and matched pairs of hexadecimal numbers with their
 bitwise-AND combination.  DT replaces matched pairs of IP numbers with
-the smallest subnet that contains both.
+the smallest subnet that contains both.  DT copies the first symbol in a
+matched pair to its output.
 
 DT arose from the author's desire to examine the rate of change of
 network statistics from several sources (ifconfig -va, netstat -s, a

Index: othersrc/external/bsd/arfe/dt/core.c
diff -u othersrc/external/bsd/arfe/dt/core.c:1.4 othersrc/external/bsd/arfe/dt/core.c:1.5
--- othersrc/external/bsd/arfe/dt/core.c:1.4	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/core.c	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: core.c,v 1.4 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: core.c 297 2015-12-02 23:16:23Z dyoung $ */
+/* $NetBSD: core.c,v 1.5 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: core.c 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/core.h
diff -u othersrc/external/bsd/arfe/dt/core.h:1.4 othersrc/external/bsd/arfe/dt/core.h:1.5
--- othersrc/external/bsd/arfe/dt/core.h:1.4	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/core.h	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: core.h,v 1.4 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: core.h 297 2015-12-02 23:16:23Z dyoung $ */
+/* $NetBSD: core.h,v 1.5 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: core.h 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/dec.c
diff -u othersrc/external/bsd/arfe/dt/dec.c:1.2 othersrc/external/bsd/arfe/dt/dec.c:1.3
--- othersrc/external/bsd/arfe/dt/dec.c:1.2	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/dec.c	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dec.c,v 1.2 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: dec.c 264 2015-10-08 22:28:01Z dyoung $ */
+/* $NetBSD: dec.c,v 1.3 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: dec.c 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/dec.h
diff -u othersrc/external/bsd/arfe/dt/dec.h:1.2 othersrc/external/bsd/arfe/dt/dec.h:1.3
--- othersrc/external/bsd/arfe/dt/dec.h:1.2	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/dec.h	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dec.h,v 1.2 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: dec.h 264 2015-10-08 22:28:01Z dyoung $ */
+/* $NetBSD: dec.h,v 1.3 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: dec.h 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/macaddr.h
diff -u othersrc/external/bsd/arfe/dt/macaddr.h:1.2 othersrc/external/bsd/arfe/dt/macaddr.h:1.3
--- othersrc/external/bsd/arfe/dt/macaddr.h:1.2	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/macaddr.h	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: macaddr.h,v 1.2 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: macaddr.h 286 2015-11-18 05:09:15Z dyoung $ */
+/* $NetBSD: macaddr.h,v 1.3 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: macaddr.h 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.15 othersrc/external/bsd/arfe/dt/dt.c:1.16
--- othersrc/external/bsd/arfe/dt/dt.c:1.15	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.15 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: dt.c 289 2015-11-19 23:51:04Z dyoung $ */
+/* $NetBSD: dt.c,v 1.16 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: dt.c 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/hex.c
diff -u othersrc/external/bsd/arfe/dt/hex.c:1.7 othersrc/external/bsd/arfe/dt/hex.c:1.8
--- othersrc/external/bsd/arfe/dt/hex.c:1.7	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/hex.c	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.c,v 1.7 2015/12/02 23:39:51 dyoung Exp $ */
-/* $ARFE: hex.c 264 2015-10-08 22:28:01Z dyoung $ */
+/* $NetBSD: hex.c,v 1.8 2015/12/03 03:29:01 dyoung Exp $ */
+/* $ARFE: hex.c 302 2015-12-02 23:44:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/hex.h
diff -u othersrc/external/bsd/arfe/dt/hex.h:1.7 othersrc/external/bsd/arfe/dt/hex.h:1.8
--- othersrc/external/bsd/arfe/dt/hex.h:1.7	Wed Dec  2 23:39:51 2015
+++ othersrc/external/bsd/arfe/dt/hex.h	Thu Dec  3 03:29:01 2015
@@ -1,5 +1,5 @@
-/* $NetBS

CVS commit: othersrc/external/bsd/arfe/dt

2015-12-02 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Dec  2 23:44:02 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: .cvsignore

Log Message:
Make CVS ignore *.undo.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/dt/.cvsignore

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/.cvsignore
diff -u othersrc/external/bsd/arfe/dt/.cvsignore:1.2 othersrc/external/bsd/arfe/dt/.cvsignore:1.3
--- othersrc/external/bsd/arfe/dt/.cvsignore:1.2	Fri Aug 28 21:38:33 2015
+++ othersrc/external/bsd/arfe/dt/.cvsignore	Wed Dec  2 23:44:02 2015
@@ -1,6 +1,7 @@
-.*.swp
 *.core
 *.d
+*.undo
+.*.swp
 .depend
 .gdbinit
 dt



CVS commit: othersrc/external/bsd/arfe

2015-12-02 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Dec  2 23:40:39 UTC 2015

Added Files:
othersrc/external/bsd/arfe/tt/tests/5: expected-output input match
transform
Removed Files:
othersrc/external/bsd/arfe/dt/rr: abecedarian-abracadabra
abracadabra-abecedarian

Log Message:
Straggler from last: delete some tests, add a test.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r0 \
othersrc/external/bsd/arfe/dt/rr/abecedarian-abracadabra \
othersrc/external/bsd/arfe/dt/rr/abracadabra-abecedarian
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tests/5/expected-output \
othersrc/external/bsd/arfe/tt/tests/5/input \
othersrc/external/bsd/arfe/tt/tests/5/match \
othersrc/external/bsd/arfe/tt/tests/5/transform

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

Added files:

Index: othersrc/external/bsd/arfe/tt/tests/5/expected-output
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/5/expected-output:1.1
--- /dev/null	Wed Dec  2 23:40:39 2015
+++ othersrc/external/bsd/arfe/tt/tests/5/expected-output	Wed Dec  2 23:40:39 2015
@@ -0,0 +1,3 @@
+re0
+	0 input bytes in 0 packets (0 multicast)
+	29641834 output bytes in 85674 packets (4 multicast)
Index: othersrc/external/bsd/arfe/tt/tests/5/input
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/5/input:1.1
--- /dev/null	Wed Dec  2 23:40:39 2015
+++ othersrc/external/bsd/arfe/tt/tests/5/input	Wed Dec  2 23:40:39 2015
@@ -0,0 +1,10 @@
+re0: flags=8843 mtu 1500
+	capabilities=3f80
+	enabled=3f80
+	address: 00:33:5d:80:a1:b0
+	media: Ethernet autoselect (none)
+	status: no carrier
+	input: 0 packets, 0 bytes
+	output: 85674 packets, 29641834 bytes, 4 multicasts
+	inet 0.0.0.0 netmask 0xff00 broadcast 255.255.255.255
+	inet6 fe80::233:5dff:fe80:a1b0%re0 prefixlen 64 scopeid 0x2
Index: othersrc/external/bsd/arfe/tt/tests/5/match
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/5/match:1.1
--- /dev/null	Wed Dec  2 23:40:39 2015
+++ othersrc/external/bsd/arfe/tt/tests/5/match	Wed Dec  2 23:40:39 2015
@@ -0,0 +1,9 @@
+wm0: flags=8843 mtu 1500
+	capabilities=2bf80
+	enabled=2bf80
+	address: 00:0a:0b:cd:01:ef
+	media: Ethernet autoselect (1000baseT full-duplex)
+	status: active
+	input: 745177 packets, 455120099 bytes, 0 multicasts
+	output: 540500 packets, 121290742 bytes, 253 multicasts
+	inet 10.0.1.17 netmask 0xff00 broadcast 10.0.1.255
Index: othersrc/external/bsd/arfe/tt/tests/5/transform
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/5/transform:1.1
--- /dev/null	Wed Dec  2 23:40:39 2015
+++ othersrc/external/bsd/arfe/tt/tests/5/transform	Wed Dec  2 23:40:39 2015
@@ -0,0 +1,3 @@
+wm0
+	455120099 input bytes in 745177 packets (0 multicast)
+	121290742 output bytes in 540500 packets (253 multicast)



CVS commit: othersrc/external/bsd/arfe/dt

2015-12-02 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Dec  2 23:42:45 UTC 2015

Added Files:
othersrc/external/bsd/arfe/dt: sym.c sym.h
Removed Files:
othersrc/external/bsd/arfe/dt/rr: quack123quack-quack456quack
quack456quack-quack123quack quackabequack-quackdariaquack
quackdariaquack-quackabequack

Log Message:
Straggler from last: add sym.[ch].  Remove some files belonging to dead
tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/sym.c \
othersrc/external/bsd/arfe/dt/sym.h
cvs rdiff -u -r1.2 -r0 \
othersrc/external/bsd/arfe/dt/rr/quack123quack-quack456quack \
othersrc/external/bsd/arfe/dt/rr/quack456quack-quack123quack \
othersrc/external/bsd/arfe/dt/rr/quackabequack-quackdariaquack \
othersrc/external/bsd/arfe/dt/rr/quackdariaquack-quackabequack

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

Added files:

Index: othersrc/external/bsd/arfe/dt/sym.c
diff -u /dev/null othersrc/external/bsd/arfe/dt/sym.c:1.1
--- /dev/null	Wed Dec  2 23:42:45 2015
+++ othersrc/external/bsd/arfe/dt/sym.c	Wed Dec  2 23:42:45 2015
@@ -0,0 +1,215 @@
+/* $NetBSD: sym.c,v 1.1 2015/12/02 23:42:45 dyoung Exp $ */
+/* $ARFE$ */
+
+/*-
+ * Copyright (c) 2014,2015 David Young <dyo...@netbsd.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 ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include 
+#include 
+#include 
+#include 
+
+#include "core.h"
+#include "sym.h"
+
+typedef enum sym_op {
+	  SYM_OP_NONE = 0
+	, SYM_OP_PUSH
+	, SYM_OP_EMIT
+	, SYM_OP_START
+} sym_op_t;
+
+struct sym_state;
+typedef struct sym_state sym_state_t;
+
+typedef struct sym_transition {
+	const sym_state_t	*t_newstate;
+	sym_op_t		t_op;
+} sym_transition_t;
+
+struct sym_state {
+	const char *s_descr;
+	sym_transition_t s_other;
+	sym_transition_t s_underscore;
+	sym_transition_t s_0_9;
+	sym_transition_t s_alpha;
+	sym_transition_t s_delimiter;
+	sym_transition_t s_eof;
+};
+
+enum sym_state_idxs {
+	  READ_SYM
+	, READ_EOF
+	, READ_OTHER
+	, READ_DELIMITER
+};
+
+#define	read_sym sym_states[READ_SYM]
+#define	read_eof sym_states[READ_EOF]
+#define	read_other sym_states[READ_OTHER]
+#define	read_delimiter sym_states[READ_DELIMITER]
+
+static const sym_state_t sym_states[] = {[READ_SYM] = {
+	.s_descr = "read start",
+	.s_other = {_other, SYM_OP_NONE},
+	.s_delimiter = {_delimiter, SYM_OP_EMIT},
+	.s_0_9 = {_sym, SYM_OP_PUSH},
+	.s_alpha = {_sym, SYM_OP_PUSH},
+	.s_underscore = {_sym, SYM_OP_PUSH},
+	.s_eof = {_eof, SYM_OP_EMIT},
+}, [READ_EOF] = {
+	.s_descr = "read eof",
+	.s_other = {_eof, SYM_OP_NONE},
+}, [READ_OTHER] = {
+	.s_descr = "read other",
+	.s_other = {_other, SYM_OP_NONE},
+	.s_delimiter = {_delimiter, SYM_OP_NONE},
+}, [READ_DELIMITER] = {
+	.s_descr = "read delimiter",
+	.s_underscore = {_sym, SYM_OP_START},
+	.s_alpha = {_sym, SYM_OP_START},
+	.s_delimiter = {_delimiter, SYM_OP_NONE},
+	.s_other = {_other, SYM_OP_NONE},
+}};
+
+struct sym_parser {
+	sym_detection_t p_detection;
+#define	p_column	p_detection.d_column
+#define	p_chars		p_detection.d_chars
+#define	p_idx		p_detection.d_idx
+	char *p_top;
+	const sym_state_t *p_state;
+	sym_emitter_t p_emitter;
+	void *p_arg;
+};
+
+void
+sym_parser_free(sym_parser_t *p)
+{
+	free(p);
+}
+
+static void
+sym_parser_init(sym_parser_t *p, sym_emitter_t emitter, void *arg)
+{
+	memset(p, 0, sizeof(*p));
+	p->p_state = _delimiter;
+	p->p_emitter = emitter;
+	p->p_arg = arg;
+}
+
+sym_parser_t *
+sym_parser_alloc(sym_emitter_t emitter, void *arg)
+{
+	sym_parser_t *p;
+
+	p = malloc(sizeof(*p));
+	if (p == NULL)
+		return NULL;
+
+	sym_parser_init(p, emit

CVS commit: othersrc/external/bsd/arfe

2015-12-02 Thread David Young
l/bsd/arfe/dt/hex.c:1.6 othersrc/external/bsd/arfe/dt/hex.c:1.7
--- othersrc/external/bsd/arfe/dt/hex.c:1.6	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/hex.c	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.c,v 1.6 2015/09/23 19:32:34 dyoung Exp $ */
-/* $ARFE: hex.c 258 2015-09-23 19:31:17Z dyoung $ */
+/* $NetBSD: hex.c,v 1.7 2015/12/02 23:39:51 dyoung Exp $ */
+/* $ARFE: hex.c 264 2015-10-08 22:28:01Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/hex.h
diff -u othersrc/external/bsd/arfe/dt/hex.h:1.6 othersrc/external/bsd/arfe/dt/hex.h:1.7
--- othersrc/external/bsd/arfe/dt/hex.h:1.6	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/hex.h	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.h,v 1.6 2015/09/23 19:32:34 dyoung Exp $ */
-/* $ARFE: hex.h 258 2015-09-23 19:31:17Z dyoung $ */
+/* $NetBSD: hex.h,v 1.7 2015/12/02 23:39:51 dyoung Exp $ */
+/* $ARFE: hex.h 264 2015-10-08 22:28:01Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/ipv4.c
diff -u othersrc/external/bsd/arfe/dt/ipv4.c:1.6 othersrc/external/bsd/arfe/dt/ipv4.c:1.7
--- othersrc/external/bsd/arfe/dt/ipv4.c:1.6	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.c	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.c,v 1.6 2015/09/23 19:32:34 dyoung Exp $ */
-/* $ARFE: ipv4.c 258 2015-09-23 19:31:17Z dyoung $ */
+/* $NetBSD: ipv4.c,v 1.7 2015/12/02 23:39:51 dyoung Exp $ */
+/* $ARFE: ipv4.c 264 2015-10-08 22:28:01Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/ipv4.h
diff -u othersrc/external/bsd/arfe/dt/ipv4.h:1.6 othersrc/external/bsd/arfe/dt/ipv4.h:1.7
--- othersrc/external/bsd/arfe/dt/ipv4.h:1.6	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.h	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.h,v 1.6 2015/09/23 19:32:34 dyoung Exp $ */
-/* $ARFE: ipv4.h 258 2015-09-23 19:31:17Z dyoung $ */
+/* $NetBSD: ipv4.h,v 1.7 2015/12/02 23:39:51 dyoung Exp $ */
+/* $ARFE: ipv4.h 264 2015-10-08 22:28:01Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.10 othersrc/external/bsd/arfe/dt/README:1.11
--- othersrc/external/bsd/arfe/dt/README:1.10	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/README	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-$ARFE: README 258 2015-09-23 19:31:17Z dyoung $
-$NetBSD: README,v 1.10 2015/09/23 19:32:34 dyoung Exp $
+$ARFE: README 264 2015-10-08 22:28:01Z dyoung $
+$NetBSD: README,v 1.11 2015/12/02 23:39:51 dyoung Exp $
 
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where the numbers and IPv4 addresses are "wild": a span

Index: othersrc/external/bsd/arfe/dt/core.c
diff -u othersrc/external/bsd/arfe/dt/core.c:1.3 othersrc/external/bsd/arfe/dt/core.c:1.4
--- othersrc/external/bsd/arfe/dt/core.c:1.3	Thu Oct  8 22:00:56 2015
+++ othersrc/external/bsd/arfe/dt/core.c	Wed Dec  2 23:39:51 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: core.c,v 1.3 2015/10/08 22:00:56 dyoung Exp $ */
-/* $ARFE$ */
+/* $NetBSD: core.c,v 1.4 2015/12/02 23:39:51 dyoung Exp $ */
+/* $ARFE: core.c 297 2015-12-02 23:16:23Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -46,6 +46,7 @@
 #include "hex.h"
 #include "ipv4.h"
 #include "macaddr.h"
+#include "sym.h"
 
 union freeslice;
 typedef union freeslice freeslice_t;
@@ -55,18 +56,17 @@ union freeslice {
 	freeslice_t *next;
 };
 
-static const char *names[] = {
-	  "abe"
-	, "ada"
-	, "daria"
-};
-
-const size_t no_expected_lcs = SIZE_T_MAX;
-
 static bool freeslices_initialized __aligned(COHERENCY_UNIT);
 static freeslice_t *first_freeslice __aligned(COHERENCY_UNIT);
 static freeslice_t freeslices[2048];
 
+static const int gap_open = 1, gap_extend = 6;
+static const subcell_t infinity = {
+	  .score = SSIZE_MAX / 2
+	, .gaps = SSIZE_MAX / 2
+	, .splitn = 0
+};
+
 static void
 init_freeslices(void)
 {
@@ -111,8 +111,6 @@ newslice(char *buf, size_t buflen)
 	if (s == NULL)
 		return NULL;
 
-	s->backward = false;
-
 	s->first = buf;
 	s->last = buf + buflen - 1;
 
@@ -166,7 +164,7 @@ get(const slice_t *s, int i)
 {
 	dbg_assert(0 <= i && i < length(s));
 
-	return (s->backward) ? s->last[-i] : s->first[i];
+	return s->first[i];
 }
 
 static inline const char *
@@ -174,25 +172,7 @@ getp(const slice_t *s, int i)
 {
 	dbg_assert(0 <= i && i < length(s));
 
-	return (s->backward) ? >last[-i] : >first[i];
-}
-
-static void
-extract(const slice_t *s, unsigned int i, unsigned int j, char *o)
-{
-	unsigned int k, inc;
-	char *p;
-
-	inc = (i < j) ? 1 : -1;
-	p = o;
-
-	fo

CVS commit: othersrc/external/bsd/arfe

2015-10-08 Thread David Young
t(o->occs, o->noccs, sizeof(*o->occs), clocc_cmp);
+out:
+	if (o->noccs > 0)
+		mergesort(o->occs, o->noccs, sizeof(*o->occs), clocc_cmp);
 	cloccs_dedup(o);
 }
 
Index: othersrc/external/bsd/arfe/dt/core.h
diff -u othersrc/external/bsd/arfe/dt/core.h:1.2 othersrc/external/bsd/arfe/dt/core.h:1.3
--- othersrc/external/bsd/arfe/dt/core.h:1.2	Wed Sep 23 19:32:34 2015
+++ othersrc/external/bsd/arfe/dt/core.h	Thu Oct  8 22:00:56 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: core.h,v 1.2 2015/09/23 19:32:34 dyoung Exp $ */
-/* $ARFE: core.h 258 2015-09-23 19:31:17Z dyoung $ */
+/* $NetBSD: core.h,v 1.3 2015/10/08 22:00:56 dyoung Exp $ */
+/* $ARFE: core.h 262 2015-10-08 21:47:24Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -113,6 +113,13 @@ typedef enum {
 struct chainelt;
 typedef struct chainelt chainelt_t;
 
+struct decimal {
+	intmax_t num;
+	unsigned int log10denom;
+};
+
+typedef struct decimal decimal_t;
+
 typedef struct clocc {
 	int column;
 	int first;
@@ -120,7 +127,7 @@ typedef struct clocc {
 	clocc_kind_t kind;
 	clocc_qual_t qual;
 	union {
-		intmax_t u_intmax;
+		decimal_t u_dec;
 		uintmax_t u_uintmax;
 		uint32_t u_ipv4;
 		uint8_t u_macaddr[6];

Index: othersrc/external/bsd/arfe/dt/macaddr.c
diff -u othersrc/external/bsd/arfe/dt/macaddr.c:1.3 othersrc/external/bsd/arfe/dt/macaddr.c:1.4
--- othersrc/external/bsd/arfe/dt/macaddr.c:1.3	Tue Sep 22 01:12:09 2015
+++ othersrc/external/bsd/arfe/dt/macaddr.c	Thu Oct  8 22:00:56 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: macaddr.c,v 1.3 2015/09/22 01:12:09 dyoung Exp $ */
-/* $ARFE:47:33Z dyoung $ */
+/* $NetBSD: macaddr.c,v 1.4 2015/10/08 22:00:56 dyoung Exp $ */
+/* $ARFE: macaddr.c 260 2015-09-23 19:37:44Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/portability.h
diff -u othersrc/external/bsd/arfe/dt/portability.h:1.1 othersrc/external/bsd/arfe/dt/portability.h:1.2
--- othersrc/external/bsd/arfe/dt/portability.h:1.1	Wed Sep 16 21:07:44 2015
+++ othersrc/external/bsd/arfe/dt/portability.h	Thu Oct  8 22:00:56 2015
@@ -1,3 +1,6 @@
+/* $NetBSD: portability.h,v 1.2 2015/10/08 22:00:56 dyoung Exp $ */
+/* $ARFE: portability.h 261 2015-09-23 19:39:10Z dyoung $ */
+
 #ifndef __NetBSD__
 #define __aligned(__x)	/* */
 #define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))

Index: othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5
diff -u othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5:1.1 othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5:1.2
--- othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5	Thu Oct  8 22:00:56 2015
@@ -1,6 +1,6 @@
 
 
-Uptime:  0: 0AM  up 3 day, 0:0,  -10 users, load averages: 0.13, 0. 4, 0. 1
+Uptime:  0: 0AM  up 3 day, 0:0,  -10 users, load averages: 0.13, 0.04, 0.01
 
 Checking subsystem status:
 
Index: othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2
diff -u othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2:1.1 othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2:1.2
--- othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2	Thu Oct  8 22:00:56 2015
@@ -1,6 +1,6 @@
 
 
-Uptime:  0: 0AM  up -3 day, 0:0,  10 users, load averages: 0.-13, 0.-4, 0.-1
+Uptime:  0: 0AM  up -3 day, 0:0,  10 users, load averages: -0.13, -0.04, -0.01
 
 Checking subsystem status:
 
Index: othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6
diff -u othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6:1.1 othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6:1.2
--- othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6	Thu Oct  8 22:00:56 2015
@@ -1,6 +1,6 @@
 
 
-Uptime:  0: 0AM  up 1 days,  0: 0, 0 users, load averages: 0.-11, 0.-2, 0.-1
+Uptime:  0: 0AM  up 1 days,  0: 0, 0 users, load averages: -0.11, -0.02, -0.01
 
 Checking subsystem status:
 
Index: othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5
diff -u othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5:1.1 othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5:1.2
--- othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5	Thu Oct  8 22:00:56 2015
@@ -1,6 +1,6 @@
 
 
-Uptime:  0: 0AM  up -1 days, 0: 0, 0 users, load averages: 0.11, 0. 2, 0. 1
+Uptime:  0: 0AM  up -1 days, 0: 0, 0 users, load averages: 0.11, 0.02, 0.01
 
 Checking subsystem status:
 
Index: othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-7
diff -u othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-7:1.1 othersrc/external/bsd/arfe/dt/rr

CVS commit: othersrc/external/bsd/arfe

2015-09-21 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Tue Sep 22 01:12:09 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: Makefile README dt.c hex.c hex.h ipv4.c
ipv4.h macaddr.c
othersrc/external/bsd/arfe/it: Makefile README
othersrc/external/bsd/arfe/tt: Makefile README
Added Files:
othersrc/external/bsd/arfe/dt: core.c core.h
othersrc/external/bsd/arfe/it: it.c
othersrc/external/bsd/arfe/tt: tt.c
Removed Files:
othersrc/external/bsd/arfe/dt: dt.h

Log Message:
Give dt, it, and tt custom main() routines instead of using a bunch
of conditionals.  Put the core algorithms and data structures into
core.[ch].  Retire dt.h (it became core.h).  Update Makefiles to suit
and alphabetize SRCS.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/arfe/dt/Makefile \
othersrc/external/bsd/arfe/dt/hex.c othersrc/external/bsd/arfe/dt/hex.h \
othersrc/external/bsd/arfe/dt/ipv4.c othersrc/external/bsd/arfe/dt/ipv4.h
cvs rdiff -u -r1.8 -r1.9 othersrc/external/bsd/arfe/dt/README
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/core.c \
othersrc/external/bsd/arfe/dt/core.h
cvs rdiff -u -r1.12 -r1.13 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r1.4 -r0 othersrc/external/bsd/arfe/dt/dt.h
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/dt/macaddr.c
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/it/Makefile
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/arfe/it/README
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/it/it.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/tt/Makefile
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/tt/README
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tt.c

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/Makefile
diff -u othersrc/external/bsd/arfe/dt/Makefile:1.4 othersrc/external/bsd/arfe/dt/Makefile:1.5
--- othersrc/external/bsd/arfe/dt/Makefile:1.4	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/Makefile	Tue Sep 22 01:12:09 2015
@@ -1,9 +1,9 @@
-# $ARFE: Makefile 239 2015-09-10 22:49:40Z dyoung $
+# $ARFE: Makefile 250 2015-09-22 01:04:13Z dyoung $
 NOMAN=
 .include 
 
 PROG=dt
-SRCS+=dt.c hex.c ipv4.c macaddr.c
+SRCS+=core.c dt.c hex.c ipv4.c macaddr.c
 #CPPFLAGS+=-DHB_DEBUG
 CPPFLAGS+=-DHB_ASSERT
 DBG+=-g -O3
Index: othersrc/external/bsd/arfe/dt/hex.c
diff -u othersrc/external/bsd/arfe/dt/hex.c:1.4 othersrc/external/bsd/arfe/dt/hex.c:1.5
--- othersrc/external/bsd/arfe/dt/hex.c:1.4	Mon Sep 14 02:58:17 2015
+++ othersrc/external/bsd/arfe/dt/hex.c	Tue Sep 22 01:12:09 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.c,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
-/* $ARFE: hex.c 245 2015-09-11 02:13:21Z dyoung $ */
+/* $NetBSD: hex.c,v 1.5 2015/09/22 01:12:09 dyoung Exp $ */
+/* $ARFE: hex.c 251 2015-09-22 01:09:13Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -30,7 +30,7 @@
 #include 
 #include 
 
-#include "dt.h"
+#include "core.h"
 #include "hex.h"
 
 typedef enum hex_op {
Index: othersrc/external/bsd/arfe/dt/hex.h
diff -u othersrc/external/bsd/arfe/dt/hex.h:1.4 othersrc/external/bsd/arfe/dt/hex.h:1.5
--- othersrc/external/bsd/arfe/dt/hex.h:1.4	Mon Sep 14 02:58:17 2015
+++ othersrc/external/bsd/arfe/dt/hex.h	Tue Sep 22 01:12:09 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.h,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
-/* $ARFE: hex.h 245 2015-09-11 02:13:21Z dyoung $ */
+/* $NetBSD: hex.h,v 1.5 2015/09/22 01:12:09 dyoung Exp $ */
+/* $ARFE: hex.h 251 2015-09-22 01:09:13Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/ipv4.c
diff -u othersrc/external/bsd/arfe/dt/ipv4.c:1.4 othersrc/external/bsd/arfe/dt/ipv4.c:1.5
--- othersrc/external/bsd/arfe/dt/ipv4.c:1.4	Mon Sep 14 02:58:17 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.c	Tue Sep 22 01:12:09 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.c,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
-/* $ARFE: ipv4.c 247 2015-09-14 02:52:57Z dyoung $ */
+/* $NetBSD: ipv4.c,v 1.5 2015/09/22 01:12:09 dyoung Exp $ */
+/* $ARFE: ipv4.c 251 2015-09-22 01:09:13Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -33,7 +33,7 @@
 
 #include 	/* for __predict_true() */
 
-#include "dt.h"
+#include "core.h"
 #include "ipv4.h"
 
 typedef enum ipv4_op {
Index: othersrc/external/bsd/arfe/dt/ipv4.h
diff -u othersrc/external/bsd/arfe/dt/ipv4.h:1.4 othersrc/external/bsd/arfe/dt/ipv4.h:1.5
--- othersrc/external/bsd/arfe/dt/ipv4.h:1.4	Mon Sep 14 02:58:17 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.h	Tue Sep 22 01:12:09 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.h,v 1.4 2015/09/14 02:58:17 dyoung Exp $ */
-/* $ARFE: ipv4.h 245 2015-09-11 02:13:21Z dyoung $ */
+/* $NetBSD: ipv4.h,v 1.5 2015/09

CVS commit: othersrc/external/bsd/arfe/tt/tests/4

2015-09-16 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Sep 16 21:08:10 UTC 2015

Added Files:
othersrc/external/bsd/arfe/tt/tests/4: README expected-output input
match transform

Log Message:
Add a new test for tt.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tests/4/README \
othersrc/external/bsd/arfe/tt/tests/4/expected-output \
othersrc/external/bsd/arfe/tt/tests/4/input \
othersrc/external/bsd/arfe/tt/tests/4/match \
othersrc/external/bsd/arfe/tt/tests/4/transform

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

Added files:

Index: othersrc/external/bsd/arfe/tt/tests/4/README
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/4/README:1.1
--- /dev/null	Wed Sep 16 21:08:10 2015
+++ othersrc/external/bsd/arfe/tt/tests/4/README	Wed Sep 16 21:08:10 2015
@@ -0,0 +1,2 @@
+This test demonstrates how TT can marshal a vector dot product into some
+arithmetic that bc(1) understands.
Index: othersrc/external/bsd/arfe/tt/tests/4/expected-output
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/4/expected-output:1.1
--- /dev/null	Wed Sep 16 21:08:10 2015
+++ othersrc/external/bsd/arfe/tt/tests/4/expected-output	Wed Sep 16 21:08:10 2015
@@ -0,0 +1 @@
+5 * 2 + 10 * 3 + 0 * 4
Index: othersrc/external/bsd/arfe/tt/tests/4/input
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/4/input:1.1
--- /dev/null	Wed Sep 16 21:08:10 2015
+++ othersrc/external/bsd/arfe/tt/tests/4/input	Wed Sep 16 21:08:10 2015
@@ -0,0 +1 @@
+(5, 10, 0) . (2, 3, 4)
Index: othersrc/external/bsd/arfe/tt/tests/4/match
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/4/match:1.1
--- /dev/null	Wed Sep 16 21:08:10 2015
+++ othersrc/external/bsd/arfe/tt/tests/4/match	Wed Sep 16 21:08:10 2015
@@ -0,0 +1 @@
+[1 2 3] . [4 5 6]
Index: othersrc/external/bsd/arfe/tt/tests/4/transform
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/4/transform:1.1
--- /dev/null	Wed Sep 16 21:08:10 2015
+++ othersrc/external/bsd/arfe/tt/tests/4/transform	Wed Sep 16 21:08:10 2015
@@ -0,0 +1 @@
+1 * 4 + 2 * 5 + 3 * 6



CVS commit: othersrc/external/bsd/arfe/dt

2015-09-16 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Sep 16 21:07:44 UTC 2015

Added Files:
othersrc/external/bsd/arfe/dt: portability.h

Log Message:
Straggler from previous: add file dt/portability.h.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/portability.h

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

Added files:

Index: othersrc/external/bsd/arfe/dt/portability.h
diff -u /dev/null othersrc/external/bsd/arfe/dt/portability.h:1.1
--- /dev/null	Wed Sep 16 21:07:44 2015
+++ othersrc/external/bsd/arfe/dt/portability.h	Wed Sep 16 21:07:44 2015
@@ -0,0 +1,4 @@
+#ifndef __NetBSD__
+#define __aligned(__x)	/* */
+#define __arraycount(__x) (sizeof(__x) / sizeof(__x[0]))
+#endif



CVS commit: othersrc/external/bsd/arfe/tt

2015-09-10 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Fri Sep 11 01:53:49 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/tt: .cvsignore

Log Message:
In .cvsignore, s/it/tt/ and add a directory that I do not intend to
commit.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/tt/.cvsignore

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

Modified files:

Index: othersrc/external/bsd/arfe/tt/.cvsignore
diff -u othersrc/external/bsd/arfe/tt/.cvsignore:1.1 othersrc/external/bsd/arfe/tt/.cvsignore:1.2
--- othersrc/external/bsd/arfe/tt/.cvsignore:1.1	Fri Sep 11 01:50:43 2015
+++ othersrc/external/bsd/arfe/tt/.cvsignore	Fri Sep 11 01:53:49 2015
@@ -1,3 +1,5 @@
 *.d
 .depend
-it
+.gdbinit
+anonymize
+tt



CVS commit: othersrc/external/bsd/arfe

2015-09-10 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Fri Sep 11 01:50:43 UTC 2015

Modified Files:
othersrc/external/bsd/arfe: Makefile
othersrc/external/bsd/arfe/dt: Makefile README dt.c dt.h hex.c hex.h
ipv4.c ipv4.h testit
othersrc/external/bsd/arfe/dt/rr: if-re0-if-wm0 if-wm0-if-re0
ifconfig.0-ifconfig.1 ifconfig.0-logger-ifconfig.0
ifconfig.1-ifconfig.0 logger-ifconfig.0-ifconfig.0 wm0-a-wm0-b
wm0-b-wm0-a
othersrc/external/bsd/arfe/it: Makefile README
Added Files:
othersrc/external/bsd/arfe/dt: macaddr.c macaddr.h
othersrc/external/bsd/arfe/tt: .cvsignore Makefile README testit.sh

Log Message:
Add a new tool, tt, that transforms its input based on the transform
exemplified by a match/transform-template pair.

Add a data detector for MAC addresses.  Update expected test outputs.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/Makefile
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/dt/Makefile
cvs rdiff -u -r1.5 -r1.6 othersrc/external/bsd/arfe/dt/README
cvs rdiff -u -r1.9 -r1.10 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/dt/dt.h \
othersrc/external/bsd/arfe/dt/hex.c othersrc/external/bsd/arfe/dt/hex.h \
othersrc/external/bsd/arfe/dt/ipv4.c othersrc/external/bsd/arfe/dt/ipv4.h
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/macaddr.c \
othersrc/external/bsd/arfe/dt/macaddr.h
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/dt/testit
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/dt/rr/if-re0-if-wm0 \
othersrc/external/bsd/arfe/dt/rr/if-wm0-if-re0
cvs rdiff -u -r1.4 -r1.5 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-ifconfig.1 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-logger-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.1-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/logger-ifconfig.0-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/wm0-a-wm0-b \
othersrc/external/bsd/arfe/dt/rr/wm0-b-wm0-a
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/it/Makefile
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/it/README
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/.cvsignore \
othersrc/external/bsd/arfe/tt/Makefile \
othersrc/external/bsd/arfe/tt/README \
othersrc/external/bsd/arfe/tt/testit.sh

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

Modified files:

Index: othersrc/external/bsd/arfe/Makefile
diff -u othersrc/external/bsd/arfe/Makefile:1.1 othersrc/external/bsd/arfe/Makefile:1.2
--- othersrc/external/bsd/arfe/Makefile:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/Makefile	Fri Sep 11 01:50:42 2015
@@ -1,5 +1,5 @@
 .include 
 
-SUBDIR=dt it
+SUBDIR=dt it tt
 
 .include 

Index: othersrc/external/bsd/arfe/dt/Makefile
diff -u othersrc/external/bsd/arfe/dt/Makefile:1.3 othersrc/external/bsd/arfe/dt/Makefile:1.4
--- othersrc/external/bsd/arfe/dt/Makefile:1.3	Wed Sep  2 22:43:17 2015
+++ othersrc/external/bsd/arfe/dt/Makefile	Fri Sep 11 01:50:42 2015
@@ -1,9 +1,9 @@
-# $ARFE: Makefile 231 2015-09-02 22:31:30Z dyoung $
+# $ARFE: Makefile 239 2015-09-10 22:49:40Z dyoung $
 NOMAN=
 .include 
 
 PROG=dt
-SRCS+=dt.c hex.c ipv4.c
+SRCS+=dt.c hex.c ipv4.c macaddr.c
 #CPPFLAGS+=-DHB_DEBUG
 CPPFLAGS+=-DHB_ASSERT
 DBG+=-g -O3

Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.5 othersrc/external/bsd/arfe/dt/README:1.6
--- othersrc/external/bsd/arfe/dt/README:1.5	Wed Sep  2 22:45:47 2015
+++ othersrc/external/bsd/arfe/dt/README	Fri Sep 11 01:50:42 2015
@@ -1,5 +1,5 @@
-$ARFE: README 235 2015-09-02 22:44:54Z dyoung $
-$NetBSD: README,v 1.5 2015/09/02 22:45:47 dyoung Exp $
+$ARFE: README 236 2015-09-02 22:47:33Z dyoung $
+$NetBSD: README,v 1.6 2015/09/11 01:50:42 dyoung Exp $
 
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where the numbers and IPv4 addresses are "wild": a span

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.9 othersrc/external/bsd/arfe/dt/dt.c:1.10
--- othersrc/external/bsd/arfe/dt/dt.c:1.9	Wed Sep  2 22:45:47 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Fri Sep 11 01:50:42 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.9 2015/09/02 22:45:47 dyoung Exp $ */
-/* $ARFE: dt.c 235 2015-09-02 22:44:54Z dyoung $ */
+/* $NetBSD: dt.c,v 1.10 2015/09/11 01:50:42 dyoung Exp $ */
+/* $ARFE: dt.c 239 2015-09-10 22:49:40Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -51,6 +51,7 @@
 #include "dt.h"
 #include "hex.h"
 #include "ipv4.h"
+#include "macaddr.h"
 
 #if defined(HB_ASSERT)
 #define	dbg_assert	assert
@@ -63,19 +64,6 @@ typedef struct origin {
 	int j;
 } origin_t;
 
-typedef struct chainelt {
-	TAILQ_ENTRY(chainelt) ce_link;
-	int ce_column;	/*  

CVS commit: othersrc/external/bsd/arfe/tt/tests

2015-09-10 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Fri Sep 11 01:52:20 UTC 2015

Added Files:
othersrc/external/bsd/arfe/tt/tests/1: expected-output input match
transform
othersrc/external/bsd/arfe/tt/tests/2: expected-output input match
transform
othersrc/external/bsd/arfe/tt/tests/3: expected-output input match
transform

Log Message:
Straggler from last: add tt tests.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tests/1/expected-output \
othersrc/external/bsd/arfe/tt/tests/1/input \
othersrc/external/bsd/arfe/tt/tests/1/match \
othersrc/external/bsd/arfe/tt/tests/1/transform
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tests/2/expected-output \
othersrc/external/bsd/arfe/tt/tests/2/input \
othersrc/external/bsd/arfe/tt/tests/2/match \
othersrc/external/bsd/arfe/tt/tests/2/transform
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/tt/tests/3/expected-output \
othersrc/external/bsd/arfe/tt/tests/3/input \
othersrc/external/bsd/arfe/tt/tests/3/match \
othersrc/external/bsd/arfe/tt/tests/3/transform

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

Added files:

Index: othersrc/external/bsd/arfe/tt/tests/1/expected-output
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/1/expected-output:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/1/expected-output	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,3 @@
+wm0
+	455275962 input bytes in 746652 packets (74393 multicast)
+	121514350 output bytes in 541402 packets (254 multicast)
Index: othersrc/external/bsd/arfe/tt/tests/1/input
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/1/input:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/1/input	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,10 @@
+wm0: flags=8843 mtu 1500
+	capabilities=2bf80
+	enabled=2bf80
+	address: 00:0a:0b:cd:01:ef
+	media: Ethernet autoselect (1000baseT full-duplex)
+	status: active
+	input: 746652 packets, 455275962 bytes, 74393 multicasts
+	output: 541402 packets, 121514350 bytes, 254 multicasts
+	inet 10.0.1.17 netmask 0xff00 broadcast 10.0.1.255
+	inet6 fe80::20a:bff:fecd:1ef%wm0 prefixlen 64 scopeid 0x1
Index: othersrc/external/bsd/arfe/tt/tests/1/match
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/1/match:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/1/match	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,9 @@
+wm0: flags=8843 mtu 1500
+	capabilities=2bf80
+	enabled=2bf80
+	address: 00:0a:0b:cd:01:ef
+	media: Ethernet autoselect (1000baseT full-duplex)
+	status: active
+	input: 745177 packets, 455120099 bytes, 74377 multicasts
+	output: 540500 packets, 121290742 bytes, 253 multicasts
+	inet 10.0.1.17 netmask 0xff00 broadcast 10.0.1.255
Index: othersrc/external/bsd/arfe/tt/tests/1/transform
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/1/transform:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/1/transform	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,3 @@
+wm0
+	455120099 input bytes in 745177 packets (74377 multicast)
+	121290742 output bytes in 540500 packets (253 multicast)

Index: othersrc/external/bsd/arfe/tt/tests/2/expected-output
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/2/expected-output:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/2/expected-output	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,4 @@
+wm0 mtu 1500
+	link 00:0a:0b:cd:01:ef
+	inet 10.0.1.17 netmask 0xff00 broadcast 10.0.1.255
+	inet6 fe80::20a:bff:fecd:1ef%wm0 / 64 scopeid 0x1
Index: othersrc/external/bsd/arfe/tt/tests/2/input
diff -u /dev/null othersrc/external/bsd/arfe/tt/tests/2/input:1.1
--- /dev/null	Fri Sep 11 01:52:20 2015
+++ othersrc/external/bsd/arfe/tt/tests/2/input	Fri Sep 11 01:52:20 2015
@@ -0,0 +1,10 @@
+wm0: flags=8843 mtu 1500
+	capabilities=2bf80
+	enabled=2bf80
+	address: 00:0a:0b:cd:01:ef
+	media: Ethernet autoselect (1000baseT full-duplex)
+	status: active
+	input: 746652 packets, 455275962 bytes, 74393 multicasts
+	output: 541402 packets, 121514350 bytes, 254 multicasts
+	inet 10.0.1.17 

CVS commit: othersrc/external/bsd/arfe

2015-09-10 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Fri Sep 11 02:12:57 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: README dt.c dt.h hex.c hex.h ipv4.c
ipv4.h
othersrc/external/bsd/arfe/it: README
othersrc/external/bsd/arfe/tt: README testit.sh

Log Message:
CVS/ is not a test directory, don't try to run a test there.

Update $ARFE$.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 othersrc/external/bsd/arfe/dt/README
cvs rdiff -u -r1.10 -r1.11 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/dt/dt.h \
othersrc/external/bsd/arfe/dt/hex.c othersrc/external/bsd/arfe/dt/hex.h \
othersrc/external/bsd/arfe/dt/ipv4.c othersrc/external/bsd/arfe/dt/ipv4.h
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/arfe/it/README
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/tt/README \
othersrc/external/bsd/arfe/tt/testit.sh

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.6 othersrc/external/bsd/arfe/dt/README:1.7
--- othersrc/external/bsd/arfe/dt/README:1.6	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/README	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-$ARFE: README 236 2015-09-02 22:47:33Z dyoung $
-$NetBSD: README,v 1.6 2015/09/11 01:50:42 dyoung Exp $
+$ARFE: README 243 2015-09-11 01:57:04Z dyoung $
+$NetBSD: README,v 1.7 2015/09/11 02:12:57 dyoung Exp $
 
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where the numbers and IPv4 addresses are "wild": a span

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.10 othersrc/external/bsd/arfe/dt/dt.c:1.11
--- othersrc/external/bsd/arfe/dt/dt.c:1.10	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.10 2015/09/11 01:50:42 dyoung Exp $ */
-/* $ARFE: dt.c 239 2015-09-10 22:49:40Z dyoung $ */
+/* $NetBSD: dt.c,v 1.11 2015/09/11 02:12:57 dyoung Exp $ */
+/* $ARFE: dt.c 243 2015-09-11 01:57:04Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>

Index: othersrc/external/bsd/arfe/dt/dt.h
diff -u othersrc/external/bsd/arfe/dt/dt.h:1.2 othersrc/external/bsd/arfe/dt/dt.h:1.3
--- othersrc/external/bsd/arfe/dt/dt.h:1.2	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/dt.h	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.h,v 1.2 2015/09/11 01:50:42 dyoung Exp $ */
-/* $ARFE: dt.h 237 2015-09-02 22:48:04Z dyoung $ */
+/* $NetBSD: dt.h,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
+/* $ARFE: dt.h 243 2015-09-11 01:57:04Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/hex.c
diff -u othersrc/external/bsd/arfe/dt/hex.c:1.2 othersrc/external/bsd/arfe/dt/hex.c:1.3
--- othersrc/external/bsd/arfe/dt/hex.c:1.2	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/hex.c	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.c,v 1.2 2015/09/11 01:50:42 dyoung Exp $ */
-/* $ARFE: hex.c 236 2015-09-02 22:47:33Z dyoung $ */
+/* $NetBSD: hex.c,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
+/* $ARFE: hex.c 243 2015-09-11 01:57:04Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/hex.h
diff -u othersrc/external/bsd/arfe/dt/hex.h:1.2 othersrc/external/bsd/arfe/dt/hex.h:1.3
--- othersrc/external/bsd/arfe/dt/hex.h:1.2	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/hex.h	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: hex.h,v 1.2 2015/09/11 01:50:42 dyoung Exp $ */
-/* $ARFE: hex.h 236 2015-09-02 22:47:33Z dyoung $ */
+/* $NetBSD: hex.h,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
+/* $ARFE: hex.h 243 2015-09-11 01:57:04Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/ipv4.c
diff -u othersrc/external/bsd/arfe/dt/ipv4.c:1.2 othersrc/external/bsd/arfe/dt/ipv4.c:1.3
--- othersrc/external/bsd/arfe/dt/ipv4.c:1.2	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.c	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.c,v 1.2 2015/09/11 01:50:42 dyoung Exp $ */
-/* $ARFE: ipv4.c 238 2015-09-10 20:16:07Z dyoung $ */
+/* $NetBSD: ipv4.c,v 1.3 2015/09/11 02:12:57 dyoung Exp $ */
+/* $ARFE: ipv4.c 243 2015-09-11 01:57:04Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
Index: othersrc/external/bsd/arfe/dt/ipv4.h
diff -u othersrc/external/bsd/arfe/dt/ipv4.h:1.2 othersrc/external/bsd/arfe/dt/ipv4.h:1.3
--- othersrc/external/bsd/arfe/dt/ipv4.h:1.2	Fri Sep 11 01:50:42 2015
+++ othersrc/external/bsd/arfe/dt/ipv4.h	Fri Sep 11 02:12:57 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: ipv4.h,v 1.2 2015/09/11 01:50:42 dyoung Exp $ */
-/

CVS commit: othersrc/external/bsd/arfe

2015-09-02 Thread David Young
-02 22:31:30Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>
@@ -25,12 +25,6 @@
  * (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 	/* for __cacheline_aligned */
-#include 	/* for MAX() */
-#include 	/* for TAILQ_*() */
-#include 
-#include 
 #include 
 #include 	/* for ispunct(), isspace(), isxdigit() */
 #include 
@@ -45,6 +39,19 @@
 #include 
 #include 
 
+#include 	/* for inet_net_pton */
+#include 	/* for inet_net_pton */
+#include 	/* for inet_net_pton */
+
+#include 	/* for MAX() */
+#include 	/* for TAILQ_*() */
+#include 
+#include 
+
+#include "dt.h"
+#include "hex.h"
+#include "ipv4.h"
+
 #if defined(HB_ASSERT)
 #define	dbg_assert	assert
 #else
@@ -56,104 +63,6 @@ typedef struct origin {
 	int j;
 } origin_t;
 
-typedef enum hex_op {
-	  HEX_OP_NONE = 0
-	, HEX_OP_PUSH
-	, HEX_OP_EMIT
-	, HEX_OP_0xEMIT
-	, HEX_OP_START
-	, HEX_OP_0xSTART
-} hex_op_t;
-
-struct hex_state;
-typedef struct hex_state hex_state_t;
-
-typedef struct hex_transition {
-	const hex_state_t	*t_newstate;
-	hex_op_t		t_op;
-} hex_transition_t;
-
-struct hex_state {
-	const char *s_descr;
-	hex_transition_t s_other;
-	hex_transition_t s_hexdigit;
-	hex_transition_t s_0;
-	hex_transition_t s_x;
-	hex_transition_t s_delimiter;
-	hex_transition_t s_eof;
-};
-
-enum hex_state_idxs {
-	  READ_0
-	, READ_X
-	, READ_0xHEXDIGIT
-	, READ_HEXDIGIT
-	, READ_EOF
-	, READ_OTHER
-	, READ_DELIMITER
-};
-
-#define	read_0 hex_states[READ_0]
-#define	read_x hex_states[READ_X]
-#define	read_0xhexdigit hex_states[READ_0xHEXDIGIT]
-#define	read_hexdigit hex_states[READ_HEXDIGIT]
-#define	read_eof hex_states[READ_EOF]
-#define	read_other hex_states[READ_OTHER]
-#define	read_delimiter hex_states[READ_DELIMITER]
-
-static const hex_state_t hex_states[] = {[READ_0] = {
-	.s_descr = "read 0",
-	.s_other = {_other, HEX_OP_NONE},
-	.s_hexdigit = {_hexdigit, HEX_OP_PUSH},
-	.s_x = {_x, HEX_OP_0xSTART},
-}, [READ_X] = {
-	.s_descr = "read x",
-	.s_other = {_other, HEX_OP_NONE},
-	.s_hexdigit = {_0xhexdigit, HEX_OP_PUSH},
-}, [READ_0xHEXDIGIT] = {
-	.s_descr = "read 0xhexdigit",
-	.s_other = {_other, HEX_OP_NONE},
-	.s_delimiter = {_delimiter, HEX_OP_0xEMIT},
-	.s_eof = {_eof, HEX_OP_0xEMIT},
-	.s_hexdigit = {_0xhexdigit, HEX_OP_PUSH},
-}, [READ_HEXDIGIT] = {
-	.s_descr = "read hexdigit",
-	.s_other = {_other, HEX_OP_NONE},
-	.s_delimiter = {_delimiter, HEX_OP_EMIT},
-	.s_eof = {_eof, HEX_OP_EMIT},
-	.s_hexdigit = {_hexdigit, HEX_OP_PUSH},
-}, [READ_EOF] = {
-	.s_descr = "read eof",
-	.s_other = {_eof, HEX_OP_NONE},
-}, [READ_OTHER] = {
-	.s_descr = "read other",
-	.s_other = {_other, HEX_OP_NONE},
-	.s_delimiter = {_delimiter, HEX_OP_NONE},
-}, [READ_DELIMITER] = {
-	.s_descr = "read delimiter",
-	.s_0 = {_0, HEX_OP_START},
-	.s_hexdigit = {_hexdigit, HEX_OP_START},
-	.s_delimiter = {_delimiter, HEX_OP_NONE},
-	.s_other = {_other, HEX_OP_NONE},
-}};
-
-struct hex_parser;
-typedef struct hex_parser hex_parser_t;
-
-typedef void (*hex_emitter_t)(hex_parser_t *, void *, bool);
-
-struct hex_parser {
-	struct {
-		int start, stop;
-	} p_column, p_idx;
-	char p_digits[16 + 1];	/* XXX how many hex digits in an intmax_t? */
-	char *p_top;
-	const hex_state_t *p_state;
-	bool p_starts_0x;
-	hex_emitter_t p_emitter;
-	void *p_arg;
-};
-
 typedef struct chainelt {
 	TAILQ_ENTRY(chainelt) ce_link;
 	int ce_column;	/*  0: no column alignment,
@@ -178,6 +87,7 @@ typedef enum {
 	, KIND_INTMAX_DEC
 	, KIND_INTMAX_HEX
 	, KIND_INTMAX_0xHEX
+	, KIND_IPv4
 	, KIND_STRING
 } clocc_kind_t;
 
@@ -195,6 +105,7 @@ typedef struct clocc {
 	union {
 		intmax_t u_intmax;
 		uintmax_t u_uintmax;
+		uint32_t u_ipv4;
 	} val_u;
 } clocc_t;
 
@@ -235,151 +146,6 @@ static bool freeslices_initialized __ali
 static freeslice_t *first_freeslice __aligned(COHERENCY_UNIT);
 static freeslice_t freeslices[2048];
 
-static int dbg_printf(const char *, ...) __printflike(1, 2);
-static int dbg2_printf(const char *, ...) __printflike(1, 2);
-
-#if defined(HB_DEBUG)
-static inline int
-dbg_printf(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	const int rc = vfprintf(stderr, fmt, ap);
-	va_end(ap);
-	return rc;
-}
-
-static inline int
-dbg2_printf(const char *fmt, ...)
-{
-	va_list ap;
-
-	va_start(ap, fmt);
-	const int rc = vfprintf(stderr, fmt, ap);
-	va_end(ap);
-	return rc;
-}
-#else
-static inline int
-dbg_printf(const char *fmt, ...)
-{
-	return 0;
-}
-
-static inline int
-dbg2_printf(const char *fmt, ...)
-{
-	return 0;
-}
-#endif
-
-static void
-hex_parser_init(hex_parser_t *p, hex_emitter_t emitter, void *arg)
-{
-	memset(p, 0, sizeof(*p));
-	p->p_state = _delimiter;
-	p->p_emitter = emitter;
-	p->p_arg = arg;
-}
-
-static const char *
-hex_op_string(hex_op_t op)
-{
-	switch (op) {
-	case HEX_OP_NONE:
-		return "none";
-	c

CVS commit: othersrc/external/bsd/arfe/dt

2015-09-02 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Wed Sep  2 22:45:47 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: README dt.c

Log Message:
Commit latest $ARFE$.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/arfe/dt/README
cvs rdiff -u -r1.8 -r1.9 othersrc/external/bsd/arfe/dt/dt.c

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.4 othersrc/external/bsd/arfe/dt/README:1.5
--- othersrc/external/bsd/arfe/dt/README:1.4	Wed Sep  2 22:43:17 2015
+++ othersrc/external/bsd/arfe/dt/README	Wed Sep  2 22:45:47 2015
@@ -1,5 +1,5 @@
-$ARFE: README 233 2015-09-02 22:33:54Z dyoung $
-$NetBSD: README,v 1.4 2015/09/02 22:43:17 dyoung Exp $
+$ARFE: README 235 2015-09-02 22:44:54Z dyoung $
+$NetBSD: README,v 1.5 2015/09/02 22:45:47 dyoung Exp $
 
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where the numbers and IPv4 addresses are "wild": a span

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.8 othersrc/external/bsd/arfe/dt/dt.c:1.9
--- othersrc/external/bsd/arfe/dt/dt.c:1.8	Wed Sep  2 22:43:17 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Wed Sep  2 22:45:47 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.8 2015/09/02 22:43:17 dyoung Exp $ */
-/* $ARFE: dt.c 231 2015-09-02 22:31:30Z dyoung $ */
+/* $NetBSD: dt.c,v 1.9 2015/09/02 22:45:47 dyoung Exp $ */
+/* $ARFE: dt.c 235 2015-09-02 22:44:54Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young <dyo...@netbsd.org>



CVS commit: othersrc/external/bsd/arfe/dt

2015-08-28 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Fri Aug 28 21:39:00 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: dt.c

Log Message:
Identify hexadecimal numbers that do NOT begin with 0x.

When one hexadecimal number in all capitals matches another all-caps hex
number, print the result in all capitals, too, so that inputs like
this netstat -s output,

0 packets with ECN CE bit

do not turn to this:

0 packets with ECN ce bit

TBD: repair expected test results.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 othersrc/external/bsd/arfe/dt/dt.c

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.4 othersrc/external/bsd/arfe/dt/dt.c:1.5
--- othersrc/external/bsd/arfe/dt/dt.c:1.4	Tue Aug 25 22:19:09 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Fri Aug 28 21:39:00 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.4 2015/08/25 22:19:09 dyoung Exp $ */
-/* $ARFE: dt.c 217 2015-08-25 22:16:29Z dyoung $ */
+/* $NetBSD: dt.c,v 1.5 2015/08/28 21:39:00 dyoung Exp $ */
+/* $ARFE: dt.c 220 2015-08-28 21:37:51Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young dyo...@netbsd.org
@@ -60,7 +60,9 @@ typedef enum hex_op {
 	  HEX_OP_NONE = 0
 	, HEX_OP_PUSH
 	, HEX_OP_EMIT
+	, HEX_OP_0xEMIT
 	, HEX_OP_START
+	, HEX_OP_0xSTART
 } hex_op_t;
 
 struct hex_state;
@@ -84,6 +86,7 @@ struct hex_state {
 enum hex_state_idxs {
 	  READ_0
 	, READ_X
+	, READ_0xHEXDIGIT
 	, READ_HEXDIGIT
 	, READ_EOF
 	, READ_OTHER
@@ -92,6 +95,7 @@ enum hex_state_idxs {
 
 #define	read_0 hex_states[READ_0]
 #define	read_x hex_states[READ_X]
+#define	read_0xhexdigit hex_states[READ_0xHEXDIGIT]
 #define	read_hexdigit hex_states[READ_HEXDIGIT]
 #define	read_eof hex_states[READ_EOF]
 #define	read_other hex_states[READ_OTHER]
@@ -100,11 +104,18 @@ enum hex_state_idxs {
 static const hex_state_t hex_states[] = {[READ_0] = {
 	.s_descr = read 0,
 	.s_other = {read_other, HEX_OP_NONE},
-	.s_x = {read_x, HEX_OP_NONE},
+	.s_hexdigit = {read_hexdigit, HEX_OP_PUSH},
+	.s_x = {read_x, HEX_OP_0xSTART},
 }, [READ_X] = {
 	.s_descr = read x,
 	.s_other = {read_other, HEX_OP_NONE},
-	.s_hexdigit = {read_hexdigit, HEX_OP_PUSH},
+	.s_hexdigit = {read_0xhexdigit, HEX_OP_PUSH},
+}, [READ_0xHEXDIGIT] = {
+	.s_descr = read 0xhexdigit,
+	.s_other = {read_other, HEX_OP_NONE},
+	.s_delimiter = {read_delimiter, HEX_OP_0xEMIT},
+	.s_eof = {read_eof, HEX_OP_0xEMIT},
+	.s_hexdigit = {read_0xhexdigit, HEX_OP_PUSH},
 }, [READ_HEXDIGIT] = {
 	.s_descr = read hexdigit,
 	.s_other = {read_other, HEX_OP_NONE},
@@ -121,13 +132,15 @@ static const hex_state_t hex_states[] = 
 }, [READ_DELIMITER] = {
 	.s_descr = read delimiter,
 	.s_0 = {read_0, HEX_OP_START},
+	.s_hexdigit = {read_hexdigit, HEX_OP_START},
+	.s_delimiter = {read_delimiter, HEX_OP_NONE},
 	.s_other = {read_other, HEX_OP_NONE},
 }};
 
 struct hex_parser;
 typedef struct hex_parser hex_parser_t;
 
-typedef void (*hex_emitter_t)(hex_parser_t *, void *);
+typedef void (*hex_emitter_t)(hex_parser_t *, void *, bool);
 
 struct hex_parser {
 	struct {
@@ -136,6 +149,7 @@ struct hex_parser {
 	char p_digits[16 + 1];	/* XXX how many hex digits in an intmax_t? */
 	char *p_top;
 	const hex_state_t *p_state;
+	bool p_starts_0x;
 	hex_emitter_t p_emitter;
 	void *p_arg;
 };
@@ -163,14 +177,21 @@ typedef enum {
 	  KIND_NONE = 0
 	, KIND_INTMAX_DEC
 	, KIND_INTMAX_HEX
+	, KIND_INTMAX_0xHEX
 	, KIND_STRING
 } clocc_kind_t;
 
+typedef enum {
+	  QUAL_NONE = 0 
+	, QUAL_ALLCAPS
+} clocc_qual_t;
+
 typedef struct clocc {
 	int column;
 	int first;
 	int last;
 	clocc_kind_t kind;
+	clocc_qual_t qual;
 	union {
 		intmax_t u_intmax;
 		uintmax_t u_uintmax;
@@ -270,10 +291,14 @@ hex_op_string(hex_op_t op)
 		return none;
 	case HEX_OP_EMIT:
 		return emit;
+	case HEX_OP_0xEMIT:
+		return 0xemit;
 	case HEX_OP_PUSH:
 		return push;
 	case HEX_OP_START:
 		return start;
+	case HEX_OP_0xSTART:
+		return 0xstart;
 	default:
 		return unknown;
 	}
@@ -284,6 +309,7 @@ hex_parser_drive(hex_parser_t *p, int id
 {
 	const hex_transition_t *t;
 	const hex_state_t *ns, *s;
+	bool use0x = false;
 
 	s = p-p_state;
 
@@ -313,6 +339,11 @@ hex_parser_drive(hex_parser_t *p, int id
 	}
 
 	switch (t-t_op) {
+	case HEX_OP_START:
+		p-p_column.start = column;
+		p-p_idx.start = idx;
+		p-p_top = p-p_digits[0];
+		/*FALLTHROUGH*/
 	case HEX_OP_PUSH:
 		if (p-p_top == NULL)
 			;
@@ -323,21 +354,24 @@ hex_parser_drive(hex_parser_t *p, int id
 			*p-p_top = c;
 			p-p_top++;
 		}
-		p-p_idx.stop = idx;
 		p-p_column.stop = column;
+		p-p_idx.stop = idx;
 		break;
-	case HEX_OP_START:
-		p-p_column.start = column;
-		p-p_column.stop = column + 1;
-		p-p_idx.start = idx;
-		p-p_idx.stop = idx + 1;
+	case HEX_OP_0xSTART:
+		p-p_column.start = column - 1;
+		p-p_column.stop = column;
+		p-p_idx.start = idx - 1;
+		p-p_idx.stop = idx;
 		p

CVS commit: othersrc/external/bsd/arfe/dt

2015-08-25 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Tue Aug 25 22:19:10 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: dt.c
Added Files:
othersrc/external/bsd/arfe/dt/rr: if-re0-if-wm0 if-wm0-if-re0
othersrc/external/bsd/arfe/dt/t: if-re0 if-wm0

Log Message:
Commit stragglers.  Renew $ARFE$ in dt.c.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/rr/if-re0-if-wm0 \
othersrc/external/bsd/arfe/dt/rr/if-wm0-if-re0
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/t/if-re0 \
othersrc/external/bsd/arfe/dt/t/if-wm0

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.3 othersrc/external/bsd/arfe/dt/dt.c:1.4
--- othersrc/external/bsd/arfe/dt/dt.c:1.3	Sat Aug 22 05:08:48 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Tue Aug 25 22:19:09 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.3 2015/08/22 05:08:48 dyoung Exp $ */
-/* $ARFE: dt.c 215 2015-08-22 05:02:46Z dyoung $ */
+/* $NetBSD: dt.c,v 1.4 2015/08/25 22:19:09 dyoung Exp $ */
+/* $ARFE: dt.c 217 2015-08-25 22:16:29Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young dyo...@netbsd.org

Added files:

Index: othersrc/external/bsd/arfe/dt/rr/if-re0-if-wm0
diff -u /dev/null othersrc/external/bsd/arfe/dt/rr/if-re0-if-wm0:1.1
--- /dev/null	Tue Aug 25 22:19:10 2015
+++ othersrc/external/bsd/arfe/dt/rr/if-re0-if-wm0	Tue Aug 25 22:19:09 2015
@@ -0,0 +1,8 @@
+  0: flags=   0UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu0
+	capabilities=-1f0TSO0,IP0CSUM_Rx,IP0CSUM_Tx,TCP0CSUM_Rx,TCP0CSUM_Tx,UDP0CSUM_Rx,UDP0CSUM_Tx
+	enabled=-1f0TSO0,IP0CSUM_Rx,IP0CSUM_Tx,TCP0CSUM_Rx,TCP0CSUM_Tx,UDP0CSUM_Rx,UDP0CSUM_Tx
+	address:  0:-25:-80:-1:b
+	media: Ethernet autoselect (e)
+	status: aie
+	inet 10.0.1.17 netmask 0xff00 broadcast -245.-255.-254.0
+	inet0 fe 0::-25:ff:fe-80:b%0 prefixlen 0 scopeid 0x0
Index: othersrc/external/bsd/arfe/dt/rr/if-wm0-if-re0
diff -u /dev/null othersrc/external/bsd/arfe/dt/rr/if-wm0-if-re0:1.1
--- /dev/null	Tue Aug 25 22:19:10 2015
+++ othersrc/external/bsd/arfe/dt/rr/if-wm0-if-re0	Tue Aug 25 22:19:09 2015
@@ -0,0 +1,8 @@
+  0: flags=   0UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu0
+	capabilities=1f0TSO0,IP0CSUM_Rx,IP0CSUM_Tx,TCP0CSUM_Rx,TCP0CSUM_Tx,UDP0CSUM_Rx,UDP-2CSUM_Tx
+	enabled=1f0TSO0,IP0CSUM_Rx,IP0CSUM_Tx,TCP0CSUM_Rx,TCP0CSUM_Tx,UDP0CSUM_Rx,UDP-2CSUM_Tx
+	address:  0:25:5: 80::
+	media: Ethernet autoselect (e)
+	status: cie
+	inet -10.0.-1.-17 netmask 0xff00 broadcast 245.255.254.0
+	inet0 fe 0:: 25:ff:fe80:b%0 prefixlen 0 scopeid 0x0

Index: othersrc/external/bsd/arfe/dt/t/if-re0
diff -u /dev/null othersrc/external/bsd/arfe/dt/t/if-re0:1.1
--- /dev/null	Tue Aug 25 22:19:10 2015
+++ othersrc/external/bsd/arfe/dt/t/if-re0	Tue Aug 25 22:19:10 2015
@@ -0,0 +1,8 @@
+re0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
+	capabilities=3f80TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx
+	enabled=3f80TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx
+	address: 00:33:5d:80:a1:b0
+	media: Ethernet autoselect (none)
+	status: no carrier
+	inet 0.0.0.0 netmask 0xff00 broadcast 255.255.255.255
+	inet6 fe80::233:5dff:fe80:a1b0%re0 prefixlen 64 scopeid 0x2
Index: othersrc/external/bsd/arfe/dt/t/if-wm0
diff -u /dev/null othersrc/external/bsd/arfe/dt/t/if-wm0:1.1
--- /dev/null	Tue Aug 25 22:19:10 2015
+++ othersrc/external/bsd/arfe/dt/t/if-wm0	Tue Aug 25 22:19:10 2015
@@ -0,0 +1,8 @@
+wm0: flags=8843UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST mtu 1500
+	capabilities=2bf80TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx
+	enabled=2bf80TSO4,IP4CSUM_Rx,IP4CSUM_Tx,TCP4CSUM_Rx,TCP4CSUM_Tx,UDP4CSUM_Rx,UDP4CSUM_Tx,TCP6CSUM_Tx,UDP6CSUM_Tx
+	address: 00:08:0c:0e:bc:cc
+	media: Ethernet autoselect (1000baseT full-duplex)
+	status: active
+	inet 10.0.1.17 netmask 0xff00 broadcast 10.0.1.255
+	inet6 fe80::208:cff:fe0e:bccc%wm0 prefixlen 64 scopeid 0x1



CVS commit: othersrc/external/bsd/arfe

2015-08-21 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Sat Aug 22 05:08:48 UTC 2015

Modified Files:
othersrc/external/bsd/arfe: README
othersrc/external/bsd/arfe/dt: Makefile README dt.c testit
othersrc/external/bsd/arfe/dt/rr: ifconfig.0-ifconfig.1
ifconfig.0-logger-ifconfig.0 ifconfig.1-ifconfig.0
logger-ifconfig.0-ifconfig.0 wm0-a-wm0-b wm0-b-wm0-a

Log Message:
Locate in both inputs hexadecimal numbers starting 0x and make them
wild in the alignments dt computes.  In dt, bitwise-AND the 0x-hex
numbers.  In it, bitwise-OR them.  Take care not to match a hexadecimal
with a decimal or vice versa!

TBD: identify hexadecimals that don't start 0x.

Remove a little dead code.

Split HB_DEBUG into HB_DEBUG and HB_ASSERT.  The latter just enables the
assertions.

Update old test results for the new treatment of 0x-hexadecimal.  Add
some new tests.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/README
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/dt/Makefile \
othersrc/external/bsd/arfe/dt/README othersrc/external/bsd/arfe/dt/testit
cvs rdiff -u -r1.2 -r1.3 othersrc/external/bsd/arfe/dt/dt.c
cvs rdiff -u -r1.1 -r1.2 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-ifconfig.1 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-logger-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.1-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/logger-ifconfig.0-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/wm0-a-wm0-b \
othersrc/external/bsd/arfe/dt/rr/wm0-b-wm0-a

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

Modified files:

Index: othersrc/external/bsd/arfe/README
diff -u othersrc/external/bsd/arfe/README:1.1 othersrc/external/bsd/arfe/README:1.2
--- othersrc/external/bsd/arfe/README:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/README	Sat Aug 22 05:08:48 2015
@@ -1,3 +1,5 @@
+$ARFE: README 216 2015-08-22 05:04:28Z dyoung $
+
 ARFE is a suite of tools for processing record- and field-oriented
 digital texts.  ARFE strives to make a useful set of automatic
 text-processing functions available at a level of abstraction that both

Index: othersrc/external/bsd/arfe/dt/Makefile
diff -u othersrc/external/bsd/arfe/dt/Makefile:1.1 othersrc/external/bsd/arfe/dt/Makefile:1.2
--- othersrc/external/bsd/arfe/dt/Makefile:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/Makefile	Sat Aug 22 05:08:48 2015
@@ -1,9 +1,11 @@
+# $ARFE: Makefile 216 2015-08-22 05:04:28Z dyoung $
 NOMAN=
 .include bsd.own.mk
 
 PROG=dt
 SRCS+=dt.c
 #CPPFLAGS+=-DHB_DEBUG
+CPPFLAGS+=-DHB_ASSERT
 DBG+=-g -O3
 #DBG+=-g -O0
 #COPTS+=-pg
Index: othersrc/external/bsd/arfe/dt/README
diff -u othersrc/external/bsd/arfe/dt/README:1.1 othersrc/external/bsd/arfe/dt/README:1.2
--- othersrc/external/bsd/arfe/dt/README:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/README	Sat Aug 22 05:08:48 2015
@@ -1,3 +1,5 @@
+$ARFE: README 216 2015-08-22 05:04:28Z dyoung $
+
 DT---(d)ifferentiate (t)ext---finds a longest common subsequence (LCS)
 of two texts where decimal numbers are wild: a span of decimal digits
 in the first text will match a digits span in the second text.  Then it
Index: othersrc/external/bsd/arfe/dt/testit
diff -u othersrc/external/bsd/arfe/dt/testit:1.1 othersrc/external/bsd/arfe/dt/testit:1.2
--- othersrc/external/bsd/arfe/dt/testit:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/testit	Sat Aug 22 05:08:48 2015
@@ -1,4 +1,5 @@
 #!/bin/sh
+# $ARFE: testit 216 2015-08-22 05:04:28Z dyoung $
 
 results=rr
 
@@ -34,4 +35,6 @@ quackabequack quackdariaquack
 quackdariaquack quackabequack 
 wm0-a wm0-b
 wm0-b wm0-a
+if-re0 if-wm0
+if-wm0 if-re0
 EOF

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.2 othersrc/external/bsd/arfe/dt/dt.c:1.3
--- othersrc/external/bsd/arfe/dt/dt.c:1.2	Tue Aug 11 21:04:59 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Sat Aug 22 05:08:48 2015
@@ -1,5 +1,5 @@
-/* $NetBSD: dt.c,v 1.2 2015/08/11 21:04:59 dyoung Exp $ */
-/* $Id: dt.c,v 1.2 2015/08/11 21:04:59 dyoung Exp $ */
+/* $NetBSD: dt.c,v 1.3 2015/08/22 05:08:48 dyoung Exp $ */
+/* $ARFE: dt.c 215 2015-08-22 05:02:46Z dyoung $ */
 
 /*-
  * Copyright (c) 2014,2015 David Young dyo...@netbsd.org
@@ -32,6 +32,7 @@
 #include sys/mman.h
 #include sys/stat.h
 #include assert.h
+#include ctype.h	/* for ispunct(), isspace(), isxdigit() */
 #include err.h
 #include errno.h
 #include fcntl.h
@@ -44,7 +45,7 @@
 #include limits.h
 #include string.h
 
-#if defined(HB_DEBUG)
+#if defined(HB_ASSERT)
 #define	dbg_assert	assert
 #else
 #define dbg_assert(__x)	do { } while (false) /* do nothing */
@@ -55,6 +56,90 @@ typedef struct origin {
 	int j;
 } origin_t;
 
+typedef enum hex_op {
+	  HEX_OP_NONE = 0
+	, HEX_OP_PUSH
+	, HEX_OP_EMIT
+	, HEX_OP_START
+} hex_op_t;
+
+struct hex_state;
+typedef struct hex_state hex_state_t

CVS commit: othersrc/external/bsd/arfe/dt

2015-08-11 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Tue Aug 11 21:04:59 UTC 2015

Modified Files:
othersrc/external/bsd/arfe/dt: dt.c

Log Message:
Add 2-clause BSD license and copyright notice.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 othersrc/external/bsd/arfe/dt/dt.c

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

Modified files:

Index: othersrc/external/bsd/arfe/dt/dt.c
diff -u othersrc/external/bsd/arfe/dt/dt.c:1.1 othersrc/external/bsd/arfe/dt/dt.c:1.2
--- othersrc/external/bsd/arfe/dt/dt.c:1.1	Mon Aug 10 21:10:59 2015
+++ othersrc/external/bsd/arfe/dt/dt.c	Tue Aug 11 21:04:59 2015
@@ -1,3 +1,31 @@
+/* $NetBSD: dt.c,v 1.2 2015/08/11 21:04:59 dyoung Exp $ */
+/* $Id: dt.c,v 1.2 2015/08/11 21:04:59 dyoung Exp $ */
+
+/*-
+ * Copyright (c) 2014,2015 David Young dyo...@netbsd.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 ``AS IS'' AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+ * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+ * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+ * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
 #include sys/cdefs.h	/* for __cacheline_aligned */
 #include sys/param.h	/* for MAX() */
 #include sys/queue.h	/* for TAILQ_*() */



CVS commit: othersrc/external/bsd/arfe

2015-08-10 Thread David Young
Module Name:othersrc
Committed By:   dyoung
Date:   Mon Aug 10 21:11:00 UTC 2015

Added Files:
othersrc/external/bsd/arfe: Makefile README
othersrc/external/bsd/arfe/dt: .cvsignore Makefile README dt.c testit
othersrc/external/bsd/arfe/dt/rr: abecedarian-abracadabra
abracadabra-abecedarian daily-output-2-daily-output-5
daily-output-5-daily-output-2 daily-output-5-daily-output-6
daily-output-6-daily-output-5 daily-output-6-daily-output-7
daily-output-7-daily-output-6 ifconfig.0-ifconfig.1
ifconfig.0-logger-ifconfig.0 ifconfig.1-ifconfig.0
logger-ifconfig.0-ifconfig.0 netstat-s.0-netstat-s.1
netstat-s.1-netstat-s.0 quack123quack-quack456quack
quack456quack-quack123quack quackabequack-quackdariaquack
quackdariaquack-quackabequack wm0-a-wm0-b wm0-b-wm0-a
othersrc/external/bsd/arfe/dt/t: abecedarian abracadabra daily-output-2
daily-output-5 daily-output-6 daily-output-7 ifconfig.0 ifconfig.1
logger-ifconfig.0 netstat-s.0 netstat-s.1 quack123quack
quack456quack quackabequack quackdariaquack wm0-a wm0-b
othersrc/external/bsd/arfe/it: .cvsignore Makefile README

Log Message:
Commit the beginnings of ARFE.

ARFE is a suite of tools for processing record- and field-oriented
digital texts.  ARFE strives to make a useful set of automatic
text-processing functions available at a level of abstraction that both
invites use by lay people and frees programmers from painstakingly
specifying input and output forms.  ARFE stands for (A)d hoc (R)ecord
and (F)ield (E)xtraction.  It is pronounced arf!


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/Makefile \
othersrc/external/bsd/arfe/README
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/.cvsignore \
othersrc/external/bsd/arfe/dt/Makefile \
othersrc/external/bsd/arfe/dt/README othersrc/external/bsd/arfe/dt/dt.c \
othersrc/external/bsd/arfe/dt/testit
cvs rdiff -u -r0 -r1.1 \
othersrc/external/bsd/arfe/dt/rr/abecedarian-abracadabra \
othersrc/external/bsd/arfe/dt/rr/abracadabra-abecedarian \
othersrc/external/bsd/arfe/dt/rr/daily-output-2-daily-output-5 \
othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-2 \
othersrc/external/bsd/arfe/dt/rr/daily-output-5-daily-output-6 \
othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-5 \
othersrc/external/bsd/arfe/dt/rr/daily-output-6-daily-output-7 \
othersrc/external/bsd/arfe/dt/rr/daily-output-7-daily-output-6 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-ifconfig.1 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.0-logger-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/ifconfig.1-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/logger-ifconfig.0-ifconfig.0 \
othersrc/external/bsd/arfe/dt/rr/netstat-s.0-netstat-s.1 \
othersrc/external/bsd/arfe/dt/rr/netstat-s.1-netstat-s.0 \
othersrc/external/bsd/arfe/dt/rr/quack123quack-quack456quack \
othersrc/external/bsd/arfe/dt/rr/quack456quack-quack123quack \
othersrc/external/bsd/arfe/dt/rr/quackabequack-quackdariaquack \
othersrc/external/bsd/arfe/dt/rr/quackdariaquack-quackabequack \
othersrc/external/bsd/arfe/dt/rr/wm0-a-wm0-b \
othersrc/external/bsd/arfe/dt/rr/wm0-b-wm0-a
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/dt/t/abecedarian \
othersrc/external/bsd/arfe/dt/t/abracadabra \
othersrc/external/bsd/arfe/dt/t/daily-output-2 \
othersrc/external/bsd/arfe/dt/t/daily-output-5 \
othersrc/external/bsd/arfe/dt/t/daily-output-6 \
othersrc/external/bsd/arfe/dt/t/daily-output-7 \
othersrc/external/bsd/arfe/dt/t/ifconfig.0 \
othersrc/external/bsd/arfe/dt/t/ifconfig.1 \
othersrc/external/bsd/arfe/dt/t/logger-ifconfig.0 \
othersrc/external/bsd/arfe/dt/t/netstat-s.0 \
othersrc/external/bsd/arfe/dt/t/netstat-s.1 \
othersrc/external/bsd/arfe/dt/t/quack123quack \
othersrc/external/bsd/arfe/dt/t/quack456quack \
othersrc/external/bsd/arfe/dt/t/quackabequack \
othersrc/external/bsd/arfe/dt/t/quackdariaquack \
othersrc/external/bsd/arfe/dt/t/wm0-a \
othersrc/external/bsd/arfe/dt/t/wm0-b
cvs rdiff -u -r0 -r1.1 othersrc/external/bsd/arfe/it/.cvsignore \
othersrc/external/bsd/arfe/it/Makefile \
othersrc/external/bsd/arfe/it/README

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

Added files:

Index: othersrc/external/bsd/arfe/Makefile
diff -u /dev/null othersrc/external/bsd/arfe/Makefile:1.1
--- /dev/null	Mon Aug 10 21:11:00 2015
+++ othersrc/external/bsd/arfe/Makefile	Mon Aug 10 21:10:59 2015
@@ -0,0 +1,5 @@
+.include bsd.own.mk
+
+SUBDIR=dt it
+
+.include bsd.subdir.mk
Index: othersrc/external/bsd/arfe/README
diff -u /dev/null othersrc/external/bsd/arfe/README:1.1
--- /dev/null	Mon Aug 10 21:11:00 2015
+++ 

CVS commit: src/sys/arch/x86

2013-01-26 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Jan 26 17:37:39 UTC 2013

Modified Files:
src/sys/arch/x86/include: i82093reg.h i82489reg.h
src/sys/arch/x86/pci: pci_intr_machdep.c

Log Message:
Several registers and bitfields named IOAPIC_* actually belong to the
LAPIC, so rename them LAPIC_* and move to a more appropriate header
file.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/include/i82093reg.h
cvs rdiff -u -r1.11 -r1.12 src/sys/arch/x86/include/i82489reg.h
cvs rdiff -u -r1.25 -r1.26 src/sys/arch/x86/pci/pci_intr_machdep.c

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

Modified files:

Index: src/sys/arch/x86/include/i82093reg.h
diff -u src/sys/arch/x86/include/i82093reg.h:1.3 src/sys/arch/x86/include/i82093reg.h:1.4
--- src/sys/arch/x86/include/i82093reg.h:1.3	Wed Aug 17 14:55:11 2011
+++ src/sys/arch/x86/include/i82093reg.h	Sat Jan 26 17:37:39 2013
@@ -1,4 +1,4 @@
-/* 	$NetBSD: i82093reg.h,v 1.3 2011/08/17 14:55:11 dyoung Exp $ */
+/* 	$NetBSD: i82093reg.h,v 1.4 2013/01/26 17:37:39 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -36,34 +36,6 @@
  */
 #define IOAPIC_BASE_DEFAULT	0xfec0
 
-#define IOAPIC_MSIADDR_BASE		0xfee0
-#define	IOAPIC_MSIADDR_DSTID_MASK	__BITS(19, 12)
-#define	IOAPIC_MSIADDR_RSVD0_MASK	__BITS(11, 4)
-#define	IOAPIC_MSIADDR_RH		__BIT(3)
-#define	IOAPIC_MSIADDR_DM		__BIT(2)
-#define	IOAPIC_MSIADDR_RSVD1_MASK	__BITS(1, 0)
-
-#define	IOAPIC_MSIDATA_VECTOR_MASK	__BITS(7, 0)
-#define	IOAPIC_MSIDATA_DM_MASK		__BITS(10, 8)
-#define	IOAPIC_MSIDATA_DM_FIXED		__SHIFTIN(0, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_LOPRI		__SHIFTIN(1, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_SMI		__SHIFTIN(2, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_RSVD0		__SHIFTIN(3, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_NMI		__SHIFTIN(4, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_INIT		__SHIFTIN(5, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_RSVD1		__SHIFTIN(6, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_DM_EXTINT	__SHIFTIN(7, IOAPIC_MSIDATA_DM_MASK)
-#define	IOAPIC_MSIDATA_RSVD0_MASK	__BITS(13, 11)
-#define	IOAPIC_MSIDATA_LEVEL_MASK	__BIT(14)
-#define	IOAPIC_MSIDATA_LEVEL_DEASSERT	__SHIFTIN(0, IOAPIC_MSIDATA_LEVEL_MASK)
-#define	IOAPIC_MSIDATA_LEVEL_ASSERT	__SHIFTIN(1, IOAPIC_MSIDATA_LEVEL_MASK)
-#define	IOAPIC_MSIDATA_TRGMODE_MASK	__BIT(15)
-#define	IOAPIC_MSIDATA_TRGMODE_EDGE	\
-__SHIFTIN(0, IOAPIC_MSIDATA_TRGMODE_MASK)
-#define	IOAPIC_MSIDATA_TRGMODE_LEVEL	\
-__SHIFTIN(1, IOAPIC_MSIDATA_TRGMODE_MASK)
-#define	IOAPIC_MSIDATA_RSVD1_MASK	__BITS(31, 16)
-
 /*
  * Memory-space registers.
  */

Index: src/sys/arch/x86/include/i82489reg.h
diff -u src/sys/arch/x86/include/i82489reg.h:1.11 src/sys/arch/x86/include/i82489reg.h:1.12
--- src/sys/arch/x86/include/i82489reg.h:1.11	Fri Jan 20 18:47:04 2012
+++ src/sys/arch/x86/include/i82489reg.h	Sat Jan 26 17:37:39 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: i82489reg.h,v 1.11 2012/01/20 18:47:04 hannken Exp $	*/
+/*	$NetBSD: i82489reg.h,v 1.12 2013/01/26 17:37:39 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -139,6 +139,32 @@
 #	define LAPIC_DCRT_DIV64		0x09
 #	define LAPIC_DCRT_DIV128	0x0a
 
+#define LAPIC_MSIADDR_BASE		0xfee0
+#define	LAPIC_MSIADDR_DSTID_MASK	__BITS(19, 12)
+#define	LAPIC_MSIADDR_RSVD0_MASK	__BITS(11, 4)
+#define	LAPIC_MSIADDR_RH		__BIT(3)
+#define	LAPIC_MSIADDR_DM		__BIT(2)
+#define	LAPIC_MSIADDR_RSVD1_MASK	__BITS(1, 0)
+
+#define	LAPIC_MSIDATA_VECTOR_MASK	__BITS(7, 0)
+#define	LAPIC_MSIDATA_DM_MASK		__BITS(10, 8)
+#define	LAPIC_MSIDATA_DM_FIXED		__SHIFTIN(0, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_LOPRI		__SHIFTIN(1, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_SMI		__SHIFTIN(2, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_RSVD0		__SHIFTIN(3, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_NMI		__SHIFTIN(4, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_INIT		__SHIFTIN(5, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_RSVD1		__SHIFTIN(6, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_DM_EXTINT	__SHIFTIN(7, LAPIC_MSIDATA_DM_MASK)
+#define	LAPIC_MSIDATA_RSVD0_MASK	__BITS(13, 11)
+#define	LAPIC_MSIDATA_LEVEL_MASK	__BIT(14)
+#define	LAPIC_MSIDATA_LEVEL_DEASSERT	__SHIFTIN(0, LAPIC_MSIDATA_LEVEL_MASK)
+#define	LAPIC_MSIDATA_LEVEL_ASSERT	__SHIFTIN(1, LAPIC_MSIDATA_LEVEL_MASK)
+#define	LAPIC_MSIDATA_TRGMODE_MASK	__BIT(15)
+#define	LAPIC_MSIDATA_TRGMODE_EDGE	__SHIFTIN(0, LAPIC_MSIDATA_TRGMODE_MASK)
+#define	LAPIC_MSIDATA_TRGMODE_LEVEL	__SHIFTIN(1, LAPIC_MSIDATA_TRGMODE_MASK)
+#define	LAPIC_MSIDATA_RSVD1_MASK	__BITS(31, 16)
+
 #define LAPIC_BASE		0xfee0
 
 #define LAPIC_IRQ_MASK(i)	(1  ((i) + 1))

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.25 src/sys/arch/x86/pci/pci_intr_machdep.c:1.26
--- 

CVS commit: src/sys/dev/pci

2012-11-08 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Nov  8 20:36:17 UTC 2012

Modified Files:
src/sys/dev/pci: if_et.c

Log Message:
Use native NetBSD macros instead of compatibility macros.

This change compiles, but I don't have an et(4) with which to test.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/sys/dev/pci/if_et.c

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

Modified files:

Index: src/sys/dev/pci/if_et.c
diff -u src/sys/dev/pci/if_et.c:1.5 src/sys/dev/pci/if_et.c:1.6
--- src/sys/dev/pci/if_et.c:1.5	Mon Oct 29 01:36:33 2012
+++ src/sys/dev/pci/if_et.c	Thu Nov  8 20:36:16 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_et.c,v 1.5 2012/10/29 01:36:33 msaitoh Exp $	*/
+/*	$NetBSD: if_et.c,v 1.6 2012/11/08 20:36:16 dyoung Exp $	*/
 /*	$OpenBSD: if_et.c,v 1.11 2008/06/08 06:18:07 jsg Exp $	*/
 /*
  * Copyright (c) 2007 The DragonFly Project.  All rights reserved.
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.5 2012/10/29 01:36:33 msaitoh Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.6 2012/11/08 20:36:16 dyoung Exp $);
 
 #include opt_inet.h
 #include vlan.h
@@ -81,17 +81,6 @@ __KERNEL_RCSID(0, $NetBSD: if_et.c,v 1.
 
 #include dev/pci/if_etreg.h
 
-/* XXX temporary porting goop */
-#define KKASSERT(cond) if (!(cond)) panic(KKASSERT: %s in %s, #cond, __func__)
-#undef KASSERT
-#define KASSERT(cond, complaint) if (!(cond)) panic complaint
-
-/* these macros in particular need to die, so gross */
-#define __LOWEST_SET_BIT(__mask) __mask) - 1)  (__mask)) ^ (__mask))
-#define __SHIFTOUT(__x, __mask) (((__x)  (__mask)) / __LOWEST_SET_BIT(__mask))
-#define __SHIFTIN(__x, __mask) ((__x) * __LOWEST_SET_BIT(__mask))
-/* XXX end porting goop */
-
 int	et_match(device_t, cfdata_t, void *);
 void	et_attach(device_t, device_t, void *);
 int	et_detach(device_t, int flags);
@@ -120,7 +109,6 @@ int	et_dma_mem_create(struct et_softc *,
 void	et_dma_mem_destroy(struct et_softc *, void *, bus_dmamap_t);
 int	et_dma_mbuf_create(struct et_softc *);
 void	et_dma_mbuf_destroy(struct et_softc *, int, const int[]);
-void	et_dma_ring_addr(void *, bus_dma_segment_t *, int, int);
 
 int	et_init_tx_ring(struct et_softc *);
 int	et_init_rx_ring(struct et_softc *);
@@ -183,7 +171,7 @@ et_match(device_t dev, cfdata_t match, v
 	const struct et_product *ep;
 	int i;
 
-	for (i = 0; i  sizeof(et_devices) / sizeof(et_devices[0]); i++) {
+	for (i = 0; i  __arraycount(et_devices); i++) {
 		ep = et_devices[i];
 		if (PCI_VENDOR(pa-pa_id) == ep-vendor 
 		PCI_PRODUCT(pa-pa_id) == ep-product)
@@ -830,8 +818,8 @@ et_dma_mbuf_destroy(struct et_softc *sc,
 		for (j = 0; j  rx_done[i]; ++j) {
 			struct et_rxbuf *rb = rbd-rbd_buf[j];
 
-			KASSERT(rb-rb_mbuf == NULL,
-			(RX mbuf in %d RX ring is not freed yet\n, i));
+			KASSERTMSG(rb-rb_mbuf == NULL,
+			RX mbuf in %d RX ring is not freed yet\n, i);
 			bus_dmamap_destroy(sc-sc_dmat, rb-rb_dmap); 
 		}
 	}
@@ -842,7 +830,7 @@ et_dma_mbuf_destroy(struct et_softc *sc,
 	for (i = 0; i  tx_done; ++i) {
 		struct et_txbuf *tb = tbd-tbd_buf[i];
 
-		KASSERT(tb-tb_mbuf == NULL, (TX mbuf is not freed yet\n));
+		KASSERTMSG(tb-tb_mbuf == NULL, TX mbuf is not freed yet\n);
 		bus_dmamap_destroy(sc-sc_dmat, tb-tb_dmap);
 	}
 
@@ -902,13 +890,6 @@ et_dma_mem_destroy(struct et_softc *sc, 
 }
 
 void
-et_dma_ring_addr(void *arg, bus_dma_segment_t *seg, int nseg, int error)
-{
-	KASSERT(nseg == 1, (too many segments\n));
-	*((bus_addr_t *)arg) = seg-ds_addr;
-}
-
-void
 et_chip_attach(struct et_softc *sc)
 {
 	uint32_t val;
@@ -1729,7 +1710,7 @@ et_rxeof(struct et_softc *sc)
 		int buflen, buf_idx, ring_idx;
 		uint32_t rxstat_pos, rxring_pos;
 
-		KKASSERT(rxst_ring-rsr_index  ET_RX_NSTAT);
+		KASSERT(rxst_ring-rsr_index  ET_RX_NSTAT);
 		st = rxst_ring-rsr_stat[rxst_ring-rsr_index];
 
 		buflen = __SHIFTOUT(st-rxst_info2, ET_RXST_INFO2_LEN);
@@ -1791,7 +1772,7 @@ et_rxeof(struct et_softc *sc)
 			ring_idx, buf_idx, rx_ring-rr_index);
 		}
 
-		KKASSERT(rx_ring-rr_index  ET_RX_NDESC);
+		KASSERT(rx_ring-rr_index  ET_RX_NDESC);
 		if (++rx_ring-rr_index == ET_RX_NDESC) {
 			rx_ring-rr_index = 0;
 			rx_ring-rr_wrap ^= 1;
@@ -1817,10 +1798,10 @@ et_encap(struct et_softc *sc, struct mbu
 	maxsegs = ET_TX_NDESC - tbd-tbd_used;
 	if (maxsegs  ET_NSEG_MAX)
 		maxsegs = ET_NSEG_MAX;
-	KASSERT(maxsegs = ET_NSEG_SPARE,
-		(not enough spare TX desc (%d)\n, maxsegs));
+	KASSERTMSG(maxsegs = ET_NSEG_SPARE,
+		not enough spare TX desc (%d)\n, maxsegs);
 
-	KKASSERT(tx_ring-tr_ready_index  ET_TX_NDESC);
+	KASSERT(tx_ring-tr_ready_index  ET_TX_NDESC);
 	first_idx = tx_ring-tr_ready_index;
 	map = tbd-tbd_buf[first_idx].tb_dmap;
 
@@ -1905,7 +1886,7 @@ et_encap(struct et_softc *sc, struct mbu
 			last_idx = idx;
 		}
 
-		KKASSERT(tx_ring-tr_ready_index  ET_TX_NDESC);
+		KASSERT(tx_ring-tr_ready_index  ET_TX_NDESC);
 		if (++tx_ring-tr_ready_index == ET_TX_NDESC) 

CVS commit: src/sys/dev/ic

2012-11-08 Thread David Young
, BUS_DMASYNC_PREREAD);
@@ -3484,8 +3484,8 @@ again:
 		} else
 			m = n;
 	}
-	KASSERT(maxfrags  1,
-		(maxfrags %u, but normal collapse failed, maxfrags));
+	KASSERTMSG(maxfrags  1,
+		maxfrags %u, but normal collapse failed, maxfrags);
 	/*
 	 * Collapse consecutive mbufs to a cluster.
 	 */
@@ -3679,8 +3679,8 @@ ath_tx_start(struct ath_softc *sc, struc
 			ath_freetx(m0);
 			return error;
 		}
-		KASSERT(bf-bf_nseg = ATH_TXDESC,
-		(too many segments after defrag; nseg %u, bf-bf_nseg));
+		KASSERTMSG(bf-bf_nseg = ATH_TXDESC,
+		too many segments after defrag; nseg %u, bf-bf_nseg);
 	} else if (bf-bf_nseg == 0) {		/* null packet, discard */
 		sc-sc_stats.ast_tx_nodata++;
 		ath_freetx(m0);
@@ -3695,7 +3695,7 @@ ath_tx_start(struct ath_softc *sc, struc
 	/* setup descriptors */
 	ds = bf-bf_desc;
 	rt = sc-sc_currates;
-	KASSERT(rt != NULL, (no rate table, mode %u, sc-sc_curmode));
+	KASSERTMSG(rt != NULL, no rate table, mode %u, sc-sc_curmode);
 
 	/*
 	 * NB: the 802.11 layer marks whether or not we should
@@ -3862,7 +3862,7 @@ ath_tx_start(struct ath_softc *sc, struc
 			dur = rt-info[rix].lpAckDuration;
 		if (wh-i_fc[1]  IEEE80211_FC1_MORE_FRAG) {
 			dur += dur; /* additional SIFS+ACK */
-			KASSERT(m0-m_nextpkt != NULL, (no fragment));
+			KASSERTMSG(m0-m_nextpkt != NULL, no fragment);
 			/*
 			 * Include the size of next fragment so NAV is
 			 * updated properly.  The last fragment uses only
@@ -3896,7 +3896,7 @@ ath_tx_start(struct ath_softc *sc, struc
 		 * in whether or not a short preamble is to be used.
 		 */
 		/* NB: cix is set above where RTS/CTS is enabled */
-		KASSERT(cix != 0xff, (cix not setup));
+		KASSERTMSG(cix != 0xff, cix not setup);
 		ctsrate = rt-info[cix].rateCode;
 		/*
 		 * Compute the transmit duration based on the frame
@@ -4640,8 +4640,9 @@ ath_calibrate(void *arg)
 		if (sc-sc_calinterval  ath_calinterval)
 			sc-sc_calinterval = ath_calinterval;
 	}
-	KASSERT(0  sc-sc_calinterval  sc-sc_calinterval = ath_calinterval,
-		(bad calibration interval %u, sc-sc_calinterval));
+	KASSERTMSG(0  sc-sc_calinterval 
+	   sc-sc_calinterval = ath_calinterval,
+		   bad calibration interval %u, sc-sc_calinterval);
 
 	DPRINTF(sc, ATH_DEBUG_CALIBRATE,
 		%s: next +%u (%siqCalDone tries %u)\n, __func__,
@@ -4864,9 +4865,9 @@ ath_newassoc(struct ieee80211_node *ni, 
 	ath_rate_newassoc(sc, ATH_NODE(ni), isnew);
 	if (isnew 
 	(ic-ic_flags  IEEE80211_F_PRIVACY) == 0  sc-sc_hasclrkey) {
-		KASSERT(ni-ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE,
-		(new assoc with a unicast key already setup (keyix %u),
-		ni-ni_ucastkey.wk_keyix));
+		KASSERTMSG(ni-ni_ucastkey.wk_keyix == IEEE80211_KEYIX_NONE,
+		new assoc with a unicast key already setup (keyix %u),
+		ni-ni_ucastkey.wk_keyix);
 		ath_setup_stationkey(ni);
 	}
 }
@@ -5107,7 +5108,7 @@ ath_setcurmode(struct ath_softc *sc, enu
 
 	memset(sc-sc_rixmap, 0xff, sizeof(sc-sc_rixmap));
 	rt = sc-sc_rates[mode];
-	KASSERT(rt != NULL, (no h/w rate set for phy mode %u, mode));
+	KASSERTMSG(rt != NULL, no h/w rate set for phy mode %u, mode);
 	for (i = 0; i  rt-rateCount; i++)
 		sc-sc_rixmap[rt-info[i].dot11Rate  IEEE80211_RATE_VAL] = i;
 	memset(sc-sc_hwmap, 0, sizeof(sc-sc_hwmap));

Index: src/sys/dev/ic/ath_netbsd.h
diff -u src/sys/dev/ic/ath_netbsd.h:1.13 src/sys/dev/ic/ath_netbsd.h:1.14
--- src/sys/dev/ic/ath_netbsd.h:1.13	Sat Jun  2 21:36:44 2012
+++ src/sys/dev/ic/ath_netbsd.h	Thu Nov  8 20:43:55 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath_netbsd.h,v 1.13 2012/06/02 21:36:44 dsl Exp $ */
+/*	$NetBSD: ath_netbsd.h,v 1.14 2012/11/08 20:43:55 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young
@@ -29,9 +29,6 @@
 
 #include sys/sysctl.h
 
-#undef KASSERT
-#define KASSERT(__cond, __complaint) if (!(__cond)) panic __complaint
-
 typedef struct ath_task {
 	void	(*t_func)(void*, int);
 	void	*t_context;
@@ -53,14 +50,14 @@ typedef kmutex_t ath_txq_lock_t;
 #define	ATH_TXQ_LOCK_DESTROY(_tq)	mutex_destroy((_tq)-axq_lock)
 #define	ATH_TXQ_LOCK(_tq)		mutex_enter((_tq)-axq_lock)
 #define	ATH_TXQ_UNLOCK(_tq)		mutex_exit((_tq)-axq_lock)
-#define	ATH_TXQ_LOCK_ASSERT(_tq)	do { KASSERT(mutex_owned((_tq)-axq_lock), (txq lock unheld)); } while (/*CONSTCOND*/true)
+#define	ATH_TXQ_LOCK_ASSERT(_tq)	do { KASSERTMSG(mutex_owned((_tq)-axq_lock), txq lock unheld); } while (/*CONSTCOND*/true)
 
 typedef kmutex_t ath_txbuf_lock_t;
 #define	ATH_TXBUF_LOCK_INIT(_sc)	mutex_init((_sc)-sc_txbuflock, MUTEX_DEFAULT, IPL_NET)
 #define	ATH_TXBUF_LOCK_DESTROY(_sc)	mutex_destroy((_sc)-sc_txbuflock)
 #define	ATH_TXBUF_LOCK(_sc)		mutex_enter((_sc)-sc_txbuflock)
 #define	ATH_TXBUF_UNLOCK(_sc)		mutex_exit((_sc)-sc_txbuflock)
-#define	ATH_TXBUF_LOCK_ASSERT(_sc)	do { KASSERT(mutex_owned((_sc)-sc_txbuflock), (txbuf lock unheld)); } while (/*CONSTCOND*/true)
+#define	ATH_TXBUF_LOCK_ASSERT(_sc)	do { KASSERTMSG(mutex_owned((_sc)-sc_txbuflock), txbuf lock unheld); } while (/*CONSTCOND*/true)
 
 #define	NET_LOCK_GIANT()
 #define

CVS commit: src/sys/arch/i386

2012-10-23 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 23 16:08:12 UTC 2012

Modified Files:
src/sys/arch/i386: Makefile

Log Message:
Run $(TOOL_CTAGS) instead of ctags: sometimes it's better than the host's
native ctags, and it's nice to have consistent ctags from one host to another.


To generate a diff of this commit:
cvs rdiff -u -r1.42 -r1.43 src/sys/arch/i386/Makefile

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

Modified files:

Index: src/sys/arch/i386/Makefile
diff -u src/sys/arch/i386/Makefile:1.42 src/sys/arch/i386/Makefile:1.43
--- src/sys/arch/i386/Makefile:1.42	Fri Sep  2 22:12:48 2011
+++ src/sys/arch/i386/Makefile	Tue Oct 23 16:08:12 2012
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.42 2011/09/02 22:12:48 dyoung Exp $
+#	$NetBSD: Makefile,v 1.43 2012/10/23 16:08:12 dyoung Exp $
 
 # Makefile for i386 tags file and boot blocks
 
@@ -34,10 +34,10 @@ DI386=	i386 eisa isa include pci
 
 tags:
 	-rm -f ${TI386}
-	-echo ${SI386} | xargs ctags -wadtf ${TI386}
+	-echo ${SI386} | xargs $(TOOL_CTAGS) -wadtf ${TI386}
 	-find -H ${SYSDIR}/external/bsd/acpica/dist/ -name '*.[ch]' | \
-	sort -t / -u | xargs ctags -wadtf ${TI386}
-	-${FINDCOMM} | xargs ctags -wadtf ${TI386}
+	sort -t / -u | xargs $(TOOL_CTAGS) -wadtf ${TI386}
+	-${FINDCOMM} | xargs $(TOOL_CTAGS) -wadtf ${TI386}
 	egrep ^ENTRY(.*)|^ALTENTRY(.*) ${AI386} | \
 	${TOOL_SED} -e \
 	s;\([^:]*\):\([^(]*\)(\([^, )]*\)\(.*\);\3	\1	/^\2(\3\4$$/; \



CVS commit: src/sys/sys

2012-10-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 17 17:48:48 UTC 2012

Modified Files:
src/sys/sys: module.h

Log Message:
Correct spelling: entrie - entry.


To generate a diff of this commit:
cvs rdiff -u -r1.31 -r1.32 src/sys/sys/module.h

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

Modified files:

Index: src/sys/sys/module.h
diff -u src/sys/sys/module.h:1.31 src/sys/sys/module.h:1.32
--- src/sys/sys/module.h:1.31	Tue Aug  7 01:19:06 2012
+++ src/sys/sys/module.h	Wed Oct 17 17:48:48 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: module.h,v 1.31 2012/08/07 01:19:06 jnemeth Exp $	*/
+/*	$NetBSD: module.h,v 1.32 2012/10/17 17:48:48 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -89,7 +89,7 @@ typedef struct module {
 	modsrc_t		mod_source;
 	time_t			mod_autotime;
 	void 			*mod_ctf;
-	u_int			mod_fbtentries;	/* DTrace FBT entrie count */
+	u_int			mod_fbtentries;	/* DTrace FBT entry count */
 	int			mod_flags;
 #define MODFLG_MUST_FORCE	0x01
 #define MODFLG_AUTO_LOADED	0x02



CVS commit: src/sys

2012-10-17 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 17 21:35:39 UTC 2012

Modified Files:
src/sys/arch/x86/x86: mpbios.c
src/sys/dev/gpio: gpio.c

Log Message:
Quiet down autoconfiguration by changing some printf() calls to
aprint_normal() calls.


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/sys/arch/x86/x86/mpbios.c
cvs rdiff -u -r1.50 -r1.51 src/sys/dev/gpio/gpio.c

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

Modified files:

Index: src/sys/arch/x86/x86/mpbios.c
diff -u src/sys/arch/x86/x86/mpbios.c:1.58 src/sys/arch/x86/x86/mpbios.c:1.59
--- src/sys/arch/x86/x86/mpbios.c:1.58	Wed Aug  4 10:02:12 2010
+++ src/sys/arch/x86/x86/mpbios.c	Wed Oct 17 21:35:38 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mpbios.c,v 1.58 2010/08/04 10:02:12 jruoho Exp $	*/
+/*	$NetBSD: mpbios.c,v 1.59 2012/10/17 21:35:38 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 The NetBSD Foundation, Inc.
@@ -96,7 +96,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mpbios.c,v 1.58 2010/08/04 10:02:12 jruoho Exp $);
+__KERNEL_RCSID(0, $NetBSD: mpbios.c,v 1.59 2012/10/17 21:35:38 dyoung Exp $);
 
 #include acpica.h
 #include lapic.h
@@ -221,7 +221,7 @@ mp_cpuprint(void *aux, const char *pnp)
 
 	if (pnp)
 		aprint_normal(cpu at %s, pnp);
-	printf( apid %d, caa-cpu_number);
+	aprint_normal( apid %d, caa-cpu_number);
 	return (UNCONF);
 }
 
@@ -232,7 +232,7 @@ mp_ioapicprint(void *aux, const char *pn
 
 	if (pnp)
 		aprint_normal(ioapic at %s, pnp);
-	printf( apid %d, aaa-apic_id);
+	aprint_normal( apid %d, aaa-apic_id);
 	return (UNCONF);
 }
 
@@ -506,13 +506,13 @@ mpbios_scan(device_t self, int *ncpup)
 
 	switch (mp_fps-spec_rev) {
 	case 1:
-		printf((Version 1.1));
+		aprint_normal((Version 1.1));
 		break;
 	case 4:
-		printf((Version 1.4));
+		aprint_normal((Version 1.4));
 		break;
 	default:
-		printf((unrecognized rev %d), mp_fps-spec_rev);
+		aprint_normal((unrecognized rev %d), mp_fps-spec_rev);
 	}
 
 	/*

Index: src/sys/dev/gpio/gpio.c
diff -u src/sys/dev/gpio/gpio.c:1.50 src/sys/dev/gpio/gpio.c:1.51
--- src/sys/dev/gpio/gpio.c:1.50	Fri Nov 25 13:49:43 2011
+++ src/sys/dev/gpio/gpio.c	Wed Oct 17 21:35:39 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: gpio.c,v 1.50 2011/11/25 13:49:43 mbalmer Exp $ */
+/* $NetBSD: gpio.c,v 1.51 2012/10/17 21:35:39 dyoung Exp $ */
 /*	$OpenBSD: gpio.c,v 1.6 2006/01/14 12:33:49 grange Exp $	*/
 
 /*
@@ -19,7 +19,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.50 2011/11/25 13:49:43 mbalmer Exp $);
+__KERNEL_RCSID(0, $NetBSD: gpio.c,v 1.51 2012/10/17 21:35:39 dyoung Exp $);
 
 /*
  * General Purpose Input/Output framework.
@@ -198,7 +198,7 @@ gpio_attach(device_t parent, device_t se
 	sc-sc_pins = gba-gba_pins;
 	sc-sc_npins = gba-gba_npins;
 
-	printf(: %d pins\n, sc-sc_npins);
+	aprint_normal(: %d pins\n, sc-sc_npins);
 
 	if (!pmf_device_register(self, NULL, gpio_resume))
 		aprint_error_dev(self, couldn't establish power handler\n);



CVS commit: src/usr.bin/ktruss

2012-03-12 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Mar 12 22:02:07 UTC 2012

Modified Files:
src/usr.bin/ktruss: makeerrnos.sh

Log Message:
Use 'sort -n -k 3' instead of 'sort -n +2' since the former is more
portable.  The latter is not supported by Mac OS X Lion.


To generate a diff of this commit:
cvs rdiff -u -r1.5 -r1.6 src/usr.bin/ktruss/makeerrnos.sh

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

Modified files:

Index: src/usr.bin/ktruss/makeerrnos.sh
diff -u src/usr.bin/ktruss/makeerrnos.sh:1.5 src/usr.bin/ktruss/makeerrnos.sh:1.6
--- src/usr.bin/ktruss/makeerrnos.sh:1.5	Sun Oct 19 22:10:05 2008
+++ src/usr.bin/ktruss/makeerrnos.sh	Mon Mar 12 22:02:07 2012
@@ -1,6 +1,6 @@
 #! /bin/sh
 #
-#	$NetBSD: makeerrnos.sh,v 1.5 2008/10/19 22:10:05 apb Exp $
+#	$NetBSD: makeerrnos.sh,v 1.6 2012/03/12 22:02:07 dyoung Exp $
 
 if [ $# -ne 3 ]; then
 	echo usage: makeerrnos.sh errno.h signal.h output
@@ -35,7 +35,7 @@ ${AWK} '
 END {
 	print 	{ \0\, 0 },\n;
 }
-' | sort -n +2  $CFILE
+' | sort -n -k 3  $CFILE
 echo 	{ 0L, 0},
 };  $CFILE
 lines=`wc -l $CFILE | ${AWK} ' { print $1; } ' -`
@@ -59,7 +59,7 @@ ${AWK} '
 END {
 	print 	{ \0\, 0 },\n;
 }
-' | sort -n +2  $CFILE
+' | sort -n -k 3  $CFILE
 echo 	{ 0L, 0},
 };  $CFILE
 elines=`grep '{ SIG' $CFILE | wc -l`



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

2012-02-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Feb  7 16:34:44 UTC 2012

Modified Files:
src/sys/arch/i386/i386: mainbus.c

Log Message:
Initialize pcibus_attach_args.pba_sub to 255.  Note in a comment that
this needs some improvement for machines with 1 Host-PCI bridge, but
that it doesn't cause any practical problems at this time.

Ok releng@.


To generate a diff of this commit:
cvs rdiff -u -r1.93 -r1.94 src/sys/arch/i386/i386/mainbus.c

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

Modified files:

Index: src/sys/arch/i386/i386/mainbus.c
diff -u src/sys/arch/i386/i386/mainbus.c:1.93 src/sys/arch/i386/i386/mainbus.c:1.94
--- src/sys/arch/i386/i386/mainbus.c:1.93	Wed Jan 18 21:34:38 2012
+++ src/sys/arch/i386/i386/mainbus.c	Tue Feb  7 16:34:44 2012
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.93 2012/01/18 21:34:38 drochner Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.94 2012/02/07 16:34:44 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.93 2012/01/18 21:34:38 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.94 2012/02/07 16:34:44 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -406,6 +406,13 @@ mainbus_rescan(device_t self, const char
 		mba.mba_pba.pba_pc = NULL;
 		mba.mba_pba.pba_flags = pci_bus_flags();
 		mba.mba_pba.pba_bus = 0;
+		/* XXX On those machines with 1 Host-PCI bridge,
+		 * XXX not every bus  pba_bus is subordinate to pba_bus,
+		 * XXX but this works on many machines, and pba_sub is
+		 * XXX not used today by any critical code, so it is safe
+		 * XXX to be so inclusive at this time.
+		 */
+		mba.mba_pba.pba_sub = 255;
 		mba.mba_pba.pba_bridgetag = NULL;
 #if NACPICA  0  defined(ACPI_SCANPCI)
 		if (npcibus == 0  sc-sc_mpacpi_active)



CVS commit: src/sys/net

2011-12-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Dec 28 02:14:57 UTC 2011

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

Log Message:
Fix ifpromisc() regression: if ifpromisc(ifp, 1) is called, do set
IFF_PROMISC whether ifp is IFF_UP or not, but do not call ifp-if_ioctl
unless ifp is IFF_UP.


To generate a diff of this commit:
cvs rdiff -u -r1.258 -r1.259 src/sys/net/if.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.258 src/sys/net/if.c:1.259
--- src/sys/net/if.c:1.258	Sun Nov 27 14:55:57 2011
+++ src/sys/net/if.c	Wed Dec 28 02:14:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.258 2011/11/27 14:55:57 jakllsch Exp $	*/
+/*	$NetBSD: if.c,v 1.259 2011/12/28 02:14:57 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.258 2011/11/27 14:55:57 jakllsch Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.259 2011/12/28 02:14:57 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -1415,10 +1415,9 @@ int
 ifpromisc(struct ifnet *ifp, int pswitch)
 {
 	int pcount, ret;
-	short flags, nflags;
+	short nflags;
 
 	pcount = ifp-if_pcount;
-	flags = ifp-if_flags;
 	if (pswitch) {
 		/*
 		 * Allow the device to be placed into promiscuous
@@ -1428,20 +1427,10 @@ ifpromisc(struct ifnet *ifp, int pswitch
 		if (ifp-if_pcount++ != 0)
 			return 0;
 		nflags = ifp-if_flags | IFF_PROMISC;
-		if ((nflags  IFF_UP) == 0)
-			return 0;
 	} else {
 		if (--ifp-if_pcount  0)
 			return 0;
 		nflags = ifp-if_flags  ~IFF_PROMISC;
-		/*
-		 * If the device is not configured up, we should not need to
-		 * turn off promiscuous mode (device should have turned it
-		 * off when interface went down; and will look at IFF_PROMISC
-		 * again next time interface comes up).
-		 */
-		if ((nflags  IFF_UP) == 0)
-			return 0;
 	}
 	ret = if_flags_set(ifp, nflags);
 	/* Restore interface state if not successful. */
@@ -2160,15 +2149,24 @@ if_flags_set(ifnet_t *ifp, const short f
 	if (ifp-if_setflags != NULL)
 		rc = (*ifp-if_setflags)(ifp, flags);
 	else {
-		short cantflags;
+		short cantflags, chgdflags;
 		struct ifreq ifr;
 
-		memset(ifr, 0, sizeof(ifr));
+		chgdflags = ifp-if_flags ^ flags;
+		cantflags = chgdflags  IFF_CANTCHANGE;
 
-		cantflags = (ifp-if_flags ^ flags)  IFF_CANTCHANGE;
 		if (cantflags != 0)
 			ifp-if_flags ^= cantflags;
 
+/* Traditionally, we do not call if_ioctl after
+ * setting/clearing only IFF_PROMISC if the interface
+ * isn't IFF_UP.  Uphold that tradition.
+		 */
+		if (chgdflags == IFF_PROMISC  (ifp-if_flags  IFF_UP) == 0)
+			return 0;
+
+		memset(ifr, 0, sizeof(ifr));
+
 		ifr.ifr_flags = flags  ~IFF_CANTCHANGE;
 		rc = (*ifp-if_ioctl)(ifp, SIOCSIFFLAGS, ifr);
 



CVS commit: src/sys/dev/pci

2011-12-20 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Dec 20 21:27:29 UTC 2011

Modified Files:
src/sys/dev/pci: if_wmreg.h

Log Message:
Mark all of the Rx descriptor fields 'volatile' so that the compiler
will not re-order accesses.  Some versions of GCC (such as one in NetBSD
5.x) definitely do re-order reads from these fields if they're not
marked volatile.


To generate a diff of this commit:
cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/if_wmreg.h

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

Modified files:

Index: src/sys/dev/pci/if_wmreg.h
diff -u src/sys/dev/pci/if_wmreg.h:1.45 src/sys/dev/pci/if_wmreg.h:1.46
--- src/sys/dev/pci/if_wmreg.h:1.45	Fri May 20 01:51:36 2011
+++ src/sys/dev/pci/if_wmreg.h	Tue Dec 20 21:27:29 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_wmreg.h,v 1.45 2011/05/20 01:51:36 msaitoh Exp $	*/
+/*	$NetBSD: if_wmreg.h,v 1.46 2011/12/20 21:27:29 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2001 Wasabi Systems, Inc.
@@ -57,14 +57,14 @@ typedef struct wiseman_addr {
  * and there must be an even multiple of 8 descriptors in the ring.
  */
 typedef struct wiseman_rxdesc {
-	wiseman_addr_t	wrx_addr;	/* buffer address */
+	volatile wiseman_addr_t	wrx_addr;	/* buffer address */
 
-	uint16_t	wrx_len;	/* buffer length */
-	uint16_t	wrx_cksum;	/* checksum (starting at PCSS) */
+	volatile uint16_t	wrx_len;	/* buffer length */
+	volatile uint16_t	wrx_cksum;	/* checksum (starting at PCSS)*/
 
-	uint8_t		wrx_status;	/* Rx status */
-	uint8_t		wrx_errors;	/* Rx errors */
-	uint16_t	wrx_special;	/* special field (VLAN, etc.) */
+	volatile uint8_t	wrx_status;	/* Rx status */
+	volatile uint8_t	wrx_errors;	/* Rx errors */
+	volatile uint16_t	wrx_special;	/* special field (VLAN, etc.) */
 } __packed wiseman_rxdesc_t;
 
 /* wrx_status bits */



CVS commit: src/sys/net

2011-11-15 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Nov 16 06:09:37 UTC 2011

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

Log Message:
Before freeing an ifnet_lock, destroy its mutex.  Should help with
kern/43294.


To generate a diff of this commit:
cvs rdiff -u -r1.256 -r1.257 src/sys/net/if.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.256 src/sys/net/if.c:1.257
--- src/sys/net/if.c:1.256	Fri Oct 28 20:11:58 2011
+++ src/sys/net/if.c	Wed Nov 16 06:09:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.256 2011/10/28 20:11:58 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.257 2011/11/16 06:09:37 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.256 2011/10/28 20:11:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.257 2011/11/16 06:09:37 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -1954,6 +1954,7 @@ ifioctl_detach(struct ifnet *ifp)
 	ifp-if_ioctl_lock = NULL;
 	percpu_free(il-il_nenter, sizeof(uint64_t));
 	il-il_nenter = NULL;
+	mutex_destroy(il-il_lock);
 	kmem_free(il, sizeof(*il));
 }
 



CVS commit: src/sys/net

2011-11-01 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Nov  2 01:17:59 UTC 2011

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

Log Message:
For simplicity's sake, use pcq(9) instead of my own circular-queue
implementation.  Saves 45 lines of code.


To generate a diff of this commit:
cvs rdiff -u -r1.148 -r1.149 src/sys/net/if_gre.c
cvs rdiff -u -r1.40 -r1.41 src/sys/net/if_gre.h

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

Modified files:

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.148 src/sys/net/if_gre.c:1.149
--- src/sys/net/if_gre.c:1.148	Fri Oct 28 16:42:52 2011
+++ src/sys/net/if_gre.c	Wed Nov  2 01:17:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.148 2011/10/28 16:42:52 dyoung Exp $ */
+/*	$NetBSD: if_gre.c,v 1.149 2011/11/02 01:17:59 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.148 2011/10/28 16:42:52 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.149 2011/11/02 01:17:59 dyoung Exp $);
 
 #include opt_atalk.h
 #include opt_gre.h
@@ -136,7 +136,6 @@ int gre_debug = 0;
 #endif /* GRE_DEBUG */
 
 int ip_gre_ttl = GRE_TTL;
-MALLOC_DEFINE(M_GRE_BUFQ, gre_bufq, gre mbuf queue);
 
 static int gre_clone_create(struct if_clone *, int);
 static int gre_clone_destroy(struct ifnet *);
@@ -163,60 +162,18 @@ static bool gre_fp_send(struct gre_softc
 static bool gre_fp_recv(struct gre_softc *);
 static void gre_fp_recvloop(void *);
 
-static int
-nearest_pow2(size_t len0)
-{
-	size_t len, mid;
-
-	if (len0 == 0)
-		return 1;
-
-	for (len = len0; (len  (len - 1)) != 0; len = len - 1)
-		;
-
-	mid = len | (len  1);
-
-	/* avoid overflow */
-	if ((len  1)  len)
-		return len;
-	if (len0 = mid)
-		return len  1;
-	return len;
-}
-
-static struct gre_bufq *
+static void
 gre_bufq_init(struct gre_bufq *bq, size_t len0)
 {
-	size_t len;
-
-	len = nearest_pow2(len0);
-
 	memset(bq, 0, sizeof(*bq));
-	bq-bq_buf = malloc(len * sizeof(struct mbuf *), M_GRE_BUFQ, M_WAITOK);
-	bq-bq_len = len;
-	bq-bq_lenmask = len - 1;
-
-	return bq;
-}
-
-static bool
-gre_bufq_empty(struct gre_bufq *bq)
-{
-	return bq-bq_prodidx == bq-bq_considx;
+	bq-bq_q = pcq_create(len0, KM_SLEEP);
+	KASSERT(bq-bq_q != NULL);
 }
 
 static struct mbuf *
 gre_bufq_dequeue(struct gre_bufq *bq)
 {
-	struct mbuf *m;
-
-	if (gre_bufq_empty(bq))
-		return NULL;
-
-	m = bq-bq_buf[bq-bq_considx];
-	bq-bq_considx = (bq-bq_considx + 1)  bq-bq_lenmask;
-
-	return m;
+	return pcq_get(bq-bq_q);
 }
 
 static void
@@ -228,20 +185,22 @@ gre_bufq_purge(struct gre_bufq *bq)
 		m_freem(m);
 }
 
+static void
+gre_bufq_destroy(struct gre_bufq *bq)
+{
+	gre_bufq_purge(bq);
+	pcq_destroy(bq-bq_q);
+}
+
 static int
 gre_bufq_enqueue(struct gre_bufq *bq, struct mbuf *m)
 {
-	int next;
-
-	next = (bq-bq_prodidx + 1)  bq-bq_lenmask;
+	KASSERT(bq-bq_q != NULL);
 
-	if (next == bq-bq_considx) {
+	if (!pcq_put(bq-bq_q, m)) {
 		bq-bq_drops++;
 		return ENOBUFS;
 	}
-
-	bq-bq_buf[bq-bq_prodidx] = m;
-	bq-bq_prodidx = next;
 	return 0;
 }
 
@@ -385,6 +344,7 @@ gre_clone_destroy(struct ifnet *ifp)
 	cv_destroy(sc-sc_condvar);
 	cv_destroy(sc-sc_fp_condvar);
 	mutex_destroy(sc-sc_mtx);
+	gre_bufq_destroy(sc-sc_snd);
 	gre_evcnt_detach(sc);
 	free(sc, M_DEVBUF);
 

Index: src/sys/net/if_gre.h
diff -u src/sys/net/if_gre.h:1.40 src/sys/net/if_gre.h:1.41
--- src/sys/net/if_gre.h:1.40	Tue Jun  1 22:13:30 2010
+++ src/sys/net/if_gre.h	Wed Nov  2 01:17:59 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.h,v 1.40 2010/06/01 22:13:30 mjf Exp $ */
+/*	$NetBSD: if_gre.h,v 1.41 2011/11/02 01:17:59 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -44,6 +44,7 @@
 #include sys/condvar.h
 #include sys/malloc.h
 #include sys/mallocvar.h
+#include sys/pcq.h
 
 #ifdef _KERNEL
 struct gre_soparm {
@@ -64,16 +65,10 @@ enum gre_state {
 };
 
 struct gre_bufq {
-	volatile int	bq_prodidx;
-	volatile int	bq_considx;
-	size_t		bq_len __aligned(CACHE_LINE_SIZE);
-	size_t		bq_lenmask;
+	pcq_t		*bq_q;
 	volatile int	bq_drops;
-	struct mbuf	**bq_buf;
 };
 
-MALLOC_DECLARE(M_GRE_BUFQ);
-
 enum gre_msg {
 	  GRE_M_NONE = 0
 	, GRE_M_SETFP



CVS commit: src/sys/net

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 16:10:12 UTC 2011

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

Log Message:
kauth isn't used in here, so don't #include sys/kauth.h.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/net/if_etherip.c

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

Modified files:

Index: src/sys/net/if_etherip.c
diff -u src/sys/net/if_etherip.c:1.30 src/sys/net/if_etherip.c:1.31
--- src/sys/net/if_etherip.c:1.30	Wed May 19 20:41:59 2010
+++ src/sys/net/if_etherip.c	Fri Oct 28 16:10:12 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: if_etherip.c,v 1.30 2010/05/19 20:41:59 christos Exp $*/
+/*  $NetBSD: if_etherip.c,v 1.31 2011/10/28 16:10:12 dyoung Exp $*/
 
 /*
  *  Copyright (c) 2006, Hans Rosenfeld rosenf...@grumpf.hope-2000.org
@@ -86,7 +86,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_etherip.c,v 1.30 2010/05/19 20:41:59 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_etherip.c,v 1.31 2011/10/28 16:10:12 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -100,7 +100,6 @@ __KERNEL_RCSID(0, $NetBSD: if_etherip.c
 #include sys/time.h
 #include sys/sysctl.h
 #include sys/queue.h
-#include sys/kauth.h
 #include sys/socket.h
 #include sys/socketvar.h
 #include sys/intr.h



CVS commit: src/sys/net

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 16:42:52 UTC 2011

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

Log Message:
Don't kauth-orize SIOCDIFPHYADDR, SIOCSIFFLAGS, SIOCSIFMTU, or
SIOCSLIFPHYADDR, in gif_ioctl() or in gre_ioctl(), because those
operations are ordinarily kauth-orized already in ifioctl().

Kauth-orizing SIOCSIFFLAGS in gre_ioctl() caused a panic (panic:
bpf_detachd: ifpromisc failed: 1) when tcpdump(8) was interrupted.
Somehow bpf(4) enables promiscuous mode using different credentials than
it uses to disable promiscuous mode, hence the ifpromisc failure.  This
may have something to do with privilege-separation in tcpdump(8).  I.e.,
an LWP with SIOCSIFFLAGS privilege opens /dev/bpf, but an LWP without
SIOCSIFFLAGS privilege closes it.


To generate a diff of this commit:
cvs rdiff -u -r1.79 -r1.80 src/sys/net/if_gif.c
cvs rdiff -u -r1.147 -r1.148 src/sys/net/if_gre.c

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

Modified files:

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.79 src/sys/net/if_gif.c:1.80
--- src/sys/net/if_gif.c:1.79	Thu Oct 27 20:04:57 2011
+++ src/sys/net/if_gif.c	Fri Oct 28 16:42:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.80 2011/10/28 16:42:52 dyoung Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gif.c,v 1.80 2011/10/28 16:42:52 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_iso.h
@@ -48,7 +48,6 @@ __KERNEL_RCSID(0, $NetBSD: if_gif.c,v 1
 #include sys/syslog.h
 #include sys/proc.h
 #include sys/protosw.h
-#include sys/kauth.h
 #include sys/cpu.h
 #include sys/intr.h
 
@@ -470,29 +469,12 @@ gif_input(struct mbuf *m, int af, struct
 int
 gif_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-	struct lwp *l = curlwp;	/* XXX */
 	struct gif_softc *sc  = ifp-if_softc;
 	struct ifreq *ifr = (struct ifreq*)data;
 	int error = 0, size;
 	struct sockaddr *dst, *src;
 
 	switch (cmd) {
-	case SIOCSIFMTU:
-	case SIOCSLIFPHYADDR:
-#ifdef SIOCDIFPHYADDR
-	case SIOCDIFPHYADDR:
-#endif
-		if ((error = kauth_authorize_network(l-l_cred,
-		KAUTH_NETWORK_INTERFACE,
-		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,
-		NULL)) != 0)
-			return (error);
-		/* FALLTHROUGH */
-	default:
-		break;
-	}
-
-	switch (cmd) {
 	case SIOCINITIFADDR:
 		ifp-if_flags |= IFF_UP;
 		break;

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.147 src/sys/net/if_gre.c:1.148
--- src/sys/net/if_gre.c:1.147	Thu Oct 27 20:04:57 2011
+++ src/sys/net/if_gre.c	Fri Oct 28 16:42:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $ */
+/*	$NetBSD: if_gre.c,v 1.148 2011/10/28 16:42:52 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.148 2011/10/28 16:42:52 dyoung Exp $);
 
 #include opt_atalk.h
 #include opt_gre.h
@@ -1234,15 +1234,11 @@ gre_ioctl(struct ifnet *ifp, const u_lon
 	GRE_DPRINTF(sc, cmd %lu\n, cmd);
 
 	switch (cmd) {
-	case SIOCSIFFLAGS:
-	case SIOCSIFMTU:
 	case GRESPROTO:
 	case GRESADDRD:
 	case GRESADDRS:
 	case GRESSOCK:
 	case GREDSOCK:
-	case SIOCSLIFPHYADDR:
-	case SIOCDIFPHYADDR:
 		if (kauth_authorize_network(curlwp-l_cred,
 		KAUTH_NETWORK_INTERFACE,
 		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, (void *)cmd,



CVS commit: src/sys/net

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 20:11:59 UTC 2011

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

Log Message:
Userland may not change the IFF_CANTCHANGE flags, however, the kernel
may, so make sure if_flags_set() takes care of them.  Fixes a regression
in ifpromisc().


To generate a diff of this commit:
cvs rdiff -u -r1.255 -r1.256 src/sys/net/if.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.255 src/sys/net/if.c:1.256
--- src/sys/net/if.c:1.255	Tue Oct 25 22:26:18 2011
+++ src/sys/net/if.c	Fri Oct 28 20:11:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.255 2011/10/25 22:26:18 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.256 2011/10/28 20:11:58 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.255 2011/10/25 22:26:18 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.256 2011/10/28 20:11:58 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -2154,14 +2154,24 @@ int
 if_flags_set(ifnet_t *ifp, const short flags)
 {
 	int rc;
-	struct ifreq ifr;
 
 	if (ifp-if_setflags != NULL)
 		rc = (*ifp-if_setflags)(ifp, flags);
 	else {
+		short cantflags;
+		struct ifreq ifr;
+
 		memset(ifr, 0, sizeof(ifr));
-		ifr.ifr_flags = flags;
+
+		cantflags = (ifp-if_flags ^ flags)  IFF_CANTCHANGE;
+		if (cantflags != 0)
+			ifp-if_flags ^= cantflags;
+
+		ifr.ifr_flags = flags  ~IFF_CANTCHANGE;
 		rc = (*ifp-if_ioctl)(ifp, SIOCSIFFLAGS, ifr);
+
+		if (rc != 0  cantflags != 0)
+			ifp-if_flags ^= cantflags;
 	}
 
 	return rc;



CVS commit: src/sys/net

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 20:13:32 UTC 2011

Modified Files:
src/sys/net: if_ppp.c if_stf.c

Log Message:
Don't kauth-orize SIOCSIFMTU in pppsioctl() and stf_ioctl(), ifioctl()
has already done that for us.


To generate a diff of this commit:
cvs rdiff -u -r1.134 -r1.135 src/sys/net/if_ppp.c
cvs rdiff -u -r1.76 -r1.77 src/sys/net/if_stf.c

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

Modified files:

Index: src/sys/net/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.134 src/sys/net/if_ppp.c:1.135
--- src/sys/net/if_ppp.c:1.134	Sun Aug  7 13:51:37 2011
+++ src/sys/net/if_ppp.c	Fri Oct 28 20:13:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.134 2011/08/07 13:51:37 rmind Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.135 2011/10/28 20:13:32 dyoung Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ppp.c,v 1.134 2011/08/07 13:51:37 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ppp.c,v 1.135 2011/10/28 20:13:32 dyoung Exp $);
 
 #include ppp.h
 
@@ -734,7 +734,6 @@ pppioctl(struct ppp_softc *sc, u_long cm
 static int
 pppsioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-struct lwp *l = curlwp;	/* XXX */
 struct ppp_softc *sc = ifp-if_softc;
 struct ifaddr *ifa = (struct ifaddr *)data;
 struct ifreq *ifr = (struct ifreq *)data;
@@ -834,12 +833,6 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
 	break;
 #endif /* PPP_COMPRESS */
 
-case SIOCSIFMTU:
-	if ((error = kauth_authorize_network(l-l_cred,
-	KAUTH_NETWORK_INTERFACE, KAUTH_REQ_NETWORK_INTERFACE_SETPRIV,
-	ifp, (void *)cmd, NULL)) != 0)
-	break;
-	/*FALLTHROUGH*/
 default:
 	if ((error = ifioctl_common(sc-sc_if, cmd, data)) == ENETRESET)
 		error = 0;

Index: src/sys/net/if_stf.c
diff -u src/sys/net/if_stf.c:1.76 src/sys/net/if_stf.c:1.77
--- src/sys/net/if_stf.c:1.76	Sun Jul 17 20:54:52 2011
+++ src/sys/net/if_stf.c	Fri Oct 28 20:13:32 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_stf.c,v 1.76 2011/07/17 20:54:52 joerg Exp $	*/
+/*	$NetBSD: if_stf.c,v 1.77 2011/10/28 20:13:32 dyoung Exp $	*/
 /*	$KAME: if_stf.c,v 1.62 2001/06/07 22:32:16 itojun Exp $ */
 
 /*
@@ -75,7 +75,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_stf.c,v 1.76 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_stf.c,v 1.77 2011/10/28 20:13:32 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -90,7 +90,6 @@ __KERNEL_RCSID(0, $NetBSD: if_stf.c,v 1
 #include sys/protosw.h
 #include sys/queue.h
 #include sys/syslog.h
-#include sys/kauth.h
 
 #include sys/cpu.h
 
@@ -661,7 +660,6 @@ stf_rtrequest(int cmd, struct rtentry *r
 static int
 stf_ioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
-	struct lwp		*l = curlwp;	/* XXX */
 	struct ifaddr		*ifa;
 	struct ifreq		*ifr = data;
 	struct sockaddr_in6	*sin6;
@@ -694,12 +692,6 @@ stf_ioctl(struct ifnet *ifp, u_long cmd,
 		break;
 
 	case SIOCSIFMTU:
-		error = kauth_authorize_network(l-l_cred,
-		KAUTH_NETWORK_INTERFACE,
-		KAUTH_REQ_NETWORK_INTERFACE_SETPRIV, ifp, KAUTH_ARG(cmd),
-		NULL);
-		if (error)
-			break;
 		if (ifr-ifr_mtu  STF_MTU_MIN || ifr-ifr_mtu  STF_MTU_MAX)
 			return EINVAL;
 		else if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET)



CVS commit: src/sys/net

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 22:08:15 UTC 2011

Modified Files:
src/sys/net: if_ppp.c if_spppsubr.c if_srt.c if_tun.c

Log Message:
For these interfaces, the implementation of SIOCSIFDSTADDR is identical
to SIOCINITIFADDR, and SIOCSIFDSTADDR callers always fall back to
SIOCINITIFADDR, so just get rid of the SIOCSIFDSTADDR case.


To generate a diff of this commit:
cvs rdiff -u -r1.135 -r1.136 src/sys/net/if_ppp.c
cvs rdiff -u -r1.122 -r1.123 src/sys/net/if_spppsubr.c
cvs rdiff -u -r1.16 -r1.17 src/sys/net/if_srt.c
cvs rdiff -u -r1.113 -r1.114 src/sys/net/if_tun.c

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

Modified files:

Index: src/sys/net/if_ppp.c
diff -u src/sys/net/if_ppp.c:1.135 src/sys/net/if_ppp.c:1.136
--- src/sys/net/if_ppp.c:1.135	Fri Oct 28 20:13:32 2011
+++ src/sys/net/if_ppp.c	Fri Oct 28 22:08:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ppp.c,v 1.135 2011/10/28 20:13:32 dyoung Exp $	*/
+/*	$NetBSD: if_ppp.c,v 1.136 2011/10/28 22:08:14 dyoung Exp $	*/
 /*	Id: if_ppp.c,v 1.6 1997/03/04 03:33:00 paulus Exp 	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ppp.c,v 1.135 2011/10/28 20:13:32 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ppp.c,v 1.136 2011/10/28 22:08:14 dyoung Exp $);
 
 #include ppp.h
 
@@ -767,22 +767,6 @@ pppsioctl(struct ifnet *ifp, u_long cmd,
 	}
 	break;
 
-case SIOCSIFDSTADDR:
-	switch (ifa-ifa_addr-sa_family) {
-#ifdef INET
-	case AF_INET:
-	break;
-#endif
-#ifdef INET6
-	case AF_INET6:
-	break;
-#endif
-	default:
-	error = EAFNOSUPPORT;
-	break;
-	}
-	break;
-
 case SIOCADDMULTI:
 case SIOCDELMULTI:
 	if (ifr == NULL) {

Index: src/sys/net/if_spppsubr.c
diff -u src/sys/net/if_spppsubr.c:1.122 src/sys/net/if_spppsubr.c:1.123
--- src/sys/net/if_spppsubr.c:1.122	Mon Sep  5 12:19:09 2011
+++ src/sys/net/if_spppsubr.c	Fri Oct 28 22:08:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $	 */
+/*	$NetBSD: if_spppsubr.c,v 1.123 2011/10/28 22:08:14 dyoung Exp $	 */
 
 /*
  * Synchronous PPP/Cisco link level subroutines.
@@ -41,7 +41,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_spppsubr.c,v 1.122 2011/09/05 12:19:09 rjs Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_spppsubr.c,v 1.123 2011/10/28 22:08:14 dyoung Exp $);
 
 #if defined(_KERNEL_OPT)
 #include opt_inet.h
@@ -1045,7 +1045,6 @@ sppp_ioctl(struct ifnet *ifp, u_long cmd
 
 	s = splnet();
 	switch (cmd) {
-	case SIOCSIFDSTADDR:
 	case SIOCINITIFADDR:
 		break;
 

Index: src/sys/net/if_srt.c
diff -u src/sys/net/if_srt.c:1.16 src/sys/net/if_srt.c:1.17
--- src/sys/net/if_srt.c:1.16	Sun Jul 17 20:54:52 2011
+++ src/sys/net/if_srt.c	Fri Oct 28 22:08:14 2011
@@ -1,8 +1,8 @@
-/* $NetBSD: if_srt.c,v 1.16 2011/07/17 20:54:52 joerg Exp $ */
+/* $NetBSD: if_srt.c,v 1.17 2011/10/28 22:08:14 dyoung Exp $ */
 /* This file is in the public domain. */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_srt.c,v 1.16 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_srt.c,v 1.17 2011/10/28 22:08:14 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -150,7 +150,6 @@ srt_if_ioctl(struct ifnet *ifp, u_long c
 	s = splnet();
 	switch (cmd) {
 	case SIOCINITIFADDR:
-	case SIOCSIFDSTADDR:
 		ifa = (void *) data;
 		switch (ifa-ifa_addr-sa_family) {
 #ifdef INET
@@ -165,7 +164,6 @@ srt_if_ioctl(struct ifnet *ifp, u_long c
 			err = EAFNOSUPPORT;
 			break;
 		}
-		/* XXX do we need to do more here for either of these? */
 		break;
 	default:
 		if ((err = ifioctl_common(ifp, cmd, data)) == ENETRESET)

Index: src/sys/net/if_tun.c
diff -u src/sys/net/if_tun.c:1.113 src/sys/net/if_tun.c:1.114
--- src/sys/net/if_tun.c:1.113	Mon Apr  5 07:22:24 2010
+++ src/sys/net/if_tun.c	Fri Oct 28 22:08:14 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_tun.c,v 1.113 2010/04/05 07:22:24 joerg Exp $	*/
+/*	$NetBSD: if_tun.c,v 1.114 2011/10/28 22:08:14 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1988, Julian Onions j...@cs.nott.ac.uk
@@ -15,7 +15,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_tun.c,v 1.113 2010/04/05 07:22:24 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_tun.c,v 1.114 2011/10/28 22:08:14 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -442,10 +442,6 @@ tun_ioctl(struct ifnet *ifp, u_long cmd,
 		tuninit(tp);
 		TUNDEBUG(%s: address set\n, ifp-if_xname);
 		break;
-	case SIOCSIFDSTADDR:
-		tuninit(tp);
-		TUNDEBUG(%s: destination address set\n, ifp-if_xname);
-		break;
 	case SIOCSIFBRDADDR:
 		TUNDEBUG(%s: broadcast address set\n, ifp-if_xname);
 		break;



CVS commit: src/sys/netinet

2011-10-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 28 22:23:54 UTC 2011

Modified Files:
src/sys/netinet: in.c

Log Message:
Remove the #if 1 / #endif around some code that appears to be
responsible deleting the 'first' AF_INET address on the interface if the
target address has family == AF_UNSPEC.


To generate a diff of this commit:
cvs rdiff -u -r1.139 -r1.140 src/sys/netinet/in.c

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

Modified files:

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.139 src/sys/netinet/in.c:1.140
--- src/sys/netinet/in.c:1.139	Wed Oct 19 01:52:22 2011
+++ src/sys/netinet/in.c	Fri Oct 28 22:23:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.139 2011/10/19 01:52:22 dyoung Exp $	*/
+/*	$NetBSD: in.c,v 1.140 2011/10/28 22:23:54 dyoung Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in.c,v 1.139 2011/10/19 01:52:22 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: in.c,v 1.140 2011/10/28 22:23:54 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_inet_conf.h
@@ -352,12 +352,10 @@ in_control(struct socket *so, u_long cmd
 		if ((cmd == SIOCDIFADDR || cmd == SIOCGIFALIAS)  ia == NULL)
 			return (EADDRNOTAVAIL);
 
-#if 1 /*def COMPAT_43*/
 		if (cmd == SIOCDIFADDR 
 		ifra-ifra_addr.sin_family == AF_UNSPEC) {
 			ifra-ifra_addr.sin_family = AF_INET;
 		}
-#endif
 		/* FALLTHROUGH */
 	case SIOCSIFADDR:
 	case SIOCSIFDSTADDR:



CVS commit: src/sys/net

2011-10-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Oct 27 20:04:57 UTC 2011

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

Log Message:
Fix gif(4)/gre(4) operation over interfaces such as wm(4) that do IPv4
checksum-offload.  Note well: it really is necessary to clear the
csum_data.

While I'm here, remove the do-nothing case for SIOCSIFDSTADDR and let
ifioctl_common() or the protocol handle it.


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/sys/net/if_gif.c
cvs rdiff -u -r1.146 -r1.147 src/sys/net/if_gre.c

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

Modified files:

Index: src/sys/net/if_gif.c
diff -u src/sys/net/if_gif.c:1.78 src/sys/net/if_gif.c:1.79
--- src/sys/net/if_gif.c:1.78	Mon Apr  5 07:22:23 2010
+++ src/sys/net/if_gif.c	Thu Oct 27 20:04:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gif.c,v 1.78 2010/04/05 07:22:23 joerg Exp $	*/
+/*	$NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $	*/
 /*	$KAME: if_gif.c,v 1.76 2001/08/20 02:01:02 kjc Exp $	*/
 
 /*
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gif.c,v 1.78 2010/04/05 07:22:23 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gif.c,v 1.79 2011/10/27 20:04:57 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_iso.h
@@ -312,6 +312,10 @@ gif_output(struct ifnet *ifp, struct mbu
 	}
 	*mtod(m, int *) = dst-sa_family;
 
+	/* Clear checksum-offload flags. */
+	m-m_pkthdr.csum_flags = 0;
+	m-m_pkthdr.csum_data = 0;
+
 	s = splnet();
 	IFQ_ENQUEUE(ifp-if_snd, m, pktattr, error);
 	if (error) {
@@ -493,9 +497,6 @@ gif_ioctl(struct ifnet *ifp, u_long cmd,
 		ifp-if_flags |= IFF_UP;
 		break;
 
-	case SIOCSIFDSTADDR:
-		break;
-
 	case SIOCADDMULTI:
 	case SIOCDELMULTI:
 		switch (ifr-ifr_addr.sa_family) {

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.146 src/sys/net/if_gre.c:1.147
--- src/sys/net/if_gre.c:1.146	Wed Oct 19 21:59:38 2011
+++ src/sys/net/if_gre.c	Thu Oct 27 20:04:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $ */
+/*	$NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.147 2011/10/27 20:04:57 dyoung Exp $);
 
 #include opt_atalk.h
 #include opt_gre.h
@@ -993,6 +993,10 @@ gre_output(struct ifnet *ifp, struct mbu
 	ifp-if_opackets++;
 	ifp-if_obytes += m-m_pkthdr.len;
 
+	/* Clear checksum-offload flags. */
+	m-m_pkthdr.csum_flags = 0;
+	m-m_pkthdr.csum_data = 0;
+
 	/* send it off */
 	if ((error = gre_bufq_enqueue(sc-sc_snd, m)) != 0) {
 		sc-sc_oflow_ev.ev_count++;
@@ -1265,8 +1269,6 @@ gre_ioctl(struct ifnet *ifp, const u_lon
 		gre_clearconf(sp, false);
 		ifp-if_flags |= IFF_UP;
 		goto mksocket;
-	case SIOCSIFDSTADDR:
-		break;
 	case SIOCSIFFLAGS:
 		if ((error = ifioctl_common(ifp, cmd, data)) != 0)
 			break;



CVS commit: src/sys/net

2011-10-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 25 22:26:18 UTC 2011

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

Log Message:
Document the ifioctl locking in comments.

Add a missing percpu_free(9) call.


To generate a diff of this commit:
cvs rdiff -u -r1.254 -r1.255 src/sys/net/if.c
cvs rdiff -u -r1.153 -r1.154 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.254 src/sys/net/if.c:1.255
--- src/sys/net/if.c:1.254	Wed Oct 19 21:29:51 2011
+++ src/sys/net/if.c	Tue Oct 25 22:26:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.254 2011/10/19 21:29:51 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.255 2011/10/25 22:26:18 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.254 2011/10/19 21:29:51 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.255 2011/10/25 22:26:18 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -297,6 +297,9 @@ int
 if_nullioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 
+	/* Wake ifioctl_detach(), who may wait for all threads to
+	 * quit the critical section.
+	 */
 	cv_signal(ifp-if_ioctl_lock-il_emptied);
 	return ENXIO;
 }
@@ -504,7 +507,8 @@ if_attach(struct ifnet *ifp)
 	TAILQ_INIT(ifp-if_addrlist);
 	TAILQ_INSERT_TAIL(ifnet, ifp, if_list);
 
-	ifioctl_attach(ifp);	/* XXX ifioctl_attach can fail! */ 
+	if (ifioctl_attach(ifp) != 0)
+		panic(%s: ifioctl_attach() failed, __func__);
 
 	mutex_enter(index_gen_mtx);
 	ifp-if_index_gen = index_gen++;
@@ -1702,6 +1706,11 @@ ifnet_lock_enter(struct ifnet_lock *il)
 {
 	uint64_t *nenter;
 
+	/* Before trying to acquire the mutex, increase the count of threads
+	 * who have entered or who wait to enter the critical section.
+	 * Avoid one costly locked memory transaction by keeping a count for
+	 * each CPU.
+	 */
 	nenter = percpu_getref(il-il_nenter);
 	(*nenter)++;
 	percpu_putref(il-il_nenter);
@@ -1711,6 +1720,9 @@ ifnet_lock_enter(struct ifnet_lock *il)
 static void
 ifnet_lock_exit(struct ifnet_lock *il)
 {
+	/* Increase the count of threads who have exited the critical
+	 * section.  Increase while we still hold the lock.
+	 */
 	il-il_nexit++;
 	mutex_exit(il-il_lock);
 }
@@ -1857,6 +1869,10 @@ ifioctl(struct socket *so, u_long cmd, v
 	return error;
 }
 
+/* This callback adds to the sum in `arg' the number of
+ * threads on `ci' who have entered or who wait to enter the
+ * critical section.
+ */
 static void
 ifnet_lock_sum(void *p, void *arg, struct cpu_info *ci)
 {
@@ -1865,6 +1881,9 @@ ifnet_lock_sum(void *p, void *arg, struc
 	*sum += *nenter;
 }
 
+/* Return the number of threads who have entered or who wait
+ * to enter the critical section on all CPUs.
+ */
 static uint64_t
 ifnet_lock_entrances(struct ifnet_lock *il)
 {
@@ -1880,9 +1899,13 @@ ifioctl_attach(struct ifnet *ifp)
 {
 	struct ifnet_lock *il;
 
+	/* If the driver has not supplied its own if_ioctl, then
+	 * supply the default.
+	 */
 	if (ifp-if_ioctl == NULL)
 		ifp-if_ioctl = ifioctl_common;
 
+	/* Create an ifnet_lock for synchronizing ifioctls. */
 	if ((il = kmem_zalloc(sizeof(*il), KM_SLEEP)) == NULL)
 		return ENOMEM;
 
@@ -1900,6 +1923,11 @@ ifioctl_attach(struct ifnet *ifp)
 	return 0;
 }
 
+/*
+ * This must not be called until after `ifp' has been withdrawn from the
+ * ifnet tables so that ifioctl() cannot get a handle on it by calling
+ * ifunit().
+ */
 static void
 ifioctl_detach(struct ifnet *ifp)
 {
@@ -1907,11 +1935,25 @@ ifioctl_detach(struct ifnet *ifp)
 
 	il = ifp-if_ioctl_lock;
 	mutex_enter(il-il_lock);
+	/* Install if_nullioctl to make sure that any thread that
+	 * subsequently enters the critical section will quit it
+	 * immediately and signal the condition variable that we
+	 * wait on, below.
+	 */
 	ifp-if_ioctl = if_nullioctl;
+	/* Sleep while threads are still in the critical section or
+	 * wait to enter it.
+	 */
 	while (ifnet_lock_entrances(il) != il-il_nexit)
 		cv_wait(il-il_emptied, il-il_lock);
+	/* At this point, we are the only thread still in the critical
+	 * section, and no new thread can get a handle on the ifioctl
+	 * lock, so it is safe to free its memory.
+	 */
 	mutex_exit(il-il_lock);
 	ifp-if_ioctl_lock = NULL;
+	percpu_free(il-il_nenter, sizeof(uint64_t));
+	il-il_nenter = NULL;
 	kmem_free(il, sizeof(*il));
 }
 

Index: src/sys/net/if.h
diff -u src/sys/net/if.h:1.153 src/sys/net/if.h:1.154
--- src/sys/net/if.h:1.153	Wed Oct 19 21:29:51 2011
+++ src/sys/net/if.h	Tue Oct 25 22:26:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.h,v 1.153 2011/10/19 21:29:51 dyoung Exp $	*/
+/*	$NetBSD: if.h,v 1.154 2011/10/25 22:26:18 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001 The NetBSD Foundation, Inc.
@@ -209,10 +209,22 @@ struct ifnet_lock;
 #include sys/percpu.h
 
 struct ifnet_lock {
-	kmutex_t il_lock;
-	uint64_t il_nexit;
-	

CVS commit: src/sys

2011-10-21 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct 21 21:35:29 UTC 2011

Modified Files:
src/sys/arch/i386/i386: mainbus.c
src/sys/dev/pci: pcivar.h ppb.c

Log Message:
Tell a pci(4) instance its subordinate PCI buses using a new member
in the pcibus_attach_args, pba_sub. pciN attaches to pba_bus itself.
If pba_bus  pba_sub, then [pba_bus + 1, pba_sub] are subordinate to
pba_bus.

On i386, make mainbus0 attach pci0 with pba_sub = 255 because all buses
1 and up must be subordinate to pci0.

XXX Deal with other architectures.


To generate a diff of this commit:
cvs rdiff -u -r1.91 -r1.92 src/sys/arch/i386/i386/mainbus.c
cvs rdiff -u -r1.95 -r1.96 src/sys/dev/pci/pcivar.h
cvs rdiff -u -r1.46 -r1.47 src/sys/dev/pci/ppb.c

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

Modified files:

Index: src/sys/arch/i386/i386/mainbus.c
diff -u src/sys/arch/i386/i386/mainbus.c:1.91 src/sys/arch/i386/i386/mainbus.c:1.92
--- src/sys/arch/i386/i386/mainbus.c:1.91	Tue May 17 17:34:50 2011
+++ src/sys/arch/i386/i386/mainbus.c	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mainbus.c,v 1.91 2011/05/17 17:34:50 dyoung Exp $	*/
+/*	$NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.91 2011/05/17 17:34:50 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: mainbus.c,v 1.92 2011/10/21 21:35:28 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -406,6 +406,7 @@ mainbus_rescan(device_t self, const char
 		mba.mba_pba.pba_pc = NULL;
 		mba.mba_pba.pba_flags = pci_bus_flags();
 		mba.mba_pba.pba_bus = 0;
+		mba.mba_pba.pba_sub = 255;
 		mba.mba_pba.pba_bridgetag = NULL;
 #if NACPICA  0  defined(ACPI_SCANPCI)
 		if (npcibus == 0  sc-sc_mpacpi_active)

Index: src/sys/dev/pci/pcivar.h
diff -u src/sys/dev/pci/pcivar.h:1.95 src/sys/dev/pci/pcivar.h:1.96
--- src/sys/dev/pci/pcivar.h:1.95	Wed Aug 24 20:27:36 2011
+++ src/sys/dev/pci/pcivar.h	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pcivar.h,v 1.95 2011/08/24 20:27:36 dyoung Exp $	*/
+/*	$NetBSD: pcivar.h,v 1.96 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 1997 Christopher G. Demetriou.  All rights reserved.
@@ -104,6 +104,14 @@ struct pcibus_attach_args {
 	int		pba_flags;	/* flags; see below */
 
 	int		pba_bus;	/* PCI bus number */
+	int		pba_sub;	/* pba_bus = pba_sub: no
+	 * buses are subordinate to
+	 * pba_bus.
+	 *
+	 * pba_bus  pba_sub: buses
+	 * [pba_bus + 1, pba_sub] are
+	 * subordinate to pba_bus.
+	 */
 
 	/*
 	 * Pointer to the pcitag of our parent bridge.  If there is no

Index: src/sys/dev/pci/ppb.c
diff -u src/sys/dev/pci/ppb.c:1.46 src/sys/dev/pci/ppb.c:1.47
--- src/sys/dev/pci/ppb.c:1.46	Wed Aug 17 00:59:47 2011
+++ src/sys/dev/pci/ppb.c	Fri Oct 21 21:35:28 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $	*/
+/*	$NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996, 1998 Christopher G. Demetriou.  All rights reserved.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.46 2011/08/17 00:59:47 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: ppb.c,v 1.47 2011/10/21 21:35:28 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -206,6 +206,7 @@ ppbattach(device_t parent, device_t self
 	pba.pba_pc = pc;
 	pba.pba_flags = pa-pa_flags  ~PCI_FLAGS_MRM_OKAY;
 	pba.pba_bus = PPB_BUSINFO_SECONDARY(busdata);
+	pba.pba_sub = PPB_BUSINFO_SUBORDINATE(busdata);
 	pba.pba_bridgetag = sc-sc_tag;
 	pba.pba_intrswiz = pa-pa_intrswiz;
 	pba.pba_intrtag = pa-pa_intrtag;



CVS commit: src/sys/net

2011-10-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 21:29:51 UTC 2011

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

Log Message:
Userland by pulling the ifioctl lock-related data members into a
struct ifnet_lock that the ifnet has a pointer to.  In a non-_KERNEL
environment, don't #include sys/percpu.h et cetera, and don't define
the struct ifnet_lock but *do* declare it.


To generate a diff of this commit:
cvs rdiff -u -r1.253 -r1.254 src/sys/net/if.c
cvs rdiff -u -r1.152 -r1.153 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.253 src/sys/net/if.c:1.254
--- src/sys/net/if.c:1.253	Wed Oct 19 01:46:43 2011
+++ src/sys/net/if.c	Wed Oct 19 21:29:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.253 2011/10/19 01:46:43 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.254 2011/10/19 21:29:51 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.253 2011/10/19 01:46:43 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.254 2011/10/19 21:29:51 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -112,6 +112,7 @@ __KERNEL_RCSID(0, $NetBSD: if.c,v 1.253
 #include sys/sysctl.h
 #include sys/syslog.h
 #include sys/kauth.h
+#include sys/kmem.h
 
 #include net/if.h
 #include net/if_dl.h
@@ -170,8 +171,8 @@ static kauth_listener_t if_listener;
 
 static int ifioctl_attach(struct ifnet *);
 static void ifioctl_detach(struct ifnet *);
-static void ifioctl_enter(struct ifnet *);
-static void ifioctl_exit(struct ifnet *);
+static void ifnet_lock_enter(struct ifnet_lock *);
+static void ifnet_lock_exit(struct ifnet_lock *);
 static void if_detach_queues(struct ifnet *, struct ifqueue *);
 static void sysctl_sndq_setup(struct sysctllog **, const char *,
 struct ifaltq *);
@@ -296,7 +297,7 @@ int
 if_nullioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 
-	cv_signal(ifp-if_ioctl_emptied);
+	cv_signal(ifp-if_ioctl_lock-il_emptied);
 	return ENXIO;
 }
 
@@ -1697,19 +1698,21 @@ ifaddrpref_ioctl(struct socket *so, u_lo
 }
 
 static void
-ifioctl_enter(struct ifnet *ifp)
+ifnet_lock_enter(struct ifnet_lock *il)
 {
-	uint64_t *nenter = percpu_getref(ifp-if_ioctl_nenter);
+	uint64_t *nenter;
+
+	nenter = percpu_getref(il-il_nenter);
 	(*nenter)++;
-	percpu_putref(ifp-if_ioctl_nenter);
-	mutex_enter(ifp-if_ioctl_lock);
+	percpu_putref(il-il_nenter);
+	mutex_enter(il-il_lock);
 }
 
 static void
-ifioctl_exit(struct ifnet *ifp)
+ifnet_lock_exit(struct ifnet_lock *il)
 {
-	ifp-if_ioctl_nexit++;
-	mutex_exit(ifp-if_ioctl_lock);
+	il-il_nexit++;
+	mutex_exit(il-il_lock);
 }
 
 /*
@@ -1820,7 +1823,7 @@ ifioctl(struct socket *so, u_long cmd, v
 
 	oif_flags = ifp-if_flags;
 
-	ifioctl_enter(ifp);
+	ifnet_lock_enter(ifp-if_ioctl_lock);
 	error = (*ifp-if_ioctl)(ifp, cmd, data);
 	if (error != ENOTTY)
 		;
@@ -1850,12 +1853,12 @@ ifioctl(struct socket *so, u_long cmd, v
 		ifreqn2o(oifr, ifr);
 #endif
 
-	ifioctl_exit(ifp);
+	ifnet_lock_exit(ifp-if_ioctl_lock);
 	return error;
 }
 
 static void
-ifioctl_sum(void *p, void *arg, struct cpu_info *ci)
+ifnet_lock_sum(void *p, void *arg, struct cpu_info *ci)
 {
 	uint64_t *sum = arg, *nenter = p;
 
@@ -1863,11 +1866,11 @@ ifioctl_sum(void *p, void *arg, struct c
 }
 
 static uint64_t
-ifioctl_entrances(struct ifnet *ifp)
+ifnet_lock_entrances(struct ifnet_lock *il)
 {
 	uint64_t sum = 0;
 
-	percpu_foreach(ifp-if_ioctl_nenter, ifioctl_sum, sum);
+	percpu_foreach(il-il_nenter, ifnet_lock_sum, sum);
 
 	return sum;
 }
@@ -1875,15 +1878,24 @@ ifioctl_entrances(struct ifnet *ifp)
 static int
 ifioctl_attach(struct ifnet *ifp)
 {
+	struct ifnet_lock *il;
+
 	if (ifp-if_ioctl == NULL)
 		ifp-if_ioctl = ifioctl_common;
 
-	ifp-if_ioctl_nenter = percpu_alloc(sizeof(uint64_t));
-	if (ifp-if_ioctl_nenter == NULL)
+	if ((il = kmem_zalloc(sizeof(*il), KM_SLEEP)) == NULL)
 		return ENOMEM;
 
-	mutex_init(ifp-if_ioctl_lock, MUTEX_DEFAULT, IPL_NONE);
-	cv_init(ifp-if_ioctl_emptied, ifp-if_xname);
+	il-il_nenter = percpu_alloc(sizeof(uint64_t));
+	if (il-il_nenter == NULL) {
+		kmem_free(il, sizeof(*il));
+		return ENOMEM;
+	}
+
+	mutex_init(il-il_lock, MUTEX_DEFAULT, IPL_NONE);
+	cv_init(il-il_emptied, ifp-if_xname);
+
+	ifp-if_ioctl_lock = il;
 
 	return 0;
 }
@@ -1891,11 +1903,16 @@ ifioctl_attach(struct ifnet *ifp)
 static void
 ifioctl_detach(struct ifnet *ifp)
 {
-	mutex_enter(ifp-if_ioctl_lock);
+	struct ifnet_lock *il;
+
+	il = ifp-if_ioctl_lock;
+	mutex_enter(il-il_lock);
 	ifp-if_ioctl = if_nullioctl;
-	while (ifioctl_entrances(ifp) != ifp-if_ioctl_nexit)
-		cv_wait(ifp-if_ioctl_emptied, ifp-if_ioctl_lock);
-	mutex_exit(ifp-if_ioctl_lock);
+	while (ifnet_lock_entrances(il) != il-il_nexit)
+		cv_wait(il-il_emptied, il-il_lock);
+	mutex_exit(il-il_lock);
+	ifp-if_ioctl_lock = NULL;
+	kmem_free(il, sizeof(*il));
 }
 
 /*

Index: 

CVS commit: src/sys/net

2011-10-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 21:59:38 UTC 2011

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

Log Message:
Get rid of gre's deadlock-prone, one-off ifioctl locking.  The standard
ifioctl locking will do.


To generate a diff of this commit:
cvs rdiff -u -r1.145 -r1.146 src/sys/net/if_gre.c

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

Modified files:

Index: src/sys/net/if_gre.c
diff -u src/sys/net/if_gre.c:1.145 src/sys/net/if_gre.c:1.146
--- src/sys/net/if_gre.c:1.145	Tue May 24 16:37:49 2011
+++ src/sys/net/if_gre.c	Wed Oct 19 21:59:38 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_gre.c,v 1.145 2011/05/24 16:37:49 joerg Exp $ */
+/*	$NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $ */
 
 /*
  * Copyright (c) 1998, 2008 The NetBSD Foundation, Inc.
@@ -45,7 +45,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.145 2011/05/24 16:37:49 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_gre.c,v 1.146 2011/10/19 21:59:38 dyoung Exp $);
 
 #include opt_atalk.h
 #include opt_gre.h
@@ -266,14 +266,6 @@ greintr(void *arg)
 
 /* Caller must hold sc-sc_mtx. */
 static void
-gre_wait(struct gre_softc *sc)
-{
-	sc-sc_waiters++;
-	cv_wait(sc-sc_condvar, sc-sc_mtx);
-	sc-sc_waiters--;
-}
-
-static void
 gre_fp_wait(struct gre_softc *sc)
 {
 	sc-sc_fp_waiters++;
@@ -362,7 +354,6 @@ gre_clone_create(struct if_clone *ifc, i
 	if_attach(sc-sc_if);
 	if_alloc_sadl(sc-sc_if);
 	bpf_attach(sc-sc_if, DLT_NULL, sizeof(uint32_t));
-	sc-sc_state = GRE_S_IDLE;
 	return 0;
 }
 
@@ -378,23 +369,6 @@ gre_clone_destroy(struct ifnet *ifp)
 	s = splnet();
 	if_detach(ifp);
 
-	/* Some LWPs may still wait in gre_ioctl_lock(), however,
-	 * no new LWP will enter gre_ioctl_lock(), because ifunit()
-	 * cannot locate the interface any longer.
-	 */
-	mutex_enter(sc-sc_mtx);
-	GRE_DPRINTF(sc, \n);
-	while (sc-sc_state != GRE_S_IDLE)
-		gre_wait(sc);
-	GRE_DPRINTF(sc, \n);
-	sc-sc_state = GRE_S_DIE;
-	cv_broadcast(sc-sc_condvar);
-	while (sc-sc_waiters  0)
-		cv_wait(sc-sc_condvar, sc-sc_mtx);
-	/* At this point, no other LWP will access the gre_softc, so
-	 * we can release the mutex.
-	 */
-	mutex_exit(sc-sc_mtx);
 	GRE_DPRINTF(sc, \n);
 	/* Note that we must not hold the mutex while we call gre_reconf(). */
 	gre_reconf(sc, NULL);
@@ -1242,39 +1216,6 @@ gre_clearconf(struct gre_soparm *sp, boo
 }
 
 static int
-gre_ioctl_lock(struct gre_softc *sc)
-{
-	mutex_enter(sc-sc_mtx);
-
-	while (sc-sc_state == GRE_S_IOCTL)
-		gre_wait(sc);
-
-	if (sc-sc_state != GRE_S_IDLE) {
-		cv_signal(sc-sc_condvar);
-		mutex_exit(sc-sc_mtx);
-		GRE_DPRINTF(sc, \n);
-		return ENXIO;
-	}
-
-	sc-sc_state = GRE_S_IOCTL;
-
-	mutex_exit(sc-sc_mtx);
-	return 0;
-}
-
-static void
-gre_ioctl_unlock(struct gre_softc *sc)
-{
-	mutex_enter(sc-sc_mtx);
-
-	KASSERT(sc-sc_state == GRE_S_IOCTL);
-	sc-sc_state = GRE_S_IDLE;
-	cv_signal(sc-sc_condvar);
-
-	mutex_exit(sc-sc_mtx);
-}
-
-static int
 gre_ioctl(struct ifnet *ifp, const u_long cmd, void *data)
 {
 	struct ifreq *ifr;
@@ -1308,10 +1249,6 @@ gre_ioctl(struct ifnet *ifp, const u_lon
 		break;
 	}
 
-	if ((error = gre_ioctl_lock(sc)) != 0) {
-		GRE_DPRINTF(sc, \n);
-		return error;
-	}
 	s = splnet();
 
 	sp0 = sc-sc_soparm;
@@ -1549,7 +1486,6 @@ gre_ioctl(struct ifnet *ifp, const u_lon
 out:
 	GRE_DPRINTF(sc, \n);
 	splx(s);
-	gre_ioctl_unlock(sc);
 	return error;
 }
 



CVS commit: src/sys/net

2011-10-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 22:07:10 UTC 2011

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

Log Message:
Use if_flags_set() and if_mcast_op().


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.68 src/sys/net/if_vlan.c:1.69
--- src/sys/net/if_vlan.c:1.68	Wed Oct 19 01:48:30 2011
+++ src/sys/net/if_vlan.c	Wed Oct 19 22:07:09 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.68 2011/10/19 01:48:30 dyoung Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.69 2011/10/19 22:07:09 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.68 2011/10/19 01:48:30 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.69 2011/10/19 22:07:09 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -286,11 +286,7 @@ vlan_config(struct ifvlan *ifv, struct i
 			 */
 			ec-ec_capenable |= ETHERCAP_VLAN_MTU;
 			if (p-if_flags  IFF_UP) {
-struct ifreq ifr;
-
-ifr.ifr_flags = p-if_flags;
-error = (*p-if_ioctl)(p, SIOCSIFFLAGS,
-(void *) ifr);
+error = if_flags_set(p, p-if_flags);
 if (error) {
 	if (ec-ec_nvlans-- == 1)
 		ec-ec_capenable =
@@ -382,11 +378,8 @@ vlan_unconfig(struct ifnet *ifp)
 			 */
 			ec-ec_capenable = ~ETHERCAP_VLAN_MTU;
 			if (ifv-ifv_p-if_flags  IFF_UP) {
-struct ifreq ifr;
-
-ifr.ifr_flags = ifv-ifv_p-if_flags;
-(void) (*ifv-ifv_p-if_ioctl)(ifv-ifv_p,
-SIOCSIFFLAGS, (void *) ifr);
+(void)if_flags_set(ifv-ifv_p,
+ifv-ifv_p-if_flags);
 			}
 		}
 
@@ -608,8 +601,7 @@ vlan_ether_addmulti(struct ifvlan *ifv, 
 	memcpy(mc-mc_addr, sa, sa-sa_len);
 	LIST_INSERT_HEAD(ifv-ifv_mc_listhead, mc, mc_entries);
 
-	error = (*ifv-ifv_p-if_ioctl)(ifv-ifv_p, SIOCADDMULTI,
-	(void *)ifr);
+	error = if_mcast_op(ifv-ifv_p, SIOCADDMULTI, sa);
 	if (error != 0)
 		goto ioctl_failed;
 	return (error);
@@ -644,8 +636,7 @@ vlan_ether_delmulti(struct ifvlan *ifv, 
 		return (error);
 
 	/* We no longer use this multicast address.  Tell parent so. */
-	error = (*ifv-ifv_p-if_ioctl)(ifv-ifv_p, SIOCDELMULTI,
-	(void *)ifr);
+	error = if_mcast_op(ifv-ifv_p, SIOCDELMULTI, sa);
 	if (error == 0) {
 		/* And forget about this address. */
 		for (mc = LIST_FIRST(ifv-ifv_mc_listhead); mc != NULL;
@@ -671,20 +662,10 @@ vlan_ether_purgemulti(struct ifvlan *ifv
 {
 	struct ifnet *ifp = ifv-ifv_p;		/* Parent. */
 	struct vlan_mc_entry *mc;
-	union {
-		struct ifreq ifreq;
-		struct {
-			char ifr_name[IFNAMSIZ];
-			struct sockaddr_storage ifr_ss;
-		} ifreq_storage;
-	} ifreq;
-	struct ifreq *ifr = ifreq.ifreq;
 
-	memcpy(ifr-ifr_name, ifp-if_xname, IFNAMSIZ);
 	while ((mc = LIST_FIRST(ifv-ifv_mc_listhead)) != NULL) {
-		ifreq_setaddr(SIOCDELMULTI, ifr,
+		(void)if_mcast_op(ifp, SIOCDELMULTI,
 		(const struct sockaddr *)mc-mc_addr);
-		(void)(*ifp-if_ioctl)(ifp, SIOCDELMULTI, (void *)ifr);
 		LIST_REMOVE(mc, mc_entries);
 		free(mc, M_DEVBUF);
 	}



CVS commit: src/sbin/drvctl

2011-10-19 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 22:13:46 UTC 2011

Modified Files:
src/sbin/drvctl: drvctl.c

Log Message:
Don't print the silly header, Properties for device `xxx0':, before
the device properties if the -n option was given.


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/sbin/drvctl/drvctl.c

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

Modified files:

Index: src/sbin/drvctl/drvctl.c
diff -u src/sbin/drvctl/drvctl.c:1.13 src/sbin/drvctl/drvctl.c:1.14
--- src/sbin/drvctl/drvctl.c:1.13	Mon Aug 29 14:34:59 2011
+++ src/sbin/drvctl/drvctl.c	Wed Oct 19 22:13:46 2011
@@ -1,4 +1,4 @@
-/* $NetBSD: drvctl.c,v 1.13 2011/08/29 14:34:59 joerg Exp $ */
+/* $NetBSD: drvctl.c,v 1.14 2011/10/19 22:13:46 dyoung Exp $ */
 
 /*
  * Copyright (c) 2004
@@ -200,8 +200,11 @@ main(int argc, char **argv)
 
 		if (argc == 1) {
 			xml = prop_dictionary_externalize(data_dict);
-			printf(Properties for device `%s':\n%s,
-			   argv[0], xml);
+			if (!nflag) {
+printf(Properties for device `%s':\n,
+argv[0]);
+			}
+			printf(%s, xml);
 			free(xml);
 		} else {
 			for (i = 1; i  argc; i++)



CVS commit: src/sys/dev/pci

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 18 23:04:35 UTC 2011

Modified Files:
src/sys/dev/pci: if_ath_pci.c

Log Message:
Reduce differences from if_ath_cardbus.c.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/pci/if_ath_pci.c

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

Modified files:

Index: src/sys/dev/pci/if_ath_pci.c
diff -u src/sys/dev/pci/if_ath_pci.c:1.44 src/sys/dev/pci/if_ath_pci.c:1.45
--- src/sys/dev/pci/if_ath_pci.c:1.44	Fri Oct  7 20:47:42 2011
+++ src/sys/dev/pci/if_ath_pci.c	Tue Oct 18 23:04:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_pci.c,v 1.44 2011/10/07 20:47:42 dyoung Exp $	*/
+/*	$NetBSD: if_ath_pci.c,v 1.45 2011/10/18 23:04:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -35,9 +35,35 @@
  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
  * THE POSSIBILITY OF SUCH DAMAGES.
  */
+/*
+ * Copyright (c) 2003
+ *	Ichiro FUKUHARA ich...@ichiro.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 ICHIRO FUKUHARA ``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 ICHIRO FUKUHARA OR THE VOICES IN HIS HEAD BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.44 2011/10/07 20:47:42 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.45 2011/10/18 23:04:35 dyoung Exp $);
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.



CVS commit: src/sys/arch

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 18 23:25:20 UTC 2011

Modified Files:
src/sys/arch/x86/x86: x86_stub.c
Added Files:
src/sys/arch/amd64/include: autoconf.h
src/sys/arch/i386/include: autoconf.h
src/sys/arch/x86/include: autoconf.h

Log Message:
Define some optional routines that will help device_register() to
register ISA  PCI devices.  Add stub implementations of the routines.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.3 src/sys/arch/amd64/include/autoconf.h
cvs rdiff -u -r0 -r1.3 src/sys/arch/i386/include/autoconf.h
cvs rdiff -u -r0 -r1.3 src/sys/arch/x86/include/autoconf.h
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/x86/x86_stub.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_stub.c
diff -u src/sys/arch/x86/x86/x86_stub.c:1.1 src/sys/arch/x86/x86/x86_stub.c:1.2
--- src/sys/arch/x86/x86/x86_stub.c:1.1	Sun Apr  3 22:29:27 2011
+++ src/sys/arch/x86/x86/x86_stub.c	Tue Oct 18 23:25:20 2011
@@ -1,13 +1,16 @@
-/* $NetBSD: x86_stub.c,v 1.1 2011/04/03 22:29:27 dyoung Exp $ */
+/* $NetBSD: x86_stub.c,v 1.2 2011/10/18 23:25:20 dyoung Exp $ */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.1 2011/04/03 22:29:27 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.2 2011/10/18 23:25:20 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kgdb.h
 
+#include machine/autoconf.h
+
 int x86_nullop(void);
+void *x86_zeroop(void);
 void x86_voidop(void);
 
 void
@@ -21,8 +24,17 @@ x86_nullop(void)
 	return 0;
 }
 
-__weak_alias(kdb_trap, x86_nullop);
-__weak_alias(kgdb_disconnected, x86_nullop);
-__weak_alias(kgdb_trap, x86_nullop);
+void *
+x86_zeroop(void)
+{
+	return NULL;
+}
+
+__weak_alias(device_pci_props_register, x86_voidop);
+__weak_alias(device_pci_register, x86_nullop);
+__weak_alias(device_isa_register, x86_nullop);
+__weak_alias(kdb_trap, x86_zeroop);
+__weak_alias(kgdb_disconnected, x86_zeroop);
+__weak_alias(kgdb_trap, x86_zeroop);
 __weak_alias(mca_nmi, x86_voidop);
 __weak_alias(x86_nmi, x86_voidop);

Added files:

Index: src/sys/arch/amd64/include/autoconf.h
diff -u /dev/null src/sys/arch/amd64/include/autoconf.h:1.3
--- /dev/null	Tue Oct 18 23:25:21 2011
+++ src/sys/arch/amd64/include/autoconf.h	Tue Oct 18 23:25:20 2011
@@ -0,0 +1,3 @@
+/*	$NetBSD: autoconf.h,v 1.3 2011/10/18 23:25:20 dyoung Exp $	*/
+
+#include x86/autoconf.h

Index: src/sys/arch/i386/include/autoconf.h
diff -u /dev/null src/sys/arch/i386/include/autoconf.h:1.3
--- /dev/null	Tue Oct 18 23:25:21 2011
+++ src/sys/arch/i386/include/autoconf.h	Tue Oct 18 23:25:20 2011
@@ -0,0 +1,3 @@
+/*	$NetBSD: autoconf.h,v 1.3 2011/10/18 23:25:20 dyoung Exp $	*/
+
+#include x86/autoconf.h

Index: src/sys/arch/x86/include/autoconf.h
diff -u /dev/null src/sys/arch/x86/include/autoconf.h:1.3
--- /dev/null	Tue Oct 18 23:25:21 2011
+++ src/sys/arch/x86/include/autoconf.h	Tue Oct 18 23:25:20 2011
@@ -0,0 +1,11 @@
+/* $NetBSD: autoconf.h,v 1.3 2011/10/18 23:25:20 dyoung Exp $ */
+#ifndef _X86_AUTOCONF_H_
+#define _X86_AUTOCONF_H_
+
+#include sys/device.h
+
+void device_pci_props_register(device_t, void *);
+device_t device_pci_register(device_t, void *);
+device_t device_isa_register(device_t, void *);
+
+#endif /* _X86_AUTOCONF_H_ */



CVS commit: src/sys/arch/x86/pci

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 18 23:30:54 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_ranges.c

Log Message:
Add an implementation of device_pci_props_register().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/pci/pci_ranges.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_ranges.c
diff -u src/sys/arch/x86/pci/pci_ranges.c:1.2 src/sys/arch/x86/pci/pci_ranges.c:1.3
--- src/sys/arch/x86/pci/pci_ranges.c:1.2	Tue Sep 13 18:09:52 2011
+++ src/sys/arch/x86/pci/pci_ranges.c	Tue Oct 18 23:30:54 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_ranges.c,v 1.2 2011/09/13 18:09:52 dyoung Exp $	*/
+/*	$NetBSD: pci_ranges.c,v 1.3 2011/10/18 23:30:54 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_ranges.c,v 1.2 2011/09/13 18:09:52 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_ranges.c,v 1.3 2011/10/18 23:30:54 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -47,6 +47,8 @@ __KERNEL_RCSID(0, $NetBSD: pci_ranges.c
 #include dev/pci/pcireg.h
 #include dev/pci/pccbbreg.h
 
+#include machine/autoconf.h
+
 typedef enum pci_alloc_regtype {
 	  PCI_ALLOC_REGTYPE_NONE = 0
 	, PCI_ALLOC_REGTYPE_BAR = 1
@@ -956,3 +958,63 @@ pci_ranges_infer(pci_chipset_tag_t pc, i
 		prop_object_release(memdict);
 	/* XXX release iorsvns, memrsvns */
 }
+
+static bool
+pcibus_rsvn_predicate(void *arg, prop_dictionary_t rsvn)
+{
+	struct pcibus_attach_args *pba = arg;
+	uint8_t bus;
+
+	if (!prop_dictionary_get_uint8(rsvn, bus, bus))
+		return false;
+
+	return pba-pba_bus = bus  bus = pba-pba_sub;
+}
+
+static bool
+pci_rsvn_predicate(void *arg, prop_dictionary_t rsvn)
+{
+	struct pci_attach_args *pa = arg;
+	uint8_t bus, device, function;
+	bool rc;
+
+	rc = prop_dictionary_get_uint8(rsvn, bus, bus) 
+	prop_dictionary_get_uint8(rsvn, device, device) 
+	prop_dictionary_get_uint8(rsvn, function, function);
+
+	if (!rc)
+		return false;
+
+	return pa-pa_bus == bus  pa-pa_device == device 
+	pa-pa_function == function;
+}
+
+void
+device_pci_props_register(device_t dev, void *aux)
+{
+	cfdata_t cf;
+	prop_dictionary_t dict;
+
+	cf = (device_parent(dev) != NULL) ? device_cfdata(dev) : NULL;
+#if 0
+	aprint_normal_dev(dev, is%s a pci, parent %p, cf %p, ifattr %s\n,
+	device_is_a(dev, pci) ?  :  not,
+	(const void *)device_parent(dev),
+	cf,
+	cf != NULL ? cfdata_ifattr(cf) : );
+#endif
+	if (pci_rsrc_dict == NULL)
+		return;
+
+	if (!device_is_a(dev, pci) 
+	(cf == NULL || strcmp(cfdata_ifattr(cf), pci) != 0))
+		return;
+
+	dict = pci_rsrc_filter(pci_rsrc_dict,
+	device_is_a(dev, pci) ? pcibus_rsvn_predicate
+: pci_rsvn_predicate, aux);
+	if (dict == NULL)
+		return;
+	(void)prop_dictionary_set(device_properties(dev),
+	pci-resources, dict);
+}



CVS commit: src/sys/arch/x86/x86

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 18 23:41:45 UTC 2011

Modified Files:
src/sys/arch/x86/x86: x86_stub.c

Log Message:
Use the right return types for x86_nullop() and x86_zeroop().


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/sys/arch/x86/x86/x86_stub.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_stub.c
diff -u src/sys/arch/x86/x86/x86_stub.c:1.2 src/sys/arch/x86/x86/x86_stub.c:1.3
--- src/sys/arch/x86/x86/x86_stub.c:1.2	Tue Oct 18 23:25:20 2011
+++ src/sys/arch/x86/x86/x86_stub.c	Tue Oct 18 23:41:45 2011
@@ -1,7 +1,7 @@
-/* $NetBSD: x86_stub.c,v 1.2 2011/10/18 23:25:20 dyoung Exp $ */
+/* $NetBSD: x86_stub.c,v 1.3 2011/10/18 23:41:45 dyoung Exp $ */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.2 2011/10/18 23:25:20 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.3 2011/10/18 23:41:45 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -9,8 +9,8 @@ __KERNEL_RCSID(0, $NetBSD: x86_stub.c,v
 
 #include machine/autoconf.h
 
-int x86_nullop(void);
-void *x86_zeroop(void);
+int x86_zeroop(void);
+void *x86_nullop(void);
 void x86_voidop(void);
 
 void
@@ -18,16 +18,16 @@ x86_voidop(void)
 {
 }
 
-int
+void *
 x86_nullop(void)
 {
-	return 0;
+	return NULL;
 }
 
-void *
+int
 x86_zeroop(void)
 {
-	return NULL;
+	return 0;
 }
 
 __weak_alias(device_pci_props_register, x86_voidop);



CVS commit: src/sys/arch/x86

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Oct 18 23:43:36 UTC 2011

Modified Files:
src/sys/arch/x86/isa: isa_machdep.c
src/sys/arch/x86/pci: pci_machdep.c
src/sys/arch/x86/x86: x86_autoconf.c

Log Message:
Factor device_isa_register() and device_pci_register() out of
device_register() and stick the new routines into isa_machdep.c and
pci_machdep.c, respectively.


To generate a diff of this commit:
cvs rdiff -u -r1.30 -r1.31 src/sys/arch/x86/isa/isa_machdep.c
cvs rdiff -u -r1.51 -r1.52 src/sys/arch/x86/pci/pci_machdep.c
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x86/x86/x86_autoconf.c

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

Modified files:

Index: src/sys/arch/x86/isa/isa_machdep.c
diff -u src/sys/arch/x86/isa/isa_machdep.c:1.30 src/sys/arch/x86/isa/isa_machdep.c:1.31
--- src/sys/arch/x86/isa/isa_machdep.c:1.30	Thu Sep  1 15:10:31 2011
+++ src/sys/arch/x86/isa/isa_machdep.c	Tue Oct 18 23:43:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: isa_machdep.c,v 1.30 2011/09/01 15:10:31 christos Exp $	*/
+/*	$NetBSD: isa_machdep.c,v 1.31 2011/10/18 23:43:36 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -65,7 +65,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: isa_machdep.c,v 1.30 2011/09/01 15:10:31 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: isa_machdep.c,v 1.31 2011/10/18 23:43:36 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -80,12 +80,16 @@ __KERNEL_RCSID(0, $NetBSD: isa_machdep.
 #include machine/bus_private.h
 #include machine/pio.h
 #include machine/cpufunc.h
+#include machine/autoconf.h
+#include machine/bootinfo.h
 
 #include dev/isa/isareg.h
 #include dev/isa/isavar.h
 
 #include uvm/uvm_extern.h
 
+#include acpica.h
+#include opt_acpi.h
 #include ioapic.h
 
 #if NIOAPIC  0
@@ -335,3 +339,48 @@ _isa_dma_may_bounce(bus_dma_tag_t t, bus
 		*cookieflagsp |= X86_DMA_MIGHT_NEED_BOUNCE;
 	return 0;
 }
+
+device_t
+device_isa_register(device_t dev, void *aux)
+{
+
+	/*
+	 * Handle network interfaces here, the attachment information is
+	 * not available driver-independently later.
+	 *
+	 * For disks, there is nothing useful available at attach time.
+	 */
+	if (device_class(dev) == DV_IFNET) {
+		struct btinfo_netif *bin = lookup_bootinfo(BTINFO_NETIF);
+		if (bin == NULL)
+			return NULL;
+
+		/*
+		 * We don't check the driver name against the device name
+		 * passed by the boot ROM.  The ROM should stay usable if
+		 * the driver becomes obsolete.  The physical attachment
+		 * information (checked below) must be sufficient to
+		 * idenfity the device.
+		 */
+		if (bin-bus == BI_BUS_ISA 
+		device_is_a(device_parent(dev), isa)) {
+			struct isa_attach_args *iaa = aux;
+
+			/* Compare IO base address */
+			/* XXXJRT What about multiple IO addrs? */
+			if (iaa-ia_nio  0 
+			bin-addr.iobase == iaa-ia_io[0].ir_addr)
+				return dev;
+		}
+	}
+#if NACPICA  0
+#if notyet
+	if (device_is_a(dev, isa)  acpi_active) {
+		if (!(AcpiGbl_FADT.BootFlags  ACPI_FADT_LEGACY_DEVICES))
+			prop_dictionary_set_bool(device_properties(dev),
+			no-legacy-devices, true);
+	}
+#endif
+#endif /* NACPICA  0 */
+	return NULL;
+}

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.51 src/sys/arch/x86/pci/pci_machdep.c:1.52
--- src/sys/arch/x86/pci/pci_machdep.c:1.51	Tue Sep 13 17:58:42 2011
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Oct 18 23:43:36 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.51 2011/09/13 17:58:42 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.52 2011/10/18 23:43:36 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.51 2011/09/13 17:58:42 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.52 2011/10/18 23:43:36 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -98,10 +98,34 @@ __KERNEL_RCSID(0, $NetBSD: pci_machdep.
 #include dev/pci/pcireg.h
 #include dev/pci/pccbbreg.h
 #include dev/pci/pcidevs.h
+#include dev/pci/genfb_pcivar.h
+
+#include dev/wsfb/genfbvar.h
+#include arch/x86/include/genfb_machdep.h
+#include dev/ic/vgareg.h
 
 #include acpica.h
-#include opt_mpbios.h
+#include genfb.h
+#include isa.h
 #include opt_acpi.h
+#include opt_ddb.h
+#include opt_mpbios.h
+#include opt_vga.h
+#include pci.h
+#include wsdisplay.h
+
+#ifdef DDB
+#include machine/db_machdep.h
+#include ddb/db_sym.h
+#include ddb/db_extern.h
+#endif
+
+#ifdef VGA_POST
+#include x86/vga_post.h
+#endif
+
+#include machine/autoconf.h
+#include machine/bootinfo.h
 
 #ifdef MPBIOS
 #include machine/mpbiosvar.h
@@ -221,6 +245,18 @@ static struct pci_conf_lock cl0 = {
 
 static struct pci_conf_lock * const cl = cl0;
 
+#if NGENFB  0  NACPICA  0  defined(VGA_POST)
+extern int acpi_md_vbios_reset;
+extern int acpi_md_vesa_modenum;
+#endif
+
+static struct 

CVS commit: src/sys/net

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:34:37 UTC 2011

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

Log Message:
Start to untangle the ifnet ioctls mess.

Add ifnet functions, if_mcast_op(), if_flags_set(), and if_addr_init()
for adding/deleting multicast addresses, modifying the if_flags,
and initializing local/remote addresses.  Make ifpromisc() use
if_flags_set().  Protocols and network drivers should use these
instead of ifp-if_ioctl() calls.  Subsequent commits will
replace ifp-if_ioctl(SIOCADDMULTI| SIOCDELMULTI| SIOCSIFDSTADDR|
SIOCINITIFADDR| SIOCSIFFLAGS) calls with calls to the new functions.

Use a mutex(9) to synchronize ifp-if_ioctl() calls originating in
userland.  Also synchronize ifp-if_ioctl() calls with ifnet detachment
and reclamation.


To generate a diff of this commit:
cvs rdiff -u -r1.251 -r1.252 src/sys/net/if.c
cvs rdiff -u -r1.151 -r1.152 src/sys/net/if.h

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.251 src/sys/net/if.c:1.252
--- src/sys/net/if.c:1.251	Fri Aug 12 22:09:36 2011
+++ src/sys/net/if.c	Wed Oct 19 01:34:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.251 2011/08/12 22:09:36 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.252 2011/10/19 01:34:37 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.251 2011/08/12 22:09:36 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.252 2011/10/19 01:34:37 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -168,6 +168,8 @@ struct pfil_head if_pfil;	/* packet filt
 
 static kauth_listener_t if_listener;
 
+static int ifioctl_attach(struct ifnet *);
+static void ifioctl_detach(struct ifnet *);
 static void if_detach_queues(struct ifnet *, struct ifqueue *);
 static void sysctl_sndq_setup(struct sysctllog **, const char *,
 struct ifaltq *);
@@ -292,6 +294,7 @@ int
 if_nullioctl(struct ifnet *ifp, u_long cmd, void *data)
 {
 
+	cv_signal(ifp-if_ioctl_emptied);
 	return ENXIO;
 }
 
@@ -497,8 +500,8 @@ if_attach(struct ifnet *ifp)
 	}
 	TAILQ_INIT(ifp-if_addrlist);
 	TAILQ_INSERT_TAIL(ifnet, ifp, if_list);
-	if (ifp-if_ioctl == NULL)
-		ifp-if_ioctl = ifioctl_common;
+
+	ifioctl_attach(ifp);	/* XXX ifioctl_attach can fail! */ 
 
 	mutex_enter(index_gen_mtx);
 	ifp-if_index_gen = index_gen++;
@@ -842,6 +845,8 @@ again:
 
 	TAILQ_REMOVE(ifnet, ifp, if_list);
 
+	ifioctl_detach(ifp);
+
 	/*
 	 * remove packets that came from ifp, from software interrupt queues.
 	 */
@@ -1403,8 +1408,7 @@ int
 ifpromisc(struct ifnet *ifp, int pswitch)
 {
 	int pcount, ret;
-	short flags;
-	struct ifreq ifr;
+	short flags, nflags;
 
 	pcount = ifp-if_pcount;
 	flags = ifp-if_flags;
@@ -1416,29 +1420,26 @@ ifpromisc(struct ifnet *ifp, int pswitch
 		 */
 		if (ifp-if_pcount++ != 0)
 			return 0;
-		ifp-if_flags |= IFF_PROMISC;
-		if ((ifp-if_flags  IFF_UP) == 0)
+		nflags = ifp-if_flags | IFF_PROMISC;
+		if ((nflags  IFF_UP) == 0)
 			return 0;
 	} else {
 		if (--ifp-if_pcount  0)
 			return 0;
-		ifp-if_flags = ~IFF_PROMISC;
+		nflags = ifp-if_flags  ~IFF_PROMISC;
 		/*
 		 * If the device is not configured up, we should not need to
 		 * turn off promiscuous mode (device should have turned it
 		 * off when interface went down; and will look at IFF_PROMISC
 		 * again next time interface comes up).
 		 */
-		if ((ifp-if_flags  IFF_UP) == 0)
+		if ((nflags  IFF_UP) == 0)
 			return 0;
 	}
-	memset(ifr, 0, sizeof(ifr));
-	ifr.ifr_flags = ifp-if_flags;
-	ret = (*ifp-if_ioctl)(ifp, SIOCSIFFLAGS, ifr);
+	ret = if_flags_set(ifp, nflags);
 	/* Restore interface state if not successful. */
 	if (ret != 0) {
 		ifp-if_pcount = pcount;
-		ifp-if_flags = flags;
 	}
 	return ret;
 }
@@ -1801,11 +1802,15 @@ ifioctl(struct socket *so, u_long cmd, v
 
 	oif_flags = ifp-if_flags;
 
+	uint64_t *nenter = percpu_getref(ifp-if_ioctl_nenter);
+	(*nenter)++;
+	percpu_putref(ifp-if_ioctl_nenter);
+	mutex_enter(ifp-if_ioctl_lock);
 	error = (*ifp-if_ioctl)(ifp, cmd, data);
 	if (error != ENOTTY)
 		;
 	else if (so-so_proto == NULL)
-		return EOPNOTSUPP;
+		error = EOPNOTSUPP;
 	else {
 #ifdef COMPAT_OSOCK
 		error = compat_ifioctl(so, ocmd, cmd, data, l);
@@ -1830,9 +1835,55 @@ ifioctl(struct socket *so, u_long cmd, v
 		ifreqn2o(oifr, ifr);
 #endif
 
+	ifp-if_ioctl_nexit++;
+	mutex_exit(ifp-if_ioctl_lock);
 	return error;
 }
 
+static void
+ifioctl_sum(void *p, void *arg, struct cpu_info *ci)
+{
+	uint64_t *sum = arg, *nenter = p;
+
+	*sum += *nenter;
+}
+
+static uint64_t
+ifioctl_entrances(struct ifnet *ifp)
+{
+	uint64_t sum = 0;
+
+	percpu_foreach(ifp-if_ioctl_nenter, ifioctl_sum, sum);
+
+	return sum;
+}
+
+static int
+ifioctl_attach(struct ifnet *ifp)
+{
+	if (ifp-if_ioctl == NULL)
+		ifp-if_ioctl = ifioctl_common;
+
+	ifp-if_ioctl_nenter = percpu_alloc(sizeof(uint64_t));
+	if 

CVS commit: src/sys/net

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:46:43 UTC 2011

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

Log Message:
Extract subroutines ifioctl_enter() and ifioctl_exit().


To generate a diff of this commit:
cvs rdiff -u -r1.252 -r1.253 src/sys/net/if.c

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

Modified files:

Index: src/sys/net/if.c
diff -u src/sys/net/if.c:1.252 src/sys/net/if.c:1.253
--- src/sys/net/if.c:1.252	Wed Oct 19 01:34:37 2011
+++ src/sys/net/if.c	Wed Oct 19 01:46:43 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if.c,v 1.252 2011/10/19 01:34:37 dyoung Exp $	*/
+/*	$NetBSD: if.c,v 1.253 2011/10/19 01:46:43 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1999, 2000, 2001, 2008 The NetBSD Foundation, Inc.
@@ -90,7 +90,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if.c,v 1.252 2011/10/19 01:34:37 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if.c,v 1.253 2011/10/19 01:46:43 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -170,6 +170,8 @@ static kauth_listener_t if_listener;
 
 static int ifioctl_attach(struct ifnet *);
 static void ifioctl_detach(struct ifnet *);
+static void ifioctl_enter(struct ifnet *);
+static void ifioctl_exit(struct ifnet *);
 static void if_detach_queues(struct ifnet *, struct ifqueue *);
 static void sysctl_sndq_setup(struct sysctllog **, const char *,
 struct ifaltq *);
@@ -1694,6 +1696,22 @@ ifaddrpref_ioctl(struct socket *so, u_lo
 	}
 }
 
+static void
+ifioctl_enter(struct ifnet *ifp)
+{
+	uint64_t *nenter = percpu_getref(ifp-if_ioctl_nenter);
+	(*nenter)++;
+	percpu_putref(ifp-if_ioctl_nenter);
+	mutex_enter(ifp-if_ioctl_lock);
+}
+
+static void
+ifioctl_exit(struct ifnet *ifp)
+{
+	ifp-if_ioctl_nexit++;
+	mutex_exit(ifp-if_ioctl_lock);
+}
+
 /*
  * Interface ioctls.
  */
@@ -1802,10 +1820,7 @@ ifioctl(struct socket *so, u_long cmd, v
 
 	oif_flags = ifp-if_flags;
 
-	uint64_t *nenter = percpu_getref(ifp-if_ioctl_nenter);
-	(*nenter)++;
-	percpu_putref(ifp-if_ioctl_nenter);
-	mutex_enter(ifp-if_ioctl_lock);
+	ifioctl_enter(ifp);
 	error = (*ifp-if_ioctl)(ifp, cmd, data);
 	if (error != ENOTTY)
 		;
@@ -1835,8 +1850,7 @@ ifioctl(struct socket *so, u_long cmd, v
 		ifreqn2o(oifr, ifr);
 #endif
 
-	ifp-if_ioctl_nexit++;
-	mutex_exit(ifp-if_ioctl_lock);
+	ifioctl_exit(ifp);
 	return error;
 }
 



CVS commit: src/sys/net

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:48:30 UTC 2011

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

Log Message:
Use if_mcast_op() and if_flags_set() instead of calling ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.67 -r1.68 src/sys/net/if_vlan.c

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

Modified files:

Index: src/sys/net/if_vlan.c
diff -u src/sys/net/if_vlan.c:1.67 src/sys/net/if_vlan.c:1.68
--- src/sys/net/if_vlan.c:1.67	Fri Apr  8 13:56:51 2011
+++ src/sys/net/if_vlan.c	Wed Oct 19 01:48:30 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_vlan.c,v 1.67 2011/04/08 13:56:51 sborrill Exp $	*/
+/*	$NetBSD: if_vlan.c,v 1.68 2011/10/19 01:48:30 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000, 2001 The NetBSD Foundation, Inc.
@@ -78,7 +78,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.67 2011/04/08 13:56:51 sborrill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_vlan.c,v 1.68 2011/10/19 01:48:30 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -469,24 +469,6 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
 	s = splnet();
 
 	switch (cmd) {
-	case SIOCINITIFADDR:
-		if (ifv-ifv_p != NULL) {
-			ifp-if_flags |= IFF_UP;
-
-			switch (ifa-ifa_addr-sa_family) {
-#ifdef INET
-			case AF_INET:
-arp_ifinit(ifp, ifa);
-break;
-#endif
-			default:
-break;
-			}
-		} else {
-			error = EINVAL;
-		}
-		break;
-
 	case SIOCSIFMTU:
 		if (ifv-ifv_p == NULL)
 			error = EINVAL;
@@ -569,6 +551,19 @@ vlan_ioctl(struct ifnet *ifp, u_long cmd
 		if ((error = ifioctl_common(ifp, cmd, data)) == ENETRESET)
 			error = 0;
 		break;
+	case SIOCINITIFADDR:
+		if (ifv-ifv_p == NULL) {
+			error = EINVAL;
+			break;
+		}
+
+		ifp-if_flags |= IFF_UP;
+#ifdef INET
+		if (ifa-ifa_addr-sa_family == AF_INET)
+			arp_ifinit(ifp, ifa);
+#endif
+		break;
+
 	default:
 		error = ether_ioctl(ifp, cmd, data);
 	}



CVS commit: src/sys/net/agr

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:49:50 UTC 2011

Modified Files:
src/sys/net/agr: if_agr.c if_agrether.c

Log Message:
Use if_flags_set() and if_addr_init() instead of ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/net/agr/if_agr.c
cvs rdiff -u -r1.8 -r1.9 src/sys/net/agr/if_agrether.c

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

Modified files:

Index: src/sys/net/agr/if_agr.c
diff -u src/sys/net/agr/if_agr.c:1.29 src/sys/net/agr/if_agr.c:1.30
--- src/sys/net/agr/if_agr.c:1.29	Wed Aug 11 11:47:29 2010
+++ src/sys/net/agr/if_agr.c	Wed Oct 19 01:49:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_agr.c,v 1.29 2010/08/11 11:47:29 pgoyette Exp $	*/
+/*	$NetBSD: if_agr.c,v 1.30 2011/10/19 01:49:50 dyoung Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_agr.c,v 1.29 2010/08/11 11:47:29 pgoyette Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_agr.c,v 1.30 2011/10/19 01:49:50 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -235,7 +235,6 @@ agr_vlan_add(struct agr_port *port, void
 {
 	struct ifnet *ifp = port-port_ifp;
 	struct ethercom *ec_port = (void *)ifp;
-	struct ifreq ifr;
 	int error=0;
 
 	if (ec_port-ec_nvlans++ == 0 
@@ -246,9 +245,7 @@ agr_vlan_add(struct agr_port *port, void
 		 */
 		ec_port-ec_capenable |= ETHERCAP_VLAN_MTU;
 		if (p-if_flags  IFF_UP) {
-			ifr.ifr_flags = p-if_flags;
-			error = (*p-if_ioctl)(p, SIOCSIFFLAGS,
-			(void *) ifr);
+			error = if_flags_set(p, p-if_flags);
 			if (error) {
 if (ec_port-ec_nvlans-- == 1)
 	ec_port-ec_capenable =
@@ -268,7 +265,6 @@ static int
 agr_vlan_del(struct agr_port *port, void *arg)
 {
 	struct ethercom *ec_port = (void *)port-port_ifp;
-	struct ifreq ifr;
 
 	/* Disable vlan support */
 	if (ec_port-ec_nvlans-- == 1) {
@@ -277,9 +273,8 @@ agr_vlan_del(struct agr_port *port, void
 		 */
 		ec_port-ec_capenable = ~ETHERCAP_VLAN_MTU;
 		if (port-port_ifp-if_flags  IFF_UP) {
-			ifr.ifr_flags = port-port_ifp-if_flags;
-			(void) (*port-port_ifp-if_ioctl)(port-port_ifp,
-			SIOCSIFFLAGS, (void *) ifr);
+			(void)if_flags_set(port-port_ifp,
+			port-port_ifp-if_flags);
 		}
 	}
 
@@ -641,10 +636,10 @@ agr_addport(struct ifnet *ifp, struct if
 	 * of each port to that of the first port. No need for arps 
 	 * since there are no inet addresses assigned to the ports.
 	 */
-	error = (*ifp_port-if_ioctl)(ifp_port, SIOCINITIFADDR, ifp-if_dl);
+	error = if_addr_init(ifp_port, ifp-if_dl, true);
 
 	if (error) {
-		printf(%s: SIOCINITIFADDR error %d\n, __func__, error);
+		printf(%s: if_addr_init error %d\n, __func__, error);
 		goto cleanup;
 	}
 	port-port_flags |= AGRPORT_LADDRCHANGED;

Index: src/sys/net/agr/if_agrether.c
diff -u src/sys/net/agr/if_agrether.c:1.8 src/sys/net/agr/if_agrether.c:1.9
--- src/sys/net/agr/if_agrether.c:1.8	Tue Jun  9 22:26:49 2009
+++ src/sys/net/agr/if_agrether.c	Wed Oct 19 01:49:50 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_agrether.c,v 1.8 2009/06/09 22:26:49 yamt Exp $	*/
+/*	$NetBSD: if_agrether.c,v 1.9 2011/10/19 01:49:50 dyoung Exp $	*/
 
 /*-
  * Copyright (c)2005 YAMAMOTO Takashi,
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_agrether.c,v 1.8 2009/06/09 22:26:49 yamt Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_agrether.c,v 1.9 2011/10/19 01:49:50 dyoung Exp $);
 
 #include sys/param.h
 #include sys/callout.h
@@ -175,9 +175,7 @@ agrether_portinit(struct agr_softc *sc, 
 		 */
 		ec_port-ec_capenable |= ETHERCAP_VLAN_MTU;
 		if (p-if_flags  IFF_UP) {
-			ifr.ifr_flags = p-if_flags;
-			error = (*p-if_ioctl)(p, SIOCSIFFLAGS,
-			(void *) ifr);
+			error = if_flags_set(p, p-if_flags);
 			if (error) {
 if (ec_port-ec_nvlans-- == 1)
 	ec_port-ec_capenable =
@@ -234,9 +232,8 @@ agrether_portfini(struct agr_softc *sc, 
 		 */
 		ec_port-ec_capenable = ~ETHERCAP_VLAN_MTU;
 		if (port-port_ifp-if_flags  IFF_UP) {
-			ifr.ifr_flags = port-port_ifp-if_flags;
-			(void) (*port-port_ifp-if_ioctl)(port-port_ifp,
-			SIOCSIFFLAGS, (void *) ifr);
+			(void)if_flags_set(port-port_ifp,
+			port-port_ifp-if_flags);
 		}
 	}
 



CVS commit: src/sys/netatalk

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:50:27 UTC 2011

Modified Files:
src/sys/netatalk: at_control.c

Log Message:
Use if_addr_init() instead of ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.33 -r1.34 src/sys/netatalk/at_control.c

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

Modified files:

Index: src/sys/netatalk/at_control.c
diff -u src/sys/netatalk/at_control.c:1.33 src/sys/netatalk/at_control.c:1.34
--- src/sys/netatalk/at_control.c:1.33	Sat Jan 30 21:48:30 2010
+++ src/sys/netatalk/at_control.c	Wed Oct 19 01:50:27 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: at_control.c,v 1.33 2010/01/30 21:48:30 is Exp $	 */
+/*	$NetBSD: at_control.c,v 1.34 2011/10/19 01:50:27 dyoung Exp $	 */
 
 /*
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: at_control.c,v 1.33 2010/01/30 21:48:30 is Exp $);
+__KERNEL_RCSID(0, $NetBSD: at_control.c,v 1.34 2011/10/19 01:50:27 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -575,7 +575,7 @@ at_ifinit(struct ifnet *ifp, struct at_i
 	 * Now that we have selected an address, we need to tell the
 	 * interface about it, just in case it needs to adjust something.
 	 */
-	if ((error = (*ifp-if_ioctl)(ifp, SIOCINITIFADDR, aa)) != 0) {
+	if ((error = if_addr_init(ifp, aa-aa_ifa, true)) != 0) {
 		/*
 		 * of course this could mean that it objects violently
 		 * so if it does, we back out again..



CVS commit: src/sys/netinet

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:52:22 UTC 2011

Modified Files:
src/sys/netinet: in.c ip_carp.c ip_mroute.c

Log Message:
Use if_addr_init() and if_mcast_op() instead of ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.138 -r1.139 src/sys/netinet/in.c
cvs rdiff -u -r1.45 -r1.46 src/sys/netinet/ip_carp.c
cvs rdiff -u -r1.120 -r1.121 src/sys/netinet/ip_mroute.c

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

Modified files:

Index: src/sys/netinet/in.c
diff -u src/sys/netinet/in.c:1.138 src/sys/netinet/in.c:1.139
--- src/sys/netinet/in.c:1.138	Sat May 15 05:02:46 2010
+++ src/sys/netinet/in.c	Wed Oct 19 01:52:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: in.c,v 1.138 2010/05/15 05:02:46 oki Exp $	*/
+/*	$NetBSD: in.c,v 1.139 2011/10/19 01:52:22 dyoung Exp $	*/
 
 /*
  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -91,7 +91,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in.c,v 1.138 2010/05/15 05:02:46 oki Exp $);
+__KERNEL_RCSID(0, $NetBSD: in.c,v 1.139 2011/10/19 01:52:22 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_inet_conf.h
@@ -454,7 +454,7 @@ in_control(struct socket *so, u_long cmd
 			return (EINVAL);
 		oldaddr = ia-ia_dstaddr;
 		ia-ia_dstaddr = *satocsin(ifreq_getdstaddr(cmd, ifr));
-		if ((error = (*ifp-if_ioctl)(ifp, SIOCSIFDSTADDR, ia)) != 0) {
+		if ((error = if_addr_init(ifp, ia-ia_ifa, false)) != 0) {
 			ia-ia_dstaddr = oldaddr;
 			return error;
 		}
@@ -813,7 +813,7 @@ in_ifinit(struct ifnet *ifp, struct in_i
 	 * if this is its first address,
 	 * and to validate the address if necessary.
 	 */
-	if ((error = (*ifp-if_ioctl)(ifp, SIOCINITIFADDR, ia)) != 0)
+	if ((error = if_addr_init(ifp, ia-ia_ifa, true)) != 0)
 		goto bad;
 	splx(s);
 	if (scrub) {
@@ -1045,7 +1045,6 @@ in_addmulti(struct in_addr *ap, struct i
 {
 	struct sockaddr_in sin;
 	struct in_multi *inm;
-	struct ifreq ifr;
 	int s = splsoftnet();
 
 	/*
@@ -1078,8 +1077,7 @@ in_addmulti(struct in_addr *ap, struct i
 		 * filter appropriately for the new address.
 		 */
 		sockaddr_in_init(sin, ap, 0);
-		ifreq_setaddr(SIOCADDMULTI, ifr, sintosa(sin));
-		if ((*ifp-if_ioctl)(ifp, SIOCADDMULTI, ifr) != 0) {
+		if (if_mcast_op(ifp, SIOCADDMULTI, sintosa(sin)) != 0) {
 			LIST_REMOVE(inm, inm_list);
 			pool_put(inmulti_pool, inm);
 			splx(s);
@@ -1107,7 +1105,6 @@ void
 in_delmulti(struct in_multi *inm)
 {
 	struct sockaddr_in sin;
-	struct ifreq ifr;
 	int s = splsoftnet();
 
 	if (--inm-inm_refcount == 0) {
@@ -1126,8 +1123,7 @@ in_delmulti(struct in_multi *inm)
 		 * filter.
 		 */
 		sockaddr_in_init(sin, inm-inm_addr, 0);
-		ifreq_setaddr(SIOCDELMULTI, ifr, sintosa(sin));
-		(*inm-inm_ifp-if_ioctl)(inm-inm_ifp, SIOCDELMULTI, ifr);
+		if_mcast_op(inm-inm_ifp, SIOCDELMULTI, sintosa(sin));
 		pool_put(inmulti_pool, inm);
 	}
 	splx(s);

Index: src/sys/netinet/ip_carp.c
diff -u src/sys/netinet/ip_carp.c:1.45 src/sys/netinet/ip_carp.c:1.46
--- src/sys/netinet/ip_carp.c:1.45	Sun Jul 17 20:54:53 2011
+++ src/sys/netinet/ip_carp.c	Wed Oct 19 01:52:22 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip_carp.c,v 1.45 2011/07/17 20:54:53 joerg Exp $	*/
+/*	$NetBSD: ip_carp.c,v 1.46 2011/10/19 01:52:22 dyoung Exp $	*/
 /*	$OpenBSD: ip_carp.c,v 1.113 2005/11/04 08:11:54 mcbride Exp $	*/
 
 /*
@@ -30,7 +30,7 @@
 #include opt_inet.h
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip_carp.c,v 1.45 2011/07/17 20:54:53 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip_carp.c,v 1.46 2011/10/19 01:52:22 dyoung Exp $);
 
 /*
  * TODO:
@@ -2151,7 +2151,7 @@ carp_ether_addmulti(struct carp_softc *s
 	memcpy(mc-mc_addr, sa, sa-sa_len);
 	LIST_INSERT_HEAD(sc-carp_mc_listhead, mc, mc_entries);
 
-	error = (*ifp-if_ioctl)(ifp, SIOCADDMULTI, ifr);
+	error = if_mcast_op(ifp, SIOCADDMULTI, sa);
 	if (error != 0)
 		goto ioctl_failed;
 
@@ -2203,7 +2203,7 @@ carp_ether_delmulti(struct carp_softc *s
 		return (error);
 
 	/* We no longer use this multicast address.  Tell parent so. */
-	error = (*ifp-if_ioctl)(ifp, SIOCDELMULTI, ifr);
+	error = if_mcast_op(ifp, SIOCDELMULTI, sa);
 	if (error == 0) {
 		/* And forget about this address. */
 		LIST_REMOVE(mc, mc_entries);
@@ -,22 +,12 @@ carp_ether_purgemulti(struct carp_softc 
 {
 	struct ifnet *ifp = sc-sc_carpdev;		/* Parent. */
 	struct carp_mc_entry *mc;
-	union {
-		struct ifreq ifreq;
-		struct {
-			char ifr_name[IFNAMSIZ];
-			struct sockaddr_storage ifr_ss;
-		} ifreq_storage;
-	} u;
-	struct ifreq *ifr = u.ifreq;
 
 	if (ifp == NULL)
 		return;
 
-	memcpy(ifr-ifr_name, ifp-if_xname, IFNAMSIZ);
 	while ((mc = LIST_FIRST(sc-carp_mc_listhead)) != NULL) {
-		memcpy(ifr-ifr_addr, mc-mc_addr, mc-mc_addr.ss_len);
-		(void)(*ifp-if_ioctl)(ifp, SIOCDELMULTI, ifr);
+		(void)if_mcast_op(ifp, SIOCDELMULTI, sstosa(mc-mc_addr));
 		LIST_REMOVE(mc, mc_entries);
 		free(mc, M_DEVBUF);
 	}

Index: src/sys/netinet/ip_mroute.c
diff -u 

CVS commit: src/sys/netinet6

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:53:08 UTC 2011

Modified Files:
src/sys/netinet6: in6.c ip6_mroute.c mld6.c

Log Message:
Use if_addr_init() and if_mcast_op() instead of ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.157 -r1.158 src/sys/netinet6/in6.c
cvs rdiff -u -r1.101 -r1.102 src/sys/netinet6/ip6_mroute.c
cvs rdiff -u -r1.53 -r1.54 src/sys/netinet6/mld6.c

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

Modified files:

Index: src/sys/netinet6/in6.c
diff -u src/sys/netinet6/in6.c:1.157 src/sys/netinet6/in6.c:1.158
--- src/sys/netinet6/in6.c:1.157	Sun Feb  6 19:12:55 2011
+++ src/sys/netinet6/in6.c	Wed Oct 19 01:53:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: in6.c,v 1.157 2011/02/06 19:12:55 dyoung Exp $	*/
+/*	$NetBSD: in6.c,v 1.158 2011/10/19 01:53:07 dyoung Exp $	*/
 /*	$KAME: in6.c,v 1.198 2001/07/18 09:12:38 itojun Exp $	*/
 
 /*
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.157 2011/02/06 19:12:55 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: in6.c,v 1.158 2011/10/19 01:53:07 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_pfil_hooks.h
@@ -1753,8 +1753,8 @@ in6_ifinit(struct ifnet *ifp, struct in6
 
 	ia-ia_addr = *sin6;
 
-	if (ifacount = 1  
-	(error = (*ifp-if_ioctl)(ifp, SIOCINITIFADDR, ia)) != 0) {
+	if (ifacount = 1 
+	(error = if_addr_init(ifp, ia-ia_ifa, true)) != 0) {
 		splx(s);
 		return error;
 	}

Index: src/sys/netinet6/ip6_mroute.c
diff -u src/sys/netinet6/ip6_mroute.c:1.101 src/sys/netinet6/ip6_mroute.c:1.102
--- src/sys/netinet6/ip6_mroute.c:1.101	Wed Aug 31 18:31:03 2011
+++ src/sys/netinet6/ip6_mroute.c	Wed Oct 19 01:53:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ip6_mroute.c,v 1.101 2011/08/31 18:31:03 plunky Exp $	*/
+/*	$NetBSD: ip6_mroute.c,v 1.102 2011/10/19 01:53:07 dyoung Exp $	*/
 /*	$KAME: ip6_mroute.c,v 1.49 2001/07/25 09:21:18 jinmei Exp $	*/
 
 /*
@@ -117,7 +117,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: ip6_mroute.c,v 1.101 2011/08/31 18:31:03 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: ip6_mroute.c,v 1.102 2011/10/19 01:53:07 dyoung Exp $);
 
 #include opt_inet.h
 #include opt_mrouting.h
@@ -512,7 +512,7 @@ ip6_mrouter_done(void)
 	mifi_t mifi;
 	int i;
 	struct ifnet *ifp;
-	struct in6_ifreq ifr;
+	struct sockaddr_in6 sin6;
 	struct mf6c *rt;
 	struct rtdetq *rte;
 	int s;
@@ -538,10 +538,11 @@ ip6_mrouter_done(void)
 		for (mifi = 0; mifi  nummifs; mifi++) {
 			if (mif6table[mifi].m6_ifp 
 			!(mif6table[mifi].m6_flags  MIFF_REGISTER)) {
-ifr.ifr_addr.sin6_family = AF_INET6;
-ifr.ifr_addr.sin6_addr= in6addr_any;
+sin6.sin6_family = AF_INET6;
+sin6.sin6_addr = in6addr_any;
 ifp = mif6table[mifi].m6_ifp;
-(*ifp-if_ioctl)(ifp, SIOCDELMULTI, ifr);
+if_mcast_op(ifp, SIOCDELMULTI,
+sin6tocsa(sin6));
 			}
 		}
 	}
@@ -643,7 +644,7 @@ add_m6if(struct mif6ctl *mifcp)
 {
 	struct mif6 *mifp;
 	struct ifnet *ifp;
-	struct in6_ifreq ifr;
+	struct sockaddr_in6 sin6;
 	int error, s;
 #ifdef notyet
 	struct tbf *m_tbf = tbftable + mifcp-mif6c_mifi;
@@ -686,9 +687,9 @@ add_m6if(struct mif6ctl *mifcp)
 		 * Enable promiscuous reception of all IPv6 multicasts
 		 * from the interface.
 		 */
-		ifr.ifr_addr.sin6_family = AF_INET6;
-		ifr.ifr_addr.sin6_addr = in6addr_any;
-		error = (*ifp-if_ioctl)(ifp, SIOCADDMULTI, ifr);
+		sin6.sin6_family = AF_INET6;
+		sin6.sin6_addr = in6addr_any;
+		error = if_mcast_op(ifp, SIOCADDMULTI, sin6tosa(sin6));
 		splx(s);
 		if (error)
 			return error;
@@ -731,7 +732,7 @@ del_m6if(mifi_t *mifip)
 	struct mif6 *mifp = mif6table + *mifip;
 	mifi_t mifi;
 	struct ifnet *ifp;
-	struct in6_ifreq ifr;
+	struct sockaddr_in6 sin6;
 	int s;
 
 	if (*mifip = nummifs)
@@ -748,9 +749,9 @@ del_m6if(mifi_t *mifip)
 		 */
 		ifp = mifp-m6_ifp;
 
-		ifr.ifr_addr.sin6_family = AF_INET6;
-		ifr.ifr_addr.sin6_addr = in6addr_any;
-		(*ifp-if_ioctl)(ifp, SIOCDELMULTI, ifr);
+		sin6.sin6_family = AF_INET6;
+		sin6.sin6_addr = in6addr_any;
+		if_mcast_op(ifp, SIOCDELMULTI, sin6tosa(sin6));
 	} else {
 		if (reg_mif_num != (mifi_t)-1) {
 			if_detach(multicast_register_if6);

Index: src/sys/netinet6/mld6.c
diff -u src/sys/netinet6/mld6.c:1.53 src/sys/netinet6/mld6.c:1.54
--- src/sys/netinet6/mld6.c:1.53	Wed Aug 31 18:31:03 2011
+++ src/sys/netinet6/mld6.c	Wed Oct 19 01:53:07 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: mld6.c,v 1.53 2011/08/31 18:31:03 plunky Exp $	*/
+/*	$NetBSD: mld6.c,v 1.54 2011/10/19 01:53:07 dyoung Exp $	*/
 /*	$KAME: mld6.c,v 1.25 2001/01/16 14:14:18 itojun Exp $	*/
 
 /*
@@ -102,7 +102,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.53 2011/08/31 18:31:03 plunky Exp $);
+__KERNEL_RCSID(0, $NetBSD: mld6.c,v 1.54 2011/10/19 01:53:07 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -616,7 +616,7 @@ in6_addmulti(struct in6_addr *maddr6, st
 	int *errorp, int timer)
 {
 	struct	in6_ifaddr *ia;
-	struct	in6_ifreq 

CVS commit: src/sys/netiso

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 01:53:35 UTC 2011

Modified Files:
src/sys/netiso: iso.c iso_snpac.c

Log Message:
Use if_addr_init() and if_mcast_op() instead of ifp-if_ioctl().


To generate a diff of this commit:
cvs rdiff -u -r1.57 -r1.58 src/sys/netiso/iso.c
cvs rdiff -u -r1.53 -r1.54 src/sys/netiso/iso_snpac.c

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

Modified files:

Index: src/sys/netiso/iso.c
diff -u src/sys/netiso/iso.c:1.57 src/sys/netiso/iso.c:1.58
--- src/sys/netiso/iso.c:1.57	Fri Aug  7 14:04:34 2009
+++ src/sys/netiso/iso.c	Wed Oct 19 01:53:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso.c,v 1.57 2009/08/07 14:04:34 wiz Exp $	*/
+/*	$NetBSD: iso.c,v 1.58 2011/10/19 01:53:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -88,7 +88,7 @@ SOFTWARE.
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iso.c,v 1.57 2009/08/07 14:04:34 wiz Exp $);
+__KERNEL_RCSID(0, $NetBSD: iso.c,v 1.58 2011/10/19 01:53:35 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -649,7 +649,7 @@ iso_ifinit(struct ifnet *ifp, struct iso
 	 * if this is its first address,
 	 * and to validate the address if necessary.
 	 */
-	if ((error = (*ifp-if_ioctl)(ifp, SIOCINITIFADDR, ia)) != 0) {
+	if ((error = if_addr_init(ifp, ia-ia_ifa, true)) != 0) {
 		splx(s);
 		ia-ia_addr = oldaddr;
 		return (error);

Index: src/sys/netiso/iso_snpac.c
diff -u src/sys/netiso/iso_snpac.c:1.53 src/sys/netiso/iso_snpac.c:1.54
--- src/sys/netiso/iso_snpac.c:1.53	Thu Apr 16 21:37:17 2009
+++ src/sys/netiso/iso_snpac.c	Wed Oct 19 01:53:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: iso_snpac.c,v 1.53 2009/04/16 21:37:17 elad Exp $	*/
+/*	$NetBSD: iso_snpac.c,v 1.54 2011/10/19 01:53:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1991, 1993
@@ -59,7 +59,7 @@ SOFTWARE.
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: iso_snpac.c,v 1.53 2009/04/16 21:37:17 elad Exp $);
+__KERNEL_RCSID(0, $NetBSD: iso_snpac.c,v 1.54 2011/10/19 01:53:35 dyoung Exp $);
 
 #include opt_iso.h
 #ifdef ISO
@@ -275,18 +275,18 @@ iso_setmcasts(struct ifnet *ifp, int req
 {
 	static const char * const addrlist[] =
 	{all_es_snpa, all_is_snpa, all_l1is_snpa, all_l2is_snpa, 0};
-	struct ifreq ifr;
+	struct sockaddr sa;
 	const char *const *cpp;
 
-	(void)memset(ifr, 0, sizeof(ifr));
+	(void)memset(sa, 0, sizeof(sa));
 	for (cpp = addrlist; *cpp; cpp++) {
-		(void)memcpy(ifr.ifr_addr.sa_data, *cpp, 6);
+		(void)memcpy(sa.sa_data, *cpp, 6);
 		if (req == RTM_ADD  
-		(*ifp-if_ioctl)(ifp, SIOCADDMULTI, ifr) != 0)
+		if_mcast_op(ifp, SIOCADDMULTI, sa) != 0)
 			printf(iso_setmcasts: %s unable to add mcast\n,
 			ifp-if_xname);
 		else if (req == RTM_DELETE  
-		(*ifp-if_ioctl)(ifp, SIOCDELMULTI, ifr) != 0)
+		if_mcast_op(ifp, SIOCDELMULTI, sa) != 0)
 			printf(iso_setmcasts: %s unable to delete mcast\n,
 			ifp-if_xname);
 	}



CVS commit: src/sys/arch/x86/x86

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 05:01:43 UTC 2011

Modified Files:
src/sys/arch/x86/x86: x86_stub.c

Log Message:
Create a stub implementation of pci_ranges_infer().


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/sys/arch/x86/x86/x86_stub.c

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

Modified files:

Index: src/sys/arch/x86/x86/x86_stub.c
diff -u src/sys/arch/x86/x86/x86_stub.c:1.3 src/sys/arch/x86/x86/x86_stub.c:1.4
--- src/sys/arch/x86/x86/x86_stub.c:1.3	Tue Oct 18 23:41:45 2011
+++ src/sys/arch/x86/x86/x86_stub.c	Wed Oct 19 05:01:43 2011
@@ -1,13 +1,14 @@
-/* $NetBSD: x86_stub.c,v 1.3 2011/10/18 23:41:45 dyoung Exp $ */
+/* $NetBSD: x86_stub.c,v 1.4 2011/10/19 05:01:43 dyoung Exp $ */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.3 2011/10/18 23:41:45 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: x86_stub.c,v 1.4 2011/10/19 05:01:43 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
 #include sys/kgdb.h
 
 #include machine/autoconf.h
+#include dev/pci/pcivar.h
 
 int x86_zeroop(void);
 void *x86_nullop(void);
@@ -30,11 +31,12 @@ x86_zeroop(void)
 	return 0;
 }
 
+__weak_alias(device_isa_register, x86_nullop);
 __weak_alias(device_pci_props_register, x86_voidop);
 __weak_alias(device_pci_register, x86_nullop);
-__weak_alias(device_isa_register, x86_nullop);
 __weak_alias(kdb_trap, x86_zeroop);
 __weak_alias(kgdb_disconnected, x86_zeroop);
 __weak_alias(kgdb_trap, x86_zeroop);
 __weak_alias(mca_nmi, x86_voidop);
+__weak_alias(pci_ranges_infer, x86_voidop);
 __weak_alias(x86_nmi, x86_voidop);



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

2011-10-18 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Oct 19 05:22:25 UTC 2011

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

Log Message:
Don't link pci_ranges.c with x86 kernels for now, it's using a
pcibus_attach_args member that I haven't added, yet.


To generate a diff of this commit:
cvs rdiff -u -r1.74 -r1.75 src/sys/arch/x86/conf/files.x86

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

Modified files:

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.74 src/sys/arch/x86/conf/files.x86:1.75
--- src/sys/arch/x86/conf/files.x86:1.74	Mon Oct 17 23:24:05 2011
+++ src/sys/arch/x86/conf/files.x86	Wed Oct 19 05:22:25 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.74 2011/10/17 23:24:05 jmcneill Exp $
+#	$NetBSD: files.x86,v 1.75 2011/10/19 05:22:25 dyoung Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -129,7 +129,7 @@ file	arch/x86/x86/tprof_pmi.c	tprof_pmi
 file	arch/x86/x86/tprof_amdpmi.c	tprof_amdpmi
 
 file	arch/x86/pci/pci_machdep.c	pci
-file	arch/x86/pci/pci_ranges.c	pci
+#file	arch/x86/pci/pci_ranges.c	pci
 file	arch/x86/pci/pci_intr_machdep.c	pci
 
 file	arch/x86/pci/pciide_machdep.c	pciide_common



CVS commit: src/sys/dev/ic

2011-10-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct  7 16:58:11 UTC 2011

Modified Files:
src/sys/dev/ic: ath.c ath_netbsd.h athvar.h

Log Message:
Get rid of the I don't know what I was thinking / somebody should have
stopped me / does anybody read source-changes? ATH_LOCK()/ATH_UNLOCK()
and bracket with splnet()/splx() instead.  This is still not *good*,
since ifnet ioctls are not (yet) synchronized, but could be no worse
than what we have, now.  Survives light testing with my (forthcoming)
ifnet ioctl synchronization patch.


To generate a diff of this commit:
cvs rdiff -u -r1.111 -r1.112 src/sys/dev/ic/ath.c
cvs rdiff -u -r1.11 -r1.12 src/sys/dev/ic/ath_netbsd.h
cvs rdiff -u -r1.34 -r1.35 src/sys/dev/ic/athvar.h

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

Modified files:

Index: src/sys/dev/ic/ath.c
diff -u src/sys/dev/ic/ath.c:1.111 src/sys/dev/ic/ath.c:1.112
--- src/sys/dev/ic/ath.c:1.111	Mon Mar  7 11:25:41 2011
+++ src/sys/dev/ic/ath.c	Fri Oct  7 16:58:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath.c,v 1.111 2011/03/07 11:25:41 cegger Exp $	*/
+/*	$NetBSD: ath.c,v 1.112 2011/10/07 16:58:11 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -41,7 +41,7 @@
 __FBSDID($FreeBSD: src/sys/dev/ath/if_ath.c,v 1.104 2005/09/16 10:09:23 ru Exp $);
 #endif
 #ifdef __NetBSD__
-__KERNEL_RCSID(0, $NetBSD: ath.c,v 1.111 2011/03/07 11:25:41 cegger Exp $);
+__KERNEL_RCSID(0, $NetBSD: ath.c,v 1.112 2011/10/07 16:58:11 dyoung Exp $);
 #endif
 
 /*
@@ -979,18 +979,18 @@ ath_init(struct ath_softc *sc)
 	struct ieee80211com *ic = sc-sc_ic;
 	struct ath_hal *ah = sc-sc_ah;
 	HAL_STATUS status;
-	int error = 0;
+	int error = 0, s;
 
 	DPRINTF(sc, ATH_DEBUG_ANY, %s: if_flags 0x%x\n,
 		__func__, ifp-if_flags);
 
 	if (device_is_active(sc-sc_dev)) {
-		ATH_LOCK(sc);
+		s = splnet();
 	} else if (!pmf_device_subtree_resume(sc-sc_dev, sc-sc_qual) ||
 	   !device_is_active(sc-sc_dev))
 		return 0;
 	else
-		ATH_LOCK(sc);
+		s = splnet();
 
 	/*
 	 * Stop anything previously setup.  This is safe
@@ -1074,7 +1074,7 @@ ath_init(struct ath_softc *sc)
 	} else
 		ieee80211_new_state(ic, IEEE80211_S_RUN, -1);
 done:
-	ATH_UNLOCK(sc);
+	splx(s);
 	return error;
 }
 
@@ -1088,7 +1088,7 @@ ath_stop_locked(struct ifnet *ifp, int d
 	DPRINTF(sc, ATH_DEBUG_ANY, %s: invalid %d if_flags 0x%x\n,
 		__func__, !device_is_enabled(sc-sc_dev), ifp-if_flags);
 
-	ATH_LOCK_ASSERT(sc);
+	/* KASSERT() IPL_NET */
 	if (ifp-if_flags  IFF_RUNNING) {
 		/*
 		 * Shutdown the hardware and driver:
@@ -1137,11 +1137,11 @@ ath_stop_locked(struct ifnet *ifp, int d
 static void
 ath_stop(struct ifnet *ifp, int disable)
 {
-	struct ath_softc *sc = ifp-if_softc;
+	int s;
 
-	ATH_LOCK(sc);
+	s = splnet();
 	ath_stop_locked(ifp, disable);
-	ATH_UNLOCK(sc);
+	splx(s);
 }
 
 static void
@@ -4599,10 +4599,11 @@ ath_calibrate(void *arg)
 	struct ath_softc *sc = arg;
 	struct ath_hal *ah = sc-sc_ah;
 	HAL_BOOL iqCalDone;
+	int s;
 
 	sc-sc_stats.ast_per_cal++;
 
-	ATH_LOCK(sc);
+	 s = splnet();
 
 	if (ath_hal_getrfgain(ah) == HAL_RFGAIN_NEED_CHANGE) {
 		/*
@@ -4648,7 +4649,7 @@ ath_calibrate(void *arg)
 	sc-sc_caltries++;
 	callout_reset(sc-sc_cal_ch, sc-sc_calinterval * hz,
 		ath_calibrate, sc);
-	ATH_UNLOCK(sc);
+	splx(s);
 }
 
 static int
@@ -5300,9 +5301,9 @@ ath_ioctl(struct ifnet *ifp, u_long cmd,
 	struct ath_softc *sc = ifp-if_softc;
 	struct ieee80211com *ic = sc-sc_ic;
 	struct ifreq *ifr = (struct ifreq *)data;
-	int error = 0;
+	int error = 0, s;
 
-	ATH_LOCK(sc);
+	s = splnet();
 	switch (cmd) {
 	case SIOCSIFFLAGS:
 		if ((error = ifioctl_common(ifp, cmd, data)) != 0)
@@ -5348,7 +5349,7 @@ ath_ioctl(struct ifnet *ifp, u_long cmd,
 		sc-sc_stats.ast_tx_packets = ifp-if_opackets;
 		sc-sc_stats.ast_rx_packets = ifp-if_ipackets;
 		sc-sc_stats.ast_rx_rssi = ieee80211_getrssi(ic);
-		ATH_UNLOCK(sc);
+		splx(s);
 		/*
 		 * NB: Drop the softc lock in case of a page fault;
 		 * we'll accept any potential inconsisentcy in the
@@ -5371,7 +5372,7 @@ ath_ioctl(struct ifnet *ifp, u_long cmd,
 			error = 0;
 		break;
 	}
-	ATH_UNLOCK(sc);
+	splx(s);
 	return error;
 #undef IS_RUNNING
 }

Index: src/sys/dev/ic/ath_netbsd.h
diff -u src/sys/dev/ic/ath_netbsd.h:1.11 src/sys/dev/ic/ath_netbsd.h:1.12
--- src/sys/dev/ic/ath_netbsd.h:1.11	Fri Jan 21 17:46:19 2011
+++ src/sys/dev/ic/ath_netbsd.h	Fri Oct  7 16:58:11 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ath_netbsd.h,v 1.11 2011/01/21 17:46:19 dyoung Exp $ */
+/*	$NetBSD: ath_netbsd.h,v 1.12 2011/10/07 16:58:11 dyoung Exp $ */
 
 /*-
  * Copyright (c) 2003, 2004 David Young
@@ -48,49 +48,19 @@ typedef struct ath_task {
 #define TASK_RUN_OR_ENQUEUE(__task)	\
 	((*(__task)-t_func)((__task)-t_context, 1))
 
-struct ath_lock {
-	int count;
-	int ipl;
-};
-
-#define	ATH_LOCK_INIT_IMPL(_obj, _member)		\
-	do { (_obj)-_member.count = 0; } while (0)
-#define	ATH_LOCK_IMPL(_obj, _member)			\
-	do {		\
-		int

CVS commit: src/sys/dev

2011-10-07 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Oct  7 20:47:42 UTC 2011

Modified Files:
src/sys/dev/cardbus: if_ath_cardbus.c
src/sys/dev/pci: if_ath_pci.c

Log Message:
Stop calling ATH_LOCK_{INIT,DESTROY}(), they don't exist any more.


To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/sys/dev/cardbus/if_ath_cardbus.c
cvs rdiff -u -r1.43 -r1.44 src/sys/dev/pci/if_ath_pci.c

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

Modified files:

Index: src/sys/dev/cardbus/if_ath_cardbus.c
diff -u src/sys/dev/cardbus/if_ath_cardbus.c:1.44 src/sys/dev/cardbus/if_ath_cardbus.c:1.45
--- src/sys/dev/cardbus/if_ath_cardbus.c:1.44	Mon Aug  1 11:20:27 2011
+++ src/sys/dev/cardbus/if_ath_cardbus.c	Fri Oct  7 20:47:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_cardbus.c,v 1.44 2011/08/01 11:20:27 drochner Exp $ */
+/*	$NetBSD: if_ath_cardbus.c,v 1.45 2011/10/07 20:47:42 dyoung Exp $ */
 /*
  * Copyright (c) 2003
  *	Ichiro FUKUHARA ich...@ichiro.org.
@@ -30,7 +30,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ath_cardbus.c,v 1.44 2011/08/01 11:20:27 drochner Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ath_cardbus.c,v 1.45 2011/10/07 20:47:42 dyoung Exp $);
 
 #include opt_inet.h
 
@@ -186,8 +186,6 @@ ath_cardbus_attach(device_t parent, devi
 	 */
 	ath_cardbus_setup(csc);
 
-	ATH_LOCK_INIT(sc);
-
 	/*
 	 * Finish off the attach.
 	 */
@@ -235,8 +233,6 @@ ath_cardbus_detach(device_t self, int fl
 	Cardbus_mapreg_unmap(ct, ATH_PCI_MMBA, csc-sc_iot, csc-sc_ioh,
 	csc-sc_mapsize);
 
-	ATH_LOCK_DESTROY(sc);
-
 	return (0);
 }
 

Index: src/sys/dev/pci/if_ath_pci.c
diff -u src/sys/dev/pci/if_ath_pci.c:1.43 src/sys/dev/pci/if_ath_pci.c:1.44
--- src/sys/dev/pci/if_ath_pci.c:1.43	Mon Aug 29 14:47:08 2011
+++ src/sys/dev/pci/if_ath_pci.c	Fri Oct  7 20:47:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_ath_pci.c,v 1.43 2011/08/29 14:47:08 jmcneill Exp $	*/
+/*	$NetBSD: if_ath_pci.c,v 1.44 2011/10/07 20:47:42 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
@@ -37,7 +37,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.43 2011/08/29 14:47:08 jmcneill Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_ath_pci.c,v 1.44 2011/10/07 20:47:42 dyoung Exp $);
 
 /*
  * PCI/Cardbus front-end for the Atheros Wireless LAN controller driver.
@@ -178,8 +178,6 @@ ath_pci_attach(device_t parent, device_t
 
 	aprint_verbose_dev(self, interrupting at %s\n, intrstr);
 
-	ATH_LOCK_INIT(sc);
-
 	if (ath_attach(PCI_PRODUCT(pa-pa_id), sc) != 0)
 		goto bad3;
 
@@ -190,8 +188,6 @@ ath_pci_attach(device_t parent, device_t
 		aprint_error_dev(self, couldn't establish power handler\n);
 	return;
 bad3:
-	ATH_LOCK_DESTROY(sc);
-
 	pci_intr_disestablish(pc, psc-sc_ih);
 bad1:
 	bus_space_unmap(psc-sc_iot, psc-sc_ioh, psc-sc_mapsz);
@@ -213,8 +209,6 @@ ath_pci_detach(device_t self, int flags)
 	if (psc-sc_ih != NULL)
 		pci_intr_disestablish(psc-sc_pc, psc-sc_ih);
 
-	ATH_LOCK_DESTROY(psc-sc_sc);
-
 	bus_space_unmap(psc-sc_iot, psc-sc_ioh, psc-sc_mapsz);
 	return 0;
 }



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:25:55 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
Make the 'size' argument of _bus_dmamap_load_busaddr() a bus_size_t for
consistency's sake.


To generate a diff of this commit:
cvs rdiff -u -r1.60 -r1.61 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.60 src/sys/arch/x86/x86/bus_dma.c:1.61
--- src/sys/arch/x86/x86/bus_dma.c:1.60	Tue Sep 13 17:59:46 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:25:55 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -168,7 +168,7 @@ static void _bus_dma_free_bouncebuf(bus_
 static int _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map,
 	void *buf, bus_size_t buflen, struct vmspace *vm, int flags);
 static inline int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
-bus_addr_t, int);
+bus_addr_t, bus_size_t);
 
 #ifndef _BUS_DMAMEM_ALLOC_RANGE
 static int	_bus_dmamem_alloc_range(bus_dma_tag_t tag, bus_size_t size,
@@ -436,7 +436,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 
 static inline int
 _bus_dmamap_load_busaddr(bus_dma_tag_t t, bus_dmamap_t map,
-bus_addr_t addr, int size)
+bus_addr_t addr, bus_size_t size)
 {
 	bus_dma_segment_t * const segs = map-dm_segs;
 	int nseg = map-dm_nsegs;



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:33:35 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
In _bus_dmamap_load_busaddr(), change sgsize from an int to a bus_size_t.


To generate a diff of this commit:
cvs rdiff -u -r1.61 -r1.62 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.61 src/sys/arch/x86/x86/bus_dma.c:1.62
--- src/sys/arch/x86/x86/bus_dma.c:1.61	Tue Sep 27 23:25:55 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:33:35 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.61 2011/09/27 23:25:55 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -442,7 +442,7 @@ _bus_dmamap_load_busaddr(bus_dma_tag_t t
 	int nseg = map-dm_nsegs;
 	bus_addr_t bmask = ~(map-_dm_boundary - 1);
 	bus_addr_t lastaddr = 0xdead; /* XXX gcc */
-	int sgsize;
+	bus_size_t sgsize;
 
 	if (nseg  0)
 		lastaddr = segs[nseg-1].ds_addr + segs[nseg-1].ds_len;



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 27 23:44:18 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
Instead of declaring _bus_dmamap_load_busaddr() static inline, make
it static and let the compiler decide about inlining.  This reduces
the code size on both amd64 and i386, and the smaller code is probably
faster code.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.62 src/sys/arch/x86/x86/bus_dma.c:1.63
--- src/sys/arch/x86/x86/bus_dma.c:1.62	Tue Sep 27 23:33:35 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 27 23:44:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.62 2011/09/27 23:33:35 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -167,7 +167,7 @@ static int _bus_dma_alloc_bouncebuf(bus_
 static void _bus_dma_free_bouncebuf(bus_dma_tag_t t, bus_dmamap_t map);
 static int _bus_dmamap_load_buffer(bus_dma_tag_t t, bus_dmamap_t map,
 	void *buf, bus_size_t buflen, struct vmspace *vm, int flags);
-static inline int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
+static int _bus_dmamap_load_busaddr(bus_dma_tag_t, bus_dmamap_t,
 bus_addr_t, bus_size_t);
 
 #ifndef _BUS_DMAMEM_ALLOC_RANGE
@@ -434,7 +434,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	return (0);
 }
 
-static inline int
+static int
 _bus_dmamap_load_busaddr(bus_dma_tag_t t, bus_dmamap_t map,
 bus_addr_t addr, bus_size_t size)
 {



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:33:26 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
Add an untested implementation of bus_dmamap_load_raw(9).


To generate a diff of this commit:
cvs rdiff -u -r1.63 -r1.64 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.63 src/sys/arch/x86/x86/bus_dma.c:1.64
--- src/sys/arch/x86/x86/bus_dma.c:1.63	Tue Sep 27 23:44:18 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:33:26 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.63 2011/09/27 23:44:18 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -716,11 +716,44 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
  */
 static int
 _bus_dmamap_load_raw(bus_dma_tag_t t, bus_dmamap_t map,
-bus_dma_segment_t *segs, int nsegs,
-bus_size_t size, int flags)
+bus_dma_segment_t *segs, int nsegs, bus_size_t size0, int flags)
 {
+	bus_size_t size;
+	int i, error = 0;
+
+	/*
+	 * Make sure that on error condition we return no valid mappings.
+	 */
+	map-dm_mapsize = 0;
+	map-dm_nsegs = 0;
+	KASSERT(map-dm_maxsegsz = map-_dm_maxmaxsegsz);
+
+	if (size0  map-_dm_size)
+		return EINVAL;
+
+	for (i = 0, size = size0; i  nsegs  size  0; i++) {
+		bus_dma_segment_t *ds = segs[i];
+		bus_size_t sgsize;
 
-	panic(_bus_dmamap_load_raw: not implemented);
+		sgsize = MIN(ds-ds_len, size);
+		if (sgsize == 0)
+			continue;
+		error = _bus_dmamap_load_busaddr(t, map, ds-ds_addr, sgsize);
+		if (error != 0)
+			break;
+		size -= sgsize;
+	}
+
+	if (error != 0) {
+		map-dm_mapsize = 0;
+		map-dm_nsegs = 0;
+		return error;
+	}
+
+	/* XXX TBD bounce */
+
+	map-dm_mapsize = size0;
+	return 0;
 }
 
 /*



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:35:58 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
In bus_dma_tag_create(9), copy important properties (e.g., bounce
parameters) from the parent tag.

In bus_dma_tag_create(), increase the reference count on a parent
bus_dma_tag_t (if applicable), and decrease the reference count in
bus_dma_tag_destroy().

Don't let bus_dmatag_destroy(9) destroy an overridden bus_dma_tag_t.


To generate a diff of this commit:
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.64 src/sys/arch/x86/x86/bus_dma.c:1.65
--- src/sys/arch/x86/x86/bus_dma.c:1.64	Wed Sep 28 01:33:26 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:35:58 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.64 2011/09/28 01:33:26 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -1623,6 +1623,8 @@ bit_to_function_pointer(const struct bus
 void
 bus_dma_tag_destroy(bus_dma_tag_t bdt)
 {
+	if (bdt-bdt_super != NULL)
+		bus_dmatag_destroy(bdt-bdt_super);
 	kmem_free(bdt, sizeof(struct x86_bus_dma_tag));
 }
 
@@ -1642,6 +1644,10 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
 	if (bdt == NULL)
 		return ENOMEM;
 
+	*bdt = *obdt;
+	/* don't let bus_dmatag_destroy free these */
+	bdt-_tag_needs_free = 0;
+
 	bdt-bdt_super = obdt;
 
 	for (bits = present; bits != 0; bits = nbits) {
@@ -1661,6 +1667,8 @@ bus_dma_tag_create(bus_dma_tag_t obdt, c
 	bdt-bdt_ctx = ctx;
 
 	*bdtp = bdt;
+	if (obdt-_tag_needs_free)
+		obdt-_tag_needs_free++;
 
 	return 0;
 einval:



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:38:19 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
After bouncing in bus_dmamap_load{,_mbuf,_uio}, call bus_dmamap_load(9)
instead of _bus_dmamap_load() so that a bus_dmamap_load(9) override has
a shot at loading the map.

XXX Perhaps bounce buffers should be rewritten in terms of bus_dma(9)
XXX overrides.


To generate a diff of this commit:
cvs rdiff -u -r1.65 -r1.66 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.65 src/sys/arch/x86/x86/bus_dma.c:1.66
--- src/sys/arch/x86/x86/bus_dma.c:1.65	Wed Sep 28 01:35:58 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:38:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.65 2011/09/28 01:35:58 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -424,7 +424,7 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 	cookie-id_origbuflen = buflen;
 	cookie-id_buftype = X86_DMA_BUFTYPE_LINEAR;
 	map-dm_nsegs = 0;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf, buflen,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf, buflen,
 	p, flags);
 	if (error)
 		return (error);
@@ -620,7 +620,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	cookie-id_origbuf = m0;
 	cookie-id_origbuflen = m0-m_pkthdr.len;	/* not really used */
 	cookie-id_buftype = X86_DMA_BUFTYPE_MBUF;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf,
 	m0-m_pkthdr.len, NULL, flags);
 	if (error)
 		return (error);
@@ -700,7 +700,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	cookie-id_origbuf = uio;
 	cookie-id_origbuflen = uio-uio_resid;
 	cookie-id_buftype = X86_DMA_BUFTYPE_UIO;
-	error = _bus_dmamap_load(t, map, cookie-id_bouncebuf,
+	error = bus_dmamap_load(t, map, cookie-id_bouncebuf,
 	uio-uio_resid, NULL, flags);
 	if (error)
 		return (error);



CVS commit: src/sys/arch/x86/x86

2011-09-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Sep 28 01:45:49 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
Cosmetic: join some if-statements, remove superfluous parentheses.  No
change in the generated assembly.


To generate a diff of this commit:
cvs rdiff -u -r1.66 -r1.67 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.66 src/sys/arch/x86/x86/bus_dma.c:1.67
--- src/sys/arch/x86/x86/bus_dma.c:1.66	Wed Sep 28 01:38:19 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Wed Sep 28 01:45:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.67 2011/09/28 01:45:49 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.66 2011/09/28 01:38:19 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.67 2011/09/28 01:45:49 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -395,12 +395,10 @@ _bus_dmamap_load(bus_dma_tag_t t, bus_dm
 		return 0;
 	}
 
-	if (cookie == NULL)
-		return error;
-	if ((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
+	if (cookie == NULL ||
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
-
 	/*
 	 * First attempt failed; bounce it.
 	 */
@@ -594,7 +592,7 @@ _bus_dmamap_load_mbuf(bus_dma_tag_t t, b
 	map-dm_nsegs = 0;
 
 	if (cookie == NULL ||
-	((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0))
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
 	/*
@@ -678,7 +676,7 @@ _bus_dmamap_load_uio(bus_dma_tag_t t, bu
 	map-dm_nsegs = 0;
 
 	if (cookie == NULL ||
-	((cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0))
+	(cookie-id_flags  X86_DMA_MIGHT_NEED_BOUNCE) == 0)
 		return error;
 
 	STAT_INCR(bounces);



CVS commit: src/sys/arch/x86/pci

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 17:58:43 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Bracket a debugging printf() with #ifdef DEBUG.


To generate a diff of this commit:
cvs rdiff -u -r1.50 -r1.51 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.50 src/sys/arch/x86/pci/pci_machdep.c:1.51
--- src/sys/arch/x86/pci/pci_machdep.c:1.50	Thu Sep  1 15:10:31 2011
+++ src/sys/arch/x86/pci/pci_machdep.c	Tue Sep 13 17:58:42 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.50 2011/09/01 15:10:31 christos Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.51 2011/09/13 17:58:42 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.50 2011/09/01 15:10:31 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.51 2011/09/13 17:58:42 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -783,7 +783,9 @@
 		nbits = bits  (bits - 1);
 		bit = nbits ^ bits;
 		if ((fp = bit_to_function_pointer(ov, bit)) == NULL) {
+#ifdef DEBUG
 			printf(%s: missing bit % PRIx64 \n, __func__, bit);
+#endif
 			goto einval;
 		}
 	}



CVS commit: src/sys/arch/x86/x86

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 17:59:46 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_dma.c

Log Message:
For consistency, call a bus_dma_tag_t bdt instead of bst.  No functional
change intended.


To generate a diff of this commit:
cvs rdiff -u -r1.59 -r1.60 src/sys/arch/x86/x86/bus_dma.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_dma.c
diff -u src/sys/arch/x86/x86/bus_dma.c:1.59 src/sys/arch/x86/x86/bus_dma.c:1.60
--- src/sys/arch/x86/x86/bus_dma.c:1.59	Thu Sep  1 15:10:31 2011
+++ src/sys/arch/x86/x86/bus_dma.c	Tue Sep 13 17:59:46 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_dma.c,v 1.59 2011/09/01 15:10:31 christos Exp $	*/
+/*	$NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2007 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.59 2011/09/01 15:10:31 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_dma.c,v 1.60 2011/09/13 17:59:46 dyoung Exp $);
 
 /*
  * The following is included because _bus_dma_uiomove is derived from
@@ -1588,9 +1588,9 @@
 }
 
 void
-bus_dma_tag_destroy(bus_dma_tag_t bst)
+bus_dma_tag_destroy(bus_dma_tag_t bdt)
 {
-	kmem_free(bst, sizeof(struct x86_bus_dma_tag));
+	kmem_free(bdt, sizeof(struct x86_bus_dma_tag));
 }
 
 int



CVS commit: src/common/lib/libppath

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 18:04:54 UTC 2011

Modified Files:
src/common/lib/libppath: ppath_bool.3

Log Message:
Name arguments in a couple of prototypes before the arguments are
referred to by name.


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/common/lib/libppath/ppath_bool.3

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

Modified files:

Index: src/common/lib/libppath/ppath_bool.3
diff -u src/common/lib/libppath/ppath_bool.3:1.3 src/common/lib/libppath/ppath_bool.3:1.4
--- src/common/lib/libppath/ppath_bool.3:1.3	Thu Aug 25 15:14:43 2011
+++ src/common/lib/libppath/ppath_bool.3	Tue Sep 13 18:04:54 2011
@@ -1,5 +1,5 @@
-.\	$NetBSD: ppath_bool.3,v 1.3 2011/08/25 15:14:43 wiz Exp $
-.\	$Id: ppath_bool.3,v 1.3 2011/08/25 15:14:43 wiz Exp $
+.\	$NetBSD: ppath_bool.3,v 1.4 2011/09/13 18:04:54 dyoung Exp $
+.\	$Id: ppath_bool.3,v 1.4 2011/09/13 18:04:54 dyoung Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -156,7 +156,7 @@
 .Fa o ,
 it creates a private copy of the property for
 .Fa *op .
-.It Fn ppath_set_bool prop_object_t const ppath_t * bool
+.It Fn ppath_set_bool prop_object_t o const ppath_t *p bool v
 Replace with
 .Fa v
 the
@@ -165,7 +165,7 @@
 .Fa o
 named by
 .Fa p .
-.It Fn ppath_get_bool prop_object_t const ppath_t * bool *
+.It Fn ppath_get_bool prop_object_t o const ppath_t *p bool *vp
 Retrieve the
 .Vt prop_bool_t
 named by



CVS commit: src/common/lib/libppath

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 18:05:20 UTC 2011

Modified Files:
src/common/lib/libppath: ppath_bool.3

Log Message:
Bump date for previous change.


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/common/lib/libppath/ppath_bool.3

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

Modified files:

Index: src/common/lib/libppath/ppath_bool.3
diff -u src/common/lib/libppath/ppath_bool.3:1.4 src/common/lib/libppath/ppath_bool.3:1.5
--- src/common/lib/libppath/ppath_bool.3:1.4	Tue Sep 13 18:04:54 2011
+++ src/common/lib/libppath/ppath_bool.3	Tue Sep 13 18:05:20 2011
@@ -1,5 +1,5 @@
-.\	$NetBSD: ppath_bool.3,v 1.4 2011/09/13 18:04:54 dyoung Exp $
-.\	$Id: ppath_bool.3,v 1.4 2011/09/13 18:04:54 dyoung Exp $
+.\	$NetBSD: ppath_bool.3,v 1.5 2011/09/13 18:05:20 dyoung Exp $
+.\	$Id: ppath_bool.3,v 1.5 2011/09/13 18:05:20 dyoung Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -28,7 +28,7 @@
 .\ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 24, 2011
+.Dd September 13, 2011
 .Dt PPATH_BOOL 3
 .Os
 .Sh NAME



CVS commit: src/common/lib/libppath

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 18:07:22 UTC 2011

Modified Files:
src/common/lib/libppath: ppath_number.3

Log Message:
Name arguments in a couple of prototypes before the arguments are
referred to by name.  Bump date.


To generate a diff of this commit:
cvs rdiff -u -r1.2 -r1.3 src/common/lib/libppath/ppath_number.3

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

Modified files:

Index: src/common/lib/libppath/ppath_number.3
diff -u src/common/lib/libppath/ppath_number.3:1.2 src/common/lib/libppath/ppath_number.3:1.3
--- src/common/lib/libppath/ppath_number.3:1.2	Thu Aug 25 15:12:38 2011
+++ src/common/lib/libppath/ppath_number.3	Tue Sep 13 18:07:22 2011
@@ -1,5 +1,5 @@
-.\	$NetBSD: ppath_number.3,v 1.2 2011/08/25 15:12:38 wiz Exp $
-.\	$Id: ppath_number.3,v 1.2 2011/08/25 15:12:38 wiz Exp $
+.\	$NetBSD: ppath_number.3,v 1.3 2011/09/13 18:07:22 dyoung Exp $
+.\	$Id: ppath_number.3,v 1.3 2011/09/13 18:07:22 dyoung Exp $
 .\
 .\ Copyright (c) 2011 The NetBSD Foundation, Inc.
 .\ All rights reserved.
@@ -28,7 +28,7 @@
 .\ OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 .\ IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 .\
-.Dd August 24, 2011
+.Dd September 13, 2011
 .Dt PPATH_NUMBER 3
 .Os
 .Sh NAME
@@ -194,8 +194,8 @@
 .Fa o ,
 they create a private copy of the property for
 .Fa *op .
-.It Fn ppath_set_int64 prop_object_t const ppath_t * int64_t
-.It Fn ppath_set_uint64 prop_object_t const ppath_t * uint64_t
+.It Fn ppath_set_int64 prop_object_t o const ppath_t *p int64_t v
+.It Fn ppath_set_uint64 prop_object_t o const ppath_t * uint64_t v
 Replace with
 .Fa v
 the
@@ -204,8 +204,8 @@
 .Fa o
 named by
 .Fa p .
-.It Fn ppath_get_int64 prop_object_t const ppath_t * int64_t *
-.It Fn ppath_get_uint64 prop_object_t const ppath_t * uint64_t *
+.It Fn ppath_get_int64 prop_object_t o const ppath_t *p int64_t *vp
+.It Fn ppath_get_uint64 prop_object_t o const ppath_t *p uint64_t *vp
 Retrieve the
 .Vt prop_number_t
 named by



CVS commit: src/sys/arch/x86/pci

2011-09-13 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Tue Sep 13 18:09:52 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_ranges.c

Log Message:
Clean up a bit: delete #if 1 and its corresponding #endif.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/pci/pci_ranges.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_ranges.c
diff -u src/sys/arch/x86/pci/pci_ranges.c:1.1 src/sys/arch/x86/pci/pci_ranges.c:1.2
--- src/sys/arch/x86/pci/pci_ranges.c:1.1	Mon Aug 29 22:46:04 2011
+++ src/sys/arch/x86/pci/pci_ranges.c	Tue Sep 13 18:09:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_ranges.c,v 1.1 2011/08/29 22:46:04 dyoung Exp $	*/
+/*	$NetBSD: pci_ranges.c,v 1.2 2011/09/13 18:09:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2011 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
 
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_ranges.c,v 1.1 2011/08/29 22:46:04 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_ranges.c,v 1.2 2011/09/13 18:09:52 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -120,7 +120,6 @@
 	bus_addr_t		ric_io_top;
 };
 
-#if 1
 static bool
 io_range_extend(struct range_infer_ctx *ric, const pci_alloc_t *pal)
 {
@@ -371,7 +370,6 @@
 		bus, dev, fun);
 	}
 }
-#endif
 
 static bool
 mmio_range_extend(struct range_infer_ctx *ric, const pci_alloc_t *pal)



CVS commit: src/share/man/man9

2011-09-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep  2 22:07:33 UTC 2011

Modified Files:
src/share/man/man9: vmem.9

Log Message:
Update vmem(9).  Changes to the implementation and usage are following,
soon.


To generate a diff of this commit:
cvs rdiff -u -r1.11 -r1.12 src/share/man/man9/vmem.9

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

Modified files:

Index: src/share/man/man9/vmem.9
diff -u src/share/man/man9/vmem.9:1.11 src/share/man/man9/vmem.9:1.12
--- src/share/man/man9/vmem.9:1.11	Tue Aug 23 22:14:51 2011
+++ src/share/man/man9/vmem.9	Fri Sep  2 22:07:33 2011
@@ -1,4 +1,4 @@
-.\	$NetBSD: vmem.9,v 1.11 2011/08/23 22:14:51 wiz Exp $
+.\	$NetBSD: vmem.9,v 1.12 2011/09/02 22:07:33 dyoung Exp $
 .\
 .\ Copyright (c)2006 YAMAMOTO Takashi,
 .\ All rights reserved.
@@ -25,7 +25,7 @@
 .\ SUCH DAMAGE.
 .\
 .\ 
-.Dd August 23, 2011
+.Dd September 2, 2011
 .Dt VMEM 9
 .Os
 .\ 
@@ -39,25 +39,25 @@
 .Ft vmem_t *
 .Fn vmem_create \
 const char *name vmem_addr_t base vmem_size_t size vmem_size_t quantum \
-vmem_addr_t (*allocfn)(vmem_t *, vmem_size_t, vmem_size_t *, vm_flag_t) \
-void (*freefn)(vmem_t *, vmem_addr_t, vmem_size_t) \
-vmem_t *source vmem_size_t qcache_max vm_flag_t flags int ipl
+int (*allocfn)(void *, vmem_size_t, vmem_size_t *, vm_flag_t, vmem_addr_t *) \
+void (*freefn)(void *, vmem_addr_t, vmem_size_t) \
+void *arg vmem_size_t qcache_max vm_flag_t flags int ipl
 .\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-.Ft vmem_addr_t
+.Ft int
 .Fn vmem_add \
-vmem_t *vm vmem_addr_t addr vmem_size_t size vm_flag_t flags
+vmem_t *vm vmem_addr_t addr vmem_size_t size vm_flag_t flags vmem_addr_t *addrp
 .\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-.Ft vmem_addr_t
+.Ft int
 .Fn vmem_xalloc \
 vmem_t *vm vmem_size_t size vmem_size_t align \
 vmem_size_t phase vmem_size_t nocross vmem_addr_t minaddr \
-vmem_addr_t maxaddr vm_flag_t flags
+vmem_addr_t maxaddr vm_flag_t flags vmem_addr_t *addrp
 .\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 .Ft void
 .Fn vmem_xfree vmem_t *vm vmem_addr_t addr vmem_size_t size
 .\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-.Ft vmem_addr_t
-.Fn vmem_alloc vmem_t *vm vmem_size_t size vm_flag_t flags
+.Ft int
+.Fn vmem_alloc vmem_t *vm vmem_size_t size vm_flag_t flags vmem_addr_t *addrp
 .\ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 .Ft void
 .Fn vmem_free vmem_t *vm vmem_addr_t addr vmem_size_t size
@@ -81,11 +81,14 @@
 The string to describe the vmem.
 .It Fa base
 The start address of the initial span.
-It can be
-.Dv VMEM_ADDR_NULL
+Pass
+.Dv 0
 if no initial span is required.
 .It Fa size
 The size of the initial span.
+Pass
+.Dv 0
+if no initial span is required.
 .It Fa quantum
 The smallest unit of allocation.
 .It Fa allocfn
@@ -100,10 +103,11 @@
 .Nm
 calls
 .Fo (*allocfn)
-.Fa source
+.Fa arg
 .Fa size
 .Fa \*[Am]actualsize
 .Fa flags
+.Fa \*[Am]addrp
 .Fc
 to import a span of size at least
 .Fa size .
@@ -114,42 +118,43 @@
 .Fn vmem_alloc .
 .Fa allocfn
 must return
-.Dv VMEM_ADDR_NULL
-to indicate failure, or
-else the starting address of the imported span.
+.Dv ENOMEM
+to indicate failure, or 0 on success.
 If
 .Fa allocfn
 succeeds, it must write the actual size of the allocation to
-.Fa actualsize .
+.Fa actualsize
+and the starting address of the imported span to
+.Fa addrp .
 The actual size will always be greater than or equal to the requested size.
 .It Fa freefn
 The callback function used to free spans to the backend arena.
 .Fa freefn
-may not be
+may be
 .Dv NULL
-unless
+even if
 .Fa allocfn
-is
+is not
 .Dv NULL .
 .Nm
 calls
-.Fn (*freefn) source addr size
+.Fn (*freefn) arg addr size
 to return to
-.Fa source
+.Fa arg
 a span of size
 .Fa size ,
 starting at
 .Fa addr ,
 that was previously allocated by
 .Fa allocfn .
-.It Fa source
+.It Fa arg
 The backend arena.
-.Fa source
+.Fa arg
 may be
 .Dv NULL .
 .Nm
 passes
-.Fa source
+.Fa arg
 as the first argument of
 .Fa allocfn
 and
@@ -180,8 +185,10 @@
 .Fa addr
 to the arena.
 Returns
-.Fa addr
-on success.
+0
+on success,
+.Dv ENOMEM
+on failure.
 .Fa flags
 should be one of:
 .Bl -tag -width VM_NOSLEEP
@@ -190,7 +197,7 @@
 .It Dv VM_NOSLEEP
 Don't sleep.
 Immediately return
-.Dv VMEM_ADDR_NULL
+.Dv ENOMEM
 if there are not enough resources available.
 .El
 .Pp
@@ -253,9 +260,16 @@
 .It Dv VM_NOSLEEP
 Don't sleep.
 Immediately return
-.Dv VMEM_ADDR_NULL
+.Dv ENOMEM
 if there are not enough resources available.
 .El
+.It Fa addrp
+On success, if
+.Fa addrp
+is not 
+.Dv NULL ,
+.Fn vmem_xalloc
+overwrites it with the start address of the allocated span.
 .El
 .Pp
 .\ 
@@ -309,9 +323,16 @@
 .It Dv VM_NOSLEEP
 Don't sleep.
 Immediately return
-.Dv 

CVS commit: src/sys/arch/i386

2011-09-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep  2 22:12:48 UTC 2011

Modified Files:
src/sys/arch/i386: Makefile

Log Message:
In the tags target, move x86 sources above xen includes, for more
helpful tags.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/arch/i386/Makefile

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

Modified files:

Index: src/sys/arch/i386/Makefile
diff -u src/sys/arch/i386/Makefile:1.41 src/sys/arch/i386/Makefile:1.42
--- src/sys/arch/i386/Makefile:1.41	Tue May 10 23:58:25 2011
+++ src/sys/arch/i386/Makefile	Fri Sep  2 22:12:48 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.41 2011/05/10 23:58:25 dyoung Exp $
+#	$NetBSD: Makefile,v 1.42 2011/09/02 22:12:48 dyoung Exp $
 
 # Makefile for i386 tags file and boot blocks
 
@@ -18,12 +18,12 @@
 	${SYSDIR}/arch/x86/acpi/*.[ch] \
 	${SYSDIR}/arch/x86/include/*.h \
 	${SYSDIR}/arch/x86/isa/*.[ch] \
+	${SYSDIR}/arch/x86/pci/*.[ch] \
 	${SYSDIR}/arch/xen/include/*.h \
 	${SYSDIR}/arch/xen/i386/*.[ch] \
 	${SYSDIR}/arch/xen/x86/*.[ch] \
 	${SYSDIR}/arch/xen/xen/*.[ch] \
-	${SYSDIR}/arch/xen/xenbus/*.[ch] \
-	${SYSDIR}/arch/x86/pci/*.[ch]
+	${SYSDIR}/arch/xen/xenbus/*.[ch]
 AI386=	${SYSDIR}/arch/i386/i386/*.S \
 	${SYSDIR}/../common/lib/libc/arch/i386/*/*.S
 



CVS commit: src/sys/kern

2011-09-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep  2 22:15:16 UTC 2011

Modified Files:
src/sys/kern: Makefile

Log Message:
Add a target, subr_vmem, for building the vmem(9) test program.


To generate a diff of this commit:
cvs rdiff -u -r1.15 -r1.16 src/sys/kern/Makefile

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

Modified files:

Index: src/sys/kern/Makefile
diff -u src/sys/kern/Makefile:1.15 src/sys/kern/Makefile:1.16
--- src/sys/kern/Makefile:1.15	Sat Oct 25 22:35:36 2008
+++ src/sys/kern/Makefile	Fri Sep  2 22:15:16 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: Makefile,v 1.15 2008/10/25 22:35:36 apb Exp $
+#	$NetBSD: Makefile,v 1.16 2011/09/02 22:15:16 dyoung Exp $
 #
 #	from: @(#)Makefile	8.2 (Berkeley) 3/21/94
 
@@ -18,6 +18,8 @@
 vnode_if.c ../sys/vnode_if.h: ${VNODEIFSRC}
 	${HOST_SH} vnode_if.sh vnode_if.src
 
+subr_vmem: subr_vmem.c
+	$(CC) -DVMEM_SANITY -g -Wall -o subr_vmem subr_vmem.c
 
 # Kernel tags:
 # Tags files are built in the top-level directory for each architecture,



CVS commit: src/sys

2011-09-02 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Sep  2 22:25:09 UTC 2011

Modified Files:
src/sys/arch/xen/x86: xen_shm_machdep.c
src/sys/kern: subr_kmem.c subr_percpu.c subr_vmem.c
src/sys/rump/net/lib/libshmif: if_shmem.c
src/sys/sys: vmem.h
src/sys/uvm: uvm_emap.c uvm_swap.c

Log Message:
Report vmem(9) errors out-of-band so that we can use vmem(9) to manage
ranges that include the least and the greatest vmem_addr_t.  Update
vmem(9) uses throughout the kernel.  Slightly expand on the tests in
subr_vmem.c, which still pass.  I've been running a kernel with this
patch without any trouble.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/sys/arch/xen/x86/xen_shm_machdep.c
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/subr_kmem.c
cvs rdiff -u -r1.14 -r1.15 src/sys/kern/subr_percpu.c
cvs rdiff -u -r1.60 -r1.61 src/sys/kern/subr_vmem.c
cvs rdiff -u -r1.42 -r1.43 src/sys/rump/net/lib/libshmif/if_shmem.c
cvs rdiff -u -r1.13 -r1.14 src/sys/sys/vmem.h
cvs rdiff -u -r1.7 -r1.8 src/sys/uvm/uvm_emap.c
cvs rdiff -u -r1.156 -r1.157 src/sys/uvm/uvm_swap.c

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

Modified files:

Index: src/sys/arch/xen/x86/xen_shm_machdep.c
diff -u src/sys/arch/xen/x86/xen_shm_machdep.c:1.9 src/sys/arch/xen/x86/xen_shm_machdep.c:1.10
--- src/sys/arch/xen/x86/xen_shm_machdep.c:1.9	Sun Jul 31 18:00:54 2011
+++ src/sys/arch/xen/x86/xen_shm_machdep.c	Fri Sep  2 22:25:08 2011
@@ -1,4 +1,4 @@
-/*  $NetBSD: xen_shm_machdep.c,v 1.9 2011/07/31 18:00:54 jym Exp $  */
+/*  $NetBSD: xen_shm_machdep.c,v 1.10 2011/09/02 22:25:08 dyoung Exp $  */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -26,7 +26,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: xen_shm_machdep.c,v 1.9 2011/07/31 18:00:54 jym Exp $);
+__KERNEL_RCSID(0, $NetBSD: xen_shm_machdep.c,v 1.10 2011/09/02 22:25:08 dyoung Exp $);
 
 
 #include sys/types.h
@@ -122,7 +122,7 @@
 {
 	int s, i;
 	vaddr_t new_va;
-	u_long new_va_pg;
+	vmem_addr_t new_va_pg;
 	int err;
 	gnttab_map_grant_ref_t op[XENSHM_MAX_PAGES_PER_REQUEST];
 
@@ -151,9 +151,8 @@
 		return ENOMEM;
 	}
 	/* allocate the needed virtual space */
-	new_va_pg = vmem_alloc(xen_shm_arena, nentries,
-	VM_INSTANTFIT | VM_NOSLEEP);
-	if (new_va_pg == 0) {
+	if (vmem_alloc(xen_shm_arena, nentries,
+	VM_INSTANTFIT | VM_NOSLEEP, new_va_pg) != 0) {
 #ifdef DEBUG
 		static struct timeval lasttime;
 #endif

Index: src/sys/kern/subr_kmem.c
diff -u src/sys/kern/subr_kmem.c:1.35 src/sys/kern/subr_kmem.c:1.36
--- src/sys/kern/subr_kmem.c:1.35	Sun Jul 17 20:54:52 2011
+++ src/sys/kern/subr_kmem.c	Fri Sep  2 22:25:08 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: subr_kmem.c,v 1.35 2011/07/17 20:54:52 joerg Exp $	*/
+/*	$NetBSD: subr_kmem.c,v 1.36 2011/09/02 22:25:08 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2009 The NetBSD Foundation, Inc.
@@ -63,7 +63,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.35 2011/07/17 20:54:52 joerg Exp $);
+__KERNEL_RCSID(0, $NetBSD: subr_kmem.c,v 1.36 2011/09/02 22:25:08 dyoung Exp $);
 
 #include sys/param.h
 #include sys/callback.h
@@ -133,9 +133,9 @@
 #define	kmem_size_check(p, sz)	/* nothing */
 #endif
 
-static vmem_addr_t kmem_backend_alloc(vmem_t *, vmem_size_t, vmem_size_t *,
-vm_flag_t);
-static void kmem_backend_free(vmem_t *, vmem_addr_t, vmem_size_t);
+static int kmem_backend_alloc(void *, vmem_size_t, vmem_size_t *,
+vm_flag_t, vmem_addr_t *);
+static void kmem_backend_free(void *, vmem_addr_t, vmem_size_t);
 static int kmem_kva_reclaim_callback(struct callback_entry *, void *, void *);
 
 CTASSERT(KM_SLEEP == PR_WAITOK);
@@ -163,9 +163,12 @@
 static void *
 kmem_poolpage_alloc(struct pool *pool, int prflags)
 {
+	vmem_addr_t addr;
+	int rc;
 
-	return (void *)vmem_alloc(kmem_arena, pool-pr_alloc-pa_pagesz,
-	kmf_to_vmf(prflags) | VM_INSTANTFIT);
+	rc = vmem_alloc(kmem_arena, pool-pr_alloc-pa_pagesz,
+	kmf_to_vmf(prflags) | VM_INSTANTFIT, addr);
+	return (rc == 0) ? (void *)addr : NULL;
 
 }
 
@@ -208,8 +211,13 @@
 		kmflags = (KM_SLEEP | KM_NOSLEEP);
 		p = pool_cache_get(kc-kc_cache, kmflags);
 	} else {
-		p = (void *)vmem_alloc(kmem_arena, size,
-		kmf_to_vmf(kmflags) | VM_INSTANTFIT);
+		vmem_addr_t addr;
+
+		if (vmem_alloc(kmem_arena, size,
+		kmf_to_vmf(kmflags) | VM_INSTANTFIT, addr) == 0)
+			p = (void *)addr;
+		else
+			p = NULL;
 	}
 	if (__predict_true(p != NULL)) {
 		kmem_poison_check(p, kmem_roundup_size(size));
@@ -335,9 +343,9 @@
 
 /*  uvm glue */
 
-static vmem_addr_t
-kmem_backend_alloc(vmem_t *dummy, vmem_size_t size, vmem_size_t *resultsize,
-vm_flag_t vmflags)
+static int
+kmem_backend_alloc(void *dummy, vmem_size_t size, vmem_size_t *resultsize,
+vm_flag_t vmflags, vmem_addr_t *addrp)
 {
 	uvm_flag_t uflags;
 	vaddr_t va;
@@ -355,14 +363,15 @@
 	*resultsize = size = round_page(size);
 	va = uvm_km_alloc(kernel_map, size, 

CVS commit: src/sys/sys

2011-08-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Aug 31 20:04:51 UTC 2011

Modified Files:
src/sys/sys: bus.h

Log Message:
Add some definitions for bus_dma(9) overrides.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/sys/bus.h

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

Modified files:

Index: src/sys/sys/bus.h
diff -u src/sys/sys/bus.h:1.8 src/sys/sys/bus.h:1.9
--- src/sys/sys/bus.h:1.8	Sat Aug 20 06:00:14 2011
+++ src/sys/sys/bus.h	Wed Aug 31 20:04:51 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus.h,v 1.8 2011/08/20 06:00:14 he Exp $	*/
+/*	$NetBSD: bus.h,v 1.9 2011/08/31 20:04:51 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007 The NetBSD Foundation, Inc.
@@ -79,6 +79,17 @@
 #endif
 };
 
+enum bus_dma_override_idx {
+	  BUS_DMAMAP_OVERRIDE_CREATE	= __BIT(0)
+	, BUS_DMAMAP_OVERRIDE_DESTROY	= __BIT(1)
+	, BUS_DMAMAP_OVERRIDE_LOAD	= __BIT(2)
+	, BUS_DMAMAP_OVERRIDE_LOAD_MBUF	= __BIT(3)
+	, BUS_DMAMAP_OVERRIDE_LOAD_UIO	= __BIT(4)
+	, BUS_DMAMAP_OVERRIDE_LOAD_RAW	= __BIT(5)
+	, BUS_DMAMAP_OVERRIDE_UNLOAD	= __BIT(6)
+	, BUS_DMAMAP_OVERRIDE_SYNC	= __BIT(7)
+};
+
 /* Only add new members at the end of this struct! */
 struct bus_space_overrides {
 	int (*ov_space_map)(void *, bus_space_tag_t, bus_addr_t, bus_size_t,
@@ -119,11 +130,36 @@
 #endif
 };
 
+struct mbuf;
+struct uio;
+
+/* Only add new members at the end of this struct! */
+struct bus_dma_overrides {
+	int (*ov_dmamap_create)(void *, bus_dma_tag_t, bus_size_t, int,
+	bus_size_t, bus_size_t, int, bus_dmamap_t *);
+	void (*ov_dmamap_destroy)(void *, bus_dma_tag_t, bus_dmamap_t);
+	int (*ov_dmamap_load)(void *, bus_dma_tag_t, bus_dmamap_t, void *,
+	bus_size_t, struct lwp *, int);
+	int (*ov_dmamap_load_mbuf)(void *, bus_dma_tag_t, bus_dmamap_t,
+	struct mbuf *, int);
+	int (*ov_dmamap_load_uio)(void *, bus_dma_tag_t, bus_dmamap_t,
+	struct uio *, int);
+	int (*ov_dmamap_load_raw)(void *, bus_dma_tag_t, bus_dmamap_t,
+	bus_dma_segment_t *, int, bus_size_t, int);
+	void (*ov_dmamap_unload)(void *, bus_dma_tag_t, bus_dmamap_t);
+	void (*ov_dmamap_sync)(void *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t,
+	bus_size_t, int);
+};
+
 int	bus_space_tag_create(bus_space_tag_t, uint64_t, uint64_t,
 	 const struct bus_space_overrides *, void *,
 	 bus_space_tag_t *);
 void	bus_space_tag_destroy(bus_space_tag_t);
 
+int bus_dma_tag_create(bus_dma_tag_t, uint64_t,
+const struct bus_dma_overrides *, void *, bus_dma_tag_t *);
+void bus_dma_tag_destroy(bus_dma_tag_t);
+
 /* Reserve a region of bus space.  Reserved bus space cannot be allocated
  * with bus_space_alloc().  Reserved space has not been bus_space_map()'d.
  */



CVS commit: src/sys/kern

2011-08-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Aug 31 20:09:57 UTC 2011

Modified Files:
src/sys/kern: kern_stub.c

Log Message:
Add stub implementations of bus_dma_tag_create()/bus_dma_tag_destroy().


To generate a diff of this commit:
cvs rdiff -u -r1.35 -r1.36 src/sys/kern/kern_stub.c

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

Modified files:

Index: src/sys/kern/kern_stub.c
diff -u src/sys/kern/kern_stub.c:1.35 src/sys/kern/kern_stub.c:1.36
--- src/sys/kern/kern_stub.c:1.35	Tue Aug 16 23:32:15 2011
+++ src/sys/kern/kern_stub.c	Wed Aug 31 20:09:57 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: kern_stub.c,v 1.35 2011/08/16 23:32:15 dyoung Exp $	*/
+/*	$NetBSD: kern_stub.c,v 1.36 2011/08/31 20:09:57 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc.
@@ -62,7 +62,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.35 2011/08/16 23:32:15 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: kern_stub.c,v 1.36 2011/08/31 20:09:57 dyoung Exp $);
 
 #include opt_ptrace.h
 #include opt_ktrace.h
@@ -136,6 +136,8 @@
 __weak_alias(bus_space_release, voidop);
 __weak_alias(bus_space_reservation_map, eopnotsupp);
 __weak_alias(bus_space_reservation_unmap, voidop);
+__weak_alias(bus_dma_tag_create, eopnotsupp);
+__weak_alias(bus_dma_tag_destroy, voidop);
 __weak_alias(bus_space_tag_create, eopnotsupp);
 __weak_alias(bus_space_tag_destroy, voidop);
 __strict_weak_alias(bus_space_is_equal, default_bus_space_is_equal);



CVS commit: src/sys/arch/x86/include

2011-08-31 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Wed Aug 31 20:21:06 UTC 2011

Modified Files:
src/sys/arch/x86/include: bus_private.h

Log Message:
Add override members to x86_bus_dma_tag.


To generate a diff of this commit:
cvs rdiff -u -r1.12 -r1.13 src/sys/arch/x86/include/bus_private.h

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

Modified files:

Index: src/sys/arch/x86/include/bus_private.h
diff -u src/sys/arch/x86/include/bus_private.h:1.12 src/sys/arch/x86/include/bus_private.h:1.13
--- src/sys/arch/x86/include/bus_private.h:1.12	Fri Nov 12 13:40:11 2010
+++ src/sys/arch/x86/include/bus_private.h	Wed Aug 31 20:21:06 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_private.h,v 1.12 2010/11/12 13:40:11 uebayasi Exp $	*/
+/*	$NetBSD: bus_private.h,v 1.13 2011/08/31 20:21:06 dyoung Exp $	*/
 /*	NetBSD: bus.h,v 1.8 2005/03/09 19:04:46 matt Exp	*/
 
 /*-
@@ -192,6 +192,15 @@
 #endif
 
 struct x86_bus_dma_tag {
+	bus_dma_tag_tbdt_super;
+	/* bdt_present: bitmap indicating overrides present (1) in *this* tag,
+	 * bdt_exists: bitmap indicating overrides present (1) in *this* tag
+	 * or in an ancestor's tag (follow bdt_super to ancestors)
+	 */
+	uint64_tbdt_present;
+	uint64_tbdt_exists;
+	const struct bus_dma_overrides		*bdt_ov;
+	void	*bdt_ctx;
 	/*
 	 * The `bounce threshold' is checked while we are loading
 	 * the DMA map.  If the physical address of the segment



CVS commit: src/sys/arch/x86/pci

2011-08-29 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Aug 29 22:41:52 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_intr_machdep.c

Log Message:
Use a loop instead of tail-recursion for the pci_intr(9) overrides.
This is the same change that I just made to the pci(9) overrides.  While
I am here, fix a bug: use PCI_OVERRIDE_INTR_DISESTABLISH instead of
PCI_OVERRIDE_INTR_ESTABLISH for the pci_intr_disestablish(9) override.


To generate a diff of this commit:
cvs rdiff -u -r1.22 -r1.23 src/sys/arch/x86/pci/pci_intr_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_intr_machdep.c
diff -u src/sys/arch/x86/pci/pci_intr_machdep.c:1.22 src/sys/arch/x86/pci/pci_intr_machdep.c:1.23
--- src/sys/arch/x86/pci/pci_intr_machdep.c:1.22	Wed Aug 17 14:56:55 2011
+++ src/sys/arch/x86/pci/pci_intr_machdep.c	Mon Aug 29 22:41:52 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_intr_machdep.c,v 1.22 2011/08/17 14:56:55 dyoung Exp $	*/
+/*	$NetBSD: pci_intr_machdep.c,v 1.23 2011/08/29 22:41:52 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998, 2009 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_intr_machdep.c,v 1.22 2011/08/17 14:56:55 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_intr_machdep.c,v 1.23 2011/08/29 22:41:52 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -115,20 +115,16 @@
 {
 	int pin = pa-pa_intrpin;
 	int line = pa-pa_intrline;
-	pci_chipset_tag_t pc;
+	pci_chipset_tag_t ipc, pc = pa-pa_pc;
 #if NIOAPIC  0 || NACPICA  0
 	int rawpin = pa-pa_rawintrpin;
 	int bus, dev, func;
 #endif
 
-	if ((pc = pa-pa_pc) != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_INTR_MAP) != 0)
-			return (*pc-pc_ov-ov_intr_map)(pc-pc_ctx, pa, ihp);
-		if (pc-pc_super != NULL) {
-			struct pci_attach_args paclone = *pa;
-			paclone.pa_pc = pc-pc_super;
-			return pci_intr_map(paclone, ihp);
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_INTR_MAP) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_intr_map)(ipc-pc_ctx, pa, ihp);
 	}
 
 	if (pin == 0) {
@@ -217,12 +213,12 @@
 const char *
 pci_intr_string(pci_chipset_tag_t pc, pci_intr_handle_t ih)
 {
+	pci_chipset_tag_t ipc;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_INTR_STRING) != 0)
-			return (*pc-pc_ov-ov_intr_string)(pc-pc_ctx, pc, ih);
-		if (pc-pc_super != NULL)
-			return pci_intr_string(pc-pc_super, ih);
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_INTR_STRING) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_intr_string)(ipc-pc_ctx, pc, ih);
 	}
 
 	return intr_string(ih  ~MPSAFE_MASK);
@@ -232,12 +228,12 @@
 const struct evcnt *
 pci_intr_evcnt(pci_chipset_tag_t pc, pci_intr_handle_t ih)
 {
+	pci_chipset_tag_t ipc;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_INTR_EVCNT) != 0)
-			return (*pc-pc_ov-ov_intr_evcnt)(pc-pc_ctx, pc, ih);
-		if (pc-pc_super != NULL)
-			return pci_intr_evcnt(pc-pc_super, ih);
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_INTR_EVCNT) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_intr_evcnt)(ipc-pc_ctx, pc, ih);
 	}
 
 	/* XXX for now, no evcnt parent reported */
@@ -273,16 +269,13 @@
 	struct ioapic_softc *ioapic;
 #endif
 	bool mpsafe;
+	pci_chipset_tag_t ipc;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_INTR_ESTABLISH) != 0) {
-			return (*pc-pc_ov-ov_intr_establish)(pc-pc_ctx,
-			pc, ih, level, func, arg);
-		}
-		if (pc-pc_super != NULL) {
-			return pci_intr_establish(pc-pc_super, ih, level, func,
-			arg);
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_INTR_ESTABLISH) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_intr_establish)(ipc-pc_ctx,
+		pc, ih, level, func, arg);
 	}
 
 	pic = i8259_pic;
@@ -312,17 +305,13 @@
 void
 pci_intr_disestablish(pci_chipset_tag_t pc, void *cookie)
 {
+	pci_chipset_tag_t ipc;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_INTR_ESTABLISH) != 0) {
-			(*pc-pc_ov-ov_intr_disestablish)(pc-pc_ctx,
-			pc, cookie);
-			return;
-		}
-		if (pc-pc_super != NULL) {
-			pci_intr_disestablish(pc-pc_super, cookie);
-			return;
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_INTR_DISESTABLISH) == 0)
+			continue;
+		(*ipc-pc_ov-ov_intr_disestablish)(ipc-pc_ctx, pc, cookie);
+		return;
 	}
 
 	intr_disestablish(cookie);



CVS commit: src/sys/arch/x86/pci

2011-08-29 Thread David Young
, ric.ric_mmio_bottom) ||
-	!prop_dictionary_set_uint64(memdict, size,
-	 ric.ric_mmio_top - ric.ric_mmio_bottom)) {
-		aprint_error(%s: could not record PCI memory min  max\n,
-		__func__);
-	} else if ((iodict = prop_dictionary_create()) == NULL) {
-		aprint_error(%s: could not create PCI I/O 
-		resources dictionary\n, __func__);
-	} else if ((iorsvns = prop_array_create()) == NULL) {
-		aprint_error(%s: could not create PCI BIOS I/O 
-		reservations array\n, __func__);
-	} else if (!prop_dictionary_set(iodict, bios-reservations,
-	iorsvns)) {
-		aprint_error(%s: could not record PCI BIOS I/O 
-		reservations array\n, __func__);
-	} else if (!pci_range_record(pc, iorsvns, ric.ric_pals,
-	PCI_ALLOC_SPACE_IO)) {
-		aprint_error(%s: could not record PCI BIOS I/O 
-		reservations\n, __func__);
-	} else if (!prop_dictionary_set_uint64(iodict,
-	start, ric.ric_io_bottom) ||
-	!prop_dictionary_set_uint64(iodict, size,
-	 ric.ric_io_top - ric.ric_io_bottom)) {
-		aprint_error(%s: could not record PCI I/O min  max\n,
-		__func__);
-	} else if ((pci_rsrc_dict = prop_dictionary_create()) == NULL) {
-		aprint_error(%s: could not create PCI resources dictionary\n,
-		__func__);
-	} else if (!prop_dictionary_set(pci_rsrc_dict, memory, memdict) ||
-	   !prop_dictionary_set(pci_rsrc_dict, io, iodict)) {
-		aprint_error(%s: could not record PCI memory- or I/O-
-		resources dictionary\n, __func__);
-		prop_object_release(pci_rsrc_dict);
-		pci_rsrc_dict = NULL;
-	}
-
-	if (iodict != NULL)
-		prop_object_release(iodict);
-	if (memdict != NULL)
-		prop_object_release(memdict);
-	/* XXX release iorsvns, memrsvns */
-}
-
 static void
 pci_bridge_hook(pci_chipset_tag_t pc, pcitag_t tag, void *ctx)
 {

Added files:

Index: src/sys/arch/x86/pci/pci_ranges.c
diff -u /dev/null src/sys/arch/x86/pci/pci_ranges.c:1.1
--- /dev/null	Mon Aug 29 22:46:04 2011
+++ src/sys/arch/x86/pci/pci_ranges.c	Mon Aug 29 22:46:04 2011
@@ -0,0 +1,960 @@
+/*	$NetBSD: pci_ranges.c,v 1.1 2011/08/29 22:46:04 dyoung Exp $	*/
+
+/*-
+ * Copyright (c) 2011 The NetBSD Foundation, Inc.
+ * All rights reserved.
+ *
+ * This code is derived from software contributed to The NetBSD Foundation
+ * by David Young dyo...@netbsd.org.
+ *
+ * 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 NETBSD FOUNDATION, INC. 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 FOUNDATION OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+
+#include sys/cdefs.h
+__KERNEL_RCSID(0, $NetBSD: pci_ranges.c,v 1.1 2011/08/29 22:46:04 dyoung Exp $);
+
+#include sys/types.h
+#include sys/param.h
+#include sys/systm.h
+#include sys/errno.h
+#include sys/bus.h
+#include sys/kmem.h
+
+#include prop/proplib.h
+#include ppath/ppath.h
+
+#include dev/pci/pcivar.h
+#include dev/pci/pcireg.h
+#include dev/pci/pccbbreg.h
+
+typedef enum pci_alloc_regtype {
+	  PCI_ALLOC_REGTYPE_NONE = 0
+	, PCI_ALLOC_REGTYPE_BAR = 1
+	, PCI_ALLOC_REGTYPE_WIN = 2
+	, PCI_ALLOC_REGTYPE_CBWIN = 3
+	, PCI_ALLOC_REGTYPE_VGA_EN = 4
+} pci_alloc_regtype_t;
+
+typedef enum pci_alloc_space {
+	  PCI_ALLOC_SPACE_IO = 0
+	, PCI_ALLOC_SPACE_MEM = 1
+} pci_alloc_space_t;
+
+typedef enum pci_alloc_flags {
+	  PCI_ALLOC_F_PREFETCHABLE = 0x1
+} pci_alloc_flags_t;
+
+typedef struct pci_alloc {
+	TAILQ_ENTRY(pci_alloc)		pal_link;
+	pcitag_t			pal_tag;
+	uint64_t			pal_addr;
+	uint64_t			pal_size;
+	pci_alloc_regtype_t		pal_type;
+	struct pci_alloc_reg {
+		int			r_ofs;
+		pcireg_t		r_val;
+		pcireg_t		r_mask;
+	}pal_reg[3];
+	pci_alloc_space_t		pal_space;
+	pci_alloc_flags_t		pal_flags;
+} pci_alloc_t;
+
+typedef struct pci_alloc_reg pci_alloc_reg_t;
+
+TAILQ_HEAD(pci_alloc_list, pci_alloc);
+
+typedef struct pci_alloc_list pci_alloc_list_t;
+
+static pci_alloc_t *
+pci_alloc_dup(const pci_alloc_t *pal)
+{
+	pci_alloc_t *npal;
+
+	if ((npal = kmem_alloc

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

2011-08-29 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Mon Aug 29 22:46:56 UTC 2011

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

Log Message:
Add pci_ranges.c to the set of files compiled when 'pci' is configured.


To generate a diff of this commit:
cvs rdiff -u -r1.71 -r1.72 src/sys/arch/x86/conf/files.x86

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

Modified files:

Index: src/sys/arch/x86/conf/files.x86
diff -u src/sys/arch/x86/conf/files.x86:1.71 src/sys/arch/x86/conf/files.x86:1.72
--- src/sys/arch/x86/conf/files.x86:1.71	Sun Jun 12 11:31:31 2011
+++ src/sys/arch/x86/conf/files.x86	Mon Aug 29 22:46:56 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: files.x86,v 1.71 2011/06/12 11:31:31 jruoho Exp $
+#	$NetBSD: files.x86,v 1.72 2011/08/29 22:46:56 dyoung Exp $
 
 # options for MP configuration through the MP spec
 defflag opt_mpbios.h MPBIOS MPVERBOSE MPDEBUG MPBIOS_SCANPCI
@@ -125,6 +125,7 @@
 file	arch/x86/x86/tprof_amdpmi.c	tprof_amdpmi
 
 file	arch/x86/pci/pci_machdep.c	pci
+file	arch/x86/pci/pci_ranges.c	pci
 file	arch/x86/pci/pci_intr_machdep.c	pci
 
 file	arch/x86/pci/pciide_machdep.c	pciide_common



CVS commit: src/sys/arch/x86

2011-08-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Aug 28 06:04:18 UTC 2011

Modified Files:
src/sys/arch/x86/include: pci_machdep_common.h
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Add some code for grovelling in the PCI configuration space for all
of the memory  I/O space reserved by the PCI BIOS for PCI devices
(including bridges) and recording that information for later use.

The code takes between 13k and 50k (depends on the architecture and,
bizarrely, the kernel configuration) so I am going to move it from
pci_machdep.c into its own module on Monday.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/include/pci_machdep_common.h
cvs rdiff -u -r1.47 -r1.48 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/include/pci_machdep_common.h
diff -u src/sys/arch/x86/include/pci_machdep_common.h:1.7 src/sys/arch/x86/include/pci_machdep_common.h:1.8
--- src/sys/arch/x86/include/pci_machdep_common.h:1.7	Mon Aug  1 11:08:03 2011
+++ src/sys/arch/x86/include/pci_machdep_common.h	Sun Aug 28 06:04:17 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep_common.h,v 1.7 2011/08/01 11:08:03 drochner Exp $	*/
+/*	$NetBSD: pci_machdep_common.h,v 1.8 2011/08/28 06:04:17 dyoung Exp $	*/
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
@@ -140,7 +140,11 @@
 void pci_bridge_foreach(pci_chipset_tag_t, int, int,
 	void (*) (pci_chipset_tag_t, pcitag_t, void *), void *);
 
-void pci_mmio_range_infer(pci_chipset_tag_t, int, int, bus_addr_t *,
-bus_size_t *);
+void pci_ranges_infer(pci_chipset_tag_t, int, int, bus_addr_t *,
+bus_size_t *, bus_addr_t *, bus_size_t *);
+
+extern prop_dictionary_t pci_rsrc_dict;
+prop_dictionary_t pci_rsrc_filter(prop_dictionary_t,
+bool (*)(void *, prop_dictionary_t), void *arg);
 
 #endif /* _X86_PCI_MACHDEP_COMMON_H_ */

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.47 src/sys/arch/x86/pci/pci_machdep.c:1.48
--- src/sys/arch/x86/pci/pci_machdep.c:1.47	Sun Aug 28 04:59:37 2011
+++ src/sys/arch/x86/pci/pci_machdep.c	Sun Aug 28 06:04:18 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.48 2011/08/28 06:04:18 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.48 2011/08/28 06:04:18 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -85,6 +85,9 @@
 #include sys/cpu.h
 #include sys/kmem.h
 
+#include prop/proplib.h
+#include ppath/ppath.h
+
 #include uvm/uvm_extern.h
 
 #include machine/bus_private.h
@@ -750,6 +753,918 @@
 		bridge_hook);  
 }
 
+typedef enum pci_alloc_regtype {
+	  PCI_ALLOC_REGTYPE_NONE = 0
+	, PCI_ALLOC_REGTYPE_BAR = 1
+	, PCI_ALLOC_REGTYPE_WIN = 2
+	, PCI_ALLOC_REGTYPE_CBWIN = 3
+	, PCI_ALLOC_REGTYPE_VGA_EN = 4
+} pci_alloc_regtype_t;
+
+typedef enum pci_alloc_space {
+	  PCI_ALLOC_SPACE_IO = 0
+	, PCI_ALLOC_SPACE_MEM = 1
+} pci_alloc_space_t;
+
+typedef enum pci_alloc_flags {
+	  PCI_ALLOC_F_PREFETCHABLE = 0x1
+} pci_alloc_flags_t;
+
+typedef struct pci_alloc {
+	TAILQ_ENTRY(pci_alloc)		pal_link;
+	pcitag_t			pal_tag;
+	uint64_t			pal_addr;
+	uint64_t			pal_size;
+	pci_alloc_regtype_t		pal_type;
+	struct pci_alloc_reg {
+		int			r_ofs;
+		pcireg_t		r_val;
+		pcireg_t		r_mask;
+	}pal_reg[3];
+	pci_alloc_space_t		pal_space;
+	pci_alloc_flags_t		pal_flags;
+} pci_alloc_t;
+
+typedef struct pci_alloc_reg pci_alloc_reg_t;
+
+TAILQ_HEAD(pci_alloc_list, pci_alloc);
+
+typedef struct pci_alloc_list pci_alloc_list_t;
+
+static pci_alloc_t *
+pci_alloc_dup(const pci_alloc_t *pal)
+{
+	pci_alloc_t *npal;
+
+	if ((npal = kmem_alloc(sizeof(*npal), KM_SLEEP)) == NULL)
+		return NULL;
+
+	*npal = *pal;
+
+	return npal;
+}
+
+static bool
+pci_alloc_linkdup(pci_alloc_list_t *pals, const pci_alloc_t *pal)
+{
+	pci_alloc_t *npal;
+
+	if ((npal = pci_alloc_dup(pal)) == NULL)
+		return false;
+	
+	TAILQ_INSERT_TAIL(pals, npal, pal_link);
+
+	return true;
+}
+ 
+struct range_infer_ctx {
+	pci_chipset_tag_t	ric_pc;
+	pci_alloc_list_t	ric_pals;
+	bus_addr_t		ric_mmio_bottom;
+	bus_addr_t		ric_mmio_top;
+	bus_addr_t		ric_io_bottom;
+	bus_addr_t		ric_io_top;
+};
+
+#if 1
+static bool
+io_range_extend(struct range_infer_ctx *ric, const pci_alloc_t *pal)
+{
+	if (ric-ric_io_bottom  pal-pal_addr)
+		ric-ric_io_bottom = pal-pal_addr;
+	if (ric-ric_io_top  pal-pal_addr + pal-pal_size)
+		ric-ric_io_top = pal-pal_addr + pal-pal_size;
+
+	return pci_alloc_linkdup(ric-ric_pals, pal);
+}
+
+static bool
+io_range_extend_by_bar(struct range_infer_ctx *ric, int bus, int dev, int fun,
+int ofs, pcireg_t curbar, pcireg_t sizebar)
+{
+	pci_alloc_reg_t 

CVS commit: src/sys/arch/x86/pci

2011-08-28 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Aug 28 06:08:15 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_addr_fixup.c

Log Message:
Normalize whitespace.


To generate a diff of this commit:
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/x86/pci/pci_addr_fixup.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_addr_fixup.c
diff -u src/sys/arch/x86/pci/pci_addr_fixup.c:1.7 src/sys/arch/x86/pci/pci_addr_fixup.c:1.8
--- src/sys/arch/x86/pci/pci_addr_fixup.c:1.7	Sun Aug 28 05:32:41 2011
+++ src/sys/arch/x86/pci/pci_addr_fixup.c	Sun Aug 28 06:08:15 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $	*/
+/*	$NetBSD: pci_addr_fixup.c,v 1.8 2011/08/28 06:08:15 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.8 2011/08/28 06:08:15 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -67,12 +67,12 @@
 pci_addr_fixup(pci_chipset_tag_t pc, int maxbus)
 {
 	extern paddr_t avail_end;
-	const char *verbose_header = 
+	const char *verbose_header =
 		[%s]---\n
 		  device vendor product\n
 		  register space addresssize\n
 		\n;
-	const char *verbose_footer = 
+	const char *verbose_footer =
 		--[%3d devices bogus]\n;
 	const struct {
 		bus_addr_t start;
@@ -88,7 +88,7 @@
 	int error;
 
 	pciaddr.extent_mem = extent_create(PCI I/O memory space,
-	   PCIADDR_MEM_START, 
+	   PCIADDR_MEM_START,
 	   PCIADDR_MEM_END,
 	   M_DEVBUF, 0, 0, EX_NOWAIT);
 	KASSERT(pciaddr.extent_mem);
@@ -98,28 +98,28 @@
 	M_DEVBUF, 0, 0, EX_NOWAIT);
 	KASSERT(pciaddr.extent_port);
 
-	/* 
+	/*
 	 * 1. check  reserve system BIOS setting.
 	 */
 	aprint_debug(verbose_header, System BIOS Setting);
 	pci_device_foreach(pc, maxbus, pciaddr_resource_reserve, NULL);
 	aprint_debug(verbose_footer, pciaddr.nbogus);
 
-	/* 
+	/*
 	 * 2. reserve non-PCI area.
 	 */
 	for (srp = system_reserve; srp-size; srp++) {
 		error = extent_alloc_region(pciaddr.extent_mem, srp-start,
-	srp-size, 
-	EX_NOWAIT| EX_MALLOCOK);	
+	srp-size,
+	EX_NOWAIT| EX_MALLOCOK);
 		if (error != 0) {
 			aprint_error(WARNING: can't reserve area for %s.\n,
 			   srp-name);
 		}
 	}
 
-	/* 
-	 * 3. determine allocation space 
+	/*
+	 * 3. determine allocation space
 	 */
 	start = x86_round_page(avail_end + 1);
 	if (start  PCIADDR_ISAMEM_RESERVE)
@@ -127,14 +127,14 @@
 	pciaddr.mem_alloc_start = (start + 0x10 + 1)  ~(0x10 - 1);
 	pciaddr.port_alloc_start = PCIADDR_ISAPORT_RESERVE;
 	aprint_debug( Physical memory end: 0x%08x\n PCI memory mapped I/O 
-			space start: 0x%08x\n, (unsigned)avail_end, 
+			space start: 0x%08x\n, (unsigned)avail_end,
 			(unsigned)pciaddr.mem_alloc_start);
 
 	if (pciaddr.nbogus == 0)
 		return; /* no need to fixup */
 
-	/* 
-	 * 4. do fixup 
+	/*
+	 * 4. do fixup
 	 */
 	aprint_debug(verbose_header, PCIBIOS fixup stage);
 	pciaddr.nbogus = 0;
@@ -147,7 +147,7 @@
 pciaddr_resource_reserve(pci_chipset_tag_t pc, pcitag_t tag,
 void *context)
 {
-		pciaddr_print_devid(pc, tag);
+	pciaddr_print_devid(pc, tag);
 	pciaddr_resource_manage(pc, tag,
 pciaddr_do_resource_reserve,
 pciaddr);
@@ -157,7 +157,7 @@
 pciaddr_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag,
 void *context)
 {
-		pciaddr_print_devid(pc, tag);
+	pciaddr_print_devid(pc, tag);
 	pciaddr_resource_manage(pc, tag,
 pciaddr_do_resource_allocate,
 pciaddr);
@@ -192,7 +192,7 @@
 		break;
 	}
 	error = useport = usemem = 0;
-
+
 	for (mapreg = reg_start; mapreg  reg_end; mapreg += width) {
 		/* inquire PCI device bus space requirement */
 		val = pci_conf_read(pc, tag, mapreg);
@@ -200,20 +200,20 @@
 
 		mask = pci_conf_read(pc, tag, mapreg);
 		pci_conf_write(pc, tag, mapreg, val);
-	
+
 		type = PCI_MAPREG_TYPE(val);
 		width = 4;
 		if (type == PCI_MAPREG_TYPE_MEM) {
-			if (PCI_MAPREG_MEM_TYPE(val) == 
+			if (PCI_MAPREG_MEM_TYPE(val) ==
 			PCI_MAPREG_MEM_TYPE_64BIT) {
 /* XXX We could examine the upper 32 bits
- * XXX of the BAR here, but we are totally 
- * XXX unprepared to handle a non-zero value, 
- * XXX either here or anywhere else in 
- * XXX i386-land. 
+ * XXX of the BAR here, but we are totally
+ * XXX unprepared to handle a non-zero value,
+ * XXX either here or anywhere else in
+ * XXX i386-land.
  * XXX So just arrange to not look at the
  * XXX upper 32 bits, lest we misinterpret
- * XXX it as a 32-bit BAR set to zero. 
+ * XXX it as a 32-bit BAR set to zero.
  */
 			width = 8;
 			}
@@ -222,7 +222,7 @@
 			size = 

CVS commit: src/distrib/sets/lists

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Aug 27 18:54:16 UTC 2011

Modified Files:
src/distrib/sets/lists/base: ad.mips64eb ad.mips64el
src/distrib/sets/lists/comp: ad.mips64eb ad.mips64el

Log Message:
Updating setlists for mips64.  Thanks Matt Thomas for the heads-up.


To generate a diff of this commit:
cvs rdiff -u -r1.62 -r1.63 src/distrib/sets/lists/base/ad.mips64eb
cvs rdiff -u -r1.59 -r1.60 src/distrib/sets/lists/base/ad.mips64el
cvs rdiff -u -r1.47 -r1.48 src/distrib/sets/lists/comp/ad.mips64eb \
src/distrib/sets/lists/comp/ad.mips64el

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

Modified files:

Index: src/distrib/sets/lists/base/ad.mips64eb
diff -u src/distrib/sets/lists/base/ad.mips64eb:1.62 src/distrib/sets/lists/base/ad.mips64eb:1.63
--- src/distrib/sets/lists/base/ad.mips64eb:1.62	Tue Jul 26 16:10:15 2011
+++ src/distrib/sets/lists/base/ad.mips64eb	Sat Aug 27 18:54:15 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.62 2011/07/26 16:10:15 joerg Exp $
+# $NetBSD: ad.mips64eb,v 1.63 2011/08/27 18:54:15 dyoung Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -187,6 +187,8 @@
 ./usr/lib/64/libperfuse.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/64/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/64/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libpthread.so.1			base-compat-shlib	compat,pic
@@ -471,6 +473,8 @@
 ./usr/lib/o32/libperfuse.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/o32/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libpthread.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/ad.mips64el
diff -u src/distrib/sets/lists/base/ad.mips64el:1.59 src/distrib/sets/lists/base/ad.mips64el:1.60
--- src/distrib/sets/lists/base/ad.mips64el:1.59	Tue Jul 26 16:10:15 2011
+++ src/distrib/sets/lists/base/ad.mips64el	Sat Aug 27 18:54:15 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64el,v 1.59 2011/07/26 16:10:15 joerg Exp $
+# $NetBSD: ad.mips64el,v 1.60 2011/08/27 18:54:15 dyoung Exp $
 ./libexec/ld.elf_so-64base-compat-shlib	compat,pic
 ./libexec/ld.elf_so-o32base-sysutil-bin	compat,pic
 ./usr/lib/64	base-compat-lib
@@ -187,6 +187,8 @@
 ./usr/lib/64/libperfuse.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/64/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/64/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/64/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/64/libpthread.so.1			base-compat-shlib	compat,pic
@@ -471,6 +473,8 @@
 ./usr/lib/o32/libperfuse.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/o32/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/o32/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/o32/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/o32/libpthread.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/comp/ad.mips64eb
diff -u src/distrib/sets/lists/comp/ad.mips64eb:1.47 src/distrib/sets/lists/comp/ad.mips64eb:1.48
--- src/distrib/sets/lists/comp/ad.mips64eb:1.47	Tue Jul 26 16:10:15 2011
+++ src/distrib/sets/lists/comp/ad.mips64eb	Sat Aug 27 18:54:15 2011
@@ -1,4 +1,4 @@
-# $NetBSD: ad.mips64eb,v 1.47 2011/07/26 16:10:15 joerg Exp $
+# $NetBSD: ad.mips64eb,v 1.48 2011/08/27 18:54:15 dyoung Exp $
 ./usr/bin/elf2aoutcomp-obsolete		obsolete
 ./usr/bin/elf2ecoffcomp-sysutil-bin
 ./usr/include/gcc-4.5/loongson.h		comp-c-include		gcccmds,gcc=45
@@ -475,6 +475,10 @@
 ./usr/lib/64/libposix.so			base-sys-shlib		compat,pic
 ./usr/lib/64/libposix_p.a			comp-c-proflib		compat,profile
 ./usr/lib/64/libposix_pic.a			comp-c-piclib		compat,pic
+./usr/lib/64/libppath.acomp-c-lib		compat
+./usr/lib/64/libppath.so			base-sys-shlib		compat,pic
+./usr/lib/64/libppath_p.a			comp-c-proflib		compat,profile
+./usr/lib/64/libppath_pic.a			comp-c-piclib		compat,pic
 ./usr/lib/64/libprop.acomp-c-lib		compat
 ./usr/lib/64/libprop.sobase-sys-shlib		

CVS commit: src

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Aug 27 18:55:52 UTC 2011

Modified Files:
src/distrib/sets/lists/tests: mi
src/tests/lib: Makefile
src/tests/lib/libppath: Makefile

Log Message:
Build and install ppath(3) tests.


To generate a diff of this commit:
cvs rdiff -u -r1.377 -r1.378 src/distrib/sets/lists/tests/mi
cvs rdiff -u -r1.14 -r1.15 src/tests/lib/Makefile
cvs rdiff -u -r1.1 -r1.2 src/tests/lib/libppath/Makefile

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

Modified files:

Index: src/distrib/sets/lists/tests/mi
diff -u src/distrib/sets/lists/tests/mi:1.377 src/distrib/sets/lists/tests/mi:1.378
--- src/distrib/sets/lists/tests/mi:1.377	Thu Aug 25 15:34:05 2011
+++ src/distrib/sets/lists/tests/mi	Sat Aug 27 18:55:52 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.377 2011/08/25 15:34:05 dyoung Exp $
+# $NetBSD: mi,v 1.378 2011/08/27 18:55:52 dyoung Exp $
 #
 # Note: don't delete entries from here - mark them as obsolete instead.
 #
@@ -558,6 +558,8 @@
 ./usr/libdata/debug/usr/tests/lib/libposix/posix1/t_rename.debug	tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libposix/posix2			tests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libposix/posix2/t_rename.debug	tests-lib-debug		debug,atf
+./usr/libdata/debug/usr/tests/lib/libppathtests-lib-debug
+./usr/libdata/debug/usr/tests/lib/libppath/t_ppath.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libproptests-lib-debug
 ./usr/libdata/debug/usr/tests/lib/libprop/t_basic.debug			tests-lib-debug		debug,atf
 ./usr/libdata/debug/usr/tests/lib/libpthreadtests-lib-debug
@@ -2261,6 +2263,9 @@
 ./usr/tests/lib/libposix/posix2			tests-lib-tests		atf
 ./usr/tests/lib/libposix/posix2/Atffile		tests-lib-tests		atf
 ./usr/tests/lib/libposix/posix2/t_rename	tests-lib-tests		atf
+./usr/tests/lib/libppath			tests-lib-tests		atf
+./usr/tests/lib/libppath/Atffile		tests-lib-tests		atf
+./usr/tests/lib/libppath/t_ppath		tests-lib-tests		atf
 ./usr/tests/lib/libproptests-lib-tests		atf
 ./usr/tests/lib/libprop/Atffile			tests-lib-tests		atf
 ./usr/tests/lib/libprop/t_basic			tests-lib-tests		atf

Index: src/tests/lib/Makefile
diff -u src/tests/lib/Makefile:1.14 src/tests/lib/Makefile:1.15
--- src/tests/lib/Makefile:1.14	Sun Apr 10 09:49:13 2011
+++ src/tests/lib/Makefile	Sat Aug 27 18:55:51 2011
@@ -1,9 +1,9 @@
-# $NetBSD: Makefile,v 1.14 2011/04/10 09:49:13 blymn Exp $
+# $NetBSD: Makefile,v 1.15 2011/08/27 18:55:51 dyoung Exp $
 
 .include bsd.own.mk
 
 TESTS_SUBDIRS=	csu libbluetooth libc libcurses libevent libm \
-		libobjc libposix libprop libpthread \
+		libobjc libposix libppath libprop libpthread \
 		librt librumpclient librumphijack libutil semaphore
 
 .if ${MKCRYPTO} != no

Index: src/tests/lib/libppath/Makefile
diff -u src/tests/lib/libppath/Makefile:1.1 src/tests/lib/libppath/Makefile:1.2
--- src/tests/lib/libppath/Makefile:1.1	Thu Aug 25 19:09:46 2011
+++ src/tests/lib/libppath/Makefile	Sat Aug 27 18:55:52 2011
@@ -1,11 +1,12 @@
-# $Id: Makefile,v 1.1 2011/08/25 19:09:46 dyoung Exp $
+# $Id: Makefile,v 1.2 2011/08/27 18:55:52 dyoung Exp $
 
 .include bsd.own.mk
 
-LIBPPATH != make -V .OBJDIR -C $(.CURDIR)/../lib
+TESTSDIR=	${TESTSBASE}/lib/libppath
 
-TESTS_C=t_ppath t_proplib
-SRCS.t_proplib=t_proplib.c personnel.c personnel.h
+#LIBPPATH != make -V .OBJDIR -C $(.CURDIR)/../lib
+
+TESTS_C=t_ppath
 SRCS.t_ppath=t_ppath.c personnel.c personnel.h
 CPPFLAGS+=-I$(.OBJDIR)
 
@@ -19,8 +20,9 @@
 
 CLEANFILES+=personnel.c personnel.h
 
-LDADD+=-L$(LIBPPATH) -lppath -lprop
-DPADD+=$(LIBPPATH)/libppath.a
+#LDADD+=-L$(LIBPPATH)
+LDADD+=-lppath -lprop
+#DPADD+=$(LIBPPATH)/libppath.a
 
 .include bsd.test.mk
-.include ../mk/tags.mk
+#.include ../mk/tags.mk



CVS commit: src/etc/mtree

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sat Aug 27 19:02:29 UTC 2011

Modified Files:
src/etc/mtree: NetBSD.dist.tests

Log Message:
Straggler from last: add the directory for ppath(3) tests.


To generate a diff of this commit:
cvs rdiff -u -r1.51 -r1.52 src/etc/mtree/NetBSD.dist.tests

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

Modified files:

Index: src/etc/mtree/NetBSD.dist.tests
diff -u src/etc/mtree/NetBSD.dist.tests:1.51 src/etc/mtree/NetBSD.dist.tests:1.52
--- src/etc/mtree/NetBSD.dist.tests:1.51	Thu Jul  7 07:40:46 2011
+++ src/etc/mtree/NetBSD.dist.tests	Sat Aug 27 19:02:29 2011
@@ -1,4 +1,4 @@
-#	$NetBSD: NetBSD.dist.tests,v 1.51 2011/07/07 07:40:46 jruoho Exp $
+#	$NetBSD: NetBSD.dist.tests,v 1.52 2011/08/27 19:02:29 dyoung Exp $
 
 ./usr/libdata/debug/usr/tests
 ./usr/libdata/debug/usr/tests/atf
@@ -79,6 +79,7 @@
 ./usr/libdata/debug/usr/tests/lib/libposix/bsd
 ./usr/libdata/debug/usr/tests/lib/libposix/posix1
 ./usr/libdata/debug/usr/tests/lib/libposix/posix2
+./usr/libdata/debug/usr/tests/lib/libppath
 ./usr/libdata/debug/usr/tests/lib/libprop
 ./usr/libdata/debug/usr/tests/lib/libpthread
 ./usr/libdata/debug/usr/tests/lib/librt
@@ -204,6 +205,7 @@
 ./usr/tests/lib/libposix/bsd
 ./usr/tests/lib/libposix/posix1
 ./usr/tests/lib/libposix/posix2
+./usr/tests/lib/libppath
 ./usr/tests/lib/libprop
 ./usr/tests/lib/libpthread
 ./usr/tests/lib/librt



CVS commit: src/sys/arch/x86/x86

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Aug 28 00:51:22 UTC 2011

Modified Files:
src/sys/arch/x86/x86: pmap.c

Log Message:
Use __strict_weak_alias().


To generate a diff of this commit:
cvs rdiff -u -r1.128 -r1.129 src/sys/arch/x86/x86/pmap.c

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

Modified files:

Index: src/sys/arch/x86/x86/pmap.c
diff -u src/sys/arch/x86/x86/pmap.c:1.128 src/sys/arch/x86/x86/pmap.c:1.129
--- src/sys/arch/x86/x86/pmap.c:1.128	Sun Aug 14 02:31:08 2011
+++ src/sys/arch/x86/x86/pmap.c	Sun Aug 28 00:51:21 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $	*/
+/*	$NetBSD: pmap.c,v 1.129 2011/08/28 00:51:21 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2008, 2010 The NetBSD Foundation, Inc.
@@ -171,7 +171,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.128 2011/08/14 02:31:08 rmind Exp $);
+__KERNEL_RCSID(0, $NetBSD: pmap.c,v 1.129 2011/08/28 00:51:21 dyoung Exp $);
 
 #include opt_user_ldt.h
 #include opt_lockdebug.h
@@ -1069,7 +1069,7 @@
 	}
 }
 
-__weak_alias(pmap_kenter_ma, pmap_kenter_pa);
+__strict_weak_alias(pmap_kenter_ma, pmap_kenter_pa);
 
 #if defined(__x86_64__)
 /*
@@ -2882,7 +2882,7 @@
 	return (0);
 }
 
-__weak_alias(pmap_extract_ma, pmap_extract);
+__strict_weak_alias(pmap_extract_ma, pmap_extract);
 
 #ifdef XEN
 
@@ -3780,7 +3780,7 @@
  * defined as macro in pmap.h
  */
 
-__weak_alias(pmap_enter, pmap_enter_default);
+__strict_weak_alias(pmap_enter, pmap_enter_default);
 
 int
 pmap_enter_default(pmap_t pmap, vaddr_t va, paddr_t pa, vm_prot_t prot,



CVS commit: src/sys/arch/x86/pci

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Aug 28 04:59:37 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_machdep.c

Log Message:
Make the override implementation more concise.  Saves about three lines
of code per routine, makes it more explicit what's going on, and avoids
recursion, though the compiler probably optimized the tail recursion in
the old code.


To generate a diff of this commit:
cvs rdiff -u -r1.46 -r1.47 src/sys/arch/x86/pci/pci_machdep.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_machdep.c
diff -u src/sys/arch/x86/pci/pci_machdep.c:1.46 src/sys/arch/x86/pci/pci_machdep.c:1.47
--- src/sys/arch/x86/pci/pci_machdep.c:1.46	Sat Aug 27 09:32:11 2011
+++ src/sys/arch/x86/pci/pci_machdep.c	Sun Aug 28 04:59:37 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_machdep.c,v 1.46 2011/08/27 09:32:11 christos Exp $	*/
+/*	$NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
@@ -73,7 +73,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.46 2011/08/27 09:32:11 christos Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_machdep.c,v 1.47 2011/08/28 04:59:37 dyoung Exp $);
 
 #include sys/types.h
 #include sys/param.h
@@ -418,17 +418,14 @@
 pcitag_t
 pci_make_tag(pci_chipset_tag_t pc, int bus, int device, int function)
 {
+	pci_chipset_tag_t ipc;
 	pcitag_t tag;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_MAKE_TAG) != 0) {
-			return (*pc-pc_ov-ov_make_tag)(pc-pc_ctx,
-			pc, bus, device, function);
-		}
-		if (pc-pc_super != NULL) {
-			return pci_make_tag(pc-pc_super, bus, device,
-			function);
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_MAKE_TAG) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_make_tag)(ipc-pc_ctx,
+		pc, bus, device, function);
 	}
 
 	switch (pci_mode) {
@@ -456,17 +453,14 @@
 pci_decompose_tag(pci_chipset_tag_t pc, pcitag_t tag,
 int *bp, int *dp, int *fp)
 {
+	pci_chipset_tag_t ipc;
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_DECOMPOSE_TAG) != 0) {
-			(*pc-pc_ov-ov_decompose_tag)(pc-pc_ctx,
-			pc, tag, bp, dp, fp);
-			return;
-		}
-		if (pc-pc_super != NULL) {
-			pci_decompose_tag(pc-pc_super, tag, bp, dp, fp);
-			return;
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_DECOMPOSE_TAG) == 0)
+			continue;
+		(*ipc-pc_ov-ov_decompose_tag)(ipc-pc_ctx,
+		pc, tag, bp, dp, fp);
+		return;
 	}
 
 	switch (pci_mode) {
@@ -494,18 +488,16 @@
 pcireg_t
 pci_conf_read(pci_chipset_tag_t pc, pcitag_t tag, int reg)
 {
+	pci_chipset_tag_t ipc;
 	pcireg_t data;
 	struct pci_conf_lock ocl;
 
 	KASSERT((reg  0x3) == 0);
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_CONF_READ) != 0) {
-			return (*pc-pc_ov-ov_conf_read)(pc-pc_ctx,
-			pc, tag, reg);
-		}
-		if (pc-pc_super != NULL)
-			return pci_conf_read(pc-pc_super, tag, reg);
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_CONF_READ) == 0)
+			continue;
+		return (*ipc-pc_ov-ov_conf_read)(ipc-pc_ctx, pc, tag, reg);
 	}
 
 #if defined(__i386__)  defined(XBOX)
@@ -526,20 +518,17 @@
 void
 pci_conf_write(pci_chipset_tag_t pc, pcitag_t tag, int reg, pcireg_t data)
 {
+	pci_chipset_tag_t ipc;
 	struct pci_conf_lock ocl;
 
 	KASSERT((reg  0x3) == 0);
 
-	if (pc != NULL) {
-		if ((pc-pc_present  PCI_OVERRIDE_CONF_WRITE) != 0) {
-			(*pc-pc_ov-ov_conf_write)(pc-pc_ctx, pc, tag, reg,
-			data);
-			return;
-		}
-		if (pc-pc_super != NULL) {
-			pci_conf_write(pc-pc_super, tag, reg, data);
-			return;
-		}
+	for (ipc = pc; ipc != NULL; ipc = ipc-pc_super) {
+		if ((ipc-pc_present  PCI_OVERRIDE_CONF_WRITE) == 0)
+			continue;
+		(*ipc-pc_ov-ov_conf_write)(ipc-pc_ctx, pc, tag, reg,
+		data);
+		return;
 	}
 
 #if defined(__i386__)  defined(XBOX)



CVS commit: src/sys/arch/x86/pci

2011-08-27 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Sun Aug 28 05:32:41 UTC 2011

Modified Files:
src/sys/arch/x86/pci: pci_addr_fixup.c

Log Message:
Replace some anonymous constants with PCI_ constants.

Print debugging information using aprint_debug(9) not aprint_verbose(9)
and be consistent about that.  Get rid of the pciaddrverbose switch for
debugging printfs.

Make 'static' several functions that are private to this module.

Don't test truth of arbitrary integers but compare with 0.  Change
'return (x)' to 'return x'.


To generate a diff of this commit:
cvs rdiff -u -r1.6 -r1.7 src/sys/arch/x86/pci/pci_addr_fixup.c

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

Modified files:

Index: src/sys/arch/x86/pci/pci_addr_fixup.c
diff -u src/sys/arch/x86/pci/pci_addr_fixup.c:1.6 src/sys/arch/x86/pci/pci_addr_fixup.c:1.7
--- src/sys/arch/x86/pci/pci_addr_fixup.c:1.6	Fri Jul  1 18:22:08 2011
+++ src/sys/arch/x86/pci/pci_addr_fixup.c	Sun Aug 28 05:32:41 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: pci_addr_fixup.c,v 1.6 2011/07/01 18:22:08 dyoung Exp $	*/
+/*	$NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 2000 UCHIYAMA Yasushi.  All rights reserved.
@@ -27,7 +27,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.6 2011/07/01 18:22:08 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: pci_addr_fixup.c,v 1.7 2011/08/28 05:32:41 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -46,17 +46,13 @@
 
 struct pciaddr pciaddr;
 
-static int pciaddrverbose = 0;
-
-void	pciaddr_resource_reserve(pci_chipset_tag_t, pcitag_t, void *context);
-int	pciaddr_do_resource_reserve(pci_chipset_tag_t, pcitag_t, int,
+static void	pciaddr_resource_reserve(pci_chipset_tag_t, pcitag_t, void *);
+static int	pciaddr_do_resource_reserve(pci_chipset_tag_t, pcitag_t, int,
 void *, int, bus_addr_t *, bus_size_t);
-void	pciaddr_resource_allocate(pci_chipset_tag_t, pcitag_t, void *context);
-int	pciaddr_do_resource_allocate(pci_chipset_tag_t, pcitag_t, int,
+static void	pciaddr_resource_allocate(pci_chipset_tag_t, pcitag_t, void *);
+static int	pciaddr_do_resource_allocate(pci_chipset_tag_t, pcitag_t, int,
  void *, int, bus_addr_t *, bus_size_t);
-int	device_is_agp(pci_chipset_tag_t, pcitag_t);
-
-int	device_is_agp(pci_chipset_tag_t, pcitag_t);
+static int	device_is_agp(pci_chipset_tag_t, pcitag_t);
 
 #define PCIADDR_MEM_START	0x0
 #define PCIADDR_MEM_END		0x
@@ -147,22 +143,20 @@
 
 }
 
-void
+static void
 pciaddr_resource_reserve(pci_chipset_tag_t pc, pcitag_t tag,
 void *context)
 {
-	if (pciaddrverbose)
 		pciaddr_print_devid(pc, tag);
 	pciaddr_resource_manage(pc, tag,
 pciaddr_do_resource_reserve,
 pciaddr);
 }
 
-void
+static void
 pciaddr_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag,
 void *context)
 {
-	if (pciaddrverbose)
 		pciaddr_print_devid(pc, tag);
 	pciaddr_resource_manage(pc, tag,
 pciaddr_do_resource_allocate,
@@ -184,15 +178,15 @@
 		aprint_error(WARNING: unknown PCI device header.);
 		pciaddr.nbogus++;
 		return;
-	case 0: 
+	case PCI_HDRTYPE_DEVICE:
 		reg_start = PCI_MAPREG_START;
 		reg_end   = PCI_MAPREG_END;
 		break;
-	case 1: /* PCI-PCI bridge */
+	case PCI_HDRTYPE_PPB: /* PCI-PCI bridge */
 		reg_start = PCI_MAPREG_START;
 		reg_end   = PCI_MAPREG_PPB_END;
 		break;
-	case 2: /* PCI-CardBus bridge */
+	case PCI_HDRTYPE_PCB: /* PCI-CardBus bridge */
 		reg_start = PCI_MAPREG_START;
 		reg_end   = PCI_MAPREG_PCB_END;
 		break;
@@ -229,7 +223,7 @@
 		}
 		addr = pciaddr_ioaddr(val);
 	
-		if (!size) /* unused register */
+		if (size == 0) /* unused register */
 			continue;
 
 		if (type == PCI_MAPREG_TYPE_MEM)
@@ -255,13 +249,13 @@
 			 PCI_COMMAND_MASTER_ENABLE);
 	pci_conf_write(pc, tag, PCI_COMMAND_STATUS_REG, val);
 
-	if (error)
+	if (error != 0)
 		pciaddr.nbogus++;
 
 	aprint_debug(\n\t\t[%s]\n, error ? NG : OK);
 }
 
-int
+static int
 pciaddr_do_resource_allocate(pci_chipset_tag_t pc, pcitag_t tag,
 int mapreg, void *ctx, int type, bus_addr_t *addr, bus_size_t size)
 {
@@ -270,22 +264,22 @@
 	int error;
  	struct extent *ex;
  
-	if (*addr) /* no need to allocate */
-		return (0);
+	if (*addr != 0) /* no need to allocate */
+		return 0;
 
  	ex = (type == PCI_MAPREG_TYPE_MEM ?
  	  pciaddrmap-extent_mem : pciaddrmap-extent_port);
 
 	/* XXX Don't allocate if device is AGP device to avoid conflict. */
 	if (device_is_agp(pc, tag)) 
-		return (0);
+		return 0;
 	
 	start = (type == PCI_MAPREG_TYPE_MEM ?
 		 pciaddrmap-mem_alloc_start : pciaddrmap-port_alloc_start);
 
 	if (start  ex-ex_start || start + size - 1 = ex-ex_end) {
 		aprint_debug(No available resources. fixup failed\n);
-		return (1);
+		return 1;
 	}
 	error = extent_alloc_subregion(ex, start, ex-ex_end, size,
    size, 0,
@@ -293,26 +287,22 @@
    (u_long *)addr);
 	if (error) {
 		aprint_debug(No available 

CVS commit: src

2011-08-26 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Fri Aug 26 21:22:10 UTC 2011

Modified Files:
src/distrib/sets/lists/base: md.amd64 md.sparc64 mi shl.mi
src/distrib/sets/lists/comp: md.amd64 md.sparc64 mi shl.mi
src/etc/mtree: NetBSD.dist.base
src/include: Makefile
src/lib: Makefile
src/sys/lib/libkern: Makefile.libkern

Log Message:
Build and install ppath(3), property-list paths library.


To generate a diff of this commit:
cvs rdiff -u -r1.133 -r1.134 src/distrib/sets/lists/base/md.amd64
cvs rdiff -u -r1.126 -r1.127 src/distrib/sets/lists/base/md.sparc64
cvs rdiff -u -r1.948 -r1.949 src/distrib/sets/lists/base/mi
cvs rdiff -u -r1.595 -r1.596 src/distrib/sets/lists/base/shl.mi
cvs rdiff -u -r1.129 -r1.130 src/distrib/sets/lists/comp/md.amd64
cvs rdiff -u -r1.114 -r1.115 src/distrib/sets/lists/comp/md.sparc64
cvs rdiff -u -r1.1663 -r1.1664 src/distrib/sets/lists/comp/mi
cvs rdiff -u -r1.184 -r1.185 src/distrib/sets/lists/comp/shl.mi
cvs rdiff -u -r1.89 -r1.90 src/etc/mtree/NetBSD.dist.base
cvs rdiff -u -r1.135 -r1.136 src/include/Makefile
cvs rdiff -u -r1.175 -r1.176 src/lib/Makefile
cvs rdiff -u -r1.13 -r1.14 src/sys/lib/libkern/Makefile.libkern

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

Modified files:

Index: src/distrib/sets/lists/base/md.amd64
diff -u src/distrib/sets/lists/base/md.amd64:1.133 src/distrib/sets/lists/base/md.amd64:1.134
--- src/distrib/sets/lists/base/md.amd64:1.133	Wed Aug 17 00:33:52 2011
+++ src/distrib/sets/lists/base/md.amd64	Fri Aug 26 21:22:07 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.amd64,v 1.133 2011/08/17 00:33:52 jakllsch Exp $
+# $NetBSD: md.amd64,v 1.134 2011/08/26 21:22:07 dyoung Exp $
 ./dev/lms0	base-obsolete		obsolete
 ./dev/mms0	base-obsolete		obsolete
 ./libexec/ld.elf_so-i386			base-sys-shlib		compat,pic
@@ -194,6 +194,8 @@
 ./usr/lib/i386/libperfuse.so.0.0		base-compat-shlib   compat,pic
 ./usr/lib/i386/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/i386/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/i386/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/i386/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/i386/libpthread.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/md.sparc64
diff -u src/distrib/sets/lists/base/md.sparc64:1.126 src/distrib/sets/lists/base/md.sparc64:1.127
--- src/distrib/sets/lists/base/md.sparc64:1.126	Tue Jul 26 16:10:15 2011
+++ src/distrib/sets/lists/base/md.sparc64	Fri Aug 26 21:22:08 2011
@@ -1,4 +1,4 @@
-# $NetBSD: md.sparc64,v 1.126 2011/07/26 16:10:15 joerg Exp $
+# $NetBSD: md.sparc64,v 1.127 2011/08/26 21:22:08 dyoung Exp $
 ./libexec/ld.elf_so-sparc			base-sysutil-bin	compat,pic
 ./sbin/edlabel	base-sysutil-root	obsolete
 ./usr/bin/fdformatbase-util-bin
@@ -190,6 +190,8 @@
 ./usr/lib/sparc/libperfuse.so.0.0		base-compat-shlib   compat,pic
 ./usr/lib/sparc/libposix.so.0			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libposix.so.0.1			base-compat-shlib	compat,pic
+./usr/lib/sparc/libppath.so.0			base-compat-shlib	compat,pic
+./usr/lib/sparc/libppath.so.0.0			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libprop.so.1			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libprop.so.1.1			base-compat-shlib	compat,pic
 ./usr/lib/sparc/libpthread.so.1			base-compat-shlib	compat,pic

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.948 src/distrib/sets/lists/base/mi:1.949
--- src/distrib/sets/lists/base/mi:1.948	Thu Aug 25 15:29:04 2011
+++ src/distrib/sets/lists/base/mi	Fri Aug 26 21:22:07 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.948 2011/08/25 15:29:04 dyoung Exp $
+# $NetBSD: mi,v 1.949 2011/08/26 21:22:07 dyoung Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -870,6 +870,7 @@
 ./usr/include/openpgpsdk			base-obsolete		obsolete
 ./usr/include/opensslbase-c-usr
 ./usr/include/pcapbase-c-usr
+./usr/include/ppathbase-c-usr
 ./usr/include/propbase-c-usr
 ./usr/include/protocolsbase-c-usr
 ./usr/include/quotabase-c-usr

Index: src/distrib/sets/lists/base/shl.mi
diff -u src/distrib/sets/lists/base/shl.mi:1.595 src/distrib/sets/lists/base/shl.mi:1.596
--- src/distrib/sets/lists/base/shl.mi:1.595	Tue Jul 26 16:10:15 2011
+++ src/distrib/sets/lists/base/shl.mi	Fri Aug 26 21:22:08 2011
@@ -1,4 +1,4 @@
-# $NetBSD: shl.mi,v 1.595 2011/07/26 16:10:15 joerg Exp $
+# $NetBSD: shl.mi,v 1.596 2011/08/26 21:22:08 dyoung Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -49,6 +49,9 @@
 ./lib/libm.so	base-sys-shlib		dynamicroot
 ./lib/libm.so.0	base-sys-shlib		dynamicroot
 ./lib/libm.so.0.10base-sys-shlib		dynamicroot

CVS commit: src/sys/arch/x86/include

2011-08-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 15:06:10 UTC 2011

Modified Files:
src/sys/arch/x86/include: bus_defs.h

Log Message:
Add to x86 bus_space_tag_t a member, bst_exists, that tells whether a
routine is overridden by this tag or by any ancestral tag.


To generate a diff of this commit:
cvs rdiff -u -r1.1 -r1.2 src/sys/arch/x86/include/bus_defs.h

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

Modified files:

Index: src/sys/arch/x86/include/bus_defs.h
diff -u src/sys/arch/x86/include/bus_defs.h:1.1 src/sys/arch/x86/include/bus_defs.h:1.2
--- src/sys/arch/x86/include/bus_defs.h:1.1	Fri Jul  1 17:10:01 2011
+++ src/sys/arch/x86/include/bus_defs.h	Thu Aug 25 15:06:10 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_defs.h,v 1.1 2011/07/01 17:10:01 dyoung Exp $	*/
+/*	$NetBSD: bus_defs.h,v 1.2 2011/08/25 15:06:10 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998, 2001 The NetBSD Foundation, Inc.
@@ -86,7 +86,12 @@
 struct bus_space_tag {
 	int	bst_type;
 	bus_space_tag_tbst_super;
+	/* bst_present: bitmap indicating overrides present (1) in *this* tag,
+	 * bst_exists: bitmap indicating overrides present (1) in *this* tag
+	 * or in an ancestor's tag (follow bst_super to ancestors)
+	 */
 	uint64_tbst_present;
+	uint64_tbst_exists;
 	const struct bus_space_overrides	*bst_ov;
 	void	*bst_ctx;
 };



CVS commit: src/sys/arch/x86/x86

2011-08-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 15:08:49 UTC 2011

Modified Files:
src/sys/arch/x86/x86: bus_space.c

Log Message:
Initialize bst_exists in bus_space_tag_create(9).  Use it to avoid
walking the chain of ancestor tags to see if a bus_space(9) routine was
overridden.


To generate a diff of this commit:
cvs rdiff -u -r1.36 -r1.37 src/sys/arch/x86/x86/bus_space.c

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

Modified files:

Index: src/sys/arch/x86/x86/bus_space.c
diff -u src/sys/arch/x86/x86/bus_space.c:1.36 src/sys/arch/x86/x86/bus_space.c:1.37
--- src/sys/arch/x86/x86/bus_space.c:1.36	Mon Jul 25 20:34:07 2011
+++ src/sys/arch/x86/x86/bus_space.c	Thu Aug 25 15:08:49 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: bus_space.c,v 1.36 2011/07/25 20:34:07 dyoung Exp $	*/
+/*	$NetBSD: bus_space.c,v 1.37 2011/08/25 15:08:49 dyoung Exp $	*/
 
 /*-
  * Copyright (c) 1996, 1997, 1998 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.36 2011/07/25 20:34:07 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: bus_space.c,v 1.37 2011/08/25 15:08:49 dyoung Exp $);
 
 #include sys/param.h
 #include sys/systm.h
@@ -161,7 +161,9 @@
 	bus_space_tag_t it;
 	int error;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_MAP) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_MAP) == 0)
 			continue;
 		return (*it-bst_ov-ov_space_map)(it-bst_ctx, t, bpa, size,
@@ -187,7 +189,9 @@
 	bus_size_t size;
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_RESERVATION_MAP) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_RESERVATION_MAP) == 0)
 			continue;
 		return (*it-bst_ov-ov_space_reservation_map)(it-bst_ctx, t,
@@ -251,7 +255,9 @@
 	int error;
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_RESERVE) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_RESERVE) == 0)
 			continue;
 		return (*it-bst_ov-ov_space_reserve)(it-bst_ctx, t,
@@ -298,7 +304,9 @@
 	int error;
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_RESERVE_SUBREGION) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_RESERVE_SUBREGION) ==
 		0)
 			continue;
@@ -350,7 +358,9 @@
 	struct extent *ex;
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_RELEASE) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_RELEASE) == 0)
 			continue;
 		(*it-bst_ov-ov_space_release)(it-bst_ctx, t, bsr);
@@ -386,7 +396,9 @@
 	bus_space_tag_t it;
 	int error;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_ALLOC) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_ALLOC) == 0)
 			continue;
 		return (*it-bst_ov-ov_space_alloc)(it-bst_ctx, t,
@@ -572,7 +584,9 @@
 {
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_RESERVATION_UNMAP) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_RESERVATION_UNMAP) ==
 		0)
 			continue;
@@ -592,7 +606,9 @@
 	bus_space_reservation_t bsr;
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_UNMAP) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_UNMAP) == 0)
 			continue;
 		(*it-bst_ov-ov_space_unmap)(it-bst_ctx, t, bsh, size);
@@ -610,7 +626,9 @@
 {
 	bus_space_tag_t it;
 
-	for (it = t; it != NULL; it = it-bst_super) {
+	if ((t-bst_exists  BUS_SPACE_OVERRIDE_FREE) == 0)
+		;	/* skip override */
+	else for (it = t; it != NULL; it = it-bst_super) {
 		if ((it-bst_present  BUS_SPACE_OVERRIDE_FREE) == 0)
 			continue;
 		(*it-bst_ov-ov_space_free)(it-bst_ctx, t, bsh, size);
@@ -933,6 +951,7 @@
 	}
 
 	bst-bst_ov = ov;
+	bst-bst_exists = obst-bst_exists | present;
 	bst-bst_present = present;
 	bst-bst_ctx = ctx;
 



CVS commit: src/sys/rump/net/lib/libshmif

2011-08-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 15:14:19 UTC 2011

Modified Files:
src/sys/rump/net/lib/libshmif: if_shmem.c

Log Message:
Use VMEM_ADDR_MIN and VMEM_ADDR_MAX.


To generate a diff of this commit:
cvs rdiff -u -r1.41 -r1.42 src/sys/rump/net/lib/libshmif/if_shmem.c

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

Modified files:

Index: src/sys/rump/net/lib/libshmif/if_shmem.c
diff -u src/sys/rump/net/lib/libshmif/if_shmem.c:1.41 src/sys/rump/net/lib/libshmif/if_shmem.c:1.42
--- src/sys/rump/net/lib/libshmif/if_shmem.c:1.41	Tue Aug 23 22:00:57 2011
+++ src/sys/rump/net/lib/libshmif/if_shmem.c	Thu Aug 25 15:14:19 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: if_shmem.c,v 1.41 2011/08/23 22:00:57 dyoung Exp $	*/
+/*	$NetBSD: if_shmem.c,v 1.42 2011/08/25 15:14:19 dyoung Exp $	*/
 
 /*
  * Copyright (c) 2009, 2010 Antti Kantee.  All Rights Reserved.
@@ -28,7 +28,7 @@
  */
 
 #include sys/cdefs.h
-__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.41 2011/08/23 22:00:57 dyoung Exp $);
+__KERNEL_RCSID(0, $NetBSD: if_shmem.c,v 1.42 2011/08/25 15:14:19 dyoung Exp $);
 
 #include sys/param.h
 #include sys/atomic.h
@@ -293,8 +293,8 @@
 			return error;
 	}
 
-	unit = vmem_xalloc(shmif_units, 1, 0, 0, 0, 0, ~(vmem_addr_t)0,
-	VM_INSTANTFIT | VM_SLEEP) - 1;
+	unit = vmem_xalloc(shmif_units, 1, 0, 0, 0,
+	VMEM_ADDR_MIN, VMEM_ADDR_MAX, VM_INSTANTFIT | VM_SLEEP) - 1;
 
 	if ((error = allocif(unit, sc)) != 0) {
 		if (path)



CVS commit: src/distrib/sets/lists/base

2011-08-25 Thread David Young
Module Name:src
Committed By:   dyoung
Date:   Thu Aug 25 15:29:05 UTC 2011

Modified Files:
src/distrib/sets/lists/base: mi

Log Message:
Set-list repair: add 'nls' tag to some files that need it, sort some
firmware files, move some graphics-adapter firmware into the syspkg
base-firmware-root.


To generate a diff of this commit:
cvs rdiff -u -r1.947 -r1.948 src/distrib/sets/lists/base/mi

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

Modified files:

Index: src/distrib/sets/lists/base/mi
diff -u src/distrib/sets/lists/base/mi:1.947 src/distrib/sets/lists/base/mi:1.948
--- src/distrib/sets/lists/base/mi:1.947	Mon Aug 15 15:13:59 2011
+++ src/distrib/sets/lists/base/mi	Thu Aug 25 15:29:04 2011
@@ -1,4 +1,4 @@
-# $NetBSD: mi,v 1.947 2011/08/15 15:13:59 wiz Exp $
+# $NetBSD: mi,v 1.948 2011/08/25 15:29:04 dyoung Exp $
 #
 # Note:	Don't delete entries from here - mark them as obsolete instead,
 #	unless otherwise stated below.
@@ -140,21 +140,21 @@
 ./libdata/firmware/if_iwi/ipw2200-sniffer.fw	base-firmware-root
 ./libdata/firmware/if_iwn			base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-1000-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-1000-ucode	base-firmware-root
-./libdata/firmware/if_iwn/iwlwifi-1000-3.ucode	base-firmare-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-4965-ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-5000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-5150-ucode	base-firmware-root
+./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-1000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-4965-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-5000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-5150-ucode	base-firmware-root
+./libdata/firmware/if_iwn/README.iwlwifi-6000-ucode	base-firmware-root
+./libdata/firmware/if_iwn/iwlwifi-1000-3.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-4965-1.ucode	base-obsolete		obsolete
 ./libdata/firmware/if_iwn/iwlwifi-4965-2.ucode	base-firmware-root
-./libdata/firmware/if_iwn/LICENSE.iwlwifi-5000-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-5000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-5000-1.ucode	base-obsolete		obsolete
 ./libdata/firmware/if_iwn/iwlwifi-5000-2.ucode	base-firmware-root
-./libdata/firmware/if_iwn/LICENSE.iwlwifi-5150-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-5150-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-5150-2.ucode	base-firmware-root
-./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000-ucode	base-firmware-root
-./libdata/firmware/if_iwn/README.iwlwifi-6000-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/iwlwifi-6000-4.ucode	base-firmware-root
 ./libdata/firmware/if_iwn/LICENSE.iwlwifi-6000g2a-ucode	base-firmware-root
 ./libdata/firmware/if_iwn/README.iwlwifi-6000g2a-ucode	base-firmware-root
@@ -168,10 +168,10 @@
 ./libdata/firmware/if_otus/otus-main		base-firmware-root
 ./libdata/firmware/if_wpi			base-firmware-root
 ./libdata/firmware/if_wpi/LICENSE.ipw3945-ucode	base-obsolete	obsolete
-./libdata/firmware/if_wpi/README.ipw3945-ucode	base-obsolete	obsolete
-./libdata/firmware/if_wpi/ipw3945.ucode		base-obsolete	obsolete
 ./libdata/firmware/if_wpi/LICENSE.iwlwifi-3945-ucode	base-firmware-root
+./libdata/firmware/if_wpi/README.ipw3945-ucode	base-obsolete	obsolete
 ./libdata/firmware/if_wpi/README.iwlwifi-3945-ucode	base-firmware-root
+./libdata/firmware/if_wpi/ipw3945.ucode		base-obsolete	obsolete
 ./libdata/firmware/if_wpi/iwlwifi-3945.ucode		base-firmware-root
 ./libdata/firmware/ralbase-firmware-root
 ./libdata/firmware/ral/ral-license		base-firmware-root
@@ -946,49 +946,49 @@
 ./usr/libdata/debug/usr/libexec/uucp		base-obsolete		obsolete
 ./usr/libdata/debug/usr/mdec			base-sys-usr
 ./usr/libdata/debug/usr/sbin			base-sys-usr
-./usr/libdata/firmwarebase-sys-usr
-./usr/libdata/firmware/radeon			base-sys-usr
-./usr/libdata/firmware/radeon/CEDAR_me.bin	base-sys-usr
-./usr/libdata/firmware/radeon/CEDAR_pfp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/CEDAR_rlc.bin	base-sys-usr
-./usr/libdata/firmware/radeon/CYPRESS_me.bin	base-sys-usr
-./usr/libdata/firmware/radeon/CYPRESS_pfp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/CYPRESS_rlc.bin	base-sys-usr
-./usr/libdata/firmware/radeon/JUNIPER_me.bin	base-sys-usr
-./usr/libdata/firmware/radeon/JUNIPER_pfp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/JUNIPER_rlc.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R100_cp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R200_cp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R300_cp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R420_cp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R520_cp.bin	base-sys-usr
-./usr/libdata/firmware/radeon/R600_me.bin	

  1   2   3   4   5   6   7   8   9   >