From patchwork Fri Jun 28 11:13:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiongfeng Wang X-Patchwork-Id: 11021987 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3710D14C0 for ; Fri, 28 Jun 2019 11:16:33 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 25ADB2834A for ; Fri, 28 Jun 2019 11:16:33 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 185C22873C; Fri, 28 Jun 2019 11:16:33 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9DD3D2834A for ; Fri, 28 Jun 2019 11:16:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=vLqFgiisvgISK3HaTbk00wZTJOpMd2+Yswo9Wk4E6PE=; b=hp0Hwns2HRWDRF 2EEN8dC6nTbuJhd0b/eQ48c0lKgMkpwO/uAeYYl72nmUK7hTMt6LdUn6F/C6h6HYM6fd0zhFtBEdJ IxuOn9ctEMEtGBZ3rYSTtTa2/iAeOOdiJpJJQrCBolAOfpXF6af1TsYcpyRVh9PXkOQQV8c6Hp4xv zgSW7uBqXxgXOy2hQTNjgXm7VUgJOR/pERi3NmpMfrylHCLzlT3D4Nf2r9aAfsB+gSylPIraljKQo s33s6fzoisAhAnqBCV6eb1gc7ukqeEwdoYUea1Oul3+F6cgEFLwoZ1oIgXYVIAzCrg4R2mN5pryYc Ga6PXLXQVAiQlXFwH26g==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hgori-0007it-5c; Fri, 28 Jun 2019 11:16:26 +0000 Received: from szxga04-in.huawei.com ([45.249.212.190] helo=huawei.com) by bombadil.infradead.org with esmtps (Exim 4.92 #3 (Red Hat Linux)) id 1hgorN-0007Uo-Ov for linux-arm-kernel@lists.infradead.org; Fri, 28 Jun 2019 11:16:07 +0000 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: , , 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 X-Originating-IP: [10.175.102.37] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190628_041606_041840_DAA50A31 X-CRM114-Status: GOOD ( 12.42 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: xiexiuqi@huawei.com, jonathan.cameron@huawei.com, john.garry@huawei.com, linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org, huawei.libin@huawei.com, guohanjun@huawei.com, wangxiongfeng2@huawei.com, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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.