From ba3ed154863d1acd0996178beaf3a2bc693b938c Mon Sep 17 00:00:00 2001 From: sahil Date: Wed, 20 Apr 2022 12:24:41 +0530 Subject: [PATCH] Platform/ARM/N1Sdp: Fix RemoteDdrSize cast RemoteDdrSize calculation wraps around when booting N1Sdp in multichip mode. Casting it to UINT64 to fix the issue. Upstream-Status: Pending Signed-off-by: Adam Johnston Signed-off-by: Xueliang Zhong Signed-off-by: sahil Change-Id: Ic51269a8d67669684a5f056701cfbef6beb23da2 --- .../ConfigurationManagerDxe/ConfigurationManager.c | 2 +- Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c index c15020f5..b11c0425 100644 --- a/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c +++ b/Platform/ARM/N1Sdp/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c @@ -1254,7 +1254,7 @@ InitializePlatformRepository ( PlatRepoInfo->MemAffInfo[LOCAL_DDR_REGION2].Length = Dram2Size; if (PlatInfo->MultichipMode == 1) { - RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB); + RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB); // Update Remote DDR Region1 PlatRepoInfo->MemAffInfo[REMOTE_DDR_REGION1].ProximityDomain = 1; diff --git a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c index 1d53ec75..5cacd437 100644 --- a/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c +++ b/Silicon/ARM/NeoverseN1Soc/Library/PlatformLib/PlatformLibMem.c @@ -157,7 +157,7 @@ ArmPlatformGetVirtualMemoryMap ( DramBlock2Size); if (PlatInfo->MultichipMode == 1) { - RemoteDdrSize = ((PlatInfo->RemoteDdrSize - 2) * SIZE_1GB); + RemoteDdrSize = ((UINT64)(PlatInfo->RemoteDdrSize - 2) * SIZE_1GB); BuildResourceDescriptorHob ( EFI_RESOURCE_SYSTEM_MEMORY,