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