]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmPlatformPkg: Add ArmPlatformGetPlatformPpiList()
authoroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Sep 2011 23:12:23 +0000 (23:12 +0000)
committeroliviermartin <oliviermartin@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Sep 2011 23:12:23 +0000 (23:12 +0000)
This function exposes the Platform Specific PPIs. They can be used by
any PrePi modules or passed to the PeiCore by PrePeiCore

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12422 6f19259b-4bc3-4df7-8a09-765794883524

ArmPlatformPkg/ArmRealViewEbPkg/Library/ArmRealViewEbLibRTSM/ArmRealViewEb.c
ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibCTA9x4/CTA9x4.c
ArmPlatformPkg/Include/Library/ArmPlatformLib.h
ArmPlatformPkg/PrePeiCore/MainMPCore.c
ArmPlatformPkg/PrePeiCore/MainUniCore.c
ArmPlatformPkg/PrePeiCore/PrePeiCore.c
ArmPlatformPkg/PrePeiCore/PrePeiCore.h

index a245c239aaa329b9091486eee86e6884cd0efdc1..86b540b242fe026bfa2b3cba81201d4a86d90127 100644 (file)
@@ -107,3 +107,13 @@ ArmPlatformInitializeSystemMemory (
 {
   // We do not need to initialize the System Memory on RTSM
 }
 {
   // 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;
+}
+
index 644842f6d6ee8bbafe6af6bf2db56eed37995e12..fc4e14543609a8f0b6118561e5ab82f613c1446c 100644 (file)
@@ -154,3 +154,13 @@ ArmPlatformInitializeSystemMemory (
   PL341DmcInit(ARM_VE_DMC_BASE, &DDRTimings);
   PL301AxiInit(ARM_VE_FAXI_BASE);
 }
   PL341DmcInit(ARM_VE_DMC_BASE, &DDRTimings);
   PL301AxiInit(ARM_VE_FAXI_BASE);
 }
+VOID
+ArmPlatformGetPlatformPpiList (
+  OUT UINTN                   *PpiListSize,
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList
+  )
+{
+  *PpiListSize = 0;
+  *PpiList = NULL;
+}
+
index c14af9abfa9458a34b349001d8e081f5b7790339..864c2c7c921b207caf52807786cd84576b35c6a9 100644 (file)
@@ -201,4 +201,20 @@ ArmPlatformGetAdditionalSystemMemory (
   OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap
   );
 
   OUT ARM_SYSTEM_MEMORY_REGION_DESCRIPTOR** EfiMemoryMap
   );
 
+/**
+  Return the Platform specific PPIs
+
+  This function exposes the Platform Specific PPIs. They can be used by any PrePi modules or passed
+  to the PeiCore by PrePeiCore.
+
+  @param[out]   PpiListSize         Size in Bytes of the Platform PPI List
+  @param[out]   PpiList             Platform PPI List
+
+**/
+VOID
+ArmPlatformGetPlatformPpiList (
+  OUT UINTN                   *PpiListSize,
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList
+  );
+
 #endif
 #endif
index 58eeef1c3a7e5a6e1023a4541d41e977c814b756..25a11cf1bdfb6142e65dd0cd018d98346eb63ca3 100644 (file)
@@ -62,6 +62,12 @@ PrimaryMain (
   )\r
 {\r
   EFI_SEC_PEI_HAND_OFF        SecCoreData;\r
   )\r
 {\r
   EFI_SEC_PEI_HAND_OFF        SecCoreData;\r
+  UINTN                       PpiListSize;\r
+  EFI_PEI_PPI_DESCRIPTOR      *PpiList;\r
+  UINTN                       TemporaryRamBase;\r
+  UINTN                       TemporaryRamSize;\r
+\r
+  CreatePpiList (&PpiListSize, &PpiList);\r
 \r
   // Enable the GIC Distributor\r
   ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r
 \r
   // Enable the GIC Distributor\r
   ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r
@@ -72,6 +78,12 @@ PrimaryMain (
     ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E);\r
   }\r
 \r
     ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E);\r
   }\r
 \r
+  // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at\r
+  // the base of the primary core stack\r
+  PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);\r
+  TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize;\r
+  TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;\r
+\r
   //\r
   // Bind this information into the SEC hand-off state\r
   // Note: this must be in sync with the stuff in the asm file\r
   //\r
   // Bind this information into the SEC hand-off state\r
   // Note: this must be in sync with the stuff in the asm file\r
