ArmPlatformPkg: Add ArmPlatformGetPlatformPpiList()
[mirror_edk2.git] / ArmPlatformPkg / PrePeiCore / MainUniCore.c
1 /** @file
2 *
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #include <Chipset/ArmV7.h>
16
17 #include "PrePeiCore.h"
18
19 VOID
20 EFIAPI
21 SecondaryMain (
22 IN UINTN MpId
23 )
24 {
25 ASSERT(FALSE);
26 }
27
28 VOID
29 EFIAPI
30 PrimaryMain (
31 IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
32 )
33 {
34 EFI_SEC_PEI_HAND_OFF SecCoreData;
35 UINTN PpiListSize;
36 EFI_PEI_PPI_DESCRIPTOR *PpiList;
37 UINTN TemporaryRamBase;
38 UINTN TemporaryRamSize;
39
40 CreatePpiList (&PpiListSize, &PpiList);
41
42 // Adjust the Temporary Ram as the new Ppi List (Common + Platform Ppi Lists) is created at
43 // the base of the primary core stack
44 PpiListSize = ALIGN_VALUE(PpiListSize, 0x4);
45 TemporaryRamBase = (UINTN)PcdGet32 (PcdCPUCoresStackBase) + PpiListSize;
46 TemporaryRamSize = (UINTN)PcdGet32 (PcdCPUCorePrimaryStackSize) - PpiListSize;
47
48 //
49 // Bind this information into the SEC hand-off state
50 // Note: this must be in sync with the stuff in the asm file
51 // Note also: HOBs (pei temp ram) MUST be above stack
52 //
53 SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
54 SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdFvBaseAddress);
55 SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdFvSize);
56 SecCoreData.TemporaryRamBase = (VOID *)TemporaryRamBase; // We run on the primary core (and so we use the first stack)
57 SecCoreData.TemporaryRamSize = TemporaryRamSize;
58 SecCoreData.PeiTemporaryRamBase = SecCoreData.TemporaryRamBase;
59 SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
60 SecCoreData.StackBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize/2));
61 SecCoreData.StackSize = SecCoreData.TemporaryRamSize / 2;
62
63 // Jump to PEI core entry point
64 (PeiCoreEntryPoint)(&SecCoreData, PpiList);
65 }