svn commit: r256036 - in projects/amd64_xen_pv/sys: amd64/include amd64/xen conf

Cherry G. Mathew cherry at FreeBSD.org
Fri Oct 4 01:42:28 UTC 2013


Author: cherry
Date: Fri Oct  4 01:42:27 2013
New Revision: 256036
URL: http://svnweb.freebsd.org/changeset/base/256036

Log:
  Glue in cpu enumeration without -DSMP. This is a shim
  for until we get an MP build for amd64 pv.
  
  Approved by: gibbs(implicit)

Modified:
  projects/amd64_xen_pv/sys/amd64/include/smp.h
  projects/amd64_xen_pv/sys/amd64/xen/machdep.c
  projects/amd64_xen_pv/sys/conf/files.amd64

Modified: projects/amd64_xen_pv/sys/amd64/include/smp.h
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/include/smp.h	Fri Oct  4 01:39:20 2013	(r256035)
+++ projects/amd64_xen_pv/sys/amd64/include/smp.h	Fri Oct  4 01:42:27 2013	(r256036)
@@ -90,5 +90,10 @@ void	smp_masked_invltlb(cpuset_t mask, s
 #endif /* !LOCORE */
 #endif /* SMP */
 
+#ifdef XEN
+/* XXX: shim - remove when we get -D SMP */
+void	cpu_add(u_int apic_id, char boot_cpu); 
+#endif
+
 #endif /* _KERNEL */
 #endif /* _MACHINE_SMP_H_ */

Modified: projects/amd64_xen_pv/sys/amd64/xen/machdep.c
==============================================================================
--- projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Fri Oct  4 01:39:20 2013	(r256035)
+++ projects/amd64_xen_pv/sys/amd64/xen/machdep.c	Fri Oct  4 01:42:27 2013	(r256036)
@@ -88,6 +88,7 @@
 #include <machine/md_var.h>
 #include <machine/pcb.h>
 #include <machine/stdarg.h>
+#include <machine/smp.h>
 #include <machine/tss.h>
 #include <machine/vmparam.h>
 
@@ -859,6 +860,56 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 	pcpu->pc_acpi_id = 0xffffffff;
 }
 
+/* XXX: Delete when we get mp_machdep.c */
+/* Dummy defines to get x86/x86/local_apic.c to link. */
+int Xspuriousint, Xtimerint, Xerrorint, Xcmcint, Xapic_isr1;
+int Xapic_isr2, Xapic_isr3, Xapic_isr4, Xapic_isr5;
+int Xapic_isr6, Xapic_isr7;
+int cmc_intr;
+
+void	setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist)
+{
+}
+
+
+struct cpu_info {
+	int	cpu_present:1;
+	int	cpu_bsp:1;
+	int	cpu_disabled:1;
+};
+
+/* We don't want to #include <machine/apicvar.h */
+#define	MAX_APIC_ID	0xfe 
+
+static struct cpu_info cpu_info[MAX_APIC_ID + 1];
+int	boot_cpu_id = -1;	/* designated BSP */
+
+void
+cpu_add(u_int apic_id, char boot_cpu)
+{
+
+	if (apic_id > MAX_APIC_ID) {
+		panic("SMP: APIC ID %d too high", apic_id);
+		return;
+	}
+	KASSERT(cpu_info[apic_id].cpu_present == 0, ("CPU %d added twice",
+	    apic_id));
+	cpu_info[apic_id].cpu_present = 1;
+	if (boot_cpu) {
+		KASSERT(boot_cpu_id == -1,
+		    ("CPU %d claims to be BSP, but CPU %d already is", apic_id,
+		    boot_cpu_id));
+		boot_cpu_id = apic_id;
+		cpu_info[apic_id].cpu_bsp = 1;
+	}
+	if (mp_ncpus < MAXCPU)
+		mp_ncpus++;
+	if (bootverbose)
+		printf("SMP: Added CPU %d (%s)\n", apic_id, boot_cpu ? "BSP" :
+		    "AP");
+}
+/* Delete when we get mp_machdep.c : XXX*/
+
 void
 spinlock_enter(void)
 {

Modified: projects/amd64_xen_pv/sys/conf/files.amd64
==============================================================================
--- projects/amd64_xen_pv/sys/conf/files.amd64	Fri Oct  4 01:39:20 2013	(r256035)
+++ projects/amd64_xen_pv/sys/conf/files.amd64	Fri Oct  4 01:42:27 2013	(r256036)
@@ -557,7 +557,7 @@ x86/x86/fdt_machdep.c		optional	fdt
 x86/x86/intr_machdep.c		standard
 x86/x86/io_apic.c		optional	native
 x86/x86/legacy.c		optional	native
-x86/x86/local_apic.c		optional	native
+x86/x86/local_apic.c		standard
 x86/x86/mca.c			optional	native
 x86/x86/mptable.c		optional	native mptable
 x86/x86/mptable_pci.c		optional	native mptable pci


More information about the svn-src-projects mailing list