[edk2-platforms][PATCH 08/14] RISC-V/PlatformPkg: Address Core CI Uncrustify errors


Abner Chang
 

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
---
.../Library/Edk2OpensbiPlatformWrapperLib.h | 2 +-
.../FirmwareContextProcessorSpecificLib.h | 17 +-
.../Include/Library/PlatformSecPpiLib.h | 2 +-
.../Library/RiscVPlatformTempMemoryInitLib.h | 18 +-
.../PlatformBootManager.h | 34 +-
.../Universal/Pei/PlatformPei/Platform.h | 32 +-
.../PlatformPkg/Universal/Sec/SecMain.h | 6 +-
.../Edk2OpensbiPlatformWrapperLib.c | 384 ++++++++++--------
.../FirmwareContextProcessorSpecificLib.c | 30 +-
.../OpensbiPlatformLib/OpensbiPlatform.c | 229 ++++++-----
.../PeiCoreEntryPoint/PeiCoreEntryPoint.c | 18 +-
.../PlatformBootManager.c | 68 ++--
.../PlatformBootManagerLib/PlatformData.c | 18 +-
.../PlatformMemoryTestLibNull.c | 2 +-
.../Library/ResetSystemLib/ResetSystemLib.c | 40 +-
.../RiscVSpecialPlatformLib.c | 7 +-
.../PlatformPkg/Universal/FdtPeim/FdtPeim.c | 30 +-
.../Universal/Pei/PlatformPei/Fv.c | 9 +-
.../Universal/Pei/PlatformPei/MemDetect.c | 15 +-
.../Universal/Pei/PlatformPei/Platform.c | 91 +++--
.../PlatformPkg/Universal/Sec/SecMain.c | 328 ++++++++-------
21 files changed, 745 insertions(+), 635 deletions(-)

