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