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
10 // The package level header files this module uses
14 #include <Library/PcdLib.h>
15 #include <Library/PeiServicesLib.h>
18 // The protocols, PPI and GUID defintions for this module
20 #include <Ppi/MasterBootMode.h>
21 #include <Ppi/BootInRecoveryMode.h>
23 // The Library classes this module consumes
25 #include <Library/DebugLib.h>
26 #include <Library/PeimEntryPoint.h>
31 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
32 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
33 &gEfiPeiMasterBootModePpiGuid
,
37 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
38 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
39 &gEfiPeiBootInRecoveryModePpiGuid
,
46 IN EFI_PEI_FILE_HANDLE FileHandle
,
47 IN CONST EFI_PEI_SERVICES
**PeiServices
54 Peform the boot mode determination logic
58 PeiServices - General purpose services available to every PEIM.
62 Status - EFI_SUCCESS if the boot mode could be set
67 EFI_BOOT_MODE BootMode
;
69 DEBUG ((DEBUG_ERROR
, "Emu Boot Mode PEIM Loaded\n"));
71 BootMode
= FixedPcdGet32 (PcdEmuBootMode
);
73 Status
= PeiServicesSetBootMode (BootMode
);
74 ASSERT_EFI_ERROR (Status
);
76 Status
= PeiServicesInstallPpi (&mPpiListBootMode
);
77 ASSERT_EFI_ERROR (Status
);
79 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
80 Status
= PeiServicesInstallPpi (&mPpiListRecoveryBootMode
);
81 ASSERT_EFI_ERROR (Status
);