PERFORCE change 144257 for review

John Birrell jb at FreeBSD.org
Sun Jun 29 03:17:47 UTC 2008


http://perforce.freebsd.org/chv.cgi?CH=144257

Change 144257 by jb at freebsd3 on 2008/06/29 03:17:01

	IF6

Affected files ...

.. //depot/projects/dtrace6/src/etc/mtree/BSD.include.dist#2 integrate
.. //depot/projects/dtrace6/src/games/morse/morse.6#2 integrate
.. //depot/projects/dtrace6/src/games/morse/morse.c#2 integrate
.. //depot/projects/dtrace6/src/include/Makefile#4 integrate
.. //depot/projects/dtrace6/src/libexec/rpc.rstatd/Makefile#2 integrate
.. //depot/projects/dtrace6/src/libexec/rpc.rstatd/rstat_proc.c#2 integrate
.. //depot/projects/dtrace6/src/share/man/man4/blackhole.4#2 integrate
.. //depot/projects/dtrace6/src/share/man/man4/ciss.4#3 integrate
.. //depot/projects/dtrace6/src/share/man/man4/cpufreq.4#2 integrate
.. //depot/projects/dtrace6/src/share/mk/bsd.cpu.mk#3 integrate
.. //depot/projects/dtrace6/src/share/sendmail/Makefile#2 integrate
.. //depot/projects/dtrace6/src/sys/boot/i386/libi386/biossmap.c#3 integrate
.. //depot/projects/dtrace6/src/sys/conf/files#7 integrate
.. //depot/projects/dtrace6/src/sys/dev/bge/if_bge.c#5 integrate
.. //depot/projects/dtrace6/src/sys/dev/bge/if_bgereg.h#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/ciss/ciss.c#4 integrate
.. //depot/projects/dtrace6/src/sys/dev/mfi/mfi.c#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/mfi/mfi_ioctl.h#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/mfi/mfi_pci.c#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/mii/brgphy.c#3 integrate
.. //depot/projects/dtrace6/src/sys/dev/mii/brgphyreg.h#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/mii/miidevs#5 integrate
.. //depot/projects/dtrace6/src/sys/dev/mpt/mpt.h#2 integrate
.. //depot/projects/dtrace6/src/sys/dev/mpt/mpt_user.c#1 branch
.. //depot/projects/dtrace6/src/sys/i386/cpufreq/est.c#4 integrate
.. //depot/projects/dtrace6/src/sys/i386/i386/machdep.c#4 integrate
.. //depot/projects/dtrace6/src/sys/kern/kern_mib.c#2 integrate
.. //depot/projects/dtrace6/src/sys/kern/sched_4bsd.c#3 integrate
.. //depot/projects/dtrace6/src/sys/modules/mpt/Makefile#2 integrate
.. //depot/projects/dtrace6/src/sys/pci/if_dc.c#3 integrate
.. //depot/projects/dtrace6/src/sys/sys/mpt_ioctl.h#1 branch
.. //depot/projects/dtrace6/src/sys/sys/sysctl.h#2 integrate
.. //depot/projects/dtrace6/src/sys/vm/vm_kern.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/cksum/cksum.c#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/shar/shar.sh#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/COPYING#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/Makefile#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/bsdtar.1#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/bsdtar.c#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/bsdtar.h#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/bsdtar_platform.h#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/config_freebsd.h#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/getdate.y#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/matching.c#3 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/read.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/tree.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/tree.h#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/util.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/tar/write.c#2 integrate
.. //depot/projects/dtrace6/src/usr.bin/whereis/whereis.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/config/main.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/Makefile#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/add/main.c#5 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/add/perform.c#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/create/main.c#4 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/lib/file.c#2 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/lib/lib.h#5 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/lib/url.c#3 integrate
.. //depot/projects/dtrace6/src/usr.sbin/pkg_install/updating/main.c#3 integrate

Differences ...

==== //depot/projects/dtrace6/src/etc/mtree/BSD.include.dist#2 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/etc/mtree/BSD.include.dist,v 1.100.2.4 2006/10/09 21:00:16 emax Exp $
+# $FreeBSD: src/etc/mtree/BSD.include.dist,v 1.100.2.5 2008/06/27 04:46:06 jhb Exp $
 #
 # Please see the file src/etc/mtree/README before making changes to this file.
 #
@@ -48,6 +48,10 @@
         ..
         iicbus
         ..
+        mpt
+            mpilib
+            ..
+        ..
         ofw
         ..
         pbio

==== //depot/projects/dtrace6/src/games/morse/morse.6#2 (text+ko) ====

@@ -31,7 +31,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"	@(#)bcd.6	8.1 (Berkeley) 5/31/93
-.\" $FreeBSD: src/games/morse/morse.6,v 1.17 2005/06/07 21:43:16 ru Exp $
+.\" $FreeBSD: src/games/morse/morse.6,v 1.17.2.1 2008/06/19 23:40:32 scf Exp $
 .\"
 .Dd June 7, 2005
 .Dt MORSE 6
