]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PrePeiCore/MainUniCore.c
ArmPlatformPkg: Rename gEmbeddedTokenSpaceGuid.PcdEmbeddedFd* into gArmTokenSpaceGuid...
[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 <PiPei.h>
16 #include <Library/DebugLib.h>
17 #include <Library/PcdLib.h>
18 #include <Chipset/ArmV7.h>
19
20 extern EFI_PEI_PPI_DESCRIPTOR *gSecPpiTable;
21
22 VOID
23 EFIAPI
24 secondary_main(IN UINTN CoreId)
25 {
26 ASSERT(FALSE);
27 }
28
29 VOID primary_main (
30 IN EFI_PEI_CORE_ENTRY_POINT PeiCoreEntryPoint
31 )
32 {
33 EFI_SEC_PEI_HAND_OFF SecCoreData;
34
35
36 //
37 // Bind this information into the SEC hand-off state
38 // Note: this must be in sync with the stuff in the asm file
39 // Note also: HOBs (pei temp ram) MUST be above stack
40 //
41 SecCoreData.DataSize = sizeof(EFI_SEC_PEI_HAND_OFF);
42 SecCoreData.BootFirmwareVolumeBase = (VOID *)(UINTN)PcdGet32 (PcdNormalFdBaseAddress);
43 SecCoreData.BootFirmwareVolumeSize = PcdGet32 (PcdNormalFdSize);
44 SecCoreData.TemporaryRamBase = (VOID *)(UINTN)PcdGet32 (PcdCPUCoresNonSecStackBase); // We consider we run on the primary core (and so we use the first stack)
45 SecCoreData.TemporaryRamSize = (UINTN)(UINTN)PcdGet32 (PcdCPUCoresNonSecStackSize);
46 SecCoreData.PeiTemporaryRamBase = (VOID *)((UINTN)(SecCoreData.TemporaryRamBase) + (SecCoreData.TemporaryRamSize / 2));
47 SecCoreData.PeiTemporaryRamSize = SecCoreData.TemporaryRamSize / 2;
48 SecCoreData.StackBase = SecCoreData.TemporaryRamBase;
49 SecCoreData.StackSize = SecCoreData.TemporaryRamSize - SecCoreData.PeiTemporaryRamSize;
50
51 // jump to pei core entry point
52 (PeiCoreEntryPoint)(&SecCoreData, (VOID *)&gSecPpiTable);
53 }