3 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
4 This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 The tool dumps the contents of a firmware volume
29 #include <Common/UefiBaseTypes.h>
30 #include <Common/UefiCapsule.h>
31 #include <Common/PiFirmwareFile.h>
32 #include <Common/PiFirmwareVolume.h>
33 #include <Guid/PiFirmwareFileSystem.h>
34 #include <IndustryStandard/PeImage.h>
35 #include <Protocol/GuidedSectionExtraction.h>
38 #include "Decompress.h"
40 #include "CommonLib.h"
41 #include "EfiUtilityMsgs.h"
42 #include "FirmwareVolumeBufferLib.h"
44 #include "ParseGuidedSectionTools.h"
45 #include "StringFuncs.h"
48 // Utility global variables
51 EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid
= EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID
;
53 #define UTILITY_MAJOR_VERSION 0
54 #define UTILITY_MINOR_VERSION 82
56 #define UTILITY_NAME "VolInfo"
58 #define EFI_SECTION_ERROR EFIERR (100)
60 #define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable
63 // Structure to keep a list of guid-to-basenames
65 typedef struct _GUID_TO_BASENAME
{
66 struct _GUID_TO_BASENAME
*Next
;
67 INT8 Guid
[PRINTED_GUID_BUFFER_SIZE
];
68 INT8 BaseName
[MAX_BASENAME_LEN
];
71 static GUID_TO_BASENAME
*mGuidBaseNameList
= NULL
;
74 // Store GUIDed Section guid->tool mapping
76 EFI_HANDLE mParsedGuidedSectionTools
= NULL
;
78 CHAR8
* mUtilityFilename
= NULL
;
81 ParseGuidBaseNameFile (
86 FreeGuidBaseNameList (
97 IN UINT8
*SectionBuffer
,
98 IN UINT32 BufferLength
104 IN UINT32 SectionLength
112 OUT BOOLEAN
*ErasePolarity
118 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
119 EFI_FFS_FILE_HEADER
*FileHeader
,
120 BOOLEAN ErasePolarity
132 LoadGuidedSectionToolsTxt (
133 IN CHAR8
* FirmwareVolumeFilename
150 GC_TODO: Add function description
154 argc - GC_TODO: add argument description
155 ] - GC_TODO: add argument description
159 GC_TODO: add return values
165 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
;
169 BOOLEAN ErasePolarity
;
171 SetUtilityName (UTILITY_NAME
);
173 // Print utility header
175 printf ("%s Tiano Firmware Volume FFS image info. Version %d.%d %s, %s\n",
177 UTILITY_MAJOR_VERSION
,
178 UTILITY_MINOR_VERSION
,
184 // Save, and then skip filename arg
186 mUtilityFilename
= argv
[0];
193 // If they specified -x xref guid/basename cross-reference files, process it.
194 // This will print the basename beside each file guid. To use it, specify
195 // -x xref_filename to processdsc, then use xref_filename as a parameter
199 if ((strcmp(argv
[0], "-x") == 0) || (strcmp(argv
[0], "--xref") == 0)) {
200 ParseGuidBaseNameFile (argv
[1]);
201 printf("ParseGuidBaseNameFile: %s\n", argv
[1]);
204 } else if (strcmp(argv
[0], "--offset") == 0) {
208 if ((argv
[1][0] == '0') && (tolower ((int)argv
[1][1]) == 'x')) {
209 if (sscanf (argv
[1], "%x", &Offset
) != 1) {
210 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
211 return GetUtilityStatus ();
214 if (sscanf (argv
[1], "%d", &Offset
) != 1) {
215 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
216 return GetUtilityStatus ();
219 // See if they said something like "64K"
221 if (tolower ((int)argv
[1][strlen (argv
[1]) - 1]) == 'k') {
234 // Check for proper number of arguments
241 // Look for help options
243 if ((strcmp(argv
[0], "-h") == 0) || (strcmp(argv
[0], "--help") == 0) ||
244 (strcmp(argv
[0], "-?") == 0) || (strcmp(argv
[0], "/?") == 0)) {
250 // Open the file containing the FV
252 InputFile
= fopen (argv
[0], "rb");
253 if (InputFile
== NULL
) {
254 Error (NULL
, 0, 0001, "Error opening the input file", argv
[0]);
255 return GetUtilityStatus ();
258 // Skip over pad bytes if specified. This is used if they prepend 0xff
259 // data to the FV image binary.
262 fseek (InputFile
, Offset
, SEEK_SET
);
265 // Determine size of FV
267 Status
= ReadHeader (InputFile
, &FvSize
, &ErasePolarity
);
268 if (EFI_ERROR (Status
)) {
269 Error (NULL
, 0, 0003, "error parsing FV image", "%s Header is invalid", argv
[0]);
271 return GetUtilityStatus ();
274 // Allocate a buffer for the FV image
276 FvImage
= malloc (FvSize
);
277 if (FvImage
== NULL
) {
278 Error (NULL
, 0, 4001, "Resource: Memory can't be allocated", NULL
);
280 return GetUtilityStatus ();
283 // Seek to the start of the image, then read the entire FV to the buffer
285 fseek (InputFile
, Offset
, SEEK_SET
);
286 BytesRead
= fread (FvImage
, 1, FvSize
, InputFile
);
288 if ((unsigned int) BytesRead
!= FvSize
) {
289 Error (NULL
, 0, 0004, "error reading FvImage from", argv
[0]);
291 return GetUtilityStatus ();
294 LoadGuidedSectionToolsTxt (argv
[0]);
296 PrintFvInfo (FvImage
, FALSE
);
302 FreeGuidBaseNameList ();
303 return GetUtilityStatus ();
317 GC_TODO: Add function description
321 Fv - Firmware Volume to print information about
322 IsChildFv - Flag specifies whether the input FV is a child FV.
332 BOOLEAN ErasePolarity
;
334 EFI_FFS_FILE_HEADER
*CurrentFile
;
337 Status
= FvBufGetSize (Fv
, &FvSize
);
341 (((EFI_FIRMWARE_VOLUME_HEADER
*)Fv
)->Attributes
& EFI_FVB2_ERASE_POLARITY
) ?
345 // Get the first file
348 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
349 if (EFI_ERROR (Status
)) {
350 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
351 return GetUtilityStatus ();
354 // Display information about files found
356 while (CurrentFile
!= NULL
) {
358 // Increment the number of files counter
363 // Display info about this file
365 Status
= PrintFileInfo (Fv
, CurrentFile
, ErasePolarity
);
366 if (EFI_ERROR (Status
)) {
367 Error (NULL
, 0, 0003, "error parsing FV image", "failed to parse a file in the FV");
368 return GetUtilityStatus ();
373 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
374 if (Status
== EFI_NOT_FOUND
) {
376 } else if (EFI_ERROR (Status
)) {
377 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image");
378 return GetUtilityStatus ();
383 printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles
);
385 printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles
);
393 IN UINT32 ActualSize
,
400 This function returns the next larger size that meets the alignment
401 requirement specified.
406 Alignment The desired alignment.
410 EFI_SUCCESS Function completed successfully.
411 EFI_ABORTED The function encountered an error.
417 OccupiedSize
= ActualSize
;
418 while ((OccupiedSize
& (Alignment
- 1)) != 0) {
428 IN EFI_SECTION_TYPE Type
434 Converts EFI Section names to Strings
438 Type - The EFI Section type
442 CHAR8* - Pointer to the String containing the section name.
447 CHAR8
*SectionTypeStringTable
[] = {
455 "EFI_SECTION_COMPRESSION",
459 "EFI_SECTION_GUID_DEFINED",
463 "Unknown section type - Reserved 0x03",
467 "Unknown section type - Reserved 0x04",
471 "Unknown section type - Reserved 0x05",
475 "Unknown section type - Reserved 0x06",
479 "Unknown section type - Reserved 0x07",
483 "Unknown section type - Reserved 0x08",
487 "Unknown section type - Reserved 0x09",
491 "Unknown section type - Reserved 0x0A",
495 "Unknown section type - Reserved 0x0B",
499 "Unknown section type - Reserved 0x0C",
503 "Unknown section type - Reserved 0x0D",
507 "Unknown section type - Reserved 0x0E",
511 "Unknown section type - Reserved 0x0E",
527 "EFI_SECTION_DXE_DEPEX",
531 "EFI_SECTION_VERSION",
535 "EFI_SECTION_USER_INTERFACE",
539 "EFI_SECTION_COMPATIBILITY16",
543 "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
547 "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
555 "Unknown section type - 0x1A",
559 "EFI_SECTION_PEI_DEPEX",
563 "EFI_SECTION_SMM_DEPEX",
567 "Unknown section type - Reserved - beyond last defined section"
570 if (Type
> EFI_SECTION_LAST_SECTION_TYPE
) {
571 Type
= EFI_SECTION_LAST_SECTION_TYPE
+ 1;
574 SectionStr
= malloc (100);
575 if (SectionStr
== NULL
) {
576 printf ("Error: Out of memory resources.\n");
579 strcpy (SectionStr
, SectionTypeStringTable
[Type
]);
588 OUT BOOLEAN
*ErasePolarity
594 This function determines the size of the FV and the erase polarity. The
595 erase polarity is the FALSE value for file state.
599 InputFile The file that contains the FV image.
600 FvSize The size of the FV.
601 ErasePolarity The FV erase polarity.
605 EFI_SUCCESS Function completed successfully.
606 EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
607 EFI_ABORTED The function encountered an error.
611 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader
;
612 EFI_FV_BLOCK_MAP_ENTRY BlockMap
;
620 // Check input parameters
622 if (InputFile
== NULL
|| FvSize
== NULL
|| ErasePolarity
== NULL
) {
623 Error (__FILE__
, __LINE__
, 0, "application error", "invalid parameter to function");
624 return EFI_INVALID_PARAMETER
;
629 fread (&VolumeHeader
, sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
630 BytesRead
= sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
631 Signature
[0] = VolumeHeader
.Signature
;
635 // Print FV header information
637 printf ("Signature: %s (%X)\n", (char *) Signature
, (unsigned) VolumeHeader
.Signature
);
638 printf ("Attributes: %X\n", (unsigned) VolumeHeader
.Attributes
);
640 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_DISABLED_CAP
) {
641 printf (" EFI_FVB2_READ_DISABLED_CAP\n");
644 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_ENABLED_CAP
) {
645 printf (" EFI_FVB2_READ_ENABLED_CAP\n");
648 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_STATUS
) {
649 printf (" EFI_FVB2_READ_STATUS\n");
652 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_DISABLED_CAP
) {
653 printf (" EFI_FVB2_WRITE_DISABLED_CAP\n");
656 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_ENABLED_CAP
) {
657 printf (" EFI_FVB2_WRITE_ENABLED_CAP\n");
660 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_STATUS
) {
661 printf (" EFI_FVB2_WRITE_STATUS\n");
664 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_CAP
) {
665 printf (" EFI_FVB2_LOCK_CAP\n");
668 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_STATUS
) {
669 printf (" EFI_FVB2_LOCK_STATUS\n");
672 if (VolumeHeader
.Attributes
& EFI_FVB2_STICKY_WRITE
) {
673 printf (" EFI_FVB2_STICKY_WRITE\n");
676 if (VolumeHeader
.Attributes
& EFI_FVB2_MEMORY_MAPPED
) {
677 printf (" EFI_FVB2_MEMORY_MAPPED\n");
680 if (VolumeHeader
.Attributes
& EFI_FVB2_ERASE_POLARITY
) {
681 printf (" EFI_FVB2_ERASE_POLARITY\n");
682 *ErasePolarity
= TRUE
;
685 #if (PI_SPECIFICATION_VERSION < 0x00010000)
686 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT
) {
687 printf (" EFI_FVB2_ALIGNMENT\n");
690 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
691 printf (" EFI_FVB2_ALIGNMENT_2\n");
694 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
695 printf (" EFI_FVB2_ALIGNMENT_4\n");
698 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
699 printf (" EFI_FVB2_ALIGNMENT_8\n");
702 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
703 printf (" EFI_FVB2_ALIGNMENT_16\n");
706 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
707 printf (" EFI_FVB2_ALIGNMENT_32\n");
710 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
711 printf (" EFI_FVB2_ALIGNMENT_64\n");
714 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
715 printf (" EFI_FVB2_ALIGNMENT_128\n");
718 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
719 printf (" EFI_FVB2_ALIGNMENT_256\n");
722 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
723 printf (" EFI_FVB2_ALIGNMENT_512\n");
726 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
727 printf (" EFI_FVB2_ALIGNMENT_1K\n");
730 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
731 printf (" EFI_FVB2_ALIGNMENT_2K\n");
734 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
735 printf (" EFI_FVB2_ALIGNMENT_4K\n");
738 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
739 printf (" EFI_FVB2_ALIGNMENT_8K\n");
742 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
743 printf (" EFI_FVB2_ALIGNMENT_16K\n");
746 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
747 printf (" EFI_FVB2_ALIGNMENT_32K\n");
750 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
751 printf (" EFI_FVB2_ALIGNMENT_64K\n");
756 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_CAP
) {
757 printf (" EFI_FVB2_READ_LOCK_CAP\n");
760 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_STATUS
) {
761 printf (" EFI_FVB2_READ_LOCK_STATUS\n");
764 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_CAP
) {
765 printf (" EFI_FVB2_WRITE_LOCK_CAP\n");
768 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_STATUS
) {
769 printf (" EFI_FVB2_WRITE_LOCK_STATUS\n");
772 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1
) {
773 printf (" EFI_FVB2_ALIGNMENT_1\n");
776 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
777 printf (" EFI_FVB2_ALIGNMENT_2\n");
780 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
781 printf (" EFI_FVB2_ALIGNMENT_4\n");
784 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
785 printf (" EFI_FVB2_ALIGNMENT_8\n");
788 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
789 printf (" EFI_FVB2_ALIGNMENT_16\n");
792 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
793 printf (" EFI_FVB2_ALIGNMENT_32\n");
796 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
797 printf (" EFI_FVB2_ALIGNMENT_64\n");
800 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
801 printf (" EFI_FVB2_ALIGNMENT_128\n");
804 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
805 printf (" EFI_FVB2_ALIGNMENT_256\n");
808 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
809 printf (" EFI_FVB2_ALIGNMENT_512\n");
812 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
813 printf (" EFI_FVB2_ALIGNMENT_1K\n");
816 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
817 printf (" EFI_FVB2_ALIGNMENT_2K\n");
820 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
821 printf (" EFI_FVB2_ALIGNMENT_4K\n");
824 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
825 printf (" EFI_FVB2_ALIGNMENT_8K\n");
828 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
829 printf (" EFI_FVB2_ALIGNMENT_16K\n");
832 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
833 printf (" EFI_FVB2_ALIGNMENT_32K\n");
836 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
837 printf (" EFI_FVB2_ALIGNMENT_64K\n");
840 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128K
) {
841 printf (" EFI_FVB2_ALIGNMENT_128K\n");
844 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256K
) {
845 printf (" EFI_FVB2_ALIGNMENT_256K\n");
848 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512K
) {
849 printf (" EFI_FVB2_ALIGNMENT_512K\n");
852 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1M
) {
853 printf (" EFI_FVB2_ALIGNMENT_1M\n");
856 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2M
) {
857 printf (" EFI_FVB2_ALIGNMENT_2M\n");
860 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4M
) {
861 printf (" EFI_FVB2_ALIGNMENT_4M\n");
864 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8M
) {
865 printf (" EFI_FVB2_ALIGNMENT_8M\n");
868 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16M
) {
869 printf (" EFI_FVB2_ALIGNMENT_16M\n");
872 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32M
) {
873 printf (" EFI_FVB2_ALIGNMENT_32M\n");
876 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
877 printf (" EFI_FVB2_ALIGNMENT_64M\n");
880 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
881 printf (" EFI_FVB2_ALIGNMENT_128M\n");
884 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
885 printf (" EFI_FVB2_ALIGNMENT_64M\n");
888 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
889 printf (" EFI_FVB2_ALIGNMENT_128M\n");
892 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256M
) {
893 printf (" EFI_FVB2_ALIGNMENT_256M\n");
896 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512M
) {
897 printf (" EFI_FVB2_ALIGNMENT_512M\n");
900 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1G
) {
901 printf (" EFI_FVB2_ALIGNMENT_1G\n");
904 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2G
) {
905 printf (" EFI_FVB2_ALIGNMENT_2G\n");
909 printf ("Header Length: 0x%08X\n", VolumeHeader
.HeaderLength
);
910 printf ("File System ID: ");
911 PrintGuid (&VolumeHeader
.FileSystemGuid
);
915 printf ("Revision: 0x%04X\n", VolumeHeader
.Revision
);
918 fread (&BlockMap
, sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
919 BytesRead
+= sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
921 if (BlockMap
.NumBlocks
!= 0) {
922 printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap
.NumBlocks
);
923 printf ("Block Length: 0x%08X\n", (unsigned) BlockMap
.Length
);
924 Size
+= BlockMap
.NumBlocks
* BlockMap
.Length
;
927 } while (!(BlockMap
.NumBlocks
== 0 && BlockMap
.Length
== 0));
929 if (BytesRead
!= VolumeHeader
.HeaderLength
) {
930 printf ("ERROR: Header length not consistent with Block Maps!\n");
934 if (VolumeHeader
.FvLength
!= Size
) {
935 printf ("ERROR: Volume Size not consistant with Block Maps!\n");
939 printf ("Total Volume Size: 0x%08X\n", (unsigned) Size
);
944 // rewind (InputFile);
952 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
953 EFI_FFS_FILE_HEADER
*FileHeader
,
954 BOOLEAN ErasePolarity
960 GC_TODO: Add function description
964 FvImage - GC_TODO: add argument description
965 FileHeader - GC_TODO: add argument description
966 ErasePolarity - GC_TODO: add argument description
970 EFI_SUCCESS - GC_TODO: Add description for return value
971 EFI_ABORTED - GC_TODO: Add description for return value
978 EFI_FFS_FILE_HEADER2 BlankHeader
;
980 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
982 #if (PI_SPECIFICATION_VERSION < 0x00010000)
986 // Check if we have free space
988 HeaderSize
= FvBufGetFfsHeaderSize(FileHeader
);
990 memset (&BlankHeader
, -1, HeaderSize
);
992 memset (&BlankHeader
, 0, HeaderSize
);
995 if (memcmp (&BlankHeader
, FileHeader
, HeaderSize
) == 0) {
999 // Print file information.
1001 printf ("============================================================\n");
1003 printf ("File Name: ");
1004 PrintGuidToBuffer (&FileHeader
->Name
, GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
1005 printf ("%s ", GuidBuffer
);
1006 PrintGuidName (GuidBuffer
);
1010 // PrintGuid (&FileHeader->Name);
1013 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1014 printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN
) FileHeader
- (UINTN
) FvImage
));
1015 printf ("File Length: 0x%08X\n", (unsigned) FileLength
);
1016 printf ("File Attributes: 0x%02X\n", FileHeader
->Attributes
);
1017 printf ("File State: 0x%02X\n", FileHeader
->State
);
1022 FileState
= GetFileState (ErasePolarity
, FileHeader
);
1024 switch (FileState
) {
1026 case EFI_FILE_HEADER_CONSTRUCTION
:
1027 printf (" EFI_FILE_HEADER_CONSTRUCTION\n");
1030 case EFI_FILE_HEADER_INVALID
:
1031 printf (" EFI_FILE_HEADER_INVALID\n");
1034 case EFI_FILE_HEADER_VALID
:
1035 printf (" EFI_FILE_HEADER_VALID\n");
1036 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1037 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1038 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1039 if (Checksum
!= 0) {
1040 printf ("ERROR: Header checksum invalid.\n");
1046 case EFI_FILE_DELETED
:
1047 printf (" EFI_FILE_DELETED\n");
1049 case EFI_FILE_MARKED_FOR_UPDATE
:
1050 printf (" EFI_FILE_MARKED_FOR_UPDATE\n");
1052 case EFI_FILE_DATA_VALID
:
1053 printf (" EFI_FILE_DATA_VALID\n");
1056 // Calculate header checksum
1058 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1059 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1060 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1061 if (Checksum
!= 0) {
1062 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer
);
1066 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1068 if (FileHeader
->Attributes
& FFS_ATTRIB_CHECKSUM
) {
1070 // Calculate file checksum
1072 Checksum
= CalculateSum8 ((UINT8
*)FileHeader
+ HeaderSize
, FileLength
- HeaderSize
);
1073 Checksum
= Checksum
+ FileHeader
->IntegrityCheck
.Checksum
.File
;
1074 if (Checksum
!= 0) {
1075 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer
);
1079 if (FileHeader
->IntegrityCheck
.Checksum
.File
!= FFS_FIXED_CHECKSUM
) {
1080 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum -- not set to fixed value of 0xAA", GuidBuffer
);
1084 #if (PI_SPECIFICATION_VERSION < 0x00010000)
1086 // Verify tail if present
1088 if (FileHeader
->Attributes
& FFS_ATTRIB_TAIL_PRESENT
) {
1090 // Verify tail is complement of integrity check field in the header.
1092 Tail
= (UINT16
*) ((UINTN
) FileHeader
+ GetLength (FileHeader
->Size
) - sizeof (EFI_FFS_INTEGRITY_CHECK
));
1093 if (FileHeader
->IntegrityCheck
.TailReference
!= (UINT16
)~(*Tail
)) {
1094 Error (NULL
, 0, 0003, "error parsing FFS file", \
1095 "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer
);
1103 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer
);
1107 printf ("File Type: 0x%02X ", FileHeader
->Type
);
1109 switch (FileHeader
->Type
) {
1111 case EFI_FV_FILETYPE_RAW
:
1112 printf ("EFI_FV_FILETYPE_RAW\n");
1115 case EFI_FV_FILETYPE_FREEFORM
:
1116 printf ("EFI_FV_FILETYPE_FREEFORM\n");
1119 case EFI_FV_FILETYPE_SECURITY_CORE
:
1120 printf ("EFI_FV_FILETYPE_SECURITY_CORE\n");
1123 case EFI_FV_FILETYPE_PEI_CORE
:
1124 printf ("EFI_FV_FILETYPE_PEI_CORE\n");
1127 case EFI_FV_FILETYPE_DXE_CORE
:
1128 printf ("EFI_FV_FILETYPE_DXE_CORE\n");
1131 case EFI_FV_FILETYPE_PEIM
:
1132 printf ("EFI_FV_FILETYPE_PEIM\n");
1135 case EFI_FV_FILETYPE_DRIVER
:
1136 printf ("EFI_FV_FILETYPE_DRIVER\n");
1139 case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
:
1140 printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n");
1143 case EFI_FV_FILETYPE_APPLICATION
:
1144 printf ("EFI_FV_FILETYPE_APPLICATION\n");
1147 case EFI_FV_FILETYPE_SMM
:
1148 printf ("EFI_FV_FILETYPE_SMM\n");
1151 case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
:
1152 printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n");
1155 case EFI_FV_FILETYPE_COMBINED_SMM_DXE
:
1156 printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
1159 case EFI_FV_FILETYPE_SMM_CORE
:
1160 printf ("EFI_FV_FILETYPE_SMM_CORE\n");
1163 case EFI_FV_FILETYPE_FFS_PAD
:
1164 printf ("EFI_FV_FILETYPE_FFS_PAD\n");
1168 printf ("\nERROR: Unrecognized file type %X.\n", FileHeader
->Type
);
1173 switch (FileHeader
->Type
) {
1175 case EFI_FV_FILETYPE_ALL
:
1176 case EFI_FV_FILETYPE_RAW
:
1177 case EFI_FV_FILETYPE_FFS_PAD
:
1182 // All other files have sections
1184 Status
= ParseSection (
1185 (UINT8
*) ((UINTN
) FileHeader
+ HeaderSize
),
1186 FvBufGetFfsFileSize (FileHeader
) - HeaderSize
1188 if (EFI_ERROR (Status
)) {
1190 // printf ("ERROR: Parsing the FFS file.\n");
1202 IN UINT8
*SectionBuffer
,
1203 IN UINT32 BufferLength
1207 Routine Description:
1213 SectionBuffer - Buffer containing the section to parse.
1214 BufferLength - Length of SectionBuffer
1218 EFI_SECTION_ERROR - Problem with section parsing.
1219 (a) compression errors
1220 (b) unrecognized section
1221 EFI_UNSUPPORTED - Do not know how to parse the section.
1222 EFI_SUCCESS - Section successfully parsed.
1223 EFI_OUT_OF_RESOURCES - Memory allocation failed.
1227 EFI_SECTION_TYPE Type
;
1229 UINT32 SectionLength
;
1230 UINT32 SectionHeaderLen
;
1233 UINT32 ParsedLength
;
1234 UINT8
*CompressedBuffer
;
1235 UINT32 CompressedLength
;
1236 UINT8
*UncompressedBuffer
;
1237 UINT32 UncompressedLength
;
1238 UINT8
*ToolOutputBuffer
;
1239 UINT32 ToolOutputLength
;
1240 UINT8 CompressionType
;
1243 UINT8
*ScratchBuffer
;
1244 DECOMPRESS_FUNCTION DecompressFunction
;
1245 GETINFO_FUNCTION GetInfoFunction
;
1247 CHAR8
*ExtractionTool
;
1248 CHAR8
*ToolInputFile
;
1249 CHAR8
*ToolOutputFile
;
1250 CHAR8
*SystemCommandFormatString
;
1251 CHAR8
*SystemCommand
;
1258 while (ParsedLength
< BufferLength
) {
1259 Ptr
= SectionBuffer
+ ParsedLength
;
1261 SectionLength
= GetLength (((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Size
);
1262 Type
= ((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Type
;
1265 // This is sort of an odd check, but is necessary because FFS files are
1266 // padded to a QWORD boundary, meaning there is potentially a whole section
1267 // header worth of 0xFF bytes.
1269 if (SectionLength
== 0xffffff && Type
== 0xff) {
1275 // Get real section file size
1277 SectionLength
= GetSectionFileLength ((EFI_COMMON_SECTION_HEADER
*) Ptr
);
1278 SectionHeaderLen
= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1280 SectionName
= SectionNameToStr (Type
);
1281 printf ("------------------------------------------------------------\n");
1282 printf (" Type: %s\n Size: 0x%08X\n", SectionName
, (unsigned) SectionLength
);
1286 case EFI_SECTION_RAW
:
1287 case EFI_SECTION_PE32
:
1288 case EFI_SECTION_PIC
:
1289 case EFI_SECTION_TE
:
1290 // default is no more information
1293 case EFI_SECTION_USER_INTERFACE
:
1294 // name = &((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString;
1295 // printf (" String: %s\n", &name);
1298 case EFI_SECTION_FIRMWARE_VOLUME_IMAGE
:
1299 Status
= PrintFvInfo (Ptr
+ SectionHeaderLen
, TRUE
);
1300 if (EFI_ERROR (Status
)) {
1301 Error (NULL
, 0, 0003, "printing of FV section contents failed", NULL
);
1302 return EFI_SECTION_ERROR
;
1306 case EFI_SECTION_COMPATIBILITY16
:
1307 case EFI_SECTION_FREEFORM_SUBTYPE_GUID
:
1309 // Section does not contain any further header information.
1313 case EFI_SECTION_PEI_DEPEX
:
1314 case EFI_SECTION_DXE_DEPEX
:
1315 case EFI_SECTION_SMM_DEPEX
:
1316 DumpDepexSection (Ptr
, SectionLength
);
1319 case EFI_SECTION_VERSION
:
1320 printf (" Build Number: 0x%02X\n", *(UINT16
*)(Ptr
+ SectionHeaderLen
));
1321 printf (" Version Strg: %s\n", (char*) (Ptr
+ SectionHeaderLen
+ sizeof (UINT16
)));
1324 case EFI_SECTION_COMPRESSION
:
1325 UncompressedBuffer
= NULL
;
1326 if (SectionHeaderLen
== sizeof (EFI_COMMON_SECTION_HEADER
)) {
1327 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION
);
1328 UncompressedLength
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->UncompressedLength
;
1329 CompressionType
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->CompressionType
;
1331 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION2
);
1332 UncompressedLength
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->UncompressedLength
;
1333 CompressionType
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->CompressionType
;
1335 CompressedLength
= SectionLength
- RealHdrLen
;
1336 printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength
);
1338 if (CompressionType
== EFI_NOT_COMPRESSED
) {
1339 printf (" Compression Type: EFI_NOT_COMPRESSED\n");
1340 if (CompressedLength
!= UncompressedLength
) {
1345 "file is not compressed, but the compressed length does not match the uncompressed length",
1348 return EFI_SECTION_ERROR
;
1351 UncompressedBuffer
= Ptr
+ RealHdrLen
;
1352 } else if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1353 GetInfoFunction
= EfiGetInfo
;
1354 DecompressFunction
= EfiDecompress
;
1355 printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
1357 CompressedBuffer
= Ptr
+ RealHdrLen
;
1359 Status
= GetInfoFunction (CompressedBuffer
, CompressedLength
, &DstSize
, &ScratchSize
);
1360 if (EFI_ERROR (Status
)) {
1361 Error (NULL
, 0, 0003, "error getting compression info from compression section", NULL
);
1362 return EFI_SECTION_ERROR
;
1365 if (DstSize
!= UncompressedLength
) {
1366 Error (NULL
, 0, 0003, "compression error in the compression section", NULL
);
1367 return EFI_SECTION_ERROR
;
1370 ScratchBuffer
= malloc (ScratchSize
);
1371 UncompressedBuffer
= malloc (UncompressedLength
);
1372 if ((ScratchBuffer
== NULL
) || (UncompressedBuffer
== NULL
)) {
1373 return EFI_OUT_OF_RESOURCES
;
1375 Status
= DecompressFunction (
1383 free (ScratchBuffer
);
1384 if (EFI_ERROR (Status
)) {
1385 Error (NULL
, 0, 0003, "decompress failed", NULL
);
1386 free (UncompressedBuffer
);
1387 return EFI_SECTION_ERROR
;
1390 Error (NULL
, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType
);
1391 return EFI_SECTION_ERROR
;
1394 Status
= ParseSection (UncompressedBuffer
, UncompressedLength
);
1396 if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1398 // We need to deallocate Buffer
1400 free (UncompressedBuffer
);
1403 if (EFI_ERROR (Status
)) {
1404 Error (NULL
, 0, 0003, "failed to parse section", NULL
);
1405 return EFI_SECTION_ERROR
;
1409 case EFI_SECTION_GUID_DEFINED
:
1410 if (SectionHeaderLen
== sizeof(EFI_COMMON_SECTION_HEADER
)) {
1411 EfiGuid
= &((EFI_GUID_DEFINED_SECTION
*) Ptr
)->SectionDefinitionGuid
;
1412 DataOffset
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->DataOffset
;
1413 Attributes
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->Attributes
;
1415 EfiGuid
= &((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->SectionDefinitionGuid
;
1416 DataOffset
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->DataOffset
;
1417 Attributes
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->Attributes
;
1419 printf (" SectionDefinitionGuid: ");
1420 PrintGuid (EfiGuid
);
1422 printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset
);
1423 printf (" Attributes: 0x%04X\n", (unsigned) Attributes
);
1426 LookupGuidedSectionToolPath (
1427 mParsedGuidedSectionTools
,
1431 if (ExtractionTool
!= NULL
) {
1433 ToolInputFile
= CloneString (tmpnam (NULL
));
1434 ToolOutputFile
= CloneString (tmpnam (NULL
));
1437 // Construction 'system' command string
1439 SystemCommandFormatString
= "%s -d -o %s %s";
1440 SystemCommand
= malloc (
1441 strlen (SystemCommandFormatString
) +
1442 strlen (ExtractionTool
) +
1443 strlen (ToolInputFile
) +
1444 strlen (ToolOutputFile
) +
1449 SystemCommandFormatString
,
1454 free (ExtractionTool
);
1459 (CHAR8
*) SectionBuffer
+ DataOffset
,
1460 BufferLength
- DataOffset
1463 system (SystemCommand
);
1464 remove (ToolInputFile
);
1465 free (ToolInputFile
);
1470 (CHAR8
**)&ToolOutputBuffer
,
1473 remove (ToolOutputFile
);
1474 free (ToolOutputFile
);
1475 if (EFI_ERROR (Status
)) {
1476 Error (NULL
, 0, 0004, "unable to read decoded GUIDED section", NULL
);
1477 return EFI_SECTION_ERROR
;
1480 Status
= ParseSection (
1484 if (EFI_ERROR (Status
)) {
1485 Error (NULL
, 0, 0003, "parse of decoded GUIDED section failed", NULL
);
1486 return EFI_SECTION_ERROR
;
1490 // Check for CRC32 sections which we can handle internally if needed.
1492 } else if (!CompareGuid (
1494 &gEfiCrc32GuidedSectionExtractionProtocolGuid
1498 // CRC32 guided section
1500 Status
= ParseSection (
1501 SectionBuffer
+ DataOffset
,
1502 BufferLength
- DataOffset
1504 if (EFI_ERROR (Status
)) {
1505 Error (NULL
, 0, 0003, "parse of CRC32 GUIDED section failed", NULL
);
1506 return EFI_SECTION_ERROR
;
1510 // We don't know how to parse it now.
1512 Error (NULL
, 0, 0003, "Error parsing section", \
1513 "EFI_SECTION_GUID_DEFINED cannot be parsed at this time. Tool to decode this section should have been defined in GuidedSectionTools.txt (built in the FV directory).");
1514 return EFI_UNSUPPORTED
;
1520 // Unknown section, return error
1522 Error (NULL
, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type
);
1523 return EFI_SECTION_ERROR
;
1526 ParsedLength
+= SectionLength
;
1528 // We make then next section begin on a 4-byte boundary
1530 ParsedLength
= GetOccupiedSize (ParsedLength
, 4);
1533 if (ParsedLength
< BufferLength
) {
1534 Error (NULL
, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL
);
1535 return EFI_SECTION_ERROR
;
1544 IN UINT32 SectionLength
1548 Routine Description:
1550 GC_TODO: Add function description
1554 Ptr - GC_TODO: add argument description
1555 SectionLength - GC_TODO: add argument description
1559 EFI_SUCCESS - GC_TODO: Add description for return value
1563 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
1566 // Need at least a section header + data
1568 if (SectionLength
<= sizeof (EFI_COMMON_SECTION_HEADER
)) {
1572 Ptr
+= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1573 SectionLength
-= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1574 while (SectionLength
> 0) {
1577 case EFI_DEP_BEFORE
:
1578 printf ("BEFORE\n");
1591 PrintGuidToBuffer ((EFI_GUID
*) (Ptr
+ 1), GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
1592 printf ("%s ", GuidBuffer
);
1593 PrintGuidName (GuidBuffer
);
1596 // PrintGuid ((EFI_GUID *)(Ptr + 1));
1599 SectionLength
-= 17;
1633 printf ("END DEPEX\n");
1645 printf ("Unrecognized byte in depex: 0x%X\n", *Ptr
);
1659 Routine Description:
1661 GC_TODO: Add function description
1665 GuidStr - GC_TODO: add argument description
1669 EFI_SUCCESS - GC_TODO: Add description for return value
1670 EFI_INVALID_PARAMETER - GC_TODO: Add description for return value
1674 GUID_TO_BASENAME
*GPtr
;
1676 // If we have a list of guid-to-basenames, then go through the list to
1677 // look for a guid string match. If found, print the basename to stdout,
1678 // otherwise return a failure.
1680 GPtr
= mGuidBaseNameList
;
1681 while (GPtr
!= NULL
) {
1682 if (_stricmp ((CHAR8
*) GuidStr
, (CHAR8
*) GPtr
->Guid
) == 0) {
1683 printf ("%s", GPtr
->BaseName
);
1690 return EFI_INVALID_PARAMETER
;
1694 ParseGuidBaseNameFile (
1699 Routine Description:
1701 GC_TODO: Add function description
1705 FileName - GC_TODO: add argument description
1709 EFI_DEVICE_ERROR - GC_TODO: Add description for return value
1710 EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value
1711 EFI_SUCCESS - GC_TODO: Add description for return value
1716 CHAR8 Line
[MAX_LINE_LEN
];
1717 GUID_TO_BASENAME
*GPtr
;
1719 if ((Fptr
= fopen (FileName
, "r")) == NULL
) {
1720 printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName
);
1721 return EFI_DEVICE_ERROR
;
1724 while (fgets (Line
, sizeof (Line
), Fptr
) != NULL
) {
1726 // Allocate space for another guid/basename element
1728 GPtr
= malloc (sizeof (GUID_TO_BASENAME
));
1730 return EFI_OUT_OF_RESOURCES
;
1733 memset ((char *) GPtr
, 0, sizeof (GUID_TO_BASENAME
));
1734 if (sscanf (Line
, "%s %s", GPtr
->Guid
, GPtr
->BaseName
) == 2) {
1735 GPtr
->Next
= mGuidBaseNameList
;
1736 mGuidBaseNameList
= GPtr
;
1739 // Some sort of error. Just continue.
1750 FreeGuidBaseNameList (
1755 Routine Description:
1757 GC_TODO: Add function description
1765 EFI_SUCCESS - GC_TODO: Add description for return value
1769 GUID_TO_BASENAME
*Next
;
1771 while (mGuidBaseNameList
!= NULL
) {
1772 Next
= mGuidBaseNameList
->Next
;
1773 free (mGuidBaseNameList
);
1774 mGuidBaseNameList
= Next
;
1783 LoadGuidedSectionToolsTxt (
1784 IN CHAR8
* FirmwareVolumeFilename
1787 CHAR8
* PeerFilename
;
1794 Places
[0] = FirmwareVolumeFilename
;
1795 //Places[1] = mUtilityFilename;
1797 mParsedGuidedSectionTools
= NULL
;
1799 for (Index
= 0; Index
< (sizeof(Places
)/sizeof(Places
[0])); Index
++) {
1800 PeerFilename
= OsPathPeerFilePath (Places
[Index
], "GuidedSectionTools.txt");
1801 //printf("Loading %s...\n", PeerFilename);
1802 if (OsPathExists (PeerFilename
)) {
1803 mParsedGuidedSectionTools
= ParseGuidedSectionToolsFile (PeerFilename
);
1805 free (PeerFilename
);
1806 if (mParsedGuidedSectionTools
!= NULL
) {
1819 Routine Description:
1821 GC_TODO: Add function description
1829 GC_TODO: add return values
1836 fprintf (stdout
, "Usage: %s [options] <input_file>\n\n", UTILITY_NAME
);
1839 // Copyright declaration
1841 fprintf (stdout
, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
1846 fprintf (stdout
, "Options:\n");
1847 fprintf (stdout
, " -x xref, --xref xref\n\
1848 Parse basename to file-guid cross reference file(s).\n");
1849 fprintf (stdout
, " --offset offset\n\
1850 Offset of file to start processing FV at.\n");
1851 fprintf (stdout
, " -h, --help\n\
1852 Show this help message and exit.\n");