@@ -172,7 +172,8 @@
 .Sh FILES
 .Bl -tag -width ".Pa /dev/speaker" -compact
 .It Pa /dev/speaker
-speaker device file
+.Xr speaker 4
+device file
 .El
 .Sh SEE ALSO
 .Xr speaker 4
@@ -180,7 +181,7 @@
 Sound support for
 .Nm
 added by
-.An Lyndon Nerenberg (VE7TCP/VE6BBM) Aq lyndon at orthanc.com .
+.An Lyndon Nerenberg (VE6BBM) Aq lyndon at orthanc.ca .
 .Pp
 Ability to key an external device added by
 .An J\(:org Wunsch

==== //depot/projects/dtrace6/src/games/morse/morse.c#2 (text+ko) ====

@@ -32,8 +32,8 @@
  */
 
 /*
- * Taught to send *real* morse by Lyndon Nerenberg (VE7TCP/VE6BBM)
- * <lyndon at orthanc.com>
+ * Taught to send *real* morse by Lyndon Nerenberg (VE6BBM)
+ * <lyndon at orthanc.ca>
  */
 
 #ifndef lint
@@ -47,7 +47,7 @@
 static char sccsid[] = "@(#)morse.c	8.1 (Berkeley) 5/31/93";
 #endif
 static const char rcsid[] =
- "$FreeBSD: src/games/morse/morse.c,v 1.20.2.1 2005/11/16 10:50:10 ru Exp $";
+ "$FreeBSD: src/games/morse/morse.c,v 1.20.2.2 2008/06/19 23:40:32 scf Exp $";
 #endif /* not lint */
 
 #include <sys/time.h>
@@ -483,7 +483,8 @@
 		printf(" %s\n", s);
 	} else {
 		for (; *s; ++s)
-			printf(" %s", *s == '.' ? "dit" : "dah");
+			printf(" %s", *s == '.' ? *(s + 1) == '\0' ? "dit" :
+			    "di" : "dah");
 		printf("\n");
 	}
 }

==== //depot/projects/dtrace6/src/include/Makefile#4 (text+ko) ====

@@ -1,5 +1,5 @@
 #	@(#)Makefile	8.2 (Berkeley) 1/4/94
-# $FreeBSD: src/include/Makefile,v 1.244.2.6 2006/10/09 21:00:17 emax Exp $
+# $FreeBSD: src/include/Makefile,v 1.244.2.7 2008/06/27 04:46:06 jhb Exp $
 #
 # Doing a "make install" builds /usr/include.
 
@@ -52,12 +52,14 @@
 	security/mac_mls security/mac_partition \
 	ufs/ffs ufs/ufs
 
+LSUBSUBDIRS=	dev/mpt/mpilib
+
 .if !defined(NO_GPIB)
 _dev_ieee488=	dev/ieee488
 .endif
 
 .if !defined(NO_BLUETOOTH)
-LSUBSUBDIRS=	netgraph/bluetooth/include
+LSUBSUBDIRS+=	netgraph/bluetooth/include
 .endif
 
 # Define SHARED to indicate whether you want symbolic links to the system

==== //depot/projects/dtrace6/src/libexec/rpc.rstatd/Makefile#2 (text+ko) ====

@@ -1,10 +1,10 @@
-# $FreeBSD: src/libexec/rpc.rstatd/Makefile,v 1.8 2004/02/04 10:20:43 ru Exp $
+# $FreeBSD: src/libexec/rpc.rstatd/Makefile,v 1.8.8.1 2008/06/27 02:20:37 jhb Exp $
 
 PROG =	rpc.rstatd
 SRCS =	rstatd.c rstat_proc.c
 MAN =	rpc.rstatd.8
 
-DPADD=	${LIBRPCSVC} ${LIBUTIL} ${LIBDEVSTAT} ${LIBKVM}
-LDADD=	-lrpcsvc -lutil -ldevstat -lkvm
+DPADD=	${LIBRPCSVC} ${LIBUTIL} ${LIBDEVSTAT}
+LDADD=	-lrpcsvc -lutil -ldevstat
 
 .include <bsd.prog.mk>

==== //depot/projects/dtrace6/src/libexec/rpc.rstatd/rstat_proc.c#2 (text+ko) ====

@@ -33,7 +33,7 @@
 static char sccsid[] = "from: @(#)rstat_proc.c	2.2 88/08/01 4.0 RPCSRC";
 #endif
 static const char rcsid[] =
