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.
16 // The package level header files this module uses
20 // The protocols, PPI and GUID defintions for this module
22 #include <Ppi/MasterBootMode.h>
23 #include <Ppi/BootInRecoveryMode.h>
25 // The Library classes this module consumes
27 #include <Library/ArmPlatformLib.h>
28 #include <Library/DebugLib.h>
29 #include <Library/PeimEntryPoint.h>
30 #include <Library/PcdLib.h>
31 #include <Library/HobLib.h>
37 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
38 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
39 &gEfiPeiMasterBootModePpiGuid
,
43 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
44 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
45 &gEfiPeiBootInRecoveryModePpiGuid
,
51 InitializePlatformPeim (
52 IN EFI_PEI_FILE_HANDLE FileHandle
,
53 IN CONST EFI_PEI_SERVICES
**PeiServices
63 FileHandle - Handle of the file being invoked.
64 PeiServices - Describes the list of possible PEI Services.
68 Status - EFI_SUCCESS if the boot mode could be set
75 DEBUG ((EFI_D_ERROR
, "Platform PEIM Loaded\n"));
77 // Initialize the platform specific controllers
78 ArmPlatformNormalInitialize ();
80 BuildCpuHob (PcdGet8 (PcdPrePiCpuMemorySize
), PcdGet8 (PcdPrePiCpuIoSize
));
82 BuildFvHob (PcdGet32(PcdNormalFvBaseAddress
), PcdGet32(PcdNormalFvSize
));
84 BootMode
= ArmPlatformGetBootMode ();
85 Status
= (**PeiServices
).SetBootMode (PeiServices
, (UINT8
) BootMode
);
86 ASSERT_EFI_ERROR (Status
);
88 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListBootMode
);
89 ASSERT_EFI_ERROR (Status
);
91 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
92 Status
= (**PeiServices
).InstallPpi (PeiServices
, &mPpiListRecoveryBootMode
);
93 ASSERT_EFI_ERROR (Status
);