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.web10.7401.1634634508457345765 for ; Tue, 19 Oct 2021 02:08:40 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=Mrivp8hn; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=0926d272d9=abner.chang@hpe.com) Received: from pps.filterd (m0148663.ppops.net [127.0.0.1]) by mx0a-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J84Yq1030517; Tue, 19 Oct 2021 09:08:28 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 : mime-version : content-transfer-encoding; s=pps0720; bh=Wvv7eYN7TWcVivpriYdMp+jb3UBs14JL80fCBOBYYVo=; b=Mrivp8hnU5rhIDmc/nLB6msH0KtF0uFDbeADUZhOZWzF46+ZKDeZaEgWWyU+ZC6nUK/a 7arD3qArrW3Rh76F2Pb11dC+BreZU5VhJKIaYhhxXfKJbRzJtCBqwoT01OcqXiNzAtyQ DGeCrT/zQa4h3bOQdse++6g/Uss9a5qaXbj3Ng5Xrp1JWCo33OnWt6+p10i4zLqrA4sB yAWG0LP3sKHEPzXiZbgEbbuWNMP5c6qYpLa+X7lkwZ1wonkC1rkTnOjsaXEWezrJnJZq TGGthfRy3uVXipqptL4UKMljd55dfmTUrYjbA3QUXQFXGBxp9gURpqsD8lEeu4xMSgEY BA== Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0a-002e3701.pphosted.com with ESMTP id 3bst6drgpg-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 09:08:28 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id 933686A; Tue, 19 Oct 2021 09:08:27 +0000 (UTC) Received: from UB16Abner.asiapacific.hpqcorp.net (ub16abner.asiapacific.hpqcorp.net [15.119.209.229]) by g9t2301.houston.hpecorp.net (Postfix) with ESMTP id 8401B4F; Tue, 19 Oct 2021 09:08:26 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Sunil V L , Daniel Schaefer Subject: [edk2-platforms][PATCH 11/30] SiFive/U540: RiscVSpecialPlatformLib instance of U540 Date: Tue, 19 Oct 2021 16:09:48 +0800 Message-Id: <20211019081007.31165-12-abner.chang@hpe.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20211019081007.31165-1-abner.chang@hpe.com> References: <20211019081007.31165-1-abner.chang@hpe.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: pMkSp9cJsOcEN7BQFfrX4K7-myeObQ64 X-Proofpoint-GUID: pMkSp9cJsOcEN7BQFfrX4K7-myeObQ64 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 bulkscore=0 mlxlogscore=999 priorityscore=1501 adultscore=0 suspectscore=0 malwarescore=0 lowpriorityscore=0 spamscore=0 impostorscore=0 phishscore=0 clxscore=1015 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110190056 Content-Transfer-Encoding: quoted-printable Provide platform_override of U540 platform. Cc: Sunil V L Cc: Daniel Schaefer Signed-off-by: Abner Chang --- .../FreedomU540HiFiveUnleashedBoard/U540.dsc | 1 + .../RiscVSpecialPlatformLib.inf | 36 ++++++++++++ .../RiscVSpecialPlatformLib/SifiveFu540.c | 56 +++++++++++++++++++ 3 files changed, 93 insertions(+) create mode 100644 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedB= oard/Library/RiscVSpecialPlatformLib/RiscVSpecialPlatformLib.inf create mode 100644 Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedB= oard/Library/RiscVSpecialPlatformLib/SifiveFu540.c diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U5= 40.dsc b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.d= sc index d12af19825..71dbca0e96 100644 --- a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/U540.dsc @@ -163,6 +163,7 @@ =0D ReportStatusCodeLib|MdeModulePkg/Library/PeiReportStatusCodeLib/PeiRepor= tStatusCodeLib.inf=0D ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseE= xtractGuidedSectionLib.inf=0D + RiscVSpecialPlatformLib|Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnl= eashedBoard/Library/RiscVSpecialPlatformLib/RiscVSpecialPlatformLib.inf=0D =0D !ifdef $(SOURCE_DEBUG_ENABLE)=0D DebugAgentLib|SourceLevelDebugPkg/Library/DebugAgent/SecPeiDebugAgentLib= .inf=0D diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/RiscVSpecialPlatformLib/RiscVSpecialPlatformLib.inf b/Platform/SiFive= /U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/RiscVSpecialPlatformLi= b/RiscVSpecialPlatformLib.inf new file mode 100644 index 0000000000..26f475ca45 --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/R= iscVSpecialPlatformLib/RiscVSpecialPlatformLib.inf @@ -0,0 +1,36 @@ +## @file=0D +# Null library instance to provide platform_override for the=0D +# special RISC-V platform. This module incorporates with=0D +# OpensbiPlatformLib and RISC-V Opensbi library.=0D +#=0D +# Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
=0D +#=0D +# SPDX-License-Identifier: BSD-2-Clause-Patent=0D +#=0D +##=0D +=0D +[Defines]=0D + INF_VERSION =3D 0x0001001b=0D + BASE_NAME =3D RiscVSpecialPlatformLib=0D + FILE_GUID =3D FE0AE3E6-90A4-421D-851D-E092CBEEE645= =0D + MODULE_TYPE =3D BASE=0D + VERSION_STRING =3D 1.0=0D + LIBRARY_CLASS =3D RiscVSpecialPlatformLib|SEC=0D +=0D +#=0D +# The following information is for reference only and not required by the = build tools.=0D +#=0D +# VALID_ARCHITECTURES =3D RISCV64=0D +#=0D +=0D +[Sources]=0D + SifiveFu540.c=0D +=0D +[Packages]=0D + MdePkg/MdePkg.dec=0D + MdeModulePkg/MdeModulePkg.dec=0D + Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dec=0D + Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec=0D +=0D +[LibraryClasses]=0D + BaseLib=0D diff --git a/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Li= brary/RiscVSpecialPlatformLib/SifiveFu540.c b/Platform/SiFive/U5SeriesPkg/F= reedomU540HiFiveUnleashedBoard/Library/RiscVSpecialPlatformLib/SifiveFu540.c new file mode 100644 index 0000000000..e89403f7ff --- /dev/null +++ b/Platform/SiFive/U5SeriesPkg/FreedomU540HiFiveUnleashedBoard/Library/R= iscVSpecialPlatformLib/SifiveFu540.c @@ -0,0 +1,56 @@ +/*=0D + * SPDX-License-Identifier: BSD-2-Clause=0D + *=0D + * Copyright (c) 2020 Western Digital Corporation or its affiliates.=0D + *=0D + * Authors:=0D + * Anup Patel =0D +=0D + Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All righ= ts reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D + */=0D +=0D +#include =0D +#include =0D +#include =0D +=0D +static u64 sifive_fu540_tlbr_flush_limit(const struct fdt_match *match)=0D +{=0D + /*=0D + * The sfence.vma by virtual address does not work on=0D + * SiFive FU540 so we return remote TLB flush limit as zero.=0D + */=0D + return 0;=0D +}=0D +=0D +static int sifive_fu540_fdt_fixup(void *fdt, const struct fdt_match *match= )=0D +{=0D + /*=0D + * SiFive Freedom U540 has an erratum that prevents S-mode software=0D + * to access a PMP protected region using 1GB page table mapping, so=0D + * always add the no-map attribute on this platform.=0D + */=0D + fdt_reserved_memory_nomap_fixup(fdt);=0D +=0D + return 0;=0D +}=0D +=0D +static const struct fdt_match sifive_fu540_match[] =3D {=0D + { .compatible =3D "sifive,fu540" },=0D + { .compatible =3D "sifive,fu540g" },=0D + { .compatible =3D "sifive,fu540-c000" },=0D + { .compatible =3D "sifive,hifive-unleashed-a00" },=0D + { },=0D +};=0D +=0D +const struct platform_override sifive_fu540 =3D {=0D + .match_table =3D sifive_fu540_match,=0D + .tlbr_flush_limit =3D sifive_fu540_tlbr_flush_limit,=0D + .fdt_fixup =3D sifive_fu540_fdt_fixup,=0D +};=0D +=0D +const struct platform_override *special_platforms[] =3D {=0D + &sifive_fu540,=0D +};=0D +INTN NumberOfPlaformsInArray =3D array_size(special_platforms);=0D --=20 2.31.1