-  "$FreeBSD: src/libexec/rpc.rstatd/rstat_proc.c,v 1.25 2003/06/02 02:34:36 obrien Exp $";
+  "$FreeBSD: src/libexec/rpc.rstatd/rstat_proc.c,v 1.25.10.1 2008/06/27 02:20:37 jhb Exp $";
 #endif
 
 /*
@@ -53,9 +53,7 @@
 #include <err.h>
 #include <errno.h>
 #include <fcntl.h>
-#include <kvm.h>
 #include <limits.h>
-#include <nlist.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -76,17 +74,8 @@
 #undef if_collisions
 #include <rpcsvc/rstat.h>
 
-struct nlist nl[] = {
-#define	X_CPTIME	0
-	{ "_cp_time" },
-#define	X_CNT		1
-	{ "_cnt" },
-	{ "" },
-};
-
 int haveadisk(void);
 void updatexfers(int, int *);
-void setup(void);
 int stats_service(void);
 
 extern int from_inetd;
@@ -101,7 +90,6 @@
 
 void updatestat();
 static int stat_is_init = 0;
-static kvm_t *kd;
 
 static int	cp_time_xlat[RSTAT_CPUSTATES] = { CP_USER, CP_NICE, CP_SYS,
 							CP_IDLE };
@@ -116,7 +104,6 @@
 stat_init(void)
 {
     stat_is_init = 1;
-    setup();
     alarm(0);
     updatestat();
     (void) signal(SIGALRM, updatestat);
@@ -194,7 +181,6 @@
 #ifdef DEBUG
                 fprintf(stderr, "about to closedown\n");
 #endif
-		kvm_close(kd);
                 if (from_inetd)
                         exit(0);
                 else {
@@ -213,9 +199,9 @@
 	}
 	hz = clockrate.hz;
 
-	if (kvm_read(kd, (long)nl[X_CPTIME].n_value, (char *)bsd_cp_time, sizeof(bsd_cp_time))
-	    != sizeof(bsd_cp_time)) {
-		syslog(LOG_ERR, "rstat: can't read cp_time from kmem");
+	len = sizeof(bsd_cp_time);
+	if (sysctlbyname("kern.cp_time", bsd_cp_time, &len, 0, 0) < 0) {
+		syslog(LOG_ERR, "sysctl(kern.cp_time): %m");
 		exit(1);
 	}
 	for(i = 0; i < RSTAT_CPUSTATES ; i++)
@@ -244,20 +230,23 @@
 	    stats_all.s1.cp_time[1], stats_all.s1.cp_time[2], stats_all.s1.cp_time[3]);
 #endif
 
-	/* XXX - should use sysctl */
- 	if (kvm_read(kd, (long)nl[X_CNT].n_value, (char *)&cnt, sizeof cnt) != sizeof cnt) {
-		syslog(LOG_ERR, "rstat: can't read cnt from kmem");
-		exit(1);
-	}
-	stats_all.s1.v_pgpgin = cnt.v_vnodepgsin;
-	stats_all.s1.v_pgpgout = cnt.v_vnodepgsout;
-	stats_all.s1.v_pswpin = cnt.v_swappgsin;
-	stats_all.s1.v_pswpout = cnt.v_swappgsout;
-	stats_all.s1.v_intr = cnt.v_intr;
+#define	FETCH_CNT(stat, cnt) do {					\
+	len = sizeof((stat));						\
+	if (sysctlbyname("vm.stats." #cnt , &(stat), &len, 0, 0) < 0) { \
+		syslog(LOG_ERR, "sysctl(vm.stats." #cnt "): %m"); \
+		exit(1);						\
+	}								\
+} while (0)
+
+	FETCH_CNT(stats_all.s1.v_pgpgin, vm.v_vnodepgsin);
+	FETCH_CNT(stats_all.s1.v_pgpgout, vm.v_vnodepgsout);
+	FETCH_CNT(stats_all.s1.v_pswpin, vm.v_swappgsin);
+	FETCH_CNT(stats_all.s1.v_pswpout, vm.v_swappgsout);
+	FETCH_CNT(stats_all.s1.v_intr, sys.v_intr);
+	FETCH_CNT(stats_all.s2.v_swtch, sys.v_swtch);
 	gettimeofday(&tm, (struct timezone *) 0);
 	stats_all.s1.v_intr -= hz*(tm.tv_sec - btm.tv_sec) +
 	    hz*(tm.tv_usec - btm.tv_usec)/1000000;
-	stats_all.s2.v_swtch = cnt.v_swtch;
 
 	/* update disk transfers */
 	updatexfers(RSTAT_DK_NDRIVE, stats_all.s1.dk_xfer);
@@ -303,24 +292,6 @@
 	alarm(1);
 }
 
-void
-setup()
-{
-	char errbuf[_POSIX2_LINE_MAX];
-
-	int en;
-
-	if ((kd = kvm_openfiles(NULL, NULL, NULL, O_RDONLY, errbuf)) == NULL) {
-		syslog(LOG_ERR, "rpc.rstatd, %s", errbuf);
-		exit(1);
-	}
-
-	if ((en = kvm_nlist(kd, nl)) != 0) {
-		syslog(LOG_ERR, "rstatd: Can't get namelist. %d", en);
-		exit (1);
-        }
-}
-
 /*
  * returns true if have a disk
  */

==== //depot/projects/dtrace6/src/share/man/man4/blackhole.4#2 (text+ko) ====

@@ -11,8 +11,8 @@
 .\"    documentation and/or other materials provided with the distribution.
 .\"
 .\"
