ArmPlatformPkg: remove ArmPlatformInitializeSystemMemory
[mirror_edk2.git] / ArmPlatformPkg / ArmVExpressPkg / Library / ArmVExpressLibCTA15-A7 / CTA15-A7.c
1 /** @file
2 *
3 * Copyright (c) 2012, ARM Limited. All rights reserved.
4 *
5 * This program and the accompanying materials
6 * are licensed and made available under the terms and conditions of the BSD License
7 * which accompanies this distribution. The full text of the license may be found at
8 * http://opensource.org/licenses/bsd-license.php
9 *
10 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 *
13 **/
14
15 #include <Library/IoLib.h>
16 #include <Library/ArmPlatformLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
19
20 #include <Ppi/ArmMpCoreInfo.h>
21
22 #include <ArmPlatform.h>
23
24 ARM_CORE_INFO mVersatileExpressCTA15A7InfoTable[] = {
25 {
26 // Cluster 0, Core 0
27 0x0, 0x0,
28
29 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
30 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
31 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
32 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR0,
33 (UINT64)0
34 },
35 {
36 // Cluster 0, Core 1
37 0x0, 0x1,
38
39 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
40 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
41 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
42 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR1,
43 (UINT64)0
44 },
45 #ifndef ARM_BIGLITTLE_TC2
46 {
47 // Cluster 0, Core 2
48 0x0, 0x2,
49
50 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
51 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
52 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
53 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR2,
54 (UINT64)0
55 },
56 {
57 // Cluster 0, Core 3
58 0x0, 0x3,
59
60 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
61 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
62 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
63 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A15_BX_ADDR3,
64 (UINT64)0
65 },
66 #endif
67 {
68 // Cluster 1, Core 0
69 0x1, 0x0,
70
71 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
72 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
73 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
74 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR0,
75 (UINT64)0
76 },
77 {
78 // Cluster 1, Core 1
79 0x1, 0x1,
80
81 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
82 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
83 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
84 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR1,
85 (UINT64)0
86 },
87 {
88 // Cluster 1, Core 2
89 0x1, 0x2,
90
91 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
92 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
93 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
94 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR2,
95 (UINT64)0
96 }
97 #ifndef ARM_BIGLITTLE_TC2
98 ,{
99 // Cluster 1, Core 3
100 0x1, 0x3,
101
102 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
103 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
104 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
105 (EFI_PHYSICAL_ADDRESS)ARM_CTA15A7_SPC_A7_BX_ADDR3,
106 (UINT64)0
107 }
108 #endif
109 };
110
111 /**
112 Return the current Boot Mode
113
114 This function returns the boot reason on the platform
115
116 @return Return the current Boot Mode of the platform
117
118 **/
119 EFI_BOOT_MODE
120 ArmPlatformGetBootMode (
121 VOID
122 )
123 {
124 if (MmioRead32(ARM_CTA15A7_SCC_SYSINFO) & ARM_CTA15A7_SCC_SYSINFO_UEFI_RESTORE_DEFAULT_NORFLASH) {
125 return BOOT_WITH_DEFAULT_SETTINGS;
126 } else {
127 return BOOT_WITH_FULL_CONFIGURATION;
128 }
129 }
130
131 /**
132 Initialize controllers that must setup in the normal world
133
134 This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
135 in the PEI phase.
136
137 **/
138 RETURN_STATUS
139 ArmPlatformInitialize (
140 IN UINTN MpId
141 )
142 {
143 if (!ArmPlatformIsPrimaryCore (MpId)) {
144 return RETURN_SUCCESS;
145 }
146
147 // Nothing to do here
148
149 return RETURN_SUCCESS;
150 }
151
152 EFI_STATUS
153 PrePeiCoreGetMpCoreInfo (
154 OUT UINTN *CoreCount,
155 OUT ARM_CORE_INFO **ArmCoreTable
156 )
157 {
158 // Only support one cluster
159 *CoreCount = sizeof(mVersatileExpressCTA15A7InfoTable) / sizeof(ARM_CORE_INFO);
160 *ArmCoreTable = mVersatileExpressCTA15A7InfoTable;
161 return EFI_SUCCESS;
162 }
163
164 ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
165
166 EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
167 {
168 EFI_PEI_PPI_DESCRIPTOR_PPI,
169 &gArmMpCoreInfoPpiGuid,
170 &mMpCoreInfoPpi
171 }
172 };
173
174 VOID
175 ArmPlatformGetPlatformPpiList (
176 OUT UINTN *PpiListSize,
177 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
178 )
179 {
180 *PpiListSize = sizeof(gPlatformPpiTable);
181 *PpiList = gPlatformPpiTable;
182 }