3 Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>
4 Portions copyright (c) 2011, Apple Inc. All rights reserved.
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
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.
18 // The package level header files this module uses
22 #include <Library/PcdLib.h>
23 #include <Library/PeiServicesLib.h>
27 // The protocols, PPI and GUID defintions for this module
29 #include <Ppi/MasterBootMode.h>
30 #include <Ppi/BootInRecoveryMode.h>
32 // The Library classes this module consumes
34 #include <Library/DebugLib.h>
35 #include <Library/PeimEntryPoint.h>
41 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode
= {
42 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
43 &gEfiPeiMasterBootModePpiGuid
,
47 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode
= {
48 (EFI_PEI_PPI_DESCRIPTOR_PPI
| EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST
),
49 &gEfiPeiBootInRecoveryModePpiGuid
,
56 IN EFI_PEI_FILE_HANDLE FileHandle
,
57 IN CONST EFI_PEI_SERVICES
**PeiServices
63 Peform the boot mode determination logic
67 PeiServices - General purpose services available to every PEIM.
71 Status - EFI_SUCCESS if the boot mode could be set
76 EFI_BOOT_MODE BootMode
;
78 DEBUG ((EFI_D_ERROR
, "Emu Boot Mode PEIM Loaded\n"));
80 BootMode
= FixedPcdGet32 (PcdEmuBootMode
);
82 Status
= PeiServicesSetBootMode (BootMode
);
83 ASSERT_EFI_ERROR (Status
);
85 Status
= PeiServicesInstallPpi (&mPpiListBootMode
);
86 ASSERT_EFI_ERROR (Status
);
88 if (BootMode
== BOOT_IN_RECOVERY_MODE
) {
89 Status
= PeiServicesInstallPpi (&mPpiListRecoveryBootMode
);
90 ASSERT_EFI_ERROR (Status
);