[edk2-platforms][PATCH 10/30] Platform/RISC-V: Add NULL library instance of RiscVSpecialPlatformLib


Abner Chang
 

This is the library instance to provide platform_override for the
special RISC-V platform. This module incorporates with
OpensbiPlatformLib and RISC-V Opensbi library.

Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>

Signed-off-by: Abner Chang <abner.chang@hpe.com>
---
.../RISC-V/ProcessorPkg/RiscVProcessorPkg.dec | 1 +
.../RISC-V/PlatformPkg/RiscVPlatformPkg.dsc | 2 ++
.../RiscVSpecialPlatformLib.inf | 36 +++++++++++++++++++
.../Include/Library/RiscVSpecialPlatformLib.h | 20 +++++++++++
.../RiscVSpecialPlatformLib.c | 19 ++++++++++
5 files changed, 78 insertions(+)
create mode 100644 Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatfor=
mLib/RiscVSpecialPlatformLib.inf
create mode 100644 Platform/RISC-V/PlatformPkg/Include/Library/RiscVSpecia=
lPlatformLib.h
create mode 100644 Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatfor=
mLib/RiscVSpecialPlatformLib.c

diff --git a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec b/Silicon/RI=
SC-V/ProcessorPkg/RiscVProcessorPkg.dec
index 08279a97b1..9c8b57cce3 100644
--- a/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec
+++ b/Silicon/RISC-V/ProcessorPkg/RiscVProcessorPkg.dec
@@ -19,6 +19,7 @@
Include/Library=0D
Library/RiscVOpensbiLib/opensbi # OpenSBI header file reference =
("include/sbi/...")=0D
Library/RiscVOpensbiLib/opensbi/include # Header file reference from ope=
nsbi files, ("sbi/...")=0D
+ Library/RiscVOpensbiLib/opensbi/platform/generic/include # Header file r=
eference from opensbi files, ("sbi/...")=0D
=0D
[LibraryClasses]=0D
RiscVPlatformDxeIplLib|Include/Library/RiscVPlatformDxeIpl.h=0D
diff --git a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc b/Platform/RI=
SC-V/PlatformPkg/RiscVPlatformPkg.dsc
index b96324e961..ec8875be14 100644
--- a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
+++ b/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
@@ -71,6 +71,7 @@
=0D
[LibraryClasses.common.SEC]=0D
ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseE=
xtractGuidedSectionLib.inf=0D
+ RiscVSpecialPlatformLib|Platform/RISC-V/PlatformPkg/Library/RiscVSpecial=
PlatformLib/RiscVSpecialPlatformLib.inf=0D
=0D
[LibraryClasses.common.DXE_DRIVER]=0D
PlatformBootManagerLib|Platform/RISC-V/PlatformPkg/Library/PlatformBootM=
anagerLib/PlatformBootManagerLib.inf=0D
@@ -84,6 +85,7 @@
Platform/RISC-V/PlatformPkg/Library/RiscVPlatformTempMemoryInitLibNull/R=
iscVPlatformTempMemoryInitLibNull.inf=0D
Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoint.=
inf=0D
Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull/PlatformSecPpi=
LibNull.inf=0D
+ Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLib/RiscVSpecial=
PlatformLib.inf=0D
=0D
[Components.common.SEC]=0D
Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLib/Ri=
scVSpecialPlatformLib.inf b/Platform/RISC-V/PlatformPkg/Library/RiscVSpecia=
lPlatformLib/RiscVSpecialPlatformLib.inf
new file mode 100644
index 0000000000..567eeee56d
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLib/RiscVSpec=
ialPlatformLib.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.<BR>=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 79361802-18B6-458A-8C79-DA6256DEF776=
=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
+ RiscVSpecialPlatformLib.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/RISC-V/PlatformPkg/Include/Library/RiscVSpecialPlatfo=
rmLib.h b/Platform/RISC-V/PlatformPkg/Include/Library/RiscVSpecialPlatformL=
ib.h
new file mode 100644
index 0000000000..644bb08ebf
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/RiscVSpecialPlatformLib.h
@@ -0,0 +1,20 @@
+/** @file=0D
+ library definition to provide platform_override of special platforms.=0D
+ This library incorporates with OpensbiPlatformLib and RISC-V Opensbi lib=
rary=0D
+=0D
+ Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right=
s reserved.<BR>=0D
+=0D
+ SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+**/=0D
+=0D
+#ifndef RISCV_SPECIAL_PLATFORM_LIB_=0D
+#define RISCV_SPECIAL_PLATFORM_LIB_=0D
+=0D
+#include <PiPei.h>=0D
+=0D
+//=0D
+// This is declared under Silicon/RISC-V/ProcessorPkg/Library/RiscVOpensbi=
Lib/opensbi/platform/generic/include/=0D
+//=0D
+#include <platform_override.h>=0D
+=0D
+#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLib/Ri=
scVSpecialPlatformLib.c b/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialP=
latformLib/RiscVSpecialPlatformLib.c
new file mode 100644
index 0000000000..3a77ff6b17
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLib/RiscVSpec=
ialPlatformLib.c
@@ -0,0 +1,19 @@
+/**@file=0D
+ Library to provide platform_override for the special=0D
+ 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 right=
s reserved.<BR>=0D
+=0D
+ SPDX-License-Identifier: BSD-2-Clause-Patent=0D
+=0D
+**/=0D
+=0D
+//=0D
+// The package level header files this module uses=0D
+//=0D
+#include <Library/RiscVSpecialPlatformLib.h>=0D
+=0D
+const struct platform_override *SpecialPlatformArray =3D NULL;=0D
+INTN NumberOfPlaformsInArray;=0D
+=0D
--=20
2.31.1