]> git.proxmox.com Git - mirror_edk2.git/blob - EmulatorPkg/BootModePei/BootModePei.c
BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue
[mirror_edk2.git] / EmulatorPkg / BootModePei / BootModePei.c
1 /** @file
2
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
9
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.
12
13 **/
14
15
16
17 //
18 // The package level header files this module uses
19 //
20 #include <PiPei.h>
21
22 #include <Library/PcdLib.h>
23 #include <Library/PeiServicesLib.h>
24
25
26 //
27 // The protocols, PPI and GUID defintions for this module
28 //
29 #include <Ppi/MasterBootMode.h>
30 #include <Ppi/BootInRecoveryMode.h>
31 //
32 // The Library classes this module consumes
33 //
34 #include <Library/DebugLib.h>
35 #include <Library/PeimEntryPoint.h>
36
37
38 //
39 // Module globals
40 //
41 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
42 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
43 &gEfiPeiMasterBootModePpiGuid,
44 NULL
45 };
46
47 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
48 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
49 &gEfiPeiBootInRecoveryModePpiGuid,
50 NULL
51 };
52
53 EFI_STATUS
54 EFIAPI
55 InitializeBootMode (
56 IN EFI_PEI_FILE_HANDLE FileHandle,
57 IN CONST EFI_PEI_SERVICES **PeiServices
58 )
59 /*++
60
61 Routine Description:
62
63 Peform the boot mode determination logic
64
65 Arguments:
66
67 PeiServices - General purpose services available to every PEIM.
68
69 Returns:
70
71 Status - EFI_SUCCESS if the boot mode could be set
72
73 **/
74 {
75 EFI_STATUS Status;
76 EFI_BOOT_MODE BootMode;
77
78 DEBUG ((EFI_D_ERROR, "Emu Boot Mode PEIM Loaded\n"));
79
80 BootMode = FixedPcdGet32 (PcdEmuBootMode);
81
82 Status = PeiServicesSetBootMode (BootMode);
83 ASSERT_EFI_ERROR (Status);
84
85 Status = PeiServicesInstallPpi (&mPpiListBootMode);
86 ASSERT_EFI_ERROR (Status);
87
88 if (BootMode == BOOT_IN_RECOVERY_MODE) {
89 Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);
90 ASSERT_EFI_ERROR (Status);
91 }
92
93 return Status;
94 }