2 The tool dumps the contents of a firmware volume
4 Copyright (c) 1999 - 2014, Intel Corporation. All rights reserved.<BR>
5 This program and the accompanying materials
6 are licensed and made available under the terms and conditions of the BSD License
7 which accompanies this distribution. The full text of the license may be found at
8 http://opensource.org/licenses/bsd-license.php
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
22 #include <Common/UefiBaseTypes.h>
23 #include <Common/UefiCapsule.h>
24 #include <Common/PiFirmwareFile.h>
25 #include <Common/PiFirmwareVolume.h>
26 #include <Guid/PiFirmwareFileSystem.h>
27 #include <IndustryStandard/PeImage.h>
28 #include <Protocol/GuidedSectionExtraction.h>
31 #include "Decompress.h"
33 #include "CommonLib.h"
34 #include "EfiUtilityMsgs.h"
35 #include "FirmwareVolumeBufferLib.h"
37 #include "ParseGuidedSectionTools.h"
38 #include "StringFuncs.h"
41 // Utility global variables
44 EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid
= EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID
;
46 #define UTILITY_MAJOR_VERSION 0
47 #define UTILITY_MINOR_VERSION 83
49 #define UTILITY_NAME "VolInfo"
51 #define EFI_SECTION_ERROR EFIERR (100)
53 #define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable
56 // Structure to keep a list of guid-to-basenames
58 typedef struct _GUID_TO_BASENAME
{
59 struct _GUID_TO_BASENAME
*Next
;
60 INT8 Guid
[PRINTED_GUID_BUFFER_SIZE
];
61 INT8 BaseName
[MAX_BASENAME_LEN
];
64 static GUID_TO_BASENAME
*mGuidBaseNameList
= NULL
;
67 // Store GUIDed Section guid->tool mapping
69 EFI_HANDLE mParsedGuidedSectionTools
= NULL
;
71 CHAR8
* mUtilityFilename
= NULL
;
74 ParseGuidBaseNameFile (
79 FreeGuidBaseNameList (
90 IN UINT8
*SectionBuffer
,
91 IN UINT32 BufferLength
97 IN UINT32 SectionLength
105 OUT BOOLEAN
*ErasePolarity
111 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
112 EFI_FFS_FILE_HEADER
*FileHeader
,
113 BOOLEAN ErasePolarity
125 LoadGuidedSectionToolsTxt (
126 IN CHAR8
* FirmwareVolumeFilename
143 GC_TODO: Add function description
147 argc - GC_TODO: add argument description
148 ] - GC_TODO: add argument description
152 GC_TODO: add return values
158 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
;
162 BOOLEAN ErasePolarity
;
164 SetUtilityName (UTILITY_NAME
);
166 // Print utility header
168 printf ("%s Version %d.%d %s, %s\n",
170 UTILITY_MAJOR_VERSION
,
171 UTILITY_MINOR_VERSION
,
177 // Save, and then skip filename arg
179 mUtilityFilename
= argv
[0];
186 // If they specified -x xref guid/basename cross-reference files, process it.
187 // This will print the basename beside each file guid. To use it, specify
188 // -x xref_filename to processdsc, then use xref_filename as a parameter
192 if ((strcmp(argv
[0], "-x") == 0) || (strcmp(argv
[0], "--xref") == 0)) {
193 ParseGuidBaseNameFile (argv
[1]);
194 printf("ParseGuidBaseNameFile: %s\n", argv
[1]);
197 } else if (strcmp(argv
[0], "--offset") == 0) {
201 if ((argv
[1][0] == '0') && (tolower ((int)argv
[1][1]) == 'x')) {
202 if (sscanf (argv
[1], "%x", &Offset
) != 1) {
203 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
204 return GetUtilityStatus ();
207 if (sscanf (argv
[1], "%d", &Offset
) != 1) {
208 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
209 return GetUtilityStatus ();
212 // See if they said something like "64K"
214 if (tolower ((int)argv
[1][strlen (argv
[1]) - 1]) == 'k') {
227 // Check for proper number of arguments
234 // Look for help options
236 if ((strcmp(argv
[0], "-h") == 0) || (strcmp(argv
[0], "--help") == 0) ||
237 (strcmp(argv
[0], "-?") == 0) || (strcmp(argv
[0], "/?") == 0)) {
243 // Open the file containing the FV
245 InputFile
= fopen (LongFilePath (argv
[0]), "rb");
246 if (InputFile
== NULL
) {
247 Error (NULL
, 0, 0001, "Error opening the input file", argv
[0]);
248 return GetUtilityStatus ();
251 // Skip over pad bytes if specified. This is used if they prepend 0xff
252 // data to the FV image binary.
255 fseek (InputFile
, Offset
, SEEK_SET
);
258 // Determine size of FV
260 Status
= ReadHeader (InputFile
, &FvSize
, &ErasePolarity
);
261 if (EFI_ERROR (Status
)) {
262 Error (NULL
, 0, 0003, "error parsing FV image", "%s Header is invalid", argv
[0]);
264 return GetUtilityStatus ();
267 // Allocate a buffer for the FV image
269 FvImage
= malloc (FvSize
);
270 if (FvImage
== NULL
) {
271 Error (NULL
, 0, 4001, "Resource: Memory can't be allocated", NULL
);
273 return GetUtilityStatus ();
276 // Seek to the start of the image, then read the entire FV to the buffer
278 fseek (InputFile
, Offset
, SEEK_SET
);
279 BytesRead
= fread (FvImage
, 1, FvSize
, InputFile
);
281 if ((unsigned int) BytesRead
!= FvSize
) {
282 Error (NULL
, 0, 0004, "error reading FvImage from", argv
[0]);
284 return GetUtilityStatus ();
287 LoadGuidedSectionToolsTxt (argv
[0]);
289 PrintFvInfo (FvImage
, FALSE
);
295 FreeGuidBaseNameList ();
296 return GetUtilityStatus ();
310 GC_TODO: Add function description
314 Fv - Firmware Volume to print information about
315 IsChildFv - Flag specifies whether the input FV is a child FV.
325 BOOLEAN ErasePolarity
;
327 EFI_FFS_FILE_HEADER
*CurrentFile
;
330 Status
= FvBufGetSize (Fv
, &FvSize
);
334 (((EFI_FIRMWARE_VOLUME_HEADER
*)Fv
)->Attributes
& EFI_FVB2_ERASE_POLARITY
) ?
338 // Get the first file
341 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
342 if (EFI_ERROR (Status
)) {
343 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
344 return GetUtilityStatus ();
347 // Display information about files found
349 while (CurrentFile
!= NULL
) {
351 // Increment the number of files counter
356 // Display info about this file
358 Status
= PrintFileInfo (Fv
, CurrentFile
, ErasePolarity
);
359 if (EFI_ERROR (Status
)) {
360 Error (NULL
, 0, 0003, "error parsing FV image", "failed to parse a file in the FV");
361 return GetUtilityStatus ();
366 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
367 if (Status
== EFI_NOT_FOUND
) {
369 } else if (EFI_ERROR (Status
)) {
370 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image");
371 return GetUtilityStatus ();
376 printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles
);
378 printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles
);
386 IN UINT32 ActualSize
,
393 This function returns the next larger size that meets the alignment
394 requirement specified.
399 Alignment The desired alignment.
403 EFI_SUCCESS Function completed successfully.
404 EFI_ABORTED The function encountered an error.
410 OccupiedSize
= ActualSize
;
411 while ((OccupiedSize
& (Alignment
- 1)) != 0) {
421 IN EFI_SECTION_TYPE Type
427 Converts EFI Section names to Strings
431 Type - The EFI Section type
435 CHAR8* - Pointer to the String containing the section name.
440 CHAR8
*SectionTypeStringTable
[] = {
448 "EFI_SECTION_COMPRESSION",
452 "EFI_SECTION_GUID_DEFINED",
456 "Unknown section type - Reserved 0x03",
460 "Unknown section type - Reserved 0x04",
464 "Unknown section type - Reserved 0x05",
468 "Unknown section type - Reserved 0x06",
472 "Unknown section type - Reserved 0x07",
476 "Unknown section type - Reserved 0x08",
480 "Unknown section type - Reserved 0x09",
484 "Unknown section type - Reserved 0x0A",
488 "Unknown section type - Reserved 0x0B",
492 "Unknown section type - Reserved 0x0C",
496 "Unknown section type - Reserved 0x0D",
500 "Unknown section type - Reserved 0x0E",
504 "Unknown section type - Reserved 0x0E",
520 "EFI_SECTION_DXE_DEPEX",
524 "EFI_SECTION_VERSION",
528 "EFI_SECTION_USER_INTERFACE",
532 "EFI_SECTION_COMPATIBILITY16",
536 "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
540 "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
548 "Unknown section type - 0x1A",
552 "EFI_SECTION_PEI_DEPEX",
556 "EFI_SECTION_SMM_DEPEX",
560 "Unknown section type - Reserved - beyond last defined section"
563 if (Type
> EFI_SECTION_LAST_SECTION_TYPE
) {
564 Type
= EFI_SECTION_LAST_SECTION_TYPE
+ 1;
567 SectionStr
= malloc (100);
568 if (SectionStr
== NULL
) {
569 printf ("Error: Out of memory resources.\n");
572 strcpy (SectionStr
, SectionTypeStringTable
[Type
]);
581 OUT BOOLEAN
*ErasePolarity
587 This function determines the size of the FV and the erase polarity. The
588 erase polarity is the FALSE value for file state.
592 InputFile The file that contains the FV image.
593 FvSize The size of the FV.
594 ErasePolarity The FV erase polarity.
598 EFI_SUCCESS Function completed successfully.
599 EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
600 EFI_ABORTED The function encountered an error.
604 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader
;
605 EFI_FV_BLOCK_MAP_ENTRY BlockMap
;
613 // Check input parameters
615 if (InputFile
== NULL
|| FvSize
== NULL
|| ErasePolarity
== NULL
) {
616 Error (__FILE__
, __LINE__
, 0, "application error", "invalid parameter to function");
617 return EFI_INVALID_PARAMETER
;
622 fread (&VolumeHeader
, sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
623 BytesRead
= sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
624 Signature
[0] = VolumeHeader
.Signature
;
628 // Print FV header information
630 printf ("Signature: %s (%X)\n", (char *) Signature
, (unsigned) VolumeHeader
.Signature
);
631 printf ("Attributes: %X\n", (unsigned) VolumeHeader
.Attributes
);
633 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_DISABLED_CAP
) {
634 printf (" EFI_FVB2_READ_DISABLED_CAP\n");
637 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_ENABLED_CAP
) {
638 printf (" EFI_FVB2_READ_ENABLED_CAP\n");
641 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_STATUS
) {
642 printf (" EFI_FVB2_READ_STATUS\n");
645 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_DISABLED_CAP
) {
646 printf (" EFI_FVB2_WRITE_DISABLED_CAP\n");
649 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_ENABLED_CAP
) {
650 printf (" EFI_FVB2_WRITE_ENABLED_CAP\n");
653 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_STATUS
) {
654 printf (" EFI_FVB2_WRITE_STATUS\n");
657 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_CAP
) {
658 printf (" EFI_FVB2_LOCK_CAP\n");
661 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_STATUS
) {
662 printf (" EFI_FVB2_LOCK_STATUS\n");
665 if (VolumeHeader
.Attributes
& EFI_FVB2_STICKY_WRITE
) {
666 printf (" EFI_FVB2_STICKY_WRITE\n");
669 if (VolumeHeader
.Attributes
& EFI_FVB2_MEMORY_MAPPED
) {
670 printf (" EFI_FVB2_MEMORY_MAPPED\n");
673 if (VolumeHeader
.Attributes
& EFI_FVB2_ERASE_POLARITY
) {
674 printf (" EFI_FVB2_ERASE_POLARITY\n");
675 *ErasePolarity
= TRUE
;
678 #if (PI_SPECIFICATION_VERSION < 0x00010000)
679 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT
) {
680 printf (" EFI_FVB2_ALIGNMENT\n");
683 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
684 printf (" EFI_FVB2_ALIGNMENT_2\n");
687 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
688 printf (" EFI_FVB2_ALIGNMENT_4\n");
691 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
692 printf (" EFI_FVB2_ALIGNMENT_8\n");
695 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
696 printf (" EFI_FVB2_ALIGNMENT_16\n");
699 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
700 printf (" EFI_FVB2_ALIGNMENT_32\n");
703 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
704 printf (" EFI_FVB2_ALIGNMENT_64\n");
707 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
708 printf (" EFI_FVB2_ALIGNMENT_128\n");
711 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
712 printf (" EFI_FVB2_ALIGNMENT_256\n");
715 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
716 printf (" EFI_FVB2_ALIGNMENT_512\n");
719 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
720 printf (" EFI_FVB2_ALIGNMENT_1K\n");
723 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
724 printf (" EFI_FVB2_ALIGNMENT_2K\n");
727 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
728 printf (" EFI_FVB2_ALIGNMENT_4K\n");
731 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
732 printf (" EFI_FVB2_ALIGNMENT_8K\n");
735 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
736 printf (" EFI_FVB2_ALIGNMENT_16K\n");
739 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
740 printf (" EFI_FVB2_ALIGNMENT_32K\n");
743 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
744 printf (" EFI_FVB2_ALIGNMENT_64K\n");
749 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_CAP
) {
750 printf (" EFI_FVB2_READ_LOCK_CAP\n");
753 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_STATUS
) {
754 printf (" EFI_FVB2_READ_LOCK_STATUS\n");
757 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_CAP
) {
758 printf (" EFI_FVB2_WRITE_LOCK_CAP\n");
761 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_STATUS
) {
762 printf (" EFI_FVB2_WRITE_LOCK_STATUS\n");
765 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1
) {
766 printf (" EFI_FVB2_ALIGNMENT_1\n");
769 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
770 printf (" EFI_FVB2_ALIGNMENT_2\n");
773 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
774 printf (" EFI_FVB2_ALIGNMENT_4\n");
777 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
778 printf (" EFI_FVB2_ALIGNMENT_8\n");
781 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
782 printf (" EFI_FVB2_ALIGNMENT_16\n");
785 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
786 printf (" EFI_FVB2_ALIGNMENT_32\n");
789 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
790 printf (" EFI_FVB2_ALIGNMENT_64\n");
793 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
794 printf (" EFI_FVB2_ALIGNMENT_128\n");
797 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
798 printf (" EFI_FVB2_ALIGNMENT_256\n");
801 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
802 printf (" EFI_FVB2_ALIGNMENT_512\n");
805 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
806 printf (" EFI_FVB2_ALIGNMENT_1K\n");
809 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
810 printf (" EFI_FVB2_ALIGNMENT_2K\n");
813 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
814 printf (" EFI_FVB2_ALIGNMENT_4K\n");
817 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
818 printf (" EFI_FVB2_ALIGNMENT_8K\n");
821 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
822 printf (" EFI_FVB2_ALIGNMENT_16K\n");
825 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
826 printf (" EFI_FVB2_ALIGNMENT_32K\n");
829 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
830 printf (" EFI_FVB2_ALIGNMENT_64K\n");
833 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128K
) {
834 printf (" EFI_FVB2_ALIGNMENT_128K\n");
837 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256K
) {
838 printf (" EFI_FVB2_ALIGNMENT_256K\n");
841 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512K
) {
842 printf (" EFI_FVB2_ALIGNMENT_512K\n");
845 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1M
) {
846 printf (" EFI_FVB2_ALIGNMENT_1M\n");
849 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2M
) {
850 printf (" EFI_FVB2_ALIGNMENT_2M\n");
853 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4M
) {
854 printf (" EFI_FVB2_ALIGNMENT_4M\n");
857 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8M
) {
858 printf (" EFI_FVB2_ALIGNMENT_8M\n");
861 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16M
) {
862 printf (" EFI_FVB2_ALIGNMENT_16M\n");
865 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32M
) {
866 printf (" EFI_FVB2_ALIGNMENT_32M\n");
869 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
870 printf (" EFI_FVB2_ALIGNMENT_64M\n");
873 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
874 printf (" EFI_FVB2_ALIGNMENT_128M\n");
877 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
878 printf (" EFI_FVB2_ALIGNMENT_64M\n");
881 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
882 printf (" EFI_FVB2_ALIGNMENT_128M\n");
885 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256M
) {
886 printf (" EFI_FVB2_ALIGNMENT_256M\n");
889 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512M
) {
890 printf (" EFI_FVB2_ALIGNMENT_512M\n");
893 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1G
) {
894 printf (" EFI_FVB2_ALIGNMENT_1G\n");
897 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2G
) {
898 printf (" EFI_FVB2_ALIGNMENT_2G\n");
902 printf ("Header Length: 0x%08X\n", VolumeHeader
.HeaderLength
);
903 printf ("File System ID: ");
904 PrintGuid (&VolumeHeader
.FileSystemGuid
);
908 printf ("Revision: 0x%04X\n", VolumeHeader
.Revision
);
911 fread (&BlockMap
, sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
912 BytesRead
+= sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
914 if (BlockMap
.NumBlocks
!= 0) {
915 printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap
.NumBlocks
);
916 printf ("Block Length: 0x%08X\n", (unsigned) BlockMap
.Length
);
917 Size
+= BlockMap
.NumBlocks
* BlockMap
.Length
;
920 } while (!(BlockMap
.NumBlocks
== 0 && BlockMap
.Length
== 0));
922 if (BytesRead
!= VolumeHeader
.HeaderLength
) {
923 printf ("ERROR: Header length not consistent with Block Maps!\n");
927 if (VolumeHeader
.FvLength
!= Size
) {
928 printf ("ERROR: Volume Size not consistant with Block Maps!\n");
932 printf ("Total Volume Size: 0x%08X\n", (unsigned) Size
);
937 // rewind (InputFile);
945 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
946 EFI_FFS_FILE_HEADER
*FileHeader
,
947 BOOLEAN ErasePolarity
953 GC_TODO: Add function description
957 FvImage - GC_TODO: add argument description
958 FileHeader - GC_TODO: add argument description
959 ErasePolarity - GC_TODO: add argument description
963 EFI_SUCCESS - GC_TODO: Add description for return value
964 EFI_ABORTED - GC_TODO: Add description for return value
971 EFI_FFS_FILE_HEADER2 BlankHeader
;
973 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
975 #if (PI_SPECIFICATION_VERSION < 0x00010000)
979 // Check if we have free space
981 HeaderSize
= FvBufGetFfsHeaderSize(FileHeader
);
983 memset (&BlankHeader
, -1, HeaderSize
);
985 memset (&BlankHeader
, 0, HeaderSize
);
988 if (memcmp (&BlankHeader
, FileHeader
, HeaderSize
) == 0) {
992 // Print file information.
994 printf ("============================================================\n");
996 printf ("File Name: ");
997 PrintGuidToBuffer (&FileHeader
->Name
, GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
998 printf ("%s ", GuidBuffer
);
999 PrintGuidName (GuidBuffer
);
1003 // PrintGuid (&FileHeader->Name);
1006 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1007 printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN
) FileHeader
- (UINTN
) FvImage
));
1008 printf ("File Length: 0x%08X\n", (unsigned) FileLength
);
1009 printf ("File Attributes: 0x%02X\n", FileHeader
->Attributes
);
1010 printf ("File State: 0x%02X\n", FileHeader
->State
);
1015 FileState
= GetFileState (ErasePolarity
, FileHeader
);
1017 switch (FileState
) {
1019 case EFI_FILE_HEADER_CONSTRUCTION
:
1020 printf (" EFI_FILE_HEADER_CONSTRUCTION\n");
1023 case EFI_FILE_HEADER_INVALID
:
1024 printf (" EFI_FILE_HEADER_INVALID\n");
1027 case EFI_FILE_HEADER_VALID
:
1028 printf (" EFI_FILE_HEADER_VALID\n");
1029 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1030 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1031 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1032 if (Checksum
!= 0) {
1033 printf ("ERROR: Header checksum invalid.\n");
1039 case EFI_FILE_DELETED
:
1040 printf (" EFI_FILE_DELETED\n");
1042 case EFI_FILE_MARKED_FOR_UPDATE
:
1043 printf (" EFI_FILE_MARKED_FOR_UPDATE\n");
1045 case EFI_FILE_DATA_VALID
:
1046 printf (" EFI_FILE_DATA_VALID\n");
1049 // Calculate header checksum
1051 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1052 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1053 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1054 if (Checksum
!= 0) {
1055 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer
);
1059 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1061 if (FileHeader
->Attributes
& FFS_ATTRIB_CHECKSUM
) {
1063 // Calculate file checksum
1065 Checksum
= CalculateSum8 ((UINT8
*)FileHeader
+ HeaderSize
, FileLength
- HeaderSize
);
1066 Checksum
= Checksum
+ FileHeader
->IntegrityCheck
.Checksum
.File
;
1067 if (Checksum
!= 0) {
1068 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer
);
1072 if (FileHeader
->IntegrityCheck
.Checksum
.File
!= FFS_FIXED_CHECKSUM
) {
1073 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
);
1077 #if (PI_SPECIFICATION_VERSION < 0x00010000)
1079 // Verify tail if present
1081 if (FileHeader
->Attributes
& FFS_ATTRIB_TAIL_PRESENT
) {
1083 // Verify tail is complement of integrity check field in the header.
1085 Tail
= (UINT16
*) ((UINTN
) FileHeader
+ GetLength (FileHeader
->Size
) - sizeof (EFI_FFS_INTEGRITY_CHECK
));
1086 if (FileHeader
->IntegrityCheck
.TailReference
!= (UINT16
)~(*Tail
)) {
1087 Error (NULL
, 0, 0003, "error parsing FFS file", \
1088 "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer
);
1096 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer
);
1100 printf ("File Type: 0x%02X ", FileHeader
->Type
);
1102 switch (FileHeader
->Type
) {
1104 case EFI_FV_FILETYPE_RAW
:
1105 printf ("EFI_FV_FILETYPE_RAW\n");
1108 case EFI_FV_FILETYPE_FREEFORM
:
1109 printf ("EFI_FV_FILETYPE_FREEFORM\n");
1112 case EFI_FV_FILETYPE_SECURITY_CORE
:
1113 printf ("EFI_FV_FILETYPE_SECURITY_CORE\n");
1116 case EFI_FV_FILETYPE_PEI_CORE
:
1117 printf ("EFI_FV_FILETYPE_PEI_CORE\n");
1120 case EFI_FV_FILETYPE_DXE_CORE
:
1121 printf ("EFI_FV_FILETYPE_DXE_CORE\n");
1124 case EFI_FV_FILETYPE_PEIM
:
1125 printf ("EFI_FV_FILETYPE_PEIM\n");
1128 case EFI_FV_FILETYPE_DRIVER
:
1129 printf ("EFI_FV_FILETYPE_DRIVER\n");
1132 case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
:
1133 printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n");
1136 case EFI_FV_FILETYPE_APPLICATION
:
1137 printf ("EFI_FV_FILETYPE_APPLICATION\n");
1140 case EFI_FV_FILETYPE_SMM
:
1141 printf ("EFI_FV_FILETYPE_SMM\n");
1144 case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
:
1145 printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n");
1148 case EFI_FV_FILETYPE_COMBINED_SMM_DXE
:
1149 printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
1152 case EFI_FV_FILETYPE_SMM_CORE
:
1153 printf ("EFI_FV_FILETYPE_SMM_CORE\n");
1156 case EFI_FV_FILETYPE_FFS_PAD
:
1157 printf ("EFI_FV_FILETYPE_FFS_PAD\n");
1161 printf ("\nERROR: Unrecognized file type %X.\n", FileHeader
->Type
);
1166 switch (FileHeader
->Type
) {
1168 case EFI_FV_FILETYPE_ALL
:
1169 case EFI_FV_FILETYPE_RAW
:
1170 case EFI_FV_FILETYPE_FFS_PAD
:
1175 // All other files have sections
1177 Status
= ParseSection (
1178 (UINT8
*) ((UINTN
) FileHeader
+ HeaderSize
),
1179 FvBufGetFfsFileSize (FileHeader
) - HeaderSize
1181 if (EFI_ERROR (Status
)) {
1183 // printf ("ERROR: Parsing the FFS file.\n");
1195 IN UINT8
*SectionBuffer
,
1196 IN UINT32 BufferLength
1200 Routine Description:
1206 SectionBuffer - Buffer containing the section to parse.
1207 BufferLength - Length of SectionBuffer
1211 EFI_SECTION_ERROR - Problem with section parsing.
1212 (a) compression errors
1213 (b) unrecognized section
1214 EFI_UNSUPPORTED - Do not know how to parse the section.
1215 EFI_SUCCESS - Section successfully parsed.
1216 EFI_OUT_OF_RESOURCES - Memory allocation failed.
1220 EFI_SECTION_TYPE Type
;
1222 UINT32 SectionLength
;
1223 UINT32 SectionHeaderLen
;
1226 UINT32 ParsedLength
;
1227 UINT8
*CompressedBuffer
;
1228 UINT32 CompressedLength
;
1229 UINT8
*UncompressedBuffer
;
1230 UINT32 UncompressedLength
;
1231 UINT8
*ToolOutputBuffer
;
1232 UINT32 ToolOutputLength
;
1233 UINT8 CompressionType
;
1236 UINT8
*ScratchBuffer
;
1237 DECOMPRESS_FUNCTION DecompressFunction
;
1238 GETINFO_FUNCTION GetInfoFunction
;
1240 CHAR8
*ExtractionTool
;
1241 CHAR8
*ToolInputFile
;
1242 CHAR8
*ToolOutputFile
;
1243 CHAR8
*SystemCommandFormatString
;
1244 CHAR8
*SystemCommand
;
1251 while (ParsedLength
< BufferLength
) {
1252 Ptr
= SectionBuffer
+ ParsedLength
;
1254 SectionLength
= GetLength (((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Size
);
1255 Type
= ((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Type
;
1258 // This is sort of an odd check, but is necessary because FFS files are
1259 // padded to a QWORD boundary, meaning there is potentially a whole section
1260 // header worth of 0xFF bytes.
1262 if (SectionLength
== 0xffffff && Type
== 0xff) {
1268 // Get real section file size
1270 SectionLength
= GetSectionFileLength ((EFI_COMMON_SECTION_HEADER
*) Ptr
);
1271 SectionHeaderLen
= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1273 SectionName
= SectionNameToStr (Type
);
1274 printf ("------------------------------------------------------------\n");
1275 printf (" Type: %s\n Size: 0x%08X\n", SectionName
, (unsigned) SectionLength
);
1279 case EFI_SECTION_RAW
:
1280 case EFI_SECTION_PE32
:
1281 case EFI_SECTION_PIC
:
1282 case EFI_SECTION_TE
:
1283 // default is no more information
1286 case EFI_SECTION_USER_INTERFACE
:
1287 // name = &((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString;
1288 // printf (" String: %s\n", &name);
1291 case EFI_SECTION_FIRMWARE_VOLUME_IMAGE
:
1292 Status
= PrintFvInfo (Ptr
+ SectionHeaderLen
, TRUE
);
1293 if (EFI_ERROR (Status
)) {
1294 Error (NULL
, 0, 0003, "printing of FV section contents failed", NULL
);
1295 return EFI_SECTION_ERROR
;
1299 case EFI_SECTION_COMPATIBILITY16
:
1300 case EFI_SECTION_FREEFORM_SUBTYPE_GUID
:
1302 // Section does not contain any further header information.
1306 case EFI_SECTION_PEI_DEPEX
:
1307 case EFI_SECTION_DXE_DEPEX
:
1308 case EFI_SECTION_SMM_DEPEX
:
1309 DumpDepexSection (Ptr
, SectionLength
);
1312 case EFI_SECTION_VERSION
:
1313 printf (" Build Number: 0x%02X\n", *(UINT16
*)(Ptr
+ SectionHeaderLen
));
1314 printf (" Version Strg: %s\n", (char*) (Ptr
+ SectionHeaderLen
+ sizeof (UINT16
)));
1317 case EFI_SECTION_COMPRESSION
:
1318 UncompressedBuffer
= NULL
;
1319 if (SectionHeaderLen
== sizeof (EFI_COMMON_SECTION_HEADER
)) {
1320 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION
);
1321 UncompressedLength
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->UncompressedLength
;
1322 CompressionType
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->CompressionType
;
1324 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION2
);
1325 UncompressedLength
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->UncompressedLength
;
1326 CompressionType
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->CompressionType
;
1328 CompressedLength
= SectionLength
- RealHdrLen
;
1329 printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength
);
1331 if (CompressionType
== EFI_NOT_COMPRESSED
) {
1332 printf (" Compression Type: EFI_NOT_COMPRESSED\n");
1333 if (CompressedLength
!= UncompressedLength
) {
1338 "file is not compressed, but the compressed length does not match the uncompressed length",
1341 return EFI_SECTION_ERROR
;
1344 UncompressedBuffer
= Ptr
+ RealHdrLen
;
1345 } else if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1346 GetInfoFunction
= EfiGetInfo
;
1347 DecompressFunction
= EfiDecompress
;
1348 printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
1350 CompressedBuffer
= Ptr
+ RealHdrLen
;
1352 Status
= GetInfoFunction (CompressedBuffer
, CompressedLength
, &DstSize
, &ScratchSize
);
1353 if (EFI_ERROR (Status
)) {
1354 Error (NULL
, 0, 0003, "error getting compression info from compression section", NULL
);
1355 return EFI_SECTION_ERROR
;
1358 if (DstSize
!= UncompressedLength
) {
1359 Error (NULL
, 0, 0003, "compression error in the compression section", NULL
);
1360 return EFI_SECTION_ERROR
;
1363 ScratchBuffer
= malloc (ScratchSize
);
1364 UncompressedBuffer
= malloc (UncompressedLength
);
1365 if ((ScratchBuffer
== NULL
) || (UncompressedBuffer
== NULL
)) {
1366 return EFI_OUT_OF_RESOURCES
;
1368 Status
= DecompressFunction (
1376 free (ScratchBuffer
);
1377 if (EFI_ERROR (Status
)) {
1378 Error (NULL
, 0, 0003, "decompress failed", NULL
);
1379 free (UncompressedBuffer
);
1380 return EFI_SECTION_ERROR
;
1383 Error (NULL
, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType
);
1384 return EFI_SECTION_ERROR
;
1387 Status
= ParseSection (UncompressedBuffer
, UncompressedLength
);
1389 if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1391 // We need to deallocate Buffer
1393 free (UncompressedBuffer
);
1396 if (EFI_ERROR (Status
)) {
1397 Error (NULL
, 0, 0003, "failed to parse section", NULL
);
1398 return EFI_SECTION_ERROR
;
1402 case EFI_SECTION_GUID_DEFINED
:
1403 if (SectionHeaderLen
== sizeof(EFI_COMMON_SECTION_HEADER
)) {
1404 EfiGuid
= &((EFI_GUID_DEFINED_SECTION
*) Ptr
)->SectionDefinitionGuid
;
1405 DataOffset
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->DataOffset
;
1406 Attributes
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->Attributes
;
1408 EfiGuid
= &((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->SectionDefinitionGuid
;
1409 DataOffset
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->DataOffset
;
1410 Attributes
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->Attributes
;
1412 printf (" SectionDefinitionGuid: ");
1413 PrintGuid (EfiGuid
);
1415 printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset
);
1416 printf (" Attributes: 0x%04X\n", (unsigned) Attributes
);
1419 LookupGuidedSectionToolPath (
1420 mParsedGuidedSectionTools
,
1424 if (ExtractionTool
!= NULL
) {
1426 ToolInputFile
= CloneString (tmpnam (NULL
));
1427 ToolOutputFile
= CloneString (tmpnam (NULL
));
1430 // Construction 'system' command string
1432 SystemCommandFormatString
= "%s -d -o %s %s";
1433 SystemCommand
= malloc (
1434 strlen (SystemCommandFormatString
) +
1435 strlen (ExtractionTool
) +
1436 strlen (ToolInputFile
) +
1437 strlen (ToolOutputFile
) +
1442 SystemCommandFormatString
,
1447 free (ExtractionTool
);
1452 (CHAR8
*) SectionBuffer
+ DataOffset
,
1453 BufferLength
- DataOffset
1456 system (SystemCommand
);
1457 remove (ToolInputFile
);
1458 free (ToolInputFile
);
1463 (CHAR8
**)&ToolOutputBuffer
,
1466 remove (ToolOutputFile
);
1467 free (ToolOutputFile
);
1468 if (EFI_ERROR (Status
)) {
1469 Error (NULL
, 0, 0004, "unable to read decoded GUIDED section", NULL
);
1470 return EFI_SECTION_ERROR
;
1473 Status
= ParseSection (
1477 if (EFI_ERROR (Status
)) {
1478 Error (NULL
, 0, 0003, "parse of decoded GUIDED section failed", NULL
);
1479 return EFI_SECTION_ERROR
;
1483 // Check for CRC32 sections which we can handle internally if needed.
1485 } else if (!CompareGuid (
1487 &gEfiCrc32GuidedSectionExtractionProtocolGuid
1491 // CRC32 guided section
1493 Status
= ParseSection (
1494 SectionBuffer
+ DataOffset
,
1495 BufferLength
- DataOffset
1497 if (EFI_ERROR (Status
)) {
1498 Error (NULL
, 0, 0003, "parse of CRC32 GUIDED section failed", NULL
);
1499 return EFI_SECTION_ERROR
;
1503 // We don't know how to parse it now.
1505 Error (NULL
, 0, 0003, "Error parsing section", \
1506 "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).");
1507 return EFI_UNSUPPORTED
;
1513 // Unknown section, return error
1515 Error (NULL
, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type
);
1516 return EFI_SECTION_ERROR
;
1519 ParsedLength
+= SectionLength
;
1521 // We make then next section begin on a 4-byte boundary
1523 ParsedLength
= GetOccupiedSize (ParsedLength
, 4);
1526 if (ParsedLength
< BufferLength
) {
1527 Error (NULL
, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL
);
1528 return EFI_SECTION_ERROR
;
1537 IN UINT32 SectionLength
1541 Routine Description:
1543 GC_TODO: Add function description
1547 Ptr - GC_TODO: add argument description
1548 SectionLength - GC_TODO: add argument description
1552 EFI_SUCCESS - GC_TODO: Add description for return value
1556 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
1559 // Need at least a section header + data
1561 if (SectionLength
<= sizeof (EFI_COMMON_SECTION_HEADER
)) {
1565 Ptr
+= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1566 SectionLength
-= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1567 while (SectionLength
> 0) {
1570 case EFI_DEP_BEFORE
:
1571 printf ("BEFORE\n");
1584 PrintGuidToBuffer ((EFI_GUID
*) (Ptr
+ 1), GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
1585 printf ("%s ", GuidBuffer
);
1586 PrintGuidName (GuidBuffer
);
1589 // PrintGuid ((EFI_GUID *)(Ptr + 1));
1592 SectionLength
-= 17;
1626 printf ("END DEPEX\n");
1638 printf ("Unrecognized byte in depex: 0x%X\n", *Ptr
);
1652 Routine Description:
1654 GC_TODO: Add function description
1658 GuidStr - GC_TODO: add argument description
1662 EFI_SUCCESS - GC_TODO: Add description for return value
1663 EFI_INVALID_PARAMETER - GC_TODO: Add description for return value
1667 GUID_TO_BASENAME
*GPtr
;
1669 // If we have a list of guid-to-basenames, then go through the list to
1670 // look for a guid string match. If found, print the basename to stdout,
1671 // otherwise return a failure.
1673 GPtr
= mGuidBaseNameList
;
1674 while (GPtr
!= NULL
) {
1675 if (_stricmp ((CHAR8
*) GuidStr
, (CHAR8
*) GPtr
->Guid
) == 0) {
1676 printf ("%s", GPtr
->BaseName
);
1683 return EFI_INVALID_PARAMETER
;
1687 ParseGuidBaseNameFile (
1692 Routine Description:
1694 GC_TODO: Add function description
1698 FileName - GC_TODO: add argument description
1702 EFI_DEVICE_ERROR - GC_TODO: Add description for return value
1703 EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value
1704 EFI_SUCCESS - GC_TODO: Add description for return value
1709 CHAR8 Line
[MAX_LINE_LEN
];
1710 GUID_TO_BASENAME
*GPtr
;
1712 if ((Fptr
= fopen (LongFilePath (FileName
), "r")) == NULL
) {
1713 printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName
);
1714 return EFI_DEVICE_ERROR
;
1717 while (fgets (Line
, sizeof (Line
), Fptr
) != NULL
) {
1719 // Allocate space for another guid/basename element
1721 GPtr
= malloc (sizeof (GUID_TO_BASENAME
));
1723 return EFI_OUT_OF_RESOURCES
;
1726 memset ((char *) GPtr
, 0, sizeof (GUID_TO_BASENAME
));
1727 if (sscanf (Line
, "%s %s", GPtr
->Guid
, GPtr
->BaseName
) == 2) {
1728 GPtr
->Next
= mGuidBaseNameList
;
1729 mGuidBaseNameList
= GPtr
;
1732 // Some sort of error. Just continue.
1743 FreeGuidBaseNameList (
1748 Routine Description:
1750 GC_TODO: Add function description
1758 EFI_SUCCESS - GC_TODO: Add description for return value
1762 GUID_TO_BASENAME
*Next
;
1764 while (mGuidBaseNameList
!= NULL
) {
1765 Next
= mGuidBaseNameList
->Next
;
1766 free (mGuidBaseNameList
);
1767 mGuidBaseNameList
= Next
;
1776 LoadGuidedSectionToolsTxt (
1777 IN CHAR8
* FirmwareVolumeFilename
1780 CHAR8
* PeerFilename
;
1787 Places
[0] = FirmwareVolumeFilename
;
1788 //Places[1] = mUtilityFilename;
1790 mParsedGuidedSectionTools
= NULL
;
1792 for (Index
= 0; Index
< (sizeof(Places
)/sizeof(Places
[0])); Index
++) {
1793 PeerFilename
= OsPathPeerFilePath (Places
[Index
], "GuidedSectionTools.txt");
1794 //printf("Loading %s...\n", PeerFilename);
1795 if (OsPathExists (PeerFilename
)) {
1796 mParsedGuidedSectionTools
= ParseGuidedSectionToolsFile (PeerFilename
);
1798 free (PeerFilename
);
1799 if (mParsedGuidedSectionTools
!= NULL
) {
1812 Routine Description:
1814 GC_TODO: Add function description
1822 GC_TODO: add return values
1829 fprintf (stdout
, "Usage: %s [options] <input_file>\n\n", UTILITY_NAME
);
1832 // Copyright declaration
1834 fprintf (stdout
, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
1835 fprintf (stdout
, " Display Tiano Firmware Volume FFS image information\n\n");
1840 fprintf (stdout
, "Options:\n");
1841 fprintf (stdout
, " -x xref, --xref xref\n\
1842 Parse basename to file-guid cross reference file(s).\n");
1843 fprintf (stdout
, " --offset offset\n\
1844 Offset of file to start processing FV at.\n");
1845 fprintf (stdout
, " -h, --help\n\
1846 Show this help message and exit.\n");