]>
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 | #include <Chipset/ArmV7.h>\r |
cd872e40 | 19 | \r |
20 | VOID\r | |
21 | PrimaryMain (\r | |
22 | IN UINTN UefiMemoryBase,\r | |
c524ffbb | 23 | IN UINTN StacksBase,\r |
24 | IN UINTN GlobalVariableBase,\r | |
cd872e40 | 25 | IN UINT64 StartTimeStamp\r |
26 | )\r | |
27 | {\r | |
55a0d64b | 28 | // Enable the GIC Distributor\r |
29 | ArmGicEnableDistributor(PcdGet32(PcdGicDistributorBase));\r | |
cd872e40 | 30 | \r |
d269095b | 31 | // In some cases, the secondary cores are waiting for an SGI from the next stage boot loader toresume their initialization\r |
32 | if (!FixedPcdGet32(PcdSendSgiToBringUpSecondaryCores)) {\r | |
cd872e40 | 33 | // Sending SGI to all the Secondary CPU interfaces\r |
55a0d64b | 34 | ArmGicSendSgiTo (PcdGet32(PcdGicDistributorBase), ARM_GIC_ICDSGIR_FILTER_EVERYONEELSE, 0x0E);\r |
cd872e40 | 35 | }\r |
36 | \r | |
c524ffbb | 37 | PrePiMain (UefiMemoryBase, StacksBase, GlobalVariableBase, StartTimeStamp);\r |
cd872e40 | 38 | \r |
39 | // We must never return\r | |
40 | ASSERT(FALSE);\r | |
41 | }\r | |
42 | \r | |
43 | VOID\r | |
44 | SecondaryMain (\r | |
0787bc61 | 45 | IN UINTN MpId\r |
cd872e40 | 46 | )\r |
47 | {\r | |
48 | // Function pointer to Secondary Core entry point\r | |
49 | VOID (*secondary_start)(VOID);\r | |
50 | UINTN secondary_entry_addr=0;\r | |
51 | \r | |
52 | // Clear Secondary cores MailBox\r | |
53 | ArmClearMPCoreMailbox();\r | |
54 | \r | |
55 | while (secondary_entry_addr = ArmGetMPCoreMailbox(), secondary_entry_addr == 0) {\r | |
56 | ArmCallWFI();\r | |
57 | // Acknowledge the interrupt and send End of Interrupt signal.\r | |
0787bc61 | 58 | ArmGicAcknowledgeSgiFrom (PcdGet32(PcdGicInterruptInterfaceBase), PRIMARY_CORE_ID);\r |
cd872e40 | 59 | }\r |
60 | \r | |
61 | secondary_start = (VOID (*)())secondary_entry_addr;\r | |
62 | \r | |
63 | // Jump to secondary core entry point.\r | |
64 | secondary_start();\r | |
65 | \r | |
66 | // The secondaries shouldn't reach here\r | |
67 | ASSERT(FALSE);\r | |
68 | }\r |