-.\" $FreeBSD: src/share/man/man4/blackhole.4,v 1.12 2005/01/21 08:36:37 ru Exp $
-.Dd August 17, 1999
+.\" $FreeBSD: src/share/man/man4/blackhole.4,v 1.12.2.1 2008/06/20 22:52:33 danger Exp $
+.Dd January 1, 2007
 .Dt BLACKHOLE 4
 .Os
 .Sh NAME
@@ -58,12 +58,11 @@
 of service attack.
 .Sh WARNING
 The TCP and UDP blackhole features should not be regarded as a replacement
-for
-.Xr ipfw 8
-as a tool for firewalling a system.
-In order to create a highly secure system,
-.Xr ipfw 8
-should be used for protection, not the blackhole feature.
+for firewall solutions.
+Better security would consist of the
+.Nm
+.Xr sysctl 8
+MIB used in conjuction with one of the available firewall packages.
 .Pp
 This mechanism is not a substitute for securing a system.
 It should be used together with other security mechanisms.
@@ -71,7 +70,9 @@
 .Xr ip 4 ,
 .Xr tcp 4 ,
 .Xr udp 4 ,
+.Xr ipf 8 ,
 .Xr ipfw 8 ,
+.Xr pfctl 8 ,
 .Xr sysctl 8
 .Sh HISTORY
 The TCP and UDP

==== //depot/projects/dtrace6/src/share/man/man4/ciss.4#3 (text+ko) ====

@@ -1,4 +1,4 @@
-.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.11.2.4 2008/06/10 18:31:19 ps Exp $
+.\" $FreeBSD: src/share/man/man4/ciss.4,v 1.11.2.7 2008/06/25 09:24:35 peter Exp $
 .\" Written by Tom Rhodes
 .\" This file is in the public domain.
 .\"

==== //depot/projects/dtrace6/src/share/man/man4/cpufreq.4#2 (text+ko) ====

@@ -22,7 +22,7 @@
 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 .\" SUCH DAMAGE.
 .\"
-.\" $FreeBSD: src/share/man/man4/cpufreq.4,v 1.10.2.4 2006/06/19 04:44:20 brueffer Exp $
+.\" $FreeBSD: src/share/man/man4/cpufreq.4,v 1.10.2.5 2008/06/23 08:06:55 danger Exp $
 .\"
 .Dd March 03, 2006
 .Dt CPUFREQ 4
@@ -286,6 +286,7 @@
 .Dv CPUFREQ_VAL_UNKNOWN .
 .Sh SEE ALSO
 .Xr acpi 4 ,
+.Xr powerd 8 ,
 .Xr sysctl 8
 .Sh AUTHORS
 .An Nate Lawson

==== //depot/projects/dtrace6/src/share/mk/bsd.cpu.mk#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.48.2.5 2008/03/17 18:08:45 jhb Exp $
+# $FreeBSD: src/share/mk/bsd.cpu.mk,v 1.48.2.6 2008/06/26 05:46:11 ale Exp $
 
 # Set default CPU compile flags and baseline CPUTYPE for each arch.  The
 # compile flags must support the minimum CPU type for each architecture but
@@ -64,10 +64,10 @@
 # after /etc/make.conf so it can react to the local value of CPUTYPE
 # defined therein.  Consult:
 #	http://gcc.gnu.org/onlinedocs/gcc/DEC-Alpha-Options.html
-#	http://gcc.gnu.org/onlinedocs/gcc/IA-64-Options.html
-#	http://gcc.gnu.org/onlinedocs/gcc/RS-6000-and-PowerPC-Options.html
+#	http://gcc.gnu.org/onlinedocs/gcc/IA_002d64-Options.html
+#	http://gcc.gnu.org/onlinedocs/gcc/RS_002f6000-and-PowerPC-Options.html
 #	http://gcc.gnu.org/onlinedocs/gcc/SPARC-Options.html
-#	http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86-64-Options.html
+#	http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html
 
 . if ${MACHINE_ARCH} == "i386"
 .  if ${CPUTYPE} == "crusoe"

==== //depot/projects/dtrace6/src/share/sendmail/Makefile#2 (text+ko) ====

@@ -1,11 +1,11 @@
-# $FreeBSD: src/share/sendmail/Makefile,v 1.10 2004/12/21 08:46:54 ru Exp $
+# $FreeBSD: src/share/sendmail/Makefile,v 1.10.2.2 2008/06/25 09:29:46 peter Exp $
 #
 # Doing a make install builds /usr/share/sendmail/
 
 SENDMAIL_DIR=${.CURDIR}/../../contrib/sendmail
 CFDIR=	cf
-CFDIRS!=	(cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type d -print)
-CFFILES!=	(cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( -name CVS -prune \) -o -type f -print)
+CFDIRS!=	(cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( \( -name CVS -o -name .svn \) -prune \) -o -type d -print)
+CFFILES!=	(cd ${SENDMAIL_DIR}; find -L ${CFDIR} \( \( -name CVS -o -name .svn \) -prune \) -o -type f -print)
 
 DDIR=	${DESTDIR}/usr/share/sendmail
 

