]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/C/FCE/Fce.h
32cc3a1cccfa92343927a1b544cd350871c5489c
3 FCE is a tool which enables developers to retrieve and change HII configuration ("Setup")
4 data in Firmware Device files (".fd" files).
6 Copyright (c) 2011-2019, Intel Corporation. All rights reserved.<BR>
7 SPDX-License-Identifier: BSD-2-Clause-Patent
18 #include "VariableCommon.h"
19 #include "BinaryParse.h"
20 #include "BinaryCreate.h"
22 /// Utility global variables
24 #define UTILITY_MAJOR_VERSION 0
25 #define UTILITY_MINOR_VERSION 34
27 #define UTILITY_NAME "FCE"
32 #define MAX_INPUT_ALLOCATE_SIZE 256
35 /// The type of file input and operations
54 typedef struct _GUID_SEC_TOOL_ENTRY
{
58 struct _GUID_SEC_TOOL_ENTRY
*Next
;
59 } GUID_SEC_TOOL_ENTRY
;
62 /// The tag for use in identifying UNICODE files.
63 /// If the file is UNICODE, the first 16 bits of the file will equal this value.
66 BigUnicodeFileTag
= 0xFEFF,
67 LittleUnicodeFileTag
= 0xFFFE
77 Exchange the data between Efi variable and the data of VarList when the
78 variable use the authenticated variable header
80 If VarToList is TRUE, copy the efi variable data to the VarList; Otherwise,
81 update the data from varlist to efi variable.
83 @param VarToList The flag to control the direction of exchange.
84 @param StorageListHead Decide which variale list be updated
86 @retval EFI_SUCCESS Get the address successfully.
87 @retval EFI_OUT_OF_RESOURCES No available in the EFI variable zone.
88 @retval EFI_INVALID_PARAMETER Invalid variable name.
93 IN LIST_ENTRY
*StorageListHead
97 Remove the variable from Efi variable
99 Found the variable with the same name in StorageListHead and remove it.
101 @param StorageListHead Decide which variale list be removed.
103 @retval EFI_SUCCESS Remove the variables successfully.
106 RemoveAuthEfiVariable (
107 IN LIST_ENTRY
*StorageListHead
111 Exchange the data between Efi variable and the data of VarList when the
112 variable use the time stamp authenticated variable header
114 If VarToList is TRUE, copy the efi variable data to the VarList; Otherwise,
115 update the data from varlist to efi variable.
117 @param VarToList The flag to control the direction of exchange.
118 @param StorageListHead Decide which variale list be updated
120 @retval EFI_SUCCESS Get the address successfully.
121 @retval EFI_OUT_OF_RESOURCES No available in the EFI variable zone.
122 @retval EFI_INVALID_PARAMETER Invalid variable name.
126 SynAuthEfiVariableBasedTime (
127 IN BOOLEAN VarToList
,
128 IN LIST_ENTRY
*StorageListHead
132 Remove the variable from Efi variable
134 Found the variable with the same name in StorageListHead and remove it.
136 @param StorageListHead Decide which variale list be removed.
138 @retval EFI_SUCCESS Remove the variables successfully.
141 RemoveAuthEfiVariableBasedTime (
142 IN LIST_ENTRY
*StorageListHead
146 Exchange the data between Efi variable and the data of VarList when the
147 variable use the authenticated variable header
149 If VarToList is TRUE, copy the efi variable data to the VarList; Otherwise,
150 update the data from varlist to efi variable.
152 @param VarToList The flag to control the direction of exchange.
153 @param StorageListHead Decide which variale list be updated
155 @retval EFI_SUCCESS Get the address successfully.
156 @retval EFI_OUT_OF_RESOURCES No available in the EFI variable zone.
161 IN BOOLEAN VarToList
,
162 IN LIST_ENTRY
*StorageListHead
166 Remove the variable from Efi variable
168 Found the variable with the same name in StorageListHead and remove it.
170 @param StorageListHead Decide which variale list be removed.
172 @retval EFI_SUCCESS Remove the variables successfully.
175 RemoveNormalEfiVariable (
176 IN LIST_ENTRY
*StorageListHead
180 Read all defaultId and platformId from binary.
182 @param Binary The pointer to the bianry
183 @param Storage The pointer to the Storage
186 ReadDefaultAndPlatformIdFromBfv (
188 IN FORMSET_STORAGE
*Storage
192 Store all defaultId and platformId to binary.
194 @param Binary The pointer to the bianry
195 @param Storage The pointer to the Storage
197 @retval Length Return the length of the header
201 WriteDefaultAndPlatformId (
203 IN FORMSET_STORAGE
*Storage
207 Store all defaultId and platformId to binary.
209 @param Binary The pointer to the bianry
210 @param Storage The pointer to the Storage
212 @retval Length Return the length of the header
215 WriteNvStoreDefaultAndPlatformId (
217 IN FORMSET_STORAGE
*Storage
221 Copy variable to binary in multi-platform mode
223 @param Storage The pointer to a storage in storage list.
224 @param StorageBeginning The pointer to the beginning of storage under specifed platformId and defaultId
225 @param Index The number of the storage. If the Index is 0, record the variable header to
226 the binary. Or else, only record the storage.
228 @return length The length of storage
231 CopyVariableToBinary (
232 IN FORMSET_STORAGE
*Storage
,
233 IN OUT UINT8
*StorageBeginning
,
238 Copy variable to binary in multi-platform mode
240 @param Storage The pointer to a storage in storage list.
241 @param StorageBeginning The pointer to the beginning of storage under specifed platformId and defaultId
242 @param Index The number of the storage. If the Index is 0, record the variable header to
243 the binary. Or else, only record the storage.
245 @return length The length of storage
248 CopyVariableToNvStoreBinary (
249 IN FORMSET_STORAGE
*Storage
,
250 IN OUT UINT8
*StorageBeginning
,
256 Read variable to storage list in multi-platform mode
258 @param Binary The pointer to the header of storage under specifed platformId and defaultId
259 @param StorageListEntry The pointer to the storage list.
261 @return length The length of storage
265 ReadNvStoreVariableToList (
267 IN LIST_ENTRY
*StorageListEntry
271 Read variable to storage list in multi-platform mode
273 @param Binary The pointer to the header of storage under specifed platformId and defaultId
274 @param StorageListEntry The pointer to the storage list.
276 @return length The length of storage
281 IN LIST_ENTRY
*StorageListEntry
285 Check whether exists the valid normal variables in NvStorage or not.
287 @retval TRUE If existed, return TRUE.
291 ExistNormalEfiVarOrNot (
292 IN LIST_ENTRY
*StorageListHead
296 Fix the size of variable header.
298 @param Binary The pointer to the header of storage under specifed platformId and defaultId
299 @param Length The length of binary.
303 FixVariableHeaderSize (
304 IN UINT8
*BinaryBeginning
,
309 Fix the size of variable header.
311 @param Binary The pointer to the header of storage under specifed platformId and defaultId
312 @param Length The length of binary.
317 FixNvStoreVariableHeaderSize (
318 IN UINT8
*BinaryBeginning
,
322 Copy time-based authenticated variable to binary in multi-platform mode
324 @param Storage The pointer to a storage in storage list.
325 @param StorageBeginning The pointer to the beginning of storage under specifed platformId and defaultId
326 @param Index The number of the storage. If the Index is 0, record the variable header to
327 the binary. Or else, only record the storage.
328 @return length The length of storage
331 CopyTimeBasedVariableToBinary (
332 IN FORMSET_STORAGE
*Storage
,
333 IN OUT UINT8
*StorageBeginning
,
338 Read time-based authenticated variable to storage list in multi-platform mode
340 @param Binary The pointer to the header of storage under specifed platformId and defaultId
341 @param StorageListEntry The pointer to the storage list.
343 @return length The length of storage
346 ReadTimeBasedVariableToList (
348 IN LIST_ENTRY
*StorageListEntry
352 Check whether exists the valid time-based variables in NvStorage or not.
354 @retval TRUE If existed, return TRUE.
358 ExistTimeBasedEfiVarOrNot (
359 IN LIST_ENTRY
*StorageListHead
363 Fix the size of time-based variable header.
365 @param Binary The pointer to the header of storage under specifed platformId and defaultId
366 @param Length The length of binary.
370 FixBasedTimeVariableHeaderSize (
371 IN UINT8
*BinaryBeginning
,
376 Copy Monotonic-Based authenticated variable to binary in multi-platform mode
378 @param Storage The pointer to a storage in storage list.
379 @param StorageBeginning The pointer to the beginning of storage under specifed platformId and defaultId
380 @param Index The number of the storage. If the Index is 0, record the variable header to
381 the binary. Or else, only record the storage.
383 @return length The length of storage
386 CopyMonotonicBasedVariableToBinary (
387 IN FORMSET_STORAGE
*Storage
,
388 IN OUT UINT8
*StorageBeginning
,
393 Read Monotonic-based authenticated variable to storage list in multi-platform mode
395 @param Binary The pointer to the header of storage under specifed platformId and defaultId
396 @param StorageListEntry The pointer to the storage list.
398 @return length The length of storage
401 ReadMonotonicBasedVariableToList (
403 IN LIST_ENTRY
*StorageListEntry
407 Check whether exists the valid MonotonicBased variables in NvStorage or not.
409 @retval TRUE If existed, return TRUE.
413 ExistMonotonicBasedEfiVarOrNot (
414 IN LIST_ENTRY
*StorageListHead
418 Fix the size of montonic variable header.
420 @param Binary The pointer to the header of storage under specifed platformId and defaultId
421 @param Length The length of binary.
425 FixMontonicVariableHeaderSize (
426 IN UINT8
*BinaryBeginning
,
431 FCE application entry point
433 @param argc The number of input parameters.
434 @param *argv[] The array pointer to the parameters.
436 @retval 0 The application exited normally.
437 @retval 1 An error occurred.
438 @retval 2 An error about check occurred.