]> git.proxmox.com Git - mirror_edk2.git/blame - Nt32Pkg/BootModePei/BootModePei.c
Nt32Pkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / Nt32Pkg / BootModePei / BootModePei.c
CommitLineData
6ae81428 1/**@file\r
89b6542c 2\r
8f2a5f80 3Copyright (c) 2006, Intel Corporation. All rights reserved.<BR>\r
9d2eedba 4SPDX-License-Identifier: BSD-2-Clause-Patent\r
89b6542c 5\r
6Module Name:\r
7\r
8 BootMode.c\r
9 \r
10Abstract:\r
11\r
12 Tiano PEIM to provide the platform support functionality within Windows\r
13\r
6ae81428 14**/\r
89b6542c 15\r
16\r
17\r
18//\r
19// The package level header files this module uses\r
20//\r
21#include <PiPei.h>\r
22//\r
23// The protocols, PPI and GUID defintions for this module\r
24//\r
25#include <Ppi/MasterBootMode.h>\r
26#include <Ppi/BootInRecoveryMode.h>\r
27//\r
28// The Library classes this module consumes\r
29//\r
30#include <Library/DebugLib.h>\r
31#include <Library/PeimEntryPoint.h>\r
32\r
33\r
34//\r
35// Module globals\r
36//\r
37EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {\r
38 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
39 &gEfiPeiMasterBootModePpiGuid,\r
40 NULL\r
41};\r
42\r
43EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {\r
44 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),\r
45 &gEfiPeiBootInRecoveryModePpiGuid,\r
46 NULL\r
47};\r
48\r
49EFI_STATUS\r
50EFIAPI\r
51InitializeBootMode (\r
f0ba8fda
LG
52 IN EFI_PEI_FILE_HANDLE FileHandle,\r
53 IN CONST EFI_PEI_SERVICES **PeiServices\r
89b6542c 54 )\r
55/*++\r
56\r
57Routine Description:\r
58\r
59 Peform the boot mode determination logic\r
60\r
61Arguments:\r
62\r
f0ba8fda
LG
63 FileHandle - Handle of the file being invoked.\r
64 PeiServices - Describes the list of possible PEI Services.\r
89b6542c 65 \r
66Returns:\r
67\r
68 Status - EFI_SUCCESS if the boot mode could be set\r
69\r
70--*/\r
89b6542c 71{\r
72 EFI_STATUS Status;\r
73 UINTN BootMode;\r
74\r
75 DEBUG ((EFI_D_ERROR, "NT32 Boot Mode PEIM Loaded\n"));\r
76\r
77 //\r
78 // Let's assume things are OK if not told otherwise\r
79 // Should we read an environment variable in order to easily change this?\r
80 //\r
81 BootMode = BOOT_WITH_FULL_CONFIGURATION;\r
82\r
f0ba8fda 83 Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);\r
89b6542c 84 ASSERT_EFI_ERROR (Status);\r
85\r
f0ba8fda 86 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);\r
89b6542c 87 ASSERT_EFI_ERROR (Status);\r
88\r
89 if (BootMode == BOOT_IN_RECOVERY_MODE) {\r
f0ba8fda 90 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);\r
89b6542c 91 ASSERT_EFI_ERROR (Status);\r
92 }\r
93\r
94 return Status;\r
95}\r