TianoCore EDK2 master
Loading...
Searching...
No Matches
BootModePei.c
Go to the documentation of this file.
1
9//
10// The package level header files this module uses
11//
12#include <PiPei.h>
13
14#include <Library/PcdLib.h>
16
17//
18// The protocols, PPI and GUID defintions for this module
19//
20#include <Ppi/MasterBootMode.h>
22//
23// The Library classes this module consumes
24//
25#include <Library/DebugLib.h>
27
28//
29// Module globals
30//
31EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
32 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
33 &gEfiPeiMasterBootModePpiGuid,
34 NULL
35};
36
37EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
38 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
39 &gEfiPeiBootInRecoveryModePpiGuid,
40 NULL
41};
42
44EFIAPI
45InitializeBootMode (
46 IN EFI_PEI_FILE_HANDLE FileHandle,
47 IN CONST EFI_PEI_SERVICES **PeiServices
48 )
49
50/*++
51
52Routine Description:
53
54 Peform the boot mode determination logic
55
56Arguments:
57
58 PeiServices - General purpose services available to every PEIM.
59
60Returns:
61
62 Status - EFI_SUCCESS if the boot mode could be set
63
64**/
65{
66 EFI_STATUS Status;
67 EFI_BOOT_MODE BootMode;
68
69 DEBUG ((DEBUG_ERROR, "Emu Boot Mode PEIM Loaded\n"));
70
71 BootMode = FixedPcdGet32 (PcdEmuBootMode);
72
73 Status = PeiServicesSetBootMode (BootMode);
74 ASSERT_EFI_ERROR (Status);
75
76 Status = PeiServicesInstallPpi (&mPpiListBootMode);
77 ASSERT_EFI_ERROR (Status);
78
79 if (BootMode == BOOT_IN_RECOVERY_MODE) {
80 Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
81 ASSERT_EFI_ERROR (Status);
82 }
83
84 return Status;
85}
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
#define FixedPcdGet32(TokenName)
Definition: PcdLib.h:92
UINT32 EFI_BOOT_MODE
Definition: PiBootMode.h:18
VOID * EFI_PEI_FILE_HANDLE
Definition: PiPeiCis.h:26
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29