Sync basetools' source and binary files with r1707 of the basetools project.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9257 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@ -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:
|
||||
@ -556,30 +559,6 @@ Returns:
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
//
|
||||
// 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
|
||||
//
|
||||
@ -587,11 +566,7 @@ Returns:
|
||||
// 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
|
||||
@ -609,6 +584,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)
|
||||
//
|
||||
@ -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;
|
||||
}
|
||||
|
Reference in New Issue
Block a user