summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C')
-rw-r--r--BaseTools/Source/C/BootSectImage/bootsectimage.c36
-rw-r--r--BaseTools/Source/C/Common/BasePeCoff.c56
-rw-r--r--BaseTools/Source/C/Common/CommonLib.c6
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.c14
-rw-r--r--BaseTools/Source/C/Common/EfiUtilityMsgs.h4
-rw-r--r--BaseTools/Source/C/Common/MyAlloc.c56
-rw-r--r--BaseTools/Source/C/Common/ParseGuidedSectionTools.c1
-rw-r--r--BaseTools/Source/C/Common/ParseInf.c10
-rw-r--r--BaseTools/Source/C/Common/SimpleFileParsing.c14
-rw-r--r--BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c8
-rw-r--r--BaseTools/Source/C/EfiRom/EfiRom.c59
-rw-r--r--BaseTools/Source/C/GenBootSector/GenBootSector.c11
-rw-r--r--BaseTools/Source/C/GenCrc32/GenCrc32.c15
-rw-r--r--BaseTools/Source/C/GenFfs/GenFfs.c22
-rw-r--r--BaseTools/Source/C/GenFv/GenFv.c81
-rw-r--r--BaseTools/Source/C/GenFv/GenFvInternalLib.c256
-rw-r--r--BaseTools/Source/C/GenFw/GenFw.c145
-rw-r--r--BaseTools/Source/C/GenFw/elf_generic.h88
-rw-r--r--BaseTools/Source/C/GenPage/GenPage.c5
-rw-r--r--BaseTools/Source/C/GenSec/GenSec.c49
-rw-r--r--BaseTools/Source/C/GenVtf/GenVtf.c24
-rw-r--r--BaseTools/Source/C/GenVtf/GenVtf.h3
-rw-r--r--BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c11
-rw-r--r--BaseTools/Source/C/Include/Common/BaseTypes.h16
-rw-r--r--BaseTools/Source/C/Include/Common/PiFirmwareFile.h1
-rw-r--r--BaseTools/Source/C/Include/Common/UefiCapsule.h3
-rw-r--r--BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h2
-rw-r--r--BaseTools/Source/C/Include/Ia32/ProcessorBind.h4
-rw-r--r--BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h1
-rw-r--r--BaseTools/Source/C/LzmaCompress/LzmaCompress.c2
-rw-r--r--BaseTools/Source/C/Makefiles/header.makefile2
-rw-r--r--BaseTools/Source/C/Makefiles/ms.common2
-rw-r--r--BaseTools/Source/C/Split/Split.c4
-rw-r--r--BaseTools/Source/C/TianoCompress/TianoCompress.c11
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrError.cpp6
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp11
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrFormPkg.h35
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrSyntax.g178
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp4
-rw-r--r--BaseTools/Source/C/VfrCompile/VfrUtilityLib.h5
-rw-r--r--BaseTools/Source/C/VolInfo/VolInfo.c35
41 files changed, 689 insertions, 607 deletions
diff --git a/BaseTools/Source/C/BootSectImage/bootsectimage.c b/BaseTools/Source/C/BootSectImage/bootsectimage.c
index 10a545292b..d8dc8907a5 100644
--- a/BaseTools/Source/C/BootSectImage/bootsectimage.c
+++ b/BaseTools/Source/C/BootSectImage/bootsectimage.c
@@ -371,13 +371,13 @@ Return:
if ((FatType == FatTypeFat32) &&
(FatBpb->Fat12_16.BPB_TotSec32 == 0)) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_TotSec32 - %04x, expected: Non-Zero",
- FatBpb->Fat12_16.BPB_TotSec32);
+ (unsigned) FatBpb->Fat12_16.BPB_TotSec32);
return FatTypeUnknown;
}
if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_FATSz32 == 0)) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_FATSz32 - %08x, expected: Non-Zero",
- FatBpb->Fat32.BPB_FATSz32);
+ (unsigned) FatBpb->Fat32.BPB_FATSz32);
return FatTypeUnknown;
}
if ((FatType == FatTypeFat32) &&
@@ -388,7 +388,7 @@ Return:
if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_RootClus != 2)) {
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT32 - BPB_RootClus - %08x, expected: %04x",
- FatBpb->Fat32.BPB_RootClus, 2);
+ (unsigned) FatBpb->Fat32.BPB_RootClus, 2);
}
if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_FSInfo != 1)) {
@@ -523,14 +523,14 @@ ParseBootSector (
printf (" 16 Sectors per FAT (small vol.) %04x\n", FatBpb.Fat12_16.BPB_FATSz16);
printf (" 18 Sectors per track %04x\n", FatBpb.Fat12_16.BPB_SecPerTrk);
printf (" 1A Heads %04x\n", FatBpb.Fat12_16.BPB_NumHeads);
- printf (" 1C Hidden sectors %08x\n", FatBpb.Fat12_16.BPB_HiddSec);
- printf (" 20 Sectors (over 32MB) %08x\n", FatBpb.Fat12_16.BPB_TotSec32);
+ printf (" 1C Hidden sectors %08x\n", (unsigned) FatBpb.Fat12_16.BPB_HiddSec);
+ printf (" 20 Sectors (over 32MB) %08x\n", (unsigned) FatBpb.Fat12_16.BPB_TotSec32);
printf ("\n");
if (FatType != FatTypeFat32) {
printf (" 24 BIOS drive %02x\n", FatBpb.Fat12_16.BS_DrvNum);
printf (" 25 (Unused) %02x\n", FatBpb.Fat12_16.BS_Reserved1);
printf (" 26 Ext. boot signature %02x\n", FatBpb.Fat12_16.BS_BootSig);
- printf (" 27 Volume serial number %08x\n", FatBpb.Fat12_16.BS_VolID);
+ printf (" 27 Volume serial number %08x\n", (unsigned) FatBpb.Fat12_16.BS_VolID);
printf (" 2B Volume lable %c%c%c%c%c%c%c%c%c%c%c\n",
FatBpb.Fat12_16.BS_VolLab[0],
FatBpb.Fat12_16.BS_VolLab[1],
@@ -555,10 +555,10 @@ ParseBootSector (
printf ("\n");
} else {
printf ("FAT32 Section\n");
- printf (" 24 Sectors per FAT (large vol.) %08x\n", FatBpb.Fat32.BPB_FATSz32);
+ printf (" 24 Sectors per FAT (large vol.) %08x\n", (unsigned) FatBpb.Fat32.BPB_FATSz32);
printf (" 28 Flags %04x\n", FatBpb.Fat32.BPB_ExtFlags);
printf (" 2A Version %04x\n", FatBpb.Fat32.BPB_FSVer);
- printf (" 2C Root dir 1st cluster %08x\n", FatBpb.Fat32.BPB_RootClus);
+ printf (" 2C Root dir 1st cluster %08x\n", (unsigned) FatBpb.Fat32.BPB_RootClus);
printf (" 30 FSInfo sector %04x\n", FatBpb.Fat32.BPB_FSInfo);
printf (" 32 Backup boot sector %04x\n", FatBpb.Fat32.BPB_BkBootSec);
printf (" 34 (Reserved) %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
@@ -578,7 +578,7 @@ ParseBootSector (
printf (" 40 BIOS drive %02x\n", FatBpb.Fat32.BS_DrvNum);
printf (" 41 (Unused) %02x\n", FatBpb.Fat32.BS_Reserved1);
printf (" 42 Ext. boot signature %02x\n", FatBpb.Fat32.BS_BootSig);
- printf (" 43 Volume serial number %08x\n", FatBpb.Fat32.BS_VolID);
+ printf (" 43 Volume serial number %08x\n", (unsigned) FatBpb.Fat32.BS_VolID);
printf (" 47 Volume lable %c%c%c%c%c%c%c%c%c%c%c\n",
FatBpb.Fat32.BS_VolLab[0],
FatBpb.Fat32.BS_VolLab[1],
@@ -738,7 +738,7 @@ ParseMbr (
printf (" Offset Title Value\n");
printf ("==================================================================\n");
printf (" 0 Master bootstrap loader code (not list)\n");
- printf (" 1B8 Windows disk signature %08x\n", Mbr.UniqueMbrSignature);
+ printf (" 1B8 Windows disk signature %08x\n", (unsigned) Mbr.UniqueMbrSignature);
printf ("\n");
printf ("Partition Table Entry #1\n");
printf (" 1BE 80 = active partition %02x\n", Mbr.PartitionRecord[0].BootIndicator);
@@ -749,8 +749,8 @@ ParseMbr (
printf (" 1C3 End head %02x\n", Mbr.PartitionRecord[0].EndHead);
printf (" 1C4 End sector %02x\n", Mbr.PartitionRecord[0].EndSector);
printf (" 1C5 End cylinder %02x\n", Mbr.PartitionRecord[0].EndTrack);
- printf (" 1C6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[0].StartingLBA);
- printf (" 1CA Sectors in partition %08x\n", Mbr.PartitionRecord[0].SizeInLBA);
+ printf (" 1C6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[0].StartingLBA);
+ printf (" 1CA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[0].SizeInLBA);
printf ("\n");
printf ("Partition Table Entry #2\n");
printf (" 1CE 80 = active partition %02x\n", Mbr.PartitionRecord[1].BootIndicator);
@@ -761,8 +761,8 @@ ParseMbr (
printf (" 1D3 End head %02x\n", Mbr.PartitionRecord[1].EndHead);
printf (" 1D4 End sector %02x\n", Mbr.PartitionRecord[1].EndSector);
printf (" 1D5 End cylinder %02x\n", Mbr.PartitionRecord[1].EndTrack);
- printf (" 1D6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[1].StartingLBA);
- printf (" 1DA Sectors in partition %08x\n", Mbr.PartitionRecord[1].SizeInLBA);
+ printf (" 1D6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[1].StartingLBA);
+ printf (" 1DA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[1].SizeInLBA);
printf ("\n");
printf ("Partition Table Entry #3\n");
printf (" 1DE 80 = active partition %02x\n", Mbr.PartitionRecord[2].BootIndicator);
@@ -773,8 +773,8 @@ ParseMbr (
printf (" 1E3 End head %02x\n", Mbr.PartitionRecord[2].EndHead);
printf (" 1E4 End sector %02x\n", Mbr.PartitionRecord[2].EndSector);
printf (" 1E5 End cylinder %02x\n", Mbr.PartitionRecord[2].EndTrack);
- printf (" 1E6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[2].StartingLBA);
- printf (" 1EA Sectors in partition %08x\n", Mbr.PartitionRecord[2].SizeInLBA);
+ printf (" 1E6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[2].StartingLBA);
+ printf (" 1EA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[2].SizeInLBA);
printf ("\n");
printf ("Partition Table Entry #4\n");
printf (" 1EE 80 = active partition %02x\n", Mbr.PartitionRecord[3].BootIndicator);
@@ -785,8 +785,8 @@ ParseMbr (
printf (" 1F3 End head %02x\n", Mbr.PartitionRecord[3].EndHead);
printf (" 1F4 End sector %02x\n", Mbr.PartitionRecord[3].EndSector);
printf (" 1F5 End cylinder %02x\n", Mbr.PartitionRecord[3].EndTrack);
- printf (" 1F6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[3].StartingLBA);
- printf (" 1FA Sectors in partition %08x\n", Mbr.PartitionRecord[3].SizeInLBA);
+ printf (" 1F6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[3].StartingLBA);
+ printf (" 1FA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[3].SizeInLBA);
printf ("\n");
printf (" 1FE Signature %04x\n", Mbr.Signature);
printf ("\n");
diff --git a/BaseTools/Source/C/Common/BasePeCoff.c b/BaseTools/Source/C/Common/BasePeCoff.c
index 72b6a52f89..0166c22460 100644
--- a/BaseTools/Source/C/Common/BasePeCoff.c
+++ b/BaseTools/Source/C/Common/BasePeCoff.c
@@ -856,6 +856,7 @@ Returns:
PeHdr = NULL;
TeHdr = NULL;
+ OptionHeader.Header = NULL;
//
// Assume success
//
@@ -1252,11 +1253,11 @@ PeCoffLoaderGetPdbPointer (
//
// Get the DebugEntry offset in the raw data image.
//
- SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
- Index = Hdr.Te->NumberOfSections;
+ SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (Hdr.Te + 1);
+ Index = Hdr.Te->NumberOfSections;
for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *)((UINTN) Hdr.Te +
DirectoryEntry->VirtualAddress -
SectionHeader [Index1].VirtualAddress +
@@ -1324,8 +1325,8 @@ PeCoffLoaderGetPdbPointer (
// Get the DebugEntry offset in the raw data image.
//
for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
- (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ if ((DirectoryEntry->VirtualAddress >= SectionHeader[Index1].VirtualAddress) &&
+ (DirectoryEntry->VirtualAddress < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (
(UINTN) Pe32Data +
DirectoryEntry->VirtualAddress -
@@ -1349,27 +1350,28 @@ PeCoffLoaderGetPdbPointer (
for (DirCount = 0; DirCount < DirectoryEntry->Size; DirCount += sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY), DebugEntry++) {
if (EFI_IMAGE_DEBUG_TYPE_CODEVIEW == DebugEntry->Type) {
if (DebugEntry->SizeOfData > 0) {
- //
- // Get the DebugEntry offset in the raw data image.
- //
- for (Index1 = 0; Index1 < Index; Index1 ++) {
- if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
- (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
- CodeViewEntryPointer = (VOID *) (
- ((UINTN)Pe32Data) +
- (UINTN) DebugEntry->RVA -
- SectionHeader[Index1].VirtualAddress +
- SectionHeader[Index1].PointerToRawData +
- (UINTN)TEImageAdjust);
- break;
- }
- }
- if (Index1 >= Index) {
- //
- // Can't find CodeViewEntryPointer in raw PE/COFF image.
- //
- continue;
- }
+ //
+ // Get the DebugEntry offset in the raw data image.
+ //
+ CodeViewEntryPointer = NULL;
+ for (Index1 = 0; Index1 < Index; Index1 ++) {
+ if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
+ (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {
+ CodeViewEntryPointer = (VOID *) (
+ ((UINTN)Pe32Data) +
+ (UINTN) DebugEntry->RVA -
+ SectionHeader[Index1].VirtualAddress +
+ SectionHeader[Index1].PointerToRawData +
+ (UINTN)TEImageAdjust);
+ break;
+ }
+ }
+ if (Index1 >= Index) {
+ //
+ // Can't find CodeViewEntryPointer in raw PE/COFF image.
+ //
+ continue;
+ }
switch (* (UINT32 *) CodeViewEntryPointer) {
case CODEVIEW_SIGNATURE_NB10:
return (VOID *) ((CHAR8 *)CodeViewEntryPointer + sizeof (EFI_IMAGE_DEBUG_CODEVIEW_NB10_ENTRY));
diff --git a/BaseTools/Source/C/Common/CommonLib.c b/BaseTools/Source/C/Common/CommonLib.c
index 970b2af27b..a0c6603a85 100644
--- a/BaseTools/Source/C/Common/CommonLib.c
+++ b/BaseTools/Source/C/Common/CommonLib.c
@@ -472,7 +472,7 @@ Returns:
printf (
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
@@ -529,7 +529,7 @@ Returns:
sprintf (
(CHAR8 *)Buffer,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
@@ -545,7 +545,7 @@ Returns:
sprintf (
(CHAR8 *)Buffer,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
- Guid->Data1,
+ (unsigned) Guid->Data1,
Guid->Data2,
Guid->Data3,
Guid->Data4[0],
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.c b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
index 9d697da82d..68cf02469e 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.c
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.c
@@ -34,7 +34,7 @@ Abstract:
//
STATIC STATUS mStatus = STATUS_SUCCESS;
STATIC CHAR8 mUtilityName[50] = { 0 };
-STATIC UINT32 mPrintLogLevel = INFO_LOG_LEVEL;
+STATIC UINT64 mPrintLogLevel = INFO_LOG_LEVEL;
STATIC CHAR8 *mSourceFileName = NULL;
STATIC UINT32 mSourceFileLineNum = 0;
STATIC UINT32 mErrorCount = 0;
@@ -355,7 +355,7 @@ VOID
DebugMsg (
CHAR8 *FileName,
UINT32 LineNumber,
- UINT32 MsgLevel,
+ UINT64 MsgLevel,
CHAR8 *Text,
CHAR8 *MsgFmt,
...
@@ -495,7 +495,7 @@ Notes:
if (Cptr != NULL) {
sprintf (Line, ": %s", Cptr);
if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2);
}
}
@@ -509,7 +509,7 @@ Notes:
}
sprintf (Line, "%s", Cptr);
if (LineNumber != 0) {
- sprintf (Line2, "(%d)", LineNumber);
+ sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2);
}
} else {
@@ -524,7 +524,7 @@ Notes:
// message for you. It has to be decimal digits too.
//
if (MessageCode != 0) {
- sprintf (Line2, ": %s %04d", Type, MessageCode);
+ sprintf (Line2, ": %s %04u", Type, (unsigned) MessageCode);
} else {
sprintf (Line2, ": %s", Type);
}
@@ -665,7 +665,7 @@ Returns:
VOID
SetPrintLevel (
- UINT32 LogLevel
+ UINT64 LogLevel
)
/*++
@@ -843,7 +843,7 @@ TestUtilityMessages (
)
{
CHAR8 *ArgStr = "ArgString";
- INTN ArgInt;
+ int ArgInt;
ArgInt = 0x12345678;
//
diff --git a/BaseTools/Source/C/Common/EfiUtilityMsgs.h b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
index 6c2f9d2989..40e6e170ae 100644
--- a/BaseTools/Source/C/Common/EfiUtilityMsgs.h
+++ b/BaseTools/Source/C/Common/EfiUtilityMsgs.h
@@ -96,7 +96,7 @@ VOID
DebugMsg (
CHAR8 *FileName,
UINT32 LineNumber,
- UINT32 MsgLevel,
+ UINT64 MsgLevel,
CHAR8 *OffendingText,
CHAR8 *MsgFmt,
...
@@ -123,7 +123,7 @@ KeyMsg (
VOID
SetPrintLevel (
- UINT32 LogLevel
+ UINT64 LogLevel
);
VOID
diff --git a/BaseTools/Source/C/Common/MyAlloc.c b/BaseTools/Source/C/Common/MyAlloc.c
index b53713941c..64c5ff783e 100644
--- a/BaseTools/Source/C/Common/MyAlloc.c
+++ b/BaseTools/Source/C/Common/MyAlloc.c
@@ -86,7 +86,7 @@ MyCheck (
"Invalid parameter(s).\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -98,7 +98,7 @@ MyCheck (
"Invalid parameter.\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -121,12 +121,12 @@ MyCheck (
"\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Final,
File,
- (UINT32)Line,
+ (unsigned)Line,
Tmp->File,
- (UINT32)Tmp->Line,
- (UINT32)Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
);
exit (1);
@@ -141,17 +141,17 @@ MyCheck (
"\nSome allocated items have not been freed.\n",
Final,
File,
- (UINT32)Line
+ (unsigned)Line
);
for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
printf (
"File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Tmp->File,
- (UINT32)Tmp->Line,
- (UINT32)Tmp->Size,
- *(UINT32 *) (Tmp->Buffer),
- *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
+ (unsigned) Tmp->Line,
+ (unsigned) Tmp->Size,
+ (unsigned) *(UINT32 *) (Tmp->Buffer),
+ (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
);
}
}
@@ -201,9 +201,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -214,9 +214,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -238,9 +238,9 @@ MyAlloc (
printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nOut of memory.\n",
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -315,9 +315,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -328,9 +328,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -349,9 +349,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nCould not find buffer.\n",
Ptr,
- (UINT32)Size,
+ (unsigned)Size,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -421,7 +421,7 @@ MyFree (
"\nInvalid parameter(s).\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -433,7 +433,7 @@ MyFree (
"\nInvalid parameter.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -453,7 +453,7 @@ MyFree (
"\nCalled before memory allocated.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
@@ -486,7 +486,7 @@ MyFree (
"\nNot found.\n",
Ptr,
File,
- (UINT32)Line
+ (unsigned)Line
);
exit (1);
diff --git a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
index 02d0b11f0d..b643cdeb4f 100644
--- a/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
+++ b/BaseTools/Source/C/Common/ParseGuidedSectionTools.c
@@ -122,6 +122,7 @@ Returns:
GUID_SEC_TOOL_ENTRY *NewGuidTool;
FirstGuidTool = NULL;
+ LastGuidTool = NULL;
while (TRUE) {
NextLine = ReadMemoryFileLine (InputFile);
diff --git a/BaseTools/Source/C/Common/ParseInf.c b/BaseTools/Source/C/Common/ParseInf.c
index 8305f14aef..b39c5bde40 100644
--- a/BaseTools/Source/C/Common/ParseInf.c
+++ b/BaseTools/Source/C/Common/ParseInf.c
@@ -379,10 +379,10 @@ Returns:
--*/
{
INT32 Index;
- UINT32 Data1;
- UINT32 Data2;
- UINT32 Data3;
- UINT16 Data4[8];
+ unsigned Data1;
+ unsigned Data2;
+ unsigned Data3;
+ unsigned Data4[8];
if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
return EFI_INVALID_PARAMETER;
@@ -416,7 +416,7 @@ Returns:
//
Index = sscanf (
AsciiGuidBuffer,
- "%08x-%04x-%04x-%02hx%02hx-%02hx%02hx%02hx%02hx%02hx%02hx",
+ "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&Data1,
&Data2,
&Data3,
diff --git a/BaseTools/Source/C/Common/SimpleFileParsing.c b/BaseTools/Source/C/Common/SimpleFileParsing.c
index 52ec129193..5a7111c8eb 100644
--- a/BaseTools/Source/C/Common/SimpleFileParsing.c
+++ b/BaseTools/Source/C/Common/SimpleFileParsing.c
@@ -536,7 +536,7 @@ Returns:
--*/
{
- UINT32 Val;
+ unsigned Val;
SkipWhiteSpace (&mGlobals.SourceFile);
if (EndOfFile (&mGlobals.SourceFile)) {
@@ -554,7 +554,7 @@ Returns:
mGlobals.SourceFile.FileBufferPtr += 2;
sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);
- *Value = Val;
+ *Value = (UINT32) Val;
while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
mGlobals.SourceFile.FileBufferPtr++;
}
@@ -634,7 +634,7 @@ Returns:
// depth.
//
if (mGlobals.VerboseFile) {
- fprintf (stdout, "%*cProcessing file '%s'\n", (INT32)NestDepth * 2, ' ', SourceFile->FileName);
+ fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);
fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);
}
@@ -642,7 +642,7 @@ Returns:
// Make sure we didn't exceed our maximum nesting depth
//
if (NestDepth > MAX_NEST_DEPTH) {
- Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%d)", SourceFile->FileName, NestDepth);
+ Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);
Status = STATUS_ERROR;
goto Finish;
}
@@ -698,7 +698,7 @@ Returns:
fseek (SourceFile->Fptr, 0, SEEK_END);
SourceFile->FileSize = ftell (SourceFile->Fptr);
if (mGlobals.VerboseFile) {
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);
+ printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);
}
fseek (SourceFile->Fptr, 0, SEEK_SET);
@@ -819,7 +819,7 @@ Returns:
}
printf ("'\n");
- printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize);
+ printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);
RewindFile (SourceFile);
}
}
@@ -1282,7 +1282,7 @@ Returns:
--*/
{
- UINT32 Value32;
+ unsigned Value32;
UINT32 Index;
FILE_POSITION FPos;
CHAR8 TempString[20];
diff --git a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
index 3591a4d71b..c2c8111d31 100644
--- a/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
+++ b/BaseTools/Source/C/EfiLdrImage/EfiLdrImage.c
@@ -131,7 +131,7 @@ Return:
UINT64 : file size of input file
--*/
{
- UINT64 filesize, offset, length;
+ UINT32 filesize, offset, length;
CHAR8 Buffer[8*1024];
fseek (in, 0, SEEK_END);
@@ -252,7 +252,7 @@ Returns:
continue;
}
//
- // Don't recognize the paramter, should be regarded as the input file name.
+ // Don't recognize the parameter, should be regarded as the input file name.
//
InputFileNames[InputFileCount] = argv[0];
InputFileCount++;
@@ -309,9 +309,9 @@ Returns:
// And in the same time update the EfiLdrHeader and EfiLdrImage array
//
EfiLdrImage[i].Offset = EfiLdrHeader.FileLength;
- EfiLdrImage[i].Length = filesize;
+ EfiLdrImage[i].Length = (UINT32) filesize;
strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1);
- EfiLdrHeader.FileLength += filesize;
+ EfiLdrHeader.FileLength += (UINT32) filesize;
EfiLdrHeader.NumberOfImages++;
}
diff --git a/BaseTools/Source/C/EfiRom/EfiRom.c b/BaseTools/Source/C/EfiRom/EfiRom.c
index d9c2e7c1c1..d43520ae47 100644
--- a/BaseTools/Source/C/EfiRom/EfiRom.c
+++ b/BaseTools/Source/C/EfiRom/EfiRom.c
@@ -88,8 +88,8 @@ Returns:
// If dumping an image, then do that and quit
//
if (mOptions.DumpOption == 1) {
- for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) {
- if ((Ptr0 = strstr ((CONST CHAR8 *)FList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {
+ if (mOptions.FileList != NULL) {
+ if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {
DumpImage (mOptions.FileList);
goto BailOut;
} else {
@@ -163,7 +163,7 @@ Returns:
}
if (mOptions.Verbose) {
- VerboseMsg(" Output size = 0x%X\n", Size);
+ VerboseMsg(" Output size = 0x%X\n", (unsigned) Size);
}
if (Status != STATUS_SUCCESS) {
@@ -238,7 +238,8 @@ Returns:
UINT32 Index;
UINT8 ByteCheckSum;
-
+ PciDs23 = NULL;
+ PciDs30 = NULL;
Status = STATUS_SUCCESS;
//
@@ -255,7 +256,7 @@ Returns:
fseek (InFptr, 0, SEEK_END);
FileSize = ftell (InFptr);
if (mOptions.Verbose) {
- VerboseMsg(" File size = 0x%X\n", FileSize);
+ VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
}
fseek (InFptr, 0, SEEK_SET);
@@ -365,7 +366,7 @@ Returns:
Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
if (mOptions.Verbose) {
- VerboseMsg(" Checksum = %02x\n\n", (UINT32) Buffer[FileSize - 1]);
+ VerboseMsg(" Checksum = %02x\n\n", Buffer[FileSize - 1]);
}
//
@@ -495,7 +496,7 @@ Returns:
}
if (mOptions.Verbose) {
- VerboseMsg(" File size = 0x%X\n", FileSize);
+ VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
}
//
// Allocate memory for the entire file (in case we have to compress), then
@@ -540,7 +541,7 @@ Returns:
// Now compute the size, then swap buffer pointers.
//
if (mOptions.Verbose) {
- VerboseMsg(" Comp size = 0x%X\n", CompressedFileSize);
+ VerboseMsg(" Comp size = 0x%X\n", (unsigned) CompressedFileSize);
}
TotalSize = CompressedFileSize + HeaderSize;
@@ -820,7 +821,7 @@ Returns:
}
if (mOptions.Verbose) {
- VerboseMsg(" Got subsystem = 0x%X from image\n", (int) *SubSystem);
+ VerboseMsg(" Got subsystem = 0x%X from image\n", *SubSystem);
}
//
@@ -999,7 +1000,7 @@ Returns:
return 1;
}
if (DebugLevel > 9) {
- Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", Argv[1]);
+ Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, current input level is %d", Argv[1]);
return 1;
}
if (DebugLevel>=5 && DebugLevel<=9) {
@@ -1301,10 +1302,10 @@ Returns:
//
// Dump the contents of the header
//
- fprintf (stdout, "Image %d -- Offset 0x%X\n", ImageCount, ImageStart);
+ fprintf (stdout, "Image %u -- Offset 0x%X\n", (unsigned) ImageCount, (unsigned) ImageStart);
fprintf (stdout, " ROM header contents\n");
- fprintf (stdout, " Signature 0x%04X\n", (UINT32) PciRomHdr.Signature);
- fprintf (stdout, " PCIR offset 0x%04X\n", (UINT32) PciRomHdr.PcirOffset);
+ fprintf (stdout, " Signature 0x%04X\n", PciRomHdr.Signature);
+ fprintf (stdout, " PCIR offset 0x%04X\n", PciRomHdr.PcirOffset);
//
// Find PCI data structure
//
@@ -1349,11 +1350,11 @@ Returns:
fprintf (
stdout,
" Class Code 0x%06X\n",
- (UINT32) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))
+ (unsigned) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))
);
- fprintf (stdout, " Image size 0x%X\n", PciDs23.ImageLength * 512);
+ fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs23.ImageLength * 512);
fprintf (stdout, " Code revision: 0x%04X\n", PciDs23.CodeRevision);
- fprintf (stdout, " Indicator 0x%02X", (UINT32) PciDs23.Indicator);
+ fprintf (stdout, " Indicator 0x%02X", PciDs23.Indicator);
} else {
fprintf (
stdout,
@@ -1367,18 +1368,18 @@ Returns:
fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId);
fprintf (stdout, " Length 0x%04X\n", PciDs30.Length);
fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision);
- fprintf (stdout, " DeviceListOffset 0x%02X\n", (UINT32) PciDs30.DeviceListOffset);
+ fprintf (stdout, " DeviceListOffset 0x%02X\n", PciDs30.DeviceListOffset);
fprintf (
stdout,
" Class Code 0x%06X\n",
- (UINT32) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))
+ (unsigned) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))
);
- fprintf (stdout, " Image size 0x%X\n", PciDs30.ImageLength * 512);
+ fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs30.ImageLength * 512);
fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision);
- fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", (UINT32) PciDs30.MaxRuntimeImageLength);
- fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", (UINT32) PciDs30.ConfigUtilityCodeHeaderOffset);
- fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", (UINT32) PciDs30.DMTFCLPEntryPointOffset);
- fprintf (stdout, " Indicator 0x%02X", (UINT32) PciDs30.Indicator);
+ fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", PciDs30.MaxRuntimeImageLength);
+ fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
+ fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
+ fprintf (stdout, " Indicator 0x%02X", PciDs30.Indicator);
}
//
// Print the indicator, used to flag the last image
@@ -1392,9 +1393,9 @@ Returns:
// Print the code type. If EFI code, then we can provide more info.
//
if (mOptions.Pci23 == 1) {
- fprintf (stdout, " Code type 0x%02X", (UINT32) PciDs23.CodeType);
+ fprintf (stdout, " Code type 0x%02X", PciDs23.CodeType);
} else {
- fprintf (stdout, " Code type 0x%02X", (UINT32) PciDs30.CodeType);
+ fprintf (stdout, " Code type 0x%02X", PciDs30.CodeType);
}
if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
fprintf (stdout, " (EFI image)\n");
@@ -1414,11 +1415,11 @@ Returns:
//
// Now dump more info
//
- fprintf (stdout, " EFI Signature 0x%04X\n", EfiRomHdr.EfiSignature);
+ fprintf (stdout, " EFI Signature 0x%04X\n", (unsigned) EfiRomHdr.EfiSignature);
fprintf (
stdout,
" Compression Type 0x%04X ",
- (UINT32) EfiRomHdr.CompressionType
+ EfiRomHdr.CompressionType
);
if (EfiRomHdr.CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
fprintf (stdout, "(compressed)\n");
@@ -1441,8 +1442,8 @@ Returns:
fprintf (
stdout,
" EFI image offset 0x%04X (@0x%X)\n",
- (UINT32) EfiRomHdr.EfiImageHeaderOffset,
- (UINT32) (EfiRomHdr.EfiImageHeaderOffset + ImageStart)
+ EfiRomHdr.EfiImageHeaderOffset,
+ EfiRomHdr.EfiImageHeaderOffset + (unsigned) ImageStart
);
} else {
diff --git a/BaseTools/Source/C/GenBootSector/GenBootSector.c b/BaseTools/Source/C/GenBootSector/GenBootSector.c
index 47b5c5c67a..05839bb736 100644
--- a/BaseTools/Source/C/GenBootSector/GenBootSector.c
+++ b/BaseTools/Source/C/GenBootSector/GenBootSector.c
@@ -26,6 +26,9 @@ Abstract:
#include <string.h>
#include <Common/UefiBaseTypes.h>
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+
//
// Utility Name
//
@@ -259,9 +262,9 @@ Routine Description:
} else {
fprintf (
stdout,
- "%c: - DiskNum: %d, Type: %s\n",
+ "%c: - DiskNum: %u, Type: %s\n",
DriveInfo.VolumeLetter,
- DriveInfo.DiskNumber,
+ (unsigned) DriveInfo.DiskNumber,
DriveInfo.DriveType->Description
);
}
@@ -438,11 +441,9 @@ ProcessBsOrMbr (
BYTE DiskPartition[0x200] = {0};
BYTE DiskPartitionBackup[0x200] = {0};
DWORD BytesReturn;
- DWORD DbrOffset;
INT DrvNumOffset;
HANDLE InputHandle;
HANDLE OutputHandle;
- BOOL WriteToDisk;
ERROR_STATUS Status;
DWORD InputDbrOffset;
DWORD OutputDbrOffset;
@@ -731,7 +732,7 @@ main (
return 1;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
return 1;
}
SetPrintLevel (LogLevel);
diff --git a/BaseTools/Source/C/GenCrc32/GenCrc32.c b/BaseTools/Source/C/GenCrc32/GenCrc32.c
index 63900b6461..a94f9202fe 100644
--- a/BaseTools/Source/C/GenCrc32/GenCrc32.c
+++ b/BaseTools/Source/C/GenCrc32/GenCrc32.c
@@ -22,6 +22,7 @@ Abstract:
#include <stdlib.h>
#include <string.h>
+#include "ParseInf.h"
#include "EfiUtilityMsgs.h"
#include "CommonLib.h"
#include "Crc32.h"
@@ -104,7 +105,7 @@ Returns:
int
main (
- INT32 argc,
+ int argc,
CHAR8 *argv[]
)
/*++
@@ -222,7 +223,7 @@ Returns:
goto Finish;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
goto Finish;
}
SetPrintLevel (LogLevel);
@@ -294,7 +295,7 @@ Returns:
fread (FileBuffer, 1, FileSize, InFile);
fclose (InFile);
- VerboseMsg ("the size of the input file is %d bytes", FileSize);
+ VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
//
// Open output file
@@ -318,9 +319,9 @@ Returns:
// Done, write output file.
//
fwrite (&Crc32Value, 1, sizeof (Crc32Value), OutFile);
- VerboseMsg ("The calculated CRC32 value is 0x%08x", Crc32Value);
+ VerboseMsg ("The calculated CRC32 value is 0x%08x", (unsigned) Crc32Value);
fwrite (FileBuffer, 1, FileSize, OutFile);
- VerboseMsg ("the size of the encoded file is %d bytes", FileSize + sizeof (UINT32));
+ VerboseMsg ("the size of the encoded file is %u bytes", (unsigned) FileSize + sizeof (UINT32));
} else {
//
// Verify Crc32 Value
@@ -330,7 +331,7 @@ Returns:
Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
goto Finish;
}
- VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", Crc32Value, *(UINT32 *)FileBuffer);
+ VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", (unsigned) Crc32Value, (unsigned) (*(UINT32 *)FileBuffer));
if (Crc32Value != *(UINT32 *)FileBuffer) {
Error (NULL, 0, 3000, "Invalid", "CRC32 value of input file is not correct!");
Status = STATUS_ERROR;
@@ -340,7 +341,7 @@ Returns:
// Done, write output file.
//
fwrite (FileBuffer + sizeof (UINT32), 1, FileSize - sizeof (UINT32), OutFile);
- VerboseMsg ("the size of the decoded file is %d bytes", FileSize - sizeof (UINT32));
+ VerboseMsg ("the size of the decoded file is %u bytes", (unsigned) FileSize - sizeof (UINT32));
}
Finish:
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c
index e8cd09e947..12a3b2f18c 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -322,7 +322,7 @@ Returns:
FileSize = ftell (InFile);
fseek (InFile, 0, SEEK_SET);
DebugMsg (NULL, 0, 9, "Input section files",
- "the input section name is %s and the size is %d bytes", InputFileName[Index], FileSize);
+ "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
//
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
@@ -374,7 +374,7 @@ Returns:
SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
}
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
- "Pad Raw section size is %d", Offset);
+ "Pad Raw section size is %u", (unsigned) Offset);
Size = Size + Offset;
}
@@ -409,7 +409,7 @@ Returns:
int
main (
- INT32 argc,
+ int argc,
CHAR8 *argv[]
)
/*++
@@ -679,7 +679,7 @@ Returns:
goto Finish;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
goto Finish;
}
SetPrintLevel (LogLevel);
@@ -719,7 +719,7 @@ Returns:
VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
VerboseMsg ("Output file name is %s", OutputFileName);
VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- FileGuid.Data1,
+ (unsigned) FileGuid.Data1,
FileGuid.Data2,
FileGuid.Data3,
FileGuid.Data4[0],
@@ -744,7 +744,7 @@ Returns:
//
InputFileAlign[Index] = 1;
}
- VerboseMsg ("the %dth input section name is %s and section alignment is %d", Index, InputFileName[Index], InputFileAlign[Index]);
+ VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
}
//
@@ -763,7 +763,7 @@ Returns:
if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
- Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %d Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
+ Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
goto Finish;
}
@@ -810,7 +810,7 @@ Returns:
//
// Update FFS Alignment based on the max alignment required by input section files
//
- VerboseMsg ("the max alignment of all input sections is %d", MaxAlignment);
+ VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
break;
@@ -819,14 +819,14 @@ Returns:
if (FfsAlign < Index) {
FfsAlign = Index;
}
- VerboseMsg ("the alignment of the genreated FFS file is %d", mFfsValidAlign [FfsAlign + 1]);
- FfsFileHeader.Attributes = FfsAttrib | (FfsAlign << 3);
+ VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
+ FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));
//
// Now FileSize includes the EFI_FFS_FILE_HEADER
//
FileSize += sizeof (EFI_FFS_FILE_HEADER);
- VerboseMsg ("the size of the genreated FFS file is %d bytes", FileSize);
+ VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize);
FfsFileHeader.Size[0] = (UINT8) (FileSize & 0xFF);
FfsFileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);
FfsFileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);
diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c
index e080422e54..f2ff2d29cd 100644
--- a/BaseTools/Source/C/GenFv/GenFv.c
+++ b/BaseTools/Source/C/GenFv/GenFv.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2007 - 2008, Intel Corporation
+Copyright (c) 2007 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -141,7 +141,7 @@ Returns:
fprintf (stdout, " --FvNameGuid GuidValue is the Fv Name Guid value.\n\
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
fprintf (stdout, " --capflag CapFlag Capsule Reset Flag can be PersistAcrossReset,\n\
- or PopulateSystemTable or not set.\n");
+ or PopulateSystemTable or InitiateReset or not set\n");
fprintf (stdout, " --capheadsize HeadSize\n\
HeadSize is one HEX or DEC format value\n\
HeadSize is required by Capsule Image.\n");
@@ -218,6 +218,7 @@ Returns:
Index = 0;
mFvTotalSize = 0;
mFvTakenSize = 0;
+ Status = EFI_SUCCESS;
SetUtilityName (UTILITY_NAME);
@@ -232,10 +233,10 @@ Returns:
//
memset (&mFvDataInfo, 0, sizeof (FV_INFO));
memset (&mCapDataInfo, 0, sizeof (CAP_INFO));
- //
- // Set the default FvGuid
- //
- memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
+ //
+ // Set the default FvGuid
+ //
+ memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
//
// Parse command line
@@ -312,7 +313,7 @@ Returns:
return STATUS_ERROR;
}
mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
- DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%x", EFI_BLOCK_SIZE_STRING, TempNumber);
+ DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
argc -= 2;
argv += 2;
continue;
@@ -329,7 +330,7 @@ Returns:
return STATUS_ERROR;
}
mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
- DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%x", EFI_NUM_BLOCKS_STRING, TempNumber);
+ DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
argc -= 2;
argv += 2;
continue;
@@ -341,7 +342,7 @@ Returns:
return STATUS_ERROR;
}
strcpy (mFvDataInfo.FvFiles[Index], argv[1]);
- DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index + 1, argv[1]);
+ DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index + 1, argv[1]);
argc -= 2;
argv += 2;
@@ -356,8 +357,8 @@ Returns:
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
return STATUS_ERROR;
}
- mFvDataInfo.SizeofFvFiles[Index] = TempNumber;
- DebugMsg (NULL, 0, 9, "FV component file size", "the %dth size is %s", Index + 1, argv[1]);
+ mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
+ DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
argc -= 2;
argv += 2;
}
@@ -388,7 +389,7 @@ Returns:
return STATUS_ERROR;
}
mCapDataInfo.HeaderSize = (UINT32) TempNumber;
- DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%x", EFI_CAPSULE_HEADER_SIZE_STRING, TempNumber);
+ DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
argc -= 2;
argv += 2;
continue;
@@ -406,6 +407,8 @@ Returns:
mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
} else if (strcmp (argv[1], "PersistAcrossReset") == 0) {
mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
+ } else if (strcmp (argv[1], "InitiateReset") == 0) {
+ mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET;
} else {
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
return STATUS_ERROR;
@@ -506,7 +509,7 @@ Returns:
return STATUS_ERROR;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
return STATUS_ERROR;
}
SetPrintLevel (LogLevel);
@@ -625,20 +628,20 @@ Returns:
}
fprintf (FpFile, "Capsule %s Image Header Information\n", InfFileName);
fprintf (FpFile, " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
- CapsuleHeader->CapsuleGuid.Data1,
- (UINT32) CapsuleHeader->CapsuleGuid.Data2,
- (UINT32) CapsuleHeader->CapsuleGuid.Data3,
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[0],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[1],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[2],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[3],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[4],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[5],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[6],
- (UINT32) CapsuleHeader->CapsuleGuid.Data4[7]);
- fprintf (FpFile, " Header size 0x%08X\n", CapsuleHeader->HeaderSize);
- fprintf (FpFile, " Flags 0x%08X\n", CapsuleHeader->Flags);
- fprintf (FpFile, " Capsule image size 0x%08X\n", CapsuleHeader->CapsuleImageSize);
+ (unsigned) CapsuleHeader->CapsuleGuid.Data1,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data2,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data3,
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[0],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[1],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[2],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[3],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[4],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[5],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[6],
+ (unsigned) CapsuleHeader->CapsuleGuid.Data4[7]);
+ fprintf (FpFile, " Header size 0x%08X\n", (unsigned) CapsuleHeader->HeaderSize);
+ fprintf (FpFile, " Flags 0x%08X\n", (unsigned) CapsuleHeader->Flags);
+ fprintf (FpFile, " Capsule image size 0x%08X\n", (unsigned) CapsuleHeader->CapsuleImageSize);
fclose (FpFile);
} else if (CapsuleFlag) {
VerboseMsg ("Create capsule image");
@@ -657,7 +660,7 @@ Returns:
} else {
VerboseMsg ("Create Fv image and its map file");
if (mFvDataInfo.BaseAddress != 0) {
- VerboseMsg ("FvImage Rebase Address is 0x%X", mFvDataInfo.BaseAddress);
+ VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
}
//
// Call the GenerateFvImage to generate Fv Image
@@ -690,21 +693,29 @@ Returns:
fprintf (FpFile, "\n");
if (mFvDataInfo.BootBaseAddress != 0) {
fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);
- fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.BootBaseAddress);
- DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.BootBaseAddress);
+ fprintf (
+ FpFile,
+ " = 0x%llx\n",
+ (unsigned long long)mFvDataInfo.BootBaseAddress
+ );
+ DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.BootBaseAddress);
}
if (mFvDataInfo.RuntimeBaseAddress != 0) {
fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);
- fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.RuntimeBaseAddress);
- DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.RuntimeBaseAddress);
+ fprintf (
+ FpFile,
+ " = 0x%llx\n",
+ (unsigned long long)mFvDataInfo.RuntimeBaseAddress
+ );
+ DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.RuntimeBaseAddress);
}
fclose (FpFile);
}
if (Status == EFI_SUCCESS) {
- DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, mFvTotalSize);
- DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, mFvTakenSize);
- DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, mFvTotalSize - mFvTakenSize);
+ DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
+ DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
+ DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, (unsigned) (mFvTotalSize - mFvTakenSize));
}
VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
index ad3e7a6e08..917baa11e8 100644
--- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c
+++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c
@@ -1,6 +1,6 @@
/** @file
-Copyright (c) 2004 - 2008, Intel Corporation
+Copyright (c) 2004 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -184,7 +184,8 @@ Returns:
{
CHAR8 Value[_MAX_PATH];
UINT64 Value64;
- UINTN Index, Number, Index1;
+ UINTN Index;
+ UINTN Number;
EFI_STATUS Status;
EFI_GUID GuidValue;
@@ -371,7 +372,7 @@ Returns:
// Add the file
//
strcpy (FvInfo->FvFiles[Number + Index], Value);
- DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index, Value);
+ DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index, Value);
} else {
break;
}
@@ -514,6 +515,7 @@ EFI_STATUS
AddPadFile (
IN OUT MEMORY_FILE *FvImage,
IN UINT32 DataAlignment,
+ IN VOID *FvEnd,
IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader
)
/*++
@@ -525,9 +527,10 @@ Routine Description:
Arguments:
- FvImage The memory image of the FV to add it to. The current offset
- must be valid.
+ FvImage The memory image of the FV to add it to.
+ The current offset must be valid.
DataAlignment The data alignment of the next FFS file.
+ FvEnd End of the empty data in FvImage.
ExtHeader PI FvExtHeader Optional
Returns:
@@ -557,41 +560,13 @@ Returns:
}
//
- // Write pad file header
- //
- PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
-
- //
- // Verify that we have enough space for the file header
- //
- if (ExtHeader != NULL) {
- if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER) + ExtHeader->ExtHeaderSize) >= (UINTN) FvImage->Eof) {
- return EFI_OUT_OF_RESOURCES;
- }
- } else {
- if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER)) >= (UINTN) FvImage->Eof) {
- return EFI_OUT_OF_RESOURCES;
- }
- }
-
- //
- // write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
- //
- PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
- PadFile->Attributes = 0;
-
- //
// Calculate the pad file size
//
//
// This is the earliest possible valid offset (current plus pad file header
// plus the next file header)
//
- if (ExtHeader != NULL) {
- PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2) + ExtHeader->ExtHeaderSize;
- } else {
- PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);
- }
+ PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);
//
// Add whatever it takes to get to the next aligned address
@@ -610,6 +585,31 @@ Returns:
PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage;
//
+ // Append extension header size
+ //
+ if (ExtHeader != NULL) {
+ PadFileSize = PadFileSize + ExtHeader->ExtHeaderSize;
+ }
+
+ //
+ // Verify that we have enough space for the file header
+ //
+ if (((UINTN) FvImage->CurrentFilePointer + PadFileSize) > (UINTN) FvEnd) {
+ return EFI_OUT_OF_RESOURCES;
+ }
+
+ //
+ // Write pad file header
+ //
+ PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
+
+ //
+ // Write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
+ //
+ PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
+ PadFile->Attributes = 0;
+
+ //
// Write pad file size (calculated size minus next file header size)
//
PadFile->Size[0] = (UINT8) (PadFileSize & 0xFF);
@@ -630,26 +630,26 @@ Returns:
(EFI_FFS_FILE_HEADER *) PadFile,
(EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
);
-
+
+ //
+ // Update the current FV pointer
+ //
+ FvImage->CurrentFilePointer += PadFileSize;
+
if (ExtHeader != NULL) {
//
// Copy Fv Extension Header and Set Fv Extension header offset
//
memcpy (PadFile + 1, ExtHeader, ExtHeader->ExtHeaderSize);
((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) (PadFile + 1) - (UINTN) FvImage->FileImage);
+ //
+ // Make next file start at QWord Boundry
+ //
+ while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {
+ FvImage->CurrentFilePointer++;
+ }
}
- //
- // Verify that we have enough space (including the padding)
- //
- if (((UINTN)PadFile + PadFileSize) >= (UINTN) FvImage->Eof) {
- return EFI_OUT_OF_RESOURCES;
- }
- //
- // Update the current FV pointer
- //
- FvImage->CurrentFilePointer += PadFileSize;
-
return EFI_SUCCESS;
}
@@ -726,7 +726,7 @@ Returns:
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
EFI_TE_IMAGE_HEADER *TEImageHeader;
EFI_IMAGE_SECTION_HEADER *SectionHeader;
-
+ unsigned long long TempLongAddress;
//
// Init local variable
//
@@ -806,20 +806,20 @@ Returns:
//
if (ImageBaseAddress == 0) {
fprintf (FvMapFile, "%s (dummy) (", KeyWord);
- fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress);
+ fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) ImageBaseAddress);
} else {
fprintf (FvMapFile, "%s (", KeyWord);
- fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset);
+ fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) (ImageBaseAddress + Offset));
}
- fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint);
+ fprintf (FvMapFile, "EntryPoint=%08llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
fprintf (FvMapFile, "GUID=%s", FileGuidName);
fprintf (FvMapFile, ")\n");
for (; Index > 0; Index --, SectionHeader ++) {
if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {
- fprintf (FvMapFile, ".textbaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);
+ fprintf (FvMapFile, ".textbaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {
- fprintf (FvMapFile, ".databaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress);
+ fprintf (FvMapFile, ".databaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
}
}
fprintf (FvMapFile, "\n\n");
@@ -869,25 +869,27 @@ Returns:
// Printf Function Information
//
if (FunctionType == 1) {
- sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
+ FunctionAddress = (UINT64) TempLongAddress;
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);
- fprintf (FvMapFile, "(%08lx) F ", FunctionAddress - Offset);
+ fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
+ fprintf (FvMapFile, "(%08llx) F ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
} else {
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);
- fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset);
+ fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
+ fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
}
} else if (FunctionType == 2) {
- sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName);
+ sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
+ FunctionAddress = (UINT64) TempLongAddress;
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);
- fprintf (FvMapFile, "(%08lx) FS ", FunctionAddress - Offset);
+ fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
+ fprintf (FvMapFile, "(%08llx) FS ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
} else {
- fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress);
- fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset);
+ fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
+ fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
}
}
@@ -1028,7 +1030,7 @@ Returns:
//
for (Index1 = 0; Index1 < Index; Index1 ++) {
if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {
- Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %dth file have the same file GUID.", Index1 + 1, Index + 1);
+ Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);
PrintGuid ((EFI_GUID *) FileBuffer);
return EFI_INVALID_PARAMETER;
}
@@ -1067,7 +1069,7 @@ Returns:
// Sanity check. The file MUST align appropriately
//
if (((UINTN) *VtfFileImage + sizeof (EFI_FFS_FILE_HEADER) - (UINTN) FvImage->FileImage) % (1 << CurrentFileAlignment)) {
- Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %d-byte boundary.", 1 << CurrentFileAlignment);
+ Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %u-byte boundary.", (unsigned) (1 << CurrentFileAlignment));
free (FileBuffer);
return EFI_ABORTED;
}
@@ -1096,7 +1098,7 @@ Returns:
//
// Add pad file if necessary
//
- Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, NULL);
+ Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property.");
free (FileBuffer);
@@ -1105,7 +1107,7 @@ Returns:
//
// Add file
//
- if ((FvImage->CurrentFilePointer + FileSize) < FvImage->Eof) {
+ if ((UINTN) (FvImage->CurrentFilePointer + FileSize) <= (UINTN) (*VtfFileImage)) {
//
// Rebase the PE or TE image in FileBuffer of FFS file for XIP.
// Rebase Bs and Rt drivers for the debug genfvmap tool.
@@ -1174,6 +1176,10 @@ Returns:
return EFI_SUCCESS;
}
+ if ((UINTN) VtfFileImage < (UINTN) FvImage->CurrentFilePointer) {
+ return EFI_INVALID_PARAMETER;
+ }
+
//
// Pad file starts at beginning of free space
//
@@ -1261,11 +1267,11 @@ Returns:
UINT8 *BytePointer2;
UINT16 *WordPointer;
UINT16 CheckSum;
+ UINT32 IpiVector;
UINTN Index;
EFI_FFS_FILE_STATE SavedState;
UINT64 FitAddress;
FIT_TABLE *FitTablePtr;
- UINT32 IpiVector;
//
// Verify input parameters
@@ -1325,7 +1331,7 @@ Returns:
SecCorePhysicalAddress = FvInfo->BaseAddress;
SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
SecCorePhysicalAddress += EntryPoint;
- DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress);
+ DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);
//
// Find the PEI Core
@@ -1365,7 +1371,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint;
- DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);
+ DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
if (MachineType == EFI_IMAGE_MACHINE_IA64) {
//
@@ -1381,8 +1387,8 @@ Returns:
//
if (PeiCorePhysicalAddress & 0xF) {
Error (NULL, 0, 3000, "Invalid",
- "PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %Xh.",
- PeiCorePhysicalAddress
+ "PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %llXh.",
+ (unsigned long long) PeiCorePhysicalAddress
);
return EFI_ABORTED;
}
@@ -1411,8 +1417,8 @@ Returns:
//
if (SecCorePhysicalAddress & 0xF) {
Error (NULL, 0, 3000, "Invalid",
- "SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %Xh.",
- SecCorePhysicalAddress
+ "SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %llXh.",
+ (unsigned long long) SecCorePhysicalAddress
);
return EFI_ABORTED;
}
@@ -1448,7 +1454,7 @@ Returns:
//
Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);
- Ia32SecEntryOffset = SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2);
+ Ia32SecEntryOffset = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));
if (Ia32SecEntryOffset <= -65536) {
Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");
return STATUS_ERROR;
@@ -1461,7 +1467,7 @@ Returns:
//
Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 4);
*Ia32ResetAddressPtr = (UINT32) (FvInfo->BaseAddress);
- DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%X.", FvInfo->BaseAddress);
+ DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%llX.", (unsigned long long) FvInfo->BaseAddress);
//
// Update the Startup AP in the FVH header block ZeroVector region.
@@ -1507,9 +1513,9 @@ Returns:
//
// IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV.
//
- IpiVector = FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer);
- DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", IpiVector);
- if (IpiVector & 0xFFF != 0) {
+ IpiVector = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));
+ DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", (unsigned) IpiVector);
+ if ((IpiVector & 0xFFF) != 0) {
Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");
return EFI_ABORTED;
}
@@ -1527,7 +1533,7 @@ Returns:
// Volume Top File, but if you have one for some reason don't crash...
//
} else {
- Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", (UINT32) MachineType);
+ Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", MachineType);
return EFI_ABORTED;
}
@@ -1575,7 +1581,7 @@ Routine Description:
FIQ +24
We support two schemes on ARM.
- 1) Begining of the FV is the reset vector
+ 1) Beginning of the FV is the reset vector
2) Reset vector is data bytes FDF file and that code branches to reset vector
in the beginning of the FV (fixed size offset).
@@ -1671,7 +1677,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint;
- DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);
+ DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
memset (ResetVector, 0, sizeof (ResetVector));
@@ -1726,7 +1732,7 @@ Returns:
SecCorePhysicalAddress = FvInfo->BaseAddress;
SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
SecCorePhysicalAddress += EntryPoint;
- DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress);
+ DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);
//
// Find the PEI Core. It may not exist if SEC loads DXE core directly
@@ -1764,7 +1770,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint;
- DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress);
+ DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
}
@@ -1880,7 +1886,7 @@ Returns:
// Verify NT header is expected
//
if (ImgHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
- Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", ImgHdr->Pe32.Signature);
+ Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", (unsigned) ImgHdr->Pe32.Signature);
return EFI_UNSUPPORTED;
}
//
@@ -1990,7 +1996,7 @@ Returns:
//
if (mFvDataInfo.FvFileSystemGuidSet) {
DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- mFvDataInfo.FvFileSystemGuid.Data1,
+ (unsigned) mFvDataInfo.FvFileSystemGuid.Data1,
mFvDataInfo.FvFileSystemGuid.Data2,
mFvDataInfo.FvFileSystemGuid.Data3,
mFvDataInfo.FvFileSystemGuid.Data4[0],
@@ -2007,7 +2013,7 @@ Returns:
//
if (mFvDataInfo.FvNameGuidSet) {
DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- mFvDataInfo.FvNameGuid.Data1,
+ (unsigned) mFvDataInfo.FvNameGuid.Data1,
mFvDataInfo.FvNameGuid.Data2,
mFvDataInfo.FvNameGuid.Data3,
mFvDataInfo.FvNameGuid.Data4[0],
@@ -2043,7 +2049,7 @@ Returns:
if (EFI_ERROR (Status)) {
return Status;
}
- VerboseMsg ("the generated FV image size is %d bytes", mFvDataInfo.Size);
+ VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);
//
// support fv image and empty fv image
@@ -2120,7 +2126,7 @@ Returns:
//
// If there is no FFS file, generate one empty FV
//
- if (mFvDataInfo.FvFiles[0][0] == 0) {
+ if (mFvDataInfo.FvFiles[0][0] == 0 && !mFvDataInfo.FvNameGuidSet) {
goto WriteFile;
}
@@ -2155,15 +2161,15 @@ Returns:
//
if (mFvTotalSize != 0) {
fprintf (FvMapFile, EFI_FV_TOTAL_SIZE_STRING);
- fprintf (FvMapFile, " = 0x%x\n", mFvTotalSize);
+ fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTotalSize);
}
if (mFvTakenSize != 0) {
fprintf (FvMapFile, EFI_FV_TAKEN_SIZE_STRING);
- fprintf (FvMapFile, " = 0x%x\n", mFvTakenSize);
+ fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTakenSize);
}
if (mFvTotalSize != 0 && mFvTakenSize != 0) {
fprintf (FvMapFile, EFI_FV_SPACE_SIZE_STRING);
- fprintf (FvMapFile, " = 0x%x\n\n", mFvTotalSize - mFvTakenSize);
+ fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));
}
//
@@ -2172,7 +2178,7 @@ Returns:
if (mFvDataInfo.FvNameGuidSet) {
memcpy (&FvExtHeader.FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));
FvExtHeader.ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);
- AddPadFile (&FvImageMemoryFile, 8, &FvExtHeader);
+ AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, &FvExtHeader);
//
// Fv Extension header change update Fv Header Check sum
//
@@ -2382,7 +2388,9 @@ Returns:
UINT32 FfsAlignment;
EFI_FFS_FILE_HEADER FfsHeader;
BOOLEAN VtfFileFlag;
+ UINTN VtfFileSize;
+ VtfFileSize = 0;
VtfFileFlag = FALSE;
fpin = NULL;
Index = 0;
@@ -2453,24 +2461,22 @@ Returns:
return EFI_ABORTED;
}
VtfFileFlag = TRUE;
- //
- // The space between Vft File and the latest file must be able to contain
- // one ffs file header in order to add one pad file.
- //
- CurrentOffset += sizeof (EFI_FFS_FILE_HEADER);
- }
- //
- // Get the alignment of FFS file
- //
- ReadFfsAlignment (&FfsHeader, &FfsAlignment);
- FfsAlignment = 1 << FfsAlignment;
- //
- // Add Pad file
- //
- if (((CurrentOffset + sizeof (EFI_FFS_FILE_HEADER)) % FfsAlignment) != 0) {
- CurrentOffset = (CurrentOffset + sizeof (EFI_FFS_FILE_HEADER) * 2 + FfsAlignment - 1) & ~(FfsAlignment - 1);
- CurrentOffset -= sizeof (EFI_FFS_FILE_HEADER);
- }
+ VtfFileSize = FfsFileSize;
+ continue;
+ }
+
+ //
+ // Get the alignment of FFS file
+ //
+ ReadFfsAlignment (&FfsHeader, &FfsAlignment);
+ FfsAlignment = 1 << FfsAlignment;
+ //
+ // Add Pad file
+ //
+ if (((CurrentOffset + sizeof (EFI_FFS_FILE_HEADER)) % FfsAlignment) != 0) {
+ CurrentOffset = (CurrentOffset + sizeof (EFI_FFS_FILE_HEADER) * 2 + FfsAlignment - 1) & ~(FfsAlignment - 1);
+ CurrentOffset -= sizeof (EFI_FFS_FILE_HEADER);
+ }
}
//
@@ -2489,8 +2495,8 @@ Returns:
CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);
}
}
-
- DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", CurrentOffset, FvInfoPtr->Size);
+ CurrentOffset += VtfFileSize;
+ DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
if (FvInfoPtr->Size == 0) {
//
@@ -2504,7 +2510,7 @@ Returns:
//
// Not invalid
//
- Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", CurrentOffset, FvInfoPtr->Size);
+ Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
return EFI_INVALID_PARAMETER;
}
@@ -2627,8 +2633,8 @@ Returns:
//
// Check XipAddress, BootAddress and RuntimeAddress
//
- Flags = 0;
-
+ Flags = 0;
+ XipBase = 0;
if (FvInfo->BaseAddress != 0) {
Flags |= REBASE_XIP_FILE;
XipBase = FvInfo->BaseAddress + XipOffset;
@@ -2686,7 +2692,7 @@ Returns:
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status);
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status;
}
@@ -2785,7 +2791,7 @@ Returns:
ImageContext.Handle = PeFileBuffer;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status);
+ Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status;
}
ImageContext.RelocationsStripped = FALSE;
@@ -2935,7 +2941,7 @@ Returns:
ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
} else {
Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
- (UINT32) ImgHdr->Pe32.OptionalHeader.Magic,
+ ImgHdr->Pe32.OptionalHeader.Magic,
FileName
);
return EFI_ABORTED;
@@ -3018,7 +3024,7 @@ WritePeMap:
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status);
+ Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status;
}
@@ -3101,7 +3107,7 @@ WritePeMap:
ImageContext.Handle = PeFileBuffer;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status);
+ Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status;
}
ImageContext.RelocationsStripped = FALSE;
@@ -3365,8 +3371,14 @@ Returns:
if (Status == EFI_SUCCESS) {
if (strstr (Value, "PopulateSystemTable") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
+ if (strstr (Value, "InitiateReset") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
+ }
} else if (strstr (Value, "PersistAcrossReset") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
+ if (strstr (Value, "InitiateReset") != NULL) {
+ CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
+ }
} else {
Error (NULL, 0, 2000, "Invalid parameter", "invalid Flag setting for %s.", EFI_CAPSULE_FLAGS_STRING);
return EFI_ABORTED;
@@ -3403,7 +3415,7 @@ Returns:
// Add the file
//
strcpy (CapInfo->CapFiles[Index], Value);
- DebugMsg (NULL, 0, 9, "Capsule component file", "the %dth file name is %s", Index, CapInfo->CapFiles[Index]);
+ DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]);
} else {
break;
}
@@ -3568,7 +3580,7 @@ Returns:
fwrite (CapBuffer, 1, CapSize, fpout);
fclose (fpout);
- VerboseMsg ("The size of the generated capsule image is %d bytes", CapSize);
+ VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);
return EFI_SUCCESS;
}
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index d570f633d5..8c648eb407 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -23,6 +23,7 @@ Abstract:
#ifndef __GNUC__
#include <windows.h>
+#include <io.h>
#endif
#include <stdio.h>
#include <stdlib.h>
@@ -43,6 +44,8 @@ Abstract:
#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
#include "CommonLib.h"
+#include "PeCoffLib.h"
+#include "ParseInf.h"
#include "EfiUtilityMsgs.h"
#include "elf_common.h"
@@ -321,6 +324,10 @@ Returns:
ExpectedLength = sizeof(EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE);
break;
default:
+ if (AcpiHeader->Revision > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
+ ExpectedLength = AcpiHeader->Length;
+ break;
+ }
Error (NULL, 0, 3000, "Invalid", "FACP revision check failed.");
return STATUS_ERROR;
}
@@ -335,7 +342,10 @@ Returns:
//
case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
Facs = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)AcpiTable;
- if ((Facs->Version != 0) &&
+ if (Facs->Version > EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) {
+ break;
+ }
+ if ((Facs->Version != EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
(Facs->Version != EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
(Facs->Version != EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION)){
Error (NULL, 0, 3000, "Invalid", "FACS version check failed.");
@@ -354,8 +364,7 @@ Returns:
//
case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
if (AcpiHeader->Revision > EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION) {
- Error (NULL, 0, 3000, "Invalid", "DSDT revision check failed.");
- return STATUS_ERROR;
+ break;
}
if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) {
Error (NULL, 0, 3000, "Invalid", "DSDT length check failed.");
@@ -367,6 +376,9 @@ Returns:
// "APIC" Multiple APIC Description Table
//
case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
+ if (AcpiHeader->Revision > EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) {
+ break;
+ }
if ((AcpiHeader->Revision != EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
(AcpiHeader->Revision != EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
(AcpiHeader->Revision != EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION)) {
@@ -383,6 +395,9 @@ Returns:
// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
//
case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE:
+ if (AcpiHeader->Revision > EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
+ break;
+ }
if (AcpiHeader->Revision != EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
Error (NULL, 0, 3000, "Invalid", "MCFG revision check failed.");
return STATUS_ERROR;
@@ -437,7 +452,7 @@ Elf_Phdr *gPhdrBase;
// PE section alignment.
//
const UINT32 CoffAlignment = 0x20;
-const UINT32 CoffNbrSections = 4;
+const UINT16 CoffNbrSections = 4;
//
// Current offset in coff file.
@@ -508,7 +523,7 @@ CheckElfHeader(
return 0;
}
if (Ehdr->e_version != EV_CURRENT) {
- Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%d) not EV_CURRENT (%d)", Ehdr->e_version, EV_CURRENT);
+ Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) Ehdr->e_version, EV_CURRENT);
return 0;
}
@@ -707,7 +722,7 @@ ScanSections(
}
NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections;
- NtHdr->Pe32.FileHeader.TimeDateStamp = time(NULL);
+ NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);
NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0;
NtHdr->Pe32.FileHeader.NumberOfSymbols = 0;
NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader);
@@ -787,7 +802,7 @@ WriteSections(
//
// Ignore for unkown section type.
//
- VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (UINTN)Shdr->sh_type);
+ VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type);
break;
}
}
@@ -846,7 +861,7 @@ WriteSections(
- (SecOffset - SecShdr->sh_addr);
break;
default:
- Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info));
+ Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) {
@@ -862,7 +877,7 @@ WriteSections(
*(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx];
break;
default:
- Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info));
+ Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
}
}
}
@@ -918,7 +933,7 @@ CoffAddFixup(
//
// Fill the entry.
//
- CoffAddFixupEntry((Type << 12) | (Offset & 0xfff));
+ CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
}
@@ -976,7 +991,7 @@ WriteRelocations(
EFI_IMAGE_REL_BASED_HIGHLOW);
break;
default:
- Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info));
+ Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
}
} else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) {
@@ -993,10 +1008,10 @@ WriteRelocations(
);
break;
default:
- Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info));
+ Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
}
} else {
- Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %d (processor type).", Ehdr->e_machine);
+ Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) Ehdr->e_machine);
}
}
}
@@ -1214,19 +1229,20 @@ ZeroXdataSection (
CHAR8 KeyWord [MAX_LINE_LEN];
CHAR8 SectionName [MAX_LINE_LEN];
UINT32 FunctionType = 0;
- UINT32 SectionOffset;
- UINT32 SectionLength;
- UINT32 SectionNumber;
+ unsigned SectionOffset = 0;
+ unsigned SectionLength = 0;
+ unsigned SectionNumber = 0;
CHAR8 *PdbPointer;
- INT32 Index = 0;
+ INT32 Index;
+ UINT32 Index2;
- for (Index = 0; Index < SectionTotalNumber; Index ++) {
- if (stricmp ((char *)SectionHeader[Index].Name, ".zdata") == 0) {
+ for (Index2 = 0; Index2 < SectionTotalNumber; Index2++) {
+ if (stricmp ((char *)SectionHeader[Index2].Name, ".zdata") == 0) {
//
// try to zero the customized .zdata section, which is mapped to .xdata
//
- memset (FileBuffer + SectionHeader[Index].PointerToRawData, 0, SectionHeader[Index].SizeOfRawData);
- DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[Index].PointerToRawData, SectionHeader[Index].SizeOfRawData);
+ memset (FileBuffer + SectionHeader[Index2].PointerToRawData, 0, SectionHeader[Index2].SizeOfRawData);
+ DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[Index2].PointerToRawData, (unsigned) SectionHeader[Index2].SizeOfRawData);
return;
}
}
@@ -1329,7 +1345,7 @@ ZeroXdataSection (
// Zero .xdata Section data
//
memset (FileBuffer + SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, 0, SectionLength);
- DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);
+ DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);
fclose (fpMapFile);
return;
}
@@ -1610,7 +1626,7 @@ Returns:
goto Finish;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
goto Finish;
}
SetPrintLevel (LogLevel);
@@ -1631,7 +1647,7 @@ Returns:
InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));
if (InputFileName == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
- return EFI_OUT_OF_RESOURCES;
+ goto Finish;
}
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
@@ -1646,7 +1662,7 @@ Returns:
if (InputFileName == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
- return EFI_OUT_OF_RESOURCES;
+ goto Finish;
}
memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
@@ -1883,7 +1899,7 @@ Returns:
}
if (Index != FileLength) {
- Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, FileLength, Index);
+ Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, (unsigned) FileLength, (unsigned) Index);
goto Finish;
}
@@ -1899,7 +1915,7 @@ Returns:
Index += sizeof (*DataPointer);
}
if (CheckSum != 0) {
- Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", CheckSum, mInImageName);
+ Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", (unsigned) CheckSum, mInImageName);
goto Finish;
}
//
@@ -1923,7 +1939,7 @@ Returns:
goto Finish;
}
}
- VerboseMsg ("the size of output file is %d bytes", FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
//
// Convert Mci.TXT to Mci.bin file successfully
//
@@ -1950,7 +1966,7 @@ Returns:
fread (FileBuffer, 1, FileLength, fpIn);
fclose (fpIn);
- DebugMsg (NULL, 0, 9, "input file info", "the input file size is %d bytes", FileLength);
+ DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) FileLength);
//
// Replace file
@@ -1978,11 +1994,11 @@ Returns:
fprintf (fpInOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
fprintf (fpInOut, "%17X subsystems\n", TEImageHeader.Subsystem);
fprintf (fpInOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
- fprintf (fpInOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint);
- fprintf (fpInOut, "%17X base of code\n", TEImageHeader.BaseOfCode);
- fprintf (fpInOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase);
- fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size);
- fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size);
+ fprintf (fpInOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
+ fprintf (fpInOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
+ fprintf (fpInOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
+ fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
+ fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
}
if (fpOut != NULL) {
@@ -1992,11 +2008,11 @@ Returns:
fprintf (fpOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
fprintf (fpOut, "%17X subsystems\n", TEImageHeader.Subsystem);
fprintf (fpOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
- fprintf (fpOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint);
- fprintf (fpOut, "%17X base of code\n", TEImageHeader.BaseOfCode);
- fprintf (fpOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase);
- fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size);
- fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size);
+ fprintf (fpOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
+ fprintf (fpOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
+ fprintf (fpOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
+ fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
+ fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
}
goto Finish;
}
@@ -2201,7 +2217,7 @@ Returns:
if (fpInOut != NULL) {
fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders));
goto Finish;
}
@@ -2211,7 +2227,7 @@ Returns:
if (OutImageType == FW_ZERO_DEBUG_IMAGE) {
Status = ZeroDebugData (FileBuffer, TRUE);
if (EFI_ERROR (Status)) {
- Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%lx", (UINTN) Status);
+ Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%x", (int) Status);
goto Finish;
}
@@ -2221,7 +2237,7 @@ Returns:
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish;
}
@@ -2240,7 +2256,7 @@ Returns:
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish;
}
@@ -2274,7 +2290,7 @@ Returns:
if (fpInOut != NULL) {
fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish;
}
}
@@ -2291,7 +2307,7 @@ Returns:
DosHdr->e_lfanew = BackupDosHdr.e_lfanew;
for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) {
- FileBuffer[Index] = DosHdr->e_cp;
+ FileBuffer[Index] = (UINT8) DosHdr->e_cp;
}
}
@@ -2397,7 +2413,7 @@ Returns:
Optional32->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
SectionHeader->SizeOfRawData = AllignedRelocSize;
FileLength = Optional32->SizeOfImage;
- DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize);
+ DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
}
}
}
@@ -2505,7 +2521,7 @@ Returns:
Optional64->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
SectionHeader->SizeOfRawData = AllignedRelocSize;
FileLength = Optional64->SizeOfImage;
- DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize);
+ DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
}
}
}
@@ -2561,8 +2577,8 @@ Returns:
goto Finish;
}
- DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %X",
- TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, TEImageHeader.AddressOfEntryPoint, TEImageHeader.BaseOfCode, TEImageHeader.ImageBase);
+ DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %llX",
+ TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, (unsigned) TEImageHeader.AddressOfEntryPoint, (unsigned) TEImageHeader.BaseOfCode, (unsigned long long) TEImageHeader.ImageBase);
//
// Update Image to TeImage
//
@@ -2574,7 +2590,7 @@ Returns:
fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpInOut);
fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength - TEImageHeader.StrippedSize);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - TEImageHeader.StrippedSize));
goto Finish;
}
WriteFile:
@@ -2587,7 +2603,7 @@ WriteFile:
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut);
}
- VerboseMsg ("the size of output file is %d bytes", FileLength);
+ VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
Finish:
if (fpInOut != NULL) {
@@ -2813,13 +2829,13 @@ Returns:
struct tm stime;
struct tm *ptime;
time_t newtime;
- UINT32 Index;
- UINT32 DebugDirectoryEntryRva;
- UINT32 DebugDirectoryEntryFileOffset;
- UINT32 ExportDirectoryEntryRva;
- UINT32 ExportDirectoryEntryFileOffset;
- UINT32 ResourceDirectoryEntryRva;
- UINT32 ResourceDirectoryEntryFileOffset;
+ UINT32 Index;
+ UINT32 DebugDirectoryEntryRva;
+ UINT32 DebugDirectoryEntryFileOffset;
+ UINT32 ExportDirectoryEntryRva;
+ UINT32 ExportDirectoryEntryFileOffset;
+ UINT32 ResourceDirectoryEntryRva;
+ UINT32 ResourceDirectoryEntryFileOffset;
EFI_IMAGE_DOS_HEADER *DosHdr;
EFI_IMAGE_FILE_HEADER *FileHdr;
EFI_IMAGE_OPTIONAL_HEADER32 *Optional32Hdr;
@@ -2830,9 +2846,12 @@ Returns:
//
// Init variable.
//
- DebugDirectoryEntryRva = 0;
- ExportDirectoryEntryRva = 0;
- ResourceDirectoryEntryRva = 0;
+ DebugDirectoryEntryRva = 0;
+ DebugDirectoryEntryFileOffset = 0;
+ ExportDirectoryEntryRva = 0;
+ ExportDirectoryEntryFileOffset = 0;
+ ResourceDirectoryEntryRva = 0;
+ ResourceDirectoryEntryFileOffset = 0;
//
// Get time and date that will be set.
//
@@ -3041,6 +3060,7 @@ Returns:
{
CHAR8 Line[MAX_LINE_LEN];
CHAR8 *cptr;
+ unsigned ScannedData = 0;
Line[MAX_LINE_LEN - 1] = 0;
while (1) {
@@ -3080,10 +3100,11 @@ Returns:
for (; *cptr && isspace(*cptr); cptr++) {
}
if (isxdigit (*cptr)) {
- if (sscanf (cptr, "%X", Data) != 1) {
+ if (sscanf (cptr, "%X", &ScannedData) != 1) {
return STATUS_ERROR;
}
}
+ *Data = (UINT32) ScannedData;
return STATUS_SUCCESS;
}
diff --git a/BaseTools/Source/C/GenFw/elf_generic.h b/BaseTools/Source/C/GenFw/elf_generic.h
deleted file mode 100644
index dd4f8e14fd..0000000000
--- a/BaseTools/Source/C/GenFw/elf_generic.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * Copyright (c) 1998 John D. Polstra.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- *
- * $FreeBSD: src/sys/sys/elf_generic.h,v 1.6.14.2 2007/12/03 21:30:36 marius Exp $
- */
-
-#ifndef _SYS_ELF_GENERIC_H_
-#define _SYS_ELF_GENERIC_H_ 1
-
-#include <sys/cdefs.h>
-
-/*
- * Definitions of generic ELF names which relieve applications from
- * needing to know the word size.
- */
-
-#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64
-#error "__ELF_WORD_SIZE must be defined as 32 or 64"
-#endif
-
-#define ELF_CLASS __CONCAT(ELFCLASS,__ELF_WORD_SIZE)
-
-#if BYTE_ORDER == LITTLE_ENDIAN
-#define ELF_DATA ELFDATA2LSB
-#elif BYTE_ORDER == BIG_ENDIAN
-#define ELF_DATA ELFDATA2MSB
-#else
-#error "Unknown byte order"
-#endif
-
-#define __elfN(x) __CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x)
-#define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x)
-#define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)
-#define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x)
-
-__ElfType(Addr);
-__ElfType(Half);
-__ElfType(Off);
-__ElfType(Sword);
-__ElfType(Word);
-__ElfType(Ehdr);
-__ElfType(Shdr);
-__ElfType(Phdr);
-__ElfType(Dyn);
-__ElfType(Rel);
-__ElfType(Rela);
-__ElfType(Sym);
-__ElfType(Verdef);
-__ElfType(Verdaux);
-__ElfType(Verneed);
-__ElfType(Vernaux);
-__ElfType(Versym);
-
-/* Non-standard ELF types. */
-__ElfType(Hashelt);
-__ElfType(Size);
-__ElfType(Ssize);
-
-#define ELF_R_SYM __ELFN(R_SYM)
-#define ELF_R_TYPE __ELFN(R_TYPE)
-#define ELF_R_INFO __ELFN(R_INFO)
-#define ELF_ST_BIND __ELFN(ST_BIND)
-#define ELF_ST_TYPE __ELFN(ST_TYPE)
-#define ELF_ST_INFO __ELFN(ST_INFO)
-
-#endif /* !_SYS_ELF_GENERIC_H_ */
diff --git a/BaseTools/Source/C/GenPage/GenPage.c b/BaseTools/Source/C/GenPage/GenPage.c
index 99fbc1e472..dac55889d5 100644
--- a/BaseTools/Source/C/GenPage/GenPage.c
+++ b/BaseTools/Source/C/GenPage/GenPage.c
@@ -35,6 +35,7 @@ Abstract:
#include <string.h>
#include "VirtualMemory.h"
#include "EfiUtilityMsgs.h"
+#include "ParseInf.h"
#define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000
#define EFI_PAGE_BASE_ADDRESS (EFI_PAGE_BASE_OFFSET_IN_LDR + 0x20000)
@@ -252,7 +253,7 @@ return:
FileSize = ftell (NoPageFile);
fseek (NoPageFile, 0, SEEK_SET);
if (FileSize > gPageTableOffsetInFile) {
- Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%x) exceeds the Page Table Offset (0x%x)", FileSize, gPageTableOffsetInFile);
+ Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%lx) exceeds the Page Table Offset (0x%x)", FileSize, (unsigned) gPageTableOffsetInFile);
fclose (PageFile);
fclose (NoPageFile);
return -1;
@@ -380,7 +381,7 @@ main (
return STATUS_ERROR;
}
if (TempValue > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", TempValue);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) TempValue);
return STATUS_ERROR;
}
argc -= 2;
diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c
index 952034ad5f..32b8cfd5a0 100644
--- a/BaseTools/Source/C/GenSec/GenSec.c
+++ b/BaseTools/Source/C/GenSec/GenSec.c
@@ -160,7 +160,8 @@ Returns:
EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\
EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\
EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\
- EFI_SECTION_PEI_DEPEX. if -s option is not given, \n\
+ EFI_SECTION_PEI_DEPEX, EFI_SECTION_SMM_DEPEX.\n\
+ if -s option is not given, \n\
EFI_SECTION_ALL is default section type.\n");
fprintf (stdout, " -c [Type], --compress [Type]\n\
Compress method type can be PI_NONE or PI_STD.\n\
@@ -282,16 +283,16 @@ Returns:
fseek (InFile, 0, SEEK_END);
InputFileLength = ftell (InFile);
fseek (InFile, 0, SEEK_SET);
- DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %d bytes", InputFileName[0], InputFileLength);
+ DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %u bytes", InputFileName[0], (unsigned) InputFileLength);
TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;
//
// Size must fit in 3 bytes
//
if (TotalLength >= MAX_SECTION_SIZE) {
- Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%dM).", InputFileName[0], TotalLength, MAX_SECTION_SIZE>>20);
+ Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%uM).", InputFileName[0], (unsigned) TotalLength, MAX_SECTION_SIZE>>20);
goto Done;
}
- VerboseMsg ("the size of the created section file is %d bytes", TotalLength);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
//
// Fill in the fields in the local section header structure
//
@@ -404,7 +405,7 @@ Returns:
fseek (InFile, 0, SEEK_END);
FileSize = ftell (InFile);
fseek (InFile, 0, SEEK_SET);
- DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %d bytes", InputFileName[Index], FileSize);
+ DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
//
// Now read the contents of the file into the buffer
// Buffer must be enough to contain the file content.
@@ -561,10 +562,10 @@ Returns:
}
DebugMsg (NULL, 0, 9, "comprss file size",
- "the original section size is %d bytes and the compressed section size is %d bytes", InputLength, CompressedLength);
+ "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION);
if (TotalLength >= MAX_SECTION_SIZE) {
- Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);
+ Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
if (FileBuffer != NULL) {
free (FileBuffer);
}
@@ -573,7 +574,7 @@ Returns:
}
return STATUS_ERROR;
}
- VerboseMsg ("the size of the created section file is %d bytes", TotalLength);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
//
// Add the section header for the compressed data
@@ -708,7 +709,7 @@ Returns:
TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER);
if (TotalLength >= MAX_SECTION_SIZE) {
- Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);
+ Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
free (FileBuffer);
return STATUS_ERROR;
}
@@ -722,12 +723,12 @@ Returns:
Crc32GuidSect->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
Crc32GuidSect->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER);
Crc32GuidSect->CRC32Checksum = Crc32Checksum;
- DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", Crc32GuidSect->GuidSectionHeader.DataOffset);
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect->GuidSectionHeader.DataOffset);
} else {
TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION);
if (TotalLength >= MAX_SECTION_SIZE) {
- Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20);
+ Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
free (FileBuffer);
return STATUS_ERROR;
}
@@ -739,10 +740,10 @@ Returns:
VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));
VendorGuidSect->Attributes = DataAttribute;
- VendorGuidSect->DataOffset = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize;
- DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset);
+ VendorGuidSect->DataOffset = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);
+ DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect->DataOffset);
}
- VerboseMsg ("the size of the created section file is %d bytes", TotalLength);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
//
// Set OutFileBuffer
@@ -785,7 +786,7 @@ Returns:
CHAR8 *CompressionName;
CHAR8 *StringBuffer;
EFI_GUID VendorGuid = mZeroGuid;
- INT32 VersionNumber;
+ int VersionNumber;
UINT8 SectType;
UINT8 SectCompSubType;
UINT16 SectGuidAttribute;
@@ -972,7 +973,7 @@ Returns:
goto Finish;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", (int) LogLevel);
goto Finish;
}
SetPrintLevel (LogLevel);
@@ -1059,7 +1060,7 @@ Returns:
SectGuidAttribute = 0;
}
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
- VendorGuid.Data1,
+ (unsigned) VendorGuid.Data1,
VendorGuid.Data2,
VendorGuid.Data3,
VendorGuid.Data4[0],
@@ -1077,7 +1078,7 @@ Returns:
VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]);
}
if (SectGuidHeaderLength != 0) {
- VerboseMsg ("Guid Data Header size is 0x%x", SectGuidHeaderLength);
+ VerboseMsg ("Guid Data Header size is 0x%llx", (unsigned long long) SectGuidHeaderLength);
}
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) {
SectType = EFI_SECTION_PE32;
@@ -1087,6 +1088,8 @@ Returns:
SectType = EFI_SECTION_TE;
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {
SectType = EFI_SECTION_DXE_DEPEX;
+ } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_SMM_DEPEX]) == 0) {
+ SectType = EFI_SECTION_SMM_DEPEX;
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) {
SectType = EFI_SECTION_VERSION;
if (VersionNumber < 0 || VersionNumber > 9999) {
@@ -1139,7 +1142,7 @@ Returns:
// Check whether there is output file
//
for (Index = 0; Index < InputFileNum; Index ++) {
- VerboseMsg ("the %dth input file name is %s", Index, InputFileName[Index]);
+ VerboseMsg ("the %uth input file name is %s", (unsigned) Index, InputFileName[Index]);
}
if (OutputFileName == NULL) {
Error (NULL, 0, 1001, "Missing options", "Output file");
@@ -1199,7 +1202,7 @@ Returns:
VersionSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
VersionSect->BuildNumber = (UINT16) VersionNumber;
Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);
- VerboseMsg ("the size of the created section file is %d bytes", Index);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
break;
case EFI_SECTION_USER_INTERFACE:
@@ -1219,7 +1222,7 @@ Returns:
UiSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);
UiSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);
- VerboseMsg ("the size of the created section file is %d bytes", Index);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
break;
case EFI_SECTION_ALL:
@@ -1250,7 +1253,7 @@ Returns:
&InputLength
);
}
- VerboseMsg ("the size of the created section file is %d bytes", InputLength);
+ VerboseMsg ("the size of the created section file is %u bytes", (unsigned) InputLength);
break;
default:
//
@@ -1266,7 +1269,7 @@ Returns:
}
if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
- Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (UINTN) Status);
+ Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
goto Finish;
}
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.c b/BaseTools/Source/C/GenVtf/GenVtf.c
index e633b7ccf8..eafbcbf002 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.c
+++ b/BaseTools/Source/C/GenVtf/GenVtf.c
@@ -122,8 +122,8 @@ Returns:
CHAR8 StrPtr[40];
CHAR8 *Token;
UINTN Length;
- UINT32 Major;
- UINT32 Minor;
+ unsigned Major;
+ unsigned Minor;
Major = 0;
Minor = 0;
@@ -278,7 +278,7 @@ InitializeComps (
Routine Description:
- This function intializes the relevant global variable which is being
+ This function initializes the relevant global variable which is being
used to store the information retrieved from INF file. This also initializes
the VTF symbol file.
@@ -316,7 +316,7 @@ ParseAndUpdateComponents (
Routine Description:
- This function intializes the relevant global variable which is being
+ This function initializes the relevant global variable which is being
used to store the information retrieved from INF file.
Arguments:
@@ -347,7 +347,7 @@ Returns:
} else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) {
TokenStr++;
if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
- Error (NULL, 0, 5001, "Cannot get: \"0x%x\".", *TokenStr);
+ Error (NULL, 0, 5001, "Cannot get: \"0x%s\".", *TokenStr);
return ;
}
@@ -1970,7 +1970,7 @@ Returns:
Fv1BaseAddress = StartAddress1;
Fv1EndAddress = Fv1BaseAddress + Size1;
- if (Fv1EndAddress != 0x100000000 || Size1 < 0x100000) {
+ if (Fv1EndAddress != 0x100000000ULL || Size1 < 0x100000) {
Error (NULL, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");
if (Size1 < 0x100000) {
Error (NULL, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!");
@@ -2281,11 +2281,7 @@ Returns:
//
TokenAddress += BaseAddress &~IPF_CACHE_BIT;
-#ifdef __GNUC__
- fprintf (DestFile, "%s | %016lX | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);
-#else
- fprintf (DestFile, "%s | %016I64X | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);
-#endif
+ fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, (unsigned long long) TokenAddress, Section, BaseToken, Token);
}
}
@@ -2689,7 +2685,7 @@ Returns:
break;
case EFI_ABORTED:
- Error (NULL, 0, 3000, "Invaild", "Error detected while creating the file image.");
+ Error (NULL, 0, 3000, "Invalid", "Error detected while creating the file image.");
break;
case EFI_OUT_OF_RESOURCES:
@@ -2697,11 +2693,11 @@ Returns:
break;
case EFI_VOLUME_CORRUPTED:
- Error (NULL, 0, 3000, "Invaild", "No base address was specified.");
+ Error (NULL, 0, 3000, "Invalid", "No base address was specified.");
break;
default:
- Error (NULL, 0, 3000, "Invaild", "GenVtfImage function returned unknown status %x.",Status );
+ Error (NULL, 0, 3000, "Invalid", "GenVtfImage function returned unknown status %x.", (int) Status );
break;
}
}
diff --git a/BaseTools/Source/C/GenVtf/GenVtf.h b/BaseTools/Source/C/GenVtf/GenVtf.h
index 25ce1141ba..eab14f3aa6 100644
--- a/BaseTools/Source/C/GenVtf/GenVtf.h
+++ b/BaseTools/Source/C/GenVtf/GenVtf.h
@@ -33,6 +33,9 @@ Abstract:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#ifndef __GNUC__
+#include <io.h>
+#endif
#include "assert.h"
#include <Common/PiFirmwareFile.h>
#include "ParseInf.h"
diff --git a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
index 178bec2476..6a25bee957 100644
--- a/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
+++ b/BaseTools/Source/C/GnuGenBootSector/GnuGenBootSector.c
@@ -27,6 +27,9 @@ Abstract:
#include <string.h>
#include <Common/UefiBaseTypes.h>
+#include "ParseInf.h"
+#include "EfiUtilityMsgs.h"
+
//
// Utility Name
//
@@ -293,10 +296,10 @@ PrintUsage (
[-h, --help]\n");
}
-INTN
+int
main (
- INTN argc,
- CHAR8 *argv[]
+ int argc,
+ char *argv[]
)
{
CHAR8 *AppName;
@@ -393,7 +396,7 @@ main (
return 1;
}
if (LogLevel > 9) {
- Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel);
+ Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
return 1;
}
SetPrintLevel (LogLevel);
diff --git a/BaseTools/Source/C/Include/Common/BaseTypes.h b/BaseTools/Source/C/Include/Common/BaseTypes.h
index 438d949a6b..43721ae469 100644
--- a/BaseTools/Source/C/Include/Common/BaseTypes.h
+++ b/BaseTools/Source/C/Include/Common/BaseTypes.h
@@ -26,7 +26,7 @@
#include <stdarg.h>
//
-// Modifiers to absract standard types to aid in debug of problems
+// Modifiers to abstract standard types to aid in debug of problems
//
#define CONST const
#define STATIC static
@@ -38,8 +38,8 @@
//
#ifndef IN
//
-// Some other envirnments use this construct, so #ifndef to prevent
-// mulitple definition.
+// Some other environments use this construct, so #ifndef to prevent
+// multiple definition.
//
#define IN
#define OUT
@@ -68,13 +68,13 @@
//
// Support for variable length argument lists using the ANSI standard.
//
-// Since we are using the ANSI standard we used the standard nameing and
-// did not folow the coding convention
+// Since we are using the ANSI standard we used the standard naming and
+// did not follow the coding convention
//
// VA_LIST - typedef for argument list.
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
// VA_END (VA_LIST Marker) - Clear Marker
-// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from
+// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
// the ... list. You must know the size and pass it in this macro.
//
// example:
@@ -136,12 +136,12 @@
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
///
-/// ALIGN_POINTER - aligns a pointer to the lowest boundry
+/// ALIGN_POINTER - aligns a pointer to the lowest boundary
///
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
///
-/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor
+/// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor
///
#define ALIGN_VARIABLE(Value, Adjustment) \
Adjustment = 0U; \
diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
index 1e9f6028b4..158e672970 100644
--- a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
+++ b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h
@@ -134,6 +134,7 @@ typedef UINT8 EFI_SECTION_TYPE;
#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
#define EFI_SECTION_RAW 0x19
#define EFI_SECTION_PEI_DEPEX 0x1B
+#define EFI_SECTION_SMM_DEPEX 0x1C
typedef struct {
UINT8 Size[3];
diff --git a/BaseTools/Source/C/Include/Common/UefiCapsule.h b/BaseTools/Source/C/Include/Common/UefiCapsule.h
index d50492662b..70d87234f7 100644
--- a/BaseTools/Source/C/Include/Common/UefiCapsule.h
+++ b/BaseTools/Source/C/Include/Common/UefiCapsule.h
@@ -1,7 +1,7 @@
/** @file
Defines for the EFI Capsule functionality.
- Copyright (c) 2006 - 2008, Intel Corporation All rights reserved.
+ Copyright (c) 2006 - 2009, Intel Corporation All rights reserved.
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
@@ -30,5 +30,6 @@ typedef struct {
#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
+#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
#endif // #ifndef _EFI_CAPSULE_H_
diff --git a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
index a127c952d4..f54614abf2 100644
--- a/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
+++ b/BaseTools/Source/C/Include/Common/UefiInternalFormRepresentation.h
@@ -839,7 +839,7 @@ typedef struct _EFI_IFR_REF4 {
typedef struct _EFI_IFR_RESET_BUTTON {
EFI_IFR_OP_HEADER Header;
- EFI_IFR_QUESTION_HEADER Question;
+ EFI_IFR_STATEMENT_HEADER Statement;
EFI_DEFAULT_ID DefaultId;
} EFI_IFR_RESET_BUTTON;
diff --git a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
index 122a0b1178..df778a583e 100644
--- a/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
+++ b/BaseTools/Source/C/Include/Ia32/ProcessorBind.h
@@ -54,7 +54,7 @@
#pragma warning ( disable : 4057 )
//
-// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning
+// ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
//
#pragma warning ( disable : 4127 )
@@ -141,7 +141,7 @@ typedef INT32 INTN;
//
// Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and
-// EFI intrinsics are required to modify thier member functions with EFIAPI.
+// EFI intrinsics are required to modify their member functions with EFIAPI.
//
#if _MSC_EXTENSIONS
//
diff --git a/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h b/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
index 946c524ddb..fb8599333c 100644
--- a/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
+++ b/BaseTools/Source/C/Include/IndustryStandard/Acpi1_0.h
@@ -114,6 +114,7 @@ typedef struct {
#define EFI_ACPI_1_0_TMR_VAL_EXT (1 << 8)
#define EFI_ACPI_1_0_DCK_CAP (1 << 9)
+#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x0
//
// Firmware ACPI Control Structure
//
diff --git a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
index 7207a752a1..16b91da177 100644
--- a/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
+++ b/BaseTools/Source/C/LzmaCompress/LzmaCompress.c
@@ -208,7 +208,7 @@ int main2(int numArgs, const char *args[], char *rs)
CFileSeqInStream inStream;
CFileOutStream outStream;
int res;
- int encodeMode;
+ int encodeMode = 0;
Bool modeWasSet = False;
const char *inputFile = NULL;
const char *outputFile = "file.tmp";
diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
index 271b141a81..a4dc2255e7 100644
--- a/BaseTools/Source/C/Makefiles/header.makefile
+++ b/BaseTools/Source/C/Makefiles/header.makefile
@@ -25,7 +25,7 @@ endif
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
CPPFLAGS = $(INCLUDE)
-CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -c -g
+CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
.PHONY: all
.PHONY: install
diff --git a/BaseTools/Source/C/Makefiles/ms.common b/BaseTools/Source/C/Makefiles/ms.common
index 2385518c1b..1523ce75ca 100644
--- a/BaseTools/Source/C/Makefiles/ms.common
+++ b/BaseTools/Source/C/Makefiles/ms.common
@@ -44,6 +44,6 @@ LINKER = $(LD)
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
-CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
+CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
diff --git a/BaseTools/Source/C/Split/Split.c b/BaseTools/Source/C/Split/Split.c
index 5ebda0901b..22e1a2be49 100644
--- a/BaseTools/Source/C/Split/Split.c
+++ b/BaseTools/Source/C/Split/Split.c
@@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <stdlib.h>
#ifdef __GNUC__
#include <unistd.h>
+#else
+#include <direct.h>
#endif
#include <ctype.h>
#include "ParseInf.h"
@@ -219,7 +221,7 @@ Returns:
CHAR8 *OutputDir = NULL;
CHAR8 *OutFileName1 = NULL;
CHAR8 *OutFileName2 = NULL;
- UINT64 SplitValue = -1;
+ UINT64 SplitValue = (UINT64) -1;
FILE *Out1;
FILE *Out2;
CHAR8 *OutName1 = NULL;
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index b3ce640fde..ef35f1721d 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -84,7 +84,7 @@ STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC -
STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
-static UINTN DebugLevel;
+static UINT64 DebugLevel;
static BOOLEAN DebugMode;
//
// functions
@@ -180,12 +180,11 @@ Returns:
if (mCompSize + 1 + 8 > *DstSize) {
*DstSize = mCompSize + 1 + 8;
- return EFI_BUFFER_TOO_SMALL;
- } else {
+ return EFI_BUFFER_TOO_SMALL;
+ } else {
*DstSize = mCompSize + 1 + 8;
- return EFI_SUCCESS;
- }
- return EFI_SUCCESS;
+ return EFI_SUCCESS;
+ }
}
STATIC
diff --git a/BaseTools/Source/C/VfrCompile/VfrError.cpp b/BaseTools/Source/C/VfrCompile/VfrError.cpp
index b24cc725f0..963bd2da42 100644
--- a/BaseTools/Source/C/VfrCompile/VfrError.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrError.cpp
@@ -201,7 +201,11 @@ CVfrErrorHandle::PrintMsg (
{
CHAR8 *FileName = NULL;
UINT32 FileLine;
-
+
+ if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {
+ VerboseMsg (ErrorMsg);
+ return;
+ }
GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
index 654daed549..298eb0289b 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.cpp
@@ -787,11 +787,22 @@ CIfrRecordInfoDB::IfrRecordInfoUpdate (
)
{
SIfrRecord *pNode;
+ SIfrRecord *Prev;
if ((pNode = GetRecordInfoFromIdx (RecordIdx)) == NULL) {
return;
}
+ if (LineNo == 0) {
+ //
+ // Line number is not specified explicitly, try to use line number of previous opcode
+ //
+ Prev = GetRecordInfoFromIdx (RecordIdx - 1);
+ if (Prev != NULL) {
+ LineNo = Prev->mLineNo;
+ }
+ }
+
pNode->mLineNo = LineNo;
pNode->mOffset = Offset;
pNode->mBinBufLen = BinBufLen;
diff --git a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
index 3f387666bd..fa671c1b1e 100644
--- a/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
+++ b/BaseTools/Source/C/VfrCompile/VfrFormPkg.h
@@ -254,7 +254,7 @@ public:
VOID DecLength (UINT8 Size) {
if (mHeader->Length >= Size) {
- mHeader -= Size;
+ mHeader -= Size;
}
}
@@ -358,7 +358,7 @@ public:
VOID SetVarStoreInfo (IN EFI_VARSTORE_INFO *Info) {
mHeader->VarStoreId = Info->mVarStoreId;
- mHeader->VarStoreInfo.VarName = Info->mInfo.mVarName;
+ mHeader->VarStoreInfo.VarName = Info->mInfo.mVarName;
mHeader->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
}
@@ -398,7 +398,8 @@ public:
}
};
-static CIfrQuestionHeader *gCurrentQuestion = NULL;
+static CIfrQuestionHeader *gCurrentQuestion = NULL;
+static CIfrObj *gCurrentIfrOpcode = NULL;
/*
* The definition of CIfrMinMaxStepData
@@ -537,6 +538,12 @@ public:
}
EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
+ if (FormId == 0) {
+ //
+ // FormId can't be 0.
+ //
+ return VFR_RETURN_INVALID_PARAMETER;
+ }
if (CIfrForm::ChekFormIdFree (FormId) == FALSE) {
return VFR_RETURN_FORMID_REDEFINED;
}
@@ -688,7 +695,7 @@ public:
) : CIfrObj (EFI_IFR_DEFAULT_OP, (CHAR8 **)&mDefault),
CIfrOpHeader (EFI_IFR_DEFAULT_OP, &mDefault->Header) {
mDefault->Type = Type;
- mDefault->Value = Value;
+ mDefault->Value = Value;
mDefault->DefaultId = DefaultId;
}
@@ -722,7 +729,7 @@ private:
public:
CIfrSubtitle () : CIfrObj (EFI_IFR_SUBTITLE_OP, (CHAR8 **)&mSubtitle),
CIfrOpHeader (EFI_IFR_SUBTITLE_OP, &mSubtitle->Header),
- CIfrStatementHeader (&mSubtitle->Statement) {
+ CIfrStatementHeader (&mSubtitle->Statement) {
mSubtitle->Flags = 0;
}
@@ -856,7 +863,7 @@ private:
public:
CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton),
CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header),
- CIfrStatementHeader (&mResetButton->Question.Header) {
+ CIfrStatementHeader (&mResetButton->Statement) {
mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
}
@@ -874,11 +881,11 @@ public:
CIfrOpHeader (EFI_IFR_CHECKBOX_OP, &mCheckBox->Header),
CIfrQuestionHeader (&mCheckBox->Question) {
mCheckBox->Flags = 0;
- gCurrentQuestion = this;
+ gCurrentQuestion = this;
}
~CIfrCheckBox () {
- gCurrentQuestion = NULL;
+ gCurrentQuestion = NULL;
}
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, UINT8 LFlags) {
@@ -974,11 +981,13 @@ public:
CIfrQuestionHeader (&mNumeric->Question),
CIfrMinMaxStepData (&mNumeric->data) {
mNumeric->Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
- gCurrentQuestion = this;
+ gCurrentQuestion = this;
+ gCurrentIfrOpcode = this;
}
~CIfrNumeric () {
- gCurrentQuestion = NULL;
+ gCurrentQuestion = NULL;
+ gCurrentIfrOpcode = NULL;
}
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
@@ -1008,11 +1017,13 @@ public:
CIfrQuestionHeader (&mOneOf->Question),
CIfrMinMaxStepData (&mOneOf->data) {
mOneOf->Flags = 0;
- gCurrentQuestion = this;
+ gCurrentQuestion = this;
+ gCurrentIfrOpcode = this;
}
~CIfrOneOf () {
- gCurrentQuestion = NULL;
+ gCurrentQuestion = NULL;
+ gCurrentIfrOpcode = NULL;
}
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
diff --git a/BaseTools/Source/C/VfrCompile/VfrSyntax.g b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
index f91a2c3cea..c01f16e5d5 100644
--- a/BaseTools/Source/C/VfrCompile/VfrSyntax.g
+++ b/BaseTools/Source/C/VfrCompile/VfrSyntax.g
@@ -1078,7 +1078,7 @@ vfrStatementRules :
vfrStatementDefault :
<<
BOOLEAN IsExp = FALSE;
- EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
+ EFI_IFR_TYPE_VALUE Val = gZeroEfiIfrTypeValue;
CIfrDefault DObj;
EFI_DEFAULT_ID DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
CHAR8 *VarStoreName = NULL;
@@ -1087,9 +1087,73 @@ vfrStatementDefault :
D:Default << DObj.SetLineNo(D->getLine()); >>
(
(
- vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); >>
- | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] ","
- << DObj.SetType (_GET_CURRQEST_DATATYPE()); DObj.SetValue(Val); >>
+ vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
+ | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," <<
+
+ if (gCurrentIfrOpcode != NULL && gCurrentIfrOpcode->GetObjBinAddr() != NULL) {
+ EFI_IFR_OP_HEADER *TempOpCode;
+ TempOpCode = (EFI_IFR_OP_HEADER *) gCurrentIfrOpcode->GetObjBinAddr();
+ switch (TempOpCode->OpCode) {
+ case EFI_IFR_NUMERIC_OP:
+ EFI_IFR_NUMERIC *TempNumricCode;
+ TempNumricCode = (EFI_IFR_NUMERIC *) TempOpCode;
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ if (Val.u64 < TempNumricCode->data.u64.MinValue || Val.u64 > TempNumricCode->data.u64.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ if (Val.u32 < TempNumricCode->data.u32.MinValue || Val.u32 > TempNumricCode->data.u32.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ if (Val.u16 < TempNumricCode->data.u16.MinValue || Val.u16 > TempNumricCode->data.u16.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ if (Val.u8 < TempNumricCode->data.u8.MinValue || Val.u8 > TempNumricCode->data.u8.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
+ }
+ break;
+ }
+ break;
+ case EFI_IFR_ONE_OF_OP:
+ EFI_IFR_ONE_OF *TempOneOfCode;
+ TempOneOfCode = (EFI_IFR_ONE_OF *) TempOpCode;
+ if (TempOneOfCode->data.u64.MinValue != 0 || TempOneOfCode->data.u64.MaxValue != 0 || TempOneOfCode->data.u64.Step != 0) {
+ //OneOf MinMaxStep Data is set, Val value will be checked for MinMaxStep.
+ switch (_GET_CURRQEST_DATATYPE()) {
+ case EFI_IFR_TYPE_NUM_SIZE_64:
+ if (Val.u64 < TempOneOfCode->data.u64.MinValue || Val.u64 > TempOneOfCode->data.u64.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32:
+ if (Val.u32 < TempOneOfCode->data.u32.MinValue || Val.u32 > TempOneOfCode->data.u32.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16:
+ if (Val.u16 < TempOneOfCode->data.u16.MinValue || Val.u16 > TempOneOfCode->data.u16.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8:
+ if (Val.u8 < TempOneOfCode->data.u8.MinValue || Val.u8 > TempOneOfCode->data.u8.MaxValue) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
+ }
+ break;
+ }
+ }
+ break;
+ }
+ }
+ DObj.SetType (_GET_CURRQEST_DATATYPE());
+ DObj.SetValue(Val);
+ >>
)
{
DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>
@@ -1167,7 +1231,7 @@ flagsField :
vfrStatementValue :
<< CIfrValue VObj; >>
V:Value << VObj.SetLineNo(V->getLine()); >>
- "=" vfrStatementExpression[0]
+ "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
;
vfrStatementSubTitle :
@@ -1588,15 +1652,30 @@ vfrStatementDate :
;
minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
- Minimum "=" Number ","
- Maximum "=" Number ","
+ Minimum "=" MinN:Number ","
+ Maximum "=" MaxN:Number ","
{ "step" "=" Number "," }
{
"default" "=" N:Number "," <<
switch (KeyValue) {
- case 0: D.Year = _STOU16(N->getText()); break;
- case 1: D.Month = _STOU8(N->getText()); break;
- case 2: D.Day = _STOU8(N->getText()); break;
+ case 0:
+ D.Year = _STOU16(N->getText());
+ if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
+ }
+ break;
+ case 1:
+ D.Month = _STOU8(N->getText());
+ if (D.Month < 1 || D.Month > 12) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
+ }
+ break;
+ case 2:
+ D.Day = _STOU8(N->getText());
+ if (D.Day < 1 || D.Day > 31) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
+ }
+ break;
}
>>
}
@@ -1642,10 +1721,30 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
Maximum "=" A:Number ","
<<
switch (_GET_CURRQEST_DATATYPE ()) {
- case EFI_IFR_TYPE_NUM_SIZE_64 : MaxU8 = _STOU64(A->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_32 : MaxU4 = _STOU32(A->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_16 : MaxU2 = _STOU16(A->getText()); break;
- case EFI_IFR_TYPE_NUM_SIZE_8 : MaxU1 = _STOU8(A->getText()); break;
+ case EFI_IFR_TYPE_NUM_SIZE_64 :
+ MaxU8 = _STOU64(A->getText());
+ if (MaxU8 < MinU8) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_32 :
+ MaxU4 = _STOU32(A->getText());
+ if (MaxU4 < MinU4) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_16 :
+ MaxU2 = _STOU16(A->getText());
+ if (MaxU2 < MinU2) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ break;
+ case EFI_IFR_TYPE_NUM_SIZE_8 :
+ MaxU1 = _STOU8(A->getText());
+ if (MaxU1 < MinU1) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
+ }
+ break;
}
>>
{
@@ -1894,9 +1993,24 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
{
"default" "=" N:Number "," <<
switch (KeyValue) {
- case 0: T.Hour = _STOU8(N->getText()); break;
- case 1: T.Minute = _STOU8(N->getText()); break;
- case 2: T.Second = _STOU8(N->getText()); break;
+ case 0:
+ T.Hour = _STOU8(N->getText());
+ if (T.Hour > 23) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
+ }
+ break;
+ case 1:
+ T.Minute = _STOU8(N->getText());
+ if (T.Minute > 59) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
+ }
+ break;
+ case 2:
+ T.Second = _STOU8(N->getText());
+ if (T.Second > 59) {
+ _PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
+ }
+ break;
}
>>
}
@@ -3090,7 +3204,6 @@ public:
VOID _STRCAT (IN OUT CHAR8 **, IN CHAR8 *);
- VOID _CRGUID (EFI_GUID *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *);
VOID _DeclareDefaultLinearVarStore (IN UINT32);
VOID _DeclareStandardDefaultStorage (IN UINT32);
VOID _DeclareDefaultFrameworkVarStore (IN UINT32);
@@ -3490,35 +3603,6 @@ EfiVfrParser::_STRCAT (
*Dest = NewStr;
}
-VOID
-EfiVfrParser::_CRGUID (
- IN EFI_GUID *Guid,
- IN CHAR8 *G1,
- IN CHAR8 *G2,
- IN CHAR8 *G3,
- IN CHAR8 *G4,
- IN CHAR8 *G5,
- IN CHAR8 *G6,
- IN CHAR8 *G7,
- IN CHAR8 *G8,
- IN CHAR8 *G9,
- IN CHAR8 *G10,
- IN CHAR8 *G11
- )
-{
- Guid->Data1 = _STOU32 (G1);
- Guid->Data2 = _STOU16 (G2);
- Guid->Data3 = _STOU16 (G3);
- Guid->Data4[0] = _STOU8(G4);
- Guid->Data4[1] = _STOU8(G5);
- Guid->Data4[2] = _STOU8(G6);
- Guid->Data4[3] = _STOU8(G7);
- Guid->Data4[4] = _STOU8(G8);
- Guid->Data4[5] = _STOU8(G9);
- Guid->Data4[6] = _STOU8(G10);
- Guid->Data4[7] = _STOU8(G11);
-}
-
//
// framework vfr to default declare varstore for each structure
//
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
index e59fbb7743..f047b2c471 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.cpp
@@ -870,7 +870,7 @@ CVfrVarDataTypeDB::Pack (
SVfrPackStackNode *pNode = NULL;
if (mPackStack == NULL) {
- gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "#pragma pack(pop...) : more pops than pushes");
+ gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "#pragma pack(pop...) : more pops than pushes");
}
for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) {
@@ -884,7 +884,7 @@ CVfrVarDataTypeDB::Pack (
if (Action & VFR_PACK_ASSIGN) {
PackAlign = (Number > 1) ? Number + Number % 2 : Number;
if ((PackAlign == 0) || (PackAlign > 16)) {
- gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
+ gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
} else {
mPackAlign = PackAlign;
}
diff --git a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
index 76d7873e54..cb15f280d0 100644
--- a/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
+++ b/BaseTools/Source/C/VfrCompile/VfrUtilityLib.h
@@ -2,7 +2,7 @@
Vfr common library functions.
-Copyright (c) 2004 - 2008, Intel Corporation
+Copyright (c) 2004 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -421,7 +421,4 @@ public:
UINT8 GetRuleId (IN CHAR8 *);
};
-#define MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))
-#define MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
-
#endif
diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index 1df182e4d6..b7237b08e8 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -164,7 +164,7 @@ Returns:
EFI_FIRMWARE_VOLUME_HEADER *FvImage;
UINT32 FvSize;
EFI_STATUS Status;
- UINT32 Offset;
+ int Offset;
BOOLEAN ErasePolarity;
SetUtilityName (UTILITY_NAME);
@@ -622,8 +622,8 @@ Returns:
//
// Print FV header information
//
- printf ("Signature: %s (%X)\n", (char *) Signature, VolumeHeader.Signature);
- printf ("Attributes: %X\n", VolumeHeader.Attributes);
+ printf ("Signature: %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature);
+ printf ("Attributes: %X\n", (unsigned) VolumeHeader.Attributes);
if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) {
printf (" EFI_FVB2_READ_DISABLED_CAP\n");
@@ -907,8 +907,8 @@ Returns:
BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
if (BlockMap.NumBlocks != 0) {
- printf ("Number of Blocks: 0x%08X\n", BlockMap.NumBlocks);
- printf ("Block Length: 0x%08X\n", BlockMap.Length);
+ printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap.NumBlocks);
+ printf ("Block Length: 0x%08X\n", (unsigned) BlockMap.Length);
Size += BlockMap.NumBlocks * BlockMap.Length;
}
@@ -924,7 +924,7 @@ Returns:
return EFI_ABORTED;
}
- printf ("Total Volume Size: 0x%08X\n", Size);
+ printf ("Total Volume Size: 0x%08X\n", (unsigned) Size);
*FvSize = Size;
@@ -998,7 +998,7 @@ Returns:
//
FileLength = GetLength (FileHeader->Size);
printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
- printf ("File Length: 0x%08X\n", FileLength);
+ printf ("File Length: 0x%08X\n", (unsigned) FileLength);
printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
printf ("File State: 0x%02X\n", FileHeader->State);
@@ -1242,7 +1242,7 @@ Returns:
SectionName = SectionNameToStr (Type);
printf ("------------------------------------------------------------\n");
- printf (" Type: %s\n Size: 0x%08X\n", SectionName, SectionLength);
+ printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
free (SectionName);
switch (Type) {
@@ -1288,7 +1288,7 @@ Returns:
CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION);
UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType;
- printf (" Uncompressed Length: 0x%08X\n", UncompressedLength);
+ printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
if (CompressionType == EFI_NOT_COMPRESSED) {
printf (" Compression Type: EFI_NOT_COMPRESSED\n");
@@ -1342,7 +1342,7 @@ Returns:
return EFI_SECTION_ERROR;
}
} else {
- Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", (UINT32) CompressionType);
+ Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType);
return EFI_SECTION_ERROR;
}
@@ -1365,8 +1365,8 @@ Returns:
printf (" SectionDefinitionGuid: ");
PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid);
printf ("\n");
- printf (" DataOffset: 0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
- printf (" Attributes: 0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
+ printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
+ printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
ExtractionTool =
LookupGuidedSectionToolPath (
@@ -1465,7 +1465,7 @@ Returns:
//
// Unknown section, return error
//
- Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", (UINT32) Type);
+ Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type);
return EFI_SECTION_ERROR;
}
@@ -1588,7 +1588,7 @@ Returns:
break;
default:
- printf ("Unrecognized byte in depex: 0x%X\n", (UINT32) *Ptr);
+ printf ("Unrecognized byte in depex: 0x%X\n", *Ptr);
return EFI_SUCCESS;
}
}
@@ -1732,11 +1732,14 @@ LoadGuidedSectionToolsTxt (
{
CHAR8* PeerFilename;
CHAR8* Places[] = {
- FirmwareVolumeFilename,
- //mUtilityFilename,
+ NULL,
+ //NULL,
};
UINTN Index;
+ Places[0] = FirmwareVolumeFilename;
+ //Places[1] = mUtilityFilename;
+
mParsedGuidedSectionTools = NULL;
for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) {