Re: continuing troubles with AMD64

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 9 Jun 2004 11:00:47 -0400
On Wednesday 09 June 2004 10:36 am, Mikhail Teterin wrote:
> On Wednesday 09 June 2004 10:25 am, John Baldwin wrote:
> = On Tuesday 08 June 2004 04:17 pm, Mikhail Teterin wrote:
> = > The good part: the Mar 1st -current kernel works fine.
> = >
> = > The bad:
> = > 	1) Any newer kernels don't see the system drive, presumably,
> = > 	abecause ttempts to allocate IRQs for the all of the
> = > 	aata-controllers fail.
> = >
> = > 	2) Yesterday's kernel panics with:
> = >
> = > 		madt_probe_cpus_handler: CPU ID 129 too high
> = >
> = > 	Indeed, 129 is greater than NLAPICS, which is 32, but the
> = > 	Mar 1st kernel works.
> =
> = 129 is not a valid local APIC ID. (x86 only supports APIC IDs from 0
> = to 15).
>
> Perhaps, it still should not panic, but act as if APIC was not available
> at all?

Ah, the CPU is disabled.  Guess I should just ignore disabled CPUs altogether 
then.

Here's a patch to the i386 version of madt.c but it should apply to the amd64 
version as well:

--- //depot/vendor/freebsd/src/sys/i386/acpica/madt.c	2004/06/01 19:50:45
+++ //depot/user/jhb/acpipci/i386/acpica/madt.c	2004/06/09 14:58:09
_at__at_ -65,7 +65,6 _at__at_
 } ioapics[NIOAPICS];
 
 struct lapic_info {
-	u_int la_present:1;
 	u_int la_enabled:1;
 	u_int la_acpi_id:8;
 } lapics[NLAPICS];
_at__at_ -446,18 +445,17 _at__at_
 			printf("MADT: Found CPU APIC ID %d ACPI ID %d: %s\n",
 			    proc->LocalApicId, proc->ProcessorId,
 			    proc->ProcessorEnabled ? "enabled" : "disabled");
+		if (!proc->ProcessorEnabled)
+			break;
 		if (proc->LocalApicId >= NLAPICS)
 			panic("%s: CPU ID %d too high", __func__,
 			    proc->LocalApicId);
 		la = &lapics[proc->LocalApicId];
-		KASSERT(la->la_present == 0,
+		KASSERT(la->la_enabled == 0,
 		    ("Duplicate local APIC ID %d", proc->LocalApicId));
-		la->la_present = 1;
+		la->la_enabled = 1;
 		la->la_acpi_id = proc->ProcessorId;
-		if (proc->ProcessorEnabled) {
-			la->la_enabled = 1;
-			lapic_create(proc->LocalApicId, 0);
-		}
+		lapic_create(proc->LocalApicId, 0);
 		break;
 	}
 }
_at__at_ -547,15 +545,12 _at__at_
 	int i;
 
 	for (i = 0; i < NLAPICS; i++) {
-		if (!lapics[i].la_present)
+		if (!lapics[i].la_enabled)
 			continue;
 		if (lapics[i].la_acpi_id != acpi_id)
 			continue;
 		*apic_id = i;
-		if (lapics[i].la_enabled)
-			return (0);
-		else
-			return (ENXIO);
+		return (0);
 	}
 	return (ENOENT);
 }
_at__at_ -769,7 +764,7 _at__at_
 		pc = pcpu_find(i);
 		KASSERT(pc != NULL, ("no pcpu data for CPU %d", i));
 		la = &lapics[pc->pc_apic_id];
-		if (!la->la_present || !la->la_enabled)
+		if (!la->la_enabled)
 			panic("APIC: CPU with APIC ID %u is not enabled",
 			    pc->pc_apic_id);
 		pc->pc_acpi_id = la->la_acpi_id;

-- 
John Baldwin <jhb_at_FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org
Received on Wed Jun 09 2004 - 13:00:02 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:37:56 UTC