TianoCore EDK2 master
Loading...
Searching...
No Matches
PlatformPeim.c
Go to the documentation of this file.
1
9#include <PiPei.h>
10
11//
12// The protocols, PPI and GUID definitions for this module
13//
14#include <Ppi/MasterBootMode.h>
17//
18// The Library classes this module consumes
19//
22#include <Library/DebugLib.h>
23#include <Library/HobLib.h>
26#include <Library/PcdLib.h>
27
29EFIAPI
30InitializePlatformPeim (
31 IN EFI_PEI_FILE_HANDLE FileHandle,
32 IN CONST EFI_PEI_SERVICES **PeiServices
33 );
34
36EFIAPI
38 VOID
39 );
40
41//
42// Module globals
43//
44CONST EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
45 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
46 &gEfiPeiMasterBootModePpiGuid,
47 NULL
48};
49
50CONST EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
51 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
52 &gEfiPeiBootInRecoveryModePpiGuid,
53 NULL
54};
55
56/*++
57
58Routine Description:
59
60
61
62Arguments:
63
64 FileHandle - Handle of the file being invoked.
65 PeiServices - Describes the list of possible PEI Services.
66
67Returns:
68
69 Status - EFI_SUCCESS if the boot mode could be set
70
71--*/
73EFIAPI
74InitializePlatformPeim (
75 IN EFI_PEI_FILE_HANDLE FileHandle,
76 IN CONST EFI_PEI_SERVICES **PeiServices
77 )
78{
79 EFI_STATUS Status;
80 EFI_BOOT_MODE BootMode;
81
82 DEBUG ((DEBUG_LOAD | DEBUG_INFO, "Platform PEIM Loaded\n"));
83
85 ASSERT_EFI_ERROR (Status);
86
87 PlatformPeim ();
88
89 Status = PeiServicesGetBootMode (&BootMode);
90 ASSERT_EFI_ERROR (Status);
91
92 Status = PeiServicesInstallPpi (&mPpiListBootMode);
93 ASSERT_EFI_ERROR (Status);
94
95 if (BootMode == BOOT_IN_RECOVERY_MODE) {
96 Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
97 ASSERT_EFI_ERROR (Status);
98 }
99
100 return Status;
101}
EFI_BOOT_MODE ArmPlatformGetBootMode(VOID)
EFI_STATUS EFIAPI PeiServicesGetBootMode(OUT EFI_BOOT_MODE *BootMode)
EFI_STATUS EFIAPI PeiServicesInstallPpi(IN CONST EFI_PEI_PPI_DESCRIPTOR *PpiList)
EFI_STATUS EFIAPI PeiServicesSetBootMode(IN EFI_BOOT_MODE BootMode)
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define IN
Definition: Base.h:279
#define ASSERT_EFI_ERROR(StatusParameter)
Definition: DebugLib.h:462
#define DEBUG(Expression)
Definition: DebugLib.h:434
UINT32 EFI_BOOT_MODE
Definition: PiBootMode.h:18
VOID * EFI_PEI_FILE_HANDLE
Definition: PiPeiCis.h:26
EFI_STATUS EFIAPI PlatformPeim(VOID)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29