]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPkg/Drivers/CpuPei/CpuPei.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / ArmPkg / Drivers / CpuPei / CpuPei.c
1 /**@file
2
3 Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>
4 Copyright (c) 2011 Hewlett Packard Corporation. All rights reserved.<BR>
5 Copyright (c) 2011-2013, ARM Limited. All rights reserved.<BR>
6
7 SPDX-License-Identifier: BSD-2-Clause-Patent
8
9 Module Name:
10
11 MemoryInit.c
12
13 Abstract:
14
15 PEIM to provide fake memory init
16
17 **/
18
19 //
20 // The package level header files this module uses
21 //
22 #include <PiPei.h>
23 //
24 // The protocols, PPI and GUID definitions for this module
25 //
26 #include <Ppi/ArmMpCoreInfo.h>
27
28 //
29 // The Library classes this module consumes
30 //
31 #include <Library/DebugLib.h>
32 #include <Library/PeimEntryPoint.h>
33 #include <Library/PeiServicesLib.h>
34 #include <Library/PcdLib.h>
35 #include <Library/HobLib.h>
36 #include <Library/ArmLib.h>
37
38 /*++
39
40 Routine Description:
41
42 Arguments:
43
44 FileHandle - Handle of the file being invoked.
45 PeiServices - Describes the list of possible PEI Services.
46
47 Returns:
48
49 Status - EFI_SUCCESS if the boot mode could be set
50
51 --*/
52 EFI_STATUS
53 EFIAPI
54 InitializeCpuPeim (
55 IN EFI_PEI_FILE_HANDLE FileHandle,
56 IN CONST EFI_PEI_SERVICES **PeiServices
57 )
58 {
59 EFI_STATUS Status;
60 ARM_MP_CORE_INFO_PPI *ArmMpCoreInfoPpi;
61 UINTN ArmCoreCount;
62 ARM_CORE_INFO *ArmCoreInfoTable;
63
64 // Enable program flow prediction, if supported.
65 ArmEnableBranchPrediction ();
66
67 // Publish the CPU memory and io spaces sizes
68 BuildCpuHob (ArmGetPhysicalAddressBits (), PcdGet8 (PcdPrePiCpuIoSize));
69
70 // Only MP Core platform need to produce gArmMpCoreInfoPpiGuid
71 Status = PeiServicesLocatePpi (&gArmMpCoreInfoPpiGuid, 0, NULL, (VOID **)&ArmMpCoreInfoPpi);
72 if (!EFI_ERROR (Status)) {
73 // Build the MP Core Info Table
74 ArmCoreCount = 0;
75 Status = ArmMpCoreInfoPpi->GetMpCoreInfo (&ArmCoreCount, &ArmCoreInfoTable);
76 if (!EFI_ERROR (Status) && (ArmCoreCount > 0)) {
77 // Build MPCore Info HOB
78 BuildGuidDataHob (&gArmMpCoreInfoGuid, ArmCoreInfoTable, sizeof (ARM_CORE_INFO) * ArmCoreCount);
79 }
80 }
81
82 return EFI_SUCCESS;
83 }