2011-02-01 13:41:42 +08:00
|
|
|
/** @file
|
2021-02-26 00:37:35 +08:00
|
|
|
|
|
|
|
Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
|
|
|
|
|
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
|
2011-02-01 13:41:42 +08:00
|
|
|
**/
|
|
|
|
|
2011-06-11 20:10:19 +08:00
|
|
|
#include "PrePeiCore.h"
|
|
|
|
|
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PrimaryMain (
|
2011-02-01 13:41:42 +08:00
|
|
|
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
|
|
|
|
)
|
|
|
|
{
|
2011-06-11 20:10:19 +08:00
|
|
|
EFI_SEC_PEI_HAND_OFF SecCoreData;
|
2011-09-23 07:12:23 +08:00
|
|
|
UINTN PpiListSize;
|
|
|
|
EFI_PEI_PPI_DESCRIPTOR *PpiList;
|
|
|
|
UINTN TemporaryRamBase;
|
|
|
|
UINTN TemporaryRamSize;
|
2011-06-11 20:10:19 +08:00
|
|
|
|
2011-09-23 07:12:23 +08:00
|
|
|
CreatePpiList (&PpiListSize, &PpiList);
|
|
|
|
|
|
|
|
// Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
|
|
|
|
// the base of the primary core stack
|
2015-12-08 15:35:30 +08:00
|
|
|
PpiListSize = ALIGN_VALUE (PpiListSize, CPU_STACK_ALIGNMENT);
|
2014-11-11 08:43:03 +08:00
|
|
|
TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
|
2011-09-23 07:12:23 +08:00
|
|
|
TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
|
2011-06-11 20:10:19 +08:00
|
|
|
|
|
|
|
//
|
|
|
|
// Bind this information into the SEC hand-off state
|
|
|
|
// Note: this must be in sync with the stuff in the asm file
|
|
|
|
// Note also: HOBs (pei temp ram) MUST be above stack
|
|
|
|
//
|
|
|
|
SecCoreData.DataSize = sizeof (EFI_SEC_PEI_HAND_OFF);
|
2014-11-11 08:43:03 +08:00
|
|
|
SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
|
2011-09-23 07:06:31 +08:00
|
|
|
SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
|
2011-09-23 07:12:23 +08:00
|
|
|
SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
|
|
|
|
SecCoreData.TemporaryRamSize = TemporaryRamSize;
|
|
|
|
SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
|
2015-12-08 15:35:30 +08:00
|
|
|
SecCoreData.PeiTemporaryRamSize = ALIGN_VALUE (SecCoreData.TemporaryRamSize / 2, CPU_STACK_ALIGNMENT);
|
2015-12-08 22:15:14 +08:00
|
|
|
SecCoreData.StackBase = (VOID *)((UINTN)SecCoreData.TemporaryRamBase + SecCoreData.PeiTemporaryRamSize);
|
2012-02-27 18:27:10 +08:00
|
|
|
SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
|
2011-06-11 20:10:19 +08:00
|
|
|
|
2011-09-23 07:12:23 +08:00
|
|
|
// Jump to PEI core entry point
|
|
|
|
(PeiCoreEntryPoint)(&SecCoreData, PpiList);
|
2011-02-01 13:41:42 +08:00
|
|
|
}
|