==== //depot/projects/dtrace6/src/sys/boot/i386/libi386/biossmap.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biossmap.c,v 1.3.2.3 2008/03/21 15:34:38 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/boot/i386/libi386/biossmap.c,v 1.3.2.4 2008/06/27 01:00:08 jhb Exp $");
 
 /*
  * Obtain memory configuration information from the BIOS
@@ -39,7 +39,10 @@
 #include "libi386.h"
 #include "btxv86.h"
 
-static struct bios_smap smap;
+static struct {
+	struct bios_smap _smap_entry;
+	char pad[8];		/* Bad BIOS writer, no cookie! */
+} smap;
 
 static struct bios_smap *smapbase;
 static int smaplen;

==== //depot/projects/dtrace6/src/sys/conf/files#7 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: src/sys/conf/files,v 1.1031.2.73 2008/04/24 10:46:18 dfr Exp $
+# $FreeBSD: src/sys/conf/files,v 1.1031.2.74 2008/06/27 04:46:06 jhb Exp $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -798,6 +798,7 @@
 dev/mpt/mpt_debug.c		optional mpt
 dev/mpt/mpt_pci.c		optional mpt pci
 dev/mpt/mpt_raid.c		optional mpt
+dev/mpt/mpt_user.c		optional mpt
 dev/msk/if_msk.c		optional msk
 dev/my/if_my.c			optional my
 dev/ncv/ncr53c500.c		optional ncv

==== //depot/projects/dtrace6/src/sys/dev/bge/if_bge.c#5 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.91.2.27 2008/05/14 21:22:17 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.91.2.31 2008/06/27 03:35:48 jhb Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -106,6 +106,13 @@
 #include "miidevs.h"
 #include <dev/mii/brgphyreg.h>
 
+#ifdef __sparc64__
+#include <dev/ofw/ofw_bus.h>
+#include <dev/ofw/openfirm.h>
+#include <machine/ofw_machdep.h>
+#include <machine/ver.h>
+#endif
+
 #include <dev/pci/pcireg.h>
 #include <dev/pci/pcivar.h>
 
@@ -189,6 +196,8 @@
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5901 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5901A2 },
 	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5903M },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5906 },
+	{ BCOM_VENDORID,	BCOM_DEVICEID_BCM5906M },
 
 	{ SK_VENDORID,		SK_DEVICEID_ALTIMA },
 
@@ -266,6 +275,8 @@
 	{ BGE_CHIPID_BCM5787_A0,	"BCM5754/5787 A0" }, 
 	{ BGE_CHIPID_BCM5787_A1,	"BCM5754/5787 A1" },
 	{ BGE_CHIPID_BCM5787_A2,	"BCM5754/5787 A2" },
+	{ BGE_CHIPID_BCM5906_A1,	"BCM5906 A1" },
+	{ BGE_CHIPID_BCM5906_A2,	"BCM5906 A2" },
 
 	{ 0, NULL }
 };
@@ -288,6 +299,7 @@
 	{ BGE_ASICREV_BCM5755,		"unknown BCM5755" },
 	/* 5754 and 5787 share the same ASIC ID */
 	{ BGE_ASICREV_BCM5787,		"unknown BCM5754/5787" },
+	{ BGE_ASICREV_BCM5906,		"unknown BCM5906" },
 
 	{ 0, NULL }
 };
@@ -300,6 +312,9 @@
 
 const struct bge_revision * bge_lookup_rev(uint32_t);
 const struct bge_vendor * bge_lookup_vendor(uint16_t);
+
+typedef int	(*bge_eaddr_fcn_t)(struct bge_softc *, uint8_t[]);
+
 static int bge_probe(device_t);
 static int bge_attach(device_t);
 static int bge_detach(device_t);
@@ -310,6 +325,12 @@
 static int bge_dma_alloc(device_t);
 static void bge_dma_free(struct bge_softc *);
 
+static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]);
+static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]);
+static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]);
+static int bge_get_eaddr_eeprom(struct bge_softc *, uint8_t[]);
+static int bge_get_eaddr(struct bge_softc *, uint8_t[]);
+
 static void bge_txeof(struct bge_softc *);
 static void bge_rxeof(struct bge_softc *);
 
@@ -332,6 +353,9 @@
 static int bge_ifmedia_upd(struct ifnet *);
 static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *);
 
+static uint8_t bge_nvram_getbyte(struct bge_softc *, int, uint8_t *);
+static int bge_read_nvram(struct bge_softc *, caddr_t, int, int);
+
 static uint8_t bge_eeprom_getbyte(struct bge_softc *, int, uint8_t *);
 static int bge_read_eeprom(struct bge_softc *, caddr_t, int, int);
 
@@ -350,8 +374,10 @@
 static int bge_chipinit(struct bge_softc *);
 static int bge_blockinit(struct bge_softc *);
 
