Module Name:    src
Committed By:   rmind
Date:           Mon Mar 30 22:28:40 UTC 2009

Modified Files:
        src/sys/arch/amd64/conf: files.amd64
        src/sys/arch/i386/conf: files.i386
        src/sys/arch/x86/x86: ipi.c
Removed Files:
        src/sys/arch/amd64/amd64: ipifuncs.c
        src/sys/arch/i386/i386: ipifuncs.c

Log Message:
Merge i386 and amd64 ipifuncs.c into x86.  No functional changes intended.
XXX: fpu #ifdefs are ugly (should be revisited at some point).


To generate a diff of this commit:
cvs rdiff -u -r1.21 -r0 src/sys/arch/amd64/amd64/ipifuncs.c
cvs rdiff -u -r1.64 -r1.65 src/sys/arch/amd64/conf/files.amd64
cvs rdiff -u -r1.346 -r1.347 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.28 -r0 src/sys/arch/i386/i386/ipifuncs.c
cvs rdiff -u -r1.13 -r1.14 src/sys/arch/x86/x86/ipi.c

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

Modified files:

Index: src/sys/arch/amd64/conf/files.amd64
diff -u src/sys/arch/amd64/conf/files.amd64:1.64 src/sys/arch/amd64/conf/files.amd64:1.65
--- src/sys/arch/amd64/conf/files.amd64:1.64	Mon Mar 30 22:20:55 2009
+++ src/sys/arch/amd64/conf/files.amd64	Mon Mar 30 22:28:39 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.amd64,v 1.64 2009/03/30 22:20:55 rmind Exp $
+#	$NetBSD: files.amd64,v 1.65 2009/03/30 22:28:39 rmind Exp $
 #
 # new style config file for amd64 architecture
 #
@@ -52,7 +52,6 @@
 file	dev/cons.c
 
 file	arch/amd64/amd64/mptramp.S        multiprocessor
-file	arch/amd64/amd64/ipifuncs.c       multiprocessor
 
 #
 # Machine-independent SCSI drivers

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.346 src/sys/arch/i386/conf/files.i386:1.347
--- src/sys/arch/i386/conf/files.i386:1.346	Mon Mar 30 22:20:55 2009
+++ src/sys/arch/i386/conf/files.i386	Mon Mar 30 22:28:39 2009
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.346 2009/03/30 22:20:55 rmind Exp $
+#	$NetBSD: files.i386,v 1.347 2009/03/30 22:28:39 rmind Exp $
 #
 # new style config file for i386 architecture
 #
@@ -87,7 +87,6 @@
 file	dev/cons.c
 
 file	arch/i386/i386/mptramp.S  	multiprocessor
-file    arch/i386/i386/ipifuncs.c       multiprocessor
 
 file	arch/i386/i386/pmc.c		perfctrs
 

Index: src/sys/arch/x86/x86/ipi.c
diff -u src/sys/arch/x86/x86/ipi.c:1.13 src/sys/arch/x86/x86/ipi.c:1.14
--- src/sys/arch/x86/x86/ipi.c:1.13	Sun May 11 21:48:02 2008
+++ src/sys/arch/x86/x86/ipi.c	Mon Mar 30 22:28:40 2009
@@ -1,7 +1,7 @@
-/*	$NetBSD: ipi.c,v 1.13 2008/05/11 21:48:02 ad Exp $	*/
+/*	$NetBSD: ipi.c,v 1.14 2009/03/30 22:28:40 rmind Exp $	*/
 
 /*-
- * Copyright (c) 2000, 2008 The NetBSD Foundation, Inc.
+ * Copyright (c) 2000, 2008, 2009 The NetBSD Foundation, Inc.
  * All rights reserved.
  *
  * This code is derived from software contributed to The NetBSD Foundation
@@ -32,7 +32,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.13 2008/05/11 21:48:02 ad Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ipi.c,v 1.14 2009/03/30 22:28:40 rmind Exp $");
+
+#include "opt_mtrr.h"
 
 #include <sys/param.h> 
 #include <sys/device.h>
@@ -41,12 +43,66 @@
 #include <sys/intr.h>
 #include <sys/cpu.h>
  
+#ifdef MULTIPROCESSOR
+
+#include <machine/cpufunc.h>
 #include <machine/cpuvar.h>
 #include <machine/i82093var.h>
 #include <machine/i82489reg.h>
 #include <machine/i82489var.h>
+#include <machine/mtrr.h>
+#include <machine/gdt.h>
+
+#include <x86/cpu_msr.h>
+
+#include "acpi.h"
+
+#ifdef __x86_64__
+#include <machine/fpu.h>
+static void	x86_ipi_synch_fpu(struct cpu_info *);
+#else
+/* XXXfpu */
+#include "npx.h"
+#if NNPX > 0
+static void	x86_ipi_synch_fpu(struct cpu_info *);
+#define		fpusave_cpu(x)		npxsave_cpu(x)
+#else
+#define		x86_ipi_synch_fpu	NULL
+#endif
+#endif
+
+static void	x86_ipi_halt(struct cpu_info *);
+static void	x86_ipi_kpreempt(struct cpu_info *);
+
+#ifdef MTRR
+static void	x86_ipi_reload_mtrr(struct cpu_info *);
+#else
+#define		x86_ipi_reload_mtrr	NULL
+#endif
+
+#if NACPI > 0
+void	acpi_cpu_sleep(struct cpu_info *);
+#else
+#define	acpi_cpu_sleep	NULL
+#endif
+
+void (*ipifunc[X86_NIPI])(struct cpu_info *) =
+{
+	x86_ipi_halt,
+	NULL,
+	NULL,
+	x86_ipi_synch_fpu,
+	x86_ipi_reload_mtrr,
+	gdt_reload_cpu,
+	msr_write_ipi,
+	acpi_cpu_sleep,
+	x86_ipi_kpreempt
+};
+
+/*
+ * x86 IPI interface.
+ */
 
-#ifdef MULTIPROCESSOR
 int
 x86_send_ipi(struct cpu_info *ci, int ipimask)
 {
@@ -122,7 +178,56 @@
 		(*ipifunc[bit])(ci);
 	}
 }
+
+/*
+ * Common x86 IPI handlers.
+ */
+
+static void
+x86_ipi_halt(struct cpu_info *ci)
+{
+
+	x86_disable_intr();
+	atomic_and_32(&ci->ci_flags, ~CPUF_RUNNING);
+
+	for(;;) {
+		x86_hlt();
+	}
+}
+
+#if defined(__x86_64__) || NNPX > 0	/* XXXfpu */
+static void
+x86_ipi_synch_fpu(struct cpu_info *ci)
+{
+
+	fpusave_cpu(true);
+}
+#endif
+
+#ifdef MTRR
+static void
+x86_ipi_reload_mtrr(struct cpu_info *ci)
+{
+
+	if (mtrr_funcs != NULL) {
+		/*
+		 * mtrr_reload_cpu() is a macro in mtrr.h which picks
+		 * the appropriate function to use.
+		 */
+		mtrr_reload_cpu(ci);
+	}
+}
+#endif
+
+static void
+x86_ipi_kpreempt(struct cpu_info *ci)
+{
+
+	softint_trigger(1 << SIR_PREEMPT);
+}
+
 #else
+
 int
 x86_send_ipi(struct cpu_info *ci, int ipimask)
 {
@@ -141,4 +246,5 @@
 {
 
 }
+
 #endif

Reply via email to