Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2008 22:49:47 GMT
From:      Marko Zec <zec@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 153636 for review
Message-ID:  <200811262249.mAQMnl07005425@repoman.freebsd.org>

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

Change 153636 by zec@zec_tca51 on 2008/11/26 22:49:41

	IFC @ 153631

Affected files ...

.. //depot/projects/vimage/src/sys/amd64/amd64/amd64_mem.c#3 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/identcpu.c#11 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/initcpu.c#3 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/local_apic.c#13 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/mp_machdep.c#12 integrate
.. //depot/projects/vimage/src/sys/amd64/amd64/msi.c#6 integrate
.. //depot/projects/vimage/src/sys/amd64/include/cputypes.h#2 integrate
.. //depot/projects/vimage/src/sys/amd64/include/md_var.h#5 integrate
.. //depot/projects/vimage/src/sys/amd64/include/specialreg.h#11 integrate
.. //depot/projects/vimage/src/sys/boot/i386/boot0/boot0.S#3 integrate
.. //depot/projects/vimage/src/sys/compat/linux/linux_ipc.c#4 integrate
.. //depot/projects/vimage/src/sys/dev/coretemp/coretemp.c#5 integrate
.. //depot/projects/vimage/src/sys/dev/fxp/if_fxp.c#7 integrate
.. //depot/projects/vimage/src/sys/dev/fxp/if_fxpreg.h#3 integrate
.. //depot/projects/vimage/src/sys/dev/fxp/if_fxpvar.h#3 integrate
.. //depot/projects/vimage/src/sys/dev/hwpmc/hwpmc_intel.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/hwpmc/hwpmc_piv.c#7 integrate
.. //depot/projects/vimage/src/sys/dev/hwpmc/hwpmc_ppro.c#7 integrate
.. //depot/projects/vimage/src/sys/dev/hwpmc/hwpmc_x86.c#7 integrate
.. //depot/projects/vimage/src/sys/dev/patm/if_patm_intr.c#2 integrate
.. //depot/projects/vimage/src/sys/dev/usb/u3g.c#6 integrate
.. //depot/projects/vimage/src/sys/dev/usb/usbdevs#36 integrate
.. //depot/projects/vimage/src/sys/fs/cd9660/cd9660_rrip.c#10 integrate
.. //depot/projects/vimage/src/sys/fs/nullfs/null_vnops.c#9 integrate
.. //depot/projects/vimage/src/sys/geom/part/g_part_bsd.c#7 integrate
.. //depot/projects/vimage/src/sys/i386/cpufreq/est.c#8 integrate
.. //depot/projects/vimage/src/sys/i386/cpufreq/p4tcc.c#4 integrate
.. //depot/projects/vimage/src/sys/i386/cpufreq/powernow.c#6 integrate
.. //depot/projects/vimage/src/sys/i386/i386/i686_mem.c#3 integrate
.. //depot/projects/vimage/src/sys/i386/i386/identcpu.c#13 integrate
.. //depot/projects/vimage/src/sys/i386/i386/initcpu.c#5 integrate
.. //depot/projects/vimage/src/sys/i386/i386/k6_mem.c#3 integrate
.. //depot/projects/vimage/src/sys/i386/i386/local_apic.c#13 integrate
.. //depot/projects/vimage/src/sys/i386/i386/longrun.c#2 integrate
.. //depot/projects/vimage/src/sys/i386/i386/mp_machdep.c#13 integrate
.. //depot/projects/vimage/src/sys/i386/i386/msi.c#6 integrate
.. //depot/projects/vimage/src/sys/i386/include/cputypes.h#2 integrate
.. //depot/projects/vimage/src/sys/i386/include/md_var.h#3 integrate
.. //depot/projects/vimage/src/sys/i386/include/specialreg.h#11 integrate
.. //depot/projects/vimage/src/sys/kern/kern_poll.c#12 integrate
.. //depot/projects/vimage/src/sys/kern/kern_sysctl.c#14 integrate
.. //depot/projects/vimage/src/sys/net/bpf.c#29 integrate
.. //depot/projects/vimage/src/sys/net/if.c#52 integrate
.. //depot/projects/vimage/src/sys/net/if_loop.c#32 integrate
.. //depot/projects/vimage/src/sys/net/route.c#35 integrate
.. //depot/projects/vimage/src/sys/netinet/if_ether.c#29 integrate
.. //depot/projects/vimage/src/sys/netinet/in_pcb.c#41 integrate
.. //depot/projects/vimage/src/sys/netinet/in_rmx.c#24 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_divert.c#22 integrate
.. //depot/projects/vimage/src/sys/netinet/ip_fw_pfil.c#14 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_input.c#46 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_subr.c#62 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_syncache.c#48 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_timewait.c#22 integrate
.. //depot/projects/vimage/src/sys/netinet/tcp_usrreq.c#26 integrate
.. //depot/projects/vimage/src/sys/netinet/udp_usrreq.c#41 integrate
.. //depot/projects/vimage/src/sys/netinet/vinet.h#36 integrate
.. //depot/projects/vimage/src/sys/netinet6/icmp6.c#35 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_ifattach.c#28 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.c#26 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_pcb.h#5 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_proto.c#35 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_rmx.c#24 integrate
.. //depot/projects/vimage/src/sys/netinet6/in6_src.c#29 integrate
.. //depot/projects/vimage/src/sys/netinet6/nd6_nbr.c#28 integrate
.. //depot/projects/vimage/src/sys/netinet6/nd6_rtr.c#24 integrate
.. //depot/projects/vimage/src/sys/netinet6/raw_ip6.c#30 integrate
.. //depot/projects/vimage/src/sys/netinet6/udp6_usrreq.c#34 integrate
.. //depot/projects/vimage/src/sys/netipsec/ipsec.c#32 integrate
.. //depot/projects/vimage/src/sys/netipsec/key.c#32 integrate
.. //depot/projects/vimage/src/sys/netipsec/keysock.c#21 integrate
.. //depot/projects/vimage/src/sys/netipsec/vipsec.h#19 integrate

