From patchwork Wed Jun 23 06:02:23 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1495957 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:e::133; helo=bombadil.infradead.org; envelope-from=opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4UAtWTKe; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=wdc.com header.i=@wdc.com header.a=rsa-sha256 header.s=dkim.wdc.com header.b=iGLvEAnZ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sharedspace.onmicrosoft.com header.i=@sharedspace.onmicrosoft.com header.a=rsa-sha256 header.s=selector2-sharedspace-onmicrosoft-com header.b=V5FXTnxa; dkim-atps=neutral Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:e::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4G8t3y6gYLz9sCD for ; Wed, 23 Jun 2021 16:03:26 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; 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=WgER211DpuzQSR/FzuJ0dVHRNJ5M51OWk1XoJUpDuOM=; b=4UAtWTKeWy5Ims Ii3APnKpPkqCTue1v5XHTe8rhnfITQWZ2Iy3tOh/CSIHMTjNrGYjm4ewFF9sI1/lpt7eN1lRubTEi GNTUU9GTxID+H3uxXsBdqrb5lMAA78DKcM0v2U6mKnU4USJ7s1OSQ/Hz2JGuXBy2Ku7dRPtkDutQg W487U1hSTmS9yYkRuljv4WwPXJ/QnKjUu5XqvQG5QeL6hFxGZRlQrK8zlWnx7PLERM03lU1Fh1VfA SaJmbhJRfKoMUM9TElrPLaxDnKZtgwndltnrWadvvgKvG2iL/s118EJJM3Uf73PPOIbAEgH+xkzpF bxxkFN3iRagwXEX0Bh+A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvvyr-009U2r-Sa; Wed, 23 Jun 2021 06:03:21 +0000 Received: from esa4.hgst.iphmx.com ([216.71.154.42]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lvvyo-009U1F-7X for opensbi@lists.infradead.org; Wed, 23 Jun 2021 06:03:19 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=wdc.com; i=@wdc.com; q=dns/txt; s=dkim.wdc.com; t=1624428198; x=1655964198; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=zqFAGf0dLRfojjV6ONUv1SSrS4xd87NDfpvslk/g3Bw=; b=iGLvEAnZhBl5GZTUsh6b6eFxcooKw5bkaW48kDiwYSh1nNGUV2UrySXR HNsTxPI0RmXmmhljnIkiVbeUeXJeCHoP+FYX0epHsx0rrLB7Ij+/8BHGU afuSi60dLGdovuVsmbuDtiO4MBPPKSFtvNQwyHokYMEdUeL/yrqX55HfJ 4MXnXI6gE9kuEm69V6dap/nIkFFUZ2Ri4ga7q+sfshJDJwVVyd9jJpAtq UJc1A8mQCCXcRS0yfsd6dTASDyiuWh9giVYivyVCIzN6uHnn8SP1aw5rt xCq/gCHGqCzPVDLL5VMCC7ovbgxrzvbaHNQ2C7CTm/Hq8qHvflmZAoLFN Q==; IronPort-SDR: E0hZPyVGKWXEAoDeKsl7LpiA7lshfboE0tJkmRVjtfIpf82cKZNDfDZkq9J9/l/3Y9qTLX0vSX gjZvNnllk55SZGLnSwyzgynGY79T9tAoRhBoRWSS2AQsBxdqiV/+5rwL7a7DjGZQ3pe+EybIGk glIJRt9ssU10HiQMYMM6ANS7A1ZB10OeUJapgleByzBTGY5omluqUqp3e0R9L7XCjKCh6uLPZy UX5F5QXu1kNjKrdflwh5Zjopbwi1/MnxYZIZMi+a/KmYZTdN3ClkrLYVGS9+t3MgwCFFQfSstr S8A= X-IronPort-AV: E=Sophos;i="5.83,293,1616428800"; d="scan'208";a="171913210" Received: from mail-mw2nam10lp2105.outbound.protection.outlook.com (HELO NAM10-MW2-obe.outbound.protection.outlook.com) ([104.47.55.105]) by ob1.hgst.iphmx.com with ESMTP; 23 Jun 2021 14:03:15 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=hk9t7RPh3LVGEehre9MRTmAOaxoBA3CJ5JEo41phyvJYW7eMLSmsQ0Wtgf7rq0vg8DnLZMk9BfhKPNFLBhz/xou71nnMwNYAaGz4DUmR3cHt8UR7pCt4WHsK2I3Lw+MVFtf2NNPzQtK7zR4RgmwX8EkUJzv5HkRf6c9f/9mZs5uCPQPAZ3ND0nR/LwInVHRkyHbe5Czvjc9XZqaV2uPyrnPuH0hVODzouXGyMOTAvFrLBaaWtBL2CFfbfUi+sslJK5zJ8I75JCfWca1uoiCVlIudTZ5JbpIGG0urza+5lk2GXniDi11i+/D8bkWBJyOE+V3A8SyaqyVq6FeCt8Rq9w== 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=FlclpNXITpifuxp9VRGOTr0eU6eu0ssSMlJ37JTcmas=; b=mQzGv+oXti8I+EkypKkQ9WVYsM8cVOrOhSMnbPkMAGtgk3biTKMZyiP8TeOIzjspN32JgnwgVoE0ZgC7lCa6KhZat1LVNWQjesEOlAN2Hrv6vDdfKDiNO/IeqI0u8Xjx/WCnnk75s5oxZOLTfuBxcXK9jFAempqBXvIZTYO+xRK3dsuYYPU1goBvHK+NoCOSRUJ0+9BSiXVeQm/xSgke2O6nv4yquOVLPO6RL2KKZaNNVNsvaihPRF9McKDrmdUoUQWK7o7UvATfdJk4Vsl4FreHi294C2eqyiH9ex1qTkQ/EUZ0VGpeOAAcndkGogfxCImIJqCrf0cpkeNPLbZClg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wdc.com; dmarc=pass action=none header.from=wdc.com; dkim=pass header.d=wdc.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sharedspace.onmicrosoft.com; s=selector2-sharedspace-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=FlclpNXITpifuxp9VRGOTr0eU6eu0ssSMlJ37JTcmas=; b=V5FXTnxa571Zmp6YK/pV3f8UxPZNjpmxP1pbDrKhrl3ZYHFqjHJNji2xSRDnwriSuIsl/6wfl5yucuL8qmQppyR84CAns+peM3eoULXk4aAQOKs6xHu6HCGetHqYdTeb5DuleoCONFInLpVSBfiDgxnuW6G6N2eJRAXWOeSHH+w= Authentication-Results: wdc.com; dkim=none (message not signed) header.d=none;wdc.com; dmarc=none action=none header.from=wdc.com; Received: from CO6PR04MB7812.namprd04.prod.outlook.com (2603:10b6:303:138::6) by CO6PR04MB7810.namprd04.prod.outlook.com (2603:10b6:5:358::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4264.18; Wed, 23 Jun 2021 06:03:14 +0000 Received: from CO6PR04MB7812.namprd04.prod.outlook.com ([fe80::a153:b7f8:c87f:89f8]) by CO6PR04MB7812.namprd04.prod.outlook.com ([fe80::a153:b7f8:c87f:89f8%9]) with mapi id 15.20.4242.023; Wed, 23 Jun 2021 06:03:14 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel , Bin Meng , Xiang W Subject: [PATCH v2 3/6] lib: utils: Add FDT parsing API common for both ACLINT and CLINT Date: Wed, 23 Jun 2021 11:32:23 +0530 Message-Id: <20210623060226.442030-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210623060226.442030-1-anup.patel@wdc.com> References: <20210623060226.442030-1-anup.patel@wdc.com> X-Originating-IP: [122.167.39.73] X-ClientProxiedBy: MA1PR0101CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::34) To CO6PR04MB7812.namprd04.prod.outlook.com (2603:10b6:303:138::6) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from wdc.com (122.167.39.73) by MA1PR0101CA0048.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:22::34) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.18 via Frontend Transport; Wed, 23 Jun 2021 06:03:09 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 93ae7192-be89-4d40-b774-08d9360c94a9 X-MS-TrafficTypeDiagnostic: CO6PR04MB7810: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:4502; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: Sm+qIUcqhyaaOGwP4sJLJIiBhhT7tbRsrSST1Wl21dTfSAg2LjD5a7890fX2Y+003TyoaSTCXmL+NDJmq/xbmROD5rofN8atIeJWxvPE/YPKHkdZniz/4yuWeq0LrDDDds2fihtgGW1OwdQIMHQOTQnS35Feld4THvtKAYdbg9Rk4tNzTr8Co3AK5Y9Gt1/VHKYhwz9OBXgn0jNp6dx8KUndWSJs/stfDc3ZxVm3wg3o2Lb1NefcXmo33wiMjKSGocXkfyo1NHK3dH/I8q5eSrJyh783ubiCk/U5k7GmnYdFlFiFmsQSv+RQGsB+paYJq16PtUtLkrJgBRc6PNWYmjvZvEDBXEcIdo1t5RmaZfgpweZUjJnkkFdW9kQifzJxhCAQOq3c/uxMv7zccyVCijDyjTGq77mrqJ3J2UDMi8qeY4PrIFMpcss77AoOpdqYczxwWIa2syCZnOQ23gPW2pNLi0ybLuTJSeMtDkJxKTBXg8NLTh5hqa28GvrTrzuZh6p+rkXHUMeAWZ7FXjk+7VIez67M6r2WIEWszsIVszSATRe2iYDgxKMRRbZ9A+Hv8V5/Xf0Oyz9C2Pux5hzSnpp8rxg3EznaA5m6UIpJJcqZMyIXuiZ5bmlx9UX9IP//LNXgm3l64TBv3Mw83uAyVwfnGtZin6CmKeOZ3tKGPZlV8K/Lqj/sTIljAhHNxgE5Xg15KTOnzi7XQANY/lqK79dEZ+/Qg3elxEAv8TCx7HM= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:CO6PR04MB7812.namprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(4636009)(396003)(136003)(346002)(376002)(366004)(39860400002)(66946007)(66476007)(16526019)(66556008)(186003)(83380400001)(6666004)(8886007)(86362001)(54906003)(52116002)(316002)(110136005)(26005)(8676002)(8936002)(7696005)(478600001)(2906002)(4326008)(36756003)(956004)(2616005)(55016002)(44832011)(1076003)(38100700002)(6636002)(5660300002)(38350700002)(525324003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: lOWhffWDWj9Nc0JdLNUnAo7mvme/9LZyKqoAp4BGGoBXk38k5hKRnXLqCAzCKAT+Sm5KxDa8iK1nYP6kGIkvKLYefyt7LVMVPLqjFDiaU3lEDbazDxSJpUgsg7cwLsgEkyS7Xvs5Hae/sBF+jmNjhO/n/MYV89FKboogm1BPT1tS3SMmyZEjOBWtc3ShwFm9ld+43UYgeS/LLEt1Yh1Ysbeal0o8dyhYSHHai7rO7ecf2lDVSP5FrTyf+UNCWpHIQV8EsVOE9wqXblrraOcaukKieSFLDLBee2g5EpctAkgcLFYy0Mv7Bt2RitmALXEA+FPGmwMYwwCymcpHZMDLnW0/aYMaIZMWoxmgCHpjIJSqm9HFNvrxV/s4FUFYr76uaHogNojFXWB+dxvKaRejsqHYlTWoAvRmbsZNf6aGlqOinZFsjg4D3V3Or/3+9xjOSx1kfBd2hiA07hmbihc3Io5SI7X1B7zhQJxm6/RvnN5aHWJJX0YjnJ/0brc7xVE3zZUneM4PKXdL4tE9iUVMT/mQ7GZn2CktI5NQ/HZ87g0gq7Z9MZw61m8eU69LK3WGfffYU8Wtf2fNkB44TMkUCHnHq2cEK8M+DYkQD9txSPDqD+lO3Rt8YqIOPH9n+pcFcrI85A6ekj5M78Ka1lyGOqsJ3/F95xdVUeU7uOghmZD3WY6PBIyV3H+su3WhqMqIohP8uxgb2WrFm+ZSITCqhdimqJTtjTHcO0vSnBuMqNURNlYiHmMEqtKbhMDfMPmRx5RN6TxSBVKaUDpR+pkGybSaSTgtoFrvnVOyYkYx44Qrtv7KjRl5EmiR9OpS/h9+VOTTL81D6js2eYd43YEmQsykmEomuxyDyq/yFj7vqJgy6cigVxPk5iYKp3Apff/QKhMkikcu/Rx12SSx8735+hdmizK8he+zSxcDgxqemoMi/Bll4SI4DFAI3906euTfh1FBM2AwWxjx/BK8KTvZFs5pE42/je4NSDW/dUVOvmIECd9XVCkRzCAA4C6Pk3NPICuexaQ/p/Y84MHpFcM0HcQdkcgseZJIj0fxE+Mxp2+U3ht3aQ8iWY4waAWn+naKPTqlrgonT6mnV6gvzHJyZv4P1gJDj8eUOW3HnHJ4Je0f6uYA8oRJ6j1BwdhHSjG84vvctcPW/b2Ex1xflca7YTYUzp5zDzIWJRP9ulY3OVoxfdWiDrtd+nL58NjZasw0no+PJjt+DTnuFx87nV5lexPvuoXVrRTYM02eDfj3X7zWNLBJTBRuYzm+rt+yH583di+bBBvALDJ7D3XBHANHzMKQWd5gHTFnSm5Efb5HksFrtjTtPlwGqUKCWxNLlUZ/ X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 93ae7192-be89-4d40-b774-08d9360c94a9 X-MS-Exchange-CrossTenant-AuthSource: CO6PR04MB7812.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Jun 2021 06:03:12.6188 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: b61c8803-16f3-4c35-9b17-6f65f441df86 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: UBL37qR4CZtFEaIwxe6F6BpBcOw2kjHLpFW26xZ64jGHLClFvfO2Hht63dx0oWa5TUuPt+anH47lZpy9VI8Nlw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB7810 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210622_230318_432537_818C7A78 X-CRM114-Status: GOOD ( 17.19 ) X-Spam-Score: -2.5 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: We add fdt_parse_aclint_node() which can parse both ACLINT and CLINT DT nodes. This means fdt_parse_clint_node() is not required anymore so we remove it as well. Signed-off-by: Anup Patel Reviewed-by: Bin Meng Reviewed-by: Xiang W --- include/sbi_utils/fdt/fdt_helper.h | 7 +++---- lib/utils/fdt/fdt_hel [...] Content analysis details: (-2.5 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -2.3 RCVD_IN_DNSWL_MED RBL: Sender listed at https://www.dnswl.org/, medium trust [216.71.154.42 listed in list.dnswl.org] 0.0 SPF_NONE SPF: sender does not publish an SPF Record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.0 MSGID_FROM_MTA_HEADER Message-Id was added by a relay X-BeenThere: opensbi@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "opensbi" Errors-To: opensbi-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org We add fdt_parse_aclint_node() which can parse both ACLINT and CLINT DT nodes. This means fdt_parse_clint_node() is not required anymore so we remove it as well. Signed-off-by: Anup Patel Reviewed-by: Bin Meng Reviewed-by: Xiang W --- include/sbi_utils/fdt/fdt_helper.h | 7 +++---- lib/utils/fdt/fdt_helper.c | 31 +++++++++++++++--------------- lib/utils/ipi/fdt_ipi_clint.c | 5 ++++- lib/utils/timer/fdt_timer_clint.c | 9 ++++++++- 4 files changed, 30 insertions(+), 22 deletions(-) diff --git a/include/sbi_utils/fdt/fdt_helper.h b/include/sbi_utils/fdt/fdt_helper.h index c89f2e6..871f9b9 100644 --- a/include/sbi_utils/fdt/fdt_helper.h +++ b/include/sbi_utils/fdt/fdt_helper.h @@ -60,10 +60,9 @@ int fdt_parse_plic_node(void *fdt, int nodeoffset, struct plic_data *plic); int fdt_parse_plic(void *fdt, struct plic_data *plic, const char *compat); -struct clint_data; - -int fdt_parse_clint_node(void *fdt, int nodeoffset, bool for_timer, - struct clint_data *clint); +int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer, + unsigned long *out_addr, unsigned long *out_size, + u32 *out_first_hartid, u32 *out_hart_count); int fdt_parse_compat_addr(void *fdt, unsigned long *addr, const char *compatible); diff --git a/lib/utils/fdt/fdt_helper.c b/lib/utils/fdt/fdt_helper.c index 9143e44..de77196 100644 --- a/lib/utils/fdt/fdt_helper.c +++ b/lib/utils/fdt/fdt_helper.c @@ -14,7 +14,6 @@ #include #include #include -#include #define DEFAULT_UART_FREQ 0 #define DEFAULT_UART_BAUD 115200 @@ -421,8 +420,9 @@ int fdt_parse_plic(void *fdt, struct plic_data *plic, const char *compat) return fdt_parse_plic_node(fdt, nodeoffset, plic); } -int fdt_parse_clint_node(void *fdt, int nodeoffset, bool for_timer, - struct clint_data *clint) +int fdt_parse_aclint_node(void *fdt, int nodeoffset, bool for_timer, + unsigned long *out_addr, unsigned long *out_size, + u32 *out_first_hartid, u32 *out_hart_count) { const fdt32_t *val; unsigned long reg_addr, reg_size; @@ -430,22 +430,25 @@ int fdt_parse_clint_node(void *fdt, int nodeoffset, bool for_timer, u32 phandle, hwirq, hartid, first_hartid, last_hartid; u32 match_hwirq = (for_timer) ? IRQ_M_TIMER : IRQ_M_SOFT; - if (nodeoffset < 0 || !clint || !fdt) - return SBI_ENODEV; + if (nodeoffset < 0 || !fdt || + !out_addr || !out_size || + !out_first_hartid || !out_hart_count) + return SBI_EINVAL; rc = fdt_get_node_addr_size(fdt, nodeoffset, ®_addr, ®_size); if (rc < 0 || !reg_addr || !reg_size) return SBI_ENODEV; - clint->addr = reg_addr; + *out_addr = reg_addr; + *out_size = reg_size; val = fdt_getprop(fdt, nodeoffset, "interrupts-extended", &count); if (!val || count < sizeof(fdt32_t)) - return SBI_EINVAL; + return SBI_ENODEV; count = count / sizeof(fdt32_t); first_hartid = -1U; last_hartid = 0; - clint->hart_count = 0; + *out_hart_count = 0; for (i = 0; i < count; i += 2) { phandle = fdt32_to_cpu(val[i]); hwirq = fdt32_to_cpu(val[i + 1]); @@ -470,21 +473,17 @@ int fdt_parse_clint_node(void *fdt, int nodeoffset, bool for_timer, first_hartid = hartid; if (hartid > last_hartid) last_hartid = hartid; - clint->hart_count++; + (*out_hart_count)++; } } if ((last_hartid < first_hartid) || first_hartid == -1U) return SBI_ENODEV; - clint->first_hartid = first_hartid; + *out_first_hartid = first_hartid; count = last_hartid - first_hartid + 1; - if (clint->hart_count < count) - clint->hart_count = count; - - clint->has_64bit_mmio = TRUE; - if (fdt_getprop(fdt, nodeoffset, "clint,has-no-64bit-mmio", &count)) - clint->has_64bit_mmio = FALSE; + if (*out_hart_count < count) + *out_hart_count = count; return 0; } diff --git a/lib/utils/ipi/fdt_ipi_clint.c b/lib/utils/ipi/fdt_ipi_clint.c index 529f978..ce0ca8e 100644 --- a/lib/utils/ipi/fdt_ipi_clint.c +++ b/lib/utils/ipi/fdt_ipi_clint.c @@ -21,15 +21,18 @@ static int ipi_clint_cold_init(void *fdt, int nodeoff, const struct fdt_match *match) { int rc; + unsigned long cisize; struct clint_data *ci; if (CLINT_IPI_MAX_NR <= clint_ipi_count) return SBI_ENOSPC; ci = &clint_ipi[clint_ipi_count++]; - rc = fdt_parse_clint_node(fdt, nodeoff, FALSE, ci); + rc = fdt_parse_aclint_node(fdt, nodeoff, false, &ci->addr, &cisize, + &ci->first_hartid, &ci->hart_count); if (rc) return rc; + ci->has_64bit_mmio = false; return clint_cold_ipi_init(ci); } diff --git a/lib/utils/timer/fdt_timer_clint.c b/lib/utils/timer/fdt_timer_clint.c index 0352e53..63d6586 100644 --- a/lib/utils/timer/fdt_timer_clint.c +++ b/lib/utils/timer/fdt_timer_clint.c @@ -7,6 +7,7 @@ * Anup Patel */ +#include #include #include #include @@ -21,6 +22,7 @@ static int timer_clint_cold_init(void *fdt, int nodeoff, const struct fdt_match *match) { int rc; + unsigned long ctsize; struct clint_data *ct, *ctmaster = NULL; if (CLINT_TIMER_MAX_NR <= clint_timer_count) @@ -29,10 +31,15 @@ static int timer_clint_cold_init(void *fdt, int nodeoff, if (1 < clint_timer_count) ctmaster = &clint_timer[0]; - rc = fdt_parse_clint_node(fdt, nodeoff, TRUE, ct); + rc = fdt_parse_aclint_node(fdt, nodeoff, true, &ct->addr, &ctsize, + &ct->first_hartid, &ct->hart_count); if (rc) return rc; + ct->has_64bit_mmio = true; + if (fdt_getprop(fdt, nodeoff, "clint,has-no-64bit-mmio", &rc)) + ct->has_64bit_mmio = false; + return clint_cold_timer_init(ct, ctmaster); }