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.web08.7307.1634634510127855160 for ; Tue, 19 Oct 2021 02:08:36 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=ED7hbHx+; 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 (m0134421.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19J81rT1029136; Tue, 19 Oct 2021 09:08:30 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=vOsObBE17rd0Yqnx7t5xtN2laP+d871dDLhRHdJrN8I=; b=ED7hbHx+/gj6uZLaRwuQAtqVo8C2mAm98TEJGIzuXqiQ4az/mNhqQBln7nNCRvKIsyPV bqk+d7MJHIx2udTc5s3oaaJpWQd2GX75wOpNkZkS3yCWDAgZ/lSk+errRckXo4H/7Rep QSjI3k7Fqjfs8BuVfYe6dcssL5R2kBd+8YZtZJRHG6GZHmJzrEC4yAro7JadHbrJVnHm y12f6amvBPP561Lj8lOHE85a4J3I0GZJEkYSKoBGm4Yj6iQAHEdEDTA5TmbuVWkjqsNq SPE6JMqaGX5PkcrBxZcatgzKVAQWSFxGG4P26A8LgEf06grAKkAPDYxJwNYfgLKp8xuc qQ== Received: from g4t3427.houston.hpe.com (g4t3427.houston.hpe.com [15.241.140.73]) by mx0b-002e3701.pphosted.com with ESMTP id 3bsd6x5gs5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 19 Oct 2021 09:08:29 +0000 Received: from g9t2301.houston.hpecorp.net (g9t2301.houston.hpecorp.net [16.220.97.129]) by g4t3427.houston.hpe.com (Postfix) with ESMTP id F217C6A; Tue, 19 Oct 2021 09:08:28 +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 E4F4C4E; Tue, 19 Oct 2021 09:08:27 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: abner.chang@hpe.com, Sunil V L , Daniel Schaefer Subject: [edk2-platforms][PATCH 12/30] Platform/RISC-V: Remove platform dependency from this library Date: Tue, 19 Oct 2021 16:09:49 +0800 Message-Id: <20211019081007.31165-13-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-GUID: EmXl6wY_4M0Ra8ottq0l-xgnv9veBsXo X-Proofpoint-ORIG-GUID: EmXl6wY_4M0Ra8ottq0l-xgnv9veBsXo 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=999 malwarescore=0 priorityscore=1501 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2109230001 definitions=main-2110190056 Content-Transfer-Encoding: quoted-printable This is the generic library for all RISC-V platforms. Remove the dependencies of SiFive U540 platform. Cc: Sunil V L Cc: Daniel Schaefer Signed-off-by: Abner Chang --- .../OpensbiPlatformLib/OpensbiPlatformLib.inf | 3 +- .../OpensbiPlatformLib/PlatformOverride.h | 30 ------------ .../Library/OpensbiPlatformLib/Platform.c | 25 +++++++--- .../Library/OpensbiPlatformLib/SifiveFu540.c | 47 ------------------- 4 files changed, 19 insertions(+), 86 deletions(-) delete mode 100644 Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/= PlatformOverride.h delete mode 100644 Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/= SifiveFu540.c diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Opensbi= PlatformLib.inf b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Op= ensbiPlatformLib.inf index a408737961..909fbffa8d 100644 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatfor= mLib.inf +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatfor= mLib.inf @@ -25,8 +25,6 @@ =0D [Sources]=0D Platform.c=0D - SifiveFu540.c=0D - PlatformOverride.h=0D =0D [Packages]=0D EmbeddedPkg/EmbeddedPkg.dec=0D @@ -45,6 +43,7 @@ PcdLib=0D PrintLib=0D RiscVCpuLib=0D + RiscVSpecialPlatformLib=0D =0D [FixedPcd]=0D gUefiRiscVPlatformPkgTokenSpaceGuid.PcdBootHartId=0D diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platfor= mOverride.h b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platfo= rmOverride.h deleted file mode 100644 index 467ebbd4b8..0000000000 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/PlatformOverri= de.h +++ /dev/null @@ -1,30 +0,0 @@ -/* - * SPDX-License-Identifier: BSD-2-Clause - * - * Copyright (c) 2020 Western Digital Corporation or its affiliates. - * - * Authors: - * Anup Patel - */ - -#ifndef __PLATFORM_OVERRIDE_H__ -#define __PLATFORM_OVERRIDE_H__ - -#include - -struct platform_override { - const struct fdt_match *match_table; - u64 (*features)(const struct fdt_match *match); - u64 (*tlbr_flush_limit)(const struct fdt_match *match); - int (*early_init)(bool cold_boot, const struct fdt_match *match); - int (*final_init)(bool cold_boot, const struct fdt_match *match); - void (*early_exit)(const struct fdt_match *match); - void (*final_exit)(const struct fdt_match *match); - int (*system_reset_check)(u32 reset_type, u32 reset_reason, - const struct fdt_match *match); - void (*system_reset)(u32 reset_type, u32 reset_reason, - const struct fdt_match *match); - int (*fdt_fixup)(void *fdt, const struct fdt_match *match); -}; - -#endif diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platfor= m.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c index 4fbb201895..06cd1a299f 100644 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c +++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Platform.c @@ -5,10 +5,16 @@ *=0D * Authors:=0D * Anup Patel =0D +=0D + Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right= s reserved.
=0D +=0D + SPDX-License-Identifier: BSD-2-Clause-Patent=0D +=0D */=0D =0D #include =0D -#include =0D +#include =0D +=0D #include =0D #include =0D #include =0D @@ -24,11 +30,12 @@ #include =0D #include =0D =0D -extern const struct platform_override sifive_fu540;=0D -=0D -static const struct platform_override *special_platforms[] =3D {=0D - &sifive_fu540,=0D -};=0D +//=0D +// SpecialPlatformArray and NumberOfSpecialPlatform are=0D +// provided by RiscVSpecialPlatformLib library.=0D +//=0D +extern const struct platform_override *special_platforms[];=0D +extern INTN NumberOfPlaformsInArray;=0D =0D static const struct platform_override *generic_plat =3D NULL;=0D static const struct fdt_match *generic_plat_match =3D NULL;=0D @@ -39,7 +46,11 @@ static void fw_platform_lookup_special(void *fdt, int ro= ot_offset) const struct platform_override *plat;=0D const struct fdt_match *match;=0D =0D - for (pos =3D 0; pos < array_size(special_platforms); pos++) {=0D + if (special_platforms =3D=3D NULL || NumberOfPlaformsInArray =3D=3D 0)= {=0D + return;=0D + }=0D +=0D + for (pos =3D 0; pos < (int)NumberOfPlaformsInArray; pos++) {=0D plat =3D special_platforms[pos];=0D if (!plat->match_table)=0D continue;=0D diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveF= u540.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu540= .c deleted file mode 100644 index 748b058840..0000000000 --- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/SifiveFu540.c +++ /dev/null @@ -1,47 +0,0 @@ -/*=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 -=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 --=20 2.31.1