From patchwork Sat Jun 12 16:03:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 1491298 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=DE/FANmB; 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=ZVjS4SOR; 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=y9J+4FTk; 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 4G2Mw50tS1z9ssP 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=3fhxU6+JIcpEsumkWYRjY/BjzZHRuu+91jNOYwAWvB0=; b=DE/FANmB/uH1Vv IQLzyEjbD/8yToKoJvCR5BJBKx/zM3EdzD9CgaSTKlqvl2iECVHecm2k1TD/HnOzyfqx9Upt1OnPM RYmGpXqF7aryVFQgqir4ZtfDBBTATPYkmV5AxWI2fmEjsIux7AUV2DllaAuzDc29/n3kIvTiyjdeN tqvFsU/iHmc4/BKSCMDdP0rW4lHvcYGJALtdcqgjiYK/tdpOmRrpv2PyR26YjkSSmlwvfBauYsIRN QfaPYv9LMj+/l94JsERFWVYeD1pP1hbAd37OHbLMgWKSWa2CBr6cogXMrcAOTh+LrQzlAd1TP1128 Su6ZK/XHmMChc2E3DeKQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ls675-008mOS-Pf; Sat, 12 Jun 2021 16:03:59 +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-008mMv-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=K4weP+1/hcwApvJ87pB4EFIR9HhIyPT4jlEOyp1Uepw=; b=ZVjS4SORdvMvwpSSXRNfGYDqXFDVOL+y7NkyF1P9qx5fXXpsfVg92Ke1 o9ewtNi6H6y/v6/mB03bDIMtz3nCqIoy0NN8PaDKzbi0TE5gPFMPo1bQl dZBfqFB3OF1jp2EEgCaExH6nrbq8kzDFjLkpvtD6qnE8mzD7SP0HvdXi6 h1UGlWCY+Y+tFU91mftD7I9eFieqRWXWMhlvZl6LTIBr/isxmdWlzHrPP HLyj3ODSgTgcyFboGX1a3isIzvTjHZvFXgoPKcFqKrnvXZjf7BZA+BX5J Bg5tGyWmiO1O6Nmbo7itSPvw+sHMtZnPSPiPmVIbKunR2m0jK2SgZqKor w==; IronPort-SDR: 7VH02i8jEEkIqFKVmc3EIedLe4Vt6ti6Fa1qf8H/2we31u6VNM+/igXRp1Wl1sgwAd+2GH+JJD MBAG8Rx6AAPF+dNFgqkhi8c3I4H4xno4dPncpg6kXZX+quCJWOtfIiYCeVWND8/3mL7KDeG7ZU rCHKaYMA5EpiZwTAtFoCtrPPMZ1cbCkHKkKPlIvHHlBJ0lrs4SAwfdEhgKJ1/cnbitS60rZueM InKiM5izBMIle3gYX5v/4cIU556hnK3VcLUqbChLQfiS7a2IUEk5YL1EDqeu77N+esNJ49Yatm uac= X-IronPort-AV: E=Sophos;i="5.83,268,1616428800"; d="scan'208";a="171704631" 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:53 +0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=A7CNFugdMYHxsONpOrJ8f9DVPbVCMhYpwSoM2po1DFAahpdx1cM1R4xnHs+e7EurswZzinabj6uIdnaJxttcAouHTnomz3kRq2tCbTFG3NlBRv5v30S4pnthNBEhV01lxJUo6Tq3jVN82ZW/cGRYW/P4dGF8UDjGXXn58r8f9OrZCUFHSfjwcojIWdtTCZgGJRfy7PqbEZ/Ts3fVsYARuge6eH+z3hp/KL284Ou9ZxxFdZ65SXEuxNfHZ2+EzNdWCJIZeQ9mxVmUVkVzqQFL5kHS55AFkKIGyFHrpw88VjFMKfgnTI2h+cPuwZR/yIKHGwXTGMaC14dkGDwiXOmfIg== 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=J+ev+u+Ek5rAxJqYhx1LCtzTUiBI+7ZIchVVzNBw15E=; b=eybDGTGwHWdShXprtrx1V0TQ0prLo72PODVcZLuQz8LXJ1D6VDJsTvT4Vdypf9DFftWa4MRg2GtJci//ED6bqEeblXApmKcLaj1KOePsU+e9vSaekl7syc5GSiEHJnDfJyQhQC292IFu9iiwVhS+KJZEyd/LjtTxsaCL1QsEVBCpOmv54DLJ+/wmf2oHH7RnKzCInoK/XeX0ngsMEN6lQstrQCRPcr4n6feuy/3UK7JIgnJ97bNz6qh9r7s8D6flLhJUCLXDZObxKQzuVHMboTgnChd4mFuDxfQ75JaqLmepN8csd8OSdhyg4Rul0c9AuFRn9QsGAKFW6XDn2Yc9Ow== 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=J+ev+u+Ek5rAxJqYhx1LCtzTUiBI+7ZIchVVzNBw15E=; b=y9J+4FTkk4fGtB26vKN57hHbMIwouAMBaUlMLcE7irMHEnVZDEVK2AolmSNT2CpLYkzkPyXmkwvliVZJ7NxKOBBBjrAO4svGebyQiRIMZP15pxRtW+eG0XG4KYxYUoZtdfUAUHk11hfV7y2mpIV+BHEEPcNgIQICYNCdp7SxZ2g= 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:54 +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:54 +0000 From: Anup Patel To: Atish Patra , Alistair Francis Cc: Anup Patel , opensbi@lists.infradead.org, Anup Patel Subject: [PATCH 4/6] lib: utils/ipi: Add FDT based ACLINT MSWI IPI driver Date: Sat, 12 Jun 2021 21:33:19 +0530 Message-Id: <20210612160321.330638-5-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:51 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7ff3dcd7-9576-4ab2-b89e-08d92dbbad44 X-MS-TrafficTypeDiagnostic: CO6PR04MB7795: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: WDCIPOUTBOUND: EOP-TRUE X-MS-Oob-TLC-OOBClassifiers: OLM:1303; X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: HatBaokP/iJh6mcQ59i/nm/OmAUntxeFFvOBI+dSHswdsiLx54W+a+QYQ4MxNyJuChEZ0j0k/vnhrqF5mXLo8bLclP92NJq9qQbxpD2fRUdmZWRU2UmnjNvLiVtcJFCYvwH8jW7psW4fLzjsgpox/JvVFI8abO0l9CFuc+dJmS1CfBKvC94fm97R5eTiZsXsgUmnLUhk6C5YQ9Jt5obX6dGhKn0yHOWDEPGa1i9l8a5qikT6nuR850pkwUwnq7A9CcM8xj+3nmRdHjDo0s9cn602S4vhnPjYo5VgAeFXZ1KVSV/beFmH9Ekw2aY0084QREaaLL7JwvhizBsQf2wBuYoEKQV0TdatiAVWy2Jr4ljaJ1Fl1iql53k61MrWjF9DbzhH0CfPrAVusvVijNXNcDc0Dr5siLv90wR6XU1wmuqh8Lj7hsdEkk9NnmDrOQCFXKzJ1irQ+tnL2VdVwVjXf8x5Bvv6vDtuzO/3z6ACWp1E0dW5zcmt82vyDRPq0s3NsshvHU9PLXKmLLLFY03LL81oGe4uC3YsMRCs09QEvhIVjWmdal3SMqXVGOu4O8ffXz5IGRFrV8DGD73gHcph4Q5e8eh5xlWnxKCEOg/N/58XgCi4ZsZhnBP0sZPRUnsrvmZSt5Zt6o3bX1k6igUO1LhPbsdztHFX7BRLBvW11Eg= 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: 2SAuf44a2nfl9rY92mqlh/RBsVgd5EQMozsv22n9QDMLL9hRSND9PLoj9Xcyyl4ZVLIU9zeEq49kgtAbnoHmkchRkuHisUD+Z9/ROTnDW5rVorXubqNNIlMMmTyS4VzhIO99Jv1lBw/t4TMiHOdPO0QJKzrU6h4f4JfKnPuUv0UYL6dE2m+ova8BX16D6RUtt8EXB0W9swVTqAr/o75ym4JZq0LjhAMNJHlJEAPgMSoAmwDQ1/Qvm3yxoOqLl7QZ36sX9Z7qdwOa41kLJE+NiGdc9uAJAJohx71GexE4/4FEGT6rf8jt35bcaFl/MbPzWQ8bnyYSVzs+7tltabzELWBqw9XutXOHD2Sx0eYFyS+7CGYI9JwQyrT7kRSXSyFWGfUV7YINAFG/Oon0NeL8LBcumQh7mD0g9pCD6Udoj6dqRQWAt/JnRr8yxzQ0xz/u0nO3ewFkrhXfRuh9z6CoZIAg199HBTqLxHwzbBhlwld9sHSO4Zb0KevTNu3pI2Piaaqfak9DYG/Cm4REHkErzv80s0ukY4X67JhHhJmVgFDsegDUT2VK9gch5qES26ytIOwUyLSOxwqgbEyObmL3FbA2YUnvgXlVuiFSf9OeTE2r27fGBatgGlnQHYzL54GaEvyZInljIJnjeqSE2SJjVWGWjdy8IGZfDdnU4LIE0eDbEHw/k/s7fmnw55+wx4C1s8qqGWrKvuU6I9O9KMu6hzn22GhoGNppeZyjm/S7S0pIv71OzkBhtmevIvhZTfQSUytRyf2M7jimrIwS2QkswZwQ7jZ8qKGfxhwbDYeMnjQt+FLMWle3LRcq2QGeflbX+EbLVv4XSccjQoynJeCpCetnIcuSz4MQnidiPglO5gKUfTTjw3aq7ZTw+OaFsozoJaK7aMPE2U/UMsDmW4bS/tv2Hk7W6z24u/x7v7aZ1CSPK03beoh5dnBjgT5uOjMIRQHS6rh6x6PQ07eloUvIjJqp+0WE4f5Peuh5HjP+HjolZKuhz4Acxjta0g5RWSwTdvlTyS6hPh5nI8+SJkGmFPbnrVGLD7yBXpaiYqhgSG9glk1eIqmIzIKLTmiD/qH5JMgqvc2I0BDMcTTsRMWYTxNivAUVU5jsTdAL0KTxFz+MKIsHc0GvO45xHDdtSkSpL0gerABTDTSJ6fGjmExKYiL/PdV36n4tQwdzHBgOVfhjsOeI4A2IRvkwUfVwgebXRz4XWIGY48iJiEyW7u+PFS6n9KAm/TUCSurQd+t1deCxw7iFY1YnZI3ce6cSKkAOwfOWf1OFgX0CC6d+rzq9DYW1It4UAg+8FHBdUzXsb+rwTelF+bMaRP+xUWWY6oX7 X-OriginatorOrg: wdc.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7ff3dcd7-9576-4ab2-b89e-08d92dbbad44 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:54.2346 (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: oQzYcwHH+1/M5Q0zVSpHpNh/En/NH+RPTOpaDfqk6w/vwLybVE/ArEc1pu6pyyXWt9PHqZjQGapOKwrwTd4gxw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CO6PR04MB7795 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210612_090357_278063_DCCE8857 X-CRM114-Status: GOOD ( 20.75 ) 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 a new FDT based ACLINT MSWI IPI driver which works for both CLINT device and standalone ACLINT MSWI device. Signed-off-by: Anup Patel --- lib/utils/ipi/fdt_ipi.c | 4 +-- lib/utils/ipi/fdt_ipi_clint.c | 51 lib/utils/ipi/fdt_ipi_mswi.c | 67 +++++++++++++++++++++ [...] 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 a new FDT based ACLINT MSWI IPI driver which works for both CLINT device and standalone ACLINT MSWI device. Signed-off-by: Anup Patel Reviewed-by: Bin Meng Reviewed-by: Xiang W --- lib/utils/ipi/fdt_ipi.c | 4 +-- lib/utils/ipi/fdt_ipi_clint.c | 51 -------------------------- lib/utils/ipi/fdt_ipi_mswi.c | 67 +++++++++++++++++++++++++++++++++++ lib/utils/ipi/objects.mk | 2 +- 4 files changed, 70 insertions(+), 54 deletions(-) delete mode 100644 lib/utils/ipi/fdt_ipi_clint.c create mode 100644 lib/utils/ipi/fdt_ipi_mswi.c diff --git a/lib/utils/ipi/fdt_ipi.c b/lib/utils/ipi/fdt_ipi.c index 3932f50..ed56e49 100644 --- a/lib/utils/ipi/fdt_ipi.c +++ b/lib/utils/ipi/fdt_ipi.c @@ -12,10 +12,10 @@ #include #include -extern struct fdt_ipi fdt_ipi_clint; +extern struct fdt_ipi fdt_ipi_mswi; static struct fdt_ipi *ipi_drivers[] = { - &fdt_ipi_clint + &fdt_ipi_mswi }; static struct fdt_ipi dummy = { diff --git a/lib/utils/ipi/fdt_ipi_clint.c b/lib/utils/ipi/fdt_ipi_clint.c deleted file mode 100644 index c97d3a9..0000000 --- a/lib/utils/ipi/fdt_ipi_clint.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Western Digital Corporation or its affiliates. - * - * Authors: - * Anup Patel - */ - -#include -#include -#include -#include - -#define CLINT_IPI_MAX_NR 16 - -static unsigned long clint_ipi_count = 0; -static struct clint_data clint_ipi[CLINT_IPI_MAX_NR]; - -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_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); -} - -static const struct fdt_match ipi_clint_match[] = { - { .compatible = "riscv,clint0" }, - { .compatible = "sifive,clint0" }, - { }, -}; - -struct fdt_ipi fdt_ipi_clint = { - .match_table = ipi_clint_match, - .cold_init = ipi_clint_cold_init, - .warm_init = clint_warm_ipi_init, - .exit = NULL, -}; diff --git a/lib/utils/ipi/fdt_ipi_mswi.c b/lib/utils/ipi/fdt_ipi_mswi.c new file mode 100644 index 0000000..306a25b --- /dev/null +++ b/lib/utils/ipi/fdt_ipi_mswi.c @@ -0,0 +1,67 @@ +/* + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2021 Western Digital Corporation or its affiliates. + * + * Authors: + * Anup Patel + */ + +#include +#include +#include +#include + +#define MSWI_MAX_NR 16 + +static unsigned long mswi_count = 0; +static struct aclint_mswi_data mswi[MSWI_MAX_NR]; + +static int ipi_mswi_cold_init(void *fdt, int nodeoff, + const struct fdt_match *match) +{ + int rc; + unsigned long offset; + struct aclint_mswi_data *ms; + + if (MSWI_MAX_NR <= mswi_count) + return SBI_ENOSPC; + ms = &mswi[mswi_count]; + + rc = fdt_parse_aclint_node(fdt, nodeoff, FALSE, &ms->addr, &ms->size, + &ms->first_hartid, &ms->hart_count); + if (rc) + return rc; + + if (match->data) { + /* Adjust MSWI address and size for CLINT device */ + offset = *((unsigned long *)match->data); + ms->addr += offset; + if ((ms->size - offset) < ACLINT_MSWI_SIZE) + return SBI_EINVAL; + ms->size = ACLINT_MSWI_SIZE; + } + + rc = aclint_mswi_cold_init(ms); + if (rc) + return rc; + + mswi_count++; + return 0; +} + +static unsigned long clint_offset = CLINT_MSWI_OFFSET; + +static const struct fdt_match ipi_mswi_match[] = { + { .compatible = "riscv,clint0", .data = &clint_offset }, + { .compatible = "sifive,clint0", .data = &clint_offset }, + { .compatible = "riscv,aclint-mswi" }, + { }, +}; + +struct fdt_ipi fdt_ipi_mswi = { + .match_table = ipi_mswi_match, + .cold_init = ipi_mswi_cold_init, + .warm_init = aclint_mswi_warm_init, + .exit = NULL, +}; diff --git a/lib/utils/ipi/objects.mk b/lib/utils/ipi/objects.mk index cc77808..effbedd 100644 --- a/lib/utils/ipi/objects.mk +++ b/lib/utils/ipi/objects.mk @@ -8,5 +8,5 @@ # libsbiutils-objs-y += ipi/fdt_ipi.o -libsbiutils-objs-y += ipi/fdt_ipi_clint.o +libsbiutils-objs-y += ipi/fdt_ipi_mswi.o libsbiutils-objs-y += ipi/aclint_mswi.o