ahci: handle unaligned buffers.
[seabios.git] / src / smp.c
index dac95bf41cff333079b3359d0462d03d79e39bf5..40f5451e5fee4ec0276de4a8c5203467892120ae 100644 (file)
--- a/src/smp.c
+++ b/src/smp.c
@@ -72,7 +72,7 @@ smp_probe(void)
     ASSERT32FLAT();
     u32 eax, ebx, ecx, cpuid_features;
     cpuid(1, &eax, &ebx, &ecx, &cpuid_features);
-    if ((cpuid_features & CPUID_APIC)) {
+    if (eax < 1 || !(cpuid_features & CPUID_APIC)) {
         // No apic - only the main cpu is present.
         dprintf(1, "No apic - only the main cpu is present.\n");
         CountCPUs= 1;
@@ -103,6 +103,7 @@ smp_probe(void)
     }
 
     // broadcast SIPI
+    barrier();
     writel(APIC_ICR_LOW, 0x000C4500);
     u32 sipi_vector = BUILD_AP_BOOT_ADDR >> 12;
     writel(APIC_ICR_LOW, 0x000C4600 | sipi_vector);
@@ -113,7 +114,7 @@ smp_probe(void)
     } else {
         u8 cmos_smp_count = inb_cmos(CMOS_BIOS_SMP_COUNT);
         while (cmos_smp_count + 1 != readl(&CountCPUs))
-             ;
+            yield();
     }
 
     // Restore memory.
@@ -126,11 +127,3 @@ smp_probe(void)
     dprintf(1, "Found %d cpu(s) max supported %d cpu(s)\n", readl(&CountCPUs),
         MaxCountCPUs);
 }
-
-// Reset variables to zero
-void
-smp_probe_setup(void)
-{
-    CountCPUs = 0;
-    smp_mtrr_count = 0;
-}