Differences ...

==== //depot/projects/vimage/src/sys/amd64/amd64/amd64_mem.c#3 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/amd64_mem.c,v 1.29 2008/03/12 22:09:19 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/amd64_mem.c,v 1.30 2008/11/26 19:25:13 jkim Exp $");
 
 #include <sys/param.h>
 #include <sys/kernel.h>
@@ -35,6 +35,7 @@
 #include <sys/smp.h>
 #include <sys/sysctl.h>
 
+#include <machine/cputypes.h>
 #include <machine/md_var.h>
 #include <machine/specialreg.h>
 
@@ -677,8 +678,8 @@
 		return;
 	if ((cpu_id & 0xf00) != 0x600 && (cpu_id & 0xf00) != 0xf00)
 		return;
-	if ((strcmp(cpu_vendor, "GenuineIntel") != 0) &&
-	    (strcmp(cpu_vendor, "AuthenticAMD") != 0))
+	if (cpu_vendor_id != CPU_VENDOR_INTEL &&
+	    cpu_vendor_id != CPU_VENDOR_AMD)
 		return;
 	mem_range_softc.mr_op = &amd64_mrops;
 }

==== //depot/projects/vimage/src/sys/amd64/amd64/identcpu.c#11 (text+ko) ====

@@ -39,7 +39,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.164 2008/10/22 17:30:37 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/identcpu.c,v 1.166 2008/11/26 19:29:33 jkim Exp $");
 
 #include "opt_cpu.h"
 
@@ -69,6 +69,7 @@
 void earlysetcpuclass(void);
 void panicifcpuunsupported(void);
 
+static u_int find_cpu_vendor_id(void);
 static void print_AMD_info(void);
 static void print_AMD_assoc(int i);
 
@@ -95,6 +96,14 @@
 	{ "Sledgehammer",	CPUCLASS_K8 },		/* CPU_SLEDGEHAMMER */
 };
 
+static struct {
+	char	*vendor;
+	u_int	vendor_id;
+} cpu_vendors[] = {
+	{ INTEL_VENDOR_ID,	CPU_VENDOR_INTEL },	/* GenuineIntel */
+	{ AMD_VENDOR_ID,	CPU_VENDOR_AMD },	/* AuthenticAMD */
+};
+
 int cpu_cores;
 int cpu_logical;
 
@@ -122,10 +131,10 @@
 		}
 	}
 
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0) {
+	if (cpu_vendor_id == CPU_VENDOR_INTEL) {
 		/* Please make up your mind folks! */
 		strcat(cpu_model, "EM64T");
-	} else if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
+	} else if (cpu_vendor_id == CPU_VENDOR_AMD) {
 		/*
 		 * Values taken from AMD Processor Recognition
 		 * http://www.amd.com/K6/k6docs/pdf/20734g.pdf
@@ -165,13 +174,13 @@
 		printf("Unknown");	/* will panic below... */
 	}
 	printf("-class CPU)\n");
