Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jul 2008 10:33:14 GMT
From:      Ed Schouten <ed@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 146246 for review
Message-ID:  <200807301033.m6UAXEhS032582@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=146246

Change 146246 by ed@ed_flippo on 2008/07/30 10:32:40

	IFC.

Affected files ...

.. //depot/projects/mpsafetty/contrib/telnet/telnetd/state.c#2 integrate
.. //depot/projects/mpsafetty/contrib/telnet/telnetd/telnetd.c#2 integrate
.. //depot/projects/mpsafetty/etc/mtree/BSD.usr.dist#2 integrate
.. //depot/projects/mpsafetty/lib/libc/gen/popen.c#2 integrate
.. //depot/projects/mpsafetty/lib/libc/stdio/mktemp.c#3 integrate
.. //depot/projects/mpsafetty/release/doc/en_US.ISO8859-1/relnotes/article.sgml#3 integrate
.. //depot/projects/mpsafetty/sbin/routed/routed.8#2 integrate
.. //depot/projects/mpsafetty/share/colldef/Makefile#2 integrate
.. //depot/projects/mpsafetty/share/colldef/no_NO.ISO8859-1.src#1 branch
.. //depot/projects/mpsafetty/share/colldef/no_NO.ISO8859-15.src#1 branch
.. //depot/projects/mpsafetty/share/syscons/keymaps/fr.macbook.acc.kbd#2 integrate
.. //depot/projects/mpsafetty/share/timedef/Makefile#2 integrate
.. //depot/projects/mpsafetty/share/timedef/nb_NO.ISO8859-1.src#1 branch
.. //depot/projects/mpsafetty/share/timedef/nb_NO.UTF-8.src#1 branch
.. //depot/projects/mpsafetty/share/timedef/no_NO.ISO8859-1.src#2 delete
.. //depot/projects/mpsafetty/share/timedef/no_NO.UTF-8.src#2 delete
.. //depot/projects/mpsafetty/sys/conf/NOTES#3 integrate
.. //depot/projects/mpsafetty/sys/conf/files#6 integrate
.. //depot/projects/mpsafetty/sys/dev/bfe/if_bfe.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/bfe/if_bfereg.h#2 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/if_rum.c#2 integrate
.. //depot/projects/mpsafetty/sys/dev/usb/if_ural.c#2 integrate
.. //depot/projects/mpsafetty/sys/kern/sched_4bsd.c#3 integrate
.. //depot/projects/mpsafetty/sys/kern/subr_sleepqueue.c#2 integrate
.. //depot/projects/mpsafetty/sys/netgraph/bluetooth/drivers/ubt/ng_ubt.c#3 integrate
.. //depot/projects/mpsafetty/sys/netgraph/ng_l2tp.c#2 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_asconf.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_bsd_addr.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_constants.h#3 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_input.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctp_timer.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet/sctputil.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet6/icmp6.c#3 integrate
.. //depot/projects/mpsafetty/sys/netinet6/ip6_output.c#2 integrate
.. //depot/projects/mpsafetty/sys/netinet6/raw_ip6.c#4 integrate
.. //depot/projects/mpsafetty/sys/sys/sockbuf.h#1 branch
.. //depot/projects/mpsafetty/sys/sys/socketvar.h#2 integrate
.. //depot/projects/mpsafetty/sys/sys/sockopt.h#1 branch
.. //depot/projects/mpsafetty/sys/sys/sockstate.h#1 branch
.. //depot/projects/mpsafetty/tools/build/mk/OptionalObsoleteFiles.inc#2 integrate
.. //depot/projects/mpsafetty/tools/regression/netinet6/icmp6_filter/Makefile#1 branch
.. //depot/projects/mpsafetty/tools/regression/netinet6/icmp6_filter/icmp6_filter.c#1 branch
.. //depot/projects/mpsafetty/usr.bin/bluetooth/btsockstat/btsockstat.c#2 integrate
.. //depot/projects/mpsafetty/usr.bin/cpio/cmdline.c#2 integrate
.. //depot/projects/mpsafetty/usr.bin/cpio/cpio.c#2 integrate
.. //depot/projects/mpsafetty/usr.bin/cpio/cpio.h#2 integrate
.. //depot/projects/mpsafetty/usr.bin/netstat/inet.c#2 integrate

Differences ...

==== //depot/projects/mpsafetty/contrib/telnet/telnetd/state.c#2 (text+ko) ====

@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/state.c,v 1.14 2003/05/04 02:54:49 obrien Exp $");
+__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/state.c,v 1.15 2008/07/28 18:58:16 jhb Exp $");
 
 #include <stdarg.h>
 #include "telnetd.h"
@@ -553,8 +553,10 @@
 
 #ifdef	AUTHENTICATION
 		case TELOPT_AUTHENTICATION:
-			func = auth_request;
-			changeok++;
+			if (auth_level >= 0) {
+				func = auth_request;
+				changeok++;
+			}
 			break;
 #endif
 

==== //depot/projects/mpsafetty/contrib/telnet/telnetd/telnetd.c#2 (text+ko) ====

@@ -37,7 +37,7 @@
 #endif
 #endif
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/telnetd.c,v 1.29 2006/09/26 21:46:11 ru Exp $");
+__FBSDID("$FreeBSD: src/contrib/telnet/telnetd/telnetd.c,v 1.30 2008/07/28 18:58:16 jhb Exp $");
 
 #include "telnetd.h"
 #include "pathnames.h"
