Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 May 2010 01:49:00 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r208479 - head/sys/x86/x86
Message-ID:  <201005240149.o4O1n094052519@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon May 24 01:49:00 2010
New Revision: 208479
URL: http://svn.freebsd.org/changeset/base/208479

Log:
  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@

Modified:
  head/sys/x86/x86/local_apic.c

Modified: head/sys/x86/x86/local_apic.c
==============================================================================
--- head/sys/x86/x86/local_apic.c	Mon May 24 01:46:06 2010	(r208478)
+++ head/sys/x86/x86/local_apic.c	Mon May 24 01:49:00 2010	(r208479)
@@ -1195,8 +1195,9 @@ apic_register_enumerator(struct apic_enu
 }
 
 /*
- * 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.



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