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