From owner-freebsd-acpi@FreeBSD.ORG Tue Nov 25 18:33:18 2008 Return-Path: Delivered-To: freebsd-acpi@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 977971065670 for ; Tue, 25 Nov 2008 18:33:18 +0000 (UTC) (envelope-from takawata@init-main.com) Received: from sana.init-main.com (unknown [IPv6:2001:240:28::1]) by mx1.freebsd.org (Postfix) with ESMTP id 3B4B98FC19 for ; Tue, 25 Nov 2008 18:33:18 +0000 (UTC) (envelope-from takawata@init-main.com) Received: from init-main.com (localhost [127.0.0.1]) by sana.init-main.com (8.14.3/8.14.3) with ESMTP id mAPIZFIC002676 for ; Wed, 26 Nov 2008 03:35:15 +0900 (JST) (envelope-from takawata@init-main.com) Message-Id: <200811251835.mAPIZFIC002676@sana.init-main.com> To: freebsd-acpi@freebsd.org Date: Wed, 26 Nov 2008 03:35:15 +0900 From: Takanori Watanabe Subject: acpi_cpu: binding processor object to pcpu struct. X-BeenThere: freebsd-acpi@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: ACPI and power management development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 25 Nov 2008 18:33:18 -0000 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 (リビジョン 185289) +++ acpi_cpu.c (作業コピー) @@ -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);