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
|
|
|
|
PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);
|
|
|
|
TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize;
|
|
|
|
TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
|
2011-06-11 14:10:19 +02:00
|
|
|
|
2012-02-27 11:27:10 +01:00
|
|
|
// Make sure the size is 8-byte aligned. Once divided by 2, the size should be 4-byte aligned
|
|
|
|
// to ensure the stack pointer is 4-byte aligned.
|
|
|
|
TemporaryRamSize = TemporaryRamSize - (TemporaryRamSize & (0x8-1));
|
|
|
|
|
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);
|
2011-09-23 01:06:31 +02:00
|
|
|
SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);
|
|
|
|
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;
|
2011-06-11 14:10:19 +02:00
|
|
|
SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
|
2012-02-27 11:27:10 +01:00
|
|
|
SecCoreData.StackBase = (VOID *)ALIGN_VALUE((UINTN)(SecCoreData.TemporaryRamBase) + SecCoreData.PeiTemporaryRamSize, 0x4);
|
|
|
|
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
|
|
|
}
|