3 * Copyright (c) 2011, ARM Limited. All rights reserved.
5 * SPDX-License-Identifier: BSD-2-Clause-Patent
12 // The protocols, PPI and GUID definitions for this module
14 #include <Ppi/MasterBootMode.h>
15 #include <Ppi/BootInRecoveryMode.h>
16 #include <Ppi/GuidedSectionExtraction.h>
18 // The Library classes this module consumes
20 #include <Library/ArmPlatformLib.h>
21 #include <Library/BaseMemoryLib.h>
22 #include <Library/DebugLib.h>
23 #include <Library/HobLib.h>
24 #include <Library/PeimEntryPoint.h>
25 #include <Library/PeiServicesLib.h>
26 #include <Library/PcdLib.h>
30 InitializePlatformPeim (
31 IN EFI_PEI_FILE_HANDLE FileHandle
,
32 IN CONST EFI_PEI_SERVICES
**PeiServices
44 CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
45 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
46 &gEfiPeiMasterBootModePpiGuid
,
50 CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
51 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
52 &gEfiPeiBootInRecoveryModePpiGuid
,
64 FileHandle - Handle of the file being invoked.
65 PeiServices - Describes the list of possible PEI Services.
69 Status - EFI_SUCCESS if the boot mode could be set
74 InitializePlatformPeim (
75 IN EFI_PEI_FILE_HANDLE FileHandle
,
76 IN CONST EFI_PEI_SERVICES
**PeiServices
80 EFI_BOOT_MODE BootMode
;
82 DEBUG ((EFI_D_LOAD
| EFI_D_INFO
, "Platform PEIM Loaded\n"));
84 Status
= PeiServicesSetBootMode (ArmPlatformGetBootMode ());
85 ASSERT_EFI_ERROR (Status
);
89 Status
= PeiServicesGetBootMode (&BootMode
);
90 ASSERT_EFI_ERROR (Status
);
92 Status
= PeiServicesInstallPpi (&mPpiListBootMode
);
93 ASSERT_EFI_ERROR (Status
);
95 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
96 Status
= PeiServicesInstallPpi (&mPpiListRecoveryBootMode
);
97 ASSERT_EFI_ERROR (Status
);