3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
5 SPDX-License-Identifier: BSD-2-Clause-Patent
12 // The package level header files this module uses
16 #include <Library/PcdLib.h>
17 #include <Library/PeiServicesLib.h>
21 // The protocols, PPI and GUID defintions for this module
23 #include <Ppi/MasterBootMode.h>
24 #include <Ppi/BootInRecoveryMode.h>
26 // The Library classes this module consumes
28 #include <Library/DebugLib.h>
29 #include <Library/PeimEntryPoint.h>
35 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
36 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
37 &gEfiPeiMasterBootModePpiGuid
,
41 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
42 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
43 &gEfiPeiBootInRecoveryModePpiGuid
,
50 IN EFI_PEI_FILE_HANDLE FileHandle
,
51 IN CONST EFI_PEI_SERVICES
**PeiServices
57 Peform the boot mode determination logic
61 PeiServices - General purpose services available to every PEIM.
65 Status - EFI_SUCCESS if the boot mode could be set
70 EFI_BOOT_MODE BootMode
;
72 DEBUG ((EFI_D_ERROR
, "Emu Boot Mode PEIM Loaded\n"));
74 BootMode
= FixedPcdGet32 (PcdEmuBootMode
);
76 Status
= PeiServicesSetBootMode (BootMode
);
77 ASSERT_EFI_ERROR (Status
);
79 Status
= PeiServicesInstallPpi (&mPpiListBootMode
);
80 ASSERT_EFI_ERROR (Status
);
82 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
83 Status
= PeiServicesInstallPpi (&mPpiListRecoveryBootMode
);
84 ASSERT_EFI_ERROR (Status
);