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