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