]> git.proxmox.com Git - mirror_edk2.git/blob - ArmPlatformPkg/PlatformPei/PlatformPeim.c
ArmPlatformPkg: Fix builds
[mirror_edk2.git] / ArmPlatformPkg / PlatformPei / PlatformPeim.c
1 /** @file
2 *
3 * Copyright (c) 2011, ARM Limited. All rights reserved.
4 *
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
9 *
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.
12 *
13 **/
14
15 #include <PiPei.h>
16
17 //
18 // The protocols, PPI and GUID defintions for this module
19 //
20 #include <Ppi/MasterBootMode.h>
21 #include <Ppi/BootInRecoveryMode.h>
22 //
23 // The Library classes this module consumes
24 //
25 #include <Library/PeimEntryPoint.h>
26 #include <Library/PcdLib.h>
27 #include <Library/DebugLib.h>
28 #include <Library/ArmPlatformLib.h>
29
30 EFI_STATUS
31 EFIAPI
32 InitializePlatformPeim (
33 IN EFI_PEI_FILE_HANDLE FileHandle,
34 IN CONST EFI_PEI_SERVICES **PeiServices
35 );
36
37 EFI_STATUS
38 EFIAPI
39 PlatformPeim (
40 VOID
41 );
42
43 //
44 // Module globals
45 //
46 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
47 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
48 &gEfiPeiMasterBootModePpiGuid,
49 NULL
50 };
51
52 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
53 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
54 &gEfiPeiBootInRecoveryModePpiGuid,
55 NULL
56 };
57
58 /*++
59
60 Routine Description:
61
62
63
64 Arguments:
65
66 FileHandle - Handle of the file being invoked.
67 PeiServices - Describes the list of possible PEI Services.
68
69 Returns:
70
71 Status - EFI_SUCCESS if the boot mode could be set
72
73 --*/
74 EFI_STATUS
75 EFIAPI
76 InitializePlatformPeim (
77 IN EFI_PEI_FILE_HANDLE FileHandle,
78 IN CONST EFI_PEI_SERVICES **PeiServices
79 )
80 {
81 EFI_STATUS Status;
82 UINTN BootMode;
83
84 DEBUG ((EFI_D_ERROR, "Platform PEIM Loaded\n"));
85
86 PlatformPeim ();
87
88 BootMode = ArmPlatformGetBootMode ();
89 Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
90 ASSERT_EFI_ERROR (Status);
91
92 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
93 ASSERT_EFI_ERROR (Status);
94
95 if (BootMode == BOOT_IN_RECOVERY_MODE) {
96 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
97 ASSERT_EFI_ERROR (Status);
98 }
99
100 return Status;
101 }