3 * Copyright (c) 2011, ARM Limited. All rights reserved.
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
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.
18 // The protocols, PPI and GUID defintions for this module
20 #include <Ppi/MasterBootMode.h>
21 #include <Ppi/BootInRecoveryMode.h>
23 // The Library classes this module consumes
25 #include <Library/PeimEntryPoint.h>
26 #include <Library/PcdLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/ArmPlatformLib.h>
32 InitializePlatformPeim (
33 IN EFI_PEI_FILE_HANDLE FileHandle
,
34 IN CONST EFI_PEI_SERVICES
**PeiServices
46 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
47 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
48 &gEfiPeiMasterBootModePpiGuid
,
52 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
53 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
54 &gEfiPeiBootInRecoveryModePpiGuid
,
66 FileHandle - Handle of the file being invoked.
67 PeiServices - Describes the list of possible PEI Services.
71 Status - EFI_SUCCESS if the boot mode could be set
76 InitializePlatformPeim (
77 IN EFI_PEI_FILE_HANDLE FileHandle
,
78 IN CONST EFI_PEI_SERVICES
**PeiServices
84 DEBUG ((EFI_D_ERROR
, "Platform PEIM Loaded\n"));
88 BootMode
= ArmPlatformGetBootMode ();
89 Status
= (**PeiServices
).SetBootMode (PeiServices
, (UINT8
) BootMode
);
90 ASSERT_EFI_ERROR (Status
);
92 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListBootMode
);
93 ASSERT_EFI_ERROR (Status
);
95 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
96 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListRecoveryBootMode
);
97 ASSERT_EFI_ERROR (Status
);