svn commit: r208452 - in head/sys: amd64/amd64 conf i386/i386
x86/x86
Alexander Motin
mav at FreeBSD.org
Sun May 23 17:45:02 UTC 2010
Author: mav
Date: Sun May 23 17:45:01 2010
New Revision: 208452
URL: http://svn.freebsd.org/changeset/base/208452
Log:
Unify local_apic.c for x86 archs,
Added:
head/sys/x86/x86/
head/sys/x86/x86/local_apic.c
- copied, changed from r208451, head/sys/i386/i386/local_apic.c
Deleted:
head/sys/amd64/amd64/local_apic.c
head/sys/i386/i386/local_apic.c
Modified:
head/sys/conf/files.amd64
head/sys/conf/files.i386
head/sys/conf/files.pc98
Modified: head/sys/conf/files.amd64
==============================================================================
--- head/sys/conf/files.amd64 Sun May 23 16:16:33 2010 (r208451)
+++ head/sys/conf/files.amd64 Sun May 23 17:45:01 2010 (r208452)
@@ -107,7 +107,7 @@ amd64/amd64/intr_machdep.c standard
amd64/amd64/io.c optional io
amd64/amd64/io_apic.c standard
amd64/amd64/legacy.c standard
-amd64/amd64/local_apic.c standard
+x86/x86/local_apic.c standard
amd64/amd64/locore.S standard no-obj
amd64/amd64/machdep.c standard
amd64/amd64/mca.c standard
Modified: head/sys/conf/files.i386
==============================================================================
--- head/sys/conf/files.i386 Sun May 23 16:16:33 2010 (r208451)
+++ head/sys/conf/files.i386 Sun May 23 17:45:01 2010 (r208452)
@@ -272,7 +272,7 @@ i386/i386/io.c optional io
i386/i386/io_apic.c optional apic
i386/i386/k6_mem.c optional mem
i386/i386/legacy.c optional native
-i386/i386/local_apic.c optional apic
+x86/x86/local_apic.c optional apic
i386/i386/locore.s optional native no-obj
i386/xen/locore.s optional xen no-obj
i386/i386/longrun.c optional cpu_enable_longrun
Modified: head/sys/conf/files.pc98
==============================================================================
--- head/sys/conf/files.pc98 Sun May 23 16:16:33 2010 (r208451)
+++ head/sys/conf/files.pc98 Sun May 23 17:45:01 2010 (r208452)
@@ -151,7 +151,7 @@ i386/i386/io.c optional io
i386/i386/io_apic.c optional apic
i386/i386/k6_mem.c optional mem
i386/i386/legacy.c standard
-i386/i386/local_apic.c optional apic
+x86/x86/local_apic.c optional apic
i386/i386/locore.s standard no-obj
i386/i386/mca.c standard
i386/i386/mem.c optional mem
Copied and modified: head/sys/x86/x86/local_apic.c (from r208451, head/sys/i386/i386/local_apic.c)
==============================================================================
--- head/sys/i386/i386/local_apic.c Sun May 23 16:16:33 2010 (r208451, copy source)
+++ head/sys/x86/x86/local_apic.c Sun May 23 17:45:01 2010 (r208452)
@@ -34,7 +34,6 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
-#include "opt_atpic.h"
#include "opt_hwpmc_hooks.h"
#include "opt_kdtrace.h"
@@ -69,6 +68,16 @@ __FBSDID("$FreeBSD$");
#include <ddb/ddb.h>
#endif
+#ifdef __amd64__
+#define SDT_APIC SDT_SYSIGT
+#define SDT_APICT SDT_SYSIGT
+#define GSEL_APIC 0
+#else
+#define SDT_APIC SDT_SYS386IGT
+#define SDT_APICT SDT_SYS386TGT
+#define GSEL_APIC GSEL(GCODE_SEL, SEL_KPL)
+#endif
+
#ifdef KDTRACE_HOOKS
#include <sys/dtrace_bsd.h>
cyclic_clock_func_t cyclic_clock_func[MAXCPU];
@@ -213,8 +222,8 @@ lapic_init(vm_paddr_t addr)
("local APIC not aligned on a page boundary"));
lapic = pmap_mapdev(addr, sizeof(lapic_t));
lapic_paddr = addr;
- setidt(APIC_SPURIOUS_INT, IDTVEC(spuriousint), SDT_SYS386IGT, SEL_KPL,
- GSEL(GCODE_SEL, SEL_KPL));
+ setidt(APIC_SPURIOUS_INT, IDTVEC(spuriousint), SDT_APIC, SEL_KPL,
+ GSEL_APIC);
/* Perform basic initialization of the BSP's local APIC. */
lapic_enable();
@@ -223,12 +232,10 @@ lapic_init(vm_paddr_t addr)
PCPU_SET(apic_id, lapic_id());
/* Local APIC timer interrupt. */
- setidt(APIC_TIMER_INT, IDTVEC(timerint), SDT_SYS386IGT, SEL_KPL,
- GSEL(GCODE_SEL, SEL_KPL));
+ setidt(APIC_TIMER_INT, IDTVEC(timerint), SDT_APIC, SEL_KPL, GSEL_APIC);
/* Local APIC error interrupt. */
- setidt(APIC_ERROR_INT, IDTVEC(errorint), SDT_SYS386IGT, SEL_KPL,
- GSEL(GCODE_SEL, SEL_KPL));
+ setidt(APIC_ERROR_INT, IDTVEC(errorint), SDT_APIC, SEL_KPL, GSEL_APIC);
/* XXX: Thermal interrupt */
}
@@ -982,8 +989,8 @@ apic_enable_vector(u_int apic_id, u_int
KASSERT(vector != IDT_SYSCALL, ("Attempt to overwrite syscall entry"));
KASSERT(ioint_handlers[vector / 32] != NULL,
("No ISR handler for vector %u", vector));
- setidt(vector, ioint_handlers[vector / 32], SDT_SYS386IGT, SEL_KPL,
- GSEL(GCODE_SEL, SEL_KPL));
+ setidt(vector, ioint_handlers[vector / 32], SDT_APIC, SEL_KPL,
+ GSEL_APIC);
}
void
@@ -998,8 +1005,7 @@ apic_disable_vector(u_int apic_id, u_int
* We can not currently clear the idt entry because other cpus
* may have a valid vector at this offset.
*/
- setidt(vector, &IDTVEC(rsvd), SDT_SYS386TGT, SEL_KPL,
- GSEL(GCODE_SEL, SEL_KPL));
+ setidt(vector, &IDTVEC(rsvd), SDT_APICT, SEL_KPL, GSEL_APIC);
#endif
}
@@ -1196,7 +1202,9 @@ static void
apic_init(void *dummy __unused)
{
struct apic_enumerator *enumerator;
+#ifndef __amd64__
uint64_t apic_base;
+#endif
int retval, best;
/* We only support built in local APICs. */
@@ -1229,6 +1237,7 @@ apic_init(void *dummy __unused)
printf("APIC: Using the %s enumerator.\n",
best_enum->apic_name);
+#ifndef __amd64__
/*
* To work around an errata, we disable the local APIC on some
* CPUs during early startup. We need to turn the local APIC back
@@ -1240,6 +1249,7 @@ apic_init(void *dummy __unused)
apic_base |= APICBASE_ENABLED;
wrmsr(MSR_APICBASE, apic_base);
}
+#endif
/* Second, probe the CPU's in the system. */
retval = best_enum->apic_probe_cpus();
@@ -1290,7 +1300,7 @@ SYSINIT(apic_setup_io, SI_SUB_INTR, SI_O
#ifdef SMP
/*
* Inter Processor Interrupt functions. The lapic_ipi_*() functions are
- * private to the sys/i386 code. The public interface for the rest of the
+ * private to the MD code. The public interface for the rest of the
* kernel is defined in mp_machdep.c.
*/
int
More information about the svn-src-all
mailing list