]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/ArmJunoPkg/Library/ArmJunoLib/ArmJuno.c
3be26d3ed0ac983470ac6bb85605aacc58ef1a91
[mirror_edk2.git] / ArmPlatformPkg / ArmJunoPkg / Library / ArmJunoLib / ArmJuno.c
1 /** @file
2 *
3 * Copyright (c) 2013-2014, 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 mJunoInfoTable[] = {
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_VE_SYS_FLAGS_REG,
31 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
32 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
33 (UINT64)0xFFFFFFFF
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_VE_SYS_FLAGS_REG,
41 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
42 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
43 (UINT64)0xFFFFFFFF
44 },
45 {
46 // Cluster 1, Core 0
47 0x1, 0x0,
48
49 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
50 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
51 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
52 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
53 (UINT64)0xFFFFFFFF
54 },
55 {
56 // Cluster 1, Core 1
57 0x1, 0x1,
58
59 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
60 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
61 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
62 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
63 (UINT64)0xFFFFFFFF
64 },
65 {
66 // Cluster 1, Core 2
67 0x1, 0x2,
68
69 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
70 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
71 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
72 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
73 (UINT64)0xFFFFFFFF
74 },
75 {
76 // Cluster 1, Core 3
77 0x1, 0x3,
78
79 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
80 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_REG,
81 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_SET_REG,
82 (EFI_PHYSICAL_ADDRESS)ARM_VE_SYS_FLAGS_CLR_REG,
83 (UINT64)0xFFFFFFFF
84 }
85 };
86
87 /**
88 Return the current Boot Mode
89
90 This function returns the boot reason on the platform
91
92 @return Return the current Boot Mode of the platform
93
94 **/
95 EFI_BOOT_MODE
96 ArmPlatformGetBootMode (
97 VOID
98 )
99 {
100 return BOOT_WITH_FULL_CONFIGURATION;
101 }
102
103 /**
104 Initialize controllers that must setup in the normal world
105
106 This function is called by the ArmPlatformPkg/Pei or ArmPlatformPkg/Pei/PlatformPeim
107 in the PEI phase.
108
109 **/
110 RETURN_STATUS
111 ArmPlatformInitialize (
112 IN UINTN MpId
113 )
114 {
115 return RETURN_SUCCESS;
116 }
117
118 /**
119 Initialize the system (or sometimes called permanent) memory
120
121 This memory is generally represented by the DRAM.
122
123 **/
124 VOID
125 ArmPlatformInitializeSystemMemory (
126 VOID
127 )
128 {
129 }
130
131 EFI_STATUS
132 PrePeiCoreGetMpCoreInfo (
133 OUT UINTN *CoreCount,
134 OUT ARM_CORE_INFO **ArmCoreTable
135 )
136 {
137 // Only support one cluster
138 *CoreCount = sizeof(mJunoInfoTable) / sizeof(ARM_CORE_INFO);
139 *ArmCoreTable = mJunoInfoTable;
140 return EFI_SUCCESS;
141 }
142
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 };
146
147 EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
148 {
149 EFI_PEI_PPI_DESCRIPTOR_PPI,
150 &mArmMpCoreInfoPpiGuid,
151 &mMpCoreInfoPpi
152 }
153 };
154
155 VOID
156 ArmPlatformGetPlatformPpiList (
157 OUT UINTN *PpiListSize,
158 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
159 )
160 {
161 *PpiListSize = sizeof(gPlatformPpiTable);
162 *PpiList = gPlatformPpiTable;
163 }