[edk2-platforms][PATCH 05/30] Platform/RISC-V: Add library to get PPI descriptor


Abner Chang
 

The library to provide the platform PPI descriptors in
PEI core entry before executing PEI core.

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/PlatformPkg/RiscVPlatformPkg.dsc | 2 ++
.../PlatformSecPpiLibNull.inf | 36 +++++++++++++++++++
.../Include/Library/PlatformSecPpiLib.h | 24 +++++++++++++
.../PlatformSecPpiLibNull/PlatformSecPpiLib.c | 28 +++++++++++++++
4 files changed, 90 insertions(+)
create mode 100644 Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNu=
ll/PlatformSecPpiLibNull.inf
create mode 100644 Platform/RISC-V/PlatformPkg/Include/Library/PlatformSec=
PpiLib.h
create mode 100644 Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNu=
ll/PlatformSecPpiLib.c

diff --git a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc b/Platform/RI=
SC-V/PlatformPkg/RiscVPlatformPkg.dsc
index 8eec09549f..b96324e961 100644
--- a/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
+++ b/Platform/RISC-V/PlatformPkg/RiscVPlatformPkg.dsc
@@ -61,6 +61,7 @@
[LibraryClasses.common.PEI_CORE]=0D
# RISC-V platform PEI core entry point.=0D
PeiCoreEntryPoint|Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/=
PeiCoreEntryPoint.inf=0D
+ PlatformSecPpiLib|Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibN=
ull/PlatformSecPpiLibNull.inf=0D
=0D
[LibraryClasses.common.PEIM]=0D
FirmwareContextProcessorSpecificLib|Platform/RISC-V/PlatformPkg/Library/=
FirmwareContextProcessorSpecificLib/FirmwareContextProcessorSpecificLib.inf=
=0D
@@ -82,6 +83,7 @@
Platform/RISC-V/PlatformPkg/Library/FirmwareContextProcessorSpecificLib/=
FirmwareContextProcessorSpecificLib.inf=0D
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
=0D
[Components.common.SEC]=0D
Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.inf=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull/Plat=
formSecPpiLibNull.inf b/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiL=
ibNull/PlatformSecPpiLibNull.inf
new file mode 100644
index 0000000000..22f5751655
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull/PlatformSec=
PpiLibNull.inf
@@ -0,0 +1,36 @@
+## @file=0D
+# Library instance to to provide PPI before PEI Core=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 PlatformSecPpiLib=0D
+ FILE_GUID =3D A2CDDADC-CB65-4EED-9CAE-192B0BDD6C84=
=0D
+ MODULE_TYPE =3D PEIM=0D
+ VERSION_STRING =3D 1.0=0D
+ LIBRARY_CLASS =3D PlatformSecPpiLib|PEI_CORE=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
+ PlatformSecPpiLib.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
+ #PrintLib=0D
+=0D
diff --git a/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.=
h b/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.h
new file mode 100644
index 0000000000..88468e660b
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.h
@@ -0,0 +1,24 @@
+/** @file=0D
+ RISC-V platform SEC PPI before PEI Core.=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_PLATFORM_SEC_PPI_H_=0D
+#define RISCV_PLATFORM_SEC_PPI_H_=0D
+=0D
+#include <PiPei.h>=0D
+=0D
+/** Return platform SEC PPI before PEI Core=0D
+=0D
+ @param[in,out] ThisPpiList Pointer to retrieve EFI_PEI_PPI_DESCRIPTOR=
.=0D
+=0D
+**/=0D
+EFI_STATUS=0D
+GetPlatformPrePeiCorePpiDescriptor (=0D
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **ThisPpiList=0D
+);=0D
+=0D
+#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull/Plat=
formSecPpiLib.c b/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull=
/PlatformSecPpiLib.c
new file mode 100644
index 0000000000..d5c089b02d
--- /dev/null
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformSecPpiLibNull/PlatformSec=
PpiLib.c
@@ -0,0 +1,28 @@
+/**@file=0D
+ NULL library instance of PlatformSecPpiLib=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 <PiPei.h>=0D
+=0D
+/** Return platform SEC PPI before PEI Core=0D
+=0D
+ @param[in,out] ThisPpiList Pointer to retrieve EFI_PEI_PPI_DESCRIPTOR=
.=0D
+=0D
+**/=0D
+EFI_STATUS=0D
+GetPlatformPrePeiCorePpiDescriptor (=0D
+ IN OUT EFI_PEI_PPI_DESCRIPTOR **ThisPpiList=0D
+)=0D
+{=0D
+ *ThisPpiList =3D NULL;=0D
+ return EFI_NOT_FOUND;=0D
+}=0D
+=0D
--=20
2.31.1