]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PrePeiCore/MainUniCore.c
MdeModulePkg/UsbBus: Fix various typos
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / MainUniCore.c
1 /** @file
2 *
3 * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
4 *
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
6 *
7 **/
8
9 #include "PrePeiCore.h"
10
11 VOID
12 EFIAPI
13 SecondaryMain (
14 IN UINTN MpId
15 )
16 {
17 ASSERT(FALSE);
18 }
19
20 VOID
21 EFIAPI
22 PrimaryMain (
23 IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
24 )
25 {
26 EFI_SEC_PEI_HAND_OFF SecCoreData;
27 UINTN PpiListSize;
28 EFI_PEI_PPI_DESCRIPTOR *PpiList;
29 UINTN TemporaryRamBase;
30 UINTN TemporaryRamSize;
31
32 CreatePpiList (&PpiListSize, &PpiList);
33
34 // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
35 // the base of the primary core stack
36 PpiListSize = ALIGN_VALUE(PpiListSize, CPU_STACK_ALIGNMENT);
37 TemporaryRamBase = (UINTN)PcdGet64 (PcdCPUCoresStackBase) + PpiListSize;
38 TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
39
40 //
41 // Bind this information into the SEC hand-off state
42 // Note: this must be in sync with the stuff in the asm file
43 // Note also: HOBs (pei temp ram) MUST be above stack
44 //
45 SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
46 SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet64 (PcdFvBaseAddress);
47 SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
48 SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
49 SecCoreData.TemporaryRamSize = TemporaryRamSize;
50 SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
51 SecCoreData.PeiTemporaryRamSize = ALIGN_VALUE (SecCoreData.TemporaryRamSize / 2, CPU_STACK_ALIGNMENT);
52 SecCoreData.StackBase = (VOID *)((UINTN)SecCoreData.TemporaryRamBase + SecCoreData.PeiTemporaryRamSize);
53 SecCoreData.StackSize = (TemporaryRamBase + TemporaryRamSize) - (UINTN)SecCoreData.StackBase;
54
55 // Jump to PEI core entry point
56 (PeiCoreEntryPoint)(&SecCoreData, PpiList);
57 }