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