X-Git-Url: https://git.proxmox.com/?p=mirror_edk2.git;a=blobdiff_plain;f=ArmPkg%2FDrivers%2FCpuPei%2FCpuPei.c;fp=ArmPkg%2FDrivers%2FCpuPei%2FCpuPei.c;h=f358cb845a6660ca66e49325a290a4d08a6904c1;hp=bc01f306b928308e583480b3f98cc1cfe9316588;hb=44788bae6f0ac5519764651d732a7c12b1f398c4;hpb=77de7e5372fc188811acfc3222b3fd967b54de3f diff --git a/ArmPkg/Drivers/CpuPei/CpuPei.c b/ArmPkg/Drivers/CpuPei/CpuPei.c index bc01f306b9..f358cb845a 100755 --- a/ArmPkg/Drivers/CpuPei/CpuPei.c +++ b/ArmPkg/Drivers/CpuPei/CpuPei.c @@ -2,6 +2,8 @@ Copyright (c) 2006, Intel Corporation. All rights reserved.
Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.
+Copyright (c) 2011, ARM Limited. All rights reserved.
+ This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this distribution. The full text of the license may be found at @@ -29,12 +31,14 @@ Abstract: // // The protocols, PPI and GUID defintions for this module // +#include // // The Library classes this module consumes // #include #include +#include #include #include #include @@ -54,7 +58,7 @@ FindMainMemory ( { EFI_PEI_HOB_POINTERS NextHob; - // look at the resource descriptor hobs, choose the first system memory one + // Look at the resource descriptor hobs, choose the first system memory one NextHob.Raw = GetHobList (); while ((NextHob.Raw = GetNextHob (EFI_HOB_TYPE_RESOURCE_DESCRIPTOR, NextHob.Raw)) != NULL) { if(NextHob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) @@ -75,7 +79,7 @@ ConfigureMmu ( VOID ) { - EFI_STATUS Status; + EFI_STATUS Status; UINTN Idx; UINT32 CacheAttributes; UINT32 SystemMemoryBase; @@ -99,7 +103,7 @@ ConfigureMmu ( SystemMemoryLastAddress = SystemMemoryBase + (SystemMemoryLength-1); - // if system memory does not begin at 0 + // If system memory does not begin at 0 if(SystemMemoryBase > 0) { MemoryTable[Idx].PhysicalBase = 0; MemoryTable[Idx].VirtualBase = 0; @@ -114,7 +118,7 @@ ConfigureMmu ( MemoryTable[Idx].Attributes = (ARM_MEMORY_REGION_ATTRIBUTES)CacheAttributes; Idx++; - // if system memory does not go to the last address (0xFFFFFFFF) + // If system memory does not go to the last address (0xFFFFFFFF) if( SystemMemoryLastAddress < MAX_ADDRESS ) { MemoryTable[Idx].PhysicalBase = SystemMemoryLastAddress + 1; MemoryTable[Idx].VirtualBase = MemoryTable[Idx].PhysicalBase; @@ -138,13 +142,6 @@ ConfigureMmu ( BuildMemoryAllocationHob((EFI_PHYSICAL_ADDRESS)(UINTN)TranslationTableBase, TranslationTableSize, EfiBootServicesData); } - -EFI_STATUS -EFIAPI -InitializeCpuPeim ( - IN EFI_PEI_FILE_HANDLE FileHandle, - IN CONST EFI_PEI_SERVICES **PeiServices - ) /*++ Routine Description: @@ -161,14 +158,37 @@ Returns: Status - EFI_SUCCESS if the boot mode could be set --*/ +EFI_STATUS +EFIAPI +InitializeCpuPeim ( + IN EFI_PEI_FILE_HANDLE FileHandle, + IN CONST EFI_PEI_SERVICES **PeiServices + ) { + EFI_STATUS Status; + ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi; + UINTN ArmCoreCount; + ARM_CORE_INFO *ArmCoreInfoTable; + // Enable program flow prediction, if supported. ArmEnableBranchPrediction (); - // publish the CPU memory and io spaces sizes + // Publish the CPU memory and io spaces sizes BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize)); - ConfigureMmu(); + //ConfigureMmu(); + + // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid + Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID**)&ArmMpCoreInfoPpi); + if (!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); + } + } return EFI_SUCCESS; }