+static int bge_has_eaddr(struct bge_softc *);
 static uint32_t bge_readmem_ind(struct bge_softc *, int);
 static void bge_writemem_ind(struct bge_softc *, int, int);
+static void bge_writembx(struct bge_softc *, int, int);
 #ifdef notdef
 static uint32_t bge_readreg_ind(struct bge_softc *, int);
 #endif
@@ -425,6 +451,50 @@
 SYSCTL_INT(_hw_bge, OID_AUTO, allow_asf, CTLFLAG_RD, &bge_allow_asf, 0,
 	"Allow ASF mode if available");
 
+#define	SPARC64_BLADE_1500_MODEL	"SUNW,Sun-Blade-1500"
+#define	SPARC64_BLADE_1500_PATH_BGE	"/pci at 1f,700000/network at 2"
+#define	SPARC64_BLADE_2500_MODEL	"SUNW,Sun-Blade-2500"
+#define	SPARC64_BLADE_2500_PATH_BGE	"/pci at 1c,600000/network at 3"
+#define	SPARC64_OFW_SUBVENDOR		"subsystem-vendor-id"
+
+static int
+bge_has_eaddr(struct bge_softc *sc)
+{
+#ifdef __sparc64__
+	char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)];
+	device_t dev;
+	uint32_t subvendor;
+
+	dev = sc->bge_dev;
+
+	/*
+	 * The on-board BGEs found in sun4u machines aren't fitted with
+	 * an EEPROM which means that we have to obtain the MAC address
+	 * via OFW and that some tests will always fail.  We distinguish
+	 * such BGEs by the subvendor ID, which also has to be obtained
+	 * from OFW instead of the PCI configuration space as the latter
+	 * indicates Broadcom as the subvendor of the netboot interface.
+	 * For early Blade 1500 and 2500 we even have to check the OFW
+	 * device path as the subvendor ID always defaults to Broadcom
+	 * there.
+	 */
+	if (OF_getprop(ofw_bus_get_node(dev), SPARC64_OFW_SUBVENDOR,
+	    &subvendor, sizeof(subvendor)) == sizeof(subvendor) &&
+	    subvendor == SUN_VENDORID)
+		return (0);
+	memset(buf, 0, sizeof(buf));
+	if (OF_package_to_path(ofw_bus_get_node(dev), buf, sizeof(buf)) > 0) {
+		if (strcmp(sparc64_model, SPARC64_BLADE_1500_MODEL) == 0 &&
+		    strcmp(buf, SPARC64_BLADE_1500_PATH_BGE) == 0)
+			return (0);
+		if (strcmp(sparc64_model, SPARC64_BLADE_2500_MODEL) == 0 &&
+		    strcmp(buf, SPARC64_BLADE_2500_PATH_BGE) == 0)
+			return (0);
+	}
+#endif
+	return (1);
+}
+
 static uint32_t
 bge_readmem_ind(struct bge_softc *sc, int off)
 {
@@ -481,6 +551,15 @@
 	CSR_WRITE_4(sc, off, val);
 }
 
+static void
+bge_writembx(struct bge_softc *sc, int off, int val)
+{
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5906)
+		off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI;
+
+	CSR_WRITE_4(sc, off, val);
+}
+
 /*
  * Map a single buffer address.
  */
@@ -503,6 +582,78 @@
 	ctx->bge_busaddr = segs->ds_addr;
 }
 
