Enable Nt32 platform boot to DXE phase.
[mirror_edk2.git] / MdeModulePkg / Core / 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 EFI PEI Core Boot Mode services
19
20
21
22 Revision History
23
24 --*/
25
26 //
27 // Include common header file for this module.
28 //
29 #include "CommonHeader.h"
30
31 #include <PeiMain.h>
32
33 EFI_STATUS
34 EFIAPI
35 PeiGetBootMode (
36 IN EFI_PEI_SERVICES **PeiServices,
37 OUT EFI_BOOT_MODE *BootMode
38 )
39 /*++
40
41 Routine Description:
42
43 This service enables PEIMs to ascertain the present value of the boot mode.
44
45 Arguments:
46
47 PeiServices - The PEI core services table.
48 BootMode - A pointer to contain the value of the boot mode.
49
50 Returns:
51
52 EFI_SUCCESS - The boot mode was returned successfully.
53 EFI_INVALID_PARAMETER - BootMode is NULL.
54
55 --*/
56 {
57 PEI_CORE_INSTANCE *PrivateData;
58 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
59
60
61 if (BootMode == NULL) {
62 return EFI_INVALID_PARAMETER;
63 }
64
65 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
66
67 HandOffHob = (PrivateData->HobList.HandoffInformationTable);
68
69 *BootMode = HandOffHob->BootMode;
70
71
72 return EFI_SUCCESS;
73 }
74
75
76 EFI_STATUS
77 EFIAPI
78 PeiSetBootMode (
79 IN EFI_PEI_SERVICES **PeiServices,
80 IN EFI_BOOT_MODE BootMode
81 )
82 /*++
83
84 Routine Description:
85
86 This service enables PEIMs to update the boot mode variable.
87
88 Arguments:
89
90 PeiServices - The PEI core services table.
91 BootMode - The value of the boot mode to set.
92
93 Returns:
94
95 EFI_SUCCESS - The value was successfully updated
96
97 --*/
98 {
99 PEI_CORE_INSTANCE *PrivateData;
100 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;
101
102
103 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);
104
105 HandOffHob = (PrivateData->HobList.HandoffInformationTable);
106
107 HandOffHob->BootMode = BootMode;
108
109
110 return EFI_SUCCESS;
111 }