]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Core/Pei/BootMode/BootMode.c
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Core / Pei / BootMode / BootMode.c
CommitLineData
615c6dd0 1/** @file\r
b1f6a7c6 2 This module provide function for ascertaining and updating the boot mode:\r
3 GetBootMode()\r
4 SetBootMode()\r
cfc8865f 5 See PI Specification volume I, chapter 9 Boot Paths for additional information\r
b1f6a7c6 6 on the boot mode.\r
d1102dba
LG
7\r
8Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 9SPDX-License-Identifier: BSD-2-Clause-Patent\r
192f6d4c 10\r
b1f6a7c6 11**/\r
192f6d4c 12\r
0d516397 13#include "PeiMain.h"\r
192f6d4c 14\r
b1f6a7c6 15/**\r
16 This service enables PEIMs to ascertain the present value of the boot mode.\r
192f6d4c 17\r
dc857d56 18 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
b1f6a7c6 19 @param BootMode A pointer to contain the value of the boot mode.\r
192f6d4c 20\r
b1f6a7c6 21 @retval EFI_SUCCESS The boot mode was returned successfully.\r
22 @retval EFI_INVALID_PARAMETER BootMode is NULL.\r
192f6d4c 23\r
615c6dd0 24**/\r
192f6d4c 25EFI_STATUS\r
26EFIAPI\r
27PeiGetBootMode (\r
b1f6a7c6 28 IN CONST EFI_PEI_SERVICES **PeiServices,\r
d976bf31 29 IN OUT EFI_BOOT_MODE *BootMode\r
192f6d4c 30 )\r
192f6d4c 31{\r
d1102dba 32 PEI_CORE_INSTANCE *PrivateData;\r
192f6d4c 33 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
34\r
35\r
36 if (BootMode == NULL) {\r
37 return EFI_INVALID_PARAMETER;\r
38 }\r
39\r
40 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
d1102dba 41\r
192f6d4c 42 HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r
d1102dba 43\r
192f6d4c 44 *BootMode = HandOffHob->BootMode;\r
192f6d4c 45\r
d1102dba
LG
46\r
47 return EFI_SUCCESS;\r
192f6d4c 48}\r
49\r
50\r
b1f6a7c6 51/**\r
52 This service enables PEIMs to update the boot mode variable.\r
53\r
54\r
dc857d56 55 @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r
56 @param BootMode The value of the boot mode to set.\r
b1f6a7c6 57\r
dc857d56 58 @return EFI_SUCCESS The value was successfully updated\r
b1f6a7c6 59\r
60**/\r
192f6d4c 61EFI_STATUS\r
62EFIAPI\r
63PeiSetBootMode (\r
0c2b5da8 64 IN CONST EFI_PEI_SERVICES **PeiServices,\r
65 IN EFI_BOOT_MODE BootMode\r
192f6d4c 66 )\r
192f6d4c 67{\r
d1102dba 68 PEI_CORE_INSTANCE *PrivateData;\r
192f6d4c 69 EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r
70\r
71\r
72 PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r
d1102dba 73\r
192f6d4c 74 HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r
d1102dba 75\r
192f6d4c 76 HandOffHob->BootMode = BootMode;\r
77\r
78\r
d1102dba 79 return EFI_SUCCESS;\r
192f6d4c 80}\r