]>
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 - 2008, Intel Corporation. All rights reserved.<BR>\r | |
9 | This program and the accompanying materials \r | |
10 | are licensed and made available under the terms and conditions of the BSD License \r | |
11 | which accompanies this distribution. The full text of the license may be found at \r | |
12 | http://opensource.org/licenses/bsd-license.php \r | |
13 | \r | |
14 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, \r | |
15 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. \r | |
16 | \r | |
17 | **/\r | |
18 | \r | |
19 | #include "PeiMain.h"\r | |
20 | \r | |
21 | /**\r | |
22 | This service enables PEIMs to ascertain the present value of the boot mode.\r | |
23 | \r | |
24 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
25 | @param BootMode A pointer to contain the value of the boot mode.\r | |
26 | \r | |
27 | @retval EFI_SUCCESS The boot mode was returned successfully.\r | |
28 | @retval EFI_INVALID_PARAMETER BootMode is NULL.\r | |
29 | \r | |
30 | **/\r | |
31 | EFI_STATUS\r | |
32 | EFIAPI\r | |
33 | PeiGetBootMode (\r | |
34 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
35 | IN OUT EFI_BOOT_MODE *BootMode\r | |
36 | )\r | |
37 | {\r | |
38 | PEI_CORE_INSTANCE *PrivateData; \r | |
39 | EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r | |
40 | \r | |
41 | \r | |
42 | if (BootMode == NULL) {\r | |
43 | return EFI_INVALID_PARAMETER;\r | |
44 | }\r | |
45 | \r | |
46 | PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r | |
47 | \r | |
48 | HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r | |
49 | \r | |
50 | *BootMode = HandOffHob->BootMode;\r | |
51 | \r | |
52 | \r | |
53 | return EFI_SUCCESS; \r | |
54 | }\r | |
55 | \r | |
56 | \r | |
57 | /**\r | |
58 | This service enables PEIMs to update the boot mode variable.\r | |
59 | \r | |
60 | \r | |
61 | @param PeiServices An indirect pointer to the EFI_PEI_SERVICES table published by the PEI Foundation.\r | |
62 | @param BootMode The value of the boot mode to set.\r | |
63 | \r | |
64 | @return EFI_SUCCESS The value was successfully updated\r | |
65 | \r | |
66 | **/\r | |
67 | EFI_STATUS\r | |
68 | EFIAPI\r | |
69 | PeiSetBootMode (\r | |
70 | IN CONST EFI_PEI_SERVICES **PeiServices,\r | |
71 | IN EFI_BOOT_MODE BootMode\r | |
72 | )\r | |
73 | {\r | |
74 | PEI_CORE_INSTANCE *PrivateData; \r | |
75 | EFI_HOB_HANDOFF_INFO_TABLE *HandOffHob;\r | |
76 | \r | |
77 | \r | |
78 | PrivateData = PEI_CORE_INSTANCE_FROM_PS_THIS(PeiServices);\r | |
79 | \r | |
80 | HandOffHob = (PrivateData->HobList.HandoffInformationTable);\r | |
81 | \r | |
82 | HandOffHob->BootMode = BootMode;\r | |
83 | \r | |
84 | \r | |
85 | return EFI_SUCCESS; \r | |
86 | }\r |