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