diff --git a/Platform/RISC-V/PlatformPkg/Include/Library/Edk2OpensbiPlatfor=
mWrapperLib.h b/Platform/RISC-V/PlatformPkg/Include/Library/Edk2OpensbiPlat=
formWrapperLib.h
index 4da0a64a8c..cb669bd737 100644
--- a/Platform/RISC-V/PlatformPkg/Include/Library/Edk2OpensbiPlatformWrappe=
rLib.h
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/Edk2OpensbiPlatformWrappe=
rLib.h
@@ -11,6 +11,6 @@
=0D
#include <sbi/sbi_platform.h>=0D
=0D
-extern struct sbi_platform_operations Edk2OpensbiPlatformOps;=0D
+extern struct sbi_platform_operations Edk2OpensbiPlatformOps;=0D
=0D
#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Include/Library/FirmwareContextPro=
cessorSpecificLib.h b/Platform/RISC-V/PlatformPkg/Include/Library/FirmwareC=
ontextProcessorSpecificLib.h
index 0eec62033b..348a644675 100644
--- a/Platform/RISC-V/PlatformPkg/Include/Library/FirmwareContextProcessorS=
pecificLib.h
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/FirmwareContextProcessorS=
pecificLib.h
@@ -6,6 +6,7 @@
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
**/=0D
+=0D
#ifndef FIRMWARE_CONTEXT_PROCESSOR_SPECIFIC_LIB_H_=0D
#define FIRMWARE_CONTEXT_PROCESSOR_SPECIFIC_LIB_H_=0D
=0D
@@ -30,13 +31,13 @@
EFI_STATUS=0D
EFIAPI=0D
CommonFirmwareContextHartSpecificInfo (=0D
- EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *FirmwareContextHartSpecific,=0D
- EFI_GUID *ParentProcessorGuid,=0D
- UINTN ParentProcessorUid,=0D
- EFI_GUID *CoreGuid,=0D
- UINTN HartId,=0D
- BOOLEAN IsBootHart,=0D
- RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecDataHob=0D
+ EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *FirmwareContextHartSpecific,=
=0D
+ EFI_GUID *ParentProcessorGuid,=0D
+ UINTN ParentProcessorUid,=0D
+ EFI_GUID *CoreGuid,=0D
+ UINTN HartId,=0D
+ BOOLEAN IsBootHart,=0D
+ RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecDataHob=0D
);=0D
=0D
/**=0D
@@ -47,7 +48,7 @@ CommonFirmwareContextHartSpecificInfo (
VOID=0D
EFIAPI=0D
DebugPrintHartSpecificInfo (=0D
- RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
+ RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
);=0D
=0D
#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.=
h b/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.h
index 88468e660b..e7f0b2c8ff 100644
--- a/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.h
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/PlatformSecPpiLib.h
@@ -19,6 +19,6 @@
EFI_STATUS=0D
GetPlatformPrePeiCorePpiDescriptor (=0D
IN OUT EFI_PEI_PPI_DESCRIPTOR **ThisPpiList=0D
-);=0D
+ );=0D
=0D
#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Include/Library/RiscVPlatformTempM=
emoryInitLib.h b/Platform/RISC-V/PlatformPkg/Include/Library/RiscVPlatformT=
empMemoryInitLib.h
index 4f9f7950c1..996845834c 100644
--- a/Platform/RISC-V/PlatformPkg/Include/Library/RiscVPlatformTempMemoryIn=
itLib.h
+++ b/Platform/RISC-V/PlatformPkg/Include/Library/RiscVPlatformTempMemoryIn=
itLib.h
@@ -11,7 +11,19 @@
=0D
#include "RiscVImpl.h"=0D
=0D
-VOID EFIAPI RiscVPlatformTemporaryMemInit (VOID);=0D
-UINT32 EFIAPI RiscVPlatformTemporaryMemSize (VOID);=0D
-UINT32 EFIAPI RiscVPlatformTemporaryMemBase (VOID);=0D
+VOID EFIAPI=0D
+RiscVPlatformTemporaryMemInit (=0D
+ VOID=0D
+ );=0D
+=0D
+UINT32 EFIAPI=0D
+RiscVPlatformTemporaryMemSize (=0D
+ VOID=0D
+ );=0D
+=0D
+UINT32 EFIAPI=0D
+RiscVPlatformTemporaryMemBase (=0D
+ VOID=0D
+ );=0D
+=0D
#endif=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/Pla=
tformBootManager.h b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManage=
rLib/PlatformBootManager.h
index 01c26f307e..7da15b010a 100644
--- a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformBo=
otManager.h
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformBo=
otManager.h
@@ -33,25 +33,25 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
#include <Library/PrintLib.h>=0D
=0D
typedef struct {=0D
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D
- UINTN ConnectType;=0D
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D
+ UINTN ConnectType;=0D
} PLATFORM_CONSOLE_CONNECT_ENTRY;=0D
=0D
extern PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[];=0D
=0D
-#define CONSOLE_OUT BIT0=0D
-#define CONSOLE_IN BIT1=0D
-#define STD_ERROR BIT2=0D
+#define CONSOLE_OUT BIT0=0D
+#define CONSOLE_IN BIT1=0D
+#define STD_ERROR BIT2=0D
=0D
-//D3987D4B-971A-435F-8CAF-4967EB627241=0D
+// D3987D4B-971A-435F-8CAF-4967EB627241=0D
#define EFI_SERIAL_DXE_GUID \=0D
{ 0xD3987D4B, 0x971A, 0x435F, { 0x8C, 0xAF, 0x49, 0x67, 0xEB, 0x62, 0x72=
, 0x41 } }=0D
=0D
typedef struct {=0D
- VENDOR_DEVICE_PATH Guid;=0D
- UART_DEVICE_PATH Uart;=0D
- VENDOR_DEVICE_PATH TerminalType;=0D
- EFI_DEVICE_PATH_PROTOCOL End;=0D
+ VENDOR_DEVICE_PATH Guid;=0D
+ UART_DEVICE_PATH Uart;=0D
+ VENDOR_DEVICE_PATH TerminalType;=0D
+ EFI_DEVICE_PATH_PROTOCOL End;=0D
} SERIAL_CONSOLE_DEVICE_PATH;=0D
=0D
/**=0D
@@ -78,7 +78,7 @@ PlatformBootManagerDisableQuietBoot (
**/=0D
EFI_STATUS=0D
PlatformBootManagerMemoryTest (=0D
- IN EXTENDMEM_COVERAGE_LEVEL Level=0D
+ IN EXTENDMEM_COVERAGE_LEVEL Level=0D
);=0D
=0D
/**=0D
@@ -98,12 +98,12 @@ PlatformBootManagerMemoryTest (
**/=0D
EFI_STATUS=0D
PlatformBootManagerShowProgress (=0D
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,=0D
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,=0D
- IN CHAR16 *Title,=0D
- IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,=0D
- IN UINTN Progress,=0D
- IN UINTN PreviousValue=0D
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleForeground,=0D
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL TitleBackground,=0D
+ IN CHAR16 *Title,=0D
+ IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL ProgressColor,=0D
+ IN UINTN Progress,=0D
+ IN UINTN PreviousValue=0D
);=0D
=0D
#endif // _PLATFORM_BOOT_MANAGER_H=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform=
.h b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.h
index 1b6cb4f870..6c23c722a3 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.h
+++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.h
@@ -1,7 +1,7 @@
/** @file=0D
Platform PEI module include file.=0D
=0D
- Copyright (c) 2019-2022, Hewlett Packard Enterprise Development LP. All =
rights reserved.<BR>=0D
+ Copyright (c) 2019, Hewlett Packard Enterprise Development LP. All right=
s reserved.<BR>=0D
Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.<BR>=0D
=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
@@ -13,44 +13,44 @@
=0D
VOID=0D
AddIoMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
);=0D
=0D
VOID=0D
AddIoMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
);=0D
=0D
VOID=0D
AddMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
);=0D
=0D
VOID=0D
AddMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
);=0D
=0D
VOID=0D
AddUntestedMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
);=0D
=0D
VOID=0D
AddReservedMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
);=0D
=0D
VOID=0D
AddUntestedMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
);=0D
=0D
VOID=0D
@@ -92,6 +92,6 @@ InitializeXen (
EFI_STATUS=0D
BuildRiscVSmbiosHobs (=0D
VOID=0D
-);=0D
+ );=0D
=0D
#endif // _PLATFORM_PEI_H_INCLUDED_=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.h b/Platform=
/RISC-V/PlatformPkg/Universal/Sec/SecMain.h
index 4098bd7d92..8c2e6e1253 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.h
+++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.h
@@ -35,8 +35,8 @@
=0D
**/=0D
INT32=0D
-SecPostOpenSbiPlatformEarlyInit(=0D
- IN BOOLEAN ColdBoot=0D
+SecPostOpenSbiPlatformEarlyInit (=0D
+ IN BOOLEAN ColdBoot=0D
);=0D
=0D
/**=0D
@@ -49,7 +49,7 @@ SecPostOpenSbiPlatformEarlyInit(
**/=0D
INT32=0D
SecPostOpenSbiPlatformFinalInit (=0D
- IN BOOLEAN ColdBoot=0D
+ IN BOOLEAN ColdBoot=0D
);=0D
=0D
/**=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/Edk2OpensbiPlatformWrapper=
Lib/Edk2OpensbiPlatformWrapperLib.c b/Platform/RISC-V/PlatformPkg/Library/E=
dk2OpensbiPlatformWrapperLib/Edk2OpensbiPlatformWrapperLib.c
index 0bd1b44241..c4f9dd02b2 100644
--- a/Platform/RISC-V/PlatformPkg/Library/Edk2OpensbiPlatformWrapperLib/Edk=
2OpensbiPlatformWrapperLib.c
+++ b/Platform/RISC-V/PlatformPkg/Library/Edk2OpensbiPlatformWrapperLib/Edk=
2OpensbiPlatformWrapperLib.c
@@ -16,8 +16,8 @@
#include <sbi/sbi_domain.h>=0D
#include <sbi/sbi_math.h>=0D
=0D
-extern struct sbi_platform_operations platform_ops;=0D
-extern atomic_t BootHartDone;=0D
+extern struct sbi_platform_operations platform_ops;=0D
+extern atomic_t BootHartDone;=0D
=0D
/**=0D
Add firmware memory domain.=0D
@@ -30,18 +30,18 @@ SecSetEdk2FwMemoryRegions (
VOID=0D
)=0D
{=0D
- INT32 Ret;=0D
- struct sbi_domain_memregion fw_memregs;=0D
+ INT32 Ret;=0D
+ struct sbi_domain_memregion fw_memregs;=0D
=0D
Ret =3D 0;=0D
=0D
//=0D
// EDK2 PEI domain memory region=0D
//=0D
- fw_memregs.order =3D log2roundup(FixedPcdGet32(PcdFirmwareDomainSize));=
=0D
- fw_memregs.base =3D FixedPcdGet32(PcdFirmwareDomainBaseAddress);=0D
+ fw_memregs.order =3D log2roundup (FixedPcdGet32 (PcdFirmwareDomainSize))=
;=0D
+ fw_memregs.base =3D FixedPcdGet32 (PcdFirmwareDomainBaseAddress);=0D
fw_memregs.flags =3D SBI_DOMAIN_MEMREGION_EXECUTABLE | SBI_DOMAIN_MEMREG=
ION_READABLE;=0D
- Ret =3D sbi_domain_root_add_memregion ((CONST struct sbi_domain_memregio=
n *)&fw_memregs);=0D
+ Ret =3D sbi_domain_root_add_memregion ((CONST struct sbi_do=
main_memregion *)&fw_memregs);=0D
if (Ret !=3D 0) {=0D
DEBUG ((DEBUG_ERROR, "%a: Add firmware regions of FW Domain fail\n", _=
_FUNCTION__));=0D
}=0D
@@ -49,15 +49,17 @@ SecSetEdk2FwMemoryRegions (
//=0D
// EDK2 EFI Variable domain memory region=0D
//=0D
- fw_memregs.order =3D log2roundup(FixedPcdGet32(PcdVariableFirmwareRegion=
Size));=0D
- fw_memregs.base =3D FixedPcdGet32(PcdVariableFirmwareRegionBaseAddress);=
=0D
+ fw_memregs.order =3D log2roundup (FixedPcdGet32 (PcdVariableFirmwareRegi=
onSize));=0D
+ fw_memregs.base =3D FixedPcdGet32 (PcdVariableFirmwareRegionBaseAddress=
);=0D
fw_memregs.flags =3D SBI_DOMAIN_MEMREGION_READABLE | SBI_DOMAIN_MEMREGIO=
N_WRITEABLE;=0D
- Ret =3D sbi_domain_root_add_memregion ((CONST struct sbi_domain_memregio=
n *)&fw_memregs);=0D
+ Ret =3D sbi_domain_root_add_memregion ((CONST struct sbi_do=
main_memregion *)&fw_memregs);=0D
if (Ret !=3D 0) {=0D
DEBUG ((DEBUG_ERROR, "%a: Add firmware regions of variable FW Domain f=
ail\n", __FUNCTION__));=0D
}=0D
+=0D
return Ret;=0D
}=0D
+=0D
/**=0D
OpenSBI platform early init hook.=0D
=0D
@@ -66,17 +68,18 @@ SecSetEdk2FwMemoryRegions (
=0D
**/=0D
INT32=0D
-SecPostOpenSbiPlatformEarlyInit(=0D
- IN BOOLEAN ColdBoot=0D
+SecPostOpenSbiPlatformEarlyInit (=0D
+ IN BOOLEAN ColdBoot=0D
)=0D
{=0D
- UINT32 HartId;=0D
+ UINT32 HartId;=0D
=0D
if (!ColdBoot) {=0D
- HartId =3D current_hartid();=0D
+ HartId =3D current_hartid ();=0D
DEBUG ((DEBUG_INFO, "%a: Non boot hart %d.\n", __FUNCTION__, HartId));=
=0D
return 0;=0D
}=0D
+=0D
//=0D
// Setup firmware memory region.=0D
//=0D
@@ -103,70 +106,75 @@ SecPostOpenSbiPlatformEarlyInit(
**/=0D
INT32=0D
SecPostOpenSbiPlatformFinalInit (=0D
- IN BOOLEAN ColdBoot=0D
+ IN BOOLEAN ColdBoot=0D
)=0D
{=0D
- UINT32 HartId;=0D
- struct sbi_scratch *SbiScratch;=0D
- struct sbi_scratch *ScratchSpace;=0D
- struct sbi_platform *SbiPlatform;=0D
- EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
+ UINT32 HartId;=0D
+ struct sbi_scratch *SbiScratch;=0D
+ struct sbi_scratch *ScratchSpace;=0D
+ struct sbi_platform *SbiPlatform;=0D
+ EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
=0D
if (!ColdBoot) {=0D
- HartId =3D current_hartid();=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
+ DEBUG ((DEBUG_INFO, "%a: Entry, preparing to jump to PEI Core\n\n", __FU=
NCTION__));=0D
=0D
- SbiScratch =3D sbi_scratch_thishart_ptr();=0D
- SbiPlatform =3D (struct sbi_platform *)sbi_platform_ptr(SbiScratch);=0D
+ SbiScratch =3D sbi_scratch_thishart_ptr ();=0D
+ SbiPlatform =3D (struct sbi_platform *)sbi_platform_ptr (SbiScratch)=
;=0D
FirmwareContext =3D (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *)SbiPlatform->f=
irmware_context;=0D
=0D
//=0D
// Print out scratch address of each hart=0D
//=0D
DEBUG ((DEBUG_INFO, "%a: OpenSBI scratch address for each hart:\n", __FU=
NCTION__));=0D
- for (HartId =3D 0; HartId < SBI_HARTMASK_MAX_BITS; HartId ++) {=0D
- if (sbi_platform_hart_invalid(SbiPlatform, HartId)) {=0D
+ for (HartId =3D 0; HartId < SBI_HARTMASK_MAX_BITS; HartId++) {=0D
+ if (sbi_platform_hart_invalid (SbiPlatform, HartId)) {=0D
continue;=0D
}=0D
+=0D
ScratchSpace =3D sbi_hartid_to_scratch (HartId);=0D
- if(ScratchSpace !=3D NULL) {=0D
- DEBUG((DEBUG_INFO, " Hart %d: 0x%x\n", HartId, ScratchSpace=
));=0D
+ if (ScratchSpace !=3D NULL) {=0D
+ DEBUG ((DEBUG_INFO, " Hart %d: 0x%x\n", HartId, ScratchSpac=
e));=0D
} else {=0D
- DEBUG((DEBUG_INFO, " Hart %d not initialized yet\n", HartId=
));=0D
+ DEBUG ((DEBUG_INFO, " Hart %d not initialized yet\n", HartI=
d));=0D
}=0D
}=0D
=0D
//=0D
// Set firmware context Hart-specific pointer=0D
//=0D
- for (HartId =3D 0; HartId < SBI_HARTMASK_MAX_BITS; HartId ++) {=0D
- if (sbi_platform_hart_invalid(SbiPlatform, HartId)) {=0D
+ for (HartId =3D 0; HartId < SBI_HARTMASK_MAX_BITS; HartId++) {=0D
+ if (sbi_platform_hart_invalid (SbiPlatform, HartId)) {=0D
continue;=0D
}=0D
+=0D
ScratchSpace =3D sbi_hartid_to_scratch (HartId);=0D
if (ScratchSpace !=3D NULL) {=0D
FirmwareContext->HartSpecific[HartId] =3D=0D
(EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *)((UINT8 *)ScratchSpace=
- FIRMWARE_CONTEXT_HART_SPECIFIC_SIZE);=0D
- DEBUG ((DEBUG_INFO, "%a: OpenSBI Hart %d Firmware Context Hart-spe=
cific at address: 0x%x\n",=0D
- __FUNCTION__,=0D
- HartId,=0D
- FirmwareContext->HartSpecific [HartId]=0D
- ));=0D
+ DEBUG ((=0D
+ DEBUG_INFO,=0D
+ "%a: OpenSBI Hart %d Firmware Context Hart-specific at address: 0x=
%x\n",=0D
+ __FUNCTION__,=0D
+ HartId,=0D
+ FirmwareContext->HartSpecific[HartId]=0D
+ ));=0D
}=0D
}=0D
=0D
- DEBUG((DEBUG_INFO, "%a: Will jump to PEI Core in OpenSBI with \n", __FUN=
CTION__));=0D
- DEBUG((DEBUG_INFO, " sbi_scratch =3D %x\n", SbiScratch));=0D
- DEBUG((DEBUG_INFO, " sbi_platform =3D %x\n", SbiPlatform));=0D
- DEBUG((DEBUG_INFO, " FirmwareContext =3D %x\n", FirmwareContext));=0D
+ DEBUG ((DEBUG_INFO, "%a: Will jump to PEI Core in OpenSBI with \n", __FU=
NCTION__));=0D
+ DEBUG ((DEBUG_INFO, " sbi_scratch =3D %x\n", SbiScratch));=0D
+ DEBUG ((DEBUG_INFO, " sbi_platform =3D %x\n", SbiPlatform));=0D
+ DEBUG ((DEBUG_INFO, " FirmwareContext =3D %x\n", FirmwareContext));=0D
SbiScratch->next_arg1 =3D (unsigned long)FirmwareContext;=0D
=0D
return 0;=0D
}=0D
+=0D
/**=0D
OpenSBI platform early init hook.=0D
=0D
@@ -176,24 +184,27 @@ SecPostOpenSbiPlatformFinalInit (
**/=0D
INT32=0D
Edk2OpensbiPlatformEarlyInit (=0D
- IN BOOLEAN ColdBoot=0D
+ IN BOOLEAN ColdBoot=0D
)=0D
{=0D
- INT32 ReturnCode;=0D
+ INT32 ReturnCode;=0D
=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.early_init) {=0D
- ReturnCode =3D platform_ops.early_init (ColdBoot);=0D
- if (ReturnCode) {=0D
- return ReturnCode;=0D
- }=0D
- }=0D
- if (ColdBoot) {=0D
- return SecPostOpenSbiPlatformEarlyInit(ColdBoot);=0D
+ if (platform_ops.early_init) {=0D
+ ReturnCode =3D platform_ops.early_init (ColdBoot);=0D
+ if (ReturnCode) {=0D
+ return ReturnCode;=0D
}=0D
- return 0;=0D
+ }=0D
+=0D
+ if (ColdBoot) {=0D
+ return SecPostOpenSbiPlatformEarlyInit (ColdBoot);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
+=0D
/**=0D
OpenSBI platform final init hook.=0D
=0D
@@ -203,24 +214,27 @@ Edk2OpensbiPlatformEarlyInit (
**/=0D
INT32=0D
Edk2OpensbiPlatformFinalInit (=0D
- IN BOOLEAN ColdBoot=0D
+ IN BOOLEAN ColdBoot=0D
)=0D
{=0D
- INT32 ReturnCode;=0D
+ INT32 ReturnCode;=0D
=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.final_init) {=0D
- ReturnCode =3D platform_ops.final_init (ColdBoot);=0D
- if (ReturnCode) {=0D
- return ReturnCode;=0D
- }=0D
+ if (platform_ops.final_init) {=0D
+ ReturnCode =3D platform_ops.final_init (ColdBoot);=0D
+ if (ReturnCode) {=0D
+ return ReturnCode;=0D
}=0D
- if (ColdBoot) {=0D
- return SecPostOpenSbiPlatformFinalInit(ColdBoot);=0D
- }=0D
- return 0;=0D
+ }=0D
+=0D
+ if (ColdBoot) {=0D
+ return SecPostOpenSbiPlatformFinalInit (ColdBoot);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
+=0D
/**=0D
OpenSBI platform early exit hook.=0D
=0D
@@ -228,13 +242,13 @@ Edk2OpensbiPlatformFinalInit (
VOID=0D
Edk2OpensbiPlatformEarlyExit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.early_exit) {=0D
- return platform_ops.early_exit ();=0D
- }=0D
+ if (platform_ops.early_exit) {=0D
+ return platform_ops.early_exit ();=0D
+ }=0D
}=0D
=0D
/**=0D
@@ -246,11 +260,11 @@ Edk2OpensbiPlatformFinalExit (
VOID=0D
)=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.early_exit) {=0D
- return platform_ops.early_exit ();=0D
- }=0D
+ if (platform_ops.early_exit) {=0D
+ return platform_ops.early_exit ();=0D
+ }=0D
}=0D
=0D
/**=0D
@@ -263,13 +277,14 @@ Edk2OpensbiPlatformFinalExit (
**/=0D
INT32=0D
Edk2OpensbiPlatforMMISACheckExtension (=0D
- IN CHAR8 Extension=0D
+ IN CHAR8 Extension=0D
)=0D
{=0D
- if (platform_ops.misa_check_extension) {=0D
- return platform_ops.misa_check_extension (Extension);=0D
- }=0D
- return 0;=0D
+ if (platform_ops.misa_check_extension) {=0D
+ return platform_ops.misa_check_extension (Extension);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -281,12 +296,13 @@ Edk2OpensbiPlatforMMISACheckExtension (
INT32=0D
Edk2OpensbiPlatforMMISAGetXLEN (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- if (platform_ops.misa_get_xlen) {=0D
- return platform_ops.misa_get_xlen ();=0D
- }=0D
- return 0;=0D
+ if (platform_ops.misa_get_xlen) {=0D
+ return platform_ops.misa_get_xlen ();=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -298,14 +314,15 @@ Edk2OpensbiPlatforMMISAGetXLEN (
INT32=0D
Edk2OpensbiPlatformDomainsInit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.domains_init) {=0D
- return platform_ops.domains_init ();=0D
- }=0D
- return 0;=0D
+ if (platform_ops.domains_init) {=0D
+ return platform_ops.domains_init ();=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -317,14 +334,15 @@ Edk2OpensbiPlatformDomainsInit (
INT32=0D
Edk2OpensbiPlatformSerialInit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.console_init) {=0D
- return platform_ops.console_init ();=0D
- }=0D
- return 0;=0D
+ if (platform_ops.console_init) {=0D
+ return platform_ops.console_init ();=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -336,15 +354,16 @@ Edk2OpensbiPlatformSerialInit (
**/=0D
INT32=0D
Edk2OpensbiPlatformIrqchipInit (=0D
- IN BOOLEAN ColdBoot=0D
-)=0D
+ IN BOOLEAN ColdBoot=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.irqchip_init) {=0D
- return platform_ops.irqchip_init (ColdBoot);=0D
- }=0D
- return 0;=0D
+ if (platform_ops.irqchip_init) {=0D
+ return platform_ops.irqchip_init (ColdBoot);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -354,13 +373,13 @@ Edk2OpensbiPlatformIrqchipInit (
VOID=0D
Edk2OpensbiPlatformIrqchipExit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.irqchip_exit) {=0D
- return platform_ops.irqchip_exit ();=0D
- }=0D
+ if (platform_ops.irqchip_exit) {=0D
+ return platform_ops.irqchip_exit ();=0D
+ }=0D
}=0D
=0D
/**=0D
@@ -372,15 +391,16 @@ Edk2OpensbiPlatformIrqchipExit (
**/=0D
INT32=0D
Edk2OpensbiPlatformIpiInit (=0D
- IN BOOLEAN ColdBoot=0D
-)=0D
+ IN BOOLEAN ColdBoot=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.ipi_init) {=0D
- return platform_ops.ipi_init (ColdBoot);=0D
- }=0D
- return 0;=0D
+ if (platform_ops.ipi_init) {=0D
+ return platform_ops.ipi_init (ColdBoot);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -390,13 +410,13 @@ Edk2OpensbiPlatformIpiInit (
VOID=0D
Edk2OpensbiPlatformIpiExit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.ipi_exit) {=0D
- return platform_ops.ipi_exit ();=0D
- }=0D
+ if (platform_ops.ipi_exit) {=0D
+ return platform_ops.ipi_exit ();=0D
+ }=0D
}=0D
=0D
/**=0D
@@ -408,14 +428,15 @@ Edk2OpensbiPlatformIpiExit (
UINT64=0D
Edk2OpensbiPlatformTlbrFlushLimit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.get_tlbr_flush_limit) {=0D
- return platform_ops.get_tlbr_flush_limit ();=0D
- }=0D
- return 0;=0D
+ if (platform_ops.get_tlbr_flush_limit) {=0D
+ return platform_ops.get_tlbr_flush_limit ();=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -427,15 +448,16 @@ Edk2OpensbiPlatformTlbrFlushLimit (
**/=0D
INT32=0D
Edk2OpensbiPlatformTimerInit (=0D
- IN BOOLEAN ColdBoot=0D
-)=0D
+ IN BOOLEAN ColdBoot=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.timer_init) {=0D
- return platform_ops.timer_init (ColdBoot);=0D
- }=0D
- return 0;=0D
+ if (platform_ops.timer_init) {=0D
+ return platform_ops.timer_init (ColdBoot);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -445,13 +467,13 @@ Edk2OpensbiPlatformTimerInit (
VOID=0D
Edk2OpensbiPlatformTimerExit (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.timer_exit) {=0D
- return platform_ops.timer_exit ();=0D
- }=0D
+ if (platform_ops.timer_exit) {=0D
+ return platform_ops.timer_exit ();=0D
+ }=0D
}=0D
=0D
/**=0D
@@ -463,15 +485,16 @@ Edk2OpensbiPlatformTimerExit (
**/=0D
INT32=0D
Edk2OpensbiPlatformVendorExtCheck (=0D
- IN long ExtId=0D
-)=0D
+ IN long ExtId=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
- if (platform_ops.vendor_ext_check) {=0D
- return platform_ops.vendor_ext_check (ExtId);=0D
- }=0D
- return 0;=0D
+ if (platform_ops.vendor_ext_check) {=0D
+ return platform_ops.vendor_ext_check (ExtId);=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
/**=0D
@@ -488,43 +511,44 @@ Edk2OpensbiPlatformVendorExtCheck (
**/=0D
INT32=0D
Edk2OpensbiPlatformVendorExtProvider (=0D
- IN long ExtId,=0D
- IN long FuncId,=0D
- IN CONST struct sbi_trap_regs *Regs,=0D
- IN unsigned long *OutValue,=0D
- IN struct sbi_trap_info *OutTrap=0D
-)=0D
+ IN long ExtId,=0D
+ IN long FuncId,=0D
+ IN CONST struct sbi_trap_regs *Regs,=0D
+ IN unsigned long *OutValue,=0D
+ IN struct sbi_trap_info *OutTrap=0D
+ )=0D
{=0D
- DEBUG((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
-=0D
- if (platform_ops.vendor_ext_provider) {=0D
- return platform_ops.vendor_ext_provider (=0D
- ExtId,=0D
- FuncId,=0D
- Regs,=0D
- OutValue,=0D
- OutTrap=0D
- );=0D
- }=0D
- return 0;=0D
+ DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
+=0D
+ if (platform_ops.vendor_ext_provider) {=0D
+ return platform_ops.vendor_ext_provider (=0D
+ ExtId,=0D
+ FuncId,=0D
+ Regs,=0D
+ OutValue,=0D
+ OutTrap=0D
+ );=0D
+ }=0D
+=0D
+ return 0;=0D
}=0D
=0D
-CONST struct sbi_platform_operations Edk2OpensbiPlatformOps =3D {=0D
- .early_init =3D Edk2OpensbiPlatformEarlyInit,=0D
- .final_init =3D Edk2OpensbiPlatformFinalInit,=0D
- .early_exit =3D Edk2OpensbiPlatformEarlyExit,=0D
- .final_exit =3D Edk2OpensbiPlatformFinalExit,=0D
- .misa_check_extension =3D Edk2OpensbiPlatforMMISACheckExtension,=0D
- .misa_get_xlen =3D Edk2OpensbiPlatforMMISAGetXLEN,=0D
- .domains_init =3D Edk2OpensbiPlatformDomainsInit,=0D
- .console_init =3D Edk2OpensbiPlatformSerialInit,=0D
- .irqchip_init =3D Edk2OpensbiPlatformIrqchipInit,=0D
- .irqchip_exit =3D Edk2OpensbiPlatformIrqchipExit,=0D
- .ipi_init =3D Edk2OpensbiPlatformIpiInit,=0D
- .ipi_exit =3D Edk2OpensbiPlatformIpiExit,=0D
- .get_tlbr_flush_limit =3D Edk2OpensbiPlatformTlbrFlushLimit,=0D
- .timer_init =3D Edk2OpensbiPlatformTimerInit,=0D
- .timer_exit =3D Edk2OpensbiPlatformTimerExit,=0D
- .vendor_ext_check =3D Edk2OpensbiPlatformVendorExtCheck,=0D
- .vendor_ext_provider =3D Edk2OpensbiPlatformVendorExtProvider,=0D
+CONST struct sbi_platform_operations Edk2OpensbiPlatformOps =3D {=0D
+ .early_init =3D Edk2OpensbiPlatformEarlyInit,=0D
+ .final_init =3D Edk2OpensbiPlatformFinalInit,=0D
+ .early_exit =3D Edk2OpensbiPlatformEarlyExit,=0D
+ .final_exit =3D Edk2OpensbiPlatformFinalExit,=0D
+ .misa_check_extension =3D Edk2OpensbiPlatforMMISACheckExtension,=0D
+ .misa_get_xlen =3D Edk2OpensbiPlatforMMISAGetXLEN,=0D
+ .domains_init =3D Edk2OpensbiPlatformDomainsInit,=0D
+ .console_init =3D Edk2OpensbiPlatformSerialInit,=0D
+ .irqchip_init =3D Edk2OpensbiPlatformIrqchipInit,=0D
+ .irqchip_exit =3D Edk2OpensbiPlatformIrqchipExit,=0D
+ .ipi_init =3D Edk2OpensbiPlatformIpiInit,=0D
+ .ipi_exit =3D Edk2OpensbiPlatformIpiExit,=0D
+ .get_tlbr_flush_limit =3D Edk2OpensbiPlatformTlbrFlushLimit,=0D
+ .timer_init =3D Edk2OpensbiPlatformTimerInit,=0D
+ .timer_exit =3D Edk2OpensbiPlatformTimerExit,=0D
+ .vendor_ext_check =3D Edk2OpensbiPlatformVendorExtCheck,=0D
+ .vendor_ext_provider =3D Edk2OpensbiPlatformVendorExtProvider,=0D
};=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/FirmwareContextProcessorSp=
ecificLib/FirmwareContextProcessorSpecificLib.c b/Platform/RISC-V/PlatformP=
kg/Library/FirmwareContextProcessorSpecificLib/FirmwareContextProcessorSpec=
ificLib.c
index c94f7881c2..7f8ef28019 100644
--- a/Platform/RISC-V/PlatformPkg/Library/FirmwareContextProcessorSpecificL=
ib/FirmwareContextProcessorSpecificLib.c
+++ b/Platform/RISC-V/PlatformPkg/Library/FirmwareContextProcessorSpecificL=
ib/FirmwareContextProcessorSpecificLib.c
@@ -40,13 +40,13 @@
EFI_STATUS=0D
EFIAPI=0D
CommonFirmwareContextHartSpecificInfo (=0D
- EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *FirmwareContextHartSpecific,=0D
- EFI_GUID *ParentProcessorGuid,=0D
- UINTN ParentProcessorUid,=0D
- EFI_GUID *CoreGuid,=0D
- UINTN HartId,=0D
- BOOLEAN IsBootHart,=0D
- RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
+ EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *FirmwareContextHartSpecific,=
=0D
+ EFI_GUID *ParentProcessorGuid,=0D
+ UINTN ParentProcessorUid,=0D
+ EFI_GUID *CoreGuid,=0D
+ UINTN HartId,=0D
+ BOOLEAN IsBootHart,=0D
+ RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
)=0D
{=0D
//=0D
@@ -55,28 +55,32 @@ CommonFirmwareContextHartSpecificInfo (
CopyGuid (&ProcessorSpecificDataHob->ParentProcessorGuid, ParentProcesso=
rGuid);=0D
ProcessorSpecificDataHob->ParentProcessorUid =3D ParentProcessorUid;=0D
CopyGuid (&ProcessorSpecificDataHob->CoreGuid, CoreGuid);=0D
- ProcessorSpecificDataHob->Context =3D NULL;=0D
+ ProcessorSpecificDataHob->Context =3D NULL;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.Revision =3D=0D
SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA_REVISION;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.Length =3D=0D
sizeof (SMBIOS_RISC_V_PROCESSOR_SPECIFIC_DATA);=0D
ProcessorSpecificDataHob->ProcessorSpecificData.HartId.Value64_L =3D (UI=
NT64)HartId;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.HartId.Value64_H =3D 0;=
=0D
- ProcessorSpecificDataHob->ProcessorSpecificData.BootHartId =3D (UINT8)Is=
BootHart;=0D
+ ProcessorSpecificDataHob->ProcessorSpecificData.BootHartId =3D (UI=
NT8)IsBootHart;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.InstSetSupported =3D=0D
FirmwareContextHartSpecific->IsaExtensionSupported;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.PrivilegeModeSupported =
=3D=0D
SMBIOS_RISC_V_PSD_MACHINE_MODE_SUPPORTED;=0D
if ((ProcessorSpecificDataHob->ProcessorSpecificData.InstSetSupported &=
=0D
- RISC_V_ISA_SUPERVISOR_MODE_IMPLEMENTED) !=3D 0) {=0D
+ RISC_V_ISA_SUPERVISOR_MODE_IMPLEMENTED) !=3D 0)=0D
+ {=0D
ProcessorSpecificDataHob->ProcessorSpecificData.PrivilegeModeSupported=
|=3D=0D
SMBIOS_RISC_V_PSD_SUPERVISOR_MODE_SUPPORTED;=0D
}=0D
+=0D
if ((ProcessorSpecificDataHob->ProcessorSpecificData.InstSetSupported &=
=0D
- RISC_V_ISA_USER_MODE_IMPLEMENTED) !=3D 0) {=0D
+ RISC_V_ISA_USER_MODE_IMPLEMENTED) !=3D 0)=0D
+ {=0D
ProcessorSpecificDataHob->ProcessorSpecificData.PrivilegeModeSupported=
|=3D=0D
SMBIOS_RISC_V_PSD_USER_MODE_SUPPORTED;=0D
}=0D
+=0D
ProcessorSpecificDataHob->ProcessorSpecificData.MachineVendorId.Value64_=
L =3D=0D
FirmwareContextHartSpecific->MachineVendorId.Value64_L;=0D
ProcessorSpecificDataHob->ProcessorSpecificData.MachineVendorId.Value64_=
H =3D=0D
@@ -100,7 +104,7 @@ CommonFirmwareContextHartSpecificInfo (
VOID=0D
EFIAPI=0D
DebugPrintHartSpecificInfo (=0D
- RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
+ RISC_V_PROCESSOR_SPECIFIC_HOB_DATA *ProcessorSpecificDataHob=0D
)=0D
{=0D
DEBUG ((DEBUG_INFO, " *HartId =3D 0x%x\n", ProcessorSpecificDataH=
ob->ProcessorSpecificData.HartId.Value64_L));=0D
@@ -108,7 +112,7 @@ DebugPrintHartSpecificInfo (
DEBUG ((DEBUG_INFO, " *PrivilegeModeSupported =3D 0x%x\n", Proces=
sorSpecificDataHob->ProcessorSpecificData.PrivilegeModeSupported));=0D
DEBUG ((DEBUG_INFO, " *MModeExcepDelegation =3D 0x%x\n", Processo=
rSpecificDataHob->ProcessorSpecificData.MModeExcepDelegation.Value64_L));=0D
DEBUG ((DEBUG_INFO, " *MModeInterruptDelegation =3D 0x%x\n", Proc=
essorSpecificDataHob->ProcessorSpecificData.MModeInterruptDelegation.Value6=
4_L));=0D
- DEBUG ((DEBUG_INFO, " *HartXlen =3D 0x%x\n", ProcessorSpecificDat=
aHob->ProcessorSpecificData.HartXlen ));=0D
+ DEBUG ((DEBUG_INFO, " *HartXlen =3D 0x%x\n", ProcessorSpecificDat=
aHob->ProcessorSpecificData.HartXlen));=0D
DEBUG ((DEBUG_INFO, " *MachineModeXlen =3D 0x%x\n", ProcessorSpec=
ificDataHob->ProcessorSpecificData.MachineModeXlen));=0D
DEBUG ((DEBUG_INFO, " *SupervisorModeXlen =3D 0x%x\n", ProcessorS=
pecificDataHob->ProcessorSpecificData.SupervisorModeXlen));=0D
DEBUG ((DEBUG_INFO, " *UserModeXlen =3D 0x%x\n", ProcessorSpecifi=
cDataHob->ProcessorSpecificData.UserModeXlen));=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Opensbi=
Platform.c b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/Opensbi=
Platform.c
index c62d235333..50188d939f 100644
--- a/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatfor=
m.c
+++ b/Platform/RISC-V/PlatformPkg/Library/OpensbiPlatformLib/OpensbiPlatfor=
m.c
@@ -34,39 +34,45 @@
// SpecialPlatformArray and NumberOfSpecialPlatform are=0D
// provided by RiscVSpecialPlatformLib library.=0D
//=0D
-extern const struct platform_override *special_platforms[];=0D
-extern INTN NumberOfPlaformsInArray;=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
+static const struct platform_override *generic_plat =3D NULL;=0D
+static const struct fdt_match *generic_plat_match =3D NULL;=0D
=0D
-static void fw_platform_lookup_special(void *fdt, int root_offset)=0D
+static void=0D
+fw_platform_lookup_special (=0D
+ void *fdt,=0D
+ int root_offset=0D
+ )=0D
{=0D
- int pos, noff;=0D
- const struct platform_override *plat;=0D
- const struct fdt_match *match;=0D
+ int pos, noff;=0D
+ const struct platform_override *plat;=0D
+ const struct fdt_match *match;=0D
=0D
- if (special_platforms =3D=3D NULL || NumberOfPlaformsInArray =3D=3D 0)=
{=0D
- return;=0D
- }=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
+ if (!plat->match_table) {=0D
continue;=0D
+ }=0D
=0D
- noff =3D fdt_find_match(fdt, -1, plat->match_table, &match);=0D
- if (noff < 0)=0D
+ noff =3D fdt_find_match (fdt, -1, plat->match_table, &match);=0D
+ if (noff < 0) {=0D
continue;=0D
+ }=0D
=0D
- generic_plat =3D plat;=0D
+ generic_plat =3D plat;=0D
generic_plat_match =3D match;=0D
break;=0D
}=0D
}=0D
=0D
-extern struct sbi_platform platform;=0D
-static u32 generic_hart_index2id[SBI_HARTMASK_MAX_BITS] =3D { 0 };=0D
+extern struct sbi_platform platform;=0D
+static u32 generic_hart_index2id[SBI_HARTMASK_MAX_BITS] =
=3D { 0 };=0D
=0D
/*=0D
* The fw_platform_init() function is called very early on the boot HART=0D
@@ -81,39 +87,50 @@ static u32 generic_hart_index2id[SBI_HARTMASK_MAX_BITS]=
=3D { 0 };
* FDT is unchanged (or FDT is modified in-place) then fw_platform_init()=
=0D
* can always return the original FDT location (i.e. 'arg1') unmodified.=0D
*/=0D
-unsigned long fw_platform_init(unsigned long arg0, unsigned long arg1,=0D
- unsigned long arg2, unsigned long arg3,=0D
- unsigned long arg4)=0D
+unsigned long=0D
+fw_platform_init (=0D
+ unsigned long arg0,=0D
+ unsigned long arg1,=0D
+ unsigned long arg2,=0D
+ unsigned long arg3,=0D
+ unsigned long arg4=0D
+ )=0D
{=0D
- const char *model;=0D
- void *fdt =3D (void *)arg1;=0D
- u32 hartid, hart_count =3D 0;=0D
- int rc, root_offset, cpus_offset, cpu_offset, len;=0D
+ const char *model;=0D
+ void *fdt =3D (void *)arg1;=0D
+ u32 hartid, hart_count =3D 0;=0D
+ int rc, root_offset, cpus_offset, cpu_offset, len;=0D
=0D
- root_offset =3D fdt_path_offset(fdt, "/");=0D
- if (root_offset < 0)=0D
+ root_offset =3D fdt_path_offset (fdt, "/");=0D
+ if (root_offset < 0) {=0D
goto fail;=0D
+ }=0D
=0D
- fw_platform_lookup_special(fdt, root_offset);=0D
+ fw_platform_lookup_special (fdt, root_offset);=0D
=0D
- model =3D fdt_getprop(fdt, root_offset, "model", &len);=0D
- if (model)=0D
- sbi_strncpy(platform.name, model, sizeof(platform.name));=0D
+ model =3D fdt_getprop (fdt, root_offset, "model", &len);=0D
+ if (model) {=0D
+ sbi_strncpy (platform.name, model, sizeof (platform.name));=0D
+ }=0D
=0D
- if (generic_plat && generic_plat->features)=0D
- platform.features =3D generic_plat->features(generic_plat_match);=0D
+ if (generic_plat && generic_plat->features) {=0D
+ platform.features =3D generic_plat->features (generic_plat_match);=0D
+ }=0D
=0D
- cpus_offset =3D fdt_path_offset(fdt, "/cpus");=0D
- if (cpus_offset < 0)=0D
+ cpus_offset =3D fdt_path_offset (fdt, "/cpus");=0D
+ if (cpus_offset < 0) {=0D
goto fail;=0D
+ }=0D
=0D
- fdt_for_each_subnode(cpu_offset, fdt, cpus_offset) {=0D
- rc =3D fdt_parse_hart_id(fdt, cpu_offset, &hartid);=0D
- if (rc)=0D
+ fdt_for_each_subnode (cpu_offset, fdt, cpus_offset) {=0D
+ rc =3D fdt_parse_hart_id (fdt, cpu_offset, &hartid);=0D
+ if (rc) {=0D
continue;=0D
+ }=0D
=0D
- if (SBI_HARTMASK_MAX_BITS <=3D hartid)=0D
+ if (SBI_HARTMASK_MAX_BITS <=3D hartid) {=0D
continue;=0D
+ }=0D
=0D
generic_hart_index2id[hart_count++] =3D hartid;=0D
}=0D
@@ -124,102 +141,130 @@ unsigned long fw_platform_init(unsigned long arg0, =
unsigned long arg1,
return arg1;=0D
=0D
fail:=0D
- while (1)=0D
- wfi();=0D
+ while (1) {=0D
+ wfi ();=0D
+ }=0D
}=0D
=0D
-static int generic_early_init(bool cold_boot)=0D
+static int=0D
+generic_early_init (=0D
+ bool cold_boot=0D
+ )=0D
{=0D
- int rc;=0D
+ int rc;=0D
=0D
if (generic_plat && generic_plat->early_init) {=0D
- rc =3D generic_plat->early_init(cold_boot, generic_plat_match);=0D
- if (rc)=0D
+ rc =3D generic_plat->early_init (cold_boot, generic_plat_match);=0D
+ if (rc) {=0D
return rc;=0D
+ }=0D
}=0D
=0D
- if (!cold_boot)=0D
+ if (!cold_boot) {=0D
return 0;=0D
+ }=0D
=0D
- return fdt_reset_init();=0D
+ return fdt_reset_init ();=0D
}=0D
=0D
-static int generic_final_init(bool cold_boot)=0D
+static int=0D
+generic_final_init (=0D
+ bool cold_boot=0D
+ )=0D
{=0D
- void *fdt;=0D
- int rc;=0D
+ void *fdt;=0D
+ int rc;=0D
=0D
if (generic_plat && generic_plat->final_init) {=0D
- rc =3D generic_plat->final_init(cold_boot, generic_plat_match);=0D
- if (rc)=0D
+ rc =3D generic_plat->final_init (cold_boot, generic_plat_match);=0D
+ if (rc) {=0D
return rc;=0D
+ }=0D
}=0D
=0D
- if (!cold_boot)=0D
+ if (!cold_boot) {=0D
return 0;=0D
+ }=0D
=0D
- fdt =3D sbi_scratch_thishart_arg1_ptr();=0D
+ fdt =3D sbi_scratch_thishart_arg1_ptr ();=0D
=0D
- fdt_cpu_fixup(fdt);=0D
- fdt_fixups(fdt);=0D
- fdt_domain_fixup(fdt);=0D
+ fdt_cpu_fixup (fdt);=0D
+ fdt_fixups (fdt);=0D
+ fdt_domain_fixup (fdt);=0D
=0D
if (generic_plat && generic_plat->fdt_fixup) {=0D
- rc =3D generic_plat->fdt_fixup(fdt, generic_plat_match);=0D
- if (rc)=0D
+ rc =3D generic_plat->fdt_fixup (fdt, generic_plat_match);=0D
+ if (rc) {=0D
return rc;=0D
+ }=0D
}=0D
=0D
return 0;=0D
}=0D
=0D
-static void generic_early_exit(void)=0D
+static void=0D
+generic_early_exit (=0D
+ void=0D
+ )=0D
{=0D
- if (generic_plat && generic_plat->early_exit)=0D
- generic_plat->early_exit(generic_plat_match);=0D
+ if (generic_plat && generic_plat->early_exit) {=0D
+ generic_plat->early_exit (generic_plat_match);=0D
+ }=0D
}=0D
=0D
-static void generic_final_exit(void)=0D
+static void=0D
+generic_final_exit (=0D
+ void=0D
+ )=0D
{=0D
- if (generic_plat && generic_plat->final_exit)=0D
- generic_plat->final_exit(generic_plat_match);=0D
+ if (generic_plat && generic_plat->final_exit) {=0D
+ generic_plat->final_exit (generic_plat_match);=0D
+ }=0D
}=0D
=0D
-static int generic_domains_init(void)=0D
+static int=0D
+generic_domains_init (=0D
+ void=0D
+ )=0D
{=0D
- return fdt_domains_populate(sbi_scratch_thishart_arg1_ptr());=0D
+ return fdt_domains_populate (sbi_scratch_thishart_arg1_ptr ());=0D
}=0D
=0D
-static u64 generic_tlbr_flush_limit(void)=0D
+static u64=0D
+generic_tlbr_flush_limit (=0D
+ void=0D
+ )=0D
{=0D
- if (generic_plat && generic_plat->tlbr_flush_limit)=0D
- return generic_plat->tlbr_flush_limit(generic_plat_match);=0D
+ if (generic_plat && generic_plat->tlbr_flush_limit) {=0D
+ return generic_plat->tlbr_flush_limit (generic_plat_match);=0D
+ }=0D
+=0D
return SBI_PLATFORM_TLB_RANGE_FLUSH_LIMIT_DEFAULT;=0D
}=0D
=0D
-const struct sbi_platform_operations platform_ops =3D {=0D
- .early_init =3D generic_early_init,=0D
- .final_init =3D generic_final_init,=0D
- .early_exit =3D generic_early_exit,=0D
- .final_exit =3D generic_final_exit,=0D
- .domains_init =3D generic_domains_init,=0D
- .console_init =3D fdt_serial_init,=0D
- .irqchip_init =3D fdt_irqchip_init,=0D
- .irqchip_exit =3D fdt_irqchip_exit,=0D
- .ipi_init =3D fdt_ipi_init,=0D
- .ipi_exit =3D fdt_ipi_exit,=0D
- .get_tlbr_flush_limit =3D generic_tlbr_flush_limit,=0D
- .timer_init =3D fdt_timer_init,=0D
- .timer_exit =3D fdt_timer_exit,=0D
+const struct sbi_platform_operations platform_ops =3D {=0D
+ .early_init =3D generic_early_init,=0D
+ .final_init =3D generic_final_init,=0D
+ .early_exit =3D generic_early_exit,=0D
+ .final_exit =3D generic_final_exit,=0D
+ .domains_init =3D generic_domains_init,=0D
+ .console_init =3D fdt_serial_init,=0D
+ .irqchip_init =3D fdt_irqchip_init,=0D
+ .irqchip_exit =3D fdt_irqchip_exit,=0D
+ .ipi_init =3D fdt_ipi_init,=0D
+ .ipi_exit =3D fdt_ipi_exit,=0D
+ .get_tlbr_flush_limit =3D generic_tlbr_flush_limit,=0D
+ .timer_init =3D fdt_timer_init,=0D
+ .timer_exit =3D fdt_timer_exit,=0D
};=0D
=0D
-struct sbi_platform platform =3D {=0D
- .opensbi_version =3D OPENSBI_VERSION,=0D
- .platform_version =3D SBI_PLATFORM_VERSION(0x0, 0x01),=0D
- .name =3D "Generic",=0D
- .features =3D SBI_PLATFORM_DEFAULT_FEATURES,=0D
- .hart_count =3D SBI_HARTMASK_MAX_BITS,=0D
- .hart_index2id =3D generic_hart_index2id,=0D
- .hart_stack_size =3D FixedPcdGet32(PcdOpenSbiStackSize), // The stack=
given by SEC for each hart=0D
- .platform_ops_addr =3D (unsigned long)&platform_ops=0D
+struct sbi_platform platform =3D {=0D
+ .opensbi_version =3D OPENSBI_VERSION,=0D
+ .platform_version =3D SBI_PLATFORM_VERSION (0x0, 0x01),=0D
+ .name =3D "Generic",=0D
+ .features =3D SBI_PLATFORM_DEFAULT_FEATURES,=0D
+ .hart_count =3D SBI_HARTMASK_MAX_BITS,=0D
+ .hart_index2id =3D generic_hart_index2id,=0D
+ .hart_stack_size =3D FixedPcdGet32 (PcdOpenSbiStackSize), // The stack=
given by SEC for each hart=0D
+ .platform_ops_addr =3D (unsigned long)&platform_ops=0D
};=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/PeiCoreE=
ntryPoint.c b/Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/PeiCore=
EntryPoint.c
index 50de969947..f7d6fe140e 100644
--- a/Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoi=
nt.c
+++ b/Platform/RISC-V/PlatformPkg/Library/PeiCoreEntryPoint/PeiCoreEntryPoi=
nt.c
@@ -8,7 +8,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
=0D
**/=0D
=0D
-=0D
#include <PiPei.h>=0D
#include <IndustryStandard/RiscVOpensbi.h>=0D
//=0D
@@ -48,19 +47,19 @@ EFIAPI
_ModuleEntryPoint (=0D
IN CONST EFI_SEC_PEI_HAND_OFF *SecCoreData,=0D
IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList=0D
-)=0D
+ )=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_SEC_PEI_HAND_OFF *ThisSecCoreData;=0D
- EFI_PEI_PPI_DESCRIPTOR *ThisPpiList;=0D
- EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
+ EFI_STATUS Status;=0D
+ EFI_SEC_PEI_HAND_OFF *ThisSecCoreData;=0D
+ EFI_PEI_PPI_DESCRIPTOR *ThisPpiList;=0D
+ EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
=0D
FirmwareContext =3D (EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *)PpiList;=0D
SetFirmwareContextPointer (FirmwareContext);=0D
FirmwareContext->BootHartId =3D (UINT64)SecCoreData;=0D
=0D
ThisSecCoreData =3D (EFI_SEC_PEI_HAND_OFF *)FirmwareContext->SecPeiHandO=
ffData;=0D
- Status =3D GetPlatformPrePeiCorePpiDescriptor (&ThisPpiList);=0D
+ Status =3D GetPlatformPrePeiCorePpiDescriptor (&ThisPpiList);=0D
if (EFI_ERROR (Status)) {=0D
ThisPpiList =3D NULL;=0D
}=0D
@@ -68,16 +67,15 @@ _ModuleEntryPoint (
//=0D
// Invoke PEI Core entry point.=0D
//=0D
- ProcessModuleEntryPointList(ThisSecCoreData, ThisPpiList, NULL);=0D
+ ProcessModuleEntryPointList (ThisSecCoreData, ThisPpiList, NULL);=0D
=0D
//=0D
// Should never return=0D
//=0D
- ASSERT(FALSE);=0D
+ ASSERT (FALSE);=0D
CpuDeadLoop ();=0D
}=0D
=0D
-=0D
/**=0D
Required by the EBC compiler and identical in functionality to _ModuleEn=
tryPoint().=0D
=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/Pla=
tformBootManager.c b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManage=
rLib/PlatformBootManager.c
index 9ad4ef17db..21667f4225 100644
--- a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformBo=
otManager.c
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformBo=
otManager.c
@@ -10,8 +10,9 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
=0D
#include "PlatformBootManager.h"=0D
=0D
-=0D
-EFI_GUID mUefiShellFileGuid =3D { 0x7C04A583, 0x9E3E, 0x4f1c, {0xAD, 0x65,=
0xE0, 0x52, 0x68, 0xD0, 0xB4, 0xD1}};=0D
+EFI_GUID mUefiShellFileGuid =3D {=0D
+ 0x7C04A583, 0x9E3E, 0x4f1c, { 0xAD, 0x65, 0xE0, 0x52, 0x68, 0xD0, 0xB4, =
0xD1 }=0D
+};=0D
=0D
/**=0D
Perform the platform diagnostic, such like test memory. OEM/IBV also=0D
@@ -23,11 +24,11 @@ EFI_GUID mUefiShellFileGuid =3D { 0x7C04A583, 0x9E3E, 0=
x4f1c, {0xAD, 0x65, 0xE0, 0
**/=0D
VOID=0D
PlatformBootManagerDiagnostics (=0D
- IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,=0D
- IN BOOLEAN QuietBoot=0D
+ IN EXTENDMEM_COVERAGE_LEVEL MemoryTestLevel,=0D
+ IN BOOLEAN QuietBoot=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
+ EFI_STATUS Status;=0D
=0D
//=0D
// Here we can decide if we need to show=0D
@@ -36,7 +37,6 @@ PlatformBootManagerDiagnostics (
// from the graphic lib=0D
//=0D
if (QuietBoot) {=0D
-=0D
//=0D
// Perform system diagnostic=0D
//=0D
@@ -65,12 +65,12 @@ PlatformBootManagerDiagnostics (
**/=0D
INTN=0D
PlatformFindLoadOption (=0D
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,=0D
- IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,=0D
- IN UINTN Count=0D
+ IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Key,=0D
+ IN CONST EFI_BOOT_MANAGER_LOAD_OPTION *Array,=0D
+ IN UINTN Count=0D
)=0D
{=0D
- UINTN Index;=0D
+ UINTN Index;=0D
=0D
for (Index =3D 0; Index < Count; Index++) {=0D
if ((Key->OptionType =3D=3D Array[Index].OptionType) &&=0D
@@ -78,8 +78,9 @@ PlatformFindLoadOption (
(StrCmp (Key->Description, Array[Index].Description) =3D=3D 0) &&=
=0D
(CompareMem (Key->FilePath, Array[Index].FilePath, GetDevicePathSi=
ze (Key->FilePath)) =3D=3D 0) &&=0D
(Key->OptionalDataSize =3D=3D Array[Index].OptionalDataSize) &&=0D
- (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->Op=
tionalDataSize) =3D=3D 0)) {=0D
- return (INTN) Index;=0D
+ (CompareMem (Key->OptionalData, Array[Index].OptionalData, Key->Op=
tionalDataSize) =3D=3D 0))=0D
+ {=0D
+ return (INTN)Index;=0D
}=0D
}=0D
=0D
@@ -95,27 +96,27 @@ PlatformFindLoadOption (
**/=0D
VOID=0D
PlatformRegisterFvBootOption (=0D
- EFI_GUID *FileGuid,=0D
- CHAR16 *Description,=0D
- UINT32 Attributes=0D
+ EFI_GUID *FileGuid,=0D
+ CHAR16 *Description,=0D
+ UINT32 Attributes=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- UINTN OptionIndex;=0D
- EFI_BOOT_MANAGER_LOAD_OPTION NewOption;=0D
- EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;=0D
- UINTN BootOptionCount;=0D
- MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;=0D
- EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;=0D
- EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D
-=0D
- Status =3D gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageProtocolGu=
id, (VOID **) &LoadedImage);=0D
+ EFI_STATUS Status;=0D
+ UINTN OptionIndex;=0D
+ EFI_BOOT_MANAGER_LOAD_OPTION NewOption;=0D
+ EFI_BOOT_MANAGER_LOAD_OPTION *BootOptions;=0D
+ UINTN BootOptionCount;=0D
+ MEDIA_FW_VOL_FILEPATH_DEVICE_PATH FileNode;=0D
+ EFI_LOADED_IMAGE_PROTOCOL *LoadedImage;=0D
+ EFI_DEVICE_PATH_PROTOCOL *DevicePath;=0D
+=0D
+ Status =3D gBS->HandleProtocol (gImageHandle, &gEfiLoadedImageProtocolGu=
id, (VOID **)&LoadedImage);=0D
ASSERT_EFI_ERROR (Status);=0D
=0D
EfiInitializeFwVolDevicepathNode (&FileNode, FileGuid);=0D
DevicePath =3D AppendDevicePathNode (=0D
DevicePathFromHandle (LoadedImage->DeviceHandle),=0D
- (EFI_DEVICE_PATH_PROTOCOL *) &FileNode=0D
+ (EFI_DEVICE_PATH_PROTOCOL *)&FileNode=0D
);=0D
=0D
Status =3D EfiBootManagerInitializeLoadOption (=0D
@@ -134,9 +135,10 @@ PlatformRegisterFvBootOption (
OptionIndex =3D PlatformFindLoadOption (&NewOption, BootOptions, BootO=
ptionCount);=0D
=0D
if (OptionIndex =3D=3D -1) {=0D
- Status =3D EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN) =
-1);=0D
+ Status =3D EfiBootManagerAddLoadOptionVariable (&NewOption, (UINTN)-=
1);=0D
ASSERT_EFI_ERROR (Status);=0D
}=0D
+=0D
EfiBootManagerFreeLoadOption (&NewOption);=0D
EfiBootManagerFreeLoadOptions (BootOptions, BootOptionCount);=0D
}=0D
@@ -156,11 +158,11 @@ PlatformBootManagerBeforeConsole (
VOID=0D
)=0D
{=0D
- UINTN Index;=0D
- EFI_STATUS Status;=0D
- EFI_INPUT_KEY Enter;=0D
- EFI_INPUT_KEY F2;=0D
- EFI_BOOT_MANAGER_LOAD_OPTION BootOption;=0D
+ UINTN Index;=0D
+ EFI_STATUS Status;=0D
+ EFI_INPUT_KEY Enter;=0D
+ EFI_INPUT_KEY F2;=0D
+ EFI_BOOT_MANAGER_LOAD_OPTION BootOption;=0D
=0D
//=0D
// Signal EndOfDxe PI Event=0D
@@ -200,7 +202,7 @@ PlatformBootManagerBeforeConsole (
F2.ScanCode =3D SCAN_F2;=0D
F2.UnicodeChar =3D CHAR_NULL;=0D
EfiBootManagerGetBootManagerMenu (&BootOption);=0D
- EfiBootManagerAddKeyOptionVariable (NULL, (UINT16) BootOption.OptionNumb=
er, 0, &F2, NULL);=0D
+ EfiBootManagerAddKeyOptionVariable (NULL, (UINT16)BootOption.OptionNumbe=
r, 0, &F2, NULL);=0D
//=0D
// Register UEFI Shell=0D
//=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/Pla=
tformData.c b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/Pl=
atformData.c
index c1dbbf451e..4a79c6ca71 100644
--- a/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformDa=
ta.c
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformBootManagerLib/PlatformDa=
ta.c
@@ -14,13 +14,15 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
//=0D
// Platform specific serial device path=0D
//=0D
-SERIAL_CONSOLE_DEVICE_PATH gSerialConsoleDevicePath0 =3D {=0D
+SERIAL_CONSOLE_DEVICE_PATH gSerialConsoleDevicePath0 =3D {=0D
{=0D
- { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, { sizeof (VENDOR_DEVICE_PATH), 0=
} },=0D
+ { HARDWARE_DEVICE_PATH, HW_VENDOR_DP, { sizeof (VEN=
DOR_DEVICE_PATH), 0 }=0D
+ },=0D
EFI_SERIAL_DXE_GUID // Use the driver's GUID=0D
},=0D
{=0D
- { MESSAGING_DEVICE_PATH, MSG_UART_DP, { sizeof (UART_DEVICE_PATH), 0} =
},=0D
+ { MESSAGING_DEVICE_PATH, MSG_UART_DP, { sizeof (UAR=
T_DEVICE_PATH), 0 }=0D
+ },=0D
0, // Reserved=0D
115200, // BaudRate=0D
8, // DataBits=0D
@@ -28,18 +30,20 @@ SERIAL_CONSOLE_DEVICE_PATH gSerialConsoleDevicePath0 =
=3D {
1 // StopBits=0D
},=0D
{=0D
- { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, { sizeof (VENDOR_DEVICE_PATH),=
0} },=0D
+ { MESSAGING_DEVICE_PATH, MSG_VENDOR_DP, { sizeof (VEN=
DOR_DEVICE_PATH), 0 }=0D
+ },=0D
DEVICE_PATH_MESSAGING_PC_ANSI=0D
},=0D
- { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_DE=
VICE_PATH_PROTOCOL), 0 } }=0D
+ { END_DEVICE_PATH_TYPE, END_ENTIRE_DEVICE_PATH_SUBTYPE, { sizeof (EFI_D=
EVICE_PATH_PROTOCOL), 0 }=0D
+ }=0D
};=0D
=0D
//=0D
// Predefined platform default console device path=0D
//=0D
-PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] =3D {=0D
+PLATFORM_CONSOLE_CONNECT_ENTRY gPlatformConsole[] =3D {=0D
{=0D
- (EFI_DEVICE_PATH_PROTOCOL *) &gSerialConsoleDevicePath0,=0D
+ (EFI_DEVICE_PATH_PROTOCOL *)&gSerialConsoleDevicePath0,=0D
CONSOLE_OUT | CONSOLE_IN=0D
},=0D
{=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/PlatformMemoryTestLibNull/=
PlatformMemoryTestLibNull.c b/Platform/RISC-V/PlatformPkg/Library/PlatformM=
emoryTestLibNull/PlatformMemoryTestLibNull.c
index 9246070787..24cc01cb18 100644
--- a/Platform/RISC-V/PlatformPkg/Library/PlatformMemoryTestLibNull/Platfor=
mMemoryTestLibNull.c
+++ b/Platform/RISC-V/PlatformPkg/Library/PlatformMemoryTestLibNull/Platfor=
mMemoryTestLibNull.c
@@ -22,7 +22,7 @@
**/=0D
EFI_STATUS=0D
PlatformBootManagerMemoryTest (=0D
- IN EXTENDMEM_COVERAGE_LEVEL Level=0D
+ IN EXTENDMEM_COVERAGE_LEVEL Level=0D
)=0D
{=0D
return EFI_SUCCESS;=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystem=
Lib.c b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c
index 67e40151d1..524b0a6353 100644
--- a/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c
+++ b/Platform/RISC-V/PlatformPkg/Library/ResetSystemLib/ResetSystemLib.c
@@ -74,8 +74,8 @@ ResetShutdown (
VOID=0D
EFIAPI=0D
ResetPlatformSpecific (=0D
- IN UINTN DataSize,=0D
- IN VOID *ResetData=0D
+ IN UINTN DataSize,=0D
+ IN VOID *ResetData=0D
)=0D
{=0D
//=0D
@@ -99,30 +99,30 @@ ResetPlatformSpecific (
VOID=0D
EFIAPI=0D
ResetSystem (=0D
- IN EFI_RESET_TYPE ResetType,=0D
- IN EFI_STATUS ResetStatus,=0D
- IN UINTN DataSize,=0D
- IN VOID *ResetData OPTIONAL=0D
+ IN EFI_RESET_TYPE ResetType,=0D
+ IN EFI_STATUS ResetStatus,=0D
+ IN UINTN DataSize,=0D
+ IN VOID *ResetData OPTIONAL=0D
)=0D
{=0D
switch (ResetType) {=0D
- case EfiResetWarm:=0D
- ResetWarm ();=0D
- break;=0D
+ case EfiResetWarm:=0D
+ ResetWarm ();=0D
+ break;=0D
=0D
- case EfiResetCold:=0D
- ResetCold ();=0D
- break;=0D
+ case EfiResetCold:=0D
+ ResetCold ();=0D
+ break;=0D
=0D
- case EfiResetShutdown:=0D
- ResetShutdown ();=0D
- return;=0D
+ case EfiResetShutdown:=0D
+ ResetShutdown ();=0D
+ return;=0D
=0D
- case EfiResetPlatformSpecific:=0D
- ResetPlatformSpecific (DataSize, ResetData);=0D
- return;=0D
+ case EfiResetPlatformSpecific:=0D
+ ResetPlatformSpecific (DataSize, ResetData);=0D
+ return;=0D
=0D
- default:=0D
- return;=0D
+ default:=0D
+ return;=0D
}=0D
}=0D
diff --git a/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLibNul=
l/RiscVSpecialPlatformLib.c b/Platform/RISC-V/PlatformPkg/Library/RiscVSpec=
ialPlatformLibNull/RiscVSpecialPlatformLib.c
index 44f6ad6aed..77990c7350 100644
--- a/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLibNull/RiscV=
SpecialPlatformLib.c
+++ b/Platform/RISC-V/PlatformPkg/Library/RiscVSpecialPlatformLibNull/RiscV=
SpecialPlatformLib.c
@@ -14,7 +14,6 @@
//=0D
#include <Library/RiscVSpecialPlatformLib.h>=0D
=0D
-const struct platform_override *special_platforms =3D NULL;=0D
-const struct platform_override *SpecialPlatformArray =3D NULL;=0D
-INTN NumberOfPlaformsInArray =3D 0;=0D
-=0D
+const struct platform_override *special_platforms =3D NULL;=0D
+const struct platform_override *SpecialPlatformArray =3D NULL;=0D
+INTN NumberOfPlaformsInArray =3D 0;=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c b/Plat=
form/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c
index 3487a5faf4..c56dc4e545 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/FdtPeim/FdtPeim.c
@@ -28,38 +28,40 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
EFI_STATUS=0D
EFIAPI=0D
PeimPassFdt (=0D
- IN EFI_PEI_FILE_HANDLE FileHandle,=0D
- IN CONST EFI_PEI_SERVICES **PeiServices=0D
+ IN EFI_PEI_FILE_HANDLE FileHandle,=0D
+ IN CONST EFI_PEI_SERVICES **PeiServices=0D
)=0D
{=0D
- VOID *FdtPointer;=0D
- VOID *Base;=0D
- VOID *NewBase;=0D
- UINTN FdtSize;=0D
- UINTN FdtPages;=0D
- UINT64 *FdtHobData;=0D
- EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
+ VOID *FdtPointer;=0D
+ VOID *Base;=0D
+ VOID *NewBase;=0D
+ UINTN FdtSize;=0D
+ UINTN FdtPages;=0D
+ UINT64 *FdtHobData;=0D
+ EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT *FirmwareContext;=0D
=0D
FirmwareContext =3D NULL;=0D
GetFirmwareContextPointer (&FirmwareContext);=0D
=0D
if (FirmwareContext =3D=3D NULL) {=0D
- DEBUG((DEBUG_ERROR, "%a: OpenSBI Firmware Context is NULL\n", __FUNCTI=
ON__));=0D
+ DEBUG ((DEBUG_ERROR, "%a: OpenSBI Firmware Context is NULL\n", __FUNCT=
ION__));=0D
return EFI_UNSUPPORTED;=0D
}=0D
+=0D
FdtPointer =3D (VOID *)FirmwareContext->FlattenedDeviceTree;=0D
if (FdtPointer =3D=3D NULL) {=0D
- DEBUG((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __FUNCTION__));=0D
+ DEBUG ((DEBUG_ERROR, "%a: Invalid FDT pointer\n", __FUNCTION__));=0D
return EFI_UNSUPPORTED;=0D
}=0D
- DEBUG((DEBUG_ERROR, "%a: Build FDT HOB - FDT at address: 0x%x \n", __FUN=
CTION__, FdtPointer));=0D
+=0D
+ DEBUG ((DEBUG_ERROR, "%a: Build FDT HOB - FDT at address: 0x%x \n", __FU=
NCTION__, FdtPointer));=0D
Base =3D FdtPointer;=0D
ASSERT (Base !=3D NULL);=0D
ASSERT (fdt_check_header (Base) =3D=3D 0);=0D
=0D
- FdtSize =3D fdt_totalsize (Base);=0D
+ FdtSize =3D fdt_totalsize (Base);=0D
FdtPages =3D EFI_SIZE_TO_PAGES (FdtSize);=0D
- NewBase =3D AllocatePages (FdtPages);=0D
+ NewBase =3D AllocatePages (FdtPages);=0D
ASSERT (NewBase !=3D NULL);=0D
fdt_open_into (Base, NewBase, EFI_PAGES_TO_SIZE (FdtPages));=0D
=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Fv.c b/P=
latform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Fv.c
index 060d66238d..28a454a72c 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Fv.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Fv.c
@@ -32,16 +32,19 @@ PeiFvInitialization (
// Let DXE know about the DXE FV=0D
//=0D
BuildFvHob (PcdGet32 (PcdRiscVDxeFvBase), PcdGet32 (PcdRiscVDxeFvSize));=
=0D
- DEBUG ((DEBUG_INFO, "Platform builds DXE FV at %x, size %x.\n",=0D
+ DEBUG ((=0D
+ DEBUG_INFO,=0D
+ "Platform builds DXE FV at %x, size %x.\n",=0D
PcdGet32 (PcdRiscVDxeFvBase),=0D
- PcdGet32 (PcdRiscVDxeFvSize)));=0D
+ PcdGet32 (PcdRiscVDxeFvSize)=0D
+ ));=0D
=0D
//=0D
// Let PEI know about the DXE FV so it can find the DXE Core=0D
//=0D
PeiServicesInstallFvInfoPpi (=0D
NULL,=0D
- (VOID *)(UINTN) PcdGet32 (PcdRiscVDxeFvBase),=0D
+ (VOID *)(UINTN)PcdGet32 (PcdRiscVDxeFvBase),=0D
PcdGet32 (PcdRiscVDxeFvSize),=0D
NULL,=0D
NULL=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetec=
t.c b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetect.c
index 9b52eb5189..3e579bfbf5 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetect.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/MemDetect.c
@@ -30,7 +30,6 @@ Module Name:
=0D
#include "Platform.h"=0D
=0D
-=0D
/**=0D
Publish PEI core memory.=0D
=0D
@@ -42,23 +41,23 @@ PublishPeiMemory (
VOID=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_PHYSICAL_ADDRESS MemoryBase;=0D
- UINT64 MemorySize;=0D
+ EFI_STATUS Status;=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase;=0D
+ UINT64 MemorySize;=0D
=0D
//=0D
// TODO: This value should come from platform=0D
// configuration or the memory sizing code.=0D
//=0D
MemoryBase =3D 0x80000000UL + 0x1000000UL;=0D
- MemorySize =3D 0x40000000UL - 0x1000000UL; //1GB - 16MB=0D
+ MemorySize =3D 0x40000000UL - 0x1000000UL; // 1GB - 16MB=0D
=0D
- DEBUG((DEBUG_INFO, "%a: MemoryBase:0x%x MemorySize:%x\n", __FUNCTION__, =
MemoryBase, MemorySize));=0D
+ DEBUG ((DEBUG_INFO, "%a: MemoryBase:0x%x MemorySize:%x\n", __FUNCTION__,=
MemoryBase, MemorySize));=0D
=0D
//=0D
// Publish this memory to the PEI Core=0D
//=0D
- Status =3D PublishSystemMemory(MemoryBase, MemorySize);=0D
+ Status =3D PublishSystemMemory (MemoryBase, MemorySize);=0D
ASSERT_EFI_ERROR (Status);=0D
=0D
return Status;=0D
@@ -77,5 +76,5 @@ InitializeRamRegions (
// TODO: This value should come from platform=0D
// configuration or the memory sizing code.=0D
//=0D
- AddMemoryRangeHob(0x81000000UL, 0x81000000UL + 0x3F000000UL);=0D
+ AddMemoryRangeHob (0x81000000UL, 0x81000000UL + 0x3F000000UL);=0D
}=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform=
.c b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c
index c28b2ed373..32dcdce668 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/Pei/PlatformPei/Platform.c
@@ -32,7 +32,7 @@
=0D
#include "Platform.h"=0D
=0D
-EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D {=0D
+EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation[] =3D {=0D
{ EfiACPIMemoryNVS, 0x004 },=0D
{ EfiACPIReclaimMemory, 0x008 },=0D
{ EfiReservedMemoryType, 0x004 },=0D
@@ -43,8 +43,7 @@ EFI_MEMORY_TYPE_INFORMATION mDefaultMemoryTypeInformation=
[] =3D {
{ EfiMaxMemoryType, 0x000 }=0D
};=0D
=0D
-=0D
-EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D {=0D
+EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D {=0D
{=0D
EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,=0D
&gEfiPeiMasterBootModePpiGuid,=0D
@@ -52,7 +51,7 @@ EFI_PEI_PPI_DESCRIPTOR mPpiBootMode[] =3D {
}=0D
};=0D
=0D
-STATIC EFI_BOOT_MODE mBootMode =3D BOOT_WITH_FULL_CONFIGURATION;=0D
+STATIC EFI_BOOT_MODE mBootMode =3D BOOT_WITH_FULL_CONFIGURATION;=0D
=0D
/**=0D
Build memory map I/O range resource HOB using the=0D
@@ -64,16 +63,16 @@ STATIC EFI_BOOT_MODE mBootMode =3D BOOT_WITH_FULL_CONFI=
GURATION;
**/=0D
VOID=0D
AddIoMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
)=0D
{=0D
BuildResourceDescriptorHob (=0D
EFI_RESOURCE_MEMORY_MAPPED_IO,=0D
- EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
MemoryBase,=0D
MemorySize=0D
);=0D
@@ -88,16 +87,16 @@ AddIoMemoryBaseSizeHob (
**/=0D
VOID=0D
AddReservedMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
)=0D
{=0D
BuildResourceDescriptorHob (=0D
EFI_RESOURCE_MEMORY_RESERVED,=0D
- EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
MemoryBase,=0D
MemorySize=0D
);=0D
@@ -113,8 +112,8 @@ AddReservedMemoryBaseSizeHob (
**/=0D
VOID=0D
AddIoMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
)=0D
{=0D
AddIoMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));=
=0D
@@ -130,19 +129,19 @@ AddIoMemoryRangeHob (
**/=0D
VOID=0D
AddMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
)=0D
{=0D
BuildResourceDescriptorHob (=0D
EFI_RESOURCE_SYSTEM_MEMORY,=0D
- EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_TESTED,=0D
MemoryBase,=0D
MemorySize=0D
);=0D
@@ -158,8 +157,8 @@ AddMemoryBaseSizeHob (
**/=0D
VOID=0D
AddMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
)=0D
{=0D
AddMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryBase));=0D
@@ -175,18 +174,18 @@ AddMemoryRangeHob (
**/=0D
VOID=0D
AddUntestedMemoryBaseSizeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- UINT64 MemorySize=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ UINT64 MemorySize=0D
)=0D
{=0D
BuildResourceDescriptorHob (=0D
EFI_RESOURCE_SYSTEM_MEMORY,=0D
- EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
- EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
- EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |=0D
- EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE,=0D
+ EFI_RESOURCE_ATTRIBUTE_PRESENT |=0D
+ EFI_RESOURCE_ATTRIBUTE_INITIALIZED |=0D
+ EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |=0D
+ EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE,=0D
MemoryBase,=0D
MemorySize=0D
);=0D
@@ -202,8 +201,8 @@ AddUntestedMemoryBaseSizeHob (
**/=0D
VOID=0D
AddUntestedMemoryRangeHob (=0D
- EFI_PHYSICAL_ADDRESS MemoryBase,=0D
- EFI_PHYSICAL_ADDRESS MemoryLimit=0D
+ EFI_PHYSICAL_ADDRESS MemoryBase,=0D
+ EFI_PHYSICAL_ADDRESS MemoryLimit=0D
)=0D
{=0D
AddUntestedMemoryBaseSizeHob (MemoryBase, (UINT64)(MemoryLimit - MemoryB=
ase));=0D
@@ -238,7 +237,7 @@ MemMapInitialization (
BuildGuidDataHob (=0D
&gEfiMemoryTypeInformationGuid,=0D
mDefaultMemoryTypeInformation,=0D
- sizeof(mDefaultMemoryTypeInformation)=0D
+ sizeof (mDefaultMemoryTypeInformation)=0D
);=0D
=0D
//=0D
@@ -280,7 +279,7 @@ CheckResumeFromS3 (
)=0D
{=0D
//=0D
- //Platform implementation-specific=0D
+ // Platform implementation-specific=0D
//=0D
return FALSE;=0D
}=0D
@@ -294,13 +293,14 @@ BootModeInitialization (
VOID=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
+ EFI_STATUS Status;=0D
=0D
if (CheckResumeFromS3) {=0D
DEBUG ((DEBUG_INFO, "This is wake from S3\n"));=0D
} else {=0D
DEBUG ((DEBUG_INFO, "This is normal boot\n"));=0D
}=0D
+=0D
Status =3D PeiServicesSetBootMode (mBootMode);=0D
ASSERT_EFI_ERROR (Status);=0D
=0D
@@ -317,7 +317,7 @@ BootModeInitialization (
EFI_STATUS=0D
BuildCoreInformationHob (=0D
VOID=0D
-)=0D
+ )=0D
{=0D
return BuildRiscVSmbiosHobs ();=0D
}=0D
@@ -338,7 +338,7 @@ InitializePlatform (
IN CONST EFI_PEI_SERVICES **PeiServices=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
+ EFI_STATUS Status;=0D
=0D
DEBUG ((DEBUG_INFO, "Platform PEIM Loaded\n"));=0D
=0D
@@ -358,7 +358,8 @@ InitializePlatform (
Status =3D BuildCoreInformationHob ();=0D
if (EFI_ERROR (Status)) {=0D
DEBUG ((DEBUG_ERROR, "Fail to build processor information HOB.\n"));=0D
- ASSERT(FALSE);=0D
+ ASSERT (FALSE);=0D
}=0D
+=0D
return EFI_SUCCESS;=0D
}=0D
diff --git a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c b/Platform=
/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
index 7a79eeec2d..c488f03a6a 100644
--- a/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
+++ b/Platform/RISC-V/PlatformPkg/Universal/Sec/SecMain.c
@@ -1,7 +1,7 @@
/** @file=0D
RISC-V SEC phase module.=0D
=0D
- Copyright (c) 2021, Hewlett Packard Enterprise Development LP. All right=
s reserved.<BR>=0D
+ Copyright (c) 2021-2022, Hewlett Packard Enterprise Development LP. All =
rights reserved.<BR>=0D
=0D
SPDX-License-Identifier: BSD-2-Clause-Patent=0D
=0D
@@ -28,8 +28,8 @@
//=0D
// Indicates the boot hart (PcdBootHartId) OpenSBI initialization is done.=
=0D
//=0D
-atomic_t BootHartDone =3D ATOMIC_INITIALIZER(0);=0D
-atomic_t NonBootHartMessageLock =3D ATOMIC_INITIALIZER(0);=0D
+atomic_t BootHartDone =3D ATOMIC_INITIALIZER (0);=0D
+atomic_t NonBootHartMessageLock =3D ATOMIC_INITIALIZER (0);=0D
=0D
/**=0D
Locates a section within a series of sections=0D
@@ -51,34 +51,35 @@ atomic_t NonBootHartMessageLock =3D ATOMIC_INITIALIZER(=
0);
**/=0D
EFI_STATUS=0D
FindFfsSectionInstance (=0D
- IN VOID *Sections,=0D
- IN UINTN SizeOfSections,=0D
- IN EFI_SECTION_TYPE SectionType,=0D
- IN UINTN Instance,=0D
- OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
+ IN VOID *Sections,=0D
+ IN UINTN SizeOfSections,=0D
+ IN EFI_SECTION_TYPE SectionType,=0D
+ IN UINTN Instance,=0D
+ OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
)=0D
{=0D
- EFI_PHYSICAL_ADDRESS CurrentAddress;=0D
- UINT32 Size;=0D
- EFI_PHYSICAL_ADDRESS EndOfSections;=0D
- EFI_COMMON_SECTION_HEADER *Section;=0D
- EFI_PHYSICAL_ADDRESS EndOfSection;=0D
+ EFI_PHYSICAL_ADDRESS CurrentAddress;=0D
+ UINT32 Size;=0D
+ EFI_PHYSICAL_ADDRESS EndOfSections;=0D
+ EFI_COMMON_SECTION_HEADER *Section;=0D
+ EFI_PHYSICAL_ADDRESS EndOfSection;=0D
=0D
//=0D
// Loop through the FFS file sections within the PEI Core FFS file=0D
//=0D
- EndOfSection =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Sections;=0D
+ EndOfSection =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Sections;=0D
EndOfSections =3D EndOfSection + SizeOfSections;=0D
- for (;;) {=0D
+ for ( ; ;) {=0D
if (EndOfSection =3D=3D EndOfSections) {=0D
break;=0D
}=0D
+=0D
CurrentAddress =3D (EndOfSection + 3) & ~(3ULL);=0D
if (CurrentAddress >=3D EndOfSections) {=0D
return EFI_VOLUME_CORRUPTED;=0D
}=0D
=0D
- Section =3D (EFI_COMMON_SECTION_HEADER*)(UINTN) CurrentAddress;=0D
+ Section =3D (EFI_COMMON_SECTION_HEADER *)(UINTN)CurrentAddress;=0D
=0D
Size =3D SECTION_SIZE (Section);=0D
if (Size < sizeof (*Section)) {=0D
@@ -122,10 +123,10 @@ FindFfsSectionInstance (
**/=0D
EFI_STATUS=0D
FindFfsSectionInSections (=0D
- IN VOID *Sections,=0D
- IN UINTN SizeOfSections,=0D
- IN EFI_SECTION_TYPE SectionType,=0D
- OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
+ IN VOID *Sections,=0D
+ IN UINTN SizeOfSections,=0D
+ IN EFI_SECTION_TYPE SectionType,=0D
+ OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
)=0D
{=0D
return FindFfsSectionInstance (=0D
@@ -153,18 +154,18 @@ FindFfsSectionInSections (
**/=0D
EFI_STATUS=0D
FindFfsFileAndSection (=0D
- IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D
- IN EFI_FV_FILETYPE FileType,=0D
- IN EFI_SECTION_TYPE SectionType,=0D
- OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
+ IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D
+ IN EFI_FV_FILETYPE FileType,=0D
+ IN EFI_SECTION_TYPE SectionType,=0D
+ OUT EFI_COMMON_SECTION_HEADER **FoundSection=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_PHYSICAL_ADDRESS CurrentAddress;=0D
- EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume;=0D
- EFI_FFS_FILE_HEADER *File;=0D
- UINT32 Size;=0D
- EFI_PHYSICAL_ADDRESS EndOfFile;=0D
+ EFI_STATUS Status;=0D
+ EFI_PHYSICAL_ADDRESS CurrentAddress;=0D
+ EFI_PHYSICAL_ADDRESS EndOfFirmwareVolume;=0D
+ EFI_FFS_FILE_HEADER *File;=0D
+ UINT32 Size;=0D
+ EFI_PHYSICAL_ADDRESS EndOfFile;=0D
=0D
DEBUG ((DEBUG_INFO, "%a: DBT FV at 0x%x\n", __FUNCTION__, Fv));=0D
=0D
@@ -173,22 +174,21 @@ FindFfsFileAndSection (
return EFI_VOLUME_CORRUPTED;=0D
}=0D
=0D
- CurrentAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN) Fv;=0D
+ CurrentAddress =3D (EFI_PHYSICAL_ADDRESS)(UINTN)Fv;=0D
EndOfFirmwareVolume =3D CurrentAddress + Fv->FvLength;=0D
=0D
//=0D
// Loop through the FFS files in the Boot Firmware Volume=0D
//=0D
for (EndOfFile =3D CurrentAddress + Fv->HeaderLength; ; ) {=0D
-=0D
CurrentAddress =3D (EndOfFile + 7) & ~(7ULL);=0D
if (CurrentAddress > EndOfFirmwareVolume) {=0D
DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D
return EFI_VOLUME_CORRUPTED;=0D
}=0D
=0D
- File =3D (EFI_FFS_FILE_HEADER*)(UINTN) CurrentAddress;=0D
- Size =3D *(UINT32*) File->Size & 0xffffff;=0D
+ File =3D (EFI_FFS_FILE_HEADER *)(UINTN)CurrentAddress;=0D
+ Size =3D *(UINT32 *)File->Size & 0xffffff;=0D
if (Size < (sizeof (*File) + sizeof (EFI_COMMON_SECTION_HEADER))) {=0D
DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D
return EFI_VOLUME_CORRUPTED;=0D
@@ -209,19 +209,21 @@ FindFfsFileAndSection (
}=0D
=0D
Status =3D FindFfsSectionInSections (=0D
- (VOID*) (File + 1),=0D
- (UINTN) EndOfFile - (UINTN) (File + 1),=0D
+ (VOID *)(File + 1),=0D
+ (UINTN)EndOfFile - (UINTN)(File + 1),=0D
SectionType,=0D
FoundSection=0D
);=0D
- if (!EFI_ERROR(Status)) {=0D
+ if (!EFI_ERROR (Status)) {=0D
DEBUG ((DEBUG_INFO, "%a: Get firmware file section\n", __FUNCTION__)=
);=0D
return Status;=0D
}=0D
+=0D
if (Status =3D=3D EFI_VOLUME_CORRUPTED) {=0D
DEBUG ((DEBUG_ERROR, "%a: FV corrupted\n", __FUNCTION__));=0D
return Status;=0D
}=0D
+=0D
DEBUG ((DEBUG_INFO, "%a: Find next FFS\n", __FUNCTION__));=0D
}=0D
}=0D
@@ -239,12 +241,12 @@ FindFfsFileAndSection (
**/=0D
EFI_STATUS=0D
FindPeiCoreImageBaseInFv (=0D
- IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D
- OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase=0D
+ IN EFI_FIRMWARE_VOLUME_HEADER *Fv,=0D
+ OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_COMMON_SECTION_HEADER *Section;=0D
+ EFI_STATUS Status;=0D
+ EFI_COMMON_SECTION_HEADER *Section;=0D
=0D
Status =3D FindFfsFileAndSection (=0D
Fv,=0D
@@ -264,6 +266,7 @@ FindPeiCoreImageBaseInFv (
return Status;=0D
}=0D
}=0D
+=0D
DEBUG ((DEBUG_INFO, "%a: PeiCoreImageBase found\n", __FUNCTION__));=0D
*PeiCoreImageBase =3D (EFI_PHYSICAL_ADDRESS)(UINTN)(Section + 1);=0D
return EFI_SUCCESS;=0D
@@ -278,8 +281,8 @@ FindPeiCoreImageBaseInFv (
**/=0D
VOID=0D
FindPeiCoreImageBase (=0D
- IN OUT EFI_FIRMWARE_VOLUME_HEADER **BootFv,=0D
- OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase=0D
+ IN OUT EFI_FIRMWARE_VOLUME_HEADER **BootFv,=0D
+ OUT EFI_PHYSICAL_ADDRESS *PeiCoreImageBase=0D
)=0D
{=0D
*PeiCoreImageBase =3D 0;=0D
@@ -301,12 +304,12 @@ FindPeiCoreImageBase (
**/=0D
VOID=0D
FindAndReportEntryPoints (=0D
- IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr,=0D
- OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint=0D
+ IN EFI_FIRMWARE_VOLUME_HEADER **BootFirmwareVolumePtr,=0D
+ OUT EFI_PEI_CORE_ENTRY_POINT *PeiCoreEntryPoint=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_PHYSICAL_ADDRESS PeiCoreImageBase;=0D
+ EFI_STATUS Status;=0D
+ EFI_PHYSICAL_ADDRESS PeiCoreImageBase;=0D
=0D
DEBUG ((DEBUG_INFO, "%a: Entry\n", __FUNCTION__));=0D
=0D
@@ -314,10 +317,11 @@ FindAndReportEntryPoints (
//=0D
// Find PEI Core entry point=0D
//=0D
- Status =3D PeCoffLoaderGetEntryPoint ((VOID *) (UINTN) PeiCoreImageBase,=
(VOID**) PeiCoreEntryPoint);=0D
- if (EFI_ERROR(Status)) {=0D
+ Status =3D PeCoffLoaderGetEntryPoint ((VOID *)(UINTN)PeiCoreImageBase, (=
VOID **)PeiCoreEntryPoint);=0D
+ if (EFI_ERROR (Status)) {=0D
*PeiCoreEntryPoint =3D 0;=0D
}=0D
+=0D
DEBUG ((DEBUG_INFO, "%a: PeCoffLoaderGetEntryPoint success: %x\n", __FUN=
CTION__, *PeiCoreEntryPoint));=0D
=0D
return;=0D
@@ -341,36 +345,36 @@ FindAndReportEntryPoints (
**/=0D
int=0D
SbiEcallFirmwareHandler (=0D
- IN unsigned long ExtId,=0D
- IN unsigned long FuncId,=0D
- IN CONST struct sbi_trap_regs *TrapRegs,=0D
- OUT unsigned long *OutVal,=0D
- OUT struct sbi_trap_info *OutTrap=0D
+ IN unsigned long ExtId,=0D
+ IN unsigned long FuncId,=0D
+ IN CONST struct sbi_trap_regs *TrapRegs,=0D
+ OUT unsigned long *OutVal,=0D
+ OUT struct sbi_trap_info *OutTrap=0D
)=0D
{=0D
- int Ret;=0D
+ int Ret;=0D
=0D
Ret =3D SBI_OK;=0D
switch (FuncId) {=0D
case SBI_EXT_FW_MSCRATCH_FUNC:=0D
- *OutVal =3D (unsigned long) sbi_scratch_thishart_ptr();=0D
+ *OutVal =3D (unsigned long)sbi_scratch_thishart_ptr ();=0D
break;=0D
case SBI_EXT_FW_MSCRATCH_HARTID_FUNC:=0D
- *OutVal =3D (unsigned long) sbi_hartid_to_scratch (TrapRegs->a0);=0D
+ *OutVal =3D (unsigned long)sbi_hartid_to_scratch (TrapRegs->a0);=0D
break;=0D
default:=0D
Ret =3D SBI_ENOTSUPP;=0D
DEBUG ((DEBUG_ERROR, "%a: Called SBI firmware ecall with invalid fun=
ction ID\n", __FUNCTION__));=0D
ASSERT (FALSE);=0D
- };=0D
+ }=0D
=0D
return Ret;=0D
}=0D
=0D
-struct sbi_ecall_extension FirmwareEcall =3D {=0D
+struct sbi_ecall_extension FirmwareEcall =3D {=0D
.extid_start =3D SBI_EDK2_FW_EXT,=0D
- .extid_end =3D SBI_EDK2_FW_EXT,=0D
- .handle =3D SbiEcallFirmwareHandler,=0D
+ .extid_end =3D SBI_EDK2_FW_EXT,=0D
+ .handle =3D SbiEcallFirmwareHandler,=0D
};=0D
=0D
/** Register EDK2's SBI extension with OpenSBI=0D
@@ -388,20 +392,20 @@ RegisterFirmwareSbiExtension (
VOID=0D
)=0D
{=0D
- UINTN Ret;=0D
- Ret =3D sbi_ecall_register_extension(&FirmwareEcall);=0D
+ UINTN Ret;=0D
+=0D
+ Ret =3D sbi_ecall_register_extension (&FirmwareEcall);=0D
if (Ret) {=0D
//=0D
// Only fails if the extension ID is invalid or already is registered.=
=0D
//=0D
DEBUG ((DEBUG_ERROR, "Failed to register SBI Firmware Extension for ED=
K2\n"));=0D
- ASSERT(FALSE);=0D
+ ASSERT (FALSE);=0D
}=0D
=0D
return EFI_SUCCESS;=0D
}=0D
=0D
-=0D
/** Transion from SEC phase to PEI phase.=0D
=0D
This function transits to S-mode PEI phase from M-mode SEC phase.=0D
@@ -413,24 +417,24 @@ RegisterFirmwareSbiExtension (
VOID=0D
EFIAPI=0D
PeiCore (=0D
- IN UINTN BootHartId,=0D
- IN struct sbi_scratch *Scratch=0D
+ IN UINTN BootHartId,=0D
+ IN struct sbi_scratch *Scratch=0D
)=0D
{=0D
- EFI_SEC_PEI_HAND_OFF SecCoreData;=0D
- EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;=0D
- EFI_FIRMWARE_VOLUME_HEADER *BootFv;=0D
- EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT FirmwareContext;=0D
- struct sbi_platform *ThisSbiPlatform;=0D
+ EFI_SEC_PEI_HAND_OFF SecCoreData;=0D
+ EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint;=0D
+ EFI_FIRMWARE_VOLUME_HEADER *BootFv;=0D
+ EFI_RISCV_OPENSBI_FIRMWARE_CONTEXT FirmwareContext;=0D
+ struct sbi_platform *ThisSbiPlatform;=0D
=0D
- BootFv =3D (EFI_FIRMWARE_VOLUME_HEADER *)FixedPcdGet32(PcdRiscVPeiFvBase=
);=0D
+ BootFv =3D (EFI_FIRMWARE_VOLUME_HEADER *)FixedPcdGet32 (PcdRiscVPeiFvBas=
e);=0D
FindAndReportEntryPoints (&BootFv, &PeiCoreEntryPoint);=0D
=0D
- SecCoreData.DataSize =3D sizeof(EFI_SEC_PEI_HAND_OFF);=0D
+ SecCoreData.DataSize =3D sizeof (EFI_SEC_PEI_HAND_OFF);=0D
SecCoreData.BootFirmwareVolumeBase =3D BootFv;=0D
- SecCoreData.BootFirmwareVolumeSize =3D (UINTN) BootFv->FvLength;=0D
- SecCoreData.TemporaryRamBase =3D (VOID*)(UINT64) FixedPcdGet32(Pcd=
TemporaryRamBase);=0D
- SecCoreData.TemporaryRamSize =3D (UINTN) FixedPcdGet32(PcdTempora=
ryRamSize);=0D
+ SecCoreData.BootFirmwareVolumeSize =3D (UINTN)BootFv->FvLength;=0D
+ SecCoreData.TemporaryRamBase =3D (VOID *)(UINT64)FixedPcdGet32 (Pc=
dTemporaryRamBase);=0D
+ SecCoreData.TemporaryRamSize =3D (UINTN)FixedPcdGet32 (PcdTemporar=
yRamSize);=0D
SecCoreData.PeiTemporaryRamBase =3D SecCoreData.TemporaryRamBase;=0D
SecCoreData.PeiTemporaryRamSize =3D SecCoreData.TemporaryRamSize >> 1=
;=0D
SecCoreData.StackBase =3D (UINT8 *)SecCoreData.TemporaryRam=
Base + (SecCoreData.TemporaryRamSize >> 1);=0D
@@ -442,21 +446,26 @@ PeiCore (
// temporary RAM migration.=0D
//=0D
ZeroMem ((VOID *)&FirmwareContext, sizeof (EFI_RISCV_OPENSBI_FIRMWARE_CO=
NTEXT));=0D
- ThisSbiPlatform =3D (struct sbi_platform *)sbi_platform_ptr(Scratch);=0D
+ ThisSbiPlatform =3D (struct sbi_platform *)sbi_platform_ptr (Scratch);=0D
if (ThisSbiPlatform->opensbi_version > OPENSBI_VERSION) {=0D
- DEBUG ((DEBUG_ERROR, "%a: OpenSBI platform table version 0x%x is new=
er than OpenSBI version 0x%x.\n"=0D
- "There maybe be some backward compatable issues=
.\n",=0D
- __FUNCTION__,=0D
- ThisSbiPlatform->opensbi_version,=0D
- OPENSBI_VERSION=0D
- ));=0D
- ASSERT(FALSE);=0D
+ DEBUG ((=0D
+ DEBUG_ERROR,=0D
+ "%a: OpenSBI platform table version 0x%x is newer than OpenSBI versi=
on 0x%x.\n"=0D
+ "There maybe be some backward compatable issues.\n",=0D
+ __FUNCTION__,=0D
+ ThisSbiPlatform->opensbi_version,=0D
+ OPENSBI_VERSION=0D
+ ));=0D
+ ASSERT (FALSE);=0D
}=0D
- DEBUG ((DEBUG_INFO, "%a: OpenSBI platform table at address: 0x%x\nFirmwa=
re Context is located at 0x%x\n",=0D
- __FUNCTION__,=0D
- ThisSbiPlatform,=0D
- &FirmwareContext=0D
- ));=0D
+=0D
+ DEBUG ((=0D
+ DEBUG_INFO,=0D
+ "%a: OpenSBI platform table at address: 0x%x\nFirmware Context is loca=
ted at 0x%x\n",=0D
+ __FUNCTION__,=0D
+ ThisSbiPlatform,=0D
+ &FirmwareContext=0D
+ ));=0D
ThisSbiPlatform->firmware_context =3D (unsigned long)&FirmwareContext;=0D
=0D
//=0D
@@ -481,7 +490,7 @@ PeiCore (
Scratch->next_addr =3D (UINTN)(PeiCoreEntryPoint);=0D
Scratch->next_mode =3D PRV_S;=0D
DEBUG ((DEBUG_INFO, "%a: Initializing OpenSBI library for booting hart %=
d\n", __FUNCTION__, BootHartId));=0D
- sbi_init(Scratch);=0D
+ sbi_init (Scratch);=0D
}=0D
=0D
/**=0D
@@ -498,8 +507,8 @@ PeiCore (
VOID=0D
EFIAPI=0D
LaunchPeiCore (=0D
- IN UINTN ThisHartId,=0D
- IN struct sbi_scratch *Scratch=0D
+ IN UINTN ThisHartId,=0D
+ IN struct sbi_scratch *Scratch=0D
)=0D
{=0D
RegisterFirmwareSbiExtension ();=0D
@@ -522,14 +531,14 @@ LaunchPeiCore (
VOID=0D
EFIAPI=0D
RiscVOpenSbiHartSwitchMode (=0D
- IN UINTN FuncArg0,=0D
- IN UINTN FuncArg1,=0D
- IN UINTN NextAddr,=0D
- IN UINTN NextMode,=0D
- IN BOOLEAN NextVirt=0D
+ IN UINTN FuncArg0,=0D
+ IN UINTN FuncArg1,=0D
+ IN UINTN NextAddr,=0D
+ IN UINTN NextMode,=0D
+ IN BOOLEAN NextVirt=0D
)=0D
{=0D
- sbi_hart_switch_mode(FuncArg0, FuncArg1, NextAddr, NextMode, NextVirt);=
=0D
+ sbi_hart_switch_mode (FuncArg0, FuncArg1, NextAddr, NextMode, NextVirt);=
=0D
}=0D
=0D
/**=0D
@@ -543,34 +552,37 @@ GetDeviceTreeAddress (
VOID=0D
)=0D
{=0D
- EFI_STATUS Status;=0D
- EFI_COMMON_SECTION_HEADER *FoundSection;=0D
+ EFI_STATUS Status;=0D
+ EFI_COMMON_SECTION_HEADER *FoundSection;=0D
=0D
if (FixedPcdGet32 (PcdDeviceTreeAddress)) {=0D
- DEBUG ((DEBUG_INFO, "Use fixed address of DBT from PcdDeviceTreeAddr=
ess 0x%x 0x%x.\n", FixedPcdGet32 (PcdDeviceTreeAddress), *((unsigned long *=
)FixedPcdGet32 (PcdDeviceTreeAddress))));=0D
- //=0D
- // Device tree address is pointed by PcdDeviceTreeAddress.=0D
- //=0D
- return (VOID *)*((unsigned long *)FixedPcdGet32 (PcdDeviceTreeAddres=
s));=0D
+ DEBUG ((DEBUG_INFO, "Use fixed address of DBT from PcdDeviceTreeAddres=
s 0x%x 0x%x.\n", FixedPcdGet32 (PcdDeviceTreeAddress), *((unsigned long *)F=
ixedPcdGet32 (PcdDeviceTreeAddress))));=0D
+ //=0D
+ // Device tree address is pointed by PcdDeviceTreeAddress.=0D
+ //=0D
+ return (VOID *)*((unsigned long *)FixedPcdGet32 (PcdDeviceTreeAddress)=
);=0D
} else if (FixedPcdGet32 (PcdRiscVDtbFvBase)) {=0D
- DEBUG ((DEBUG_INFO, "Use DBT FV\n"));=0D
- Status =3D FindFfsFileAndSection (=0D
- (EFI_FIRMWARE_VOLUME_HEADER *)FixedPcdGet32 (PcdRiscVDtbF=
vBase),=0D
- EFI_FV_FILETYPE_FREEFORM,=0D
- EFI_SECTION_RAW,=0D
- &FoundSection=0D
- );=0D
- if (EFI_ERROR(Status)) {=0D
- return NULL;=0D
- }=0D
- FoundSection ++;=0D
- return (VOID *)FoundSection;=0D
+ DEBUG ((DEBUG_INFO, "Use DBT FV\n"));=0D
+ Status =3D FindFfsFileAndSection (=0D
+ (EFI_FIRMWARE_VOLUME_HEADER *)FixedPcdGet32 (PcdRiscVDtbFvB=
ase),=0D
+ EFI_FV_FILETYPE_FREEFORM,=0D
+ EFI_SECTION_RAW,=0D
+ &FoundSection=0D
+ );=0D
+ if (EFI_ERROR (Status)) {=0D
+ return NULL;=0D
+ }=0D
+=0D
+ FoundSection++;=0D
+ return (VOID *)FoundSection;=0D
} else {=0D
- DEBUG ((DEBUG_ERROR, "Must use DTB either from memory or compiled in=
FW. PCDs configured incorrectly.\n"));=0D
- ASSERT (FALSE);=0D
+ DEBUG ((DEBUG_ERROR, "Must use DTB either from memory or compiled in F=
W. PCDs configured incorrectly.\n"));=0D
+ ASSERT (FALSE);=0D
}=0D
+=0D
return NULL;=0D
}=0D
+=0D
/**=0D
Overwrite hart_index2id array if platform would like to use the=0D
bootable harts other than those declared in Device Tree=0D
@@ -580,21 +592,22 @@ GetDeviceTreeAddress (
**/=0D
VOID=0D
Edk2PlatformHartIndex2Id (=0D
- IN struct sbi_platform *SbiPlatform=0D
+ IN struct sbi_platform *SbiPlatform=0D
)=0D
{=0D
- UINT32 Index;=0D
- UINT32 *HartIndexToId;=0D
- UINT32 BootableHartCount;=0D
- UINT8 *PlatformHartIndex2IdArray;=0D
+ UINT32 Index;=0D
+ UINT32 *HartIndexToId;=0D
+ UINT32 BootableHartCount;=0D
+ UINT8 *PlatformHartIndex2IdArray;=0D
=0D
- BootableHartCount =3D FixedPcdGet32(PcdBootableHartNumber);=0D
+ BootableHartCount =3D FixedPcdGet32 (PcdBootableHartNumber);=0D
if (BootableHartCount !=3D 0) {=0D
- HartIndexToId =3D (UINT32 *)SbiPlatform->hart_index2id;=0D
+ HartIndexToId =3D (UINT32 *)SbiPlatform->hart_index2id;=0D
PlatformHartIndex2IdArray =3D (UINT8 *)FixedPcdGetPtr (PcdBootableHart=
IndexToId);=0D
for (Index =3D 0; Index < BootableHartCount; Index++) {=0D
*(HartIndexToId + Index) =3D (UINT32)(*(PlatformHartIndex2IdArray + =
Index));=0D
}=0D
+=0D
SbiPlatform->hart_count =3D BootableHartCount;=0D
}=0D
}=0D
@@ -631,51 +644,53 @@ Edk2PlatformHartIndex2Id (
**/=0D
VOID=0D
EFIAPI=0D
-SecCoreStartUpWithStack(=0D
- IN UINTN HartId,=0D
- IN struct sbi_scratch *Scratch=0D
+SecCoreStartUpWithStack (=0D
+ IN UINTN HartId,=0D
+ IN struct sbi_scratch *Scratch=0D
)=0D
{=0D
- UINT32 HardIndex;=0D
- UINT64 BootHartDoneSbiInit;=0D
- UINT64 NonBootHartMessageLockValue;=0D
- struct sbi_platform *ThisSbiPlatform;=0D
- EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartFirmwareContext;=0D
+ UINT32 HardIndex;=0D
+ UINT64 BootHartDoneSbiInit;=0D
+ UINT64 NonBootHartMessageLockValue;=0D
+ struct sbi_platform *ThisSbiPlatform;=0D
+ EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *HartFirmwareContext;=0D
=0D
- //DEBUG ((DEBUG_INFO, "HART ID: 0x%x enter SecCoreStartUpWithStack\n", H=
artId));=0D
+ // DEBUG ((DEBUG_INFO, "HART ID: 0x%x enter SecCoreStartUpWithStack\n", =
HartId));=0D
=0D
//=0D
// Setup EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC for each hart.=0D
//=0D
- HartFirmwareContext =3D (EFI_RISCV_FIRMWARE_CONTEXT_HART_SPECIFIC *)((UI=
NT8 *)Scratch - FIRMWARE_CONTEXT_HART_SPECIFIC_SIZE);=0D
- HartFirmwareContext->IsaExtensionSupported =3D RiscVReadMachineIsa ();=0D
+ HartFirmwareContext =3D (EFI_RISCV_FIRMWARE_C=
ONTEXT_HART_SPECIFIC *)((UINT8 *)Scratch - FIRMWARE_CONTEXT_HART_SPECIFIC_S=
IZE);=0D
+ HartFirmwareContext->IsaExtensionSupported =3D RiscVReadMachineIsa (=
);=0D
HartFirmwareContext->MachineVendorId.Value64_L =3D RiscVReadMachineVendo=
rId ();=0D
HartFirmwareContext->MachineVendorId.Value64_H =3D 0;=0D
- HartFirmwareContext->MachineArchId.Value64_L =3D RiscVReadMachineArchite=
ctureId ();=0D
- HartFirmwareContext->MachineArchId.Value64_H =3D 0;=0D
- HartFirmwareContext->MachineImplId.Value64_L =3D RiscVReadMachineImpleme=
ntId ();=0D
- HartFirmwareContext->MachineImplId.Value64_H =3D 0;=0D
- HartFirmwareContext->HartSwitchMode =3D RiscVOpenSbiHartSwitchMode;=0D
+ HartFirmwareContext->MachineArchId.Value64_L =3D RiscVReadMachineArchi=
tectureId ();=0D
+ HartFirmwareContext->MachineArchId.Value64_H =3D 0;=0D
+ HartFirmwareContext->MachineImplId.Value64_L =3D RiscVReadMachineImple=
mentId ();=0D
+ HartFirmwareContext->MachineImplId.Value64_H =3D 0;=0D
+ HartFirmwareContext->HartSwitchMode =3D RiscVOpenSbiHartSwitc=
hMode;=0D
=0D
//=0D
// Hook platform_ops with EDK2 one. Thus we can have interface=0D
// call out to OEM EDK2 platform code in M-mode before switching=0D
// to S-mode in opensbi init.=0D
//=0D
- ThisSbiPlatform =3D (struct sbi_platform *)sbi_platform_ptr(Scratch);=0D
+ ThisSbiPlatform =3D (struct sbi_platform *)sbi_platfo=
rm_ptr (Scratch);=0D
ThisSbiPlatform->platform_ops_addr =3D (unsigned long)&Edk2OpensbiPlatfo=
rmOps;=0D
- Scratch->next_arg1 =3D (unsigned long)GetDeviceTreeAddress ();=0D
- if (HartId =3D=3D FixedPcdGet32(PcdBootHartId)) {=0D
+ Scratch->next_arg1 =3D (unsigned long)GetDeviceTreeAddre=
ss ();=0D
+ if (HartId =3D=3D FixedPcdGet32 (PcdBootHartId)) {=0D
if (Scratch->next_arg1 =3D=3D (unsigned long)NULL) {=0D
DEBUG ((DEBUG_ERROR, "Platform Device Tree is not found on boot hart=
\n"));=0D
ASSERT (FALSE);=0D
}=0D
+=0D
DEBUG ((DEBUG_INFO, "Device Tree at 0x%x\n", Scratch->next_arg1));=0D
DEBUG ((DEBUG_INFO, "HART number: 0x%x\n", ThisSbiPlatform->hart_count=
));=0D
DEBUG ((DEBUG_INFO, "HART index to HART ID:\n"));=0D
- for (HardIndex =3D 0; HardIndex < ThisSbiPlatform->hart_count; HardInd=
ex ++) {=0D
- DEBUG ((DEBUG_INFO, " Index: %d -> Hard ID: %x\n", HardIndex, ThisS=
biPlatform->hart_index2id [HardIndex]));=0D
+ for (HardIndex =3D 0; HardIndex < ThisSbiPlatform->hart_count; HardInd=
ex++) {=0D
+ DEBUG ((DEBUG_INFO, " Index: %d -> Hard ID: %x\n", HardIndex, ThisS=
biPlatform->hart_index2id[HardIndex]));=0D
}=0D
+=0D
LaunchPeiCore (HartId, Scratch);=0D
}=0D
=0D
@@ -693,25 +708,26 @@ SecCoreStartUpWithStack(
CpuPause ();=0D
} while (BootHartDoneSbiInit !=3D (UINT64)TRUE);=0D
=0D
- NonBootHartMessageLockValue =3D atomic_xchg(&NonBootHartMessageLock, TRU=
E);=0D
+ NonBootHartMessageLockValue =3D atomic_xchg (&NonBootHartMessageLock, TR=
UE);=0D
while (NonBootHartMessageLockValue =3D=3D TRUE) {=0D
CpuPause ();=0D
CpuPause ();=0D
CpuPause ();=0D
- NonBootHartMessageLockValue =3D atomic_xchg(&NonBootHartMessageLock, T=
RUE);=0D
- };=0D
- DEBUG((DEBUG_INFO, "%a: Non boot hart %d initialization.\n", __FUNCTION_=
_, HartId));=0D
+ NonBootHartMessageLockValue =3D atomic_xchg (&NonBootHartMessageLock, =
TRUE);=0D
+ }=0D
+=0D
+ DEBUG ((DEBUG_INFO, "%a: Non boot hart %d initialization.\n", __FUNCTION=
__, HartId));=0D
if (Scratch->next_arg1 =3D=3D (unsigned long)NULL) {=0D
DEBUG ((DEBUG_ERROR, "Platform Device Tree is not found\n"));=0D
ASSERT (FALSE);=0D
}=0D
- DEBUG((DEBUG_INFO, "%a: Non boot hart %d DTB is at 0x%x.\n", __FUNCTION_=
_, HartId, Scratch->next_arg1));=0D
- NonBootHartMessageLockValue =3D atomic_xchg(&NonBootHartMessageLock, FAL=
SE);=0D
+=0D
+ DEBUG ((DEBUG_INFO, "%a: Non boot hart %d DTB is at 0x%x.\n", __FUNCTION=
__, HartId, Scratch->next_arg1));=0D
+ NonBootHartMessageLockValue =3D atomic_xchg (&NonBootHartMessageLock, FA=
LSE);=0D
//=0D
// Non boot hart wiil be halted waiting for SBI_HART_STARTING.=0D
// Use HSM ecall to start non boot hart (SBI_EXT_HSM_HART_START) later o=
n,=0D
//=0D
Scratch->next_mode =3D PRV_S;=0D
- sbi_init(Scratch);=0D
+ sbi_init (Scratch);=0D
}=0D
-=0D
--=20
2.31.1