]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg/PrePi: Declared the ARM MP Core Info
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Jul 2012 20:17:46 +0000 (20:17 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Wed, 4 Jul 2012 20:17:46 +0000 (20:17 +0000)
Registered the gArmMpCoreInfoGuid Data Hob.

Signed-off-by: Olivier Martin <olivier.martin@arm.com>
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13497 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/PrePi/MainMPCore.c
ArmPlatformPkg/PrePi/PeiMPCore.inf
ArmPlatformPkg/PrePi/PeiUniCore.inf
ArmPlatformPkg/PrePi/PrePi.c
ArmPlatformPkg/PrePi/PrePi.h
BeagleBoardPkg/Library/BeagleBoardLib/BeagleBoard.c

index 2c18f9f3c378d7c2236331dacee9832f82c5fd33..998a7763f4a45fd08f1f5704e6a32da78fe9fea3 100644 (file)
 \r
 #include <Ppi/ArmMpCoreInfo.h>\r
 \r
-EFI_STATUS\r
-GetPlatformPpi (\r
-  IN  EFI_GUID  *PpiGuid,\r
-  OUT VOID      **Ppi\r
-  )\r
-{\r
-  UINTN                   PpiListSize;\r
-  UINTN                   PpiListCount;\r
-  EFI_PEI_PPI_DESCRIPTOR  *PpiList;\r
-  UINTN                   Index;\r
-\r
-  PpiListSize = 0;\r
-  ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);\r
-  PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);\r
-  for (Index = 0; Index < PpiListCount; Index++, PpiList++) {\r
-    if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) {\r
-      *Ppi = PpiList->Ppi;\r
-      return EFI_SUCCESS;\r
-    }\r
-  }\r
-\r
-  return EFI_NOT_FOUND;\r
-}\r
-\r
 VOID\r
 PrimaryMain (\r
   IN  UINTN                     UefiMemoryBase,\r
@@ -50,15 +26,6 @@ PrimaryMain (
   IN  UINT64                    StartTimeStamp\r
   )\r
 {\r
-  // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)\r
-  DEBUG_CODE_BEGIN();\r
-    EFI_STATUS              Status;\r
-    ARM_MP_CORE_INFO_PPI    *ArmMpCoreInfoPpi;\r
-\r
-    Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);\r
-    ASSERT_EFI_ERROR (Status);\r
-  DEBUG_CODE_END();\r
-\r
   // Check PcdGicPrimaryCoreId has been set in case the Primary Core is not the core 0 of Cluster 0\r
   DEBUG_CODE_BEGIN();\r
   if ((PcdGet32(PcdArmPrimaryCore) != 0) && (PcdGet32 (PcdGicPrimaryCoreId) == 0)) {\r
@@ -69,7 +36,7 @@ PrimaryMain (
   // Enable the GIC Distributor\r
   ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r
 \r
-  // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader toresume their initialization\r
+  // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader to resume their initialization\r
   if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) {\r
     // Sending SGI to all the Secondary CPU interfaces\r
     ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E, PcdGet32 (PcdGicSgiIntId));\r
index 2fedb27a485b1ce522cc2378806e885c397f8275..df89dfd3a7c97f474dd9f10fa1cc8dc5fc2eb15e 100755 (executable)
@@ -61,6 +61,7 @@
 \r
 [Guids]\r
   gArmGlobalVariableGuid\r
+  gArmMpCoreInfoGuid\r
 \r
 [FeaturePcd]  \r
   gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
index cfd40bc155aad9204b34254d84067402747be7ac..1a59fdc086ec8b180f8c3ef0edcf3a54b5d51d77 100755 (executable)
   PlatformPeiLib\r
   MemoryInitPeiLib\r
 \r
-[Guids]\r
-  gArmGlobalVariableGuid\r
+[Ppis]\r
+  gArmMpCoreInfoPpiGuid\r
 \r
 [Guids]\r
   gArmGlobalVariableGuid\r
+  gArmMpCoreInfoGuid\r
 \r
 [FeaturePcd]  \r
   gEmbeddedTokenSpaceGuid.PcdCacheEnable\r
index 5090c251232cd79cff1693daec7060dc1d86bb86..c393812439a69c8b7d532fa3b5752d98e6ddce46 100755 (executable)
@@ -23,6 +23,7 @@
 #include <Library/PerformanceLib.h>\r
 \r
 #include <Ppi/GuidedSectionExtraction.h>\r
+#include <Ppi/ArmMpCoreInfo.h>\r
 #include <Guid/LzmaDecompress.h>\r
 #include <Guid/ArmGlobalVariableHob.h>\r
 \r
@@ -70,6 +71,30 @@ BuildGlobalVariableHob (
   Hob->GlobalVariableSize = GlobalVariableSize;\r
 }\r
 \r
+EFI_STATUS\r
+GetPlatformPpi (\r
+  IN  EFI_GUID  *PpiGuid,\r
+  OUT VOID      **Ppi\r
+  )\r
+{\r
+  UINTN                   PpiListSize;\r
+  UINTN                   PpiListCount;\r
+  EFI_PEI_PPI_DESCRIPTOR  *PpiList;\r
+  UINTN                   Index;\r
+\r
+  PpiListSize = 0;\r
+  ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);\r
+  PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);\r
+  for (Index = 0; Index < PpiListCount; Index++, PpiList++) {\r
+    if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) {\r
+      *Ppi = PpiList->Ppi;\r
+      return EFI_SUCCESS;\r
+    }\r
+  }\r
+\r
+  return EFI_NOT_FOUND;\r
+}\r
+\r
 VOID\r
 PrePiMain (\r
   IN  UINTN                     UefiMemoryBase,\r
@@ -79,6 +104,9 @@ PrePiMain (
   )\r
 {\r
   EFI_HOB_HANDOFF_INFO_TABLE*   HobList;\r
+  ARM_MP_CORE_INFO_PPI*         ArmMpCoreInfoPpi;\r
+  UINTN                         ArmCoreCount;\r
+  ARM_CORE_INFO*                ArmCoreInfoTable;\r
   EFI_STATUS                    Status;\r
   CHAR8                         Buffer[100];\r
   UINTN                         CharCount;\r
@@ -133,6 +161,22 @@ PrePiMain (
   //TODO: Call CpuPei as a library\r
   BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));\r
 \r
+  if (ArmIsMpCore ()) {\r
+    // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid\r
+    Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);\r
+\r
+    // On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)\r
+    ASSERT_EFI_ERROR (Status);\r
+\r
+    // Build the MP Core Info Table\r
+    ArmCoreCount = 0;\r
+    Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);\r
+    if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {\r
+      // Build MPCore Info HOB\r
+      BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);\r
+    }\r
+  }\r
+\r
   // Set the Boot Mode\r
   SetBootMode (ArmPlatformGetBootMode ());\r
 \r
index e13900dbd477415a6d8092b99f69e4fe2fecbba2..3e976fadfb52754d27a2034985bc34f97f463aa7 100644 (file)
@@ -81,4 +81,10 @@ BuildMemoryTypeInformationHob (
   VOID\r
   );\r
 \r
+EFI_STATUS\r
+GetPlatformPpi (\r
+  IN  EFI_GUID  *PpiGuid,\r
+  OUT VOID      **Ppi\r
+  );\r
+\r
 #endif /* _PREPI_H_ */\r
index 951873d3ffda3d16aaaaf9b05134d7965d499377..8f2ab557be24268287f91eaaa055dfdbe3b1f5de 100755 (executable)
@@ -114,3 +114,13 @@ ArmPlatformInitializeSystemMemory (
 {
   // We do not need to initialize the System Memory on RTSM
 }
+
+VOID
+ArmPlatformGetPlatformPpiList (
+  OUT UINTN                   *PpiListSize,
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList
+  )
+{
+  *PpiListSize = 0;
+  *PpiList = NULL;
+}