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>
22 #include <Ppi/GuidedSectionExtraction.h>
24 // The Library classes this module consumes
26 #include <Library/ArmPlatformLib.h>
27 #include <Library/BaseMemoryLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/HobLib.h>
30 #include <Library/PeimEntryPoint.h>
31 #include <Library/PeiServicesLib.h>
32 #include <Library/PcdLib.h>
36 InitializePlatformPeim (
37 IN EFI_PEI_FILE_HANDLE FileHandle
,
38 IN CONST EFI_PEI_SERVICES
**PeiServices
50 CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
51 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
52 &gEfiPeiMasterBootModePpiGuid
,
56 CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
57 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
58 &gEfiPeiBootInRecoveryModePpiGuid
,
70 FileHandle - Handle of the file being invoked.
71 PeiServices - Describes the list of possible PEI Services.
75 Status - EFI_SUCCESS if the boot mode could be set
80 InitializePlatformPeim (
81 IN EFI_PEI_FILE_HANDLE FileHandle
,
82 IN CONST EFI_PEI_SERVICES
**PeiServices
88 DEBUG ((EFI_D_LOAD
| EFI_D_INFO
, "Platform PEIM Loaded\n"));
92 BootMode
= ArmPlatformGetBootMode ();
93 Status
= (**PeiServices
).SetBootMode (PeiServices
, (UINT8
) BootMode
);
94 ASSERT_EFI_ERROR (Status
);
96 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListBootMode
);
97 ASSERT_EFI_ERROR (Status
);
99 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
100 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListRecoveryBootMode
);
101 ASSERT_EFI_ERROR (Status
);