@@ -481,11 +481,13 @@
     /*
      * Handle the Authentication option before we do anything else.
      */
-    send_do(TELOPT_AUTHENTICATION, 1);
-    while (his_will_wont_is_changing(TELOPT_AUTHENTICATION))
-	ttloop();
-    if (his_state_is_will(TELOPT_AUTHENTICATION)) {
-	retval = auth_wait(name);
+    if (auth_level >= 0) {
+	send_do(TELOPT_AUTHENTICATION, 1);
+	while (his_will_wont_is_changing(TELOPT_AUTHENTICATION))
+	    ttloop();
+	if (his_state_is_will(TELOPT_AUTHENTICATION)) {
+	    retval = auth_wait(name);
+	}
     }
 #endif
 

==== //depot/projects/mpsafetty/etc/mtree/BSD.usr.dist#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.334 2008/05/26 10:39:46 bz Exp $
+# $FreeBSD: src/etc/mtree/BSD.usr.dist,v 1.335 2008/07/28 17:42:37 antoine Exp $
 #
 # Please see the file src/etc/mtree/README before making changes to this file.
 #
@@ -297,8 +297,6 @@
             ..
             tcsh
             ..
-            wpa_supplicant
-            ..
         ..
         games
             fortune

==== //depot/projects/mpsafetty/lib/libc/gen/popen.c#2 (text+ko) ====

@@ -34,10 +34,11 @@
 static char sccsid[] = "@(#)popen.c	8.3 (Berkeley) 5/3/95";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.19 2007/01/09 00:27:54 imp Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/gen/popen.c,v 1.20 2008/07/29 16:29:59 ed Exp $");
 
 #include "namespace.h"
 #include <sys/param.h>
+#include <sys/queue.h>
 #include <sys/wait.h>
 
 #include <signal.h>
@@ -53,11 +54,12 @@
 
 extern char **environ;
 
-static struct pid {
-	struct pid *next;
+struct pid {
+	SLIST_ENTRY(pid) next;
 	FILE *fp;
 	pid_t pid;
-} *pidlist;
+};
+static SLIST_HEAD(, pid) pidlist = SLIST_HEAD_INITIALIZER(pidlist);
 static pthread_mutex_t pidlist_mutex = PTHREAD_MUTEX_INITIALIZER;
 
 #define	THREAD_LOCK()	if (__isthreaded) _pthread_mutex_lock(&pidlist_mutex)
@@ -133,9 +135,8 @@
 			}
 			(void)_close(pdes[1]);
 		}
-		for (p = pidlist; p; p = p->next) {
+		SLIST_FOREACH(p, &pidlist, next)
 			(void)_close(fileno(p->fp));
-		}
 		_execve(_PATH_BSHELL, argv, environ);
 		_exit(127);
 		/* NOTREACHED */
@@ -155,8 +156,7 @@
 	cur->fp = iop;
 	cur->pid = pid;
 	THREAD_LOCK();
-	cur->next = pidlist;
-	pidlist = cur;
+	SLIST_INSERT_HEAD(&pidlist, cur, next);
 	THREAD_UNLOCK();
 
 	return (iop);