@@ -80,13 +92,13 @@ PrimaryMain (
   SecCoreData.DataSize               = sizeof(EFI_SEC_PEI_HAND_OFF);\r
   SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);\r
   SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);\r
   SecCoreData.DataSize               = sizeof(EFI_SEC_PEI_HAND_OFF);\r
   SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);\r
   SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);\r
-  SecCoreData.TemporaryRamBase       = (VOID *)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize); // We consider we run on the primary core (and so we use the first stack)\r
-  SecCoreData.TemporaryRamSize       = (UINTN)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize);\r
-  SecCoreData.PeiTemporaryRamBase    = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize / 2));\r
+  SecCoreData.TemporaryRamBase       = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)\r
+  SecCoreData.TemporaryRamSize       = TemporaryRamSize;\r
+  SecCoreData.PeiTemporaryRamBase    = SecCoreData.TemporaryRamBase;\r
   SecCoreData.PeiTemporaryRamSize    = SecCoreData.TemporaryRamSize / 2;\r
   SecCoreData.StackBase              = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));\r
   SecCoreData.StackSize              = SecCoreData.TemporaryRamSize / 2;\r
 \r
   // Jump to PEI core entry point\r
   SecCoreData.PeiTemporaryRamSize    = SecCoreData.TemporaryRamSize / 2;\r
   SecCoreData.StackBase              = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));\r
   SecCoreData.StackSize              = SecCoreData.TemporaryRamSize / 2;\r
 \r
   // Jump to PEI core entry point\r
-  (PeiCoreEntryPoint)(&SecCoreData, (VOID *)&gSecPpiTable);\r
+  (PeiCoreEntryPoint)(&SecCoreData, PpiList);\r
 }\r
 }\r
index 9f7de371f48c51abd55f92d9e038f10e0c30fccb..bd984c6e710bf1c825474eb4fbe55546fe1c8c8e 100644 (file)
@@ -32,7 +32,18 @@ PrimaryMain (
   )\r
 {\r
   EFI_SEC_PEI_HAND_OFF        SecCoreData;\r
   )\r
 {\r
   EFI_SEC_PEI_HAND_OFF        SecCoreData;\r
+  UINTN                       PpiListSize;\r
+  EFI_PEI_PPI_DESCRIPTOR      *PpiList;\r
+  UINTN                       TemporaryRamBase;\r
+  UINTN                       TemporaryRamSize;\r
 \r
 \r
+  CreatePpiList (&PpiListSize, &PpiList);\r
+\r
+  // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at\r
+  // the base of the primary core stack\r
+  PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);\r
+  TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize;\r
+  TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;\r
 \r
   //\r
   // Bind this information into the SEC hand-off state\r
 \r
   //\r
   // Bind this information into the SEC hand-off state\r
@@ -42,13 +53,13 @@ PrimaryMain (
   SecCoreData.DataSize               = sizeof(EFI_SEC_PEI_HAND_OFF);\r
   SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);\r
   SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);\r
   SecCoreData.DataSize               = sizeof(EFI_SEC_PEI_HAND_OFF);\r
   SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);\r
   SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);\r
-  SecCoreData.TemporaryRamBase       = (VOID *)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize); // We consider we run on the primary core (and so we use the first stack)\r
-  SecCoreData.TemporaryRamSize       = (UINTN)(UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize);\r
-  SecCoreData.PeiTemporaryRamBase    = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize / 2));\r
+  SecCoreData.TemporaryRamBase       = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)\r
+  SecCoreData.TemporaryRamSize       = TemporaryRamSize;\r
+  SecCoreData.PeiTemporaryRamBase    = SecCoreData.TemporaryRamBase;\r
   SecCoreData.PeiTemporaryRamSize    = SecCoreData.TemporaryRamSize / 2;\r
   SecCoreData.StackBase              = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));\r
   SecCoreData.StackSize              = SecCoreData.TemporaryRamSize / 2;\r
 \r
   SecCoreData.PeiTemporaryRamSize    = SecCoreData.TemporaryRamSize / 2;\r
   SecCoreData.StackBase              = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));\r
   SecCoreData.StackSize              = SecCoreData.TemporaryRamSize / 2;\r
 \r
-  // jump to pei core entry point\r
-  (PeiCoreEntryPoint)(&SecCoreData, (VOID *)&gSecPpiTable);\r
+  // Jump to PEI core entry point\r
+  (PeiCoreEntryPoint)(&SecCoreData, PpiList);\r
 }\r
 }\r
