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