Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp281667ybd; Fri, 28 Jun 2019 19:45:35 -0700 (PDT) X-Google-Smtp-Source: APXvYqxn06Tl64V9R0M0udVPN3g59+l0JQrUSG8TlM9U5adILiSRIDS8YynSpVss1+D7v1OZotin X-Received: by 2002:a17:902:b284:: with SMTP id u4mr15891891plr.36.1561776335213; Fri, 28 Jun 2019 19:45:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561776335; cv=none; d=google.com; s=arc-20160816; b=Z5sKjvKWBECtdL7jfi8oi0kNNkPwyF0ATXuNk7mlgcUIQzTd8Tc+ePzTk7Emhu67GK aetjYZhNNsHJglXF+CCllM3aRF9GbWSr1iHNjbiwoFgE5ITmiWcVOJ07wMIHcLWBbZo/ ppbVCFeDz/apDKf51JgftK3q7nAdhTEu056RCdTfi3QHL3GPJ03iWKwcAYQxIjvqk/4K 2XGdJ6e1jrWlL726FFX9RIMw3wBPU0aRfKrKCVHRGwQeaDEeo+82PXzVkUZLAIYXR+d5 otObnexeDTmSVhNN+nxEaRkkQhUM0fMtZNQbAnqSYs2H0Sh8i+UuGr1suHs/okoB0agc 9oow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=1ezIuaVaKvhS4bp/DTy3YDGJJmwTUPjp/anJAUTSIOU=; b=Hjjzd6k8PbWrkWvjU5Re06/LyUOSvLKUf5EimkkviQQX7Cwx+EIm5YlyT+G3W2T0Q7 pVuSdCuilCKsn2th3bamvpuS2P5GgsIuRijza5eEHyf6x4sAb2hsVD0HQmVZy9ikfvSA rzgxWWE1KDE1G8/VXLzN6WPnU1Yxxzx3uOpGguTYK3hKbGt2H6dfMhkbNvTRa7ljWvZP UPvxJrl/NsxVBCzdSjJzIT7gQQTDkNN/r3SbCe2HZ1Ua6eQCwtMxtrnG7gqgV/qSUpVk +THoKzGMcJ8QjH/9a3etf475zB0d8NyZEqkGK71aU80tmbuOSsMemIwdZBK0wRmoJxuj 8YnQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t135si4311829pfc.251.2019.06.28.19.45.19; Fri, 28 Jun 2019 19:45:35 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726891AbfF2CpC (ORCPT + 99 others); Fri, 28 Jun 2019 22:45:02 -0400 Received: from szxga05-in.huawei.com ([45.249.212.191]:8239 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726766AbfF2Coy (ORCPT ); Fri, 28 Jun 2019 22:44:54 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.60]) by Forcepoint Email with ESMTP id 3471AF8A73B0CB831ABA; Sat, 29 Jun 2019 10:44:51 +0800 (CST) Received: from linux-ibm.site (10.175.102.37) by DGGEMS410-HUB.china.huawei.com (10.3.19.210) with Microsoft SMTP Server id 14.3.439.0; Sat, 29 Jun 2019 10:44:42 +0800 From: Xiongfeng Wang To: , , CC: , , , , , , , , Subject: [RFC PATCH v2 1/3] ACPI / scan: evaluate _STA for processors declared via ASL Device statement Date: Sat, 29 Jun 2019 10:42:33 +0800 Message-ID: <1561776155-38975-2-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1561776155-38975-1-git-send-email-wangxiongfeng2@huawei.com> References: <1561776155-38975-1-git-send-email-wangxiongfeng2@huawei.com> MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When we scan all the acpi namespace node in acpi_scan_init()->acpi_bus_scan(), we evaluate '_STA' method for processor type node to determine whether the device is present. But processors can also be declared via ASL Device statement. ACPI 6.3 spec specifically says that the Processor statement is deprecated and a Device statement should be used for processors. In that case, acpi_object_type is ACPI_TYPE_DEVICE rather than ACPI_TYPE_PROCESSOR. Current code doesn't evaluate '_STA' for nodes with ACPI_TYPE_DEVICE, and the device status is set to 'present' as default. This patch get the device status from '_STA' method for processors declared via ASL Device statement if it does have a '_STA' method. Signed-off-by: Xiongfeng Wang --- I am not sure if I should set 'type' as ACPI_BUS_TYPE_PROCESSOR rather than ACPI_BUS_TYPE_DEVICE for processors declared via ASL Device statement. --- drivers/acpi/scan.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0e28270..cec43f6 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -16,6 +16,7 @@ #include #include +#include #include #include "internal.h" @@ -1687,6 +1688,7 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, { acpi_status status; acpi_object_type acpi_type; + struct acpi_device_info *info; status = acpi_get_type(handle, &acpi_type); if (ACPI_FAILURE(status)) @@ -1699,6 +1701,16 @@ static int acpi_bus_type_and_status(acpi_handle handle, int *type, return -ENODEV; *type = ACPI_BUS_TYPE_DEVICE; + + status = acpi_get_object_info(handle, &info); + if (ACPI_SUCCESS(status) && info->valid & ACPI_VALID_HID && + !strcmp(info->hardware_id.string, + ACPI_PROCESSOR_DEVICE_HID)) { + status = acpi_bus_get_status_handle(handle, sta); + if (ACPI_SUCCESS(status)) + break; + } + /* * acpi_add_single_object updates this once we've an acpi_device * so that acpi_bus_get_status' quirk handling can be used. -- 1.7.12.4