From patchwork Mon Feb 8 15:12:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Calvin Johnson X-Patchwork-Id: 12075849 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.3 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 839B6C433E0 for ; Mon, 8 Feb 2021 15:16:54 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3386464E15 for ; Mon, 8 Feb 2021 15:16:54 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3386464E15 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=merlin.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=nJB+xasEjr1KZY32oQtL+x46NL3Qfu5rLd3atdi7UoY=; b=jHK+wHJqj0fVM9FKbAGgkuOPX b25HCbd80jHmmTZMe2E12QWg+12/EbanM1uVli4xes5s0rT+zsFFklwOHXrD0t4S5pH8FxpLRH6mk pUlPAkVSg1ckPULxuyiBMjBZbRbhKO9TkNODnqXl1eGTzjtf4PO2n1GZqRAQ3WZz2Dm7Ek3GssF9f ZXKqnCeloNHEIsfJHQGa/4VJvahUJqF2p4BttZS28rF6k7QeOBK7r8OU9zHYDpKKPWQtmqVUC07Fj A9RlZYx4IkYKIDWfh3sypmV+SyI54UNvfbHcKzxqv2dU7F7wJsJgV1PeI7PybebWRTSHaFi0ACSvo r5u0AkjnA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98G7-00064O-Tq; Mon, 08 Feb 2021 15:15:27 +0000 Received: from mail-db8eur05on2062.outbound.protection.outlook.com ([40.107.20.62] helo=EUR05-DB8-obe.outbound.protection.outlook.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1l98F5-0005Rx-TA for linux-arm-kernel@lists.infradead.org; Mon, 08 Feb 2021 15:14:25 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TtCkWlsBK/dkbnf9Vq6JdOLzEEvdd1UDf5pJLkv3xFgi+oQclnb3bGyuKBnXgSgea2b4on/GPffxnBsecFYwgr/s0cIRRI+eK0SrOwYRbbj5uD24i0X3ZzUH4CgvxuTqhQxX1ggyFG9OCjf8HG10NQbztZeFM+xyLVsUGWYx1uX4J+zbbwDDmj6hX026of9lACzTv+Kz8a6lrAhvhTx8R++xWX5LXcHIZSGLitPwt1Bo4l75AHmT4X0xfuxCxi1hIxZ43GrURsBh+0e2biIbcSAINqtjFvvUSVxOvwaDHzApvxVNZ7WmksOi4EBUAkzMk7qJdErf6PDb735HYpPGWQ== 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=tL0qBZPAdiA2FFpa8M03X3CM7yKo4+kkGIejxoTd1uk=; b=FadVCjCvY1Vdzm34ln7E/+MvEMkb8TeuxjVmCr6iIrR1PwIcTb3+6oJbp+mzSJF8qSY/oLixPhF45Ekv/sau9cPeHd5OZjwLgZmaDEFYPMhmsY1iBFxKOYPNdScLM28kWoMmUVuOde3kIyWItAYRk4RwqQZIFk6SqxLKhQjGS8mg2CmNKoB5o89W+CrUY9wJaNsBEV1RXXUVieeL2qiiayg1RHEAbrtjUxzSDKUFbII0dveKDAD5mRmhZXHWiknNOQ1ley+DAIurX2/UTIE6gzwTFBwARX1pGu52XunGxqN27t/ZYQXi5q+FUDRFfGYq+INiIZ0tCbwvQKDMHkQjSQ== 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=tL0qBZPAdiA2FFpa8M03X3CM7yKo4+kkGIejxoTd1uk=; b=JjSGfFaA7OFbkqEbha0Hrz0eSmjIIB11X6A48HZaRYBuyt8WTNLV7pUPxub3++1KTH3GHNP6qvIyCCCGckKYxJXi3lOaFUExh3WoBJul0FAmKlGG6YmVEdf22tsQJFHuMZnjc3XgbQVeA9RiEKNMxgH1Z4eeBkysjfr9qIBgK54= 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 AM0PR04MB6435.eurprd04.prod.outlook.com (2603:10a6:208:176::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.23; Mon, 8 Feb 2021 15:14:20 +0000 Received: from AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42]) by AM0PR04MB5636.eurprd04.prod.outlook.com ([fe80::e90e:b1d6:18a2:2d42%6]) with mapi id 15.20.3825.030; Mon, 8 Feb 2021 15:14:20 +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 Subject: [net-next PATCH v5 09/15] ACPI: utils: Introduce acpi_get_local_address() Date: Mon, 8 Feb 2021 20:42:38 +0530 Message-Id: <20210208151244.16338-10-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> References: <20210208151244.16338-1-calvin.johnson@oss.nxp.com> X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR04CA0176.apcprd04.prod.outlook.com (2603:1096:4:14::14) 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 SG2PR04CA0176.apcprd04.prod.outlook.com (2603:1096:4:14::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3825.19 via Frontend Transport; Mon, 8 Feb 2021 15:14:14 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8bd6d8fe-2214-40b9-66f6-08d8cc443555 X-MS-TrafficTypeDiagnostic: AM0PR04MB6435: 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: NdYfx0wIbD67ZPd5CGgToNiPmqtR5Uy4PFvtESaGarJR6Ys4GHel7s4DYoVnnizJ4eESoQ2R8vZWYjlZx4t5yPiF9yf9FCKHp4IUz/16YqD4/kNYpJtpmnOmL7yY5NZyInFVesM4Oh2jWiTL2/HzgGNNwoH87B+9xAR+DLj1/ByO6/4Z68ORESyT+WPibO7HmWCyur7mPMJCWqlEUQgVgNiJPpEhZj/Q9Mx+5eyNf0OsiHFD2ZH8FIYyxF7scCgNjr1i+KG9la8zcTFBmJp5f3mSFIg3VTE+MWHm9fPr4gmphQLA5IYZwpqKnb12bMXMvNh9pqqThjGd8xgr3w8hhGwSjuvE2X9sknAAqayARdgTLMCYsNc79bc76r3QkT6JqjKfcv8Gt3ILEbBfuR/TCBNe7OQAS2Bkw79slPw9MYuQ+aHmHxVRkvpCxkpcg4raEMv8atPvptfbc7r7aGL6+wveKwkzf8W5gFmElc0E0Bhf0whH2ao6MZNPm32Z2SAewFqhzVl6A3ybp1QvYyC6hPF5DSsod1M8nIivWEUa7lEdoPIkZJ8Xo2BTRq7S9QYZLpt9+7drWDFnzT0yPOqNbg== 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)(366004)(39860400002)(136003)(376002)(346002)(396003)(8936002)(54906003)(7416002)(52116002)(110136005)(186003)(16526019)(316002)(55236004)(956004)(6486002)(6666004)(1006002)(4326008)(2906002)(478600001)(6512007)(1076003)(6506007)(5660300002)(921005)(44832011)(83380400001)(86362001)(66556008)(26005)(2616005)(66476007)(66946007)(8676002)(110426009); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData: dsmiHnJByy+QqX1b3Qj7ZlstgurKIHbJ/JGoVDahH9zUK5OijF6gnTdYpa8GwCnut4smwfM+BuMFfuy5N8+pSxuTgEaWyFMkQVjCyebXFQI//W2yaBRgfLQHTi3mX2GTfhPQ3T9R3mLHsOprmcpKpxohs64kx2Bu4naqfhBCphk65JExQV5qv3kJrpNC/Zmv+/WS6p+/aHEdAwztHrj2qZ0dm8xd7Y1/wlhqZjxP8Rn+kvocfww84p6VSy8Pe2ZMkJlNMErXzsqrB0YTb8Svcerg7YND9o9gp7iuRud5/jrEnMi8oZmYSMkB7pjxSZnSL+PUV5/PBAPI7J4gHjKdCcJSCgHvyknsgZS8nNsmoy53E9HlyOVPzriLLKxQq/IeJIN7UtbUI334SgEpG3jXaltDXaF6/yGFKdiOV0TYd6RDAdttiqv50BZV8NeZKA358I+OFMeVIEe4OXSWxLVYIcuZ9LpU30CzZ/jxu2t6YZOS80+WgaxDalTuNhT7e98wGs0JxeOE0Kn3mWxRcK6Ey1vDrCZJkyzaGQC31IgKI+TS2sP/3qCWEl7VZFxTMATltGrQRQFmx0A3cvtEpycGlyc/JO5aVTF7i1WbJQwTt8LF+CcGDTOppBZuvSODzcyF0QKoiT7SlFBIs4i3gtJW69jYKnWFtr83uqp1iyY0yyhX6wCqxsALP9LDvjvIx4NNhxZ+ZVXPkCTiK+BFe50Fv70pzdnkHILZyzyYJVqZrdwi9yGSS6nOLeZ/j+FaEws5/AuSwkNAkDPJ2crDdx+XdidhjQtO4/MNboSzSoUvw4TDqhlA76Es0yAiuJ8YOxHRYvDRSkc/6FRy173Wp0Nx4fbvng4Ras8lzjpcqqB7Cz0fY70V8e+KSDX+QGolQ7GGzmY6cUlprXkdQlzK0VFfXFjjLCeRiVFSbGibDGks8BVyJqyoQB9k1Fv4EMAetih6RWalHoWNTiJd/GGpRukmm7RlfD8WuCIJn9Cnsb1ij2iQlINzV0rkFO/iLSWh/nid/8jLHRo8nnchySXbfoRvVkxJTSNYCILbylEIM/cBWiIhwcHTC85s25+OHykQxNC7n3d+xH51rM3HORfC9pl0gqezc863o7T9vGsVFM1LyhXi/w0yiKSH+phbAm5uWR6duNcMm04u9nsjbqD1asHyc5IDsNKysNbTLm+o+6p/qw4GX8ZydR0ceOZ0uPn86XUyLRBdlt25ZSXwAJ9qiBjpylGWaVUSiLAFWBZeM52FFc7+u26dgtHBnMv4nKvnLx7M9ezTztwMp7TNNLbhZ1Ui92p8BbGlsQRDWo6q1AHvWg4TbdgBqXWY0QFvjpooNcbG X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8bd6d8fe-2214-40b9-66f6-08d8cc443555 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Feb 2021 15:14:19.9985 (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: 5skC722HaIAA6MF4royhG78ERK118GjrONnFEuXLMevBNdlORAGYq9EFDbTP8FTpa7HC3MgaYVmwlkv7+dkFhw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR04MB6435 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210208_101424_018058_FE6FDC6D X-CRM114-Status: GOOD ( 14.60 ) 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: netdev@vger.kernel.org, "Rafael J. Wysocki" , linux-kernel@vger.kernel.org, Calvin Johnson , Diana Madalina Craciun , linux-acpi@vger.kernel.org, linux.cj@gmail.com, Len Brown , linux-arm-kernel@lists.infradead.org, Laurentiu Tudor 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 --- 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 d5411a166685..0d3a2b111c0f 100644 --- a/drivers/acpi/utils.c +++ b/drivers/acpi/utils.c @@ -296,6 +296,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 053bf05fb1f7..4e5ce2b4a69d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -699,6 +699,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 @@ -946,6 +948,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