From patchwork Thu Mar 11 06:20:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12130447 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MSGID_FROM_MTA_HEADER,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2E41C433E6 for ; Thu, 11 Mar 2021 06:28:00 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 74F5764F47 for ; Thu, 11 Mar 2021 06:27:59 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 74F5764F47 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=oss.nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jDo1qaXDbhFII++1MisTBwS/ZVG8wESSvLOwpa11DH0=; b=kvLYC5UkjS+QroZHwH90wiv5t 3wJNTq2CqMDbi8XlWKb/55jxkUany69r3xyV5jCng/85sYX5GWW7wFpLjrxp4vEK9H2EWXHr7quFa ic2N9dGTQSzY6OpsJjJ8y5z5nHPl17M9XNFb3MA3LnIc/7N6GAkb9HwtdHZZNYHH/XLmj8jkF/Wdf MAa7INXh1sMPiyT07rb1zKXnfQd1opVkmacvF5eKznTZ3aH4MxnVmizfkyb/McTNXDAV4m1aWGn0f /S2Y5QUWB3B8FKYR4Kh8rplQ5QTQaIvTTKucKzoRuxbYrvTjEXPj7oN+pwrLGtgTnmccwNPGHd/Cs sSl+R16Yw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lKEkS-008TbS-4f; Thu, 11 Mar 2021 06:24:40 +0000 Received: from mail-eopbgr20043.outbound.protection.outlook.com ([40.107.2.43] helo=EUR02-VE1-obe.outbound.protection.outlook.com) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lKEi7-008SeZ-F3 for linux-arm-kernel@lists.infradead.org; Thu, 11 Mar 2021 06:22:17 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FEyfsaXU79bMt4oRGr4cLlUfaqnQ3m7YPoIjRa8vQeTf6eVwqzgU5GHSeg5PdF/LkdEilRcT35Vm99HIFJ09sWXUkgUz8DbM697kePzxt4slEr5g7S9jfvv1rp52GU6FhE42Lq5k6JO5us4ei/zIvCiIZez7MqHAteXM0wHAfBtqpjt7/svtYxmD4XWBv+6HJNNg382q4GFhJ+1ZCTdpLwEBTwGA9nxIOuPU7lpSrJqAtRc+D7uwqw8uwnSenKDDZEAb7+JOCST7bHKM0tW/5tCLjHbGy5dW4ilHusovdvRmeP1ct6vMSHVKHhfcERMS+NP9vhqQq9VtGk3NKjVDPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sGE+dQqB5Q0ju9wYpoV22UwnpMHoGA6jS7hGPYK8h1M=; b=fMO9gU3R7ZQcwvagJgeQ4zR4Ludu/kADEiZ2e4TKT6zMAwgUBKE1cnlxwiKcleMm5yAm3w7Gwf6bdLqJl4zUZ4dWEp8FCgc/a9rTBjz5XoaVZkviE7RuuTvqWMsnvC4RP8Bz+H++lgRVkAH8E2mV6Bllct7fO455B8W04AWfpNid4DaxkglzHwtlJDGxZTGUq3ayxW/TUJxnXSJ43erWqb7QmUTsQMZ4Ha1yJUAI6gwHVmlAjpWhdhp1UrTT3UEKLZ9xZ+VlFuZWpi0kr0uL1SmG7jmSuKAeoB67DeTR3EaROhOFwJ0Mzb1X0TQ9qJ+Gi91aDk6uL2XV7PiK3RD2LQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oss.nxp.com; dmarc=pass action=none header.from=oss.nxp.com; dkim=pass header.d=oss.nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=NXP1.onmicrosoft.com; s=selector2-NXP1-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sGE+dQqB5Q0ju9wYpoV22UwnpMHoGA6jS7hGPYK8h1M=; b=IWcXQwGnbbwipfwfeFhL5mIeSPN0xGVSAGu6Snwv+jlCz3zDaKqzO05gzCsNuG+sHmCrL6BPmw8cVkMt4F8FFx19vnmjjpBcR+XJUz8wAjGf36lSAYsgEojc5FJrLjGrwWfSL1bxElKmt4V3roRYrSQ/kJY7zoRYD6eyNKgBHtI= Authentication-Results: arm.com; dkim=none (message not signed) header.d=none;arm.com; dmarc=none action=none header.from=oss.nxp.com; Received: from AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) by AM0PR04MB6611.eurprd04.prod.outlook.com (2603:10a6:208:176::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3912.17; Thu, 11 Mar 2021 06:22:13 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::1cd:7101:5570:cd79%7]) with mapi id 15.20.3912.027; Thu, 11 Mar 2021 06:22:13 +0000 From: Calvin Johnson To: Grant Likely , "Rafael J . Wysocki" , Jeremy Linton , Andrew Lunn , Andy Shevchenko , Florian Fainelli , Russell King - ARM Linux admin , Cristi Sovaiala , Florin Laurentiu Chiculita , Ioana Ciornei , Madalin Bucur , Heikki Krogerus , Marcin Wojtas , Pieter Jansen Van Vuuren , Jon , Saravana Kannan , Randy Dunlap Cc: linux-arm-kernel@lists.infradead.org, Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, linux.cj@gmail.com, netdev@vger.kernel.org, Laurentiu Tudor , Calvin Johnson , Len Brown , "Rafael J. Wysocki" Subject: [net-next PATCH v7 10/16] ACPI: utils: Introduce acpi_get_local_address() Date: Thu, 11 Mar 2021 11:50:05 +0530 Message-Id: <20210311062011.8054-11-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> References: <20210311062011.8054-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) To AM0PR04MB5636.eurprd04.prod.outlook.com (2603:10a6:208:130::22) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from lsv03152.swis.in-blr01.nxp.com (14.142.151.118) by HKAPR03CA0026.apcprd03.prod.outlook.com (2603:1096:203:c9::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3955.9 via Frontend Transport; Thu, 11 Mar 2021 06:22:05 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1db04771-33ab-4492-b892-08d8e4560265 X-MS-TrafficTypeDiagnostic: AM0PR04MB6611: X-MS-Exchange-SharedMailbox-RoutingAgent-Processed: True X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ixRDScbMZyl6pE8Me1soFOWpT/YTOZbP0M9vObAQUD1NePmlLRceOb2Wz8jP+6y0bOjyfawFoy0oclpNkuBQ/IIrrx/cUzPH/mKfjDf4oR1JyDa9eZuSzUtHEOtvZ7VPELqv+uURT8HYux4nK5l3eyKcpUzv2v3eXqi1MV9abQg1va2+0T+SnzAzoJbgHbccM4/Nx7Ntz/JlXk+4VsKVZ9PZcOOZ5CffzKeMSWVOyfYi2+IdjHXXW3oMEVR9iyixfBoOOEjo0YLPP8vTv+DOT+FkNi7RzbJT+DxNlSVFan4nVARCpPqsbxKU8qsN7AbGXCMVYmYDVGE7Rl/w0FR6iKFlphvVuXJ8/T6q0r7uGuaJ18/30ukiDAmKee775aCVWHGareXPJXXTHdQm7dZ6WXLYZFghW7KgoY+UM/CP6H0EqjO4DyekYsWBESvMzn1xlDdSVoYFV4v9cTev9SIRROeORt5egx1RvzrRcuh/3OTNB+dP09OIowaW8J/dCaonxuMgDy7Qq8AmhXUG8E5JeMHnTxKITyAUvImYKdreRe4Puh+XExJLumDh+C6T1U9LO/PWN3WdiXo2sCJ39LcEGlyQHXws/XwlTjKnsy1HfNk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB5636.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(136003)(39860400002)(396003)(376002)(366004)(346002)(2906002)(921005)(16526019)(26005)(186003)(83380400001)(6486002)(8936002)(6506007)(66556008)(66946007)(55236004)(66476007)(44832011)(478600001)(6512007)(2616005)(316002)(54906003)(5660300002)(956004)(1006002)(52116002)(8676002)(110136005)(86362001)(4326008)(7416002)(1076003)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: zH/cVp4fgyENpxD5aKgbY7AEE2URUo4rxwwrjKlZiPNmyju+FSTcRnHqNvprstVM8xDI1ckDEAzLFyymP+NX9QXbQtkjn24+ZCAq8lcpmjd7ut98BsMNFiUYlkaRuR//qrQag5KNhluHU7/zg2QzlymNfbYAm+proeSuyPEeT+mZj6pvLK7A8SMAQt0MEJRaNiXDjsFLQxZNVdrwkzRtr4pSubtONV3vy8Z7OLyjnG1wuxbkKUJiQvHPG/5lx0xqdVXOl1ce1F49ckwEIVJsrFUgbpb4uZOmXvmKdTT0aMJk72TcUKPCQZdLW6Z8yHBQm+94KQ3hbYWn7aSPY90myBBsAgEGESCLC8GJNxscQwzZtrlqT9Qr79jMb1B2PFStikjGK9xGbrP0O/+heb2Drijz7Rrr9lHmljxclTA3l1OAbh7AZdtt2bPBKZaAHzuafDqJiDFs9v3HmUzlgboQo+Q71QWszHU9IOC8O2CcEF7IOi5OPbVS6rqdE5XP7QhQeKNOk3P401GYJxfYczlkHohHuLpJeO36aFYhMLS9MccBD6W+Tjxhjk6oG4sYBT+qdq6v1Zg8nVL69LMPsEH/qlrDbz+4dBuSqR4+KtA7ddtLNdnq8BlZNmvtjtj6Go34H3hfhzv8lF1X7wuIfVh1hMawcSeP7mUWzLfUMP6q6yayzMrEL8vRomIuLjoUQl4nq/lVDa6IzPA1shD6sCiNQNBFeX3VfCNnDF0BrZBSSut1NIVA4X9gCCFWTaxUAKTV0OQpeAszf0PMN/xj42rgklgZwDEFCIt5hfXIvU64qZ96aaN+U4iQoRCsgyt1OtETAG+qcv6Mi7br0Db+qJTvDrtUcwpArilA1oQl9RSaNWGdWHBpnS5gI0AWLc2vd0c2zlkY9qZMeZFx5tTLPepkwc8eNcdqBlH20BB156brxKdyQaju5yPqX5Z7J2BjLfwK3TU3yXzhfLpocL052v8AYGUdFaMzZcifziOMnajdFrBWA2962yaSdg5XUSLHYFHlf9N9iU302relaDQO+oCbXi50Ziwubg90t4nFsYZ7SHFXiOD+G6BXFu4SCXy/0ZLu9fkoJqUM8ao47mJYErpj95BgCJ0zAyj4ke7rx/srnfp/NU+PGJPBvzILLfEEvvYU/1lQyZTn45UrLrDnyK5ThRwr3c2Fh9Rq0KNNxvSzXmwTUAiXEPnTodGZojKjtkP/6M/9czykjDfQXKaPnSZwfIWTeZpKmtRy8rBlI4YrI9WtpXosJ6VQI2b8gyvqgrkO5jHxbyzWWbWiPBoOo8LCs9jDFCh+I9gMOz/1vK73lZ8XA6qHrwd0ZK50/e1cw+5p X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1db04771-33ab-4492-b892-08d8e4560265 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 11 Mar 2021 06:22:13.4944 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: B80SY+ffe7Ybdv6zvslsO9ODpRrsKM00aSuaz8uGnxj0Snkak7sH5vORe1zcdGhDedmyOk0CG6OGSFO2dsypQg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6611 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210311_062215_782667_0743F01D X-CRM114-Status: GOOD ( 12.53 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Introduce a wrapper around the _ADR evaluation. Signed-off-by: Calvin Johnson Reviewed-by: Andy Shevchenko --- Changes in v7: None Changes in v6: None Changes in v5: - Replace fwnode_get_id() with acpi_get_local_address() Changes in v4: - Improve code structure to handle all cases Changes in v3: - Modified to retrieve reg property value for ACPI as well - Resolved compilation issue with CONFIG_ACPI = n - Added more info into documentation Changes in v2: None drivers/acpi/utils.c | 14 ++++++++++++++ include/linux/acpi.h | 7 +++++++ 2 files changed, 21 insertions(+) diff --git a/drivers/acpi/utils.c b/drivers/acpi/utils.c index 682edd913b3b..41fe380a09a7 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -277,6 +277,20 @@ acpi_evaluate_integer(acpi_handle handle, EXPORT_SYMBOL(acpi_evaluate_integer); +int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + unsigned long long adr; + acpi_status status; + + status = acpi_evaluate_integer(handle, METHOD_NAME__ADR, NULL, &adr); + if (ACPI_FAILURE(status)) + return -ENODATA; + + *addr = (u32)adr; + return 0; +} +EXPORT_SYMBOL(acpi_get_local_address); + acpi_status acpi_evaluate_reference(acpi_handle handle, acpi_string pathname, diff --git a/include/linux/acpi.h b/include/linux/acpi.h index fcdaab723916..700f9fc303ab 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -706,6 +706,8 @@ static inline u64 acpi_arch_get_root_pointer(void) } #endif +int acpi_get_local_address(acpi_handle handle, u32 *addr); + #else /* !CONFIG_ACPI */ #define acpi_disabled 1 @@ -953,6 +955,11 @@ static inline struct acpi_device *acpi_resource_consumer(struct resource *res) return NULL; } +static inline int acpi_get_local_address(acpi_handle handle, u32 *addr) +{ + return -ENODEV; +} + #endif /* !CONFIG_ACPI */ #ifdef CONFIG_ACPI_HOTPLUG_IOAPIC