Under virtualization, typically, the guest is entered with only a
single CPU turned on, and any remaining CPUs are started by the OS
using PSCI. So refactor the PrePi code in such a way that we can
implement a unicore flavor which can be allowed to execute on a
MPcore CPU.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <[email protected]>
---
 ArmPlatformPkg/PrePi/MainMPCore.c  | 2 +-
 ArmPlatformPkg/PrePi/MainUniCore.c | 2 +-
 ArmPlatformPkg/PrePi/PrePi.c       | 9 ++++-----
 ArmPlatformPkg/PrePi/PrePi.h       | 3 ++-
 4 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ArmPlatformPkg/PrePi/MainMPCore.c 
b/ArmPlatformPkg/PrePi/MainMPCore.c
index bf813730d341..8e5f9947d499 100644
--- a/ArmPlatformPkg/PrePi/MainMPCore.c
+++ b/ArmPlatformPkg/PrePi/MainMPCore.c
@@ -35,7 +35,7 @@ PrimaryMain (
     ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), 
ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));
   }
 
-  PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);
+  PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp, 
ArmIsMpCore());
 
   // We must never return
   ASSERT(FALSE);
diff --git a/ArmPlatformPkg/PrePi/MainUniCore.c 
b/ArmPlatformPkg/PrePi/MainUniCore.c
index 43588a50ddb5..918ea4dcdf7b 100644
--- a/ArmPlatformPkg/PrePi/MainUniCore.c
+++ b/ArmPlatformPkg/PrePi/MainUniCore.c
@@ -27,7 +27,7 @@ PrimaryMain (
     ASSERT(ArmIsMpCore() == 0);
   DEBUG_CODE_END();
 
-  PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);
+  PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp, 
ArmIsMpCore());
 
   // We must never return
   ASSERT(FALSE);
diff --git a/ArmPlatformPkg/PrePi/PrePi.c b/ArmPlatformPkg/PrePi/PrePi.c
index 0e551c518d6b..5b058dba80fa 100755
--- a/ArmPlatformPkg/PrePi/PrePi.c
+++ b/ArmPlatformPkg/PrePi/PrePi.c
@@ -94,7 +94,8 @@ PrePiMain (
   IN  UINTN                     UefiMemoryBase,
   IN  UINTN                     StacksBase,
   IN  UINTN                     GlobalVariableBase,
-  IN  UINT64                    StartTimeStamp
+  IN  UINT64                    StartTimeStamp,
+  IN  BOOLEAN                   IsMpCore
   )
 {
   EFI_HOB_HANDOFF_INFO_TABLE*   HobList;
@@ -138,7 +139,7 @@ PrePiMain (
   ASSERT_EFI_ERROR (Status);
 
   // Create the Stacks HOB (reserve the memory for all stacks)
-  if (ArmIsMpCore ()) {
+  if (IsMpCore) {
     StacksSize = PcdGet32 (PcdCPUCorePrimaryStackSize) +
                  ((FixedPcdGet32 (PcdCoreCount) - 1) * FixedPcdGet32 
(PcdCPUCoreSecondaryStackSize));
   } else {
@@ -152,7 +153,7 @@ PrePiMain (
   //TODO: Call CpuPei as a library
   BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
 
-  if (ArmIsMpCore ()) {
+  if (IsMpCore) {
     // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
     Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, 
(VOID**)&ArmMpCoreInfoPpi);
 
@@ -209,8 +210,6 @@ CEntryPoint (
 {
   UINT64   StartTimeStamp;
 
-  ASSERT(!ArmIsMpCore() || (PcdGet32 (PcdCoreCount) > 1));
-
   // Initialize the platform specific controllers
   ArmPlatformInitialize (MpId);
 
diff --git a/ArmPlatformPkg/PrePi/PrePi.h b/ArmPlatformPkg/PrePi/PrePi.h
index e67795f4490a..468569b3a28b 100644
--- a/ArmPlatformPkg/PrePi/PrePi.h
+++ b/ArmPlatformPkg/PrePi/PrePi.h
@@ -40,7 +40,8 @@ PrePiMain (
   IN  UINTN                     UefiMemoryBase,
   IN  UINTN                     StacksBase,
   IN  UINTN                     GlobalVariableBase,
-  IN  UINT64                    StartTimeStamp
+  IN  UINT64                    StartTimeStamp,
+  IN  BOOLEAN                   IsMpCore
   );
 
 EFI_STATUS
-- 
1.8.3.2


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to