From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web08.10716.1633521594771570306 for ; Wed, 06 Oct 2021 04:59:57 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=HUVHpC1E; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=0913d10296=daniel.schaefer@hpe.com) Received: from pps.filterd (m0134424.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 196BAEeh032409; Wed, 6 Oct 2021 11:59:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : content-transfer-encoding : content-type : mime-version; s=pps0720; bh=ainYZDDsfm7sLGO/oT+wCE3zk5Hk+dKwp+aoPR/xlZo=; b=HUVHpC1ESZBHhDUc2YBtSOdcsuOtxZuukzbvdSnahcbs1EL5n86OKQ9jrP2bM5Lzag3u LnLVQZUJk6qK4g2l0z6LFWn3AzAB0LkSKRsYDzrjsm+Z22FGtVCHDG5LMksptYFqceLv 84lS2sFZaraxPnmTie/vpOQqN8ZNBRE4r95zcpK9auyo6QgtZ+R06QhkGHayZ50xb8EE zrNg1oTYYw8jhwsIX3LDAYZ6TzkreIOTugTZpISM2JV1Z3FV+84SCgAgQYUejccnyZzv ywR7yplh5vtMGJzjtglqfk8r1Jv/SvCxhaduBkwbXSM65cpoBqxJK8DTxIupcGS7kXfQ 6A== Received: from g2t2352.austin.hpe.com (g2t2352.austin.hpe.com [15.233.44.25]) by mx0b-002e3701.pphosted.com with ESMTP id 3bh5k1b6w1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 06 Oct 2021 11:59:53 +0000 Received: from G1W8106.americas.hpqcorp.net (g1w8106.austin.hp.com [16.193.72.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2352.austin.hpe.com (Postfix) with ESMTPS id 0F736A7; Wed, 6 Oct 2021 11:59:53 +0000 (UTC) Received: from G9W8675.americas.hpqcorp.net (16.220.49.22) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 6 Oct 2021 11:59:52 +0000 Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W8675.americas.hpqcorp.net (16.220.49.22) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 6 Oct 2021 11:59:31 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (15.241.52.11) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Wed, 6 Oct 2021 11:59:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MS38Ik4k97vYy6biBtvb0ct3HhAaDLqD2KlA11mQW/V3YKnRHcduc2DFhfwOSuCIcEKVdjl0fLL/kLnv5E+pMa0YalLhj5HWQCX3f2XOwzDROh/K7TFGM85Cv3sYO1UUWPl+r8zTX5ZoLyFivHJaGzaGPcSOQcVOhegSQ9DkDNvEvcQrRnmGTQpbHeT7rgY1QlBhtgKRTmCdSgcHnzZaWZJ/22JvCYL9lR/TxTEkKFGbRXR87B11lB0CrBTevZDCk7L2mV0JG2u1TrJmNdForYQT+f3XsMssD8s4h7BYy4Ja0g9pfp+yMGjNic/fhuq/61H/WRt83KB6mJO5+cc34w== 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-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ainYZDDsfm7sLGO/oT+wCE3zk5Hk+dKwp+aoPR/xlZo=; b=DlR2VPxd0hKy9U5JltvdR+kbcHi06feh2/6Hmxh/CmcgOU/eRKX3jcLAmsMXY963UYfYiwVyehBrmArdL0inKSzbxWBX5sVarM08dQgra/eh3/cSj0JVYhTKt7YVsNpws1muSJps4uabQswdjUzBeXxfqrS5Xja0MLXFq1Kr35hCrF0lDTfViCr0HIj2YinloMKOKqk3V9/ba2E7/ahOVzulxMcZdvTLSkqXXPTfcqHb/Iv8T0lfFaDMkfwl/n335p+T9tDqZMsRADKZnaed3I95WLKbwe2KaOyO3K+q7R8an0gqh4XdXM3hE4tubYoB5rzeHoQocv7DRBcNIQVGwQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Authentication-Results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) by DF4PR8401MB1034.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7613::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Wed, 6 Oct 2021 11:59:30 +0000 Received: from DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM ([fe80::597f:4786:f1d6:8469]) by DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM ([fe80::597f:4786:f1d6:8469%3]) with mapi id 15.20.4566.023; Wed, 6 Oct 2021 11:59:30 +0000 From: "Daniel Schaefer" To: CC: Abner Chang , Sunil V L Subject: [edk2-platforms][PATCH v2 14/14] Move OpenSbiPlatformLib to RISC-V/PlatformPkg Date: Wed, 6 Oct 2021 19:58:36 +0800 Message-ID: <20211006115836.3641776-7-daniel.schaefer@hpe.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211006115836.3641776-1-daniel.schaefer@hpe.com> References: <20211006115836.3641776-1-daniel.schaefer@hpe.com> X-ClientProxiedBy: HK2PR02CA0159.apcprd02.prod.outlook.com (2603:1096:201:1f::19) To DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) MIME-Version: 1.0 Received: from localhost.localdomain (123.193.59.220) by HK2PR02CA0159.apcprd02.prod.outlook.com (2603:1096:201:1f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Wed, 6 Oct 2021 11:59:28 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 208bb0f5-3e9b-4f75-f29f-08d988c0c0ca X-MS-TrafficTypeDiagnostic: DF4PR8401MB1034: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6430; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: qneySDDUCauWIYfRHkxigXzLYJ7LETWdQumcAeob9N1oFEDB4LX4cu8Ih1vfVpwUGlG7EBdRmqy0nX/LS9LF42VLohQ23viSWhZq2vOinQzgUroWX15yoZlC36K7YcqJGCptGraqBsbfgcxQ+2CZUWSA6CxWHDbkpyADXYOKADs1uHDWccuTZ+OM5fqaHcVBFQU4Kwl1kIF1zoA2dVXy8STelmz3rN45OrklkZ6H2bkbsYocz5AD1XYTHo9uGLWVnZ2Y1bmwBn2E9uoBKTNQZil0u++E9iQM/F/eQ+kufsyT9rAnk/swYeQe/xP5FYc/nOyCOkBzvyNSj4CuonXYJhHw9XL6Tyy0w2whiK0tiGaNdZxxe+MIHdDP/n3I9ZRaXQrTXS+w5ciZAnRN3itYpes77XTcMTSmUjdHw9pnbDBDI1AcjsZnv9gRsXokaekI+QFnuickiQXD9C/N1I3EfPhBRkK+D+5/c7dTnqeSjQr0i0JcGxWFXWNpkvrBRl+YsW0PBLeef8aDaRi9wXVA8J01DzJczjZ4bXXpRODFJtHlCbTzmqiAs4LUjB5SkouD4Ciw0chq4h8dW/1zvo0LcnyAO+APu6rWEsNAC0UA1pQ5z5SSNKraIBl+oY4AkMq7fzWkmPlFX7poLHH4UnPO0GLblfXCt+Fap4csir/oFMMhHCup+mKAe298MpK/oLpa5swCpO/lAb/CN8spU5/thA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(186003)(6506007)(956004)(316002)(26005)(52116002)(6916009)(8676002)(8936002)(5660300002)(6486002)(508600001)(83380400001)(6666004)(66556008)(66476007)(38350700002)(6512007)(38100700002)(86362001)(36756003)(4326008)(2906002)(54906003)(2616005)(1076003)(66946007)(44832011);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?bLVBwcDu17W+621Wxf7B1c0FlAlkh7hythOaMHiTqbLlH0JPLC+M3IV2qxV3?= =?us-ascii?Q?5IemykW+F/IE99yHIK1wh051f1ScMW2NyoTQKPc/JtkW/YIYjzXcBdDsJuCY?= =?us-ascii?Q?Vnz5gR+Ifvh+xKCsc7J6BkUwh2FNKXVzdZSSUJU+KHTPgh3ZuONktpHyOaAQ?= =?us-ascii?Q?E5/K52WNdAS6ibXpWSKQ9F5qSZX1BCt5bIn4V1cxyg36BQHK9TElb/w36MMD?= =?us-ascii?Q?EMUzTCE0BfY/vgaPIbT+PAWgcAnOI+nTLyLf5lFCUtCglTfxtpgiu1FYgIEN?= =?us-ascii?Q?VsbnVVEVQMWIxAF6chwUba/sPCP63DIUYumgevLnG3O9RTVjFXlPDuv69d9a?= =?us-ascii?Q?c8O/d4bTG4Ei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c?= =?us-ascii?Q?ttOgIZ6k9ElwgJpPJjds4DaAQluskD6xmxO1YrzKgxTes/5eyqNDM/3FWNp6?= =?us-ascii?Q?bTcx9ILXS92etiZzyYRE/hk5?= X-MS-Exchange-CrossTenant-Network-Message-Id: 208bb0f5-3e9b-4f75-f29f-08d988c0c0ca X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 06 Oct 2021 11:59:30.0941 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: dKAUcepHEbtlFTtwgEJfGJ1YlEqpNH2nKoMHHLoOWYbHGLFmCQs6HXIwHkL74139yQa8TY0/orMILWUjnb755A== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB1034 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: I01FwK5un4YHq85pGga_P5_UfYV0vFPL X-Proofpoint-ORIG-GUID: I01FwK5un4YHq85pGga_P5_UfYV0vFPL X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.391,FMLib:17.0.607.475 definitions=2021-10-06_02,2021-10-06_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 adultscore=0 mlxscore=0 suspectscore=0 priorityscore=1501 malwarescore=0 lowpriorityscore=0 mlxlogscore=995 clxscore=1015 phishscore=0 impostorscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110060075 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain It's a generic platform file. Only the device tree decides what happens. Cc: Daniel Schaefer Cc: Abner Chang Cc: Sunil V L Signed-off-by: Daniel Schaefer --- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf | 0 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/Platform.c | 13 ++++++++= ++++- Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/PlatformOverride.h | 0 Platform/{SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard =3D> RISC-V/P= latformPkg}/Library/OpensbiPlatformLib/SifiveFu540.c | 0 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc = | 2 +- 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/OpensbiPlatformLib.inf b/Platform/RISC-V/PlatformP= kg/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/OpensbiPlatformLib.inf rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPla= tformLib.inf diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/Platform.c b/Platform/RISC-V/PlatformPkg/Library/O= pensbiPlatformLib/Platform.c similarity index 87% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/Platform.c rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c index 2f51e45d58..db0c19915f 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/O= pensbiPlatformLib/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c @@ -201,13 +201,24 @@ const struct sbi_platform_operations platform_ops =3D= { .timer_exit =3D fdt_timer_exit,=0D };=0D =0D +#if FixedPcdGet32(PcdBootableHartNumber) =3D=3D 4=0D +#define U540_BOOTABLE_HART_COUNT FixedPcdGet32(PcdBootableHartNumber)=0D +static u32 U540_hart_index2id[U540_BOOTABLE_HART_COUNT] =3D {1, 2, 3, 4};= =0D +#endif=0D +=0D struct sbi_platform platform =3D {=0D .opensbi_version =3D OPENSBI_VERSION,=0D .platform_version =3D SBI_PLATFORM_VERSION(0x0, 0x01),=0D .name =3D "Generic",=0D .features =3D SBI_PLATFORM_DEFAULT_FEATURES,=0D .hart_count =3D SBI_HARTMASK_MAX_BITS,=0D +// TODO: Workaround for U540. Not sure why we need this. OpenSBI doesn't n= eed it.=0D +#if FixedPcdGet32(PcdBootableHartNumber) =3D=3D 4=0D + .hart_index2id =3D U540_hart_index2id,=0D +#else=0D .hart_index2id =3D generic_hart_index2id,=0D - .hart_stack_size =3D SBI_PLATFORM_DEFAULT_HART_STACK_SIZE,=0D +#endif=0D + // TODO: Any reason why it shouldn't just be SBI_PLATFORM_DEFAULT_HART_ST= ACK_SIZE?=0D + .hart_stack_size =3D FixedPcdGet32(PcdOpenSbiStackSize),=0D .platform_ops_addr =3D (unsigned long)&platform_ops=0D };=0D diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/PlatformOverride.h b/Platform/RISC-V/PlatformPkg/L= ibrary/OpensbiPlatformLib/PlatformOverride.h similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/PlatformOverride.h rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/PlatformOv= erride.h diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/OpensbiPlatformLib/SifiveFu540.c b/Platform/RISC-V/PlatformPkg/Librar= y/OpensbiPlatformLib/SifiveFu540.c similarity index 100% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/SifiveFu540.c rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu54= 0.c diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 18a482aba6..5d2ccafaca 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -173,7 +173,7 @@ #=0D # OpenSBi Platform Library=0D #=0D - RiscVOpensbiPlatformLib|Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnl= eashedBoard/Library/OpensbiPlatformLib/OpensbiPlatformLib.inf=0D + RiscVOpensbiPlatformLib|Platform/RISC-V/PlatformPkg/Library/OpensbiPlatf= ormLib/OpensbiPlatformLib.inf=0D =0D [LibraryClasses.common.PEI_CORE]=0D HobLib|MdePkg/Library/PeiHobLib/PeiHobLib.inf=0D --=20 2.33.0