Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp3178297ybd; Fri, 28 Jun 2019 04:16:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqwilbNX7tjI+OTrjuHH4fyzOkQ0zMygeRKhcm1/vNThEhRvDuHwh2+juXQp6IvkKuXutoxR X-Received: by 2002:a65:404a:: with SMTP id h10mr9005777pgp.262.1561720617060; Fri, 28 Jun 2019 04:16:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561720617; cv=none; d=google.com; s=arc-20160816; b=BGCGEeLdKy5KJBrogDqenoy93ISxJuMbBG+tstNdjdihgkXCR5on7V1nVpEpxxV1BF Xx+teCwQLxnIR+A4tSQ2LNojNamZnqM3+oL963B3ra2n80cNBTrQMr/wty80upZ13AmW 7z38d9vBrluBm+i15FzkukfpP/qbYax1rfpp6pzQIx5ObCGPWAECUyX3U7hZPpnGYmoS ocEXYS9QoHa1Q/kg5YzlorNZa4tHvSDqOSVkilJ/5clK6pZ8xPjIVh+3aB5fwY5I4kOC Jt/uZJYIa5sF4Wsu3JfX3u3jZMWYi4OpSKoHNoXt+if97ufgsLznsZxcUIpHZh69g0Ji u2zw== 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=kfRX3PFj9Sjg005+w3GFsuhSRUA0sqh8Gf0k1v8kZWQ=; b=ROTnIup1e8YkIdrbdLWKcvNO3H7KuZBFRkXmrQlU7Kw/ae6MbqKNXvY350NbNMBG98 ocM3eiTHjMi1DoEEmfNgfiYHjRmY6t6Q/kRjBTyplxS8hgmQu/LUfBvB3+2BZGLDXyvv y34MECU0jvDA6oeVPywkRMdW0DzBAbMKG0MjrFaPX1XGv4LhVdpCyHuIxuPyVSLsa/dL xUTQBsRgZ/Ka+9sooM1E/pIM/fnGJj7bNGedyXl5GmxTdGqnULS1amDRq8HYDub54W42 jNWNJPQ7bZfnPgjmsTDUdkfiR9/31OPqmNVUjO/toh4E37TqDnZNQPme5+MxlH2YN9vH buvQ== 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 a3si1902701plc.132.2019.06.28.04.16.40; Fri, 28 Jun 2019 04:16:57 -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 S1726709AbfF1LQC (ORCPT + 99 others); Fri, 28 Jun 2019 07:16:02 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:7669 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726562AbfF1LP6 (ORCPT ); Fri, 28 Jun 2019 07:15:58 -0400 Received: from DGGEMS410-HUB.china.huawei.com (unknown [172.30.72.58]) by Forcepoint Email with ESMTP id F423FB8F5F2F43676CB0; Fri, 28 Jun 2019 19:15:55 +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; Fri, 28 Jun 2019 19:15:49 +0800 From: Xiongfeng Wang To: , , CC: , , , , , , , , Subject: [PATCH RFC 1/3] ACPI / scan: evaluate _STA for processors declared via ASL Device statement Date: Fri, 28 Jun 2019 19:13:10 +0800 Message-ID: <1561720392-45907-2-git-send-email-wangxiongfeng2@huawei.com> X-Mailer: git-send-email 1.7.12.4 In-Reply-To: <1561720392-45907-1-git-send-email-wangxiongfeng2@huawei.com> References: <1561720392-45907-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 e1b6231..ad50904 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -15,6 +15,7 @@ #include #include +#include #include #include "internal.h" @@ -1691,6 +1692,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)) @@ -1703,6 +1705,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