From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web11.5001.1634615452765701274 for ; Mon, 18 Oct 2021 20:50:52 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=TgMQJlGh; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=092675a635=daniel.schaefer@hpe.com) Received: from pps.filterd (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19ILhX5G013341; Tue, 19 Oct 2021 03:50:52 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=/lNQ2OF1XFr9BoW7DU60Rbs6I/CQ2Q8A/y+kvae00v4=; b=TgMQJlGhB8cT//PR9FTh7tsM24PPXXP/V+E7niHPYfQ/PdYOuGVZQ6yunjbo0d3Qn3qn yVTpadpa45RMXfhVckwljtOvBi2zurISbds3khRLyxtnBR7tv5E+hWgeElj1qqEdHLzR b1BqgX8PyNXH5KZSq7XSLGGaIfzSOb/FnGnCMYe3m2vIRkMgkBts7KjThLOfHS5df1uc v68dzp1+h82uP093PlpgHd3D5yGAYoptJWhyIABmq+8QbkZ9s5pza7zNWS4Rj3Gx7Laj /FnJW+bNPWH62jXk7+lXNW+fry0QPiCqsbHTZrRwo+cWa6JjDBUcoukdW+gY3tKGB0b3 7Q== Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsd6x3c98-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 03:50:52 +0000 Received: from G9W8453.americas.hpqcorp.net (exchangepmrr1.us.hpecorp.net [16.216.160.211]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 8E31BC6; Tue, 19 Oct 2021 03:50:51 +0000 (UTC) Received: from G1W8108.americas.hpqcorp.net (2002:10c1:483c::10c1:483c) by G9W8453.americas.hpqcorp.net (2002:10d8:a0d3::10d8:a0d3) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Tue, 19 Oct 2021 03:50:51 +0000 Received: from NAM02-BN1-obe.outbound.protection.outlook.com (15.241.52.13) by G1W8108.americas.hpqcorp.net (16.193.72.60) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Tue, 19 Oct 2021 03:50:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=RR2fEo4YFcCEqDvUym2aTlcmLNaDcmsjzS1BtaHuj3C9qy65xj3Ff+z4ViMzBbG4wEaQI9pKOZA7AiN/huDQPmYYzyD6qTiXSxkD7slZrPxII4zYaUMAYMTSImPUYPC0oZf5qcEfTbgUaYWLt4kbWL00kYdwPxFddF8FjYCm+j0SzlnvQzdxbQiWkAQuR0i9z6rBJrXsLzb+MVUjlTcD1GxPbkMx2RMAobLlZWWw14X2kRvhjuE0xnkV7WhdzVN9c4Wb4u32n5V7PDlQQJCqjPeeFr3wnVtQ/Uqm77+r6RNPZQBVBRGouriiaWBj5lZPHmk43zqiAgdGU7OTA+kAbA== 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=/lNQ2OF1XFr9BoW7DU60Rbs6I/CQ2Q8A/y+kvae00v4=; b=Nk+d76jPP4na30fqyagYL0GKtM0yd3pn/wmFNba4l6i1FdPIGGLqba3Hv1mfyltVKJJLcmx0r0bL6+m/X53DHlyKfhKItmlpskCCimQi8NA0qoAIqlbdadvr7C0D7fRGTY88Ax5E6EdYH3xezdSm/0BejlKD+HExVTfjId7jsaFhgmjw5kE/wYkMOADn2Nj7iXmXSXMTneD+kuEVglfiD5jNPd0K2oRL7kwKAt9Hv0aN8AgtQtQe0RSAiQiH7BBvIdQKHV6yzl+a2OcDhykQVZzPxPkDhUK2dE/0iplw7k1s0UbJa5H05Vgur23+p/0lnA+N4KY6uB+yd4vbfSR71A== 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 DF4PR8401MB0921.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760c::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4608.17; Tue, 19 Oct 2021 03:50:50 +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.4608.018; Tue, 19 Oct 2021 03:50:50 +0000 From: "Daniel Schaefer" To: CC: Daniel Schaefer , Abner Chang , Sunil V L Subject: [edk2-platforms] [PATCH v3 14/14] Move OpenSbiPlatformLib to RISC-V/PlatformPkg Date: Tue, 19 Oct 2021 11:48:49 +0800 Message-ID: <20211019034849.16847-15-daniel.schaefer@hpe.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211019034849.16847-1-daniel.schaefer@hpe.com> References: <20211019034849.16847-1-daniel.schaefer@hpe.com> X-ClientProxiedBy: SG2PR03CA0134.apcprd03.prod.outlook.com (2603:1096:4:c8::7) To DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:760f::13) MIME-Version: 1.0 Received: from zbook-nix.wireless.hpe.com (15.211.146.34) by SG2PR03CA0134.apcprd03.prod.outlook.com (2603:1096:4:c8::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4628.11 via Frontend Transport; Tue, 19 Oct 2021 03:50:47 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77819aa9-5baf-425c-db85-08d992b3a401 X-MS-TrafficTypeDiagnostic: DF4PR8401MB0921: 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: lBmE3Lg2jFhH1Iq5nUFhxJryNgEltDCg7OTRYJIdN+iSKvBOw1URcXJ/dXn2RMWGok9eXw/BU28+5jwsbAuZV4oJWyqhEsETO/lQphcH6OkaXotWUF35zdilMyYSaxZrSPzxQXRaYeRT3SYP9llU+ClmwipTCzQMObq66/e5cjsI8U+yyQdsPRQrLkEO6ZLBpMvrEdIra5O2dEqtqObv0qMNDexSG+TlBlb7AbRliIz4LurrufPW4CrdbGmCZpDtpIY1hVDBsX2YPiV//D3xTpd7gjpinYinuTolx2P8gQXJlEp40QnhJEE7iWOjyZOKXKQxtl/k0975vg22Q/WxBTly4Tn+BfF9xWGSk0WfpWx5k8I1jeE2SEzbC9pgWCAOqFpXugKKjKWt2pXNUbuWstVW7pIA8Ts8I66iXRgL+ddkIilL8+Px0ZTlrHDykSqJPMeWPANK00Vi5U2Wc9+hZDZahG/ltv7RRwhl82kAYn3Fu5ihzcZX6l9ppz707bjokXh8oeV0ikxJ+HUWRbp1x9DenCYMV3M+AaUvZ70835CrmsOysYDcRtwo3S41KPdulSHoymgodmQN+X10DeVDmxgdgdethAbfWR1/StZGryRC2M9U8lHh6PrNoMv34iIvRVIeV2IxuBLyxfPXxacONc72XdrO5/yEEo0m+RPqCBhrHLe4695cUCEcVIz/B8P0+7PfGyNLHec1GZhRmxJitA== 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)(6916009)(956004)(8676002)(54906003)(26005)(66946007)(186003)(66556008)(2616005)(4326008)(5660300002)(7696005)(316002)(83380400001)(36756003)(8936002)(6486002)(508600001)(66476007)(86362001)(52116002)(44832011)(82960400001)(2906002)(1076003)(38350700002)(38100700002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?ACWRTXdUwdNRUwvNeDfcFmgH3GwUAZMIPOOFNu8HcqwXFYV5NR3dLghRM2r7?= =?us-ascii?Q?xG3wRvHeaehkPmjghk3etNBuIldIcMvly2t764q9XbwLNNfDFzLz+nIeib0O?= =?us-ascii?Q?2RFTOc2gfLVYXfsRC9aPxSTH2h8mZ0cfKIatUnpZPyJnKvQYO7aILAQJ0cRA?= =?us-ascii?Q?/8+uvpnEU7KPmmanq0VYW2qRPsdE0Bebj02hFpFrsvwIN2iH6BKXX1L6TYe8?= =?us-ascii?Q?RsT7T/vMVHQ4XKWYPXZu+S8xJNUMc/GijRqbE2V4mOyBbqq6a75UkHk9QFSZ?= =?us-ascii?Q?VoFEW/sTMRE8y9hpxJEFdzEoR+y25rEX2UZqObaaqa3JOIXE32SSFUuy+Ff3?= =?us-ascii?Q?2owkhU/ELDc5zdmf193miOSTT4PTHw6UoKCcJeXQiveOw1EiB3mqYOURFz3J?= =?us-ascii?Q?F55vPQ2nksPpNm/VWa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us-ascii?Q?S/uD7+kUrzV4zByv5+bAtMeN?= X-MS-Exchange-CrossTenant-Network-Message-Id: 77819aa9-5baf-425c-db85-08d992b3a401 X-MS-Exchange-CrossTenant-AuthSource: DF4PR8401MB0923.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 Oct 2021 03:50:49.9961 (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: iTafXe6Ryq3ZOfEu342l8rxZPewLGJ6IXXnYloobb3Xbo/xSkNtn+Oe7dIZyC5WDqe/Td29XA4UaK1gXH/nHuQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DF4PR8401MB0921 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: 5MqAWPOsHXWzB2ZxSiKPfJtPi5eyh8WY X-Proofpoint-ORIG-GUID: 5MqAWPOsHXWzB2ZxSiKPfJtPi5eyh8WY X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-18_07,2021-10-18_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 mlxscore=0 adultscore=0 spamscore=0 suspectscore=0 bulkscore=0 phishscore=0 clxscore=1015 mlxlogscore=930 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110190019 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 Reviewed-by: Abner Chang Signed-off-by: Daniel Schaefer --- Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc = | 2 +- 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/PlatformOverride.h | 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/SifiveFu540.c | 0 5 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index 18a482aba611..5d2ccafacaf3 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 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/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/Platform.c b/Platform/RISC-V/PlatformPkg/Library/O= pensbiPlatformLib/Platform.c similarity index 88% rename from Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Lib= rary/OpensbiPlatformLib/Platform.c rename to Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c index ac76f073ab53..c4cf6782bd1f 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_S= TACK_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/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 --=20 2.31.1