• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /** @file
2   Head file for BDS Architectural Protocol implementation
3 
4 Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution.  The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
9 
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
12 
13 **/
14 
15 #ifndef _BDS_MODULE_H_
16 #define _BDS_MODULE_H_
17 
18 #include <Uefi.h>
19 #include <Guid/GlobalVariable.h>
20 #include <Guid/ConnectConInEvent.h>
21 #include <Guid/Performance.h>
22 #include <Guid/StatusCodeDataTypeVariable.h>
23 
24 #include <Protocol/Bds.h>
25 #include <Protocol/LoadedImage.h>
26 #include <Protocol/VariableLock.h>
27 
28 #include <Library/UefiDriverEntryPoint.h>
29 #include <Library/DebugLib.h>
30 #include <Library/BaseMemoryLib.h>
31 #include <Library/UefiBootServicesTableLib.h>
32 #include <Library/UefiRuntimeServicesTableLib.h>
33 #include <Library/UefiLib.h>
34 #include <Library/MemoryAllocationLib.h>
35 #include <Library/ReportStatusCodeLib.h>
36 #include <Library/BaseLib.h>
37 #include <Library/PcdLib.h>
38 #include <Library/PerformanceLib.h>
39 #include <Library/DevicePathLib.h>
40 #include <Library/PrintLib.h>
41 
42 #include <Library/UefiBootManagerLib.h>
43 #include <Library/PlatformBootManagerLib.h>
44 
45 #if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)
46     #if defined (MDE_CPU_EBC)
47         //
48         // Uefi specification only defines the default boot file name for IA32, X64
49         // and IPF processor, so need define boot file name for EBC architecture here.
50         //
51         #define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"
52     #else
53         #error "Can not determine the default boot file name for unknown processor type!"
54     #endif
55 #endif
56 
57 /**
58 
59   Service routine for BdsInstance->Entry(). Devices are connected, the
60   consoles are initialized, and the boot options are tried.
61 
62   @param This            Protocol Instance structure.
63 
64 **/
65 VOID
66 EFIAPI
67 BdsEntry (
68   IN  EFI_BDS_ARCH_PROTOCOL *This
69   );
70 
71 /**
72   Set the variable and report the error through status code upon failure.
73 
74   @param  VariableName           A Null-terminated string that is the name of the vendor's variable.
75                                  Each VariableName is unique for each VendorGuid. VariableName must
76                                  contain 1 or more characters. If VariableName is an empty string,
77                                  then EFI_INVALID_PARAMETER is returned.
78   @param  VendorGuid             A unique identifier for the vendor.
79   @param  Attributes             Attributes bitmask to set for the variable.
80   @param  DataSize               The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE,
81                                  EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or
82                                  EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero
83                                  causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is
84                                  set, then a SetVariable() call with a DataSize of zero will not cause any change to
85                                  the variable value (the timestamp associated with the variable may be updated however
86                                  even if no new data value is provided,see the description of the
87                                  EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not
88                                  be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated).
89   @param  Data                   The contents for the variable.
90 
91   @retval EFI_SUCCESS            The firmware has successfully stored the variable and its data as
92                                  defined by the Attributes.
93   @retval EFI_INVALID_PARAMETER  An invalid combination of attribute bits, name, and GUID was supplied, or the
94                                  DataSize exceeds the maximum allowed.
95   @retval EFI_INVALID_PARAMETER  VariableName is an empty string.
96   @retval EFI_OUT_OF_RESOURCES   Not enough storage is available to hold the variable and its data.
97   @retval EFI_DEVICE_ERROR       The variable could not be retrieved due to a hardware error.
98   @retval EFI_WRITE_PROTECTED    The variable in question is read-only.
99   @retval EFI_WRITE_PROTECTED    The variable in question cannot be deleted.
100   @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS
101                                  or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo
102                                  does NOT pass the validation check carried out by the firmware.
103 
104   @retval EFI_NOT_FOUND          The variable trying to be updated or deleted was not found.
105 **/
106 EFI_STATUS
107 BdsDxeSetVariableAndReportStatusCodeOnError (
108   IN CHAR16     *VariableName,
109   IN EFI_GUID   *VendorGuid,
110   IN UINT32     Attributes,
111   IN UINTN      DataSize,
112   IN VOID       *Data
113   );
114 
115 #endif
116