From patchwork Sat Sep 11 02:06:26 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yinghai Lu X-Patchwork-Id: 170962 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o8B29TP1016384 for ; Sat, 11 Sep 2010 02:09:30 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751658Ab0IKCJK (ORCPT ); Fri, 10 Sep 2010 22:09:10 -0400 Received: from rcsinet10.oracle.com ([148.87.113.121]:30360 "EHLO rcsinet10.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751619Ab0IKCJJ (ORCPT ); Fri, 10 Sep 2010 22:09:09 -0400 Received: from acsinet15.oracle.com (acsinet15.oracle.com [141.146.126.227]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o8B27LWu006169 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 11 Sep 2010 02:07:22 GMT Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by acsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o8B1WXVU030230; Sat, 11 Sep 2010 02:07:20 GMT Received: from abhmt001.oracle.com by acsmt353.oracle.com with ESMTP id 596425121284170781; Fri, 10 Sep 2010 19:06:21 -0700 Received: from [10.6.76.26] (/10.6.76.26) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 10 Sep 2010 19:06:21 -0700 Message-ID: <4C8AE422.4070602@kernel.org> Date: Fri, 10 Sep 2010 19:06:26 -0700 From: Yinghai Lu User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.11) Gecko/20100714 SUSE/3.0.6 Thunderbird/3.0.6 MIME-Version: 1.0 To: Andrew Morton , "Brown, Len" CC: Bjorn Helgaas , Suresh Siddha , ACPI Devel Maling List , "linux-kernel@vger.kernel.org" , Ingo Molnar , "H. Peter Anvin" , Thomas Gleixner , Lin Ming , Bob Moore Subject: Re: [PATCH] acpi: handle ACPI0007 Device in acpi_early_set_pdc References: <4C89906B.1050406@kernel.org> <201009101210.31942.bjorn.helgaas@hp.com> <4C8A8504.9000606@kernel.org> <20100910164556.b72d848e.akpm@linux-foundation.org> In-Reply-To: <20100910164556.b72d848e.akpm@linux-foundation.org> Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Sat, 11 Sep 2010 02:09:30 +0000 (UTC) Index: linux-2.6/drivers/acpi/processor_core.c =================================================================== --- linux-2.6.orig/drivers/acpi/processor_core.c +++ linux-2.6/drivers/acpi/processor_core.c @@ -189,7 +189,7 @@ int acpi_get_cpuid(acpi_handle handle, i EXPORT_SYMBOL_GPL(acpi_get_cpuid); #endif -static bool processor_physically_present(acpi_handle handle) +static bool is_processor_and_physically_present(acpi_handle handle) { int cpuid, type; u32 acpi_id; @@ -211,6 +211,8 @@ static bool processor_physically_present acpi_id = object.processor.proc_id; break; case ACPI_TYPE_DEVICE: + if (acpi_match_device_hid(handle, "ACPI0007") != AE_OK) + return false; status = acpi_evaluate_integer(handle, "_UID", NULL, &tmp); if (ACPI_FAILURE(status)) return false; @@ -334,7 +336,7 @@ EXPORT_SYMBOL_GPL(acpi_processor_set_pdc static acpi_status early_init_pdc(acpi_handle handle, u32 lvl, void *context, void **rv) { - if (processor_physically_present(handle) == false) + if (is_processor_and_physically_present(handle) == false) return AE_OK; acpi_processor_set_pdc(handle); @@ -349,7 +351,7 @@ void __init acpi_early_processor_set_pdc */ dmi_check_system(processor_idle_dmi_table); - acpi_walk_namespace(ACPI_TYPE_PROCESSOR, ACPI_ROOT_OBJECT, + acpi_walk_namespace(ACPI_TYPE_ANY, ACPI_ROOT_OBJECT, ACPI_UINT32_MAX, early_init_pdc, NULL, NULL, NULL); } Index: linux-2.6/drivers/acpi/acpica/nsxfeval.c =================================================================== --- linux-2.6.orig/drivers/acpi/acpica/nsxfeval.c +++ linux-2.6/drivers/acpi/acpica/nsxfeval.c @@ -524,6 +524,49 @@ ACPI_EXPORT_SYMBOL(acpi_walk_namespace) /******************************************************************************* * + * FUNCTION: acpi_match_device_hid + * + * PARAMETERS: handle and HID to be compared + * + * RETURN: bool + * + * DESCRIPTION: check if device coresponding to handle has HID + * + ******************************************************************************/ +acpi_status acpi_match_device_hid(acpi_handle obj_handle, const char *HID) +{ + acpi_status status; + struct acpi_namespace_node *node; + struct acpica_device_id *hid; + int no_match; + + status = acpi_ut_acquire_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) + return status; + + node = acpi_ns_validate_handle(obj_handle); + status = acpi_ut_release_mutex(ACPI_MTX_NAMESPACE); + if (ACPI_FAILURE(status)) + return status; + + if (!node) + return AE_BAD_PARAMETER; + + status = acpi_ut_execute_HID(node, &hid); + if (ACPI_FAILURE(status)) + return status; + + no_match = ACPI_STRCMP(hid->string, HID); + ACPI_FREE(hid); + + if (no_match) + return AE_NOT_FOUND; + + return AE_OK; +} + +/******************************************************************************* + * * FUNCTION: acpi_ns_get_device_callback * * PARAMETERS: Callback from acpi_get_device Index: linux-2.6/include/acpi/acpixf.h =================================================================== --- linux-2.6.orig/include/acpi/acpixf.h +++ linux-2.6/include/acpi/acpixf.h @@ -160,6 +160,8 @@ acpi_walk_namespace(acpi_object_type typ acpi_walk_callback post_order_visit, void *context, void **return_value); +acpi_status acpi_match_device_hid(acpi_handle obj_handle, const char *HID); + acpi_status acpi_get_devices(const char *HID, acpi_walk_callback user_function,