2011-02-01 06:41:42 +01:00
|
|
|
/** @file
|
|
|
|
*
|
2012-02-27 11:27:10 +01:00
|
|
|
* Copyright (c) 2011-2012, ARM Limited. All rights reserved.
|
2011-02-01 06:41:42 +01:00
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* http://opensource.org/licenses/bsd-license.php
|
|
|
|
*
|
|
|
|
* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
|
|
|
*
|
|
|
|
**/
|
|
|
|
|
2011-06-11 14:10:19 +02:00
|
|
|
#include "PrePeiCore.h"
|
|
|
|
|
2011-02-01 06:41:42 +01:00
|
|
|
VOID
|
|
|
|
EFIAPI
|
2011-06-11 14:10:19 +02:00
|
|
|
SecondaryMain (
|
2011-09-23 01:01:13 +02:00
|
|
|
IN UINTN MpId
|
2011-06-11 14:10:19 +02:00
|
|
|
)
|
2011-02-01 06:41:42 +01:00
|
|
|
{
|
2011-06-11 14:10:19 +02:00
|
|
|
ASSERT(FALSE);
|
2011-02-01 06:41:42 +01:00
|
|
|
}
|
|
|
|
|
2011-06-11 14:10:19 +02:00
|
|
|
VOID
|
|
|
|
EFIAPI
|
|
|
|
PrimaryMain (
|
2011-02-01 06:41:42 +01:00
|
|
|
IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
|
|
|
|
)
|
|
|
|
{
|
2011-06-11 14:10:19 +02:00
|
|
|
EFI_SEC_PEI_HAND_OFF SecCoreData;
|
2011-09-23 01:12:23 +02:00
|
|
|
UINTN PpiListSize;
|
|
|
|
EFI_PEI_PPI_DESCRIPTOR *PpiList;
|
|
|
|
UINTN TemporaryRamBase;
|
|
|
|
UINTN TemporaryRamSize;
|
2011-06-11 14:10:19 +02:00
|
|
|
|
2011-09-23 01:12:23 +02: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 08:35:30 +01:00
|
|
|
PpiListSize = ALIGN_VALUE(PpiListSize, CPU_STACK_ALIGNMENT);
|
2014-11-11 01:43:03 +01:00
|
|
|
TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
|
2011-09-23 01:12:23 +02:00
|
|
|
TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
|
2011-06-11 14:10:19 +02: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 01:43:03 +01:00
|
|
|
SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
|
2011-09-23 01:06:31 +02:00
|
|
|
SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
|
2011-09-23 01:12:23 +02: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 08:35:30 +01:00
|
|
|
SecCoreData.PeiTemporaryRamSize = ALIGN_VALUE (SecCoreData.TemporaryRamSize / 2, CPU_STACK_ALIGNMENT);
|
2015-12-08 15:15:14 +01:00
|
|
|
SecCoreData.StackBase = (VOID *)((UINTN)SecCoreData.TemporaryRamBase + SecCoreData.PeiTemporaryRamSize);
|
2012-02-27 11:27:10 +01:00
|
|
|
SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
|
2011-06-11 14:10:19 +02:00
|
|
|
|
2011-09-23 01:12:23 +02:00
|
|
|
// Jump to PEI core entry point
|
|
|
|
(PeiCoreEntryPoint)(&SecCoreData, PpiList);
|
2011-02-01 06:41:42 +01:00
|
|
|
}
|