+static uint8_t
+bge_nvram_getbyte(struct bge_softc *sc, int addr, uint8_t *dest)
+{
+	uint32_t access, byte = 0;
+	int i;
+
+	/* Lock. */
+	CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1);
+	for (i = 0; i < 8000; i++) {
+		if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & BGE_NVRAMSWARB_GNT1)
+			break;
+		DELAY(20);
+	}
+	if (i == 8000)
+		return (1);
+
+	/* Enable access. */
+	access = CSR_READ_4(sc, BGE_NVRAM_ACCESS);
+	CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access | BGE_NVRAMACC_ENABLE);
+
+	CSR_WRITE_4(sc, BGE_NVRAM_ADDR, addr & 0xfffffffc);
+	CSR_WRITE_4(sc, BGE_NVRAM_CMD, BGE_NVRAM_READCMD);
+	for (i = 0; i < BGE_TIMEOUT * 10; i++) {
+		DELAY(10);
+		if (CSR_READ_4(sc, BGE_NVRAM_CMD) & BGE_NVRAMCMD_DONE) {
+			DELAY(10);
+			break;
+		}
+	}
+
+	if (i == BGE_TIMEOUT * 10) {
+		if_printf(sc->bge_ifp, "nvram read timed out\n");
+		return (1);
+	}
+
+	/* Get result. */
+	byte = CSR_READ_4(sc, BGE_NVRAM_RDDATA);
+
+	*dest = (bswap32(byte) >> ((addr % 4) * 8)) & 0xFF;
+
+	/* Disable access. */
+	CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access);
+
+	/* Unlock. */
+	CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_CLR1);
+	CSR_READ_4(sc, BGE_NVRAM_SWARB);
+
+	return (0);
+}
+
+/*
+ * Read a sequence of bytes from NVRAM.
+ */
+static int
+bge_read_nvram(struct bge_softc *sc, caddr_t dest, int off, int cnt)
+{
+	int err = 0, i;
+	uint8_t byte = 0;
+
+	if (sc->bge_asicrev != BGE_ASICREV_BCM5906)
+		return (1);
+
+	for (i = 0; i < cnt; i++) {
+		err = bge_nvram_getbyte(sc, off + i, &byte);
+		if (err)
+			break;
+		*(dest + i) = byte;
+	}
+
+	return (err ? 1 : 0);
+}
+
 /*
  * Read a byte of data stored in the EEPROM at address 'addr.' The
  * BCM570x supports both the traditional bitbang interface and an
@@ -536,7 +687,7 @@
 			break;
 	}
 
-	if (i == BGE_TIMEOUT) {
+	if (i == BGE_TIMEOUT * 10) {
 		device_printf(sc->bge_dev, "EEPROM read timed out\n");
 		return (1);
 	}
@@ -600,17 +751,21 @@
 	    BGE_MIPHY(phy) | BGE_MIREG(reg));
 
 	for (i = 0; i < BGE_TIMEOUT; i++) {
+		DELAY(10);
 		val = CSR_READ_4(sc, BGE_MI_COMM);
 		if (!(val & BGE_MICOMM_BUSY))
 			break;
 	}
 
 	if (i == BGE_TIMEOUT) {
-		device_printf(sc->bge_dev, "PHY read timed out\n");
+		device_printf(sc->bge_dev,
+		    "PHY read timed out (phy %d, reg %d, val 0x%08x)\n",
+		    phy, reg, val);
 		val = 0;
 		goto done;
 	}
 
+	DELAY(5);
 	val = CSR_READ_4(sc, BGE_MI_COMM);
 
 done:
@@ -634,6 +789,10 @@
 
 	sc = device_get_softc(dev);
 
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5906 &&
+	    (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL))
+		return(0);
+
 	/* Reading with autopolling on may trigger PCI errors */
 	autopoll = CSR_READ_4(sc, BGE_MI_MODE);
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
@@ -645,19 +804,26 @@
 	    BGE_MIPHY(phy) | BGE_MIREG(reg) | val);
 
 	for (i = 0; i < BGE_TIMEOUT; i++) {
-		if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY))
+		DELAY(10);
+		if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) {
+			DELAY(5);
+			CSR_READ_4(sc, BGE_MI_COMM); /* dummy read */
 			break;
+		}
 	}
 
+	if (i == BGE_TIMEOUT) {
+		device_printf(sc->bge_dev,
+		    "PHY write timed out (phy %d, reg %d, val %d)\n",
+		    phy, reg, val);
+		return (0);
+	}
+
 	if (autopoll & BGE_MIMODE_AUTOPOLL) {
 		BGE_SETBIT(sc, BGE_MI_MODE, BGE_MIMODE_AUTOPOLL);
 		DELAY(40);
 	}
 
-	if (i == BGE_TIMEOUT) {
-		device_printf(sc->bge_dev, "PHY read timed out\n");
-		return (0);
-	}
 
 	return (0);
 }
@@ -833,7 +999,7 @@
 	    BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
 
 	sc->bge_std = i - 1;
-	CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);
+	bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std);
 
 	return (0);
 }
@@ -880,7 +1046,7 @@
 				    BGE_RCB_FLAG_USE_EXT_RX_BD);
 	CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags);
 
-	CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
+	bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo);
 
 	return (0);
 }
@@ -936,17 +1102,17 @@
 
 	/* Initialize transmit producer index for host-memory send ring. */
 	sc->bge_tx_prodidx = 0;
-	CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx);
+	bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx);
 
 	/* 5700 b2 errata */
 	if (sc->bge_chiprev == BGE_CHIPREV_5700_BX)
-		CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx);
+		bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx);
 
 	/* NIC-memory send ring not used; initialize to zero. */
-	CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
+	bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
 	/* 5700 b2 errata */
 	if (sc->bge_chiprev == BGE_CHIPREV_5700_BX)
-		CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
+		bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0);
 
 	return (0);
 }
@@ -1097,9 +1263,12 @@
 
 	/*
 	 * Check the 'ROM failed' bit on the RX CPU to see if
-	 * self-tests passed.
+	 * self-tests passed. Skip this check when there's no
+	 * chip containing the Ethernet address fitted, since
+	 * in that case it will always fail.
 	 */
-	if (CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
+	if ((sc->bge_flags & BGE_FLAG_EADDR) &&
+	    CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) {
 		device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n");
 		return (ENODEV);
 	}
@@ -1209,6 +1378,16 @@
 	/* Set the timer prescaler (always 66Mhz) */
 	CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ);
 
