From patchwork Sat Jun 12 16:03:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1491299 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=43wLrjuw; 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=FQcxlTB8; 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=mXdYs8Iq; 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 4G2Mw554vnz9sjB for ; Sun, 13 Jun 2021 02:04:05 +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=oiyLJonR4sPCZka9tdj1PySQsclvhbJN4jeKSALBuaw=; b=43wLrjuwA5cyWQ GtRdLJ+jbiUYPyGVR6jFtaYBxB0F6stLc1koOAG2i6n6M3nNPFvuXZsp2hBSMemnCxR68S6jkvXCR D0u3plsjI7YK6v/1GuqUMNwThIAMTCBauNwzSLZ7PhCBwVPQlu9VwPLJNJNmykS7dEoMD43FAV2Oq M/giapiQKK+1EVMYnMn4za0W9CX2Re6nHq+8KkMfPCUQmUCjzYauhTAHoLJcd94c7/n/4wUttSmql EA/TGa4x8193S05aYYDTERqhAWQlF5vlK6+BQhGtW0dsYgWeEgOs/cMcIHymRzaywPUfSiGocifhf rr5zYx9x1V62sbMjFxYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ls676-008mOa-Aj; Sat, 12 Jun 2021 16:04:00 +0000 Received: from esa5.hgst.iphmx.com ([216.71.153.144]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ls673-008mMc-6T for opensbi@lists.infradead.org; Sat, 12 Jun 2021 16:03:58 +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=1623513835; x=1655049835; h=from:to:cc:subject:date:message-id:in-reply-to: references:content-transfer-encoding:mime-version; bh=zzcKcB/kBrpcmyY506nBKQtYZdNN7kFC5DQuuBStLvg=; b=FQcxlTB8xZAp0w1wFJKFMewSkslGNMpVj+YHX0HIuZJmFf5k/010LO/s 1Eu5HwPNxbR3Za77vdq0iq8pd1X4cz1xH5gBDBOhKioWYhlObTH/nDdMA 8E41vQvjScsCWBYMIuhJSSgWDbAFJGa0aHj3vzKsKQgGoeKPYsqRU6frl GiQAh949qwZZLdhTgfqPOSeoTH6qvgQcjQxqFqKaMz36E58Lfw/2J2iFj yM9g9fE5tXKCn1Cdh9ermkLYsNDMqPW3Js/AHNohNtRb64HPRV4o3lba7 LLmh0wLkq+7Y5sdKVQmOyFINnaVpX9IfRnkZEbur56bmHq5lDHSckx+jl A==; IronPort-SDR: j56X4wKrFS7ie5t9KMlB4jZlg3xQ4mohlH7WKpSa7hegLlQ4NNEcSGJbq7KLF3S/4rrIzTQ+3L t87vcYLjiu3CqQwWjfRx3X4rnxhnCsO5WQ4FDbYQWKa7L/YxJgQUUIgq0LK7rvMbbGiQfYvc40 RHueXGRO86lWlEjGKGs1uzXixlucHXV0UbdRha9hbKdzGucKz21w5a9Xo9tytpBSa5rgyUXE1j ym4n4q0w4+AvZDiA59mc2YGS3jMsSj+Rh9a/mfXvxruZncWcKu0JOQMSfeTiu2HguDm/gskmI7 jTw= X-IronPort-AV: E=Sophos;i="5.83,268,1616428800"; d="scan'208";a="171704628" Received: from mail-bn8nam08lp2044.outbound.protection.outlook.com (HELO NAM04-BN8-obe.outbound.protection.outlook.com) ([104.47.74.44]) by ob1.hgst.iphmx.com with ESMTP; 13 Jun 2021 00:03:51 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=inDIDVyHaLxosTyT5q1zURy4R4ppfx4jmdcjsuoPEksUH2AhAF3j4DxKWR1UckLiNZo1mgsvyq0lVI/auCXH4oWemcgWWjbvE6vBovXu5X8IDncrxqv6JCQjQW3JBERwB5XmCQuXg4lL7noxOX3R5D3tP+7KAw1AAoLqS7y2l8SUvgByhO5dWOgo20LM3nfvQeEOAED/CueWR6XsyCdY1MORN7vVEHRduegQH25sXG7lkLvEwXzgMFu2Zp5Xg9AGG3AFqeJ06vZlb3bsq25m2XM2Va88DGPKzZ2KvtlPqhAGH+BlE7dieiPwm7c3mSl8Gtuek2F1QH5Vbm1E6SbArQ== 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=ObBimjn9WGSkGGAQ47SjY9Lv0HQp6lpUfV6VdEc4Oc8=; b=Y4ip8Ig5fNVhxGo+Hc1atCT1eCTo32/+r8MD61UdD6HaVqT4fjIpwoTxJo6ATlThJnYJhDQxxL+JyCHZEwOshyRoa2HqwALeohopI8xecATGqgCcgK5d8QEpGX0YxSJ5x6mN3QLHioBEeENp6GYHYmGBTnO6usmEs9IT4hSxUNMB/Sd1JNvZFVXxzIT799TtI+8gu6hN71NiK76lANL7kv12YS8lFyCkj6aldcnTXSWaqclZu94K/viiPUA6keCLK9pwOIQWR+PhDrbDmLqxIhqGmgQoI/VShbt6b2WDm4DGedZibQlzSXwEbikqfYsbFh3m5h4BPIo9B9uS2FY4GA== 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=ObBimjn9WGSkGGAQ47SjY9Lv0HQp6lpUfV6VdEc4Oc8=; b=mXdYs8IqHlFWno6aNsx86UMIN0xh6OGFrU5mC6ESLGgMaZsL0lQ8Ad4/TqyZ2u58u2othzmquL7B6TbTK4u9iUPoEz6BNvXsE2W0v4RDFaQPT4J5BxQakNvwdCc4GdlZa0pQOW+RQYPg2yP/0+6/TmEA42D7eQ/7ONuXgs9cc6k= 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 (10.242.165.134) by CO6PR04MB7795.namprd04.prod.outlook.com (10.242.164.231) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.23; Sat, 12 Jun 2021 16:03:51 +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.4219.025; Sat, 12 Jun 2021 16:03:51 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 3/6] lib: utils: Add FDT parsing API common for both ACLINT and CLINT Date: Sat, 12 Jun 2021 21:33:18 +0530 Message-Id: <20210612160321.330638-4-anup.patel@wdc.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210612160321.330638-1-anup.patel@wdc.com> References: <20210612160321.330638-1-anup.patel@wdc.com> X-Originating-IP: [122.171.171.205] X-ClientProxiedBy: MAXPR01CA0101.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::19) 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.171.171.205) by MAXPR01CA0101.INDPRD01.PROD.OUTLOOK.COM (2603:1096:a00:5d::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4219.21 via Frontend Transport; Sat, 12 Jun 2021 16:03:48 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: aa4cca20-ceee-42cd-8b21-08d92dbbab7f X-MS-TrafficTypeDiagnostic: CO6PR04MB7795: 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: vOV/lwCLmuxBtfiM+85eYYhKw7bPsTLAx5vCoXyyerZ6RE1Z1MK5eahoBJzzmOd8mDqbQr8xEREn86qUYnevH46gby7HphKumSJ0KKcAr13EOAQlC+KySeWNNHk8BAkv1jjnndU4jY7owyoZ0QNqzlQl1mky727PGr2Wlor12p5096JUgX1KsRfr9/3OW7ZqoZzcGvUxfw4WUj5LjJKDanQSfE6CN7fBjXJClDdrCZhNt4DSZE/qPVV6uVejhK76eifwfkCmvvYgM7tSCmcl/s1oyRFR1W9SsiZBQr15jDFw2dXcoMyR+JnyS6eD79gMUu3bAaQaw56pTV10YWZUWV2S60IDOcBMI1dYOYZecEOMEupEmq6cZwG/xCbi9Px7moYnd6YWfqFwBXQezUxUspXSqTLGot0xveHsozCffRQUhSPF71127nKIqOtVEix/H7jF7N3kBYTqxx5vTqnCLjtoMfO5y5zEK8L5w0s9kCKm3Q3WkxW4G8BXPPsp97d8mHIW+SLB6eiPwC/sVBpwhSw9Rkhavxp16CF6rihJyX9jaBwR/Dhcy1RR2D14j1BS42EcLMV3b2OmvoubZJPvm5d91XuJ/GtuhMaHyoPris3r1XCZspZlP2b6cOIKEZqHX7repJixci25YkbegkR8PBcdBUp/JDHz/KwuuAtLzZ0= 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)(39860400002)(346002)(136003)(396003)(366004)(376002)(956004)(6636002)(6666004)(8676002)(8886007)(26005)(44832011)(2616005)(52116002)(7696005)(110136005)(83380400001)(16526019)(478600001)(186003)(4326008)(38350700002)(8936002)(86362001)(66946007)(316002)(36756003)(5660300002)(38100700002)(2906002)(1076003)(66476007)(54906003)(66556008)(55016002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: EH3hjfEdEbiVEvEnUV4VetKN/NMWeIWH3ybtltvJr1XOYDhlvPL2q17xjNr/SWEwYEUwDZOTQZYus04wBGdQz059/pZ6vWVZweM3Ehf5Jb02/U8IMlpVl3AdXpU0Jte2IrhggScRRsyZWNrTwr0oQvou0dCKDq2kfMB8oNmnRWzHh7MqDef4jeGHGKp4HoX3ht2vOx0qGJ/rKki6aSX46B5UwnmkLrSFiiSwUEoFSf0r0jysvmkdJ6fawjzKvs7iiekDCATwhe4TL0UHJ4BtrLv4vxNOYuSLbpnri+ymU3KKQgYDKQ1qyqF/ejkf2nBOfsqujijPe9hNJbuY8B5M6Ottr1XHyE87CUf3jnhPhWNOsT+HKbfKT/0P8KFWCW6sR5PIwp2O3TIbgGCwALB3VMAqlVv/FWJkiRZShG29MQP2+6CGEzx3QwXxaFOMhkr1MC9HRCLJUIceuVpRLBuydfei88MYnSBfR5pMn/SVsWa3iAaH8iN3bSDr/e9Ca6SGMiR7dVSRUossNDB5F+9HWz4beyGwJYPJWeh2rWmBRaA9NZ+sDTgCRE5KQu/al4sEvHq5zSbNYVc7fvfDy8KTEapOBuozfo2/xdrtRX86If4fzNPXIKLtQSjSez75pg/xf0qrJgCHQt+ST70cZ1W5wGOTZ3mdMf4/9brIRUzkDeRjIEvy2z/g1IDlRA9hVvthKq/lNIroTBCiNrkXideb4tgG5rlsMHJNLDyvNSGKMvJcEhLHz1YsDVDLBx+se3lQ/Iv4cGQXTYEPcFq/v+e6F06pl2LmdWtLV831n4UBdnvjrJzPhX/g9h3+kpEFb4pfev0gRxaZ+xzu4lD8MZG2OQWt3K9vc3AHJTwagx4C9tmAKKRwBxGt7aR3eXEi4iJsKFWTG+h/Le8Mi0cqLcX38/pfHfUzVjK0bXoQFNfgtITjgtm+iMxHQlg6CLfPw3zMf3u39qpcj/yMrkykDrUXFUc5MT7nLk72O2QiedVZdPuSgGoGCMAhqQgHDcADbcwitiIZU3b9P/NNdW9UWR1KF7PNq6uU0VRDgZ6JPyeTrxt7J8w5tnzThS7kuXbewp8R1WNbxxYe3lJbjSQ2IRuVQP+zqIF7eCZmrFa+pm8MOHxCp73O1TCuZkp0Awm/s1I/EAs5DthNIg6Wy9pxm6dDNZtxdfgIPUEH0Yf2/hxCdzV6OarqafLk04f/gGYgLmFJlXiBbODpDCs592cJ2n9XOZp5DDlarKWgF1moo/D6DE3ox6hjaf9Fr0ppKtmInY9MJab5jDeJK/2rv+55EfWfGFzbTl3grUlLpJBl/afC3dsEtcD5HQmp/0x5Mf5qidqf X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: aa4cca20-ceee-42cd-8b21-08d92dbbab7f X-MS-Exchange-CrossTenant-AuthSource: CO6PR04MB7812.namprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Jun 2021 16:03:51.2945 (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: 48rr00XhO4aGPusf8f05EAILFPF/eRfGzJf/1kunkcqf05uCIajxHzjww1c+XGGbJaoFDrHSE7Q/U/BtbcC6ew== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB7795 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210612_090357_286736_DA24A7BA X-CRM114-Status: GOOD ( 17.40 ) 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 is 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 --- include/sbi_utils/fdt/fdt_helper.h | 7 +++---- lib/utils/fdt/fdt_helper.c | 31 +++++++++++++++ lib/utils/ipi/fdt_ipi_clint.c | 5 ++++- [...] 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.153.144 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 Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 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 is 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..c97d3a9 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..9c84c3b 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); }