]> git.proxmox.com Git - mirror_edk2.git/blame - EmulatorPkg/BootModePei/BootModePei.c
EmulatorPkg: Apply uncrustify changes
[mirror_edk2.git] / EmulatorPkg / BootModePei / BootModePei.c
CommitLineData
949f388f 1/** @file\r
2\r
3Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved.<BR>\r
4Portions copyright (c) 2011, Apple Inc. All rights reserved.\r
e3ba31da 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
949f388f 6\r
7**/\r
8\r
949f388f 9//\r
10// The package level header files this module uses\r
11//\r
12#include <PiPei.h>\r
13\r
14#include <Library/PcdLib.h>\r
15#include <Library/PeiServicesLib.h>\r
16\r
949f388f 17//\r
18// The protocols, PPI and GUID defintions for this module\r
19//\r
20#include <Ppi/MasterBootMode.h>\r
21#include <Ppi/BootInRecoveryMode.h>\r
22//\r
23// The Library classes this module consumes\r
24//\r
25#include <Library/DebugLib.h>\r
26#include <Library/PeimEntryPoint.h>\r
27\r
949f388f 28//\r
29// Module globals\r
30//\r
31EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r
32 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
33 &gEfiPeiMasterBootModePpiGuid,\r
34 NULL\r
35};\r
36\r
37EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r
38 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
39 &gEfiPeiBootInRecoveryModePpiGuid,\r
40 NULL\r
41};\r
42\r
43EFI_STATUS\r
44EFIAPI\r
45InitializeBootMode (\r
a550d468
MK
46 IN EFI_PEI_FILE_HANDLE FileHandle,\r
47 IN CONST EFI_PEI_SERVICES **PeiServices\r
949f388f 48 )\r
a550d468 49\r
949f388f 50/*++\r
51\r
52Routine Description:\r
53\r
54 Peform the boot mode determination logic\r
55\r
56Arguments:\r
57\r
58 PeiServices - General purpose services available to every PEIM.\r
d18d8a1d 59\r
949f388f 60Returns:\r
61\r
62 Status - EFI_SUCCESS if the boot mode could be set\r
63\r
64**/\r
65{\r
a550d468
MK
66 EFI_STATUS Status;\r
67 EFI_BOOT_MODE BootMode;\r
949f388f 68\r
9c7da8d8 69 DEBUG ((DEBUG_ERROR, "Emu Boot Mode PEIM Loaded\n"));\r
949f388f 70\r
a550d468 71 BootMode = FixedPcdGet32 (PcdEmuBootMode);\r
949f388f 72\r
a550d468 73 Status = PeiServicesSetBootMode (BootMode);\r
949f388f 74 ASSERT_EFI_ERROR (Status);\r
75\r
76 Status = PeiServicesInstallPpi (&mPpiListBootMode);\r
77 ASSERT_EFI_ERROR (Status);\r
78\r
79 if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
80 Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);\r
81 ASSERT_EFI_ERROR (Status);\r
82 }\r
83\r
84 return Status;\r
85}\r