+	/* XXX: The Linux tg3 driver does this at the start of brgphy_reset. */
+	if (sc->bge_asicrev == BGE_ASICREV_BCM5906) {
+		DELAY(40);	/* XXX */
+
+		/* Put PHY into ready state */
+		BGE_CLRBIT(sc, BGE_MISC_CFG, BGE_MISCCFG_EPHY_IDDQ);
+		CSR_READ_4(sc, BGE_MISC_CFG); /* Flush */
+		DELAY(40);
+	}
+
 	return (0);
 }
 
@@ -1246,14 +1425,19 @@
 	}
 
 	/* Configure mbuf pool watermarks */
-	if (BGE_IS_5705_PLUS(sc)) {
+	if (!BGE_IS_5705_PLUS(sc)) {
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
+	} else if (sc->bge_asicrev == BGE_ASICREV_BCM5906) {
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10);
+	} else {
 		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0);
 		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10);
-	} else {
-		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50);
-		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20);
+		CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
 	}
-	CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60);
 
 	/* Configure DMA resource watermarks */
 	CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_LOWAT, 5);
@@ -1266,9 +1450,9 @@
 
 		/* Poll for buffer manager start indication */
 		for (i = 0; i < BGE_TIMEOUT; i++) {
+			DELAY(10);
 			if (CSR_READ_4(sc, BGE_BMAN_MODE) & BGE_BMANMODE_ENABLE)
 				break;
-			DELAY(10);
 		}
 
 		if (i == BGE_TIMEOUT) {
@@ -1284,9 +1468,9 @@
 
 	/* Wait until queue initialization is complete */
 	for (i = 0; i < BGE_TIMEOUT; i++) {
+		DELAY(10);
 		if (CSR_READ_4(sc, BGE_FTQ_RESET) == 0)
 			break;
-		DELAY(10);
 	}
 
 	if (i == BGE_TIMEOUT) {
@@ -1359,6 +1543,9 @@
 	 * requirement of all 575x family chips.  The Linux driver sets
 	 * the lower threshold for all 5705 family chips as well, but there
 	 * are reports that it might not need to be so strict.
+	 *
+	 * XXX Linux does some extra fiddling here for the 5906 parts as
+	 * well.
 	 */
 	if (BGE_IS_5705_PLUS(sc))
 		val = 8;
@@ -1400,15 +1587,15 @@
 		    BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt,
 		    BGE_RCB_FLAG_RING_DISABLED));
 		RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0);
-		CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO +
+		bge_writembx(sc, BGE_MBX_RX_CONS0_LO +
 		    (i * (sizeof(uint64_t))), 0);
 		vrcb += sizeof(struct bge_rcb);
 	}
 
 	/* Initialize RX ring indexes */
-	CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, 0);
-	CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0);
-	CSR_WRITE_4(sc, BGE_MBX_RX_MINI_PROD_LO, 0);
+	bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0);
+	bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0);
+	bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0);
 
 	/*
 	 * Set up RX return ring 0
@@ -1455,9 +1642,9 @@
 
 	/* Poll to make sure it's shut down. */
 	for (i = 0; i < BGE_TIMEOUT; i++) {
+		DELAY(10);
 		if (!(CSR_READ_4(sc, BGE_HCC_MODE) & BGE_HCCMODE_ENABLE))
 			break;
-		DELAY(10);
 	}
 
 	if (i == BGE_TIMEOUT) {
@@ -2161,9 +2348,8 @@
 	struct ifnet *ifp;
 	struct bge_softc *sc;
 	uint32_t hwcfg = 0;
-	uint32_t mac_tmp = 0;
-	u_char eaddr[6];
-	int error = 0, rid, trys, reg;
+	u_char eaddr[ETHER_ADDR_LEN];
+	int error, reg, rid, trys;
 
 	sc = device_get_softc(dev);
 	sc->bge_dev = dev;
@@ -2194,6 +2380,19 @@
 	sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid);
 	sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid);
 
+	/*
+	 * Don't enable Ethernet at WireSpeed for the 5700, 5906, or the
+	 * 5705 A0 and A1 chips.
+	 */
+	if (sc->bge_asicrev != BGE_ASICREV_BCM5700 &&
+	    sc->bge_asicrev != BGE_ASICREV_BCM5906 &&
+	    sc->bge_chipid != BGE_CHIPID_BCM5705_A0 &&
+	    sc->bge_chipid != BGE_CHIPID_BCM5705_A1)
+		sc->bge_flags |= BGE_FLAG_WIRESPEED;
+
+	if (bge_has_eaddr(sc))
+		sc->bge_flags |= BGE_FLAG_EADDR;
+
 	/* Save chipset family. */
 	switch (sc->bge_asicrev) {
 	case BGE_ASICREV_BCM5700:
@@ -2211,6 +2410,7 @@
 	case BGE_ASICREV_BCM5752:
 	case BGE_ASICREV_BCM5755:
 	case BGE_ASICREV_BCM5787:
+	case BGE_ASICREV_BCM5906:
 		sc->bge_flags |= BGE_FLAG_575X_PLUS;
 		/* FALLTHRU */

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


More information about the p4-projects mailing list