2 This file contains functions required to generate a boot strap file (BSF) also
3 known as the Volume Top File (VTF)
5 Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.<BR>
6 This program and the accompanying materials are licensed and made available
7 under the terms and conditions of the BSD License which accompanies this
8 distribution. The full text of the license may be found at
9 http://opensource.org/licenses/bsd-license.php
11 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
20 #include <Common/UefiBaseTypes.h>
22 #include <Guid/PiFirmwareFileSystem.h>
23 #include "CommonLib.h"
24 #include "EfiUtilityMsgs.h"
29 UINTN SectionOptionFlag
= 0;
30 UINTN SectionCompFlag
= 0;
35 BOOLEAN QuietMode
= FALSE
;
37 BOOLEAN VTF_OUTPUT
= FALSE
;
45 PARSED_VTF_INFO
*FileListPtr
;
46 PARSED_VTF_INFO
*FileListHeadPtr
;
53 UINTN ValidLineNum
= 0;
54 UINTN ValidFFDFileListNum
= 0;
57 // Section Description and their number of occurences in *.INF file
60 UINTN SectionOptionNum
= 0;
63 // Global flag which will check for VTF Present, if yes then will be used
64 // to decide about adding FFS header to pad data
66 BOOLEAN VTFPresent
= FALSE
;
67 BOOLEAN SecondVTF
= FALSE
;
70 // Address related information
72 UINT64 Fv1BaseAddress
= 0;
73 UINT64 Fv2BaseAddress
= 0;
74 UINT64 Fv1EndAddress
= 0;
75 UINT64 Fv2EndAddress
= 0;
76 UINT32 Vtf1TotalSize
= SIZE_TO_OFFSET_PAL_A_END
;
77 UINT64 Vtf1LastStartAddress
= 0;
78 UINT32 Vtf2TotalSize
= 0;
79 UINT64 Vtf2LastStartAddress
= 0;
81 UINT32 BufferToTop
= 0;
84 // IA32 Reset Vector Bin name
86 CHAR8 IA32BinFile
[FILE_NAME_SIZE
];
89 // Function Implementations
94 IN OUT UINT8
*MajorVer
,
95 IN OUT UINT8
*MinorVer
100 This function split version to major version and minor version
104 Str - String representing in form XX.XX
105 MajorVer - The major version
106 MinorVer - The minor version
110 EFI_SUCCESS - The function completed successfully.
114 CHAR8 TemStr
[5] = "0000";
122 if (strstr (Str
, ".") != NULL
) {
130 Length
= strlen(Str
);
132 strncpy (TemStr
+ 4 - Length
, Str
, Length
);
134 strncpy (TemStr
, Str
+ Length
- 4, 4);
145 *MajorVer
= (UINT8
) Major
;
146 *MinorVer
= (UINT8
) Minor
;
157 This function cleans up the line by removing all whitespace and
162 Line - The pointer of the string
170 CHAR8 TmpLine
[FILE_NAME_SIZE
];
177 // Change '#' to '//' for Comment style
179 if (((Ptr0
= strchr (Line
, '#')) != NULL
) || ((Ptr0
= strstr (Line
, "//")) != NULL
)) {
180 Line
[Ptr0
- Line
] = 0;
184 // Initialize counters
189 while ((Char
= Line
[Index
]) != 0) {
190 if ((Char
!= ' ') && (Char
!= '\t') && (Char
!= '\n') && (Char
!= '\r')) {
191 TmpLine
[Index2
++] = Char
;
197 strcpy (Line
, TmpLine
);
208 This function calculated number of valid lines in a input file.
212 Fp - Pointer to a file handle which has been opened.
220 CHAR8 Buff
[FILE_NAME_SIZE
];
221 while (fgets(Buff
, sizeof (Buff
), Fp
)) {
238 This function parses the input file and tokenize the string
242 Fp - Pointer to a file handle which has been opened.
251 CHAR8 Buff
[FILE_NAME_SIZE
+ 1];
252 CHAR8 Delimit
[] = "=";
254 Buff
[FILE_NAME_SIZE
] = '\0';
257 while (fgets (Buff
, FILE_NAME_SIZE
, Fp
) != NULL
) {
262 Token
= strtok (Buff
, Delimit
);
263 while (Token
!= NULL
) {
264 strcpy (*TokenStr
, Token
);
266 Token
= strtok (NULL
, Delimit
);
280 This function initializes the relevant global variable which is being
281 used to store the information retrieved from INF file. This also initializes
290 EFI_SUCCESS - The function completed successfully
291 EFI_OUT_OF_RESOURCES - Malloc failed.
296 FileListPtr
= malloc (sizeof (PARSED_VTF_INFO
));
298 if (FileListPtr
== NULL
) {
299 return EFI_OUT_OF_RESOURCES
;
302 FileListHeadPtr
= FileListPtr
;
303 memset (FileListPtr
, 0, sizeof (PARSED_VTF_INFO
));
304 FileListPtr
->NextVtfInfo
= NULL
;
306 remove (SymFileName
);
311 ParseAndUpdateComponents (
312 IN PARSED_VTF_INFO
*VtfInfo
318 This function initializes the relevant global variable which is being
319 used to store the information retrieved from INF file.
323 VtfInfo - A pointer to the VTF Info Structure
334 while (*TokenStr
!= NULL
&& (strnicmp (*TokenStr
, "COMP_NAME", 9) != 0)) {
336 if (strnicmp (*TokenStr
, "COMP_LOC", 8) == 0) {
338 if (strnicmp (*TokenStr
, "F", 1) == 0) {
339 VtfInfo
->LocationType
= FIRST_VTF
;
340 } else if (strnicmp (*TokenStr
, "S", 1) == 0) {
341 VtfInfo
->LocationType
= SECOND_VTF
;
343 VtfInfo
->LocationType
= NONE
;
345 } else if (strnicmp (*TokenStr
, "COMP_TYPE", 9) == 0) {
347 if (AsciiStringToUint64 (*TokenStr
, FALSE
, &StringValue
) != EFI_SUCCESS
) {
348 Error (NULL
, 0, 5001, "Cannot get: \"0x%s\".", *TokenStr
);
352 VtfInfo
->CompType
= (UINT8
) StringValue
;
353 } else if (strnicmp (*TokenStr
, "COMP_VER", 8) == 0) {
355 if (strnicmp (*TokenStr
, "-", 1) == 0) {
356 VtfInfo
->VersionPresent
= FALSE
;
357 VtfInfo
->MajorVer
= 0;
358 VtfInfo
->MinorVer
= 0;
360 VtfInfo
->VersionPresent
= TRUE
;
361 ConvertVersionInfo (*TokenStr
, &VtfInfo
->MajorVer
, &VtfInfo
->MinorVer
);
363 } else if (strnicmp (*TokenStr
, "COMP_BIN", 8) == 0) {
365 strcpy (VtfInfo
->CompBinName
, *TokenStr
);
366 } else if (strnicmp (*TokenStr
, "COMP_SYM", 8) == 0) {
368 strcpy (VtfInfo
->CompSymName
, *TokenStr
);
369 } else if (strnicmp (*TokenStr
, "COMP_SIZE", 9) == 0) {
371 if (strnicmp (*TokenStr
, "-", 1) == 0) {
372 VtfInfo
->PreferredSize
= FALSE
;
373 VtfInfo
->CompSize
= 0;
375 VtfInfo
->PreferredSize
= TRUE
;
376 if (AsciiStringToUint64 (*TokenStr
, FALSE
, &StringValue
) != EFI_SUCCESS
) {
377 Error (NULL
, 0, 5001, "Parse error", "Cannot get: %s.", TokenStr
);
381 VtfInfo
->CompSize
= (UINTN
) StringValue
;
384 } else if (strnicmp (*TokenStr
, "COMP_CS", 7) == 0) {
386 if (strnicmp (*TokenStr
, "1", 1) == 0) {
387 VtfInfo
->CheckSumRequired
= 1;
388 } else if (strnicmp (*TokenStr
, "0", 1) == 0) {
389 VtfInfo
->CheckSumRequired
= 0;
391 Error (NULL
, 0, 3000, "Invaild", "Bad value in INF file required field: Checksum, the value must be '0' or '1'.");
396 if (*TokenStr
== NULL
) {
403 InitializeInFileInfo (
410 This function intializes the relevant global variable which is being
411 used to store the information retrieved from INF file.
424 SectionOptionFlag
= 0;
426 TokenStr
= OrgStrTokPtr
;
428 while (*TokenStr
!= NULL
) {
429 if (strnicmp (*TokenStr
, "[OPTIONS]", 9) == 0) {
430 SectionOptionFlag
= 1;
434 if (strnicmp (*TokenStr
, "[COMPONENTS]", 12) == 0) {
435 if (FileListPtr
== NULL
) {
436 FileListPtr
= FileListHeadPtr
;
440 SectionOptionFlag
= 0;
444 if (SectionOptionFlag
) {
445 if (stricmp (*TokenStr
, "IA32_RST_BIN") == 0) {
447 strcpy (IA32BinFile
, *TokenStr
);
451 if (SectionCompFlag
) {
452 if (stricmp (*TokenStr
, "COMP_NAME") == 0) {
454 strcpy (FileListPtr
->CompName
, *TokenStr
);
456 ParseAndUpdateComponents (FileListPtr
);
459 if (*TokenStr
!= NULL
) {
460 FileListPtr
->NextVtfInfo
= malloc (sizeof (PARSED_VTF_INFO
));
461 if (FileListPtr
->NextVtfInfo
== NULL
) {
462 Error (NULL
, 0, 4003, "Resource", "Out of memory resources.", NULL
);
465 FileListPtr
= FileListPtr
->NextVtfInfo
;
466 memset (FileListPtr
, 0, sizeof (PARSED_VTF_INFO
));
467 FileListPtr
->NextVtfInfo
= NULL
;
479 GetVtfRelatedInfoFromInfFile (
486 This function reads the input file, parse it and create a list of tokens
487 which is parsed and used, to intialize the data related to VTF
491 FileName - FileName which needed to be read to parse data
495 EFI_ABORTED - Error in opening file
496 EFI_INVALID_PARAMETER - File doesn't contain any valid information
497 EFI_OUT_OF_RESOURCES - Malloc Failed
498 EFI_SUCCESS - The function completed successfully
507 Status
= EFI_SUCCESS
;
510 Error (NULL
, 0, 2000, "Invalid parameter", "BSF INF file is invalid!");
516 if (ValidLineNum
== 0) {
517 Error (NULL
, 0, 2000, "Invalid parameter", "File does not contain any valid information!");
518 return EFI_INVALID_PARAMETER
;
521 TokenStr
= (CHAR8
**) malloc (sizeof (UINTN
) * (2 * ValidLineNum
+ 1));
523 if (TokenStr
== NULL
) {
524 return EFI_OUT_OF_RESOURCES
;
527 memset (TokenStr
, 0, (sizeof (UINTN
) * (2 * ValidLineNum
+ 1)));
528 OrgStrTokPtr
= TokenStr
;
530 for (Index
= 0; Index
< (2 * ValidLineNum
); Index
++) {
531 *TokenStr
= (CHAR8
*)malloc (sizeof (CHAR8
) * FILE_NAME_SIZE
);
533 if (*TokenStr
== NULL
) {
534 Status
= EFI_OUT_OF_RESOURCES
;
538 memset (*TokenStr
, 0, FILE_NAME_SIZE
);
542 TokenStr
= OrgStrTokPtr
;
543 fseek (Fp
, 0L, SEEK_SET
);
545 Status
= InitializeComps ();
547 if (Status
!= EFI_SUCCESS
) {
551 Status
= ParseInputFile (Fp
);
552 if (Status
!= EFI_SUCCESS
) {
556 InitializeInFileInfo ();
560 for (Index1
= 0; Index1
< Index
; Index1
++) {
561 free (OrgStrTokPtr
[Index1
]);
570 GetRelativeAddressInVtfBuffer (
572 IN OUT UINTN
*RelativeAddress
,
579 This function checks for the address alignmnet for specified data boundary. In
580 case the address is not aligned, it returns FALSE and the amount of data in
581 terms of byte needed to adjust to get the boundary alignmnet. If data is
582 aligned, TRUE will be returned.
586 Address - The address of the flash map space
587 RelativeAddress - The relative address of the Buffer
588 LocType - The type of the VTF
599 if (LocType
== FIRST_VTF
) {
600 LocalBuff
= (UINT8
*) Vtf1EndBuffer
;
601 TempAddress
= Fv1EndAddress
- Address
;
602 *RelativeAddress
= (UINTN
) LocalBuff
- (UINTN
) TempAddress
;
604 LocalBuff
= (UINT8
*) Vtf2EndBuffer
;
605 TempAddress
= Fv2EndAddress
- Address
;
606 *RelativeAddress
= (UINTN
) LocalBuff
- (UINTN
) TempAddress
;
611 GetComponentVersionInfo (
612 IN OUT PARSED_VTF_INFO
*VtfInfo
,
618 This function will extract the version information from File
622 VtfInfo - A Pointer to the VTF Info Structure
623 Buffer - A Pointer to type UINT8
627 EFI_SUCCESS - The function completed successfully
628 EFI_INVALID_PARAMETER - The parameter is invalid
635 switch (VtfInfo
->CompType
) {
637 case COMP_TYPE_FIT_PAL_A
:
638 case COMP_TYPE_FIT_PAL_B
:
639 memcpy (&VersionInfo
, (Buffer
+ 8), sizeof (UINT16
));
640 VtfInfo
->MajorVer
= (UINT8
) ((VersionInfo
& 0xFF00) >> 8);
641 VtfInfo
->MinorVer
= (UINT8
) (VersionInfo
& 0x00FF);
642 Status
= EFI_SUCCESS
;
646 Status
= EFI_INVALID_PARAMETER
;
654 CheckAddressAlignment (
656 IN UINT64 AlignmentData
,
657 IN OUT UINT64
*AlignAdjustByte
663 This function checks for the address alignmnet for specified data boundary. In
664 case the address is not aligned, it returns FALSE and the amount of data in
665 terms of byte needed to adjust to get the boundary alignmnet. If data is
666 aligned, TRUE will be returned.
670 Address - Pointer to buffer containing byte data of component.
671 AlignmentData - DataSize for which address needed to be aligned
672 AlignAdjustByte - Number of bytes needed to adjust alignment.
676 TRUE - Address is aligned to specific data size boundary
677 FALSE - Address in not aligned to specified data size boundary
678 - Add/Subtract AlignAdjustByte to aling the address.
683 // Check if the assigned address is on address boundary. If not, it will
684 // return the remaining byte required to adjust the address for specified
687 *AlignAdjustByte
= (Address
% AlignmentData
);
689 if (*AlignAdjustByte
== 0) {
697 GetFitTableStartAddress (
698 IN OUT FIT_TABLE
**FitTable
704 Get the FIT table start address in VTF Buffer
708 FitTable - Pointer to available fit table where new component can be added
712 EFI_SUCCESS - The function completed successfully
717 UINT64 FitTableAddOffset
;
718 UINTN RelativeAddress
;
721 // Read the Fit Table address from Itanium-based address map.
723 FitTableAddOffset
= Fv1EndAddress
- (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
+ SIZE_FIT_TABLE_ADD
);
726 // Translate this Itanium-based address in terms of local buffer address which
727 // contains the image for Boot Strapped File. The relative address will be
728 // the address of fit table VTF buffer.
730 GetRelativeAddressInVtfBuffer (FitTableAddOffset
, &RelativeAddress
, FIRST_VTF
);
731 FitTableAdd
= *(UINTN
*) RelativeAddress
;
734 // The FitTableAdd is the extracted Itanium based address pointing to FIT
735 // table. The relative address will return its actual location in VTF
738 GetRelativeAddressInVtfBuffer (FitTableAdd
, &RelativeAddress
, FIRST_VTF
);
740 *FitTable
= (FIT_TABLE
*) RelativeAddress
;
746 GetNextAvailableFitPtr (
747 IN FIT_TABLE
**FitPtr
753 Get the FIT table address and locate the free space in fit where we can add
754 new component. In this process, this function locates the fit table using
755 Fit pointer in Itanium-based address map (as per Intel?Itanium(TM) SAL spec)
756 and locate the available location in FIT table to be used by new components.
757 If there are any Fit table which areg not being used contains ComponentType
758 field as 0x7F. If needed we can change this and spec this out.
762 FitPtr - Pointer to available fit table where new component can be added
766 EFI_SUCCESS - The function completed successfully
770 FIT_TABLE
*TmpFitPtr
;
772 UINT64 FitTableAddOffset
;
774 UINTN NumFitComponents
;
775 UINTN RelativeAddress
;
778 // Read the Fit Table address from Itanium-based address map.
780 FitTableAddOffset
= Fv1EndAddress
- (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
+ SIZE_FIT_TABLE_ADD
);
783 // Translate this Itanium-based address in terms of local buffer address which
784 // contains the image for Boot Strapped File. The relative address will be
785 // the address of fit table VTF buffer.
787 GetRelativeAddressInVtfBuffer (FitTableAddOffset
, &RelativeAddress
, FIRST_VTF
);
788 FitTableAdd
= *(UINTN
*) RelativeAddress
;
791 // The FitTableAdd is the extracted Itanium based address pointing to FIT
792 // table. The relative address will return its actual location in VTF
795 GetRelativeAddressInVtfBuffer (FitTableAdd
, &RelativeAddress
, FIRST_VTF
);
797 TmpFitPtr
= (FIT_TABLE
*) RelativeAddress
;
798 NumFitComponents
= TmpFitPtr
->CompSize
;
801 for (Index
= 0; Index
< NumFitComponents
; Index
++) {
802 if ((TmpFitPtr
->CvAndType
& FIT_TYPE_MASK
) == COMP_TYPE_FIT_UNUSED
) {
822 This function is used by qsort to sort the FIT table based upon Component
823 Type in their incresing order.
827 Arg1 - Pointer to Arg1
828 Arg2 - Pointer to Arg2
836 if ((((FIT_TABLE
*) Arg1
)->CvAndType
& FIT_TYPE_MASK
) > (((FIT_TABLE
*) Arg2
)->CvAndType
& FIT_TYPE_MASK
)) {
838 } else if ((((FIT_TABLE
*) Arg1
)->CvAndType
& FIT_TYPE_MASK
) < (((FIT_TABLE
*) Arg2
)->CvAndType
& FIT_TYPE_MASK
)) {
853 This function is used by qsort to sort the FIT table based upon Component
854 Type in their incresing order.
867 FIT_TABLE
*TmpFitPtr
;
868 UINTN NumFitComponents
;
871 GetFitTableStartAddress (&FitTable
);
872 TmpFitPtr
= FitTable
;
873 NumFitComponents
= 0;
874 for (Index
= 0; Index
< FitTable
->CompSize
; Index
++) {
875 if ((TmpFitPtr
->CvAndType
& FIT_TYPE_MASK
) != COMP_TYPE_FIT_UNUSED
) {
876 NumFitComponents
+= 1;
880 qsort ((VOID
*) FitTable
, NumFitComponents
, sizeof (FIT_TABLE
), CompareItems
);
884 UpdateFitEntryForFwVolume (
891 This function updates the information about Firmware Volume in FIT TABLE.
892 This FIT table has to be immediately below the PAL_A Start and it contains
893 component type and address information. Other information can't be
894 created this time so we would need to fix it up..
899 Size - Firmware Volume Size
907 FIT_TABLE
*CompFitPtr
;
908 UINTN RelativeAddress
;
911 // FV Fit table will be located at PAL_A Startaddress - 16 byte location
913 Vtf1LastStartAddress
-= 0x10;
914 Vtf1TotalSize
+= 0x10;
916 GetRelativeAddressInVtfBuffer (Vtf1LastStartAddress
, &RelativeAddress
, FIRST_VTF
);
918 CompFitPtr
= (FIT_TABLE
*) RelativeAddress
;
919 CompFitPtr
->CompAddress
= Fv1BaseAddress
;
922 // Since we don't have any information about its location in Firmware Volume,
923 // initialize address to 0. This will be updated once Firmware Volume is
924 // being build and its current address will be fixed in FIT table. Currently
925 // we haven't implemented it so far and working on architectural clarafication
928 // Firmware Volume Size in 16 byte block
930 CompFitPtr
->CompSize
= ((UINT32
) Size
) / 16;
933 // Since Firmware Volume does not exist by the time we create this FIT info
934 // this should be fixedup from Firmware Volume creation tool. We haven't
935 // worked out a method so far.
937 CompFitPtr
->CompVersion
= MAKE_VERSION (0, 0);
940 // Since we don't have any info about this file, we are making sure that
941 // checksum is not needed.
943 CompFitPtr
->CvAndType
= CV_N_TYPE (0, COMP_TYPE_FIT_FV_BOOT
);
946 // Since non VTF component will reside outside the VTF, we will not have its
947 // binary image while creating VTF, hence we will not perform checksum at
948 // this time. Once Firmware Volume is being created which will contain this
949 // VTF, it will fix the FIT table for all the non VTF component and hence
952 CompFitPtr
->CheckSum
= 0;
956 UpdateFitEntryForNonVTFComp (
957 IN PARSED_VTF_INFO
*VtfInfo
963 This function updates the information about non VTF component in FIT TABLE.
964 Since non VTF componets binaries are not part of VTF binary, we would still
965 be required to update its location information in Firmware Volume, inside
970 VtfInfo - Pointer to VTF Info Structure
974 EFI_ABORTED - The function fails to update the component in FIT
975 EFI_SUCCESS - The function completed successfully
979 FIT_TABLE
*CompFitPtr
;
982 // Scan the FIT table for available space
984 GetNextAvailableFitPtr (&CompFitPtr
);
985 if (CompFitPtr
== NULL
) {
986 Error (NULL
, 0, 5003, "Invalid", "Can't update this component in FIT");
991 // Since we don't have any information about its location in Firmware Volume,
992 // initialize address to 0. This will be updated once Firmware Volume is
993 // being build and its current address will be fixed in FIT table
995 CompFitPtr
->CompAddress
= 0;
996 CompFitPtr
->CompSize
= VtfInfo
->CompSize
;
997 CompFitPtr
->CompVersion
= MAKE_VERSION (VtfInfo
->MajorVer
, VtfInfo
->MinorVer
);
998 CompFitPtr
->CvAndType
= CV_N_TYPE (VtfInfo
->CheckSumRequired
, VtfInfo
->CompType
);
1001 // Since non VTF component will reside outside the VTF, we will not have its
1002 // binary image while creating VTF, hence we will not perform checksum at
1003 // this time. Once Firmware Volume is being created which will contain this
1004 // VTF, it will fix the FIT table for all the non VTF component and hence
1007 CompFitPtr
->CheckSum
= 0;
1010 // Fit Type is FV_BOOT which means Firmware Volume, we initialize this to base
1011 // address of Firmware Volume in which this VTF will be attached.
1013 if ((CompFitPtr
->CvAndType
& 0x7F) == COMP_TYPE_FIT_FV_BOOT
) {
1014 CompFitPtr
->CompAddress
= Fv1BaseAddress
;
1022 // This function is updating the SALE_ENTRY in Itanium address space as per SAL
1023 // spec. SALE_ENTRY is being read from SYM file of PEICORE. Once the PEI
1024 // CORE moves in Firmware Volume, we would need to modify this function to be
1025 // used with a API which will detect PEICORE component while building Firmware
1026 // Volume and update its entry in FIT table as well as in Itanium address space
1027 // as per Intel?Itanium(TM) SAL address space
1031 IN PARSED_VTF_INFO
*VtfInfo
,
1032 IN UINT64
*CompStartAddress
1036 Routine Description:
1038 This function updated the architectural entry point in IPF, SALE_ENTRY.
1042 VtfInfo - Pointer to VTF Info Structure
1043 CompStartAddress - Pointer to Component Start Address
1047 EFI_INVALID_PARAMETER - The parameter is invalid
1048 EFI_SUCCESS - The function completed successfully
1052 UINTN RelativeAddress
;
1057 CHAR8 Buff
[FILE_NAME_SIZE
];
1060 CHAR8 OffsetStr
[30];
1065 CHAR8 FormatString
[MAX_LINE_LEN
];
1067 Fp
= fopen (LongFilePath (VtfInfo
->CompSymName
), "rb");
1070 Error (NULL
, 0, 0001, "Error opening file", VtfInfo
->CompSymName
);
1071 return EFI_INVALID_PARAMETER
;
1075 // Generate the format string for fscanf
1079 "%%%us %%%us %%%us %%%us %%%us %%%us %%%us",
1080 (unsigned) sizeof (Buff1
) - 1,
1081 (unsigned) sizeof (Buff2
) - 1,
1082 (unsigned) sizeof (OffsetStr
) - 1,
1083 (unsigned) sizeof (Buff3
) - 1,
1084 (unsigned) sizeof (Buff4
) - 1,
1085 (unsigned) sizeof (Buff5
) - 1,
1086 (unsigned) sizeof (Token
) - 1
1089 while (fgets (Buff
, sizeof (Buff
), Fp
) != NULL
) {
1101 if (strnicmp (Token
, "SALE_ENTRY", 10) == 0) {
1106 Offset
= strtoul (OffsetStr
, NULL
, 16);
1108 *CompStartAddress
+= Offset
;
1109 SalEntryAdd
= Fv1EndAddress
- (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
);
1111 GetRelativeAddressInVtfBuffer (SalEntryAdd
, &RelativeAddress
, FIRST_VTF
);
1113 memcpy ((VOID
*) RelativeAddress
, (VOID
*) CompStartAddress
, sizeof (UINT64
));
1123 CreateAndUpdateComponent (
1124 IN PARSED_VTF_INFO
*VtfInfo
1128 Routine Description:
1130 This function reads the binary file for each components and update them
1131 in VTF Buffer as well as in FIT table. If the component is located in non
1132 VTF area, only the FIT table address will be updated
1136 VtfInfo - Pointer to Parsed Info
1140 EFI_SUCCESS - The function completed successful
1141 EFI_ABORTED - Aborted due to one of the many reasons like:
1142 (a) Component Size greater than the specified size.
1143 (b) Error opening files.
1144 (c) Fail to get the FIT table address.
1146 EFI_INVALID_PARAMETER Value returned from call to UpdateEntryPoint()
1147 EFI_OUT_OF_RESOURCES Memory allocation failure.
1152 UINT64 CompStartAddress
;
1154 UINT64 NumAdjustByte
;
1157 FIT_TABLE
*CompFitPtr
;
1160 if (VtfInfo
->LocationType
== NONE
) {
1161 UpdateFitEntryForNonVTFComp (VtfInfo
);
1165 Fp
= fopen (LongFilePath (VtfInfo
->CompBinName
), "rb");
1168 Error (NULL
, 0, 0001, "Error opening file", VtfInfo
->CompBinName
);
1172 FileSize
= _filelength (fileno (Fp
));
1173 if ((VtfInfo
->CompType
== COMP_TYPE_FIT_PAL_B
) || (VtfInfo
->CompType
== COMP_TYPE_FIT_PAL_A_SPECIFIC
)) {
1176 // BUGBUG: Satish to correct
1178 FileSize
-= SIZE_OF_PAL_HEADER
;
1181 if (VtfInfo
->PreferredSize
) {
1182 if (FileSize
> VtfInfo
->CompSize
) {
1184 Error (NULL
, 0, 2000, "Invalid parameter", "The component size is more than specified size.");
1188 FileSize
= VtfInfo
->CompSize
;
1191 Buffer
= malloc ((UINTN
) FileSize
);
1192 if (Buffer
== NULL
) {
1194 return EFI_OUT_OF_RESOURCES
;
1196 memset (Buffer
, 0, (UINTN
) FileSize
);
1198 if ((VtfInfo
->CompType
== COMP_TYPE_FIT_PAL_B
) || (VtfInfo
->CompType
== COMP_TYPE_FIT_PAL_A_SPECIFIC
)) {
1201 // Read first 64 bytes of PAL header and use it to find version info
1203 fread (Buffer
, sizeof (UINT8
), SIZE_OF_PAL_HEADER
, Fp
);
1206 // PAL header contains the version info. Currently, we will use the header
1207 // to read version info and then discard.
1209 if (!VtfInfo
->VersionPresent
) {
1210 GetComponentVersionInfo (VtfInfo
, Buffer
);
1214 fread (Buffer
, sizeof (UINT8
), (UINTN
) FileSize
, Fp
);
1218 // If it is non PAL_B component, pass the entire buffer to get the version
1219 // info and implement any specific case inside GetComponentVersionInfo.
1221 if (VtfInfo
->CompType
!= COMP_TYPE_FIT_PAL_B
) {
1222 if (!VtfInfo
->VersionPresent
) {
1223 GetComponentVersionInfo (VtfInfo
, Buffer
);
1227 if (VtfInfo
->LocationType
== SECOND_VTF
) {
1229 CompStartAddress
= (Vtf2LastStartAddress
- FileSize
);
1231 CompStartAddress
= (Vtf1LastStartAddress
- FileSize
);
1234 if (VtfInfo
->CompType
== COMP_TYPE_FIT_PAL_B
) {
1235 Aligncheck
= CheckAddressAlignment (CompStartAddress
, 32 * 1024, &NumAdjustByte
);
1237 Aligncheck
= CheckAddressAlignment (CompStartAddress
, 8, &NumAdjustByte
);
1241 CompStartAddress
-= NumAdjustByte
;
1244 if (VtfInfo
->LocationType
== SECOND_VTF
&& SecondVTF
== TRUE
) {
1245 Vtf2LastStartAddress
= CompStartAddress
;
1246 Vtf2TotalSize
+= (UINT32
) (FileSize
+ NumAdjustByte
);
1247 Status
= UpdateVtfBuffer (CompStartAddress
, Buffer
, FileSize
, SECOND_VTF
);
1248 } else if (VtfInfo
->LocationType
== FIRST_VTF
) {
1249 Vtf1LastStartAddress
= CompStartAddress
;
1250 Vtf1TotalSize
+= (UINT32
) (FileSize
+ NumAdjustByte
);
1251 Status
= UpdateVtfBuffer (CompStartAddress
, Buffer
, FileSize
, FIRST_VTF
);
1254 Error (NULL
, 0, 2000,"Invalid Parameter", "There's component in second VTF so second BaseAddress and Size must be specified!");
1255 return EFI_INVALID_PARAMETER
;
1258 if (EFI_ERROR (Status
)) {
1263 GetNextAvailableFitPtr (&CompFitPtr
);
1264 if (CompFitPtr
== NULL
) {
1269 CompFitPtr
->CompAddress
= CompStartAddress
| IPF_CACHE_BIT
;
1270 if ((FileSize
% 16) != 0) {
1272 Error (NULL
, 0, 2000, "Invalid parameter", "Binary FileSize must be a multiple of 16.");
1273 return EFI_INVALID_PARAMETER
;
1275 //assert ((FileSize % 16) == 0);
1276 CompFitPtr
->CompSize
= (UINT32
) (FileSize
/ 16);
1277 CompFitPtr
->CompVersion
= MAKE_VERSION (VtfInfo
->MajorVer
, VtfInfo
->MinorVer
);
1278 CompFitPtr
->CvAndType
= CV_N_TYPE (VtfInfo
->CheckSumRequired
, VtfInfo
->CompType
);
1279 if (VtfInfo
->CheckSumRequired
) {
1280 CompFitPtr
->CheckSum
= 0;
1281 CompFitPtr
->CheckSum
= CalculateChecksum8 (Buffer
, (UINTN
) FileSize
);
1292 // Update the SYM file for this component based on it's start address.
1294 Status
= UpdateSymFile (CompStartAddress
, SymFileName
, VtfInfo
->CompSymName
, FileSize
);
1295 if (EFI_ERROR (Status
)) {
1298 // At this time, SYM files are not required, so continue on error.
1302 // !!!!!!!!!!!!!!!!!!!!!
1304 // This part of the code is a temporary line since PEICORE is going to be inside
1305 // VTF till we work out how to determine the SALE_ENTRY through it. We will need
1306 // to clarify so many related questions
1307 // !!!!!!!!!!!!!!!!!!!!!!!
1309 if (VtfInfo
->CompType
== COMP_TYPE_FIT_PEICORE
) {
1310 Status
= UpdateEntryPoint (VtfInfo
, &CompStartAddress
);
1317 CreateAndUpdatePAL_A (
1318 IN PARSED_VTF_INFO
*VtfInfo
1322 Routine Description:
1324 This function reads the binary file for each components and update them
1325 in VTF Buffer as well as FIT table
1329 VtfInfo - Pointer to Parsed Info
1333 EFI_ABORTED - Due to one of the following reasons:
1334 (a)Error Opening File
1335 (b)The PAL_A Size is more than specified size status
1336 One of the values mentioned below returned from
1337 call to UpdateSymFile
1338 EFI_SUCCESS - The function completed successfully.
1339 EFI_INVALID_PARAMETER - One of the input parameters was invalid.
1340 EFI_ABORTED - An error occurred.UpdateSymFile
1341 EFI_OUT_OF_RESOURCES - Memory allocation failed.
1346 UINT64 PalStartAddress
;
1348 UINTN RelativeAddress
;
1352 FIT_TABLE
*PalFitPtr
;
1354 Fp
= fopen (LongFilePath (VtfInfo
->CompBinName
), "rb");
1357 Error (NULL
, 0, 0001, "Error opening file", VtfInfo
->CompBinName
);
1361 FileSize
= _filelength (fileno (Fp
));
1362 if (FileSize
< 64) {
1364 Error (NULL
, 0, 2000, "Invalid parameter", "PAL_A bin header is 64 bytes, so the Bin size must be larger than 64 bytes!");
1365 return EFI_INVALID_PARAMETER
;
1367 FileSize
-= SIZE_OF_PAL_HEADER
;
1370 if (VtfInfo
->PreferredSize
) {
1371 if (FileSize
> VtfInfo
->CompSize
) {
1373 Error (NULL
, 0, 2000, "Invalid parameter", "The PAL_A Size is more than the specified size.");
1377 FileSize
= VtfInfo
->CompSize
;
1380 Buffer
= malloc ((UINTN
) FileSize
);
1381 if (Buffer
== NULL
) {
1383 return EFI_OUT_OF_RESOURCES
;
1385 memset (Buffer
, 0, (UINTN
) FileSize
);
1388 // Read, Get version Info and discard the PAL header.
1390 fread (Buffer
, sizeof (UINT8
), SIZE_OF_PAL_HEADER
, Fp
);
1393 // Extract the version info from header of PAL_A. Once done, discrad this buffer
1395 if (!VtfInfo
->VersionPresent
) {
1396 GetComponentVersionInfo (VtfInfo
, Buffer
);
1400 // Read PAL_A file in a buffer
1402 fread (Buffer
, sizeof (UINT8
), (UINTN
) FileSize
, Fp
);
1405 PalStartAddress
= Fv1EndAddress
- (SIZE_TO_OFFSET_PAL_A_END
+ FileSize
);
1406 Vtf1LastStartAddress
= PalStartAddress
;
1407 Vtf1TotalSize
+= (UINT32
) FileSize
;
1408 Status
= UpdateVtfBuffer (PalStartAddress
, Buffer
, FileSize
, FIRST_VTF
);
1410 AbsAddress
= Fv1EndAddress
- SIZE_TO_PAL_A_FIT
;
1411 GetRelativeAddressInVtfBuffer (AbsAddress
, &RelativeAddress
, FIRST_VTF
);
1412 PalFitPtr
= (FIT_TABLE
*) RelativeAddress
;
1413 PalFitPtr
->CompAddress
= PalStartAddress
| IPF_CACHE_BIT
;
1414 //assert ((FileSize % 16) == 0);
1415 if ((FileSize
% 16) != 0) {
1417 Error (NULL
, 0, 2000, "Invalid parameter", "Binary FileSize must be a multiple of 16.");
1418 return EFI_INVALID_PARAMETER
;
1421 PalFitPtr
->CompSize
= (UINT32
) (FileSize
/ 16);
1422 PalFitPtr
->CompVersion
= MAKE_VERSION (VtfInfo
->MajorVer
, VtfInfo
->MinorVer
);
1423 PalFitPtr
->CvAndType
= CV_N_TYPE (VtfInfo
->CheckSumRequired
, VtfInfo
->CompType
);
1424 if (VtfInfo
->CheckSumRequired
) {
1425 PalFitPtr
->CheckSum
= 0;
1426 PalFitPtr
->CheckSum
= CalculateChecksum8 (Buffer
, (UINTN
) FileSize
);
1434 // Update the SYM file for this component based on it's start address.
1436 Status
= UpdateSymFile (PalStartAddress
, SymFileName
, VtfInfo
->CompSymName
, FileSize
);
1437 if (EFI_ERROR (Status
)) {
1440 // At this time, SYM files are not required, so continue on error.
1448 CreateFitTableAndInitialize (
1449 IN PARSED_VTF_INFO
*VtfInfo
1453 Routine Description:
1455 This function creates and intializes FIT table which would be used to
1456 add component info inside this
1460 VtfInfo - Pointer to Parsed Info
1464 EFI_ABORTED - Aborted due to no size information
1465 EFI_SUCCESS - The function completed successfully
1469 UINT64 PalFitTableAdd
;
1471 UINT64 FitTableAddressOffset
;
1472 FIT_TABLE
*PalFitPtr
;
1473 FIT_TABLE
*FitStartPtr
;
1475 UINTN RelativeAddress
;
1478 if (!VtfInfo
->PreferredSize
) {
1479 Error (NULL
, 0, 2000, "Invalid parameter", "FIT could not be allocated because there is no size information.");
1483 if ((VtfInfo
->CompSize
% 16) != 0) {
1484 Error (NULL
, 0, 2000, "Invalid parameter", "Invalid FIT Table Size, it is not a multiple of 16 bytes. Please correct the size.");
1487 PalFitTableAdd
= Fv1EndAddress
- SIZE_TO_PAL_A_FIT
;
1488 GetRelativeAddressInVtfBuffer (PalFitTableAdd
, &RelativeAddress
, FIRST_VTF
);
1489 PalFitPtr
= (FIT_TABLE
*) RelativeAddress
;
1490 PalFitTableAdd
= (PalFitPtr
->CompAddress
- VtfInfo
->CompSize
);
1492 FitTableAdd
= (PalFitPtr
->CompAddress
- 0x10) - VtfInfo
->CompSize
;
1493 FitTableAddressOffset
= Fv1EndAddress
- (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
+ SIZE_FIT_TABLE_ADD
);
1494 GetRelativeAddressInVtfBuffer (FitTableAddressOffset
, &RelativeAddress
, FIRST_VTF
);
1495 *(UINT64
*) RelativeAddress
= FitTableAdd
;
1497 GetRelativeAddressInVtfBuffer (FitTableAdd
, &RelativeAddress
, FIRST_VTF
);
1500 // Update Fit Table with FIT Signature and FIT info in first 16 bytes.
1502 FitStartPtr
= (FIT_TABLE
*) RelativeAddress
;
1504 strncpy ((CHAR8
*) &FitStartPtr
->CompAddress
, FIT_SIGNATURE
, 8); // "_FIT_ "
1505 assert (((VtfInfo
->CompSize
& 0x00FFFFFF) % 16) == 0);
1506 FitStartPtr
->CompSize
= (VtfInfo
->CompSize
& 0x00FFFFFF) / 16;
1507 FitStartPtr
->CompVersion
= MAKE_VERSION (VtfInfo
->MajorVer
, VtfInfo
->MinorVer
);
1510 // BUGBUG: If a checksum is required, add code to checksum the FIT table. Also
1511 // determine what to do for things like the FV component that aren't easily checksummed.
1512 // The checksum will be done once we are done with all the componet update in the FIT
1515 FitStartPtr
->CvAndType
= CV_N_TYPE (VtfInfo
->CheckSumRequired
, VtfInfo
->CompType
);
1517 NumFitComp
= FitStartPtr
->CompSize
;
1522 // Intialize remaining FIT table space to UNUSED fit component type
1523 // so that when we need to create a FIT entry for a component, we can
1524 // locate a free one and use it.
1526 for (Index
= 0; Index
< (NumFitComp
- 1); Index
++) {
1527 FitStartPtr
->CvAndType
= 0x7F; // Initialize all with UNUSED
1531 Vtf1TotalSize
+= VtfInfo
->CompSize
;
1532 Vtf1LastStartAddress
-= VtfInfo
->CompSize
;
1545 Routine Description:
1547 Write Firmware Volume from memory to a file.
1551 FileName - Output File Name which needed to be created/
1553 LocType - The type of the VTF
1557 EFI_ABORTED - Returned due to one of the following resons:
1558 (a) Error Opening File
1559 (b) Failing to copy buffers
1560 EFI_SUCCESS - The fuction completes successfully
1567 UINTN RelativeAddress
;
1569 if (LocType
== FIRST_VTF
) {
1570 GetRelativeAddressInVtfBuffer (Vtf1LastStartAddress
, &RelativeAddress
, FIRST_VTF
);
1571 VtfBuffer
= (VOID
*) RelativeAddress
;
1573 GetRelativeAddressInVtfBuffer (Vtf2LastStartAddress
, &RelativeAddress
, SECOND_VTF
);
1574 VtfBuffer
= (VOID
*) RelativeAddress
;
1577 Fp
= fopen (LongFilePath (FileName
), "wb");
1579 Error (NULL
, 0, 0001, "Error opening file", FileName
);
1583 NumByte
= fwrite (VtfBuffer
, sizeof (UINT8
), (UINTN
) VtfSize
, Fp
);
1589 if (NumByte
!= (sizeof (UINT8
) * VtfSize
)) {
1590 Error (NULL
, 0, 0002, "Error writing file", FileName
);
1599 IN UINT64 StartAddress
,
1606 Routine Description:
1608 Update the Firmware Volume Buffer with requested buffer data
1612 StartAddress - StartAddress in buffer. This number will automatically
1613 point to right address in buffer where data needed
1615 Buffer - Buffer pointer from data will be copied to memory mapped buffer.
1616 DataSize - Size of the data needed to be copied.
1617 LocType - The type of the VTF: First or Second
1621 EFI_ABORTED - The input parameter is error
1622 EFI_SUCCESS - The function completed successfully
1626 UINT8
*LocalBufferPtrToWrite
;
1628 if (LocType
== FIRST_VTF
) {
1629 if ((StartAddress
| IPF_CACHE_BIT
) < (Vtf1LastStartAddress
| IPF_CACHE_BIT
)) {
1630 Error (NULL
, 0, 2000, "Invalid parameter", "Start Address is less than the VTF start address.");
1634 LocalBufferPtrToWrite
= (UINT8
*) Vtf1EndBuffer
;
1636 LocalBufferPtrToWrite
-= (Fv1EndAddress
- StartAddress
);
1640 if ((StartAddress
| IPF_CACHE_BIT
) < (Vtf2LastStartAddress
| IPF_CACHE_BIT
)) {
1641 Error (NULL
, 0, 2000, "Invalid parameter", "Error StartAddress");
1644 LocalBufferPtrToWrite
= (UINT8
*) Vtf2EndBuffer
;
1645 LocalBufferPtrToWrite
-= (Fv2EndAddress
- StartAddress
);
1648 memcpy (LocalBufferPtrToWrite
, Buffer
, (UINTN
) DataSize
);
1655 IN UINT32 TotalVtfSize
,
1660 Routine Description:
1662 Update the Firmware Volume Buffer with requested buffer data
1666 TotalVtfSize - Size of the VTF
1667 Fileoffset - The start of the file relative to the start of the FV.
1668 LocType - The type of the VTF
1672 EFI_SUCCESS - The function completed successfully
1673 EFI_INVALID_PARAMETER - The Ffs File Header Pointer is NULL
1677 EFI_FFS_FILE_HEADER
*FileHeader
;
1678 UINTN RelativeAddress
;
1679 EFI_GUID EfiFirmwareVolumeTopFileGuid
= EFI_FFS_VOLUME_TOP_FILE_GUID
;
1682 // Find the VTF file header location
1684 if (LocType
== FIRST_VTF
) {
1685 GetRelativeAddressInVtfBuffer (Vtf1LastStartAddress
, &RelativeAddress
, FIRST_VTF
);
1686 FileHeader
= (EFI_FFS_FILE_HEADER
*) RelativeAddress
;
1688 GetRelativeAddressInVtfBuffer (Vtf2LastStartAddress
, &RelativeAddress
, SECOND_VTF
);
1689 FileHeader
= (EFI_FFS_FILE_HEADER
*) RelativeAddress
;
1692 if (FileHeader
== NULL
) {
1693 return EFI_INVALID_PARAMETER
;
1699 memset (FileHeader
, 0, sizeof (EFI_FFS_FILE_HEADER
));
1700 memcpy (&FileHeader
->Name
, &EfiFirmwareVolumeTopFileGuid
, sizeof (EFI_GUID
));
1701 FileHeader
->Type
= EFI_FV_FILETYPE_RAW
;
1702 FileHeader
->Attributes
= FFS_ATTRIB_CHECKSUM
;
1705 // Now FileSize includes the EFI_FFS_FILE_HEADER
1707 FileHeader
->Size
[0] = (UINT8
) (TotalVtfSize
& 0x000000FF);
1708 FileHeader
->Size
[1] = (UINT8
) ((TotalVtfSize
& 0x0000FF00) >> 8);
1709 FileHeader
->Size
[2] = (UINT8
) ((TotalVtfSize
& 0x00FF0000) >> 16);
1712 // Fill in checksums and state, all three must be zero for the checksums.
1714 FileHeader
->IntegrityCheck
.Checksum
.Header
= 0;
1715 FileHeader
->IntegrityCheck
.Checksum
.File
= 0;
1716 FileHeader
->State
= 0;
1717 FileHeader
->IntegrityCheck
.Checksum
.Header
= CalculateChecksum8 ((UINT8
*) FileHeader
, sizeof (EFI_FFS_FILE_HEADER
));
1718 FileHeader
->IntegrityCheck
.Checksum
.File
= CalculateChecksum8 ((UINT8
*) (FileHeader
+ 1), TotalVtfSize
- sizeof (EFI_FFS_FILE_HEADER
));
1719 FileHeader
->State
= EFI_FILE_HEADER_CONSTRUCTION
| EFI_FILE_HEADER_VALID
| EFI_FILE_DATA_VALID
;
1725 ValidateAddressAndSize (
1726 IN UINT64 BaseAddress
,
1731 Routine Description:
1733 Update the Firmware Volume Buffer with requested buffer data
1737 BaseAddress - Base address for the Fw Volume.
1739 FwVolSize - Total Size of the FwVolume to which VTF will be attached..
1743 EFI_SUCCESS - The function completed successfully
1744 EFI_UNSUPPORTED - The input parameter is error
1748 if ((FwVolSize
> 0x40) && ((BaseAddress
+ FwVolSize
) % 8 == 0)) {
1752 return EFI_UNSUPPORTED
;
1756 UpdateIA32ResetVector (
1758 IN UINT64 FirstFwVSize
1762 Routine Description:
1764 Update the 16 byte IA32 Reset vector to maintain the compatibility
1768 FileName - Binary file name which contains the IA32 Reset vector info..
1769 FirstFwVSize - Total Size of the FwVolume to which VTF will be attached..
1773 EFI_SUCCESS - The function completed successfully
1774 EFI_ABORTED - Invalid File Size
1775 EFI_INVALID_PARAMETER - Bad File Name
1776 EFI_OUT_OF_RESOURCES - Memory allocation failed.
1781 UINT8
*LocalVtfBuffer
;
1785 if (!strcmp (FileName
, "")) {
1786 return EFI_INVALID_PARAMETER
;
1789 Fp
= fopen (LongFilePath (FileName
), "rb");
1792 Error (NULL
, 0, 0001, "Error opening file", FileName
);
1796 FileSize
= _filelength (fileno (Fp
));
1798 if (FileSize
> 16) {
1803 Buffer
= malloc (FileSize
);
1804 if (Buffer
== NULL
) {
1806 return EFI_OUT_OF_RESOURCES
;
1809 fread (Buffer
, sizeof (UINT8
), FileSize
, Fp
);
1811 LocalVtfBuffer
= (UINT8
*) Vtf1EndBuffer
- SIZE_IA32_RESET_VECT
;
1812 memcpy (LocalVtfBuffer
, Buffer
, FileSize
);
1830 Routine Description:
1832 This function cleans up any allocated buffer
1844 PARSED_VTF_INFO
*TempFileListPtr
;
1855 // Cleanup the buffer which was allocated to read the file names from FV.INF
1857 FileListPtr
= FileListHeadPtr
;
1858 while (FileListPtr
!= NULL
) {
1859 TempFileListPtr
= FileListPtr
->NextVtfInfo
;
1861 FileListPtr
= TempFileListPtr
;
1866 ProcessAndCreateVtf (
1871 Routine Description:
1873 This function process the link list created during INF file parsing
1874 and create component in VTF and updates its info in FIT table
1878 Size - Size of the Firmware Volume of which, this VTF belongs to.
1882 EFI_UNSUPPORTED - Unknown FIT type
1883 EFI_SUCCESS - The function completed successfully
1888 PARSED_VTF_INFO
*ParsedInfoPtr
;
1890 Status
= EFI_SUCCESS
;
1892 ParsedInfoPtr
= FileListHeadPtr
;
1894 while (ParsedInfoPtr
!= NULL
) {
1896 switch (ParsedInfoPtr
->CompType
) {
1898 // COMP_TYPE_FIT_HEADER is a special case, hence handle it here
1900 case COMP_TYPE_FIT_HEADER
:
1901 //COMP_TYPE_FIT_HEADER 0x00
1902 Status
= CreateFitTableAndInitialize (ParsedInfoPtr
);
1906 // COMP_TYPE_FIT_PAL_A is a special case, hence handle it here
1908 case COMP_TYPE_FIT_PAL_A
:
1909 //COMP_TYPE_FIT_PAL_A 0x0F
1910 Status
= CreateAndUpdatePAL_A (ParsedInfoPtr
);
1913 // Based on VTF specification, once the PAL_A component has been written,
1914 // update the Firmware Volume info as FIT table. This will be utilized
1915 // to extract the Firmware Volume Start address where this VTF will be
1918 if (Status
== EFI_SUCCESS
) {
1919 UpdateFitEntryForFwVolume (Size
);
1923 case COMP_TYPE_FIT_FV_BOOT
:
1924 //COMP_TYPE_FIT_FV_BOOT 0x7E
1926 // Since FIT entry for Firmware Volume has been created and it is
1927 // located at (PAL_A start - 16 byte). So we will not process any
1928 // Firmware Volume related entry from INF file
1930 Status
= EFI_SUCCESS
;
1935 // Any other component type should be handled here. This will create the
1936 // image in specified VTF and create appropriate entry about this
1937 // component in FIT Entry.
1939 Status
= CreateAndUpdateComponent (ParsedInfoPtr
);
1940 if (EFI_ERROR (Status
)) {
1941 Error (NULL
, 0, 0002, "Error updating component", ParsedInfoPtr
->CompName
);
1947 ParsedInfoPtr
= ParsedInfoPtr
->NextVtfInfo
;
1954 IN UINT64 StartAddress1
,
1956 IN UINT64 StartAddress2
,
1962 Routine Description:
1964 This is the main function which will be called from application.
1968 StartAddress1 - The start address of the first VTF
1969 Size1 - The size of the first VTF
1970 StartAddress2 - The start address of the second VTF
1971 Size2 - The size of the second VTF
1972 fp - The pointer to BSF inf file
1976 EFI_OUT_OF_RESOURCES - Can not allocate memory
1977 The return value can be any of the values
1978 returned by the calls to following functions:
1979 GetVtfRelatedInfoFromInfFile
1981 UpdateIA32ResetVector
1990 Status
= EFI_UNSUPPORTED
;
1993 if (StartAddress2
== 0) {
1999 Fv1BaseAddress
= StartAddress1
;
2000 Fv1EndAddress
= Fv1BaseAddress
+ Size1
;
2001 if (Fv1EndAddress
!= 0x100000000ULL
|| Size1
< 0x100000) {
2002 Error (NULL
, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");
2003 if (Size1
< 0x100000) {
2004 Error (NULL
, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!");
2005 } else if (SecondVTF
!= TRUE
) {
2006 Error (NULL
, 0, 2000, "Invalid parameter", "BaseAddress + FwVolumeSize must equal 0x100000000!");
2009 return EFI_INVALID_PARAMETER
;
2013 // The image buffer for the First VTF
2015 Vtf1Buffer
= malloc ((UINTN
) Size1
);
2016 if (Vtf1Buffer
== NULL
) {
2017 Error (NULL
, 0, 4001, "Resource", "Not enough resources available to create memory mapped file for the Boot Strap File!");
2018 return EFI_OUT_OF_RESOURCES
;
2020 memset (Vtf1Buffer
, 0x00, (UINTN
) Size1
);
2021 Vtf1EndBuffer
= (UINT8
*) Vtf1Buffer
+ Size1
;
2022 Vtf1LastStartAddress
= Fv1EndAddress
| IPF_CACHE_BIT
;
2025 Fv2BaseAddress
= StartAddress2
;
2026 Fv2EndAddress
= Fv2BaseAddress
+ Size2
;
2027 if (Fv2EndAddress
!= StartAddress1
) {
2028 Error (NULL
, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");
2029 if (SecondVTF
== TRUE
) {
2030 Error (NULL
, 0, 2000, "Invalid parameter", "FirstBaseAddress + FirstFwVolumeSize must equal 0x100000000!");
2031 Error (NULL
, 0, 2000, "Invalid parameter", "SecondBaseAddress + SecondFwVolumeSize must equal FirstBaseAddress!");
2034 return EFI_INVALID_PARAMETER
;
2038 // The image buffer for the second VTF
2040 Vtf2Buffer
= malloc ((UINTN
) Size2
);
2041 if (Vtf2Buffer
== NULL
) {
2042 Error (NULL
, 0, 4001, "Resource", "Not enough resources available to create memory mapped file for the Boot Strap File!");
2043 return EFI_OUT_OF_RESOURCES
;
2045 memset (Vtf2Buffer
, 0x00, (UINTN
) Size2
);
2046 Vtf2EndBuffer
= (UINT8
*) Vtf2Buffer
+ Size2
;
2047 Vtf2LastStartAddress
= Fv2EndAddress
| IPF_CACHE_BIT
;
2050 Status
= GetVtfRelatedInfoFromInfFile (VtfFP
);
2052 if (Status
!= EFI_SUCCESS
) {
2053 Error (NULL
, 0, 0003, "Error parsing file", "the input file.");
2058 Status
= ProcessAndCreateVtf (Size1
);
2059 if (Status
!= EFI_SUCCESS
) {
2064 if (SectionOptionFlag
) {
2065 Status
= UpdateIA32ResetVector (IA32BinFile
, Vtf1TotalSize
);
2066 if (Status
!= EFI_SUCCESS
) {
2073 // Re arrange the FIT Table for Ascending order of their FIT Type..
2078 // All components have been updated in FIT table. Now perform the FIT table
2079 // checksum. The following function will check if Checksum is required,
2080 // if yes, then it will perform the checksum otherwise not.
2082 CalculateFitTableChecksum ();
2085 // Write the FFS header
2087 Vtf1TotalSize
+= sizeof (EFI_FFS_FILE_HEADER
);
2088 Vtf1LastStartAddress
-= sizeof (EFI_FFS_FILE_HEADER
);
2090 Status
= UpdateFfsHeader (Vtf1TotalSize
, FIRST_VTF
);
2091 if (Status
!= EFI_SUCCESS
) {
2096 // Update the VTF buffer into specified VTF binary file
2098 Status
= WriteVtfBinary (OutFileName1
, Vtf1TotalSize
, FIRST_VTF
);
2101 Vtf2TotalSize
+= sizeof (EFI_FFS_FILE_HEADER
);
2102 Vtf2LastStartAddress
-= sizeof (EFI_FFS_FILE_HEADER
);
2103 Status
= UpdateFfsHeader (Vtf2TotalSize
, SECOND_VTF
);
2104 if (Status
!= EFI_SUCCESS
) {
2110 // Update the VTF buffer into specified VTF binary file
2112 Status
= WriteVtfBinary (OutFileName2
, Vtf2TotalSize
, SECOND_VTF
);
2121 PeimFixupInFitTable (
2122 IN UINT64 StartAddress
2126 Routine Description:
2128 This function is an entry point to fixup SAL-E entry point.
2132 StartAddress - StartAddress for PEIM.....
2136 EFI_SUCCESS - The function completed successfully
2137 EFI_ABORTED - Error Opening File
2138 EFI_OUT_OF_RESOURCES - System out of resources for memory allocation.
2144 UINT64
*StartAddressPtr
;
2147 StartAddressPtr
= malloc (sizeof (UINT64
));
2148 if (StartAddressPtr
== NULL
) {
2149 return EFI_OUT_OF_RESOURCES
;
2151 *StartAddressPtr
= StartAddress
;
2153 Fp
= fopen (LongFilePath (OutFileName1
), "rb");
2156 Error (NULL
, 0, 0001, "Error opening file", OutFileName1
);
2157 if (StartAddressPtr
) {
2158 free (StartAddressPtr
);
2163 FirstFwVSize
= _filelength (fileno (Fp
));
2164 fseek (Fp
, (long) (FirstFwVSize
- (UINTN
) (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
)), SEEK_SET
);
2165 fwrite ((VOID
*) StartAddressPtr
, sizeof (UINT64
), 1, Fp
);
2171 if (StartAddressPtr
) {
2172 free (StartAddressPtr
);
2175 Status
= EFI_SUCCESS
;
2181 IN UINT64 BaseAddress
,
2182 IN CHAR8
*DestFileName
,
2183 IN CHAR8
*SourceFileName
,
2189 Routine Description:
2191 This function adds the SYM tokens in the source file to the destination file.
2192 The SYM tokens are updated to reflect the base address.
2196 BaseAddress - The base address for the new SYM tokens.
2197 DestFileName - The destination file.
2198 SourceFileName - The source file.
2199 FileSize - Size of bin file.
2203 EFI_SUCCESS - The function completed successfully.
2204 EFI_INVALID_PARAMETER - One of the input parameters was invalid.
2205 EFI_ABORTED - An error occurred.
2211 CHAR8 Buffer
[MAX_LONG_FILE_PATH
];
2212 CHAR8 Type
[MAX_LONG_FILE_PATH
];
2213 CHAR8 Address
[MAX_LONG_FILE_PATH
];
2214 CHAR8 Section
[MAX_LONG_FILE_PATH
];
2215 CHAR8 Token
[MAX_LONG_FILE_PATH
];
2216 CHAR8 BaseToken
[MAX_LONG_FILE_PATH
];
2217 CHAR8 FormatString
[MAX_LINE_LEN
];
2218 UINT64 TokenAddress
;
2222 // Verify input parameters.
2224 if (BaseAddress
== 0 || DestFileName
== NULL
|| SourceFileName
== NULL
) {
2225 return EFI_INVALID_PARAMETER
;
2229 // Open the source file
2231 SourceFile
= fopen (LongFilePath (SourceFileName
), "r");
2232 if (SourceFile
== NULL
) {
2235 // SYM files are not required.
2241 // Use the file name minus extension as the base for tokens
2243 strcpy (BaseToken
, SourceFileName
);
2244 strtok (BaseToken
, ". \t\n");
2245 strcat (BaseToken
, "__");
2248 // Open the destination file
2250 DestFile
= fopen (LongFilePath (DestFileName
), "a+");
2251 if (DestFile
== NULL
) {
2252 fclose (SourceFile
);
2253 Error (NULL
, 0, 0001, "Error opening file", DestFileName
);
2258 // If this is the beginning of the output file, write the symbol format info.
2260 if (fseek (DestFile
, 0, SEEK_END
) != 0) {
2261 fclose (SourceFile
);
2263 Error (NULL
, 0, 2000, "Invalid parameter", "not at the beginning of the output file.");
2267 StartLocation
= ftell (DestFile
);
2269 if (StartLocation
== 0) {
2270 fprintf (DestFile
, "TEXTSYM format | V1.0\n");
2271 } else if (StartLocation
== -1) {
2272 fclose (SourceFile
);
2274 Error (NULL
, 0, 2000, "Invalid parameter", "StartLocation error");
2279 // Read the first line
2281 if (fgets (Buffer
, MAX_LONG_FILE_PATH
, SourceFile
) == NULL
) {
2286 // Make sure it matches the expected sym format
2288 if (strcmp (Buffer
, "TEXTSYM format | V1.0\n")) {
2289 fclose (SourceFile
);
2291 Error (NULL
, 0, 2000, "Invalid parameter", "The symbol file does not match the expected TEXTSYM format (V1.0.)");
2296 // Generate the format string for fscanf
2300 "%%%us | %%%us | %%%us | %%%us\n",
2301 (unsigned) sizeof (Type
) - 1,
2302 (unsigned) sizeof (Address
) - 1,
2303 (unsigned) sizeof (Section
) - 1,
2304 (unsigned) sizeof (Token
) - 1
2310 while (feof (SourceFile
) == 0) {
2315 if (fscanf (SourceFile
, FormatString
, Type
, Address
, Section
, Token
) == 4) {
2318 // Get the token address
2320 AsciiStringToUint64 (Address
, TRUE
, &TokenAddress
);
2321 if (TokenAddress
> FileSize
) {
2323 // Symbol offset larger than FileSize. This Symbol can't be in Bin file. Don't print them.
2329 // Add the base address, the size of the FFS file header and the size of the peim header.
2331 TokenAddress
+= BaseAddress
&~IPF_CACHE_BIT
;
2333 fprintf (DestFile
, "%s | %016llX | ", Type
, (unsigned long long) TokenAddress
);
2334 fprintf (DestFile
, "%s | %s\n %s\n", Section
, Token
, BaseToken
);
2338 fclose (SourceFile
);
2344 CalculateFitTableChecksum (
2349 Routine Description:
2351 This function will perform byte checksum on the FIT table, if the the checksum required
2352 field is set to CheckSum required. If the checksum is not required then checksum byte
2353 will have value as 0;.
2361 Status - Value returned by call to CalculateChecksum8 ()
2362 EFI_SUCCESS - The function completed successfully
2366 FIT_TABLE
*TmpFitPtr
;
2368 UINT64 FitTableAddOffset
;
2369 UINTN RelativeAddress
;
2373 // Read the Fit Table address from Itanium-based address map.
2375 FitTableAddOffset
= Fv1EndAddress
- (SIZE_IA32_RESET_VECT
+ SIZE_SALE_ENTRY_POINT
+ SIZE_FIT_TABLE_ADD
);
2378 // Translate this Itanium-based address in terms of local buffer address which
2379 // contains the image for Boot Strapped File
2381 GetRelativeAddressInVtfBuffer (FitTableAddOffset
, &RelativeAddress
, FIRST_VTF
);
2382 FitTableAdd
= *(UINTN
*) RelativeAddress
;
2384 GetRelativeAddressInVtfBuffer (FitTableAdd
, &RelativeAddress
, FIRST_VTF
);
2386 TmpFitPtr
= (FIT_TABLE
*) RelativeAddress
;
2388 Size
= TmpFitPtr
->CompSize
* 16;
2390 if ((TmpFitPtr
->CvAndType
& CHECKSUM_BIT_MASK
) >> 7) {
2391 TmpFitPtr
->CheckSum
= 0;
2392 TmpFitPtr
->CheckSum
= CalculateChecksum8 ((UINT8
*) TmpFitPtr
, Size
);
2394 TmpFitPtr
->CheckSum
= 0;
2406 Routine Description:
2408 Displays the standard utility information to SDTOUT
2420 fprintf (stdout
, "%s Version %d.%d %s \n", UTILITY_NAME
, UTILITY_MAJOR_VERSION
, UTILITY_MINOR_VERSION
, __BUILD_VERSION
);
2429 Routine Description:
2431 Displays the utility usage syntax to STDOUT
2446 fprintf (stdout
, "Usage: %s [options] <-f input_file> <-r BaseAddress> <-s FwVolumeSize>\n\n", UTILITY_NAME
);
2449 // Copyright declaration
2451 fprintf (stdout
, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
2455 fprintf (stdout
, "Options:\n");
2456 fprintf (stdout
, " -f Input_file, --filename Input_file\n\
2457 Input_file is name of the BS Image INF file\n");
2458 fprintf (stdout
, " -r BaseAddress, --baseaddr BaseAddress\n\
2459 BaseAddress is the starting address of Firmware Volume\n\
2460 where Boot Strapped Image will reside.\n");
2461 fprintf (stdout
, " -s FwVolumeSize, --size FwVolumeSize\n\
2462 FwVolumeSize is the size of Firmware Volume.\n");
2463 fprintf (stdout
, " -o FileName, --output FileName\n\
2464 File will be created to store the ouput content.\n");
2465 fprintf (stdout
, " -v, --verbose Turn on verbose output with informational messages.\n");
2466 fprintf (stdout
, " --version Show program's version number and exit.\n");
2467 fprintf (stdout
, " -h, --help Show this help message and exit.\n");
2468 fprintf (stdout
, " -q, --quiet Disable all messages except FATAL ERRORS.\n");
2469 fprintf (stdout
, " -d, --debug [#, 0-9] Enable debug messages at level #.\n");
2479 Routine Description:
2481 This utility uses GenVtf.dll to build a Boot Strap File Image which will be
2482 part of firmware volume image.
2486 argc - The count of the parameters
2487 argv - The parameters
2492 0 - No error conditions detected.
2493 1 - One or more of the input parameters is invalid.
2494 2 - A resource required by the utility was unavailable.
2495 - Most commonly this will be memory allocation or file creation.
2496 3 - GenFvImage.dll could not be loaded.
2497 4 - Error executing the GenFvImage dll.
2498 5 - Now this tool does not support the IA32 platform
2503 UINT64 StartAddress1
;
2504 UINT64 StartAddress2
;
2507 BOOLEAN FirstRoundO
;
2508 BOOLEAN FirstRoundB
;
2509 BOOLEAN FirstRoundS
;
2514 SetUtilityName (UTILITY_NAME
);
2517 // Initialize variables
2527 OutFileName1
= NULL
;
2528 OutFileName2
= NULL
;
2533 // Verify the correct number of arguments
2540 if ((strcmp(argv
[1], "-h") == 0) || (strcmp(argv
[1], "--help") == 0)) {
2545 if ((strcmp(argv
[1], "--version") == 0)) {
2551 // Parse the command line arguments
2553 for (Index
= 1; Index
< argc
; Index
+= 2) {
2554 if ((stricmp (argv
[Index
], "-o") == 0) || (stricmp (argv
[Index
], "--output") == 0)) {
2555 if (argv
[Index
+ 1] == NULL
|| argv
[Index
+ 1][0] == '-') {
2556 Error (NULL
, 0, 1003, "Invalid option value", "Output file is missing for -o option");
2560 // Get the output file name
2565 // It's the first output file name
2567 OutFileName1
= (CHAR8
*)argv
[Index
+1];
2568 FirstRoundO
= FALSE
;
2571 //It's the second output file name
2573 OutFileName2
= (CHAR8
*)argv
[Index
+1];
2578 if ((stricmp (argv
[Index
], "-f") == 0) || (stricmp (argv
[Index
], "--filename") == 0)) {
2579 if (argv
[Index
+ 1] == NULL
|| argv
[Index
+ 1][0] == '-') {
2580 Error (NULL
, 0, 1003, "Invalid option value", "BS Image INF file is missing for -f option");
2584 // Get the input VTF file name
2586 VtfFileName
= argv
[Index
+1];
2587 if (VtfFP
!= NULL
) {
2589 // VTF file name has been given previously, override with the new value
2593 VtfFP
= fopen (LongFilePath (VtfFileName
), "rb");
2594 if (VtfFP
== NULL
) {
2595 Error (NULL
, 0, 0001, "Error opening file", VtfFileName
);
2601 if ((stricmp (argv
[Index
], "-r") == 0) || (stricmp (argv
[Index
], "--baseaddr") == 0)) {
2603 Status
= AsciiStringToUint64 (argv
[Index
+ 1], FALSE
, &StartAddress1
);
2604 FirstRoundB
= FALSE
;
2606 Status
= AsciiStringToUint64 (argv
[Index
+ 1], FALSE
, &StartAddress2
);
2608 if (Status
!= EFI_SUCCESS
) {
2609 Error (NULL
, 0, 2000, "Invalid option value", "%s is Bad FV start address.", argv
[Index
+ 1]);
2615 if ((stricmp (argv
[Index
], "-s") == 0) || (stricmp (argv
[Index
], "--size") == 0)) {
2617 Status
= AsciiStringToUint64 (argv
[Index
+ 1], FALSE
, &FwVolSize1
);
2618 FirstRoundS
= FALSE
;
2620 Status
= AsciiStringToUint64 (argv
[Index
+ 1], FALSE
, &FwVolSize2
);
2624 if (Status
!= EFI_SUCCESS
) {
2625 Error (NULL
, 0, 2000, "Invalid option value", "%s is Bad FV size.", argv
[Index
+ 1]);
2631 if ((stricmp (argv
[Index
], "-v") == 0) || (stricmp (argv
[Index
], "--verbose") == 0)) {
2637 if ((stricmp (argv
[Index
], "-q") == 0) || (stricmp (argv
[Index
], "--quiet") == 0)) {
2643 if ((stricmp (argv
[Index
], "-d") == 0) || (stricmp (argv
[Index
], "--debug") == 0)) {
2645 // debug level specified
2647 Status
= AsciiStringToUint64(argv
[Index
+ 1], FALSE
, &DebugLevel
);
2648 if (EFI_ERROR (Status
)) {
2649 Error (NULL
, 0, 1003, "Invalid option value", "%s = %s", argv
[Index
], argv
[Index
+ 1]);
2652 if (DebugLevel
> 9) {
2653 Error (NULL
, 0, 2000, "Invalid option value", "Unrecognized argument %s.", argv
[Index
+ 1]);
2656 if((DebugLevel
<= 9) &&(DebugLevel
>= 5)) {
2664 Error (NULL
, 0, 2000, "Invalid parameter", "Unrecognized argument %s.", argv
[Index
]);
2668 if (VtfFP
== NULL
) {
2669 Error (NULL
, 0, 2000, "Invalid parameter", "No BS Image INF file is specified");
2674 Error (NULL
, 0, 2000, "Invalid parameter", "No FV base address is specified");
2679 Error (NULL
, 0, 2000, "Invalid parameter", "No FV Size is specified");
2683 // All Parameters has been parsed, now set the message print level
2687 } else if (VerboseMode
) {
2689 } else if (DebugMode
) {
2690 SetPrintLevel(DebugLevel
);
2694 VerboseMsg("%s tool start.\n", UTILITY_NAME
);
2697 if (VTF_OUTPUT
== FALSE
) {
2698 if (SecondVTF
== TRUE
) {
2699 OutFileName1
= VTF_OUTPUT_FILE1
;
2700 OutFileName2
= VTF_OUTPUT_FILE2
;
2702 OutFileName1
= VTF_OUTPUT_FILE1
;
2704 SymFileName
= VTF_SYM_FILE
;
2706 assert (OutFileName1
);
2707 INTN OutFileNameLen
= strlen(OutFileName1
);
2710 for (NewIndex
= OutFileNameLen
; NewIndex
> 0; --NewIndex
) {
2711 if (OutFileName1
[NewIndex
] == '/' || OutFileName1
[NewIndex
] == '\\') {
2715 if (NewIndex
== 0) {
2716 SymFileName
= VTF_SYM_FILE
;
2718 INTN SymFileNameLen
= NewIndex
+ 1 + strlen(VTF_SYM_FILE
);
2719 SymFileName
= malloc(SymFileNameLen
+ 1);
2720 if (SymFileName
== NULL
) {
2721 Error (NULL
, 0, 4001, "Resource", "memory cannot be allocated!");
2724 memcpy(SymFileName
, OutFileName1
, NewIndex
+ 1);
2725 memcpy(SymFileName
+ NewIndex
+ 1, VTF_SYM_FILE
, strlen(VTF_SYM_FILE
));
2726 SymFileName
[SymFileNameLen
] = '\0';
2729 DebugMsg(UTILITY_NAME
, 0, DebugLevel
, SymFileName
, NULL
);
2734 // Call the GenVtfImage
2737 DebugMsg(UTILITY_NAME
, 0, DebugLevel
, "Start to generate the VTF image\n", NULL
);
2739 Status
= GenerateVtfImage (StartAddress1
, FwVolSize1
, StartAddress2
, FwVolSize2
, VtfFP
);
2741 if (EFI_ERROR (Status
)) {
2744 case EFI_INVALID_PARAMETER
:
2745 Error (NULL
, 0, 2000, "Invalid parameter", "Invalid parameter passed to GenVtf function.");
2749 Error (NULL
, 0, 3000, "Invalid", "Error detected while creating the file image.");
2752 case EFI_OUT_OF_RESOURCES
:
2753 Error (NULL
, 0, 4002, "Resource", "GenVtfImage function could not allocate required resources.");
2756 case EFI_VOLUME_CORRUPTED
:
2757 Error (NULL
, 0, 3000, "Invalid", "No base address was specified.");
2761 Error (NULL
, 0, 3000, "Invalid", "GenVtfImage function returned unknown status %x.", (int) Status
);
2766 if (VtfFP
!= NULL
) {
2771 DebugMsg(UTILITY_NAME
, 0, DebugLevel
, "VTF image generated successful\n", NULL
);
2775 VerboseMsg("%s tool done with return code is 0x%x.\n", UTILITY_NAME
, GetUtilityStatus ());
2777 return GetUtilityStatus();