git: 9front

Download patch

ref: 13e3ef33d50ad8de38c26d6bfe655481d08eea34
parent: 82c54fce77763aeae477390148f6022983ad1271
author: cinap_lenrek <cinap_lenrek@gmx.de>
date: Sun Jul 7 08:44:30 EDT 2013

acpi: skip disabled LAPIC entries

disabled LAPIC entries overwrote the bootstrap processor
apic causing the machine panic with: "no bootstrap processor".
(problem with lenovo X230)

just ignore entries that are disabled or collide with
entries already found. (should not happen)

--- a/sys/src/9/pc/archacpi.c
+++ b/sys/src/9/pc/archacpi.c
@@ -401,16 +401,21 @@
 			a->lintr[0] = ApicIMASK;
 			a->lintr[1] = ApicIMASK;
 			a->flags = p[4] & PcmpEN;
-			if(a->flags & PcmpEN){
-				a->machno = machno++;
 
-				/*
-				 * platform firmware should list the boot processor
-				 * as the first processor entry in the MADT
-				 */
-				if(a->machno == 0)
-					a->flags |= PcmpBP;
+			/* skip disabled processors */
+			if((a->flags & PcmpEN) == 0 || mpapic[a->apicno] != nil){
+				xfree(a);
+				break;
 			}
+			a->machno = machno++;
+
+			/*
+			 * platform firmware should list the boot processor
+			 * as the first processor entry in the MADT
+			 */
+			if(a->machno == 0)
+				a->flags |= PcmpBP;
+
 			mpapic[a->apicno] = a;
 			break;
 		case 0x01:	/* I/O APIC */
--