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