]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - ArmPkg/Drivers/CpuPei/CpuPei.c
ArmPkg/CpuPei: base GCD memory space size on CPU's PA range
[mirror_edk2.git] / ArmPkg / Drivers / CpuPei / CpuPei.c
... / ...
CommitLineData
1/**@file\r
2\r
3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
4Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.<BR>\r
5Copyright (c) 2011-2013, ARM Limited. All rights reserved.<BR>\r
6\r
7This program and the accompanying materials\r
8are licensed and made available under the terms and conditions of the BSD License\r
9which accompanies this distribution. The full text of the license may be found at\r
10http://opensource.org/licenses/bsd-license.php\r
11\r
12THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14\r
15Module Name:\r
16\r
17 MemoryInit.c\r
18\r
19Abstract:\r
20\r
21 PEIM to provide fake memory init\r
22\r
23**/\r
24\r
25\r
26\r
27//\r
28// The package level header files this module uses\r
29//\r
30#include <PiPei.h>\r
31//\r
32// The protocols, PPI and GUID defintions for this module\r
33//\r
34#include <Ppi/ArmMpCoreInfo.h>\r
35\r
36//\r
37// The Library classes this module consumes\r
38//\r
39#include <Library/DebugLib.h>\r
40#include <Library/PeimEntryPoint.h>\r
41#include <Library/PeiServicesLib.h>\r
42#include <Library/PcdLib.h>\r
43#include <Library/HobLib.h>\r
44#include <Library/ArmLib.h>\r
45\r
46/*++\r
47\r
48Routine Description:\r
49\r
50Arguments:\r
51\r
52 FileHandle - Handle of the file being invoked.\r
53 PeiServices - Describes the list of possible PEI Services.\r
54\r
55Returns:\r
56\r
57 Status - EFI_SUCCESS if the boot mode could be set\r
58\r
59--*/\r
60EFI_STATUS\r
61EFIAPI\r
62InitializeCpuPeim (\r
63 IN EFI_PEI_FILE_HANDLE FileHandle,\r
64 IN CONST EFI_PEI_SERVICES **PeiServices\r
65 )\r
66{\r
67 EFI_STATUS Status;\r
68 ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;\r
69 UINTN ArmCoreCount;\r
70 ARM_CORE_INFO *ArmCoreInfoTable;\r
71\r
72 // Enable program flow prediction, if supported.\r
73 ArmEnableBranchPrediction ();\r
74\r
75 // Publish the CPU memory and io spaces sizes\r
76 BuildCpuHob (ArmGetPhysicalAddressBits (), PcdGet8 (PcdPrePiCpuIoSize));\r
77\r
78 // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid\r
79 Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID**)&ArmMpCoreInfoPpi);\r
80 if (!EFI_ERROR(Status)) {\r
81 // Build the MP Core Info Table\r
82 ArmCoreCount = 0;\r
83 Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);\r
84 if (!EFI_ERROR(Status) && (ArmCoreCount > 0)) {\r
85 // Build MPCore Info HOB\r
86 BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);\r
87 }\r
88 }\r
89\r
90 return EFI_SUCCESS;\r
91}\r