3 * Copyright (c) 2011-2012, ARM Limited. All rights reserved.
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
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.
15 #include <Library/IoLib.h>
16 #include <Library/ArmPlatformLib.h>
17 #include <Library/DebugLib.h>
18 #include <Library/PcdLib.h>
20 #include <Ppi/ArmMpCoreInfo.h>
22 #include <ArmPlatform.h>
25 ArmGetCpuCountPerCluster (
29 ARM_CORE_INFO mVersatileExpressMpCoreInfoTable
[] = {
34 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
35 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_REG
,
36 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_SET_REG
,
37 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_CLR_REG
,
44 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
45 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_REG
,
46 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_SET_REG
,
47 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_CLR_REG
,
54 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
55 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_REG
,
56 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_SET_REG
,
57 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_CLR_REG
,
64 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
65 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_REG
,
66 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_SET_REG
,
67 (EFI_PHYSICAL_ADDRESS
)ARM_VE_SYS_FLAGS_CLR_REG
,
73 Return the current Boot Mode
75 This function returns the boot reason on the platform
77 @return Return the current Boot Mode of the platform
81 ArmPlatformGetBootMode (
85 return BOOT_WITH_FULL_CONFIGURATION
;
89 Initialize controllers that must setup in the normal world
91 This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
96 ArmPlatformInitialize (
100 if (!IS_PRIMARY_CORE(MpId
)) {
101 return RETURN_SUCCESS
;
104 // Disable memory remapping and return to normal mapping
105 MmioOr32 (SP810_CTRL_BASE
, BIT8
);
107 return RETURN_SUCCESS
;
111 Initialize the system (or sometimes called permanent) memory
113 This memory is generally represented by the DRAM.
117 ArmPlatformInitializeSystemMemory (
121 // Nothing to do here
125 PrePeiCoreGetMpCoreInfo (
126 OUT UINTN
*CoreCount
,
127 OUT ARM_CORE_INFO
**ArmCoreTable
132 ProcType
= MmioRead32 (ARM_VE_SYS_PROCID0_REG
) & ARM_VE_SYS_PROC_ID_MASK
;
133 if ((ProcType
== ARM_VE_SYS_PROC_ID_CORTEX_A9
) || (ProcType
== ARM_VE_SYS_PROC_ID_CORTEX_A15
)) {
134 // Only support one cluster
135 *CoreCount
= ArmGetCpuCountPerCluster ();
136 *ArmCoreTable
= mVersatileExpressMpCoreInfoTable
;
139 return EFI_UNSUPPORTED
;
143 // Needs to be declared in the file. Otherwise gArmMpCoreInfoPpiGuid is undefined in the contect of PrePeiCore
144 EFI_GUID mArmMpCoreInfoPpiGuid
= ARM_MP_CORE_INFO_PPI_GUID
;
145 ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi
= { PrePeiCoreGetMpCoreInfo
};
147 EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable
[] = {
149 EFI_PEI_PPI_DESCRIPTOR_PPI
,
150 &mArmMpCoreInfoPpiGuid
,
156 ArmPlatformGetPlatformPpiList (
157 OUT UINTN
*PpiListSize
,
158 OUT EFI_PEI_PPI_DESCRIPTOR
**PpiList
161 *PpiListSize
= sizeof(gPlatformPpiTable
);
162 *PpiList
= gPlatformPpiTable
;