]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/PrePi/MainMPCore.c
ArmPlatformPkg: Change the memory model for the ARM Platform components
[mirror_edk2.git] / ArmPlatformPkg / PrePi / MainMPCore.c
CommitLineData
cd872e40 1/** @file\r
2*\r
3* Copyright (c) 2011, ARM Limited. All rights reserved.\r
4*\r
5* This program and the accompanying materials\r
6* are licensed and made available under the terms and conditions of the BSD License\r
7* which accompanies this distribution. The full text of the license may be found at\r
8* http://opensource.org/licenses/bsd-license.php\r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12*\r
13**/\r
14\r
15#include "PrePi.h"\r
16\r
17#include <Library/ArmMPCoreMailBoxLib.h>\r
18#include <Chipset/ArmV7.h>\r
19#include <Drivers/PL390Gic.h>\r
20\r
21VOID\r
22PrimaryMain (\r
23 IN UINTN UefiMemoryBase,\r
cd872e40 24 IN UINT64 StartTimeStamp\r
25 )\r
26{\r
27 //Enable the GIC Distributor\r
28 PL390GicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r
29\r
d269095b 30 // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader toresume their initialization\r
31 if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) {\r
cd872e40 32 // Sending SGI to all the Secondary CPU interfaces\r
33 PL390GicSendSgiTo (PcdGet32(PcdGicDistributorBase), GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E);\r
34 }\r
35\r
d269095b 36 PrePiMain (UefiMemoryBase, StartTimeStamp);\r
cd872e40 37\r
38 // We must never return\r
39 ASSERT(FALSE);\r
40}\r
41\r
42VOID\r
43SecondaryMain (\r
44 IN UINTN CoreId\r
45 )\r
46{\r
47 // Function pointer to Secondary Core entry point\r
48 VOID (*secondary_start)(VOID);\r
49 UINTN secondary_entry_addr=0;\r
50\r
51 // Clear Secondary cores MailBox\r
52 ArmClearMPCoreMailbox();\r
53\r
54 while (secondary_entry_addr = ArmGetMPCoreMailbox(), secondary_entry_addr == 0) {\r
55 ArmCallWFI();\r
56 // Acknowledge the interrupt and send End of Interrupt signal.\r
57 PL390GicAcknowledgeSgiFrom(PcdGet32(PcdGicInterruptInterfaceBase),0/*CoreId*/);\r
58 }\r
59\r
60 secondary_start = (VOID (*)())secondary_entry_addr;\r
61\r
62 // Jump to secondary core entry point.\r
63 secondary_start();\r
64\r
65 // The secondaries shouldn't reach here\r
66 ASSERT(FALSE);\r
67}\r