@@ -171,7 +171,7 @@
 pclose(iop)
 	FILE *iop;
 {
-	struct pid *cur, *last;
+	struct pid *cur, *last = NULL;
 	int pstat;
 	pid_t pid;
 
@@ -179,17 +179,19 @@
 	 * Find the appropriate file pointer and remove it from the list.
 	 */
 	THREAD_LOCK();
-	for (last = NULL, cur = pidlist; cur; last = cur, cur = cur->next)
+	SLIST_FOREACH(cur, &pidlist, next) {
 		if (cur->fp == iop)
 			break;
+		last = cur;
+	}
 	if (cur == NULL) {
 		THREAD_UNLOCK();
 		return (-1);
 	}
 	if (last == NULL)
-		pidlist = cur->next;
+		SLIST_REMOVE_HEAD(&pidlist, next);
 	else
-		last->next = cur->next;
+		SLIST_REMOVE_NEXT(&pidlist, last, next);
 	THREAD_UNLOCK();
 
 	(void)fclose(iop);

==== //depot/projects/mpsafetty/lib/libc/stdio/mktemp.c#3 (text+ko) ====

@@ -31,10 +31,10 @@
 static char sccsid[] = "@(#)mktemp.c	8.1 (Berkeley) 6/4/93";
 #endif /* LIBC_SCCS and not lint */
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/lib/libc/stdio/mktemp.c,v 1.30 2008/07/22 15:08:50 ache Exp $");
+__FBSDID("$FreeBSD: src/lib/libc/stdio/mktemp.c,v 1.31 2008/07/28 21:18:59 jhb Exp $");
 
 #include "namespace.h"
-#include <sys/types.h>
+#include <sys/param.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
@@ -102,13 +102,14 @@
 	int domkdir;
 	int slen;
 {
-	char *start, *trv, *suffp;
+	char *start, *trv, *suffp, *carryp;
 	char *pad;
 	struct stat sbuf;
 	int rval;
 	uint32_t rand;
+	char carrybuf[MAXPATHLEN];
 
-	if (doopen != NULL && domkdir) {
+	if ((doopen != NULL && domkdir) || slen < 0) {
 		errno = EINVAL;
 		return (0);
 	}
@@ -118,7 +119,7 @@
 	trv -= slen;
 	suffp = trv;
 	--trv;
-	if (trv < path) {
+	if (trv < path || NULL != strchr(suffp, '/')) {
 		errno = EINVAL;
 		return (0);
 	}
@@ -130,6 +131,9 @@
 	}
 	start = trv + 1;
 
+	/* save first combination of random characters */
+	memcpy(carrybuf, start, suffp - start);
+
 	/*
 	 * check the target directory.
 	 */
@@ -166,14 +170,25 @@
 			return (errno == ENOENT);
 
 		/* If we have a collision, cycle through the space of filenames */
-		for (trv = start;;) {
-			if (*trv == '\0' || trv == suffp)
+		for (trv = start, carryp = carrybuf;;) {
+			/* have we tried all possible permutations? */
+			if (trv == suffp)
+				return (0); /* yes - exit with EEXIST */
+			pad = strchr(padchar, *trv);
+			if (pad == NULL) {
+				/* this should never happen */
+				errno = EIO;
 				return (0);
-			pad = strchr(padchar, *trv);
-			if (pad == NULL || *++pad == '\0')
-				*trv++ = padchar[0];
-			else {
-				*trv++ = *pad;
+			}
+			/* increment character */
+			*trv = (*++pad == '\0') ? padchar[0] : *pad;
+			/* carry to next position? */
+			if (*trv == *carryp) {
+				/* increment position and loop */
+				++trv;
+				++carryp;
+			} else {
+				/* try with new name */
 				break;
 			}
 		}

==== //depot/projects/mpsafetty/release/doc/en_US.ISO8859-1/relnotes/article.sgml#3 (text+ko) ====

@@ -17,7 +17,7 @@
 
   <corpauthor>The &os; Project</corpauthor>
 
-  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/article.sgml,v 1.1091 2008/07/22 05:02:46 bmah Exp $</pubdate>
+  <pubdate>$FreeBSD: src/release/doc/en_US.ISO8859-1/relnotes/article.sgml,v 1.1092 2008/07/29 04:23:18 bmah Exp $</pubdate>
 
   <copyright>
     <year>2000</year>
@@ -171,7 +171,7 @@
       Backwards compatibility for applications using KSE threading
       will be provided via &man.libmap.conf.5; for dynamically linked
       binaries.  The &os; Project greatly appreciates the work of
-      &a.julian; and &a.deischen; on KSE support.</para>
+      &a.julian;, &a.deischen;, and &a.davidxu; on KSE support.</para>
 
     <para>The &os; kernel now exports information about certain kernel
       features via the <varname>kern.features</varname> sysctl tree.

==== //depot/projects/mpsafetty/sbin/routed/routed.8#2 (text+ko) ====

@@ -28,7 +28,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     @(#)routed.8	8.2 (Berkeley) 12/11/93
-.\" $FreeBSD: src/sbin/routed/routed.8,v 1.34 2005/01/18 10:09:37 ru Exp $
+.\" $FreeBSD: src/sbin/routed/routed.8,v 1.35 2008/07/29 23:22:06 phk Exp $
 .\"
 .Dd June 1, 1996
 .Dt ROUTED 8
@@ -87,7 +87,7 @@
 deletes all pre-existing
 non-static routes in kernel table.
 Static routes in the kernel table are preserved and
-included in RIP responses if they have a valid RIP metric
+included in RIP responses if they have a valid RIP -hopcount
 (see
 .Xr route 8 ) .
 .Pp

==== //depot/projects/mpsafetty/share/colldef/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/colldef/Makefile,v 1.72 2007/12/24 10:30:08 ache Exp $
+# $FreeBSD: src/share/colldef/Makefile,v 1.73 2008/07/28 21:33:34 des Exp $
 
 LOCALES=	bg_BG.CP1251 \
 		be_BY.CP1131 \
@@ -23,6 +23,8 @@
 		la_LN.ISO8859-2 \
 		la_LN.ISO8859-4 \
 		la_LN.US-ASCII \
+		no_NO.ISO8859-1 \
+		no_NO.ISO8859-15 \
 		lt_LT.ISO8859-4 \
 		lt_LT.ISO8859-13 \
 		pl_PL.ISO8859-2 \
@@ -65,9 +67,11 @@
 ISO8859-1_ISO8859-1= ${ISO8859-15_ISO8859-15} pt_PT:pt_BR
 
 LATIN1LINKS=	af_ZA da_DK en_AU en_CA en_GB en_NZ en_US eu_ES fi_FI \
-		fr_BE fr_CA fr_CH fr_FR it_CH it_IT nb_NO nl_BE nl_NL \
-		nn_NO no_NO pt_PT
-ISO8859-15_ISO8859-15= de_DE:de_AT de_DE:de_CH ${LATIN1LINKS:C/^/la_LN:/}
+		fr_BE fr_CA fr_CH fr_FR it_CH it_IT nl_BE nl_NL pt_PT
+ISO8859-15_ISO8859-15= \
+	de_DE:de_AT de_DE:de_CH \
+	no_NO:nb_NO no_NO:nn_NO \
+	${LATIN1LINKS:C/^/la_LN:/}
 
 LATIN2LINKS=    hr_HR hu_HU ro_RO sr_YU
 ISO8859-2_ISO8859-2= ${LATIN2LINKS:C/^/la_LN:/} cs_CZ:sk_SK

==== //depot/projects/mpsafetty/share/syscons/keymaps/fr.macbook.acc.kbd#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/syscons/keymaps/fr.macbook.acc.kbd,v 1.1 2007/07/13 08:29:24 roberto Exp $
+# $FreeBSD: src/share/syscons/keymaps/fr.macbook.acc.kbd,v 1.2 2008/07/29 08:07:27 roberto Exp $
 #                                                         alt
 # scan                       cntrl          alt    alt   cntrl lock
 # code  base   shift  cntrl  shift  alt    shift  cntrl  shift state
@@ -52,7 +52,7 @@
   046   'c'    'C'    etx    etx    169    'C'    etx    etx     C
   047   'v'    'V'    syn    syn    'v'    'V'    syn    syn     C
   048   'b'    'B'    stx    stx    223    'B'    stx    stx     C
-  049   'n'    'N'    so     so     'n'    '~'    so     so      C
+  049   'n'    'N'    so     so     '~'    'N'    so     so      C
   050   ','    '?'    nop    nop    nop    nop    nop    nop     O
   051   ';'    '.'    nop    nop    ','    '<'    nop    nop     O
   052   ':'    '/'    nop    nop    '.'    '\'    nop    nop     O

==== //depot/projects/mpsafetty/share/timedef/Makefile#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/timedef/Makefile,v 1.50 2006/11/09 18:10:34 des Exp $
+# $FreeBSD: src/share/timedef/Makefile,v 1.52 2008/07/29 11:32:42 des Exp $
 
 LOCALES=	am_ET.UTF-8 \
 		be_BY.CP1131 \
@@ -54,11 +54,11 @@
 		lt_LT.ISO8859-13 \
 		lt_LT.UTF-8 \
 		mn_MN.UTF-8 \
+		nb_NO.ISO8859-1 \
+		nb_NO.UTF-8 \
 		nl_NL.ISO8859-1 \
 		nn_NO.ISO8859-1 \
 		nn_NO.UTF-8 \
-		no_NO.ISO8859-1 \
-		no_NO.UTF-8 \
 		pl_PL.ISO8859-2 \
 		pl_PL.UTF-8 \
 		pt_BR.ISO8859-1 \
@@ -118,7 +118,7 @@
 FR_LINKS=	fr_FR:fr_BE fr_FR:fr_CA fr_FR:fr_CH
 IT_LINKS=	it_IT:it_CH
 NL_LINKS=	nl_NL:nl_BE
-NO_LINKS=	no_NO:nb_NO
+NO_LINKS=	nb_NO:no_NO
 GB_LINKS=	en_GB:en_AU en_GB:en_CA en_GB:en_NZ
 
 eucKR_CP949=	ko_KR

==== //depot/projects/mpsafetty/sys/conf/NOTES#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/NOTES,v 1.1499 2008/07/18 14:44:51 dwmalone Exp $
+# $FreeBSD: src/sys/conf/NOTES,v 1.1502 2008/07/30 00:39:25 yongari Exp $
 #
 # NOTES -- Lines that can be cut/pasted into kernel and hints configs.
 #
@@ -1783,6 +1783,7 @@
 #	pcn(4) driver is left out of the kernel. The le(4) driver does not
 #	support the additional features like the MII bus and burst mode of
 #	the PCnet-FAST and greater chipsets though.
+# re:   RealTek 8139C+/8169/816xS/811xS/8101E PCI/PCIe Ethernet adapter
 # rl:   Support for PCI fast ethernet adapters based on the RealTek 8129/8139
 #       chipset.  Note that the RealTek driver defaults to using programmed
 #       I/O to do register accesses because memory mapped mode seems to cause
@@ -1877,15 +1878,19 @@
 hint.fxp.0.prefer_iomap="0"
 device		gem		# Apple GMAC/Sun ERI/Sun GEM
 device		hme		# Sun HME (Happy Meal Ethernet)
+device		jme		# JMicron JMC250 Gigabit/JMC260 Fast Ethernet
 device		lge		# Level 1 LXT1001 gigabit Ethernet
+device		msk		# Marvell/SysKonnect Yukon II Gigabit Ethernet
 device		my		# Myson Fast Ethernet (MTD80X, MTD89X)
 device		nge		# NatSemi DP83820 gigabit Ethernet
+device		re		# RealTek 8139C+/8169/8169S/8110S
 device		rl		# RealTek 8129/8139
 device		pcn		# AMD Am79C97x PCI 10/100 NICs
 device		sf		# Adaptec AIC-6915 (``Starfire'')
 device		sis		# Silicon Integrated Systems SiS 900/SiS 7016
 device		sk		# SysKonnect SK-984x & SK-982x gigabit Ethernet
 device		ste		# Sundance ST201 (D-Link DFE-550TX)
+device		stge		# Sundance/Tamarack TC9021 gigabit Ethernet
 device		tl		# Texas Instruments ThunderLAN
 device		tx		# SMC EtherPower II (83c170 ``EPIC'')
 device		vr		# VIA Rhine, Rhine II
@@ -1894,8 +1899,8 @@
 
 # PCI Ethernet NICs.
 device		de		# DEC/Intel DC21x4x (``Tulip'')
-#device		em		# Intel Pro/1000 Gigabit Ethernet
-#device		igb		# Intel Pro/1000 PCIE Gigabit Ethernet
+device		em		# Intel Pro/1000 Gigabit Ethernet
+device		igb		# Intel Pro/1000 PCIE Gigabit Ethernet
 #device		ixgbe		# Intel Pro/10Gbe PCIE Ethernet
 device		le		# AMD Am7900 LANCE and Am79C9xx PCnet
 device		mxge		# Myricom Myri-10G 10GbE NIC

==== //depot/projects/mpsafetty/sys/conf/files#6 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1318 2008/07/25 19:35:40 stas Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1319 2008/07/28 21:47:04 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -836,8 +836,6 @@
 dev/ixgb/ixgb_hw.c		optional ixgb
 dev/ixgbe/ixgbe.c		optional ixgbe \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
-dev/ixgbe/tcp_lro.c		optional ixgbe \
-	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_phy.c		optional ixgbe \
 	compile-with "${NORMAL_C} -I$S/dev/ixgbe"
 dev/ixgbe/ixgbe_api.c		optional ixgbe \

==== //depot/projects/mpsafetty/sys/dev/bfe/if_bfe.c#2 (text+ko) ====

@@ -26,7 +26,7 @@
 
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bfe/if_bfe.c,v 1.45 2008/04/30 02:49:24 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bfe/if_bfe.c,v 1.48 2008/07/29 09:02:00 yongari Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -171,18 +171,14 @@
 bfe_probe(device_t dev)
 {
 	struct bfe_type *t;
-	struct bfe_softc *sc;
+	uint16_t vendor, devid;
 
 	t = bfe_devs;
+	vendor = pci_get_vendor(dev);
+	devid = pci_get_device(dev);
 
-	sc = device_get_softc(dev);
-	bzero(sc, sizeof(struct bfe_softc));
-	sc->bfe_unit = device_get_unit(dev);
-	sc->bfe_dev = dev;
-
-	while(t->bfe_name != NULL) {
-		if ((pci_get_vendor(dev) == t->bfe_vid) &&
-				(pci_get_device(dev) == t->bfe_did)) {
+	while (t->bfe_name != NULL) {
+		if (vendor == t->bfe_vid && devid == t->bfe_did) {
 			device_set_desc_copy(dev, t->bfe_name);
 			return (BUS_PROBE_DEFAULT);
 		}
@@ -294,7 +290,7 @@
 	error = bus_dmamem_alloc(sc->bfe_rx_tag, (void *)&sc->bfe_rx_list,
 			BUS_DMA_NOWAIT, &sc->bfe_rx_map);
 
-	if(error)
+	if (error)
 		return (ENOMEM);
 
 	bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE);
@@ -302,7 +298,7 @@
 			sc->bfe_rx_list, sizeof(struct bfe_desc),
 			bfe_dma_map, &sc->bfe_rx_dma, BUS_DMA_NOWAIT);
 
-	if(error)
+	if (error)
 		return (ENOMEM);
 
 	bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, BUS_DMASYNC_PREWRITE);
@@ -316,7 +312,7 @@
 	error = bus_dmamap_load(sc->bfe_tx_tag, sc->bfe_tx_map,
 			sc->bfe_tx_list, sizeof(struct bfe_desc),
 			bfe_dma_map, &sc->bfe_tx_dma, BUS_DMA_NOWAIT);
-	if(error)
+	if (error)
 		return (ENOMEM);
 
 	bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE);
@@ -330,16 +326,14 @@
 {
 	struct ifnet *ifp = NULL;
 	struct bfe_softc *sc;
-	int unit, error = 0, rid;
+	int error = 0, rid;
 
 	sc = device_get_softc(dev);
 	mtx_init(&sc->bfe_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK,
 			MTX_DEF);
 	callout_init_mtx(&sc->bfe_stat_co, &sc->bfe_mtx, 0);
 
-	unit = device_get_unit(dev);
 	sc->bfe_dev = dev;
-	sc->bfe_unit = unit;
 
 	/*
 	 * Map control/status registers.
@@ -350,7 +344,7 @@
 	sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid,
 			RF_ACTIVE);
 	if (sc->bfe_res == NULL) {
-		printf ("bfe%d: couldn't map memory\n", unit);
+		device_printf(dev, "couldn't map memory\n");
 		error = ENXIO;
 		goto fail;
 	}
@@ -365,14 +359,13 @@
 	sc->bfe_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid,
 			RF_SHAREABLE | RF_ACTIVE);
 	if (sc->bfe_irq == NULL) {
-		printf("bfe%d: couldn't map interrupt\n", unit);
+		device_printf(dev, "couldn't map interrupt\n");
 		error = ENXIO;
 		goto fail;
 	}
 
 	if (bfe_dma_alloc(dev)) {
-		printf("bfe%d: failed to allocate DMA resources\n",
-		    sc->bfe_unit);
+		device_printf(dev, "failed to allocate DMA resources\n");
 		error = ENXIO;
 		goto fail;
 	}
@@ -380,7 +373,7 @@
 	/* Set up ifnet structure */
 	ifp = sc->bfe_ifp = if_alloc(IFT_ETHER);
 	if (ifp == NULL) {
-		printf("bfe%d: failed to if_alloc()\n", sc->bfe_unit);
+		device_printf(dev, "failed to if_alloc()\n");
 		error = ENOSPC;
 		goto fail;
 	}
@@ -404,7 +397,7 @@
 
 	if (mii_phy_probe(dev, &sc->bfe_miibus,
 				bfe_ifmedia_upd, bfe_ifmedia_sts)) {
-		printf("bfe%d: MII without any PHY!\n", sc->bfe_unit);
+		device_printf(dev, "MII without any PHY!\n");
 		error = ENXIO;
 		goto fail;
 	}
@@ -425,7 +418,7 @@
 			NULL, bfe_intr, sc, &sc->bfe_intrhand);
 
 	if (error) {
-		printf("bfe%d: couldn't set up irq\n", unit);
+		device_printf(dev, "couldn't set up irq\n");
 		goto fail;
 	}
 fail:
@@ -458,7 +451,7 @@
 	bfe_chip_reset(sc);
 
 	bus_generic_detach(dev);
-	if(sc->bfe_miibus != NULL)
+	if (sc->bfe_miibus != NULL)
 		device_delete_child(dev, sc->bfe_miibus);
 
 	bfe_release_resources(sc);
@@ -526,7 +519,7 @@
 	u_int32_t ret;
 
 	sc = device_get_softc(dev);
-	if(phy != sc->bfe_phyaddr)
+	if (phy != sc->bfe_phyaddr)
 		return (0);
 	bfe_readphy(sc, reg, &ret);
 
@@ -539,7 +532,7 @@
 	struct bfe_softc *sc;
 
 	sc = device_get_softc(dev);
-	if(phy != sc->bfe_phyaddr)
+	if (phy != sc->bfe_phyaddr)
 		return (0);
 	bfe_writephy(sc, reg, val);
 
@@ -593,7 +586,7 @@
 	int i;
 
 	for(i = 0; i < BFE_TX_LIST_CNT; i++) {
-		if(sc->bfe_tx_ring[i].bfe_mbuf != NULL) {
+		if (sc->bfe_tx_ring[i].bfe_mbuf != NULL) {
 			m_freem(sc->bfe_tx_ring[i].bfe_mbuf);
 			sc->bfe_tx_ring[i].bfe_mbuf = NULL;
 			bus_dmamap_unload(sc->bfe_tag,
@@ -627,7 +620,7 @@
 	int i;
 
 	for(i = 0; i < BFE_RX_LIST_CNT; i++) {
-		if(bfe_list_newbuf(sc, i, NULL) == ENOBUFS)
+		if (bfe_list_newbuf(sc, i, NULL) == ENOBUFS)
 			return (ENOBUFS);
 	}
 
@@ -652,9 +645,9 @@
 		return (EINVAL);
 
 	allocated = 0;
-	if(m == NULL) {
+	if (m == NULL) {
 		m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR);
-		if(m == NULL)
+		if (m == NULL)
 			return (ENOBUFS);
 		m->m_len = m->m_pkthdr.len = MCLBYTES;
 		allocated++;
@@ -676,15 +669,15 @@
 		if (allocated != 0)
 			m_free(m);
 		if (error != ENOMEM)
-			printf("bfe%d: failed to map RX buffer, error %d\n",
-			    sc->bfe_unit, error);
+			device_printf(sc->bfe_dev,
+			    "failed to map RX buffer, error %d\n", error);
 		return (ENOBUFS);
 	}
 	bus_dmamap_sync(sc->bfe_tag, r->bfe_map, BUS_DMASYNC_PREWRITE);
 
 	ctrl = ETHER_MAX_LEN + 32;
 
-	if(c == BFE_RX_LIST_CNT - 1)
+	if (c == BFE_RX_LIST_CNT - 1)
 		ctrl |= BFE_DESC_EOT;
 
 	d->bfe_ctrl = ctrl;
@@ -757,7 +750,7 @@
 	DELAY(100);
 	bfe_readphy(sc, 0, &val);
 	if (val & BMCR_RESET) {
-		printf("bfe%d: PHY Reset would not complete.\n", sc->bfe_unit);
+		device_printf(sc->bfe_dev, "PHY Reset would not complete.\n");
 		return (ENXIO);
 	}
 	return (0);
@@ -820,9 +813,9 @@
 
 	/* Internal or external PHY? */
 	val = CSR_READ_4(sc, BFE_DEVCTRL);
-	if(!(val & BFE_IPP))
+	if (!(val & BFE_IPP))
 		CSR_WRITE_4(sc, BFE_ENET_CTRL, BFE_ENET_EPSEL);
-	else if(CSR_READ_4(sc, BFE_DEVCTRL) & BFE_EPR) {
+	else if (CSR_READ_4(sc, BFE_DEVCTRL) & BFE_EPR) {
 		BFE_AND(sc, BFE_DEVCTRL, ~BFE_EPR);
 		DELAY(100);
 	}
@@ -867,7 +860,7 @@
 static void
 bfe_core_disable(struct bfe_softc *sc)
 {
-	if((CSR_READ_4(sc, BFE_SBTMSLOW)) & BFE_RESET)
+	if ((CSR_READ_4(sc, BFE_SBTMSLOW)) & BFE_RESET)
 		return;
 
 	/*
@@ -1023,7 +1016,7 @@
 	if (sc->bfe_ifp != NULL)
 		if_free(sc->bfe_ifp);
 
-	if(sc->bfe_tx_tag != NULL) {
+	if (sc->bfe_tx_tag != NULL) {
 		bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map);
 		bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list,
 		    sc->bfe_tx_map);
@@ -1031,7 +1024,7 @@
 		sc->bfe_tx_tag = NULL;
 	}
 
-	if(sc->bfe_rx_tag != NULL) {
+	if (sc->bfe_rx_tag != NULL) {
 		bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map);
 		bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list,
 		    sc->bfe_rx_map);
@@ -1039,7 +1032,7 @@
 		sc->bfe_rx_tag = NULL;
 	}
 
-	if(sc->bfe_tag != NULL) {
+	if (sc->bfe_tag != NULL) {
 		for(i = 0; i < BFE_TX_LIST_CNT; i++) {
 			bus_dmamap_destroy(sc->bfe_tag,
 			    sc->bfe_tx_ring[i].bfe_map);
@@ -1052,7 +1045,7 @@
 		sc->bfe_tag = NULL;
 	}
 
-	if(sc->bfe_parent_tag != NULL)
+	if (sc->bfe_parent_tag != NULL)
 		bus_dma_tag_destroy(sc->bfe_parent_tag);
 
 	return;
@@ -1084,9 +1077,9 @@
 		DELAY(10);
 	}
 	if (i == timeout) {
-		printf("bfe%d: BUG!  Timeout waiting for bit %08x of register "
-				"%x to %s.\n", sc->bfe_unit, bit, reg,
-				(clear ? "clear" : "set"));
+		device_printf(sc->bfe_dev,
+		    "BUG!  Timeout waiting for bit %08x of register "
+		    "%x to %s.\n", bit, reg, (clear ? "clear" : "set"));
 		return (-1);
 	}
 	return (0);
@@ -1179,9 +1172,9 @@
 
 	i = sc->bfe_tx_cons;
 	/* Go through the mbufs and free those that have been transmitted */
-	while(i != chipidx) {
+	while (i != chipidx) {
 		struct bfe_data *r = &sc->bfe_tx_ring[i];
-		if(r->bfe_mbuf != NULL) {
+		if (r->bfe_mbuf != NULL) {
 			ifp->if_opackets++;
 			m_freem(r->bfe_mbuf);
 			r->bfe_mbuf = NULL;
@@ -1191,7 +1184,7 @@
 		BFE_INC(i, BFE_TX_LIST_CNT);
 	}
 
-	if(i != sc->bfe_tx_cons) {
+	if (i != sc->bfe_tx_cons) {
 		/* we freed up some mbufs */
 		sc->bfe_tx_cons = i;
 		ifp->if_drv_flags &= ~IFF_DRV_OACTIVE;
@@ -1219,7 +1212,7 @@
 
 	ifp = sc->bfe_ifp;
 
-	while(current != cons) {
+	while (current != cons) {
 		r = &sc->bfe_rx_ring[cons];
 		m = r->bfe_mbuf;
 		rxheader = mtod(m, struct bfe_rxheader*);
@@ -1288,33 +1281,34 @@
 	CSR_READ_4(sc, BFE_ISTAT);
 
 	/* not expecting this interrupt, disregard it */
-	if(istat == 0) {
+	if (istat == 0) {
 		BFE_UNLOCK(sc);
 		return;
 	}
 
-	if(istat & BFE_ISTAT_ERRORS) {
+	if (istat & BFE_ISTAT_ERRORS) {
 
 		if (istat & BFE_ISTAT_DSCE) {
-			printf("if_bfe Descriptor Error\n");
+			device_printf(sc->bfe_dev, "Descriptor Error\n");
 			bfe_stop(sc);
 			BFE_UNLOCK(sc);
 			return;
 		}
 
 		if (istat & BFE_ISTAT_DPE) {
-			printf("if_bfe Descriptor Protocol Error\n");
+			device_printf(sc->bfe_dev,
+			    "Descriptor Protocol Error\n");
 			bfe_stop(sc);
 			BFE_UNLOCK(sc);
 			return;
 		}
 		
 		flag = CSR_READ_4(sc, BFE_DMATX_STAT);
-		if(flag & BFE_STAT_EMASK)
+		if (flag & BFE_STAT_EMASK)
 			ifp->if_oerrors++;
 
 		flag = CSR_READ_4(sc, BFE_DMARX_STAT);
-		if(flag & BFE_RX_FLAG_ERRORS)
+		if (flag & BFE_RX_FLAG_ERRORS)
 			ifp->if_ierrors++;
 
 		ifp->if_drv_flags &= ~IFF_DRV_RUNNING;
@@ -1322,11 +1316,11 @@
 	}
 
 	/* A packet was received */
-	if(istat & BFE_ISTAT_RX)
+	if (istat & BFE_ISTAT_RX)
 		bfe_rxeof(sc);
 
 	/* A packet was sent */
-	if(istat & BFE_ISTAT_TX)
+	if (istat & BFE_ISTAT_TX)
 		bfe_txeof(sc);
 
 	/* We have packets pending, fire them out */
@@ -1347,7 +1341,7 @@
 	int chainlen = 0;
 	int error;
 
-	if(BFE_TX_LIST_CNT - sc->bfe_tx_cnt < 2)
+	if (BFE_TX_LIST_CNT - sc->bfe_tx_cnt < 2)
 		return (ENOBUFS);
 
 	/*
@@ -1377,8 +1371,8 @@
 	cnt = 0;
 
 	for(m = *m_head; m != NULL; m = m->m_next) {
-		if(m->m_len != 0) {
-			if((BFE_TX_LIST_CNT - (sc->bfe_tx_cnt + cnt)) < 2)
+		if (m->m_len != 0) {
+			if ((BFE_TX_LIST_CNT - (sc->bfe_tx_cnt + cnt)) < 2)
 				return (ENOBUFS);
 
 			d = &sc->bfe_tx_list[cur];
@@ -1386,10 +1380,10 @@
 			d->bfe_ctrl = BFE_DESC_LEN & m->m_len;
 			/* always intterupt on completion */
 			d->bfe_ctrl |= BFE_DESC_IOC;
-			if(cnt == 0)
+			if (cnt == 0)
 				/* Set start of frame */
 				d->bfe_ctrl |= BFE_DESC_SOF;
-			if(cur == BFE_TX_LIST_CNT - 1)
+			if (cur == BFE_TX_LIST_CNT - 1)
 				/*
 				 * Tell the chip to wrap to the start of
 				 * the descriptor list
@@ -1459,16 +1453,16 @@
 	    IFF_DRV_RUNNING)
 		return;
 
-	while(sc->bfe_tx_ring[idx].bfe_mbuf == NULL) {
+	while (sc->bfe_tx_ring[idx].bfe_mbuf == NULL) {
 		IFQ_DRV_DEQUEUE(&ifp->if_snd, m_head);
-		if(m_head == NULL)
+		if (m_head == NULL)
 			break;
 
 		/*
 		 * Pack the data into the tx ring.  If we dont have
 		 * enough room, let the chip drain the ring.
 		 */
-		if(bfe_encap(sc, &m_head, &idx)) {
+		if (bfe_encap(sc, &m_head, &idx)) {
 			IFQ_DRV_PREPEND(&ifp->if_snd, m_head);
 			ifp->if_drv_flags |= IFF_DRV_OACTIVE;
 			break;
@@ -1522,8 +1516,8 @@
 	bfe_chip_reset(sc);
 
 	if (bfe_list_rx_init(sc) == ENOBUFS) {
-		printf("bfe%d: bfe_init: Not enough memory for list buffers\n",
-		    sc->bfe_unit);
+		device_printf(sc->bfe_dev,
+		    "%s: Not enough memory for list buffers\n", __func__);
 		bfe_stop(sc);
 		return;
 	}
@@ -1596,34 +1590,33 @@
 	struct mii_data *mii;
 	int error = 0;
 
-	switch(command) {
-		case SIOCSIFFLAGS:
-			BFE_LOCK(sc);
-			if(ifp->if_flags & IFF_UP)
-				if(ifp->if_drv_flags & IFF_DRV_RUNNING)
-					bfe_set_rx_mode(sc);
-				else
-					bfe_init_locked(sc);
-			else if(ifp->if_drv_flags & IFF_DRV_RUNNING)
-				bfe_stop(sc);
-			BFE_UNLOCK(sc);
-			break;
-		case SIOCADDMULTI:
-		case SIOCDELMULTI:
-			BFE_LOCK(sc);
-			if(ifp->if_drv_flags & IFF_DRV_RUNNING)
+	switch (command) {
+	case SIOCSIFFLAGS:
+		BFE_LOCK(sc);
+		if (ifp->if_flags & IFF_UP)
+			if (ifp->if_drv_flags & IFF_DRV_RUNNING)
 				bfe_set_rx_mode(sc);
-			BFE_UNLOCK(sc);
-			break;
-		case SIOCGIFMEDIA:
-		case SIOCSIFMEDIA:
-			mii = device_get_softc(sc->bfe_miibus);
-			error = ifmedia_ioctl(ifp, ifr, &mii->mii_media,
-			    command);
-			break;
-		default:
-			error = ether_ioctl(ifp, command, data);
-			break;
+			else
+				bfe_init_locked(sc);
+		else if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+			bfe_stop(sc);
+		BFE_UNLOCK(sc);
+		break;
+	case SIOCADDMULTI:
+	case SIOCDELMULTI:
+		BFE_LOCK(sc);
+		if (ifp->if_drv_flags & IFF_DRV_RUNNING)
+			bfe_set_rx_mode(sc);
+		BFE_UNLOCK(sc);
+		break;
+	case SIOCGIFMEDIA:
+	case SIOCSIFMEDIA:
+		mii = device_get_softc(sc->bfe_miibus);
+		error = ifmedia_ioctl(ifp, ifr, &mii->mii_media, command);
+		break;
+	default:
+		error = ether_ioctl(ifp, command, data);
+		break;
 	}
 
 	return (error);
@@ -1641,7 +1634,7 @@
 
 	ifp = sc->bfe_ifp;
 
-	printf("bfe%d: watchdog timeout -- resetting\n", sc->bfe_unit);
+	device_printf(sc->bfe_dev, "watchdog timeout -- resetting\n");
 
 	ifp->if_oerrors++;
 	ifp->if_drv_flags &= ~IFF_DRV_RUNNING;

==== //depot/projects/mpsafetty/sys/dev/bfe/if_bfereg.h#2 (text+ko) ====

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200807301033.m6UAXEhS032582>