From: "Siddha, Suresh B" <suresh.b.siddha@intel.com>

Recent x86_64 smp boot code changes assumed that BP is the first one listed
in ACPI/MPS processor table entries.  And this assumption broke one of the
systems, where BP is not the first one in the list.

ak: Anyways, I would prefer if could you fix up the smpboot.c code to not
    assume this, reordering the array is quite hackish.

Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Cc: Andi Kleen <ak@muc.de>
Signed-off-by: Andrew Morton <akpm@osdl.org>
---

 arch/x86_64/kernel/mpparse.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletion(-)

diff -puN arch/x86_64/kernel/mpparse.c~x86_64-dont-assume-bp-to-be-the-first-one-in-madt-mps arch/x86_64/kernel/mpparse.c
--- 25/arch/x86_64/kernel/mpparse.c~x86_64-dont-assume-bp-to-be-the-first-one-in-madt-mps	2005-05-03 19:09:42.000000000 -0700
+++ 25-akpm/arch/x86_64/kernel/mpparse.c	2005-05-03 19:09:42.000000000 -0700
@@ -150,7 +150,19 @@ static void __init MP_processor_info (st
 		ver = 0x10;
 	}
 	apic_version[m->mpc_apicid] = ver;
-	bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
+
+	if ((m->mpc_cpuflag & CPU_BOOTPROCESSOR) && num_processors > 1) {
+		/* for now smp boot code assumes that the first element
+		 * in bios_cpu_apicid array is of boot processor's.
+		 * And we will bring up the AP's in the order listed
+		 * by the bios tables.
+		 */
+		int j;
+		for (j = num_processors - 1; j >= 1; j--)
+			bios_cpu_apicid[j] = bios_cpu_apicid[j-1];
+		bios_cpu_apicid[0] = m->mpc_apicid;
+	} else
+		bios_cpu_apicid[num_processors - 1] = m->mpc_apicid;
 }
 
 static void __init MP_bus_info (struct mpc_config_bus *m)
_