]> git.proxmox.com Git - mirror_edk2.git/blame_incremental - EmulatorPkg/BootModePei/BootModePei.c
Vlv2TbltDevicePkg:Add PiSmmCommunication&PiSmmCpuDxeSmm of UefiCpuPkg.
[mirror_edk2.git] / EmulatorPkg / BootModePei / BootModePei.c
... / ...
CommitLineData
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
5This program and the accompanying materials\r
6are licensed and made available under the terms and conditions of the BSD License\r
7which accompanies this distribution. The full text of the license may be found at\r
8http://opensource.org/licenses/bsd-license.php\r
9\r
10THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15\r
16\r
17//\r
18// The package level header files this module uses\r
19//\r
20#include <PiPei.h>\r
21\r
22#include <Library/PcdLib.h>\r
23#include <Library/PeiServicesLib.h>\r
24\r
25\r
26//\r
27// The protocols, PPI and GUID defintions for this module\r
28//\r
29#include <Ppi/MasterBootMode.h>\r
30#include <Ppi/BootInRecoveryMode.h>\r
31//\r
32// The Library classes this module consumes\r
33//\r
34#include <Library/DebugLib.h>\r
35#include <Library/PeimEntryPoint.h>\r
36\r
37\r
38//\r
39// Module globals\r
40//\r
41EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r
42 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
43 &gEfiPeiMasterBootModePpiGuid,\r
44 NULL\r
45};\r
46\r
47EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r
48 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
49 &gEfiPeiBootInRecoveryModePpiGuid,\r
50 NULL\r
51};\r
52\r
53EFI_STATUS\r
54EFIAPI\r
55InitializeBootMode (\r
56 IN EFI_PEI_FILE_HANDLE FileHandle,\r
57 IN CONST EFI_PEI_SERVICES **PeiServices\r
58 )\r
59/*++\r
60\r
61Routine Description:\r
62\r
63 Peform the boot mode determination logic\r
64\r
65Arguments:\r
66\r
67 PeiServices - General purpose services available to every PEIM.\r
68\r
69Returns:\r
70\r
71 Status - EFI_SUCCESS if the boot mode could be set\r
72\r
73**/\r
74{\r
75 EFI_STATUS Status;\r
76 EFI_BOOT_MODE BootMode;\r
77\r
78 DEBUG ((EFI_D_ERROR, "Emu Boot Mode PEIM Loaded\n"));\r
79\r
80 BootMode = FixedPcdGet32 (PcdEmuBootMode);\r
81\r
82 Status = PeiServicesSetBootMode (BootMode);\r
83 ASSERT_EFI_ERROR (Status);\r
84\r
85 Status = PeiServicesInstallPpi (&mPpiListBootMode);\r
86 ASSERT_EFI_ERROR (Status);\r
87\r
88 if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
89 Status = PeiServicesInstallPpi (&mPpiListRecoveryBootMode);\r
90 ASSERT_EFI_ERROR (Status);\r
91 }\r
92\r
93 return Status;\r
94}\r