summaryrefslogtreecommitdiffstats
path: root/sys/x86
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2010-05-24 01:49:00 +0000
committermav <mav@FreeBSD.org>2010-05-24 01:49:00 +0000
commit045332b70991f7d2e3bbcac010b18420d137f596 (patch)
tree94bfd33b7f82c233fc31592e5457691a4ee764e9 /sys/x86
parentadd6413e9ac3e0d554b2f8bea1e13e04a5401f56 (diff)
downloadFreeBSD-src-045332b70991f7d2e3bbcac010b18420d137f596.zip
FreeBSD-src-045332b70991f7d2e3bbcac010b18420d137f596.tar.gz
Restore different APIC init orders for i386 and amd64 unified in r208452.
Seems noone of them contents both arch for different reasons. Submitted by: kib@
Diffstat (limited to 'sys/x86')
-rw-r--r--sys/x86/x86/local_apic.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/sys/x86/x86/local_apic.c b/sys/x86/x86/local_apic.c
index e155cd7..29b078e 100644
--- a/sys/x86/x86/local_apic.c
+++ b/sys/x86/x86/local_apic.c
@@ -1195,8 +1195,9 @@ apic_register_enumerator(struct apic_enumerator *enumerator)
}
/*
- * Probe the APIC enumerators, enumerate CPUs, and initialize the
- * local APIC.
+ * We have to look for CPU's very, very early because certain subsystems
+ * want to know how many CPU's we have extremely early on in the boot
+ * process.
*/
static void
apic_init(void *dummy __unused)
@@ -1257,13 +1258,34 @@ apic_init(void *dummy __unused)
printf("%s: Failed to probe CPUs: returned %d\n",
best_enum->apic_name, retval);
+#ifdef __amd64__
+}
+SYSINIT(apic_init, SI_SUB_TUNABLES - 1, SI_ORDER_SECOND, apic_init, NULL);
+
+/*
+ * Setup the local APIC. We have to do this prior to starting up the APs
+ * in the SMP case.
+ */
+static void
+apic_setup_local(void *dummy __unused)
+{
+ int retval;
+
+ if (best_enum == NULL)
+ return;
+#endif
/* Third, initialize the local APIC. */
retval = best_enum->apic_setup_local();
if (retval != 0)
printf("%s: Failed to setup the local APIC: returned %d\n",
best_enum->apic_name, retval);
}
+#ifdef __amd64__
+SYSINIT(apic_setup_local, SI_SUB_CPU, SI_ORDER_SECOND, apic_setup_local,
+ NULL);
+#else
SYSINIT(apic_init, SI_SUB_CPU, SI_ORDER_SECOND, apic_init, NULL);
+#endif
/*
* Setup the I/O APICs.
OpenPOWER on IntegriCloud