2 The tool dumps the contents of a firmware volume
4 Copyright (c) 1999 - 2015, 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.
25 #include <Common/UefiBaseTypes.h>
26 #include <Common/UefiCapsule.h>
27 #include <Common/PiFirmwareFile.h>
28 #include <Common/PiFirmwareVolume.h>
29 #include <Guid/PiFirmwareFileSystem.h>
30 #include <IndustryStandard/PeImage.h>
31 #include <Protocol/GuidedSectionExtraction.h>
34 #include "Decompress.h"
36 #include "CommonLib.h"
37 #include "EfiUtilityMsgs.h"
38 #include "FirmwareVolumeBufferLib.h"
40 #include "ParseGuidedSectionTools.h"
41 #include "StringFuncs.h"
44 // Utility global variables
47 EFI_GUID gEfiCrc32GuidedSectionExtractionProtocolGuid
= EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID
;
49 #define UTILITY_MAJOR_VERSION 0
50 #define UTILITY_MINOR_VERSION 83
52 #define UTILITY_NAME "VolInfo"
54 #define EFI_SECTION_ERROR EFIERR (100)
56 #define MAX_BASENAME_LEN 60 // not good to hardcode, but let's be reasonable
59 // Structure to keep a list of guid-to-basenames
61 typedef struct _GUID_TO_BASENAME
{
62 struct _GUID_TO_BASENAME
*Next
;
63 INT8 Guid
[PRINTED_GUID_BUFFER_SIZE
];
64 INT8 BaseName
[MAX_BASENAME_LEN
];
67 static GUID_TO_BASENAME
*mGuidBaseNameList
= NULL
;
70 // Store GUIDed Section guid->tool mapping
72 EFI_HANDLE mParsedGuidedSectionTools
= NULL
;
74 CHAR8
* mUtilityFilename
= NULL
;
77 ParseGuidBaseNameFile (
82 FreeGuidBaseNameList (
93 IN UINT8
*SectionBuffer
,
94 IN UINT32 BufferLength
100 IN UINT32 SectionLength
108 OUT BOOLEAN
*ErasePolarity
114 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
115 EFI_FFS_FILE_HEADER
*FileHeader
,
116 BOOLEAN ErasePolarity
128 LoadGuidedSectionToolsTxt (
129 IN CHAR8
* FirmwareVolumeFilename
146 GC_TODO: Add function description
150 argc - GC_TODO: add argument description
151 ] - GC_TODO: add argument description
155 GC_TODO: add return values
161 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
;
165 BOOLEAN ErasePolarity
;
167 SetUtilityName (UTILITY_NAME
);
169 // Print utility header
171 printf ("%s Version %d.%d %s, %s\n",
173 UTILITY_MAJOR_VERSION
,
174 UTILITY_MINOR_VERSION
,
180 // Save, and then skip filename arg
182 mUtilityFilename
= argv
[0];
189 // If they specified -x xref guid/basename cross-reference files, process it.
190 // This will print the basename beside each file guid. To use it, specify
191 // -x xref_filename to processdsc, then use xref_filename as a parameter
195 if ((strcmp(argv
[0], "-x") == 0) || (strcmp(argv
[0], "--xref") == 0)) {
196 ParseGuidBaseNameFile (argv
[1]);
197 printf("ParseGuidBaseNameFile: %s\n", argv
[1]);
200 } else if (strcmp(argv
[0], "--offset") == 0) {
204 if ((argv
[1][0] == '0') && (tolower ((int)argv
[1][1]) == 'x')) {
205 if (sscanf (argv
[1], "%x", &Offset
) != 1) {
206 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
207 return GetUtilityStatus ();
210 if (sscanf (argv
[1], "%d", &Offset
) != 1) {
211 Error (NULL
, 0, 1003, "Invalid option value", "Offset = %s", argv
[1]);
212 return GetUtilityStatus ();
215 // See if they said something like "64K"
217 if (tolower ((int)argv
[1][strlen (argv
[1]) - 1]) == 'k') {
230 // Check for proper number of arguments
237 // Look for help options
239 if ((strcmp(argv
[0], "-h") == 0) || (strcmp(argv
[0], "--help") == 0) ||
240 (strcmp(argv
[0], "-?") == 0) || (strcmp(argv
[0], "/?") == 0)) {
246 // Open the file containing the FV
248 InputFile
= fopen (LongFilePath (argv
[0]), "rb");
249 if (InputFile
== NULL
) {
250 Error (NULL
, 0, 0001, "Error opening the input file", argv
[0]);
251 return GetUtilityStatus ();
254 // Skip over pad bytes if specified. This is used if they prepend 0xff
255 // data to the FV image binary.
258 fseek (InputFile
, Offset
, SEEK_SET
);
261 // Determine size of FV
263 Status
= ReadHeader (InputFile
, &FvSize
, &ErasePolarity
);
264 if (EFI_ERROR (Status
)) {
265 Error (NULL
, 0, 0003, "error parsing FV image", "%s Header is invalid", argv
[0]);
267 return GetUtilityStatus ();
270 // Allocate a buffer for the FV image
272 FvImage
= malloc (FvSize
);
273 if (FvImage
== NULL
) {
274 Error (NULL
, 0, 4001, "Resource: Memory can't be allocated", NULL
);
276 return GetUtilityStatus ();
279 // Seek to the start of the image, then read the entire FV to the buffer
281 fseek (InputFile
, Offset
, SEEK_SET
);
282 BytesRead
= fread (FvImage
, 1, FvSize
, InputFile
);
284 if ((unsigned int) BytesRead
!= FvSize
) {
285 Error (NULL
, 0, 0004, "error reading FvImage from", argv
[0]);
287 return GetUtilityStatus ();
290 LoadGuidedSectionToolsTxt (argv
[0]);
292 PrintFvInfo (FvImage
, FALSE
);
298 FreeGuidBaseNameList ();
299 return GetUtilityStatus ();
313 GC_TODO: Add function description
317 Fv - Firmware Volume to print information about
318 IsChildFv - Flag specifies whether the input FV is a child FV.
328 BOOLEAN ErasePolarity
;
330 EFI_FFS_FILE_HEADER
*CurrentFile
;
333 Status
= FvBufGetSize (Fv
, &FvSize
);
337 (((EFI_FIRMWARE_VOLUME_HEADER
*)Fv
)->Attributes
& EFI_FVB2_ERASE_POLARITY
) ?
341 // Get the first file
344 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
345 if (EFI_ERROR (Status
)) {
346 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the first file in the FV image");
347 return GetUtilityStatus ();
350 // Display information about files found
352 while (CurrentFile
!= NULL
) {
354 // Increment the number of files counter
359 // Display info about this file
361 Status
= PrintFileInfo (Fv
, CurrentFile
, ErasePolarity
);
362 if (EFI_ERROR (Status
)) {
363 Error (NULL
, 0, 0003, "error parsing FV image", "failed to parse a file in the FV");
364 return GetUtilityStatus ();
369 Status
= FvBufFindNextFile (Fv
, &Key
, (VOID
**) &CurrentFile
);
370 if (Status
== EFI_NOT_FOUND
) {
372 } else if (EFI_ERROR (Status
)) {
373 Error (NULL
, 0, 0003, "error parsing FV image", "cannot find the next file in the FV image");
374 return GetUtilityStatus ();
379 printf ("There are a total of %d files in the child FV\n", (int) NumberOfFiles
);
381 printf ("There are a total of %d files in this FV\n", (int) NumberOfFiles
);
389 IN UINT32 ActualSize
,
396 This function returns the next larger size that meets the alignment
397 requirement specified.
402 Alignment The desired alignment.
406 EFI_SUCCESS Function completed successfully.
407 EFI_ABORTED The function encountered an error.
413 OccupiedSize
= ActualSize
;
414 while ((OccupiedSize
& (Alignment
- 1)) != 0) {
424 IN EFI_SECTION_TYPE Type
430 Converts EFI Section names to Strings
434 Type - The EFI Section type
438 CHAR8* - Pointer to the String containing the section name.
443 CHAR8
*SectionTypeStringTable
[] = {
451 "EFI_SECTION_COMPRESSION",
455 "EFI_SECTION_GUID_DEFINED",
459 "Unknown section type - Reserved 0x03",
463 "Unknown section type - Reserved 0x04",
467 "Unknown section type - Reserved 0x05",
471 "Unknown section type - Reserved 0x06",
475 "Unknown section type - Reserved 0x07",
479 "Unknown section type - Reserved 0x08",
483 "Unknown section type - Reserved 0x09",
487 "Unknown section type - Reserved 0x0A",
491 "Unknown section type - Reserved 0x0B",
495 "Unknown section type - Reserved 0x0C",
499 "Unknown section type - Reserved 0x0D",
503 "Unknown section type - Reserved 0x0E",
507 "Unknown section type - Reserved 0x0E",
523 "EFI_SECTION_DXE_DEPEX",
527 "EFI_SECTION_VERSION",
531 "EFI_SECTION_USER_INTERFACE",
535 "EFI_SECTION_COMPATIBILITY16",
539 "EFI_SECTION_FIRMWARE_VOLUME_IMAGE ",
543 "EFI_SECTION_FREEFORM_SUBTYPE_GUID ",
551 "Unknown section type - 0x1A",
555 "EFI_SECTION_PEI_DEPEX",
559 "EFI_SECTION_SMM_DEPEX",
563 "Unknown section type - Reserved - beyond last defined section"
566 if (Type
> EFI_SECTION_LAST_SECTION_TYPE
) {
567 Type
= EFI_SECTION_LAST_SECTION_TYPE
+ 1;
570 SectionStr
= malloc (100);
571 if (SectionStr
== NULL
) {
572 printf ("Error: Out of memory resources.\n");
575 strcpy (SectionStr
, SectionTypeStringTable
[Type
]);
584 OUT BOOLEAN
*ErasePolarity
590 This function determines the size of the FV and the erase polarity. The
591 erase polarity is the FALSE value for file state.
595 InputFile The file that contains the FV image.
596 FvSize The size of the FV.
597 ErasePolarity The FV erase polarity.
601 EFI_SUCCESS Function completed successfully.
602 EFI_INVALID_PARAMETER A required parameter was NULL or is out of range.
603 EFI_ABORTED The function encountered an error.
607 EFI_FIRMWARE_VOLUME_HEADER VolumeHeader
;
608 EFI_FV_BLOCK_MAP_ENTRY BlockMap
;
616 // Check input parameters
618 if (InputFile
== NULL
|| FvSize
== NULL
|| ErasePolarity
== NULL
) {
619 Error (__FILE__
, __LINE__
, 0, "application error", "invalid parameter to function");
620 return EFI_INVALID_PARAMETER
;
625 fread (&VolumeHeader
, sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
626 BytesRead
= sizeof (EFI_FIRMWARE_VOLUME_HEADER
) - sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
627 Signature
[0] = VolumeHeader
.Signature
;
631 // Print FV header information
633 printf ("Signature: %s (%X)\n", (char *) Signature
, (unsigned) VolumeHeader
.Signature
);
634 printf ("Attributes: %X\n", (unsigned) VolumeHeader
.Attributes
);
636 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_DISABLED_CAP
) {
637 printf (" EFI_FVB2_READ_DISABLED_CAP\n");
640 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_ENABLED_CAP
) {
641 printf (" EFI_FVB2_READ_ENABLED_CAP\n");
644 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_STATUS
) {
645 printf (" EFI_FVB2_READ_STATUS\n");
648 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_DISABLED_CAP
) {
649 printf (" EFI_FVB2_WRITE_DISABLED_CAP\n");
652 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_ENABLED_CAP
) {
653 printf (" EFI_FVB2_WRITE_ENABLED_CAP\n");
656 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_STATUS
) {
657 printf (" EFI_FVB2_WRITE_STATUS\n");
660 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_CAP
) {
661 printf (" EFI_FVB2_LOCK_CAP\n");
664 if (VolumeHeader
.Attributes
& EFI_FVB2_LOCK_STATUS
) {
665 printf (" EFI_FVB2_LOCK_STATUS\n");
668 if (VolumeHeader
.Attributes
& EFI_FVB2_STICKY_WRITE
) {
669 printf (" EFI_FVB2_STICKY_WRITE\n");
672 if (VolumeHeader
.Attributes
& EFI_FVB2_MEMORY_MAPPED
) {
673 printf (" EFI_FVB2_MEMORY_MAPPED\n");
676 if (VolumeHeader
.Attributes
& EFI_FVB2_ERASE_POLARITY
) {
677 printf (" EFI_FVB2_ERASE_POLARITY\n");
678 *ErasePolarity
= TRUE
;
681 #if (PI_SPECIFICATION_VERSION < 0x00010000)
682 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT
) {
683 printf (" EFI_FVB2_ALIGNMENT\n");
686 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
687 printf (" EFI_FVB2_ALIGNMENT_2\n");
690 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
691 printf (" EFI_FVB2_ALIGNMENT_4\n");
694 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
695 printf (" EFI_FVB2_ALIGNMENT_8\n");
698 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
699 printf (" EFI_FVB2_ALIGNMENT_16\n");
702 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
703 printf (" EFI_FVB2_ALIGNMENT_32\n");
706 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
707 printf (" EFI_FVB2_ALIGNMENT_64\n");
710 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
711 printf (" EFI_FVB2_ALIGNMENT_128\n");
714 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
715 printf (" EFI_FVB2_ALIGNMENT_256\n");
718 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
719 printf (" EFI_FVB2_ALIGNMENT_512\n");
722 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
723 printf (" EFI_FVB2_ALIGNMENT_1K\n");
726 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
727 printf (" EFI_FVB2_ALIGNMENT_2K\n");
730 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
731 printf (" EFI_FVB2_ALIGNMENT_4K\n");
734 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
735 printf (" EFI_FVB2_ALIGNMENT_8K\n");
738 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
739 printf (" EFI_FVB2_ALIGNMENT_16K\n");
742 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
743 printf (" EFI_FVB2_ALIGNMENT_32K\n");
746 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
747 printf (" EFI_FVB2_ALIGNMENT_64K\n");
752 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_CAP
) {
753 printf (" EFI_FVB2_READ_LOCK_CAP\n");
756 if (VolumeHeader
.Attributes
& EFI_FVB2_READ_LOCK_STATUS
) {
757 printf (" EFI_FVB2_READ_LOCK_STATUS\n");
760 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_CAP
) {
761 printf (" EFI_FVB2_WRITE_LOCK_CAP\n");
764 if (VolumeHeader
.Attributes
& EFI_FVB2_WRITE_LOCK_STATUS
) {
765 printf (" EFI_FVB2_WRITE_LOCK_STATUS\n");
768 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1
) {
769 printf (" EFI_FVB2_ALIGNMENT_1\n");
772 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2
) {
773 printf (" EFI_FVB2_ALIGNMENT_2\n");
776 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4
) {
777 printf (" EFI_FVB2_ALIGNMENT_4\n");
780 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8
) {
781 printf (" EFI_FVB2_ALIGNMENT_8\n");
784 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16
) {
785 printf (" EFI_FVB2_ALIGNMENT_16\n");
788 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32
) {
789 printf (" EFI_FVB2_ALIGNMENT_32\n");
792 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64
) {
793 printf (" EFI_FVB2_ALIGNMENT_64\n");
796 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128
) {
797 printf (" EFI_FVB2_ALIGNMENT_128\n");
800 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256
) {
801 printf (" EFI_FVB2_ALIGNMENT_256\n");
804 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512
) {
805 printf (" EFI_FVB2_ALIGNMENT_512\n");
808 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1K
) {
809 printf (" EFI_FVB2_ALIGNMENT_1K\n");
812 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2K
) {
813 printf (" EFI_FVB2_ALIGNMENT_2K\n");
816 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4K
) {
817 printf (" EFI_FVB2_ALIGNMENT_4K\n");
820 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8K
) {
821 printf (" EFI_FVB2_ALIGNMENT_8K\n");
824 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16K
) {
825 printf (" EFI_FVB2_ALIGNMENT_16K\n");
828 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32K
) {
829 printf (" EFI_FVB2_ALIGNMENT_32K\n");
832 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64K
) {
833 printf (" EFI_FVB2_ALIGNMENT_64K\n");
836 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128K
) {
837 printf (" EFI_FVB2_ALIGNMENT_128K\n");
840 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256K
) {
841 printf (" EFI_FVB2_ALIGNMENT_256K\n");
844 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512K
) {
845 printf (" EFI_FVB2_ALIGNMENT_512K\n");
848 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1M
) {
849 printf (" EFI_FVB2_ALIGNMENT_1M\n");
852 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2M
) {
853 printf (" EFI_FVB2_ALIGNMENT_2M\n");
856 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_4M
) {
857 printf (" EFI_FVB2_ALIGNMENT_4M\n");
860 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_8M
) {
861 printf (" EFI_FVB2_ALIGNMENT_8M\n");
864 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_16M
) {
865 printf (" EFI_FVB2_ALIGNMENT_16M\n");
868 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_32M
) {
869 printf (" EFI_FVB2_ALIGNMENT_32M\n");
872 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
873 printf (" EFI_FVB2_ALIGNMENT_64M\n");
876 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
877 printf (" EFI_FVB2_ALIGNMENT_128M\n");
880 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_64M
) {
881 printf (" EFI_FVB2_ALIGNMENT_64M\n");
884 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_128M
) {
885 printf (" EFI_FVB2_ALIGNMENT_128M\n");
888 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_256M
) {
889 printf (" EFI_FVB2_ALIGNMENT_256M\n");
892 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_512M
) {
893 printf (" EFI_FVB2_ALIGNMENT_512M\n");
896 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_1G
) {
897 printf (" EFI_FVB2_ALIGNMENT_1G\n");
900 if (VolumeHeader
.Attributes
& EFI_FVB2_ALIGNMENT_2G
) {
901 printf (" EFI_FVB2_ALIGNMENT_2G\n");
905 printf ("Header Length: 0x%08X\n", VolumeHeader
.HeaderLength
);
906 printf ("File System ID: ");
907 PrintGuid (&VolumeHeader
.FileSystemGuid
);
911 printf ("Revision: 0x%04X\n", VolumeHeader
.Revision
);
914 fread (&BlockMap
, sizeof (EFI_FV_BLOCK_MAP_ENTRY
), 1, InputFile
);
915 BytesRead
+= sizeof (EFI_FV_BLOCK_MAP_ENTRY
);
917 if (BlockMap
.NumBlocks
!= 0) {
918 printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap
.NumBlocks
);
919 printf ("Block Length: 0x%08X\n", (unsigned) BlockMap
.Length
);
920 Size
+= BlockMap
.NumBlocks
* BlockMap
.Length
;
923 } while (!(BlockMap
.NumBlocks
== 0 && BlockMap
.Length
== 0));
925 if (BytesRead
!= VolumeHeader
.HeaderLength
) {
926 printf ("ERROR: Header length not consistent with Block Maps!\n");
930 if (VolumeHeader
.FvLength
!= Size
) {
931 printf ("ERROR: Volume Size not consistant with Block Maps!\n");
935 printf ("Total Volume Size: 0x%08X\n", (unsigned) Size
);
940 // rewind (InputFile);
948 EFI_FIRMWARE_VOLUME_HEADER
*FvImage
,
949 EFI_FFS_FILE_HEADER
*FileHeader
,
950 BOOLEAN ErasePolarity
956 GC_TODO: Add function description
960 FvImage - GC_TODO: add argument description
961 FileHeader - GC_TODO: add argument description
962 ErasePolarity - GC_TODO: add argument description
966 EFI_SUCCESS - GC_TODO: Add description for return value
967 EFI_ABORTED - GC_TODO: Add description for return value
974 EFI_FFS_FILE_HEADER2 BlankHeader
;
976 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
978 #if (PI_SPECIFICATION_VERSION < 0x00010000)
982 // Check if we have free space
984 HeaderSize
= FvBufGetFfsHeaderSize(FileHeader
);
986 memset (&BlankHeader
, -1, HeaderSize
);
988 memset (&BlankHeader
, 0, HeaderSize
);
991 if (memcmp (&BlankHeader
, FileHeader
, HeaderSize
) == 0) {
995 // Print file information.
997 printf ("============================================================\n");
999 printf ("File Name: ");
1000 PrintGuidToBuffer (&FileHeader
->Name
, GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
1001 printf ("%s ", GuidBuffer
);
1002 PrintGuidName (GuidBuffer
);
1006 // PrintGuid (&FileHeader->Name);
1009 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1010 printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN
) FileHeader
- (UINTN
) FvImage
));
1011 printf ("File Length: 0x%08X\n", (unsigned) FileLength
);
1012 printf ("File Attributes: 0x%02X\n", FileHeader
->Attributes
);
1013 printf ("File State: 0x%02X\n", FileHeader
->State
);
1018 FileState
= GetFileState (ErasePolarity
, FileHeader
);
1020 switch (FileState
) {
1022 case EFI_FILE_HEADER_CONSTRUCTION
:
1023 printf (" EFI_FILE_HEADER_CONSTRUCTION\n");
1026 case EFI_FILE_HEADER_INVALID
:
1027 printf (" EFI_FILE_HEADER_INVALID\n");
1030 case EFI_FILE_HEADER_VALID
:
1031 printf (" EFI_FILE_HEADER_VALID\n");
1032 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1033 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1034 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1035 if (Checksum
!= 0) {
1036 printf ("ERROR: Header checksum invalid.\n");
1042 case EFI_FILE_DELETED
:
1043 printf (" EFI_FILE_DELETED\n");
1045 case EFI_FILE_MARKED_FOR_UPDATE
:
1046 printf (" EFI_FILE_MARKED_FOR_UPDATE\n");
1048 case EFI_FILE_DATA_VALID
:
1049 printf (" EFI_FILE_DATA_VALID\n");
1052 // Calculate header checksum
1054 Checksum
= CalculateSum8 ((UINT8
*) FileHeader
, HeaderSize
);
1055 Checksum
= (UINT8
) (Checksum
- FileHeader
->IntegrityCheck
.Checksum
.File
);
1056 Checksum
= (UINT8
) (Checksum
- FileHeader
->State
);
1057 if (Checksum
!= 0) {
1058 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid header checksum", GuidBuffer
);
1062 FileLength
= FvBufGetFfsFileSize (FileHeader
);
1064 if (FileHeader
->Attributes
& FFS_ATTRIB_CHECKSUM
) {
1066 // Calculate file checksum
1068 Checksum
= CalculateSum8 ((UINT8
*)FileHeader
+ HeaderSize
, FileLength
- HeaderSize
);
1069 Checksum
= Checksum
+ FileHeader
->IntegrityCheck
.Checksum
.File
;
1070 if (Checksum
!= 0) {
1071 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has invalid file checksum", GuidBuffer
);
1075 if (FileHeader
->IntegrityCheck
.Checksum
.File
!= FFS_FIXED_CHECKSUM
) {
1076 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
);
1080 #if (PI_SPECIFICATION_VERSION < 0x00010000)
1082 // Verify tail if present
1084 if (FileHeader
->Attributes
& FFS_ATTRIB_TAIL_PRESENT
) {
1086 // Verify tail is complement of integrity check field in the header.
1088 Tail
= (UINT16
*) ((UINTN
) FileHeader
+ GetLength (FileHeader
->Size
) - sizeof (EFI_FFS_INTEGRITY_CHECK
));
1089 if (FileHeader
->IntegrityCheck
.TailReference
!= (UINT16
)~(*Tail
)) {
1090 Error (NULL
, 0, 0003, "error parsing FFS file", \
1091 "FFS file with Guid %s failed in the integrity check, tail is not the complement of the header field", GuidBuffer
);
1099 Error (NULL
, 0, 0003, "error parsing FFS file", "FFS file with Guid %s has the invalid/unrecognized file state bits", GuidBuffer
);
1103 printf ("File Type: 0x%02X ", FileHeader
->Type
);
1105 switch (FileHeader
->Type
) {
1107 case EFI_FV_FILETYPE_RAW
:
1108 printf ("EFI_FV_FILETYPE_RAW\n");
1111 case EFI_FV_FILETYPE_FREEFORM
:
1112 printf ("EFI_FV_FILETYPE_FREEFORM\n");
1115 case EFI_FV_FILETYPE_SECURITY_CORE
:
1116 printf ("EFI_FV_FILETYPE_SECURITY_CORE\n");
1119 case EFI_FV_FILETYPE_PEI_CORE
:
1120 printf ("EFI_FV_FILETYPE_PEI_CORE\n");
1123 case EFI_FV_FILETYPE_DXE_CORE
:
1124 printf ("EFI_FV_FILETYPE_DXE_CORE\n");
1127 case EFI_FV_FILETYPE_PEIM
:
1128 printf ("EFI_FV_FILETYPE_PEIM\n");
1131 case EFI_FV_FILETYPE_DRIVER
:
1132 printf ("EFI_FV_FILETYPE_DRIVER\n");
1135 case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
:
1136 printf ("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER\n");
1139 case EFI_FV_FILETYPE_APPLICATION
:
1140 printf ("EFI_FV_FILETYPE_APPLICATION\n");
1143 case EFI_FV_FILETYPE_SMM
:
1144 printf ("EFI_FV_FILETYPE_SMM\n");
1147 case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
:
1148 printf ("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE\n");
1151 case EFI_FV_FILETYPE_COMBINED_SMM_DXE
:
1152 printf ("EFI_FV_FILETYPE_COMBINED_SMM_DXE\n");
1155 case EFI_FV_FILETYPE_SMM_CORE
:
1156 printf ("EFI_FV_FILETYPE_SMM_CORE\n");
1159 case EFI_FV_FILETYPE_FFS_PAD
:
1160 printf ("EFI_FV_FILETYPE_FFS_PAD\n");
1164 printf ("\nERROR: Unrecognized file type %X.\n", FileHeader
->Type
);
1169 switch (FileHeader
->Type
) {
1171 case EFI_FV_FILETYPE_ALL
:
1172 case EFI_FV_FILETYPE_RAW
:
1173 case EFI_FV_FILETYPE_FFS_PAD
:
1178 // All other files have sections
1180 Status
= ParseSection (
1181 (UINT8
*) ((UINTN
) FileHeader
+ HeaderSize
),
1182 FvBufGetFfsFileSize (FileHeader
) - HeaderSize
1184 if (EFI_ERROR (Status
)) {
1186 // printf ("ERROR: Parsing the FFS file.\n");
1198 IN UINT8
*SectionBuffer
,
1199 IN UINT32 BufferLength
1203 Routine Description:
1209 SectionBuffer - Buffer containing the section to parse.
1210 BufferLength - Length of SectionBuffer
1214 EFI_SECTION_ERROR - Problem with section parsing.
1215 (a) compression errors
1216 (b) unrecognized section
1217 EFI_UNSUPPORTED - Do not know how to parse the section.
1218 EFI_SUCCESS - Section successfully parsed.
1219 EFI_OUT_OF_RESOURCES - Memory allocation failed.
1223 EFI_SECTION_TYPE Type
;
1225 UINT32 SectionLength
;
1226 UINT32 SectionHeaderLen
;
1229 UINT32 ParsedLength
;
1230 UINT8
*CompressedBuffer
;
1231 UINT32 CompressedLength
;
1232 UINT8
*UncompressedBuffer
;
1233 UINT32 UncompressedLength
;
1234 UINT8
*ToolOutputBuffer
;
1235 UINT32 ToolOutputLength
;
1236 UINT8 CompressionType
;
1239 UINT8
*ScratchBuffer
;
1240 DECOMPRESS_FUNCTION DecompressFunction
;
1241 GETINFO_FUNCTION GetInfoFunction
;
1243 CHAR8
*ExtractionTool
;
1244 CHAR8
*ToolInputFile
;
1245 CHAR8
*ToolOutputFile
;
1246 CHAR8
*SystemCommandFormatString
;
1247 CHAR8
*SystemCommand
;
1254 while (ParsedLength
< BufferLength
) {
1255 Ptr
= SectionBuffer
+ ParsedLength
;
1257 SectionLength
= GetLength (((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Size
);
1258 Type
= ((EFI_COMMON_SECTION_HEADER
*) Ptr
)->Type
;
1261 // This is sort of an odd check, but is necessary because FFS files are
1262 // padded to a QWORD boundary, meaning there is potentially a whole section
1263 // header worth of 0xFF bytes.
1265 if (SectionLength
== 0xffffff && Type
== 0xff) {
1271 // Get real section file size
1273 SectionLength
= GetSectionFileLength ((EFI_COMMON_SECTION_HEADER
*) Ptr
);
1274 SectionHeaderLen
= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1276 SectionName
= SectionNameToStr (Type
);
1277 printf ("------------------------------------------------------------\n");
1278 printf (" Type: %s\n Size: 0x%08X\n", SectionName
, (unsigned) SectionLength
);
1282 case EFI_SECTION_RAW
:
1283 case EFI_SECTION_PE32
:
1284 case EFI_SECTION_PIC
:
1285 case EFI_SECTION_TE
:
1286 // default is no more information
1289 case EFI_SECTION_USER_INTERFACE
:
1290 // name = &((EFI_USER_INTERFACE_SECTION *) Ptr)->FileNameString;
1291 // printf (" String: %s\n", &name);
1294 case EFI_SECTION_FIRMWARE_VOLUME_IMAGE
:
1295 Status
= PrintFvInfo (Ptr
+ SectionHeaderLen
, TRUE
);
1296 if (EFI_ERROR (Status
)) {
1297 Error (NULL
, 0, 0003, "printing of FV section contents failed", NULL
);
1298 return EFI_SECTION_ERROR
;
1302 case EFI_SECTION_COMPATIBILITY16
:
1303 case EFI_SECTION_FREEFORM_SUBTYPE_GUID
:
1305 // Section does not contain any further header information.
1309 case EFI_SECTION_PEI_DEPEX
:
1310 case EFI_SECTION_DXE_DEPEX
:
1311 case EFI_SECTION_SMM_DEPEX
:
1312 DumpDepexSection (Ptr
, SectionLength
);
1315 case EFI_SECTION_VERSION
:
1316 printf (" Build Number: 0x%02X\n", *(UINT16
*)(Ptr
+ SectionHeaderLen
));
1317 printf (" Version Strg: %s\n", (char*) (Ptr
+ SectionHeaderLen
+ sizeof (UINT16
)));
1320 case EFI_SECTION_COMPRESSION
:
1321 UncompressedBuffer
= NULL
;
1322 if (SectionHeaderLen
== sizeof (EFI_COMMON_SECTION_HEADER
)) {
1323 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION
);
1324 UncompressedLength
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->UncompressedLength
;
1325 CompressionType
= ((EFI_COMPRESSION_SECTION
*)Ptr
)->CompressionType
;
1327 RealHdrLen
= sizeof(EFI_COMPRESSION_SECTION2
);
1328 UncompressedLength
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->UncompressedLength
;
1329 CompressionType
= ((EFI_COMPRESSION_SECTION2
*)Ptr
)->CompressionType
;
1331 CompressedLength
= SectionLength
- RealHdrLen
;
1332 printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength
);
1334 if (CompressionType
== EFI_NOT_COMPRESSED
) {
1335 printf (" Compression Type: EFI_NOT_COMPRESSED\n");
1336 if (CompressedLength
!= UncompressedLength
) {
1341 "file is not compressed, but the compressed length does not match the uncompressed length",
1344 return EFI_SECTION_ERROR
;
1347 UncompressedBuffer
= Ptr
+ RealHdrLen
;
1348 } else if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1349 GetInfoFunction
= EfiGetInfo
;
1350 DecompressFunction
= EfiDecompress
;
1351 printf (" Compression Type: EFI_STANDARD_COMPRESSION\n");
1353 CompressedBuffer
= Ptr
+ RealHdrLen
;
1355 Status
= GetInfoFunction (CompressedBuffer
, CompressedLength
, &DstSize
, &ScratchSize
);
1356 if (EFI_ERROR (Status
)) {
1357 Error (NULL
, 0, 0003, "error getting compression info from compression section", NULL
);
1358 return EFI_SECTION_ERROR
;
1361 if (DstSize
!= UncompressedLength
) {
1362 Error (NULL
, 0, 0003, "compression error in the compression section", NULL
);
1363 return EFI_SECTION_ERROR
;
1366 ScratchBuffer
= malloc (ScratchSize
);
1367 UncompressedBuffer
= malloc (UncompressedLength
);
1368 if ((ScratchBuffer
== NULL
) || (UncompressedBuffer
== NULL
)) {
1369 return EFI_OUT_OF_RESOURCES
;
1371 Status
= DecompressFunction (
1379 free (ScratchBuffer
);
1380 if (EFI_ERROR (Status
)) {
1381 Error (NULL
, 0, 0003, "decompress failed", NULL
);
1382 free (UncompressedBuffer
);
1383 return EFI_SECTION_ERROR
;
1386 Error (NULL
, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType
);
1387 return EFI_SECTION_ERROR
;
1390 Status
= ParseSection (UncompressedBuffer
, UncompressedLength
);
1392 if (CompressionType
== EFI_STANDARD_COMPRESSION
) {
1394 // We need to deallocate Buffer
1396 free (UncompressedBuffer
);
1399 if (EFI_ERROR (Status
)) {
1400 Error (NULL
, 0, 0003, "failed to parse section", NULL
);
1401 return EFI_SECTION_ERROR
;
1405 case EFI_SECTION_GUID_DEFINED
:
1406 if (SectionHeaderLen
== sizeof(EFI_COMMON_SECTION_HEADER
)) {
1407 EfiGuid
= &((EFI_GUID_DEFINED_SECTION
*) Ptr
)->SectionDefinitionGuid
;
1408 DataOffset
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->DataOffset
;
1409 Attributes
= ((EFI_GUID_DEFINED_SECTION
*) Ptr
)->Attributes
;
1411 EfiGuid
= &((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->SectionDefinitionGuid
;
1412 DataOffset
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->DataOffset
;
1413 Attributes
= ((EFI_GUID_DEFINED_SECTION2
*) Ptr
)->Attributes
;
1415 printf (" SectionDefinitionGuid: ");
1416 PrintGuid (EfiGuid
);
1418 printf (" DataOffset: 0x%04X\n", (unsigned) DataOffset
);
1419 printf (" Attributes: 0x%04X\n", (unsigned) Attributes
);
1422 LookupGuidedSectionToolPath (
1423 mParsedGuidedSectionTools
,
1427 if (ExtractionTool
!= NULL
) {
1429 ToolInputFile
= CloneString (tmpnam (NULL
));
1430 ToolOutputFile
= CloneString (tmpnam (NULL
));
1432 char tmp1
[] = "/tmp/fileXXXXXX";
1433 char tmp2
[] = "/tmp/fileXXXXXX";
1436 fd1
= mkstemp(tmp1
);
1437 fd2
= mkstemp(tmp2
);
1438 ToolInputFile
= CloneString(tmp1
);
1439 ToolOutputFile
= CloneString(tmp2
);
1445 // Construction 'system' command string
1447 SystemCommandFormatString
= "%s -d -o %s %s";
1448 SystemCommand
= malloc (
1449 strlen (SystemCommandFormatString
) +
1450 strlen (ExtractionTool
) +
1451 strlen (ToolInputFile
) +
1452 strlen (ToolOutputFile
) +
1457 SystemCommandFormatString
,
1462 free (ExtractionTool
);
1467 (CHAR8
*) SectionBuffer
+ DataOffset
,
1468 BufferLength
- DataOffset
1471 system (SystemCommand
);
1472 remove (ToolInputFile
);
1473 free (ToolInputFile
);
1478 (CHAR8
**)&ToolOutputBuffer
,
1481 remove (ToolOutputFile
);
1482 free (ToolOutputFile
);
1483 if (EFI_ERROR (Status
)) {
1484 Error (NULL
, 0, 0004, "unable to read decoded GUIDED section", NULL
);
1485 return EFI_SECTION_ERROR
;
1488 Status
= ParseSection (
1492 if (EFI_ERROR (Status
)) {
1493 Error (NULL
, 0, 0003, "parse of decoded GUIDED section failed", NULL
);
1494 return EFI_SECTION_ERROR
;
1498 // Check for CRC32 sections which we can handle internally if needed.
1500 } else if (!CompareGuid (
1502 &gEfiCrc32GuidedSectionExtractionProtocolGuid
1506 // CRC32 guided section
1508 Status
= ParseSection (
1509 SectionBuffer
+ DataOffset
,
1510 BufferLength
- DataOffset
1512 if (EFI_ERROR (Status
)) {
1513 Error (NULL
, 0, 0003, "parse of CRC32 GUIDED section failed", NULL
);
1514 return EFI_SECTION_ERROR
;
1518 // We don't know how to parse it now.
1520 Error (NULL
, 0, 0003, "Error parsing section", \
1521 "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).");
1522 return EFI_UNSUPPORTED
;
1528 // Unknown section, return error
1530 Error (NULL
, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type
);
1531 return EFI_SECTION_ERROR
;
1534 ParsedLength
+= SectionLength
;
1536 // We make then next section begin on a 4-byte boundary
1538 ParsedLength
= GetOccupiedSize (ParsedLength
, 4);
1541 if (ParsedLength
< BufferLength
) {
1542 Error (NULL
, 0, 0003, "sections do not completely fill the sectioned buffer being parsed", NULL
);
1543 return EFI_SECTION_ERROR
;
1552 IN UINT32 SectionLength
1556 Routine Description:
1558 GC_TODO: Add function description
1562 Ptr - GC_TODO: add argument description
1563 SectionLength - GC_TODO: add argument description
1567 EFI_SUCCESS - GC_TODO: Add description for return value
1571 UINT8 GuidBuffer
[PRINTED_GUID_BUFFER_SIZE
];
1574 // Need at least a section header + data
1576 if (SectionLength
<= sizeof (EFI_COMMON_SECTION_HEADER
)) {
1580 Ptr
+= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1581 SectionLength
-= GetSectionHeaderLength((EFI_COMMON_SECTION_HEADER
*)Ptr
);
1582 while (SectionLength
> 0) {
1585 case EFI_DEP_BEFORE
:
1586 printf ("BEFORE\n");
1599 PrintGuidToBuffer ((EFI_GUID
*) (Ptr
+ 1), GuidBuffer
, sizeof (GuidBuffer
), TRUE
);
1600 printf ("%s ", GuidBuffer
);
1601 PrintGuidName (GuidBuffer
);
1604 // PrintGuid ((EFI_GUID *)(Ptr + 1));
1607 SectionLength
-= 17;
1641 printf ("END DEPEX\n");
1653 printf ("Unrecognized byte in depex: 0x%X\n", *Ptr
);
1667 Routine Description:
1669 GC_TODO: Add function description
1673 GuidStr - GC_TODO: add argument description
1677 EFI_SUCCESS - GC_TODO: Add description for return value
1678 EFI_INVALID_PARAMETER - GC_TODO: Add description for return value
1682 GUID_TO_BASENAME
*GPtr
;
1684 // If we have a list of guid-to-basenames, then go through the list to
1685 // look for a guid string match. If found, print the basename to stdout,
1686 // otherwise return a failure.
1688 GPtr
= mGuidBaseNameList
;
1689 while (GPtr
!= NULL
) {
1690 if (_stricmp ((CHAR8
*) GuidStr
, (CHAR8
*) GPtr
->Guid
) == 0) {
1691 printf ("%s", GPtr
->BaseName
);
1698 return EFI_INVALID_PARAMETER
;
1702 ParseGuidBaseNameFile (
1707 Routine Description:
1709 GC_TODO: Add function description
1713 FileName - GC_TODO: add argument description
1717 EFI_DEVICE_ERROR - GC_TODO: Add description for return value
1718 EFI_OUT_OF_RESOURCES - GC_TODO: Add description for return value
1719 EFI_SUCCESS - GC_TODO: Add description for return value
1724 CHAR8 Line
[MAX_LINE_LEN
];
1725 GUID_TO_BASENAME
*GPtr
;
1727 if ((Fptr
= fopen (LongFilePath (FileName
), "r")) == NULL
) {
1728 printf ("ERROR: Failed to open input cross-reference file '%s'\n", FileName
);
1729 return EFI_DEVICE_ERROR
;
1732 while (fgets (Line
, sizeof (Line
), Fptr
) != NULL
) {
1734 // Allocate space for another guid/basename element
1736 GPtr
= malloc (sizeof (GUID_TO_BASENAME
));
1738 return EFI_OUT_OF_RESOURCES
;
1741 memset ((char *) GPtr
, 0, sizeof (GUID_TO_BASENAME
));
1742 if (sscanf (Line
, "%s %s", GPtr
->Guid
, GPtr
->BaseName
) == 2) {
1743 GPtr
->Next
= mGuidBaseNameList
;
1744 mGuidBaseNameList
= GPtr
;
1747 // Some sort of error. Just continue.
1758 FreeGuidBaseNameList (
1763 Routine Description:
1765 GC_TODO: Add function description
1773 EFI_SUCCESS - GC_TODO: Add description for return value
1777 GUID_TO_BASENAME
*Next
;
1779 while (mGuidBaseNameList
!= NULL
) {
1780 Next
= mGuidBaseNameList
->Next
;
1781 free (mGuidBaseNameList
);
1782 mGuidBaseNameList
= Next
;
1791 LoadGuidedSectionToolsTxt (
1792 IN CHAR8
* FirmwareVolumeFilename
1795 CHAR8
* PeerFilename
;
1802 Places
[0] = FirmwareVolumeFilename
;
1803 //Places[1] = mUtilityFilename;
1805 mParsedGuidedSectionTools
= NULL
;
1807 for (Index
= 0; Index
< (sizeof(Places
)/sizeof(Places
[0])); Index
++) {
1808 PeerFilename
= OsPathPeerFilePath (Places
[Index
], "GuidedSectionTools.txt");
1809 //printf("Loading %s...\n", PeerFilename);
1810 if (OsPathExists (PeerFilename
)) {
1811 mParsedGuidedSectionTools
= ParseGuidedSectionToolsFile (PeerFilename
);
1813 free (PeerFilename
);
1814 if (mParsedGuidedSectionTools
!= NULL
) {
1827 Routine Description:
1829 GC_TODO: Add function description
1837 GC_TODO: add return values
1844 fprintf (stdout
, "Usage: %s [options] <input_file>\n\n", UTILITY_NAME
);
1847 // Copyright declaration
1849 fprintf (stdout
, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");
1850 fprintf (stdout
, " Display Tiano Firmware Volume FFS image information\n\n");
1855 fprintf (stdout
, "Options:\n");
1856 fprintf (stdout
, " -x xref, --xref xref\n\
1857 Parse basename to file-guid cross reference file(s).\n");
1858 fprintf (stdout
, " --offset offset\n\
1859 Offset of file to start processing FV at.\n");
1860 fprintf (stdout
, " -h, --help\n\
1861 Show this help message and exit.\n");