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