index 1927035365cc5a33e6dcf3a30771201f6ca169ec..645935f6119b339ba6a6292643f635e12cb00fdf 100644 (file)
@@ -34,12 +34,40 @@ EFI_PEI_PPI_DESCRIPTOR      gCommonPpiTable[] = {
     &mTemporaryRamSupportPpi\r
   },\r
   {\r
     &mTemporaryRamSupportPpi\r
   },\r
   {\r
-    EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST,\r
+    EFI_PEI_PPI_DESCRIPTOR_PPI,\r
     &gArmGlobalVariablePpiGuid,\r
     &mGlobalVariablePpi\r
   }\r
 };\r
 \r
     &gArmGlobalVariablePpiGuid,\r
     &mGlobalVariablePpi\r
   }\r
 };\r
 \r
+VOID\r
+CreatePpiList (\r
+  OUT UINTN                   *PpiListSize,\r
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList\r
+  )\r
+{\r
+  EFI_PEI_PPI_DESCRIPTOR *PlatformPpiList;\r
+  UINTN                   PlatformPpiListSize;\r
+  UINTN                   ListBase;\r
+  EFI_PEI_PPI_DESCRIPTOR *LastPpi;\r
+\r
+  // Get the Platform PPIs\r
+  PlatformPpiListSize = 0;\r
+  ArmPlatformGetPlatformPpiList (&PlatformPpiListSize, &PlatformPpiList);\r
+\r
+  // Copy the Common and Platform PPis in Temporrary Memory\r
+  ListBase = PcdGet32 (PcdCPUCoresStackBase);\r
+  CopyMem ((VOID*)ListBase, gCommonPpiTable, sizeof(gCommonPpiTable));\r
+  CopyMem ((VOID*)(ListBase + sizeof(gCommonPpiTable)), PlatformPpiList, PlatformPpiListSize);\r
+\r
+  // Set the Terminate flag on the last PPI entry\r
+  LastPpi = (EFI_PEI_PPI_DESCRIPTOR*)ListBase + ((sizeof(gCommonPpiTable) + PlatformPpiListSize) / sizeof(EFI_PEI_PPI_DESCRIPTOR)) - 1;\r
+  LastPpi->Flags |= EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST;\r
+\r
+  *PpiList     = (EFI_PEI_PPI_DESCRIPTOR*)ListBase;\r
+  *PpiListSize = sizeof(gCommonPpiTable) + PlatformPpiListSize;\r
+}\r
+\r
 VOID\r
 CEntryPoint (\r
   IN  UINTN                     MpId,\r
 VOID\r
 CEntryPoint (\r
   IN  UINTN                     MpId,\r
@@ -67,7 +95,7 @@ CEntryPoint (
 \r
   //Note: The MMU will be enabled by MemoryPeim. Only the primary core will have the MMU on.\r
 \r
 \r
   //Note: The MMU will be enabled by MemoryPeim. Only the primary core will have the MMU on.\r
 \r
-  //If not primary Jump to Secondary Main\r
+  // If not primary Jump to Secondary Main\r
   if (IS_PRIMARY_CORE(MpId)) {\r
     // Initialize the Debug Agent for Source Level Debugging\r
     InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);\r
   if (IS_PRIMARY_CORE(MpId)) {\r
     // Initialize the Debug Agent for Source Level Debugging\r
     InitializeDebugAgent (DEBUG_AGENT_INIT_POSTMEM_SEC, NULL, NULL);\r
index 08c5ebd031b10fc9261981e1d19a66efb7375004..9f7c9c3339f75a9647f70f5aae115662ecb43656 100644 (file)
 #include <PiPei.h>\r
 #include <Ppi/TemporaryRamSupport.h>\r
 \r
 #include <PiPei.h>\r
 #include <Ppi/TemporaryRamSupport.h>\r
 \r
+VOID\r
+CreatePpiList (\r
+  OUT UINTN                   *PpiListSize,\r
+  OUT EFI_PEI_PPI_DESCRIPTOR  **PpiList\r
+  );\r
 \r
 EFI_STATUS\r
 EFIAPI\r
 \r
 EFI_STATUS\r
 EFIAPI\r
-SecTemporaryRamSupport (\r
+PrePeiCoreTemporaryRamSupport (\r
   IN CONST EFI_PEI_SERVICES   **PeiServices,\r
   IN EFI_PHYSICAL_ADDRESS     TemporaryMemoryBase,\r
   IN EFI_PHYSICAL_ADDRESS     PermanentMemoryBase,\r
   IN CONST EFI_PEI_SERVICES   **PeiServices,\r
   IN EFI_PHYSICAL_ADDRESS     TemporaryMemoryBase,\r
   IN EFI_PHYSICAL_ADDRESS     PermanentMemoryBase,\r