]> git.proxmox.com Git - mirror_edk2.git/blame - ArmPlatformPkg/PlatformPei/PlatformPei.c
ArmPlatformPkg/ArmPlatformLib: Renamed ArmPlatformInitialize into ArmPlatformSecIniti...
[mirror_edk2.git] / ArmPlatformPkg / PlatformPei / PlatformPei.c
CommitLineData
1d5d0ae9 1/** @file\r
2*\r
3* Copyright (c) 2011, ARM Limited. All rights reserved.\r
4* \r
5* This program and the accompanying materials \r
6* are licensed and made available under the terms and conditions of the BSD License \r
7* which accompanies this distribution. The full text of the license may be found at \r
8* http://opensource.org/licenses/bsd-license.php \r
9*\r
10* THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
11* WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
12*\r
13**/\r
14\r
15//\r
16// The package level header files this module uses\r
17//\r
18#include <PiPei.h>\r
19//\r
20// The protocols, PPI and GUID defintions for this module\r
21//\r
22#include <Ppi/MasterBootMode.h>\r
23#include <Ppi/BootInRecoveryMode.h>\r
24//\r
25// The Library classes this module consumes\r
26//\r
27#include <Library/DebugLib.h>\r
28#include <Library/PeimEntryPoint.h>\r
29#include <Library/PcdLib.h>\r
30#include <Library/HobLib.h>\r
31\r
32\r
33//\r
34// Module globals\r
35//\r
36EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r
37 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
38 &gEfiPeiMasterBootModePpiGuid,\r
39 NULL\r
40};\r
41\r
42EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r
43 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
44 &gEfiPeiBootInRecoveryModePpiGuid,\r
45 NULL\r
46};\r
47\r
48EFI_STATUS\r
49EFIAPI\r
50InitializePlatformPeim (\r
51 IN EFI_PEI_FILE_HANDLE FileHandle,\r
52 IN CONST EFI_PEI_SERVICES **PeiServices\r
53 )\r
54/*++\r
55\r
56Routine Description:\r
57\r
58 \r
59\r
60Arguments:\r
61\r
62 FileHandle - Handle of the file being invoked.\r
63 PeiServices - Describes the list of possible PEI Services.\r
64 \r
65Returns:\r
66\r
67 Status - EFI_SUCCESS if the boot mode could be set\r
68\r
69--*/\r
70{\r
71 EFI_STATUS Status;\r
72 UINTN BootMode;\r
73\r
74 DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));\r
75\r
aa01abaa 76 // Initialize the platform specific controllers\r
77 ArmPlatformNormalInitialize ();\r
78\r
1d5d0ae9 79 BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize), PcdGet8 (PcdPrePiCpuIoSize));\r
80 \r
81 BuildFvHob (FixedPcdGet32(PcdFlashFvMainBase), FixedPcdGet32(PcdFlashFvMainSize));\r
82 \r
a534d714 83 BootMode = ArmPlatformGetBootMode ();\r
1d5d0ae9 84 Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);\r
85 ASSERT_EFI_ERROR (Status);\r
86\r
87 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);\r
88 ASSERT_EFI_ERROR (Status);\r
89\r
90 if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
91 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);\r
92 ASSERT_EFI_ERROR (Status);\r
93 }\r
94\r
95 return Status;\r
96}\r