ArmPlatformPkg/PrePi: Declared the ARM MP Core Info

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
This commit is contained in:
oliviermartin 2012-07-04 20:17:46 +00:00
parent dac180fc76
commit 0dbbacdf18
6 changed files with 65 additions and 36 deletions

View File

@ -18,30 +18,6 @@
#include <Ppi/ArmMpCoreInfo.h> #include <Ppi/ArmMpCoreInfo.h>
EFI_STATUS
GetPlatformPpi (
IN EFI_GUID *PpiGuid,
OUT VOID **Ppi
)
{
UINTN PpiListSize;
UINTN PpiListCount;
EFI_PEI_PPI_DESCRIPTOR *PpiList;
UINTN Index;
PpiListSize = 0;
ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);
PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);
for (Index = 0; Index < PpiListCount; Index++, PpiList++) {
if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) {
*Ppi = PpiList->Ppi;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
VOID VOID
PrimaryMain ( PrimaryMain (
IN UINTN UefiMemoryBase, IN UINTN UefiMemoryBase,
@ -50,15 +26,6 @@ PrimaryMain (
IN UINT64 StartTimeStamp IN UINT64 StartTimeStamp
) )
{ {
// On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)
DEBUG_CODE_BEGIN();
EFI_STATUS Status;
ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);
ASSERT_EFI_ERROR (Status);
DEBUG_CODE_END();
// Check PcdGicPrimaryCoreId has been set in case the Primary Core is not the core 0 of Cluster 0 // Check PcdGicPrimaryCoreId has been set in case the Primary Core is not the core 0 of Cluster 0
DEBUG_CODE_BEGIN(); DEBUG_CODE_BEGIN();
if ((PcdGet32(PcdArmPrimaryCore) != 0) && (PcdGet32 (PcdGicPrimaryCoreId) == 0)) { if ((PcdGet32(PcdArmPrimaryCore) != 0) && (PcdGet32 (PcdGicPrimaryCoreId) == 0)) {

View File

@ -61,6 +61,7 @@
[Guids] [Guids]
gArmGlobalVariableGuid gArmGlobalVariableGuid
gArmMpCoreInfoGuid
[FeaturePcd] [FeaturePcd]
gEmbeddedTokenSpaceGuid.PcdCacheEnable gEmbeddedTokenSpaceGuid.PcdCacheEnable

View File

@ -55,11 +55,12 @@
PlatformPeiLib PlatformPeiLib
MemoryInitPeiLib MemoryInitPeiLib
[Guids] [Ppis]
gArmGlobalVariableGuid gArmMpCoreInfoPpiGuid
[Guids] [Guids]
gArmGlobalVariableGuid gArmGlobalVariableGuid
gArmMpCoreInfoGuid
[FeaturePcd] [FeaturePcd]
gEmbeddedTokenSpaceGuid.PcdCacheEnable gEmbeddedTokenSpaceGuid.PcdCacheEnable

View File

@ -23,6 +23,7 @@
#include <Library/PerformanceLib.h> #include <Library/PerformanceLib.h>
#include <Ppi/GuidedSectionExtraction.h> #include <Ppi/GuidedSectionExtraction.h>
#include <Ppi/ArmMpCoreInfo.h>
#include <Guid/LzmaDecompress.h> #include <Guid/LzmaDecompress.h>
#include <Guid/ArmGlobalVariableHob.h> #include <Guid/ArmGlobalVariableHob.h>
@ -70,6 +71,30 @@ BuildGlobalVariableHob (
Hob->GlobalVariableSize = GlobalVariableSize; Hob->GlobalVariableSize = GlobalVariableSize;
} }
EFI_STATUS
GetPlatformPpi (
IN EFI_GUID *PpiGuid,
OUT VOID **Ppi
)
{
UINTN PpiListSize;
UINTN PpiListCount;
EFI_PEI_PPI_DESCRIPTOR *PpiList;
UINTN Index;
PpiListSize = 0;
ArmPlatformGetPlatformPpiList (&PpiListSize, &PpiList);
PpiListCount = PpiListSize / sizeof(EFI_PEI_PPI_DESCRIPTOR);
for (Index = 0; Index < PpiListCount; Index++, PpiList++) {
if (CompareGuid (PpiList->Guid, PpiGuid) == TRUE) {
*Ppi = PpiList->Ppi;
return EFI_SUCCESS;
}
}
return EFI_NOT_FOUND;
}
VOID VOID
PrePiMain ( PrePiMain (
IN UINTN UefiMemoryBase, IN UINTN UefiMemoryBase,
@ -79,6 +104,9 @@ PrePiMain (
) )
{ {
EFI_HOB_HANDOFF_INFO_TABLE* HobList; EFI_HOB_HANDOFF_INFO_TABLE* HobList;
ARM_MP_CORE_INFO_PPI* ArmMpCoreInfoPpi;
UINTN ArmCoreCount;
ARM_CORE_INFO* ArmCoreInfoTable;
EFI_STATUS Status; EFI_STATUS Status;
CHAR8 Buffer[100]; CHAR8 Buffer[100];
UINTN CharCount; UINTN CharCount;
@ -133,6 +161,22 @@ PrePiMain (
//TODO: Call CpuPei as a library //TODO: Call CpuPei as a library
BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));
if (ArmIsMpCore ()) {
// Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
Status = GetPlatformPpi (&gArmMpCoreInfoPpiGuid, (VOID**)&ArmMpCoreInfoPpi);
// On MP Core Platform we must implement the ARM MP Core Info PPI (gArmMpCoreInfoPpiGuid)
ASSERT_EFI_ERROR (Status);
// Build the MP Core Info Table
ArmCoreCount = 0;
Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {
// Build MPCore Info HOB
BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);
}
}
// Set the Boot Mode // Set the Boot Mode
SetBootMode (ArmPlatformGetBootMode ()); SetBootMode (ArmPlatformGetBootMode ());

View File

@ -81,4 +81,10 @@ BuildMemoryTypeInformationHob (
VOID VOID
); );
EFI_STATUS
GetPlatformPpi (
IN EFI_GUID *PpiGuid,
OUT VOID **Ppi
);
#endif /* _PREPI_H_ */ #endif /* _PREPI_H_ */

View File

@ -114,3 +114,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;
}