Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp7009938pxb; Wed, 17 Feb 2021 21:41:15 -0800 (PST) X-Google-Smtp-Source: ABdhPJzAY9GvV/RAE/TZEF7/QjlUJ/VRBEVqtqxlMJa9PZMGXkZdrvGPvQZwNa1qNpY1KPu39j7X X-Received: by 2002:a17:906:17c3:: with SMTP id u3mr2282174eje.304.1613626875715; Wed, 17 Feb 2021 21:41:15 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1613626875; cv=pass; d=google.com; s=arc-20160816; b=RxY33PcstFkzvTR3adgqlr5g+z6mE4MvsetHgqrfB5c6uqJSgjqD58Z0E5PlRq6mr0 cT+o8sT5ugKRwA0iNDzdJYnYY8C5NCfg6COQAzuNDgFJY5HqVLXSunxSKfNiqHwqhZNl 5TEtsoUJTJV3UbW3RkQ+PLCcQrxtmp+iYYcaYZS8dZ5abZyII1452kDD5ZDUsJLRixos sRkX5nvsdajBXzDdaEui+Y4gUf0Ac2TsOkgsuIQzUjGM4L+nkSAKC9DbxwZNRWgTabV5 zZ+ER6X00A03c4l/dRXVDaar37Ei/bEy9mPyCsyENdXfcsJSS7XB7w+/6ONxbg/SLn9k RXUg== 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=2VxMVISQ/LMSiAcmhaO1GSPoe7eKo42+tIOb5vDny4g=; b=o9sO8708n6hjCd7SCBDaQikzGkhOaOjqryz4XYilGhys0JEJ8JELf7Lvs1QOxCgGFu h4xWBQCZs9/Aq7cPn844QKQFRMRsw3rFV0avq9AVDMToSR0jwcqCaVEsJ/Wfg5jZL05b WbuGfSbYy7crWTwQStgw8djYp6CHIfX+vVCQ7rE5LJ3YTnHsOkVvybHPCocC0nmr0fel GmvTKCAc1VmReP1CzZoGYHaC0bjscY9O4QRzC9MS+TTiMATQnicimfZ0TxrwI0yOQAjA SgKwqxLePxh3IBwXmV/dd2jFEkt0MVOa8ldiGuuW6yGZydQ+1Hg98JGv2KvaDzYNswMl wl8Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@NXP1.onmicrosoft.com header.s=selector2-NXP1-onmicrosoft-com header.b=ACjNiVQE; 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 y13si3106971edd.436.2021.02.17.21.40.51; Wed, 17 Feb 2021 21:41:15 -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=ACjNiVQE; 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 S231279AbhBRFiA (ORCPT + 99 others); Thu, 18 Feb 2021 00:38:00 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43744 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229720AbhBRFaw (ORCPT ); Thu, 18 Feb 2021 00:30:52 -0500 Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-he1eur04on0603.outbound.protection.outlook.com [IPv6:2a01:111:f400:fe0d::603]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C06A2C061756; Wed, 17 Feb 2021 21:30:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=f/hv8h9ywtSZRtIJjlCaLL4nHO8ljFbGGoCBvHskHq4i6yL01uEd2LxROfAXUcPkKsEWLyQt21VfoNLTusfOdBlBKwo1RJ6zwTqSqy6a14PpFVvO+2WoSPFbZE7jJFmgpRabOYMyghcl43hcqI9OwERr7cm+LXgeFRlb34NOxq42vnM4cOXnVHFEcloXkCYXbFPsmpfOZygm4jlP1z8wCG5U7hHC3mtZ/cVgtKBE3BlAiAYBzXHqymPJd8bQTTNJV6pcwRE1NA4fXHYJCQjlhE35SXVPXbarvRx3ly4SeDb0Y8qSfcqWFnN1r7rsc/Bn7dux+C7dJTxVRxa/kufC7Q== 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=2VxMVISQ/LMSiAcmhaO1GSPoe7eKo42+tIOb5vDny4g=; b=hVUIkFqeo4kZhCqCrF3lsHax3HwE1ZSH3fJV5LvbBCAdlIElQrCLA8/FuDo+am5ZPvShM5XTmvYZAmxJBlADrrd3uk6XSasdKNhXMM/r6cXzJ1i0O4xAdgFLKUzRodq4cHkDbokpKua2rjahLOWX0zeniJ9jD3FlWgpG+Gnhy0JYZflr+PwrySazAB2NERaSBgnAky99K8bmXTH4FaOOxRnzLRj7RP8a8zYWvWeyX7crn1DZk8cemLp0eNkmsq4Yb8gs2Z5iS23zZczCE+MuCq2AxhbwMUXN0NrlryCt3rfhHA7Bylu9UnE1g4snmNK9H9S9ZBPIqZufeqrKCtSfOw== 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=2VxMVISQ/LMSiAcmhaO1GSPoe7eKo42+tIOb5vDny4g=; b=ACjNiVQEC9mvzGV7JDWwUHXfmtO1PHkwpdPqGTvkQ8+4w4kPhzgGkXXeHigfHqUKvTLeJG2sA7a9BqHBiJEjGOJNFUNKfpAnRm7bCvoj1P4eDc4FeJSZwFq4/jTd/26skkITTZEvUJvT3J5VEOU3/BPTjQpOiP1iVii1rUts9J0= 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 AM8PR04MB7730.eurprd04.prod.outlook.com (2603:10a6:20b:242::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27; Thu, 18 Feb 2021 05:28:28 +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.3846.042; Thu, 18 Feb 2021 05:28:28 +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-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-acpi@vger.kernel.org, Laurentiu Tudor , Diana Madalina Craciun , linux-arm-kernel@lists.infradead.org, linux.cj@gmail.com, Calvin Johnson , Len Brown , "Rafael J. Wysocki" Subject: [net-next PATCH v6 09/15] ACPI: utils: Introduce acpi_get_local_address() Date: Thu, 18 Feb 2021 10:56:48 +0530 Message-Id: <20210218052654.28995-10-calvin.johnson@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20210218052654.28995-1-calvin.johnson@oss.nxp.com> References: <20210218052654.28995-1-calvin.johnson@oss.nxp.com> Content-Type: text/plain X-Originating-IP: [14.142.151.118] X-ClientProxiedBy: SG2PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:54::15) 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 SG2PR02CA0051.apcprd02.prod.outlook.com (2603:1096:4:54::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.3868.27 via Frontend Transport; Thu, 18 Feb 2021 05:28:22 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 8d50f793-05c5-45b4-2cf0-08d8d3ce05a8 X-MS-TrafficTypeDiagnostic: AM8PR04MB7730: 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: TESp2T3F0MVkINs9U9Li/k9Fl7zQ7iIjhHZ4pNXEighiBDHkTlWwiB+lQsP5kHcWl2JF3sMuUkq8uO79Hb817iHLKFKbZZlWoB99bMnKLOitKMFA0XHNxVm+c/9osbqP6Ds+QDD044ygmSsjCThL84fA1vS7IJwoynDFRDMT8VOACJJJ/gbtq+0LmC0If0oID0hYileysWOq1eKWH8tva4N9d2rrqCbwZoH6DGJF1VBJhenoDzSHImZIJv7BiSwR4hmh4yqpbenp9xRC8wKPAq7sYbotHBfti8uFzObqseVGRakXxyuHhTytZm96wiXD3MDolM0tEK8e8JKt1oH6L4s7G5ksjMdD7RQc8Ga5dOhBF8ozxaCRpjeLrExR3e5B/U+S/lfnQIVm6/8LC5tccYxp1T7/KidXGczXW1jNRJMi4Dua4TBjcnfNnjcKodPaBDEaWisfxxFFnQD5StOGZZYrSrnqsFTU40pPwj92w2UcbT7+mfk1A8cHMsrSt3E42Ey1WHfglNvP7e1MkTXdumpI9CZYgWBHtTsHrQp2tQ+U+ggJY/XyqSPzvJtTuEA6y3iS+hD0K0fo+2PAaPpKXg== 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)(396003)(376002)(346002)(366004)(39860400002)(136003)(26005)(8936002)(52116002)(16526019)(921005)(478600001)(1076003)(6486002)(8676002)(55236004)(83380400001)(5660300002)(186003)(44832011)(110136005)(6512007)(956004)(54906003)(316002)(66946007)(2906002)(2616005)(1006002)(66476007)(86362001)(7416002)(6506007)(6666004)(4326008)(66556008)(110426009);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData: =?us-ascii?Q?GTw88VGF2dEYbYoW9EuanTRdDZDyAIJeJiELgChZrfnTPE0MvXz19cYSegxY?= =?us-ascii?Q?MhZnqYBbfo28Ier2vv+7KPEzCyIMT7Z8lJdyb7KmWgPskYlCxYOfNdimSR1J?= =?us-ascii?Q?VeEq5NVvjlk+MFfEHBON8QtLCpEiSMViK1WZATYgQzVBw1gN3mJGphcjMV30?= =?us-ascii?Q?lc0hDa4Dd0+IWfDJlkjtNYF2PpN73DudOxp+gvVBElcC61fpcCeA8p+0MNZv?= =?us-ascii?Q?cRbM27oxI2w18ejH6c6m6Gm1HmYM3EWesKuBAvtmb9XDn+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SzNBpNMBCkZcvZ9bfgacR0VPSdl1TQXv1AHEuAoufI?= =?us-ascii?Q?9QIrroepM2nWk1324Gx8IjxHAJ69e03obIAtQRfDiCJ3ekBexsARZHDa/Loi?= =?us-ascii?Q?3/eBXqUTQ1EfJll+8J4Swynir8pXX+9fOZ1R8Tm2IcDGEQRqtfDP409OVMcZ?= =?us-ascii?Q?TR+W9jQEEyyB6SmwK4GplFIj?= X-OriginatorOrg: oss.nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8d50f793-05c5-45b4-2cf0-08d8d3ce05a8 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB5636.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Feb 2021 05:28:28.7494 (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: rFrsesNzaNrFjSD3Ttz0DP82X3ExJfvXpb7cPKD8+gzWUQSEL9IV4Rv3JfoBl7DVkRSlvFSm85LsBi1Z4kkWpQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7730 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 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 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