]>
Commit | Line | Data |
---|---|---|
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 | |
55a0d64b | 17 | #include <Library/ArmGicLib.h>\r |
cd872e40 | 18 | \r |
19 | VOID\r | |
20 | PrimaryMain (\r | |
21 | IN UINTN UefiMemoryBase,\r | |
c524ffbb | 22 | IN UINTN StacksBase,\r |
23 | IN UINTN GlobalVariableBase,\r | |
cd872e40 | 24 | IN UINT64 StartTimeStamp\r |
25 | )\r | |
26 | {\r | |
55a0d64b | 27 | // Enable the GIC Distributor\r |
28 | ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r | |
cd872e40 | 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 |
55a0d64b | 33 | ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E);\r |
cd872e40 | 34 | }\r |
35 | \r | |
c524ffbb | 36 | PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);\r |
cd872e40 | 37 | \r |
38 | // We must never return\r | |
39 | ASSERT(FALSE);\r | |
40 | }\r | |
41 | \r | |
42 | VOID\r | |
43 | SecondaryMain (\r | |
0787bc61 | 44 | IN UINTN MpId\r |
cd872e40 | 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 | |
0787bc61 | 57 | ArmGicAcknowledgeSgiFrom (PcdGet32(PcdGicInterruptInterfaceBase), PRIMARY_CORE_ID);\r |
cd872e40 | 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 |