Add PeiCore module for enabling NT32Pkg, please attention this PeiCore does follows...
[mirror_edk2.git] / MdeModulePkg / Core / Pei / BootMode / BootMode.c
CommitLineData
192f6d4c 1/*++\r
2\r
3Copyright (c) 2006, Intel Corporation \r
4All rights reserved. This program and the accompanying materials \r
5are licensed and made available under the terms and conditions of the BSD License \r
6which accompanies this distribution. The full text of the license may be found at \r
7http://opensource.org/licenses/bsd-license.php \r
8 \r
9THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r
10WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r
11\r
12Module Name:\r
13\r
14 BootMode.c\r
15\r
16Abstract:\r
17\r
18 EFI PEI Core Boot Mode services\r
19\r
20\r
21\r
22Revision History\r
23\r
24--*/\r
25\r
26//\r
27// Include common header file for this module.\r
28//\r
29#include "CommonHeader.h"\r
30\r
31#include <PeiMain.h>\r
32\r
33EFI_STATUS\r
34EFIAPI\r
35PeiGetBootMode (\r
36 IN EFI_PEI_SERVICES **PeiServices,\r
37 OUT EFI_BOOT_MODE *BootMode\r
38 )\r
39/*++\r
40\r
41Routine Description:\r
42\r
43 This service enables PEIMs to ascertain the present value of the boot mode. \r
44\r
45Arguments:\r
46\r
47 PeiServices - The PEI core services table.\r
48 BootMode - A pointer to contain the value of the boot mode. \r
49\r
50Returns:\r
51\r
52 EFI_SUCCESS - The boot mode was returned successfully.\r
53 EFI_INVALID_PARAMETER - BootMode is NULL.\r
54\r
55--*/\r
56{\r
57 PEI_CORE_INSTANCE *PrivateData; \r
58 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
59\r
60\r
61 if (BootMode == NULL) {\r
62 return EFI_INVALID_PARAMETER;\r
63 }\r
64\r
65 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
66 \r
67 HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r
68 \r
69 *BootMode = HandOffHob->BootMode;\r
70 \r
71\r
72 return EFI_SUCCESS; \r
73}\r
74\r
75\r
76EFI_STATUS\r
77EFIAPI\r
78PeiSetBootMode (\r
79 IN EFI_PEI_SERVICES **PeiServices,\r
80 IN EFI_BOOT_MODE BootMode\r
81 )\r
82/*++\r
83\r
84Routine Description:\r
85\r
86 This service enables PEIMs to update the boot mode variable. \r
87\r
88Arguments:\r
89\r
90 PeiServices - The PEI core services table.\r
91 BootMode - The value of the boot mode to set.\r
92\r
93Returns:\r
94\r
95 EFI_SUCCESS - The value was successfully updated\r
96\r
97--*/\r
98{\r
99 PEI_CORE_INSTANCE *PrivateData; \r
100 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
101\r
102\r
103 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
104 \r
105 HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r
106 \r
107 HandOffHob->BootMode = BootMode;\r
108\r
109\r
110 return EFI_SUCCESS; \r
111}\r