Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp4140394pxb; Mon, 8 Feb 2021 08:52:21 -0800 (PST) X-Google-Smtp-Source: ABdhPJwBg5Pek4EH/HgSxvkFtD/iYod/5Kbk7fotHMS7WL3B4q4baF3MSvUd+SsPuQBdfvCQm7R0 X-Received: by 2002:a05:6402:541:: with SMTP id i1mr9327892edx.36.1612803141469; Mon, 08 Feb 2021 08:52:21 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1612803141; cv=pass; d=google.com; s=arc-20160816; b=vF+D+86R2OVFZ7NvGIXdYlxf8zSdx5cEoNZrcDOWXqGGwsb1G0WHTtl4HtHMLKtpib 9gc0yhU8KQ2LZyixQudcWXNAjrl7RI8R/3e7hZFYrl0WvdOyYqGNX5x8oT0j8NrJwhu2 QDbR7e542dlugxZKHA1//3ssOwZtmfoWTe4IgUvIJiKx951MYX0REZPcZBWjJ6rWEd/i MX9spGSLd2tzsCUYUQVYB95yt3oS0N4TYcJOdvrksGBFe+Xq0rh/F8YPyNeqOOcnP5W0 kOcxG7/nIX50VADVFMghFKX31C/4qHxoanw0Llot+t7amoK4sw14NEyEEfZMHLC4qMXu OpMw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=tL0qBZPAdiA2FFpa8M03X3CM7yKo4+kkGIejxoTd1uk=; b=IDdSULfAXse6bt4MUAPYir0cq2epte7+dyrJ4ghZkj46pEQQnRymfxNMWwh2H6jH2e rKuCOPvPcGXnlT2Rh6VMmnkjhAlBufscYDQBOUaX6spajgKa0dJqnwRhy9k8Dc5FTnbX sgA4xa+epqCbcAFVnmyxvIEAP014aftYTG/30J4RkCkTwpcz4285s403KYn7QXYSCakD mzM7HSvdWv7rWvYoB/dtiaj4c26YoTIKx56GVfDm9l83s62VPEH0c8HvI02LtbmOhfkO swhtEM6oB9RNe+OMKM7RUxk2yBI8nls3t1GkQT9cNCXGzXzYEKPkvuIVtfQZrQIMwuxw AOUQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=JjSGfFaA; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b63si12800050edf.480.2021.02.08.08.51.57; Mon, 08 Feb 2021 08:52:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=JjSGfFaA; arc=pass (i=1 spf=pass spfdomain=oss.nxp.com dkim=pass dkdomain=oss.nxp.com dmarc=pass fromdomain=oss.nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234631AbhBHQtm (ORCPT + 99 others); Mon, 8 Feb 2021 11:49:42 -0500 Received: from mail-am6eur05on2080.outbound.protection.outlook.com ([40.107.22.80]:34240 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S233588AbhBHPRO (ORCPT ); Mon, 8 Feb 2021 10:17:14 -0500 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 Cc: Laurentiu Tudor , linux-kernel@vger.kernel.org, linux.cj@gmail.com, Diana Madalina Craciun , netdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, Calvin Johnson , Len Brown , "Rafael J. Wysocki" 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> Content-Type: text/plain 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: =?us-ascii?Q?dsmiHnJByy+QqX1b3Qj7ZlstgurKIHbJ/JGoVDahH9zUK5OijF6gnTdYpa8G?= =?us-ascii?Q?wCnut4smwfM+BuMFfuy5N8+pSxuTgEaWyFMkQVjCyebXFQI//W2yaBRgfLQH?= =?us-ascii?Q?Ti3mX2GTfhPQ3T9R3mLHsOprmcpKpxohs64kx2Bu4naqfhBCphk65JExQV5q?= =?us-ascii?Q?v3kJrpNC/Zmv+/WS6p+/aHEdAwztHrj2qZ0dm8xd7Y1/wlhqZjxP8Rn+kvoc?= =?us-ascii?Q?fww84p6VSy8Pe2ZMkJlNMErXzsqrB0YTb8Svcerg7YND9o9gp7iuRud5/jrE?= =?us-ascii?Q?nMi8oZmYSMkB7pjxSZnSL+PUV5/PBAPI7J4gHjKdCcJSCgHvyknsgZS8nNsm?= =?us-ascii?Q?oy53E9HlyOVPzriLLKxQq/IeJ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ii?Q?u26dgtHBnMv4nKvnLx7M9ezTztwMp7TNNLbhZ1Ui92p8BbGlsQRDWo6q1AHv?= =?us-ascii?Q?Wg4TbdgBqXWY0QFvjpooNcbG?= 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 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.17.1