Add some definitions in Framework FV 0.9 spec but not in PI 1.0.
[mirror_edk2.git] / EdkNt32Pkg / Pei / BootMode / BootMode.c
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12 Module Name:
13
14 BootMode.c
15
16 Abstract:
17
18 Tiano PEIM to provide the platform support functionality within Windows
19
20 --*/
21
22
23
24 //
25 // Module globals
26 //
27 EFI_PEI_PPI_DESCRIPTOR mPpiListBootMode = {
28 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
29 &gEfiPeiMasterBootModePpiGuid,
30 NULL
31 };
32
33 EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode = {
34 (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
35 &gEfiPeiBootInRecoveryModePpiGuid,
36 NULL
37 };
38
39 EFI_STATUS
40 EFIAPI
41 InitializeBootMode (
42 IN EFI_FFS_FILE_HEADER *FfsHeader,
43 IN EFI_PEI_SERVICES **PeiServices
44 )
45 /*++
46
47 Routine Description:
48
49 Peform the boot mode determination logic
50
51 Arguments:
52
53 PeiServices - General purpose services available to every PEIM.
54
55 Returns:
56
57 Status - EFI_SUCCESS if the boot mode could be set
58
59 --*/
60 // TODO: FfsHeader - add argument and description to function comment
61 {
62 EFI_STATUS Status;
63 UINTN BootMode;
64
65 DEBUG ((EFI_D_ERROR, "NT32 Boot Mode PEIM Loaded\n"));
66
67 //
68 // Let's assume things are OK if not told otherwise
69 // Should we read an environment variable in order to easily change this?
70 //
71 BootMode = BOOT_WITH_FULL_CONFIGURATION;
72
73 Status = (**PeiServices).SetBootMode (PeiServices, (UINT8) BootMode);
74 ASSERT_EFI_ERROR (Status);
75
76 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListBootMode);
77 ASSERT_EFI_ERROR (Status);
78
79 if (BootMode == BOOT_IN_RECOVERY_MODE) {
80 Status = (**PeiServices).InstallPpi (PeiServices, &mPpiListRecoveryBootMode);
81 ASSERT_EFI_ERROR (Status);
82 }
83
84 return Status;
85 }