]> git.proxmox.com Git - mirror_edk2.git/blame - Vlv2TbltDevicePkg/Override/IntelFrameworkModulePkg/Library/GenericBdsLib/InternalBdsLib.h
Vlv2TbltDevicePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / Vlv2TbltDevicePkg / Override / IntelFrameworkModulePkg / Library / GenericBdsLib / InternalBdsLib.h
CommitLineData
3cbfba02
DW
1/** @file\r
2 BDS library definition, include the file and data structure\r
3\r
080851ae 4Copyright (c) 2004 - 2018, Intel Corporation. All rights reserved.<BR>\r
9dc8036d 5SPDX-License-Identifier: BSD-2-Clause-Patent\r
3cbfba02
DW
6\r
7**/\r
8\r
9#ifndef _INTERNAL_BDS_LIB_H_\r
10#define _INTERNAL_BDS_LIB_H_\r
11\r
12#include <FrameworkDxe.h>\r
13\r
14#include <IndustryStandard/Pci.h>\r
15#include <IndustryStandard/PeImage.h>\r
16\r
17#include <Protocol/BlockIo.h>\r
18#include <Protocol/LoadedImage.h>\r
19#include <Protocol/Cpu.h>\r
20#include <Protocol/SimpleFileSystem.h>\r
21#include <Protocol/LoadFile.h>\r
22#include <Protocol/DebugPort.h>\r
23#include <Protocol/DevicePath.h>\r
24#include <Protocol/SimpleTextIn.h>\r
25#include <Protocol/LegacyBios.h>\r
26#include <Protocol/SimpleTextOut.h>\r
27#include <Protocol/SimpleNetwork.h>\r
28#include <Protocol/FirmwareVolume2.h>\r
29#include <Protocol/PciIo.h>\r
30#include <Protocol/AcpiS3Save.h>\r
31#include <Protocol/OEMBadging.h>\r
32#include <Protocol/GraphicsOutput.h>\r
33#include <Protocol/UgaDraw.h>\r
34#include <Protocol/HiiFont.h>\r
35#include <Protocol/HiiImage.h>\r
36#include <Protocol/UsbIo.h>\r
37#include <Protocol/BootLogo.h>\r
38\r
39#include <Guid/MemoryTypeInformation.h>\r
40#include <Guid/FileInfo.h>\r
41#include <Guid/GlobalVariable.h>\r
42#include <Guid/PcAnsi.h>\r
3cbfba02
DW
43#include <Guid/BdsLibHii.h>\r
44#include <Guid/HdBootVariable.h>\r
45#include <Guid/LastEnumLang.h>\r
46#include <Guid/LegacyDevOrder.h>\r
217abb46 47#include <Guid/StatusCodeDataTypeVariable.h>\r
3cbfba02
DW
48\r
49#include <Library/PrintLib.h>\r
50#include <Library/DebugLib.h>\r
51#include <Library/BaseMemoryLib.h>\r
52#include <Library/UefiBootServicesTableLib.h>\r
53#include <Library/UefiLib.h>\r
54#include <Library/MemoryAllocationLib.h>\r
55#include <Library/DxeServicesTableLib.h>\r
56#include <Library/UefiRuntimeServicesTableLib.h>\r
57#include <Library/HobLib.h>\r
58#include <Library/BaseLib.h>\r
59#include <Library/DevicePathLib.h>\r
60#include <Library/PerformanceLib.h>\r
61#include <Library/PcdLib.h>\r
62#include <Library/PeCoffGetEntryPointLib.h>\r
63#include <Library/GenericBdsLib.h>\r
64#include <Library/TimerLib.h>\r
65#include <Library/PcdLib.h>\r
66#include <Library/DxeServicesLib.h>\r
67#include <Library/ReportStatusCodeLib.h>\r
080851ae 68#include <Library/BmpSupportLib.h>\r
3cbfba02
DW
69\r
70#if !defined (EFI_REMOVABLE_MEDIA_FILE_NAME)\r
71 #if defined (MDE_CPU_EBC)\r
72 //\r
73 // Uefi specification only defines the default boot file name for IA32, X64\r
74 // and IPF processor, so need define boot file name for EBC architecture here.\r
75 //\r
76 #define EFI_REMOVABLE_MEDIA_FILE_NAME L"\\EFI\\BOOT\\BOOTEBC.EFI"\r
77 #else\r
78 #error "Can not determine the default boot file name for unknown processor type!"\r
79 #endif\r
80#endif\r
81\r
3cbfba02
DW
82/**\r
83 Get the headers (dos, image, optional header) from an image\r
84\r
85 @param Device SimpleFileSystem device handle\r
86 @param FileName File name for the image\r
87 @param DosHeader Pointer to dos header\r
88 @param Hdr The buffer in which to return the PE32, PE32+, or TE header.\r
89\r
90 @retval EFI_SUCCESS Successfully get the machine type.\r
91 @retval EFI_NOT_FOUND The file is not found.\r
92 @retval EFI_LOAD_ERROR File is not a valid image file.\r
93\r
94**/\r
95EFI_STATUS\r
96EFIAPI\r
97BdsLibGetImageHeader (\r
98 IN EFI_HANDLE Device,\r
99 IN CHAR16 *FileName,\r
100 OUT EFI_IMAGE_DOS_HEADER *DosHeader,\r
101 OUT EFI_IMAGE_OPTIONAL_HEADER_PTR_UNION Hdr\r
102 );\r
103\r
104/**\r
105 This routine adjust the memory information for different memory type and \r
106 save them into the variables for next boot.\r
107**/\r
108VOID\r
109BdsSetMemoryTypeInformationVariable (\r
110 VOID\r
111 );\r
112\r
113/**\r
114 Validate the EFI Boot#### or Driver#### variable (VendorGuid/Name)\r
115\r
116 @param Variable Boot#### variable data.\r
117 @param VariableSize Returns the size of the EFI variable that was read\r
118\r
119 @retval TRUE The variable data is correct.\r
120 @retval FALSE The variable data is corrupted.\r
121\r
122**/\r
123BOOLEAN \r
124ValidateOption (\r
125 UINT8 *Variable,\r
126 UINTN VariableSize\r
127 );\r
128\r
217abb46
SL
129/**\r
130 Set the variable and report the error through status code upon failure.\r
131\r
132 @param VariableName A Null-terminated string that is the name of the vendor's variable.\r
133 Each VariableName is unique for each VendorGuid. VariableName must\r
134 contain 1 or more characters. If VariableName is an empty string,\r
135 then EFI_INVALID_PARAMETER is returned.\r
136 @param VendorGuid A unique identifier for the vendor.\r
137 @param Attributes Attributes bitmask to set for the variable.\r
138 @param DataSize The size in bytes of the Data buffer. Unless the EFI_VARIABLE_APPEND_WRITE, \r
139 EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS, or \r
140 EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS attribute is set, a size of zero \r
141 causes the variable to be deleted. When the EFI_VARIABLE_APPEND_WRITE attribute is \r
142 set, then a SetVariable() call with a DataSize of zero will not cause any change to \r
143 the variable value (the timestamp associated with the variable may be updated however \r
144 even if no new data value is provided,see the description of the \r
145 EFI_VARIABLE_AUTHENTICATION_2 descriptor below. In this case the DataSize will not \r
146 be zero since the EFI_VARIABLE_AUTHENTICATION_2 descriptor will be populated). \r
147 @param Data The contents for the variable.\r
148\r
149 @retval EFI_SUCCESS The firmware has successfully stored the variable and its data as\r
150 defined by the Attributes.\r
151 @retval EFI_INVALID_PARAMETER An invalid combination of attribute bits, name, and GUID was supplied, or the\r
152 DataSize exceeds the maximum allowed.\r
153 @retval EFI_INVALID_PARAMETER VariableName is an empty string.\r
154 @retval EFI_OUT_OF_RESOURCES Not enough storage is available to hold the variable and its data.\r
155 @retval EFI_DEVICE_ERROR The variable could not be retrieved due to a hardware error.\r
156 @retval EFI_WRITE_PROTECTED The variable in question is read-only.\r
157 @retval EFI_WRITE_PROTECTED The variable in question cannot be deleted.\r
158 @retval EFI_SECURITY_VIOLATION The variable could not be written due to EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS \r
159 or EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACESS being set, but the AuthInfo \r
160 does NOT pass the validation check carried out by the firmware.\r
161\r
162 @retval EFI_NOT_FOUND The variable trying to be updated or deleted was not found.\r
163**/\r
164EFI_STATUS\r
165SetVariableAndReportStatusCodeOnError (\r
166 IN CHAR16 *VariableName,\r
167 IN EFI_GUID *VendorGuid,\r
168 IN UINT32 Attributes,\r
169 IN UINTN DataSize,\r
170 IN VOID *Data\r
171 );\r
172\r
3cbfba02 173#endif // _BDS_LIB_H_\r