-	if(*cpu_vendor)
-		printf("  Origin = \"%s\"",cpu_vendor);
-	if(cpu_id)
+	if (*cpu_vendor)
+		printf("  Origin = \"%s\"", cpu_vendor);
+	if (cpu_id)
 		printf("  Id = 0x%x", cpu_id);
 
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0 ||
-	    strcmp(cpu_vendor, "AuthenticAMD") == 0) {
+	if (cpu_vendor_id == CPU_VENDOR_INTEL ||
+	    cpu_vendor_id == CPU_VENDOR_AMD) {
 		printf("  Stepping = %u", cpu_id & 0xf);
 		if (cpu_high > 0) {
 			u_int cmp = 1, htt = 1;
@@ -343,22 +352,28 @@
 				);
 			}
 
-			if (cpu_feature & CPUID_HTT && strcmp(cpu_vendor,
-			    "AuthenticAMD") == 0)
+			if ((cpu_feature & CPUID_HTT) &&
+			    cpu_vendor_id == CPU_VENDOR_AMD)
 				cpu_feature &= ~CPUID_HTT;
 
 			/*
 			 * If this CPU supports P-state invariant TSC then
 			 * mention the capability.
 			 */
-			if (!tsc_is_invariant &&
-			    (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
-			    ((amd_pminfo & AMDPM_TSC_INVARIANT) != 0 ||
-			    AMD64_CPU_FAMILY(cpu_id) >= 0x10 ||
-			    cpu_id == 0x60fb2))) {
-				tsc_is_invariant = 1;
+			switch (cpu_vendor_id) {
+			case CPU_VENDOR_AMD:
+				if ((amd_pminfo & AMDPM_TSC_INVARIANT) ||
+				    AMD64_CPU_FAMILY(cpu_id) >= 0x10 ||
+				    cpu_id == 0x60fb2)
+					tsc_is_invariant = 1;
+				break;
+			case CPU_VENDOR_INTEL:
+				if (amd_pminfo & AMDPM_TSC_INVARIANT)
+					tsc_is_invariant = 1;
+				break;
+			}
+			if (tsc_is_invariant)
 				printf("\n  TSC: P-state invariant");
-			}
 
 			/*
 			 * If this CPU supports HTT or CMP then mention the
@@ -366,10 +381,10 @@
 			 */
 			if (cpu_feature & CPUID_HTT)
 				htt = (cpu_procinfo & CPUID_HTT_CORES) >> 16;
-			if (strcmp(cpu_vendor, "AuthenticAMD") == 0 &&
+			if (cpu_vendor_id == CPU_VENDOR_AMD &&
 			    (amd_feature2 & AMDID2_CMP))
 				cmp = (cpu_procinfo2 & AMDID_CMP_CORES) + 1;
-			else if (strcmp(cpu_vendor, "GenuineIntel") == 0 &&
+			else if (cpu_vendor_id == CPU_VENDOR_INTEL &&
 			    (cpu_high >= 4)) {
 				cpuid_count(4, 0, regs);
 				if ((regs[0] & 0x1f) != 0)
@@ -391,7 +406,7 @@
 	if (!bootverbose)
 		return;
 
-	if (strcmp(cpu_vendor, "AuthenticAMD") == 0)
+	if (cpu_vendor_id == CPU_VENDOR_AMD)
 		print_AMD_info();
 }
 
@@ -450,6 +465,7 @@
 	((u_int *)&cpu_vendor)[1] = regs[3];
 	((u_int *)&cpu_vendor)[2] = regs[2];
 	cpu_vendor[12] = '\0';
+	cpu_vendor_id = find_cpu_vendor_id();
 
 	do_cpuid(1, regs);
 	cpu_id = regs[0];
@@ -457,8 +473,8 @@
 	cpu_feature = regs[3];
 	cpu_feature2 = regs[2];
 
-	if (strcmp(cpu_vendor, "GenuineIntel") == 0 ||
-	    strcmp(cpu_vendor, "AuthenticAMD") == 0) {
+	if (cpu_vendor_id == CPU_VENDOR_INTEL ||
+	    cpu_vendor_id == CPU_VENDOR_AMD) {
 		do_cpuid(0x80000000, regs);
 		cpu_exthigh = regs[0];
 	}
@@ -480,6 +496,17 @@
 	cpu = CPU_CLAWHAMMER;
 }
 
+static u_int
+find_cpu_vendor_id(void)
+{
+	int	i;
+
+	for (i = 0; i < sizeof(cpu_vendors) / sizeof(cpu_vendors[0]); i++)
+		if (strcmp(cpu_vendor, cpu_vendors[i].vendor) == 0)
+			return (cpu_vendors[i].vendor_id);
+	return (0);
+}
+
 static void
 print_AMD_assoc(int i)
 {

==== //depot/projects/vimage/src/sys/amd64/amd64/initcpu.c#3 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.51 2008/10/21 00:17:55 jkim Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/initcpu.c,v 1.52 2008/11/26 19:25:13 jkim Exp $");
 
 #include "opt_cpu.h"
 
@@ -60,6 +60,7 @@
 u_int	cpu_procinfo;		/* HyperThreading Info / Brand Index / CLFUSH */
 u_int	cpu_procinfo2;		/* Multicore info */
 char	cpu_vendor[20];		/* CPU Origin code */
+u_int	cpu_vendor_id;		/* CPU vendor ID */
 u_int	cpu_fxsr;		/* SSE enabled */
 u_int	cpu_mxcsr_mask;		/* Valid bits in mxcsr */
 

==== //depot/projects/vimage/src/sys/amd64/amd64/local_apic.c#13 (text+ko) ====

@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.48 2008/10/27 21:45:18 sobomax Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/local_apic.c,v 1.49 2008/11/26 19:25:13 jkim Exp $");
 
 #include "opt_hwpmc_hooks.h"
 #include "opt_kdtrace.h"
@@ -323,7 +323,7 @@
 
 	/* XXX: Error and thermal LVTs */
 
-	if (strcmp(cpu_vendor, "AuthenticAMD") == 0) {
+	if (cpu_vendor_id == CPU_VENDOR_AMD) {
 		/*
 		 * Detect the presence of C1E capability mostly on latest
 		 * dual-cores (or future) k8 family.  This feature renders

==== //depot/projects/vimage/src/sys/amd64/amd64/mp_machdep.c#12 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.294 2008/09/28 18:34:14 marius Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/mp_machdep.c,v 1.295 2008/11/26 19:25:13 jkim Exp $");
 
 #include "opt_cpu.h"
 #include "opt_kstack_pages.h"
@@ -57,6 +57,7 @@
 #include <vm/vm_extern.h>
 
 #include <machine/apicreg.h>
+#include <machine/cputypes.h>
 #include <machine/md_var.h>
 #include <machine/mp_watchdog.h>
 #include <machine/pcb.h>
@@ -374,8 +375,7 @@
 	 * First determine if this is an Intel processor which claims
 	 * to have hyperthreading support.
 	 */
-	if ((cpu_feature & CPUID_HTT) &&
-	    (strcmp(cpu_vendor, "GenuineIntel") == 0)) {
+	if ((cpu_feature & CPUID_HTT) && cpu_vendor_id == CPU_VENDOR_INTEL) {
 		/*
 		 * If the "deterministic cache parameters" cpuid calls
 		 * are available, use them.

==== //depot/projects/vimage/src/sys/amd64/amd64/msi.c#6 (text+ko) ====

@@ -35,7 +35,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.7 2007/10/24 21:16:22 jhb Exp $");
+__FBSDID("$FreeBSD: src/sys/amd64/amd64/msi.c,v 1.8 2008/11/26 19:25:13 jkim Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -46,6 +46,7 @@
 #include <sys/sx.h>
 #include <sys/systm.h>
 #include <machine/apicreg.h>
+#include <machine/cputypes.h>
 #include <machine/md_var.h>
 #include <machine/frame.h>
 #include <machine/intr_machdep.h>
@@ -211,8 +212,8 @@
 {
 
 	/* Check if we have a supported CPU. */
-	if (!(strcmp(cpu_vendor, "GenuineIntel") == 0 ||
-	      strcmp(cpu_vendor, "AuthenticAMD") == 0))
+	if (!(cpu_vendor_id == CPU_VENDOR_INTEL ||
+	    cpu_vendor_id == CPU_VENDOR_AMD))
 		return;
 
 	msi_enabled = 1;

==== //depot/projects/vimage/src/sys/amd64/include/cputypes.h#2 (text+ko) ====

@@ -24,7 +24,7 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/cputypes.h,v 1.19 2005/01/05 20:17:20 imp Exp $
+ * $FreeBSD: src/sys/amd64/include/cputypes.h,v 1.20 2008/11/26 19:25:13 jkim Exp $
  */
 
 #ifndef _MACHINE_CPUTYPES_H_
@@ -33,15 +33,21 @@
 /*
  * Classes of processor.
  */
-#define	CPUCLASS_X86	0	/* X86 */
-#define	CPUCLASS_K8	1	/* K8 AMD64 class */
+#define	CPUCLASS_X86		0	/* X86 */
+#define	CPUCLASS_K8		1	/* K8 AMD64 class */
 
 /*
  * Kinds of processor.
  */
-#define	CPU_X86		0	/* Intel */
-#define	CPU_CLAWHAMMER	1	/* AMD Clawhammer */
-#define	CPU_SLEDGEHAMMER 2	/* AMD Sledgehammer */
+#define	CPU_X86			0	/* Intel */
+#define	CPU_CLAWHAMMER		1	/* AMD Clawhammer */
+#define	CPU_SLEDGEHAMMER	2	/* AMD Sledgehammer */
+
+/*
+ * Vendors of processor.
+ */
+#define	CPU_VENDOR_AMD		0x1022		/* AMD */
+#define	CPU_VENDOR_INTEL	0x8086		/* Intel */
 
 #ifndef LOCORE
 extern int	cpu;

==== //depot/projects/vimage/src/sys/amd64/include/md_var.h#5 (text+ko) ====

@@ -26,7 +26,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: src/sys/amd64/include/md_var.h,v 1.82 2008/10/21 00:17:55 jkim Exp $
+ * $FreeBSD: src/sys/amd64/include/md_var.h,v 1.83 2008/11/26 19:25:13 jkim Exp $
  */
 
 #ifndef _MACHINE_MD_VAR_H_
@@ -52,6 +52,7 @@
 extern	u_int	cpu_procinfo;
 extern	u_int	cpu_procinfo2;
 extern	char	cpu_vendor[];
+extern	u_int	cpu_vendor_id;
 extern	char	kstack[];
 extern	char	sigcode[];
 extern	int	szsigcode;

==== //depot/projects/vimage/src/sys/amd64/include/specialreg.h#11 (text+ko) ====

@@ -27,7 +27,7 @@
  * SUCH DAMAGE.
  *
  *	from: @(#)specialreg.h	7.1 (Berkeley) 5/9/91
- * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.49 2008/10/22 17:36:52 jkim Exp $
+ * $FreeBSD: src/sys/amd64/include/specialreg.h,v 1.50 2008/11/26 19:25:13 jkim Exp $
  */
 
 #ifndef _MACHINE_SPECIALREG_H_
@@ -196,8 +196,8 @@
 /*
  * CPUID manufacturers identifiers
  */
-#define	INTEL_VENDOR_ID	"GenuineIntel"
-#define	AMD_VENDOR_ID	"AuthenticAMD"
+#define	AMD_VENDOR_ID		"AuthenticAMD"
+#define	INTEL_VENDOR_ID		"GenuineIntel"
 
 /*
  * Model-specific registers for the i386 family

==== //depot/projects/vimage/src/sys/boot/i386/boot0/boot0.S#3 (text+ko) ====

@@ -13,7 +13,7 @@
  * warranties of merchantability and fitness for a particular
  * purpose.
  *
- * $FreeBSD: src/sys/boot/i386/boot0/boot0.S,v 1.16 2007/03/26 21:56:13 thomas Exp $
+ * $FreeBSD: src/sys/boot/i386/boot0/boot0.S,v 1.18 2008/11/26 21:38:43 luigi Exp $
  */
 
 /* A 512-byte boot manager. */
@@ -319,8 +319,9 @@
 		jc main.10			# If error
 		cmpw $MAGIC,0x1fe(%bx)		# Bootable?
 		jne main.10			# No
-		movw $crlf,%si			# Leave some
-		callw puts			#  space
+		pushw %si			# Save ptr to selected part.
+		callw putn			# Leave some space
+		popw %si			# Restore, next stage uses it
 		jmp *%bx			# Invoke bootstrap
 
 /*

==== //depot/projects/vimage/src/sys/compat/linux/linux_ipc.c#4 (text+ko) ====

@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.54 2007/01/14 16:34:43 netchild Exp $");
+__FBSDID("$FreeBSD: src/sys/compat/linux/linux_ipc.c,v 1.55 2008/11/26 16:38:43 rdivacky Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -672,6 +672,14 @@
 	return (error);
     }
 
+/* 
+ * TODO: implement this 
+ * case LINUX_MSG_STAT:
+ */
+    case LINUX_IPC_STAT:
+	/* NOTHING */
+	break;
+
     case LINUX_IPC_SET:
 	error = linux_msqid_pullup(args->cmd & LINUX_IPC_64,
 	    &linux_msqid, PTRIN(args->buf));
@@ -679,6 +687,14 @@
 	    return (error);
 	linux_to_bsd_msqid_ds(&linux_msqid, &bsd_msqid);
 	break;
+
+    case LINUX_IPC_RMID:
+	/* NOTHING */
+	break;
+
+    default:
+	return (EINVAL);
+	break;
     }
 
     error = kern_msgctl(td, args->msqid, bsd_cmd, &bsd_msqid);

==== //depot/projects/vimage/src/sys/dev/coretemp/coretemp.c#5 (text+ko) ====

@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/coretemp/coretemp.c,v 1.8 2008/05/14 10:02:25 rpaulo Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/coretemp/coretemp.c,v 1.9 2008/11/26 19:25:13 jkim Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -45,6 +45,7 @@
 
 #include <machine/specialreg.h>
 #include <machine/cpufunc.h>
+#include <machine/cputypes.h>
 #include <machine/md_var.h>
 
 struct coretemp_softc {
@@ -94,7 +95,7 @@
 		return;
 
 	/* Check that CPUID 0x06 is supported and the vendor is Intel.*/
-	if (cpu_high < 6 || strcmp(cpu_vendor, "GenuineIntel"))
+	if (cpu_high < 6 || cpu_vendor_id != CPU_VENDOR_INTEL)
 		return;
 	/*
 	 * CPUID 0x06 returns 1 if the processor has on-die thermal

==== //depot/projects/vimage/src/sys/dev/fxp/if_fxp.c#7 (text+ko) ====

@@ -28,7 +28,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.274 2008/11/25 04:33:02 yongari Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/fxp/if_fxp.c,v 1.277 2008/11/26 07:36:17 yongari Exp $");
 
 /*
  * Intel EtherExpress Pro/100B PCI Fast Ethernet driver
@@ -59,15 +59,15 @@
 #include <net/if_types.h>
 #include <net/if_vlan_var.h>
 
-#include <machine/bus.h>
-#include <machine/resource.h>
-
-#ifdef FXP_IP_CSUM_WAR
 #include <netinet/in.h>
 #include <netinet/in_systm.h>
 #include <netinet/ip.h>
+#include <netinet/tcp.h>
+#include <netinet/udp.h>
+
+#include <machine/bus.h>
 #include <machine/in_cksum.h>
-#endif
+#include <machine/resource.h>
 
 #include <dev/pci/pcivar.h>
 #include <dev/pci/pcireg.h>		/* for PCIM_CMD_xxx */
@@ -213,6 +213,8 @@
 static int		fxp_resume(device_t dev);
 
 static void		fxp_intr(void *xsc);
+static void		fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp,
+			    struct mbuf *m, uint16_t status, int pos);
 static void		fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp,
 			    uint8_t statack, int count);
 static void 		fxp_init(void *xsc);
@@ -227,8 +229,12 @@
 static int		fxp_ioctl(struct ifnet *ifp, u_long command,
 			    caddr_t data);
 static void 		fxp_watchdog(struct fxp_softc *sc);
-static int		fxp_add_rfabuf(struct fxp_softc *sc,
-    			    struct fxp_rx *rxp, struct mbuf *oldm);
+static void		fxp_add_rfabuf(struct fxp_softc *sc,
+    			    struct fxp_rx *rxp);
+static void		fxp_discard_rfabuf(struct fxp_softc *sc,
+    			    struct fxp_rx *rxp);
+static int		fxp_new_rfabuf(struct fxp_softc *sc,
+    			    struct fxp_rx *rxp);
 static int		fxp_mc_addrs(struct fxp_softc *sc);
 static void		fxp_mc_setup(struct fxp_softc *sc);
 static uint16_t		fxp_eeprom_getword(struct fxp_softc *sc, int offset,
@@ -587,6 +593,9 @@
 		sc->flags |= FXP_FLAG_SAVE_BAD;
 	}
 
+	/* For 82559 or later chips, Rx checksum offload is supported. */
+	if (sc->revision >= FXP_REV_82559_A0)
+		sc->flags |= FXP_FLAG_82559_RXCSUM;
 	/*
 	 * Enable use of extended RFDs and TCBs for 82550
 	 * and later chips. Note: we need extended TXCB support
@@ -599,6 +608,8 @@
 		sc->rfa_size = sizeof (struct fxp_rfa);
 		sc->tx_cmd = FXP_CB_COMMAND_IPCBXMIT;
 		sc->flags |= FXP_FLAG_EXT_RFA;
+		/* Use extended RFA instead of 82559 checksum mode. */
+		sc->flags &= ~FXP_FLAG_82559_RXCSUM;
 	} else {
 		sc->rfa_size = sizeof (struct fxp_rfa) - FXP_RFAX_LEN;
 		sc->tx_cmd = FXP_CB_COMMAND_XMIT;
@@ -608,11 +619,15 @@
 	 * Allocate DMA tags and DMA safe memory.
 	 */
 	sc->maxtxseg = FXP_NTXSEG;
-	if (sc->flags & FXP_FLAG_EXT_RFA)
+	sc->maxsegsize = MCLBYTES;
+	if (sc->flags & FXP_FLAG_EXT_RFA) {
 		sc->maxtxseg--;
+		sc->maxsegsize = FXP_TSO_SEGSIZE;
+	}
 	error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0,
 	    BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
-	    MCLBYTES * sc->maxtxseg, sc->maxtxseg, MCLBYTES, 0,
+	    sc->maxsegsize * sc->maxtxseg + sizeof(struct ether_vlan_header),
+	    sc->maxtxseg, sc->maxsegsize, 0,
 	    busdma_lock_mutex, &Giant, &sc->fxp_mtag);
 	if (error) {
 		device_printf(dev, "could not allocate dma tag\n");
@@ -712,10 +727,11 @@
 			device_printf(dev, "can't create DMA map for RX\n");
 			goto fail;
 		}
-		if (fxp_add_rfabuf(sc, rxp, NULL) != 0) {
+		if (fxp_new_rfabuf(sc, rxp) != 0) {
 			error = ENOMEM;
 			goto fail;
 		}
+		fxp_add_rfabuf(sc, rxp);
 	}
 
 	/*
@@ -768,11 +784,16 @@
 
 	ifp->if_capabilities = ifp->if_capenable = 0;
 
-	/* Enable checksum offload for 82550 or better chips */
+	/* Enable checksum offload/TSO for 82550 or better chips */
 	if (sc->flags & FXP_FLAG_EXT_RFA) {
-		ifp->if_hwassist = FXP_CSUM_FEATURES;
-		ifp->if_capabilities |= IFCAP_HWCSUM;
-		ifp->if_capenable |= IFCAP_HWCSUM;
+		ifp->if_hwassist = FXP_CSUM_FEATURES | CSUM_TSO;
+		ifp->if_capabilities |= IFCAP_HWCSUM | IFCAP_TSO4;
+		ifp->if_capenable |= IFCAP_HWCSUM | IFCAP_TSO4;
+	}
+
+	if (sc->flags & FXP_FLAG_82559_RXCSUM) {
+		ifp->if_capabilities |= IFCAP_RXCSUM;
+		ifp->if_capenable |= IFCAP_RXCSUM;
 	}
 
 #ifdef DEVICE_POLLING
@@ -1258,12 +1279,15 @@
 	struct mbuf *m;
 	struct fxp_tx *txp;
 	struct fxp_cb_tx *cbp;
+	struct tcphdr *tcp;
 	bus_dma_segment_t segs[FXP_NTXSEG];
-	int error, i, nseg;
+	int error, i, nseg, tcp_payload;
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
 	ifp = sc->ifp;
 
+	tcp_payload = 0;
+	tcp = NULL;
 	/*
 	 * Get pointer to next available tx desc.
 	 */
@@ -1341,6 +1365,75 @@
 #endif
 	}
 
+	if (m->m_pkthdr.csum_flags & CSUM_TSO) {
+		/*
+		 * 82550/82551 requires ethernet/IP/TCP headers must be
+		 * contained in the first active transmit buffer.
+		 */
+		struct ether_header *eh;
+		struct ip *ip;
+		uint32_t ip_off, poff;
+
+		if (M_WRITABLE(*m_head) == 0) {
+			/* Get a writable copy. */
+			m = m_dup(*m_head, M_DONTWAIT);
+			m_freem(*m_head);
+			if (m == NULL) {
+				*m_head = NULL;
+				return (ENOBUFS);
+			}
+			*m_head = m;
+		}
+		ip_off = sizeof(struct ether_header);
+		m = m_pullup(*m_head, ip_off);
+		if (m == NULL) {
+			*m_head = NULL;
+			return (ENOBUFS);
+		}
+		eh = mtod(m, struct ether_header *);
+		/* Check the existence of VLAN tag. */
+		if (eh->ether_type == htons(ETHERTYPE_VLAN)) {
+			ip_off = sizeof(struct ether_vlan_header);
+			m = m_pullup(m, ip_off);
+			if (m == NULL) {
+				*m_head = NULL;
+				return (ENOBUFS);
+			}
+		}
+		m = m_pullup(m, ip_off + sizeof(struct ip));
+		if (m == NULL) {
+			*m_head = NULL;
+			return (ENOBUFS);
+		}
+		ip = (struct ip *)(mtod(m, char *) + ip_off);
+		poff = ip_off + (ip->ip_hl << 2);
+		m = m_pullup(m, poff + sizeof(struct tcphdr));
+		if (m == NULL) {
+			*m_head = NULL;
+			return (ENOBUFS);
+		}
+		tcp = (struct tcphdr *)(mtod(m, char *) + poff);
+		m = m_pullup(m, poff + sizeof(struct tcphdr) + tcp->th_off);
+		if (m == NULL) {
+			*m_head = NULL;
+			return (ENOBUFS);
+		}
+
+		/*
+		 * Since 82550/82551 doesn't modify IP length and pseudo
+		 * checksum in the first frame driver should compute it.
+		 */
+		ip->ip_sum = 0;
+		ip->ip_len = htons(ifp->if_mtu);
+		tcp->th_sum = in_pseudo(ip->ip_src.s_addr, ip->ip_dst.s_addr,
+		    htons(IPPROTO_TCP + (tcp->th_off << 2) +
+		    m->m_pkthdr.tso_segsz));
+		/* Compute total TCP payload. */
+		tcp_payload = m->m_pkthdr.len - ip_off - (ip->ip_hl << 2);
+		tcp_payload -= tcp->th_off << 2;
+		*m_head = m;
+	}
+
 	error = bus_dmamap_load_mbuf_sg(sc->fxp_mtag, txp->tx_map, *m_head,
 	    segs, &nseg, 0);
 	if (error == EFBIG) {
@@ -1371,7 +1464,6 @@
 
 	cbp = txp->tx_cb;
 	for (i = 0; i < nseg; i++) {
-		KASSERT(segs[i].ds_len <= MCLBYTES, ("segment size too large"));
 		/*
 		 * If this is an 82550/82551, then we're using extended
 		 * TxCBs _and_ we're using checksum offload. This means
@@ -1386,14 +1478,28 @@
 		 * the chip is an 82550/82551 or not.
 		 */
 		if (sc->flags & FXP_FLAG_EXT_RFA) {
-			cbp->tbd[i + 1].tb_addr = htole32(segs[i].ds_addr);
-			cbp->tbd[i + 1].tb_size = htole32(segs[i].ds_len);
+			cbp->tbd[i + 2].tb_addr = htole32(segs[i].ds_addr);
+			cbp->tbd[i + 2].tb_size = htole32(segs[i].ds_len);
 		} else {
 			cbp->tbd[i].tb_addr = htole32(segs[i].ds_addr);
 			cbp->tbd[i].tb_size = htole32(segs[i].ds_len);
 		}
 	}
-	cbp->tbd_number = nseg;
+	if (sc->flags & FXP_FLAG_EXT_RFA) {
+		/* Configure dynamic TBD for 82550/82551. */
+		cbp->tbd_number = 0xFF;
+		cbp->tbd[nseg + 1].tb_size |= htole32(0x8000);
+	} else
+		cbp->tbd_number = nseg;
+	/* Configure TSO. */
+	if (m->m_pkthdr.csum_flags & CSUM_TSO) {
+		cbp->tbd[-1].tb_size = htole32(m->m_pkthdr.tso_segsz << 16);
+		cbp->tbd[1].tb_size = htole32(tcp_payload << 16);
+		cbp->ipcb_ip_schedule |= FXP_IPCB_LARGESEND_ENABLE |
+		    FXP_IPCB_IP_CHECKSUM_ENABLE |
+		    FXP_IPCB_TCP_PACKET |
+		    FXP_IPCB_TCPUDP_CHECKSUM_ENABLE;
+	}
 
 	txp->tx_mbuf = m;
 	txp->tx_cb->cb_status = 0;
@@ -1406,7 +1512,8 @@
 		txp->tx_cb->cb_command =
 		    htole16(sc->tx_cmd | FXP_CB_COMMAND_SF |
 		    FXP_CB_COMMAND_S | FXP_CB_COMMAND_I);
-	txp->tx_cb->tx_threshold = tx_threshold;
+	if ((m->m_pkthdr.csum_flags & CSUM_TSO) == 0)
+		txp->tx_cb->tx_threshold = tx_threshold;
 
 	/*
 	 * Advance the end of list forward.
@@ -1553,6 +1660,84 @@
 }
 
 static void
+fxp_rxcsum(struct fxp_softc *sc, struct ifnet *ifp, struct mbuf *m,
+    uint16_t status, int pos)
+{
+	struct ether_header *eh;
+	struct ip *ip;
+	struct udphdr *uh;
+	int32_t hlen, len, pktlen, temp32;
+	uint16_t csum, *opts;
+
+	if ((sc->flags & FXP_FLAG_82559_RXCSUM) == 0) {
+		if ((status & FXP_RFA_STATUS_PARSE) != 0) {
+			if (status & FXP_RFDX_CS_IP_CSUM_BIT_VALID)
+				m->m_pkthdr.csum_flags |= CSUM_IP_CHECKED;
+			if (status & FXP_RFDX_CS_IP_CSUM_VALID)
+				m->m_pkthdr.csum_flags |= CSUM_IP_VALID;
+			if ((status & FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID) &&
+			    (status & FXP_RFDX_CS_TCPUDP_CSUM_VALID)) {
+				m->m_pkthdr.csum_flags |= CSUM_DATA_VALID |
+				    CSUM_PSEUDO_HDR;
+				m->m_pkthdr.csum_data = 0xffff;
+			}
+		}
+		return;
+	}
+
+	pktlen = m->m_pkthdr.len;
+	if (pktlen < sizeof(struct ether_header) + sizeof(struct ip))
+		return;
+	eh = mtod(m, struct ether_header *);
+	if (eh->ether_type != htons(ETHERTYPE_IP))
+		return;
+	ip = (struct ip *)(eh + 1);
+	if (ip->ip_v != IPVERSION)
+		return;
+
+	hlen = ip->ip_hl << 2;
+	pktlen -= sizeof(struct ether_header);
+	if (hlen < sizeof(struct ip))
+		return;
+	if (ntohs(ip->ip_len) < hlen)
+		return;
+	if (ntohs(ip->ip_len) != pktlen)
+		return;
+	if (ip->ip_off & htons(IP_MF | IP_OFFMASK))
+		return;	/* can't handle fragmented packet */
+
+	switch (ip->ip_p) {
+	case IPPROTO_TCP:
+		if (pktlen < (hlen + sizeof(struct tcphdr)))
+			return;
+		break;
+	case IPPROTO_UDP:
+		if (pktlen < (hlen + sizeof(struct udphdr)))
+			return;
+		uh = (struct udphdr *)((caddr_t)ip + hlen);
+		if (uh->uh_sum == 0)
+			return; /* no checksum */
+		break;
+	default:
+		return;
+	}
+	/* Extract computed checksum. */
+	csum = be16dec(mtod(m, char *) + pos);
+	/* checksum fixup for IP options */
+	len = hlen - sizeof(struct ip);
+	if (len > 0) {
+		opts = (uint16_t *)(ip + 1);
+		for (; len > 0; len -= sizeof(uint16_t), opts++) {
+			temp32 = csum - *opts;
+			temp32 = (temp32 >> 16) + (temp32 & 65535);
+			csum = temp32 & 65535;
+		}
+	}
+	m->m_pkthdr.csum_flags |= CSUM_DATA_VALID;
+	m->m_pkthdr.csum_data = csum;
+}
+
+static void
 fxp_intr_body(struct fxp_softc *sc, struct ifnet *ifp, uint8_t statack,
     int count)
 {
@@ -1560,7 +1745,6 @@
 	struct fxp_rx *rxp;
 	struct fxp_rfa *rfa;
 	int rnr = (statack & FXP_SCB_STATACK_RNR) ? 1 : 0;
-	int fxp_rc = 0;
 	uint16_t status;
 
 	FXP_LOCK_ASSERT(sc, MA_OWNED);
@@ -1647,8 +1831,7 @@
 		 * If this fails, the old buffer is recycled
 		 * instead.
 		 */
-		fxp_rc = fxp_add_rfabuf(sc, rxp, m);
-		if (fxp_rc == 0) {
+		if (fxp_new_rfabuf(sc, rxp) == 0) {
 			int total_len;
 
 			/*
@@ -1658,6 +1841,11 @@
 			 * of bogus length or CRC errors.
 			 */
 			total_len = le16toh(rfa->actual_size) & 0x3fff;
+			if ((sc->flags & FXP_FLAG_82559_RXCSUM) != 0 &&
+			    (ifp->if_capenable & IFCAP_RXCSUM) != 0) {
+				/* Adjust for appended checksum bytes. */
+				total_len -= 2;
+			}
 			if (total_len < sizeof(struct ether_header) ||
 			    total_len > MCLBYTES - RFA_ALIGNMENT_FUDGE -
 				sc->rfa_size || status & FXP_RFA_STATUS_CRC) {
@@ -1665,30 +1853,12 @@
 				continue;
 			}
 
-                        /* Do IP checksum checking. */
-			if ((ifp->if_capenable & IFCAP_RXCSUM) != 0 &&
-			    (status & FXP_RFA_STATUS_PARSE)) {
-				if (rfa->rfax_csum_sts &
-				    FXP_RFDX_CS_IP_CSUM_BIT_VALID)
-					m->m_pkthdr.csum_flags |=
-					    CSUM_IP_CHECKED;
-				if (rfa->rfax_csum_sts &
-				    FXP_RFDX_CS_IP_CSUM_VALID)
-					m->m_pkthdr.csum_flags |=
-					    CSUM_IP_VALID;
-				if ((rfa->rfax_csum_sts &
-				    FXP_RFDX_CS_TCPUDP_CSUM_BIT_VALID) &&
-				    (rfa->rfax_csum_sts &
-				    FXP_RFDX_CS_TCPUDP_CSUM_VALID)) {
-					m->m_pkthdr.csum_flags |=
-					    CSUM_DATA_VALID|CSUM_PSEUDO_HDR;
-					m->m_pkthdr.csum_data = 0xffff;
-				}
-			}
-
 			m->m_pkthdr.len = m->m_len = total_len;
 			m->m_pkthdr.rcvif = ifp;
 
+                        /* Do IP checksum checking. */
+			if ((ifp->if_capenable & IFCAP_RXCSUM) != 0)
+				fxp_rxcsum(sc, ifp, m, status, total_len);
 			/*
 			 * Drop locks before calling if_input() since it
 			 * may re-enter fxp_start() in the netisr case.
@@ -1700,10 +1870,12 @@
 			FXP_UNLOCK(sc);
 			(*ifp->if_input)(ifp, m);
 			FXP_LOCK(sc);
-		} else if (fxp_rc == ENOBUFS) {
-			rnr = 0;
-			break;
+		} else {
+			/* Reuse RFA and loaded DMA map. */
+			ifp->if_iqdrops++;
+			fxp_discard_rfabuf(sc, rxp);
 		}
+		fxp_add_rfabuf(sc, rxp);
 	}
 	if (rnr) {
 		fxp_scb_wait(sc);
@@ -2015,11 +2187,12 @@
 	cbp->disc_short_rx =	!prm;	/* discard short packets */
 	cbp->underrun_retry =	1;	/* retry mode (once) on DMA underrun */
 	cbp->two_frames =	0;	/* do not limit FIFO to 2 frames */
-	cbp->dyn_tbd =		0;	/* (no) dynamic TBD mode */
+	cbp->dyn_tbd =		sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0;
 	cbp->ext_rfa =		sc->flags & FXP_FLAG_EXT_RFA ? 1 : 0;
 	cbp->mediatype =	sc->flags & FXP_FLAG_SERIAL_MEDIA ? 0 : 1;
 	cbp->csma_dis =		0;	/* (don't) disable link */
-	cbp->tcp_udp_cksum =	0;	/* (don't) enable checksum */

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



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