]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/ArmVExpressPkg/Library/ArmVExpressLibRTSM/RTSMFoundation.c
ArmPlatformPkg: Added Aarch64 Foundation Model
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibRTSM / RTSMFoundation.c
CommitLineData
f9cec5f1
HL
1/** @file\r
2*\r
3* Copyright (c) 2011-2013, 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 <Library/IoLib.h>\r
16#include <Library/ArmPlatformLib.h>\r
17#include <Library/DebugLib.h>\r
18#include <Library/PcdLib.h>\r
19\r
20#include <Ppi/ArmMpCoreInfo.h>\r
21\r
22#include <ArmPlatform.h>\r
23\r
24\r
25UINTN\r
26ArmGetCpuCountPerCluster (\r
27 VOID\r
28 );\r
29\r
30ARM_CORE_INFO mVersatileExpressMpCoreInfoTable[] = {\r
31 {\r
32 // Cluster 0, Core 0\r
33 0x0, 0x0,\r
34\r
35 // NOTE:\r
36 // The foundation model does not have the VE_SYS_REGS like all the other VE\r
37 // platforms. We pick a spot in RAM that *should* be safe in the simple case\r
38 // of no UEFI apps interfering (Only the Linux loader getting used). By the\r
39 // time we come to load Linux we should have all the cores in a safe place.\r
40 // The image expects to be loaded at 0xa0000000. We also place the mailboxes\r
41 // here as it does not matter if we corrupt the image at this time.\r
42 // NOTE also see: "ArmVExpressSecLibRTSM/AArch64/RTSMFoundationBoot.S"\r
43\r
44 // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
45 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
46 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
47 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
48 (UINT64)0x0\r
49\r
50 },\r
51 {\r
52 // Cluster 0, Core 1\r
53 0x0, 0x1,\r
54\r
55 // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
56 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
57 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
58 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
59 (UINT64)0x0\r
60\r
61 },\r
62 {\r
63 // Cluster 0, Core 2\r
64 0x0, 0x2,\r
65\r
66 // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
67 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
68 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
69 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
70 (UINT64)0x0\r
71 },\r
72 {\r
73 // Cluster 0, Core 3\r
74 0x0, 0x3,\r
75\r
76 // MP Core MailBox Set/Get/Clear Addresses and Clear Value\r
77 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
78 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
79 (EFI_PHYSICAL_ADDRESS)0xa0000000,\r
80 (UINT64)0x0\r
81 }\r
82};\r
83\r
84/**\r
85 Return the current Boot Mode\r
86\r
87 This function returns the boot reason on the platform\r
88\r
89 @return Return the current Boot Mode of the platform\r
90\r
91**/\r
92EFI_BOOT_MODE\r
93ArmPlatformGetBootMode (\r
94 VOID\r
95 )\r
96{\r
97 return BOOT_WITH_FULL_CONFIGURATION;\r
98}\r
99\r
100/**\r
101 Initialize controllers that must setup in the normal world\r
102\r
103 This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim\r
104 in the PEI phase.\r
105\r
106**/\r
107RETURN_STATUS\r
108ArmPlatformInitialize (\r
109 IN UINTN MpId\r
110 )\r
111{\r
112 /* The Foundation model has no SP810 to initialise. */\r
113\r
114 return RETURN_SUCCESS;\r
115}\r
116\r
117/**\r
118 Initialize the system (or sometimes called permanent) memory\r
119\r
120 This memory is generally represented by the DRAM.\r
121\r
122**/\r
123VOID\r
124ArmPlatformInitializeSystemMemory (\r
125 VOID\r
126 )\r
127{\r
128 // Nothing to do here\r
129}\r
130\r
131EFI_STATUS\r
132PrePeiCoreGetMpCoreInfo (\r
133 OUT UINTN *CoreCount,\r
134 OUT ARM_CORE_INFO **ArmCoreTable\r
135 )\r
136{\r
137 // Foundation model has no VE_SYS_REGS\r
138 // Only support one cluster\r
139 *CoreCount = ArmGetCpuCountPerCluster ();\r
140 *ArmCoreTable = mVersatileExpressMpCoreInfoTable;\r
141\r
142 return EFI_SUCCESS;\r
143}\r
144\r
145// Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the context of PrePeiCore\r
146EFI_GUID mArmMpCoreInfoPpiGuid = ARM_MP_CORE_INFO_PPI_GUID;\r
147ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };\r
148\r
149EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {\r
150 {\r
151 EFI_PEI_PPI_DESCRIPTOR_PPI,\r
152 &mArmMpCoreInfoPpiGuid,\r
153 &mMpCoreInfoPpi\r
154 }\r
155};\r
156\r
157VOID\r
158ArmPlatformGetPlatformPpiList (\r
159 OUT UINTN *PpiListSize,\r
160 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList\r
161 )\r
162{\r
163 *PpiListSize = sizeof(gPlatformPpiTable);\r
164 *PpiList = gPlatformPpiTable;\r
165}\r