f80a276a04d6fa6f35ffb5475cf04ab2b64a7a0c
[mirror_edk2.git] / ArmPlatformPkg / Library / ArmPlatformLibNull / ArmPlatformLibNull.c
1 /** @file
2 *
3 * Copyright (c) 2011-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/ArmLib.h>
16 #include <Library/ArmPlatformLib.h>
17
18 #include <Ppi/ArmMpCoreInfo.h>
19
20
21 ARM_CORE_INFO mArmPlatformNullMpCoreInfoTable[] = {
22 {
23 // Cluster 0, Core 0
24 0x0, 0x0,
25
26 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
27 (EFI_PHYSICAL_ADDRESS)0,
28 (EFI_PHYSICAL_ADDRESS)0,
29 (EFI_PHYSICAL_ADDRESS)0,
30 (UINT64)0xFFFFFFFF
31 },
32 {
33 // Cluster 0, Core 1
34 0x0, 0x1,
35
36 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
37 (EFI_PHYSICAL_ADDRESS)0,
38 (EFI_PHYSICAL_ADDRESS)0,
39 (EFI_PHYSICAL_ADDRESS)0,
40 (UINT64)0xFFFFFFFF
41 },
42 {
43 // Cluster 0, Core 2
44 0x0, 0x2,
45
46 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
47 (EFI_PHYSICAL_ADDRESS)0,
48 (EFI_PHYSICAL_ADDRESS)0,
49 (EFI_PHYSICAL_ADDRESS)0,
50 (UINT64)0xFFFFFFFF
51 },
52 {
53 // Cluster 0, Core 3
54 0x0, 0x3,
55
56 // MP Core MailBox Set/Get/Clear Addresses and Clear Value
57 (EFI_PHYSICAL_ADDRESS)0,
58 (EFI_PHYSICAL_ADDRESS)0,
59 (EFI_PHYSICAL_ADDRESS)0,
60 (UINT64)0xFFFFFFFF
61 }
62 };
63
64 // This function should be better located into TimerLib implementation
65 RETURN_STATUS
66 EFIAPI
67 TimerConstructor (
68 VOID
69 )
70 {
71 return EFI_SUCCESS;
72 }
73
74 /**
75 Return the current Boot Mode
76
77 This function returns the boot reason on the platform
78
79 **/
80 EFI_BOOT_MODE
81 ArmPlatformGetBootMode (
82 VOID
83 )
84 {
85 return BOOT_WITH_FULL_CONFIGURATION;
86 }
87
88 /**
89 Initialize controllers that must setup in the normal world
90
91 This function is called by the ArmPlatformPkg/PrePi or ArmPlatformPkg/PlatformPei
92 in the PEI phase.
93
94 **/
95 RETURN_STATUS
96 ArmPlatformInitialize (
97 IN UINTN MpId
98 )
99 {
100 if (!ArmPlatformIsPrimaryCore (MpId)) {
101 return RETURN_SUCCESS;
102 }
103
104 //TODO: Implement me
105
106 return RETURN_SUCCESS;
107 }
108
109 /**
110 Initialize the system (or sometimes called permanent) memory
111
112 This memory is generally represented by the DRAM.
113
114 **/
115 VOID
116 ArmPlatformInitializeSystemMemory (
117 VOID
118 )
119 {
120 //TODO: Implement me
121 }
122
123 EFI_STATUS
124 PrePeiCoreGetMpCoreInfo (
125 OUT UINTN *CoreCount,
126 OUT ARM_CORE_INFO **ArmCoreTable
127 )
128 {
129 if (ArmIsMpCore()) {
130 *CoreCount = sizeof(mArmPlatformNullMpCoreInfoTable) / sizeof(ARM_CORE_INFO);
131 *ArmCoreTable = mArmPlatformNullMpCoreInfoTable;
132 return EFI_SUCCESS;
133 } else {
134 return EFI_UNSUPPORTED;
135 }
136 }
137
138 ARM_MP_CORE_INFO_PPI mMpCoreInfoPpi = { PrePeiCoreGetMpCoreInfo };
139
140 EFI_PEI_PPI_DESCRIPTOR gPlatformPpiTable[] = {
141 {
142 EFI_PEI_PPI_DESCRIPTOR_PPI,
143 &gArmMpCoreInfoPpiGuid,
144 &mMpCoreInfoPpi
145 }
146 };
147
148 VOID
149 ArmPlatformGetPlatformPpiList (
150 OUT UINTN *PpiListSize,
151 OUT EFI_PEI_PPI_DESCRIPTOR **PpiList
152 )
153 {
154 if (ArmIsMpCore()) {
155 *PpiListSize = sizeof(gPlatformPpiTable);
156 *PpiList = gPlatformPpiTable;
157 } else {
158 *PpiListSize = 0;
159 *PpiList = NULL;
160 }
161 }
162