[edk2-platforms][PATCH 21/30] RiscVPlatformPkg/Sec: Check Cold/Warm hart


Abner Chang
 

Check Coldboot or Warmboot hart in SEC OpenSBI platform function.

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/Universal/Sec/SecMain.c | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform=
/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
index 51d9edfe75..9b162fb3b6 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
@@ -398,6 +398,13 @@ SecPostOpenSbiPlatformEarlylInit(
IN BOOLEAN ColdBoot=0D
)=0D
{=0D
+ UINT32 HartId;=0D
+=0D
+ if (!ColdBoot) {=0D
+ HartId =3D current_hartid();=0D
+ DEBUG ((DEBUG_INFO, "%a: Non boot hart %d.\n", __FUNCTION__, HartId));=
=0D
+ return 0;=0D
+ }=0D
//=0D
// Boot HART is already in the process of OpenSBI initialization.=0D
// We can let other HART to keep booting.=0D
@@ -423,6 +430,12 @@ SecPostOpenSbiPlatformFinalInit (
struct sbi_platform *SbiPlatform;=0D
EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
=0D
+ if (!ColdBoot) {=0D
+ HartId =3D current_hartid();=0D
+ DEBUG ((DEBUG_INFO, "%a: Non boot hart %d.\n", __FUNCTION__, HartId));=
=0D
+ return 0;=0D
+ }=0D
+=0D
DEBUG((DEBUG_INFO, "%a: Entry, preparing to jump to PEI Core\n\n", __FUN=
CTION__));=0D
=0D
SbiScratch =3D sbi_scratch_thishart_ptr();=0D
@@ -777,7 +790,7 @@ VOID EFIAPI SecCoreStartUpWithStack(
sbi_init(Scratch);=0D
}=0D
=0D
-void xxxx (char *debugstr, ...)=0D
+void OpensbiDebugPrint (char *debugstr, ...)=0D
{=0D
VA_LIST Marker;=0D
=0D
--=20
2.31.1