Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 26 Nov 2008 03:35:15 +0900
From:      Takanori Watanabe <takawata@init-main.com>
To:        freebsd-acpi@freebsd.org
Subject:   acpi_cpu: binding processor object to pcpu struct.
Message-ID:  <200811251835.mAPIZFIC002676@sana.init-main.com>

next in thread | raw e-mail | index | archive | help
In my box, processor does not binded properly to ACPI object, 
so I wrote the code as follows.
comment?

I'm afraid system pcpu unit number and cpu device instance number
may inconsistent, but without this change, ACPI namespace and 
pcpu struct does not match.

Index: acpi_cpu.c
===================================================================
--- acpi_cpu.c	($B%j%S%8%g%s(B 185289)
+++ acpi_cpu.c	($B:n6H%3%T!<(B)
@@ -241,7 +241,9 @@
      * in their Processor object as the ProcId values in the MADT.
      */
     acpi_id = obj->Processor.ProcId;
+
     AcpiOsFree(obj);
+
     if (acpi_pcpu_get_id(device_get_unit(dev), &acpi_id, &cpu_id) != 0)
 	return (ENXIO);
 
@@ -427,25 +429,35 @@
 
     KASSERT(acpi_id != NULL, ("Null acpi_id"));
     KASSERT(cpu_id != NULL, ("Null cpu_id"));
+
+    /*Check for cpu that have duplicate acpi_id probed.*/
+    for ( i = 0 ; i <= mp_maxid; i++){
+	    if (CPU_ABSENT(i))
+		    continue;
+	    pcpu_data = pcpu_find(i);
+	    if(cpu_softc[i]&& (pcpu_data->pc_acpi_id == *acpi_id)){
+		    return ESRCH;
+	    }
+    }
     for (i = 0; i <= mp_maxid; i++) {
 	if (CPU_ABSENT(i))
 	    continue;
 	pcpu_data = pcpu_find(i);
 	KASSERT(pcpu_data != NULL, ("no pcpu data for %d", i));
-	if (idx-- == 0) {
-	    /*
-	     * If pc_acpi_id was not initialized (e.g., a non-APIC UP box)
-	     * override it with the value from the ASL.  Otherwise, if the
-	     * two don't match, prefer the MADT-derived value.  Finally,
-	     * return the pc_cpuid to reference this processor.
-	     */
-	    if (pcpu_data->pc_acpi_id == 0xffffffff)
+	/*
+	 * If pc_acpi_id was not initialized (e.g., a non-APIC UP box)
+	 * override it with the value from the ASL.  Otherwise, if the
+	 * two don't match, prefer the MADT-derived value.  Finally,
+	 * return the pc_cpuid to reference this processor.
+	 */
+	if (pcpu_data->pc_acpi_id == 0xffffffff)
 		pcpu_data->pc_acpi_id = *acpi_id;
-	    else if (pcpu_data->pc_acpi_id != *acpi_id)
-		*acpi_id = pcpu_data->pc_acpi_id;
-	    *cpu_id = pcpu_data->pc_cpuid;
-	    return (0);
+	else if (pcpu_data->pc_acpi_id == *acpi_id){
+		*cpu_id = pcpu_data->pc_cpuid;
 	}
+	else
+		continue;
+	return 0;
     }
 
     return (ESRCH);



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