Sync BaseTools Branch (version r2149) to EDKII main trunk.
BaseTool Branch: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/branches/Releases/BaseTools_r2100 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@11640 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
@@ -159,6 +159,7 @@ PeCoffLoaderGetEntryPoint (
|
||||
|
||||
**/
|
||||
UINT16
|
||||
EFIAPI
|
||||
ThumbMovtImmediateAddress (
|
||||
IN UINT16 *Instruction
|
||||
);
|
||||
@@ -171,11 +172,41 @@ ThumbMovtImmediateAddress (
|
||||
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ThumbMovtImmediatePatch (
|
||||
IN OUT UINT16 *Instruction,
|
||||
IN UINT16 Address
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
||||
return the immediate data encoded in the two` instruction
|
||||
|
||||
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
||||
|
||||
@return Immediate address encoded in the instructions
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
ThumbMovwMovtImmediateAddress (
|
||||
IN UINT16 *Instructions
|
||||
);
|
||||
|
||||
/**
|
||||
Update an ARM MOVW/MOVT immediate instruction instruction pair.
|
||||
|
||||
@param Instructions Pointer to ARM MOVW/MOVT instruction pair
|
||||
@param Address New addres to patch into the instructions
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ThumbMovwMovtImmediatePatch (
|
||||
IN OUT UINT16 *Instructions,
|
||||
IN UINT32 Address
|
||||
);
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
|
@@ -24,6 +24,8 @@ Revision History
|
||||
#include <Common/UefiBaseTypes.h>
|
||||
#include <IndustryStandard/PeImage.h>
|
||||
#include "PeCoffLib.h"
|
||||
#include "CommonLib.h"
|
||||
|
||||
|
||||
#define EXT_IMM64(Value, Address, Size, InstPos, ValPos) \
|
||||
Value |= (((UINT64)((*(Address) >> InstPos) & (((UINT64)1 << Size) - 1))) << ValPos)
|
||||
@@ -374,6 +376,55 @@ ThumbMovtImmediatePatch (
|
||||
*Instruction = (*Instruction & ~0x70ff) | Patch;
|
||||
}
|
||||
|
||||
/**
|
||||
Pass in a pointer to an ARM MOVW/MOVT instruciton pair and
|
||||
return the immediate data encoded in the two` instruction
|
||||
|
||||
@param Instructions Pointer to ARM MOVW/MOVT insturction pair
|
||||
|
||||
@return Immediate address encoded in the instructions
|
||||
|
||||
**/
|
||||
UINT32
|
||||
EFIAPI
|
||||
ThumbMovwMovtImmediateAddress (
|
||||
IN UINT16 *Instructions
|
||||
)
|
||||
{
|
||||
UINT16 *Word;
|
||||
UINT16 *Top;
|
||||
|
||||
Word = Instructions; // MOVW
|
||||
Top = Word + 2; // MOVT
|
||||
|
||||
return (ThumbMovtImmediateAddress (Top) << 16) + ThumbMovtImmediateAddress (Word);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Update an ARM MOVW/MOVT immediate instruction instruction pair.
|
||||
|
||||
@param Instructions Pointer to ARM MOVW/MOVT instruction pair
|
||||
@param Address New addres to patch into the instructions
|
||||
**/
|
||||
VOID
|
||||
EFIAPI
|
||||
ThumbMovwMovtImmediatePatch (
|
||||
IN OUT UINT16 *Instructions,
|
||||
IN UINT32 Address
|
||||
)
|
||||
{
|
||||
UINT16 *Word;
|
||||
UINT16 *Top;
|
||||
|
||||
Word = (UINT16 *)Instructions; // MOVW
|
||||
Top = Word + 2; // MOVT
|
||||
|
||||
ThumbMovtImmediatePatch (Word, (UINT16)(Address & 0xffff));
|
||||
ThumbMovtImmediatePatch (Top, (UINT16)(Address >> 16));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
Performs an ARM-based specific relocation fixup and is a no-op on other
|
||||
instruction sets.
|
||||
@@ -395,38 +446,26 @@ PeCoffLoaderRelocateArmImage (
|
||||
)
|
||||
{
|
||||
UINT16 *Fixup16;
|
||||
UINT16 FixupVal;
|
||||
UINT16 *Addend;
|
||||
UINT32 FixupVal;
|
||||
|
||||
Fixup16 = (UINT16 *) Fixup;
|
||||
Fixup16 = (UINT16 *) Fixup;
|
||||
|
||||
switch ((**Reloc) >> 12) {
|
||||
case EFI_IMAGE_REL_BASED_ARM_THUMB_MOVW:
|
||||
FixupVal = ThumbMovtImmediateAddress (Fixup16) + (UINT16)Adjust;
|
||||
ThumbMovtImmediatePatch (Fixup16, FixupVal);
|
||||
|
||||
|
||||
case EFI_IMAGE_REL_BASED_ARM_MOV32T:
|
||||
FixupVal = ThumbMovwMovtImmediateAddress (Fixup16) + (UINT32)Adjust;
|
||||
ThumbMovwMovtImmediatePatch (Fixup16, FixupVal);
|
||||
|
||||
|
||||
if (*FixupData != NULL) {
|
||||
*FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT16));
|
||||
*(UINT16 *)*FixupData = *Fixup16;
|
||||
*FixupData = *FixupData + sizeof (UINT16);
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IMAGE_REL_BASED_ARM_THUMB_MOVT:
|
||||
// For MOVT you need to know the lower 16-bits do do the math
|
||||
// So this relocation entry is really two entries.
|
||||
*Reloc = *Reloc + 1;
|
||||
Addend = *Reloc;
|
||||
FixupVal = (UINT16)(((ThumbMovtImmediateAddress (Fixup16) << 16) + Adjust + *Addend) >> 16);
|
||||
ThumbMovtImmediatePatch (Fixup16, FixupVal);
|
||||
|
||||
if (*FixupData != NULL) {
|
||||
*FixupData = ALIGN_POINTER (*FixupData, sizeof (UINT16));
|
||||
*(UINT16 *)*FixupData = *Fixup16;
|
||||
*FixupData = *FixupData + sizeof (UINT16);
|
||||
*FixupData = ALIGN_POINTER(*FixupData, sizeof(UINT64));
|
||||
*(UINT64 *)(*FixupData) = *Fixup16;
|
||||
CopyMem (*FixupData, Fixup16, sizeof (UINT64));
|
||||
}
|
||||
break;
|
||||
|
||||
case EFI_IMAGE_REL_BASED_ARM_MOV32A:
|
||||
// break omitted - ARM instruction encoding not implemented
|
||||
default:
|
||||
return RETURN_UNSUPPORTED;
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -263,6 +263,7 @@ ScanSections32 (
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
|
||||
UINT32 CoffEntry;
|
||||
UINT32 SectionCount;
|
||||
|
||||
CoffEntry = 0;
|
||||
mCoffOffset = 0;
|
||||
@@ -291,6 +292,7 @@ ScanSections32 (
|
||||
//
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
mTextOffset = mCoffOffset;
|
||||
SectionCount = 0;
|
||||
for (i = 0; i < mEhdr->e_shnum; i++) {
|
||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||
if (IsTextShdr(shdr)) {
|
||||
@@ -315,6 +317,7 @@ ScanSections32 (
|
||||
}
|
||||
mCoffSectionsOffset[i] = mCoffOffset;
|
||||
mCoffOffset += shdr->sh_size;
|
||||
SectionCount ++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,10 +325,15 @@ ScanSections32 (
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
}
|
||||
|
||||
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
|
||||
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
|
||||
}
|
||||
|
||||
//
|
||||
// Then data sections.
|
||||
//
|
||||
mDataOffset = mCoffOffset;
|
||||
SectionCount = 0;
|
||||
for (i = 0; i < mEhdr->e_shnum; i++) {
|
||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||
if (IsDataShdr(shdr)) {
|
||||
@@ -344,10 +352,15 @@ ScanSections32 (
|
||||
}
|
||||
mCoffSectionsOffset[i] = mCoffOffset;
|
||||
mCoffOffset += shdr->sh_size;
|
||||
SectionCount ++;
|
||||
}
|
||||
}
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
|
||||
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
|
||||
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName);
|
||||
}
|
||||
|
||||
//
|
||||
// The HII resource sections.
|
||||
//
|
||||
@@ -650,18 +663,18 @@ WriteSections32 (
|
||||
case R_ARM_THM_ALU_PREL_11_0:
|
||||
case R_ARM_THM_PC12:
|
||||
case R_ARM_REL32_NOI:
|
||||
case R_ARM_ALU_PC_G0_NC:
|
||||
case R_ARM_ALU_PC_G0:
|
||||
case R_ARM_ALU_PC_G1_NC:
|
||||
case R_ARM_ALU_PC_G1:
|
||||
case R_ARM_ALU_PC_G2:
|
||||
case R_ARM_LDR_PC_G1:
|
||||
case R_ARM_LDR_PC_G2:
|
||||
case R_ARM_LDRS_PC_G0:
|
||||
case R_ARM_LDRS_PC_G1:
|
||||
case R_ARM_LDRS_PC_G2:
|
||||
case R_ARM_LDC_PC_G0:
|
||||
case R_ARM_LDC_PC_G1:
|
||||
case R_ARM_ALU_PC_G0_NC:
|
||||
case R_ARM_ALU_PC_G0:
|
||||
case R_ARM_ALU_PC_G1_NC:
|
||||
case R_ARM_ALU_PC_G1:
|
||||
case R_ARM_ALU_PC_G2:
|
||||
case R_ARM_LDR_PC_G1:
|
||||
case R_ARM_LDR_PC_G2:
|
||||
case R_ARM_LDRS_PC_G0:
|
||||
case R_ARM_LDRS_PC_G1:
|
||||
case R_ARM_LDRS_PC_G2:
|
||||
case R_ARM_LDC_PC_G0:
|
||||
case R_ARM_LDC_PC_G1:
|
||||
case R_ARM_LDC_PC_G2:
|
||||
case R_ARM_GOT_PREL:
|
||||
case R_ARM_THM_JUMP11:
|
||||
@@ -704,6 +717,8 @@ WriteSections32 (
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
UINTN gMovwOffset = 0;
|
||||
|
||||
STATIC
|
||||
VOID
|
||||
WriteRelocations32 (
|
||||
@@ -786,18 +801,18 @@ WriteRelocations32 (
|
||||
case R_ARM_THM_ALU_PREL_11_0:
|
||||
case R_ARM_THM_PC12:
|
||||
case R_ARM_REL32_NOI:
|
||||
case R_ARM_ALU_PC_G0_NC:
|
||||
case R_ARM_ALU_PC_G0:
|
||||
case R_ARM_ALU_PC_G1_NC:
|
||||
case R_ARM_ALU_PC_G1:
|
||||
case R_ARM_ALU_PC_G2:
|
||||
case R_ARM_LDR_PC_G1:
|
||||
case R_ARM_LDR_PC_G2:
|
||||
case R_ARM_LDRS_PC_G0:
|
||||
case R_ARM_LDRS_PC_G1:
|
||||
case R_ARM_LDRS_PC_G2:
|
||||
case R_ARM_LDC_PC_G0:
|
||||
case R_ARM_LDC_PC_G1:
|
||||
case R_ARM_ALU_PC_G0_NC:
|
||||
case R_ARM_ALU_PC_G0:
|
||||
case R_ARM_ALU_PC_G1_NC:
|
||||
case R_ARM_ALU_PC_G1:
|
||||
case R_ARM_ALU_PC_G2:
|
||||
case R_ARM_LDR_PC_G1:
|
||||
case R_ARM_LDR_PC_G2:
|
||||
case R_ARM_LDRS_PC_G0:
|
||||
case R_ARM_LDRS_PC_G1:
|
||||
case R_ARM_LDRS_PC_G2:
|
||||
case R_ARM_LDC_PC_G0:
|
||||
case R_ARM_LDC_PC_G1:
|
||||
case R_ARM_LDC_PC_G2:
|
||||
case R_ARM_GOT_PREL:
|
||||
case R_ARM_THM_JUMP11:
|
||||
@@ -812,19 +827,18 @@ WriteRelocations32 (
|
||||
CoffAddFixup (
|
||||
mCoffSectionsOffset[RelShdr->sh_info]
|
||||
+ (Rel->r_offset - SecShdr->sh_addr),
|
||||
EFI_IMAGE_REL_BASED_ARM_THUMB_MOVW
|
||||
EFI_IMAGE_REL_BASED_ARM_MOV32T
|
||||
);
|
||||
|
||||
// PE/COFF treats MOVW/MOVT relocation as single 64-bit instruction
|
||||
// Track this address so we can log an error for unsupported sequence of MOVW/MOVT
|
||||
gMovwOffset = mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr);
|
||||
break;
|
||||
|
||||
case R_ARM_THM_MOVT_ABS:
|
||||
CoffAddFixup (
|
||||
mCoffSectionsOffset[RelShdr->sh_info]
|
||||
+ (Rel->r_offset - SecShdr->sh_addr),
|
||||
EFI_IMAGE_REL_BASED_ARM_THUMB_MOVT
|
||||
);
|
||||
|
||||
// The relocation entry needs to contain the lower 16-bits so we can do math
|
||||
CoffAddFixupEntry ((UINT16)(Sym->st_value - SymShdr->sh_addr + mCoffSectionsOffset[Sym->st_shndx]));
|
||||
if ((gMovwOffset + 4) != (mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr))) {
|
||||
Error (NULL, 0, 3000, "Not Supported", "PE/COFF requires MOVW+MOVT instruction sequence %x +4 != %x.", gMovwOffset, mCoffSectionsOffset[RelShdr->sh_info] + (Rel->r_offset - SecShdr->sh_addr));
|
||||
}
|
||||
break;
|
||||
|
||||
case R_ARM_ABS32:
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -256,6 +256,7 @@ ScanSections64 (
|
||||
EFI_IMAGE_DOS_HEADER *DosHdr;
|
||||
EFI_IMAGE_OPTIONAL_HEADER_UNION *NtHdr;
|
||||
UINT32 CoffEntry;
|
||||
UINT32 SectionCount;
|
||||
|
||||
CoffEntry = 0;
|
||||
mCoffOffset = 0;
|
||||
@@ -284,6 +285,7 @@ ScanSections64 (
|
||||
//
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
mTextOffset = mCoffOffset;
|
||||
SectionCount = 0;
|
||||
for (i = 0; i < mEhdr->e_shnum; i++) {
|
||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||
if (IsTextShdr(shdr)) {
|
||||
@@ -308,6 +310,7 @@ ScanSections64 (
|
||||
}
|
||||
mCoffSectionsOffset[i] = mCoffOffset;
|
||||
mCoffOffset += (UINT32) shdr->sh_size;
|
||||
SectionCount ++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,10 +318,15 @@ ScanSections64 (
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
}
|
||||
|
||||
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
|
||||
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 text section. Source level debug might not work correctly.", mInImageName);
|
||||
}
|
||||
|
||||
//
|
||||
// Then data sections.
|
||||
//
|
||||
mDataOffset = mCoffOffset;
|
||||
SectionCount = 0;
|
||||
for (i = 0; i < mEhdr->e_shnum; i++) {
|
||||
Elf_Shdr *shdr = GetShdrByIndex(i);
|
||||
if (IsDataShdr(shdr)) {
|
||||
@@ -337,10 +345,15 @@ ScanSections64 (
|
||||
}
|
||||
mCoffSectionsOffset[i] = mCoffOffset;
|
||||
mCoffOffset += (UINT32) shdr->sh_size;
|
||||
SectionCount ++;
|
||||
}
|
||||
}
|
||||
mCoffOffset = CoffAlign(mCoffOffset);
|
||||
|
||||
if (SectionCount > 1 && mOutImageType == FW_EFI_IMAGE) {
|
||||
Warning (NULL, 0, 0, NULL, "Mulitple sections in %s are merged into 1 data section. Source level debug might not work correctly.", mInImageName);
|
||||
}
|
||||
|
||||
//
|
||||
// The HII resource sections.
|
||||
//
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -170,7 +170,7 @@ ConvertElf (
|
||||
//
|
||||
// Determine ELF type and set function table pointer correctly.
|
||||
//
|
||||
VerboseMsg ("Check Efl Image Header");
|
||||
VerboseMsg ("Check Elf Image Header");
|
||||
EiClass = (*FileBuffer)[EI_CLASS];
|
||||
if (EiClass == ELFCLASS32) {
|
||||
if (!InitializeElf32 (*FileBuffer, &ElfFunctions)) {
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -27,6 +27,7 @@ extern CHAR8 *mInImageName;
|
||||
extern UINT32 mImageTimeStamp;
|
||||
extern UINT8 *mCoffFile;
|
||||
extern UINT32 mTableOffset;
|
||||
extern UINT32 mOutImageType;
|
||||
|
||||
//
|
||||
// Common EFI specific data.
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -62,25 +62,6 @@ Abstract:
|
||||
|
||||
#define HII_RESOURCE_SECTION_INDEX 1
|
||||
#define HII_RESOURCE_SECTION_NAME "HII"
|
||||
//
|
||||
// Action for this tool.
|
||||
//
|
||||
#define FW_DUMMY_IMAGE 0
|
||||
#define FW_EFI_IMAGE 1
|
||||
#define FW_TE_IMAGE 2
|
||||
#define FW_ACPI_IMAGE 3
|
||||
#define FW_BIN_IMAGE 4
|
||||
#define FW_ZERO_DEBUG_IMAGE 5
|
||||
#define FW_SET_STAMP_IMAGE 6
|
||||
#define FW_MCI_IMAGE 7
|
||||
#define FW_MERGE_IMAGE 8
|
||||
#define FW_RELOC_STRIPEED_IMAGE 9
|
||||
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
||||
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
||||
#define FW_REBASE_IMAGE 12
|
||||
#define FW_SET_ADDRESS_IMAGE 13
|
||||
|
||||
#define DUMP_TE_HEADER 0x11
|
||||
|
||||
#define DEFAULT_MC_PAD_BYTE_VALUE 0xFF
|
||||
#define DEFAULT_MC_ALIGNMENT 16
|
||||
@@ -121,6 +102,7 @@ static const char *gHiiPackageRCFileHeader[] = {
|
||||
CHAR8 *mInImageName;
|
||||
UINT32 mImageTimeStamp = 0;
|
||||
UINT32 mImageSize = 0;
|
||||
UINT32 mOutImageType = FW_DUMMY_IMAGE;
|
||||
|
||||
|
||||
STATIC
|
||||
@@ -1080,7 +1062,6 @@ Returns:
|
||||
char *OutImageName;
|
||||
char *ModuleType;
|
||||
CHAR8 *TimeStamp;
|
||||
UINT32 OutImageType;
|
||||
FILE *fpIn;
|
||||
FILE *fpOut;
|
||||
FILE *fpInOut;
|
||||
@@ -1147,7 +1128,6 @@ Returns:
|
||||
mInImageName = NULL;
|
||||
OutImageName = NULL;
|
||||
ModuleType = NULL;
|
||||
OutImageType = FW_DUMMY_IMAGE;
|
||||
Type = 0;
|
||||
Status = STATUS_SUCCESS;
|
||||
FileBuffer = NULL;
|
||||
@@ -1221,8 +1201,8 @@ Returns:
|
||||
goto Finish;
|
||||
}
|
||||
ModuleType = argv[1];
|
||||
if (OutImageType != FW_TE_IMAGE) {
|
||||
OutImageType = FW_EFI_IMAGE;
|
||||
if (mOutImageType != FW_TE_IMAGE) {
|
||||
mOutImageType = FW_EFI_IMAGE;
|
||||
}
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
@@ -1230,49 +1210,49 @@ Returns:
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-l") == 0) || (stricmp (argv[0], "--stripped") == 0)) {
|
||||
OutImageType = FW_RELOC_STRIPEED_IMAGE;
|
||||
mOutImageType = FW_RELOC_STRIPEED_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--acpi") == 0)) {
|
||||
OutImageType = FW_ACPI_IMAGE;
|
||||
mOutImageType = FW_ACPI_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-t") == 0) || (stricmp (argv[0], "--terse") == 0)) {
|
||||
OutImageType = FW_TE_IMAGE;
|
||||
mOutImageType = FW_TE_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-u") == 0) || (stricmp (argv[0], "--dump") == 0)) {
|
||||
OutImageType = DUMP_TE_HEADER;
|
||||
mOutImageType = DUMP_TE_HEADER;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--exe2bin") == 0)) {
|
||||
OutImageType = FW_BIN_IMAGE;
|
||||
mOutImageType = FW_BIN_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-z") == 0) || (stricmp (argv[0], "--zero") == 0)) {
|
||||
OutImageType = FW_ZERO_DEBUG_IMAGE;
|
||||
mOutImageType = FW_ZERO_DEBUG_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--stamp") == 0)) {
|
||||
OutImageType = FW_SET_STAMP_IMAGE;
|
||||
mOutImageType = FW_SET_STAMP_IMAGE;
|
||||
if (argv[1] == NULL || argv[1][0] == '-') {
|
||||
Error (NULL, 0, 1003, "Invalid option value", "time stamp is missing for -s option");
|
||||
goto Finish;
|
||||
@@ -1305,14 +1285,14 @@ Returns:
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--mcifile") == 0)) {
|
||||
OutImageType = FW_MCI_IMAGE;
|
||||
mOutImageType = FW_MCI_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((stricmp (argv[0], "-j") == 0) || (stricmp (argv[0], "--join") == 0)) {
|
||||
OutImageType = FW_MERGE_IMAGE;
|
||||
mOutImageType = FW_MERGE_IMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
@@ -1341,7 +1321,7 @@ Returns:
|
||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||
goto Finish;
|
||||
}
|
||||
OutImageType = FW_REBASE_IMAGE;
|
||||
mOutImageType = FW_REBASE_IMAGE;
|
||||
NewBaseAddress = (UINT64) Temp64;
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
@@ -1360,7 +1340,7 @@ Returns:
|
||||
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
|
||||
goto Finish;
|
||||
}
|
||||
OutImageType = FW_SET_ADDRESS_IMAGE;
|
||||
mOutImageType = FW_SET_ADDRESS_IMAGE;
|
||||
NewBaseAddress = (UINT64) Temp64;
|
||||
argc -= 2;
|
||||
argv += 2;
|
||||
@@ -1423,14 +1403,14 @@ Returns:
|
||||
}
|
||||
|
||||
if (stricmp (argv[0], "--hiipackage") == 0) {
|
||||
OutImageType = FW_HII_PACKAGE_LIST_RCIMAGE;
|
||||
mOutImageType = FW_HII_PACKAGE_LIST_RCIMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (stricmp (argv[0], "--hiibinpackage") == 0) {
|
||||
OutImageType = FW_HII_PACKAGE_LIST_BINIMAGE;
|
||||
mOutImageType = FW_HII_PACKAGE_LIST_BINIMAGE;
|
||||
argc --;
|
||||
argv ++;
|
||||
continue;
|
||||
@@ -1475,7 +1455,7 @@ Returns:
|
||||
|
||||
VerboseMsg ("%s tool start.", UTILITY_NAME);
|
||||
|
||||
if (OutImageType == FW_DUMMY_IMAGE) {
|
||||
if (mOutImageType == FW_DUMMY_IMAGE) {
|
||||
Error (NULL, 0, 1001, "Missing option", "No create file action specified; pls specify -e, -c or -t option to create efi image, or acpi table or TeImage!");
|
||||
if (ReplaceFlag) {
|
||||
Error (NULL, 0, 1001, "Missing option", "-r option is not supported as the independent option. It can be used together with other create file option specified at the above.");
|
||||
@@ -1494,7 +1474,7 @@ Returns:
|
||||
//
|
||||
// Combine MciBinary files to one file
|
||||
//
|
||||
if ((OutImageType == FW_MERGE_IMAGE) && ReplaceFlag) {
|
||||
if ((mOutImageType == FW_MERGE_IMAGE) && ReplaceFlag) {
|
||||
Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with -j merge files option.");
|
||||
goto Finish;
|
||||
}
|
||||
@@ -1502,12 +1482,12 @@ Returns:
|
||||
//
|
||||
// Combine HiiBinary packages to a single package list
|
||||
//
|
||||
if ((OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) && ReplaceFlag) {
|
||||
if ((mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) && ReplaceFlag) {
|
||||
Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with --hiipackage merge files option.");
|
||||
goto Finish;
|
||||
}
|
||||
|
||||
if ((OutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) && ReplaceFlag) {
|
||||
if ((mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) && ReplaceFlag) {
|
||||
Error (NULL, 0, 1002, "Conflicting option", "-r replace option cannot be used with --hiibinpackage merge files option.");
|
||||
goto Finish;
|
||||
}
|
||||
@@ -1521,7 +1501,7 @@ Returns:
|
||||
//
|
||||
// Action will be taken for the input file.
|
||||
//
|
||||
switch (OutImageType) {
|
||||
switch (mOutImageType) {
|
||||
case FW_EFI_IMAGE:
|
||||
VerboseMsg ("Create efi image on module type %s based on the input PE image.", ModuleType);
|
||||
break;
|
||||
@@ -1599,7 +1579,7 @@ Returns:
|
||||
fpOut = NULL;
|
||||
}
|
||||
VerboseMsg ("Output file name is %s", OutImageName);
|
||||
} else if (!ReplaceFlag && OutImageType != DUMP_TE_HEADER) {
|
||||
} else if (!ReplaceFlag && mOutImageType != DUMP_TE_HEADER) {
|
||||
Error (NULL, 0, 1001, "Missing option", "output file");
|
||||
goto Finish;
|
||||
}
|
||||
@@ -1634,7 +1614,7 @@ Returns:
|
||||
//
|
||||
// Combine multi binary HII package files.
|
||||
//
|
||||
if (OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE || OutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
|
||||
if (mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE || mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
|
||||
//
|
||||
// Open output file handle.
|
||||
//
|
||||
@@ -1711,7 +1691,7 @@ Returns:
|
||||
//
|
||||
// write the hii package into the binary package list file with the resource section header
|
||||
//
|
||||
if (OutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
|
||||
if (mOutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
|
||||
//
|
||||
// Create the resource section header
|
||||
//
|
||||
@@ -1735,7 +1715,7 @@ Returns:
|
||||
//
|
||||
// write the hii package into the text package list rc file.
|
||||
//
|
||||
if (OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) {
|
||||
if (mOutImageType == FW_HII_PACKAGE_LIST_RCIMAGE) {
|
||||
for (Index = 0; gHiiPackageRCFileHeader[Index] != NULL; Index++) {
|
||||
fprintf (fpOut, "%s\n", gHiiPackageRCFileHeader[Index]);
|
||||
}
|
||||
@@ -1770,7 +1750,7 @@ Returns:
|
||||
//
|
||||
// Combine MciBinary files to one file
|
||||
//
|
||||
if (OutImageType == FW_MERGE_IMAGE) {
|
||||
if (mOutImageType == FW_MERGE_IMAGE) {
|
||||
//
|
||||
// Open output file handle.
|
||||
//
|
||||
@@ -1821,7 +1801,7 @@ Returns:
|
||||
//
|
||||
// Convert MicroCode.txt file to MicroCode.bin file
|
||||
//
|
||||
if (OutImageType == FW_MCI_IMAGE) {
|
||||
if (mOutImageType == FW_MCI_IMAGE) {
|
||||
fpIn = fopen (mInImageName, "r");
|
||||
if (fpIn == NULL) {
|
||||
Error (NULL, 0, 0001, "Error opening file", mInImageName);
|
||||
@@ -1935,7 +1915,7 @@ Returns:
|
||||
//
|
||||
// Dump TeImage Header into output file.
|
||||
//
|
||||
if (OutImageType == DUMP_TE_HEADER) {
|
||||
if (mOutImageType == DUMP_TE_HEADER) {
|
||||
memcpy (&TEImageHeader, FileBuffer, sizeof (TEImageHeader));
|
||||
if (TEImageHeader.Signature != EFI_TE_IMAGE_HEADER_SIGNATURE) {
|
||||
Error (NULL, 0, 3000, "Invalid", "TE header signature of file %s is not correct.", mInImageName);
|
||||
@@ -1994,12 +1974,12 @@ Returns:
|
||||
// Following code to convert dll to efi image or te image.
|
||||
// Get new image type
|
||||
//
|
||||
if ((OutImageType == FW_EFI_IMAGE) || (OutImageType == FW_TE_IMAGE)) {
|
||||
if ((mOutImageType == FW_EFI_IMAGE) || (mOutImageType == FW_TE_IMAGE)) {
|
||||
if (ModuleType == NULL) {
|
||||
if (OutImageType == FW_EFI_IMAGE) {
|
||||
if (mOutImageType == FW_EFI_IMAGE) {
|
||||
Error (NULL, 0, 1001, "Missing option", "EFI_FILETYPE");
|
||||
goto Finish;
|
||||
} else if (OutImageType == FW_TE_IMAGE) {
|
||||
} else if (mOutImageType == FW_TE_IMAGE) {
|
||||
//
|
||||
// Default TE Image Type is Boot service driver
|
||||
//
|
||||
@@ -2047,7 +2027,7 @@ Returns:
|
||||
}
|
||||
|
||||
//
|
||||
// Convert EFL image to PeImage
|
||||
// Convert ELF image to PeImage
|
||||
//
|
||||
if (IsElfHeader(FileBuffer)) {
|
||||
VerboseMsg ("Convert %s from ELF to PE/COFF.", mInImageName);
|
||||
@@ -2066,7 +2046,7 @@ Returns:
|
||||
//
|
||||
// Remove reloc section from PE or TE image
|
||||
//
|
||||
if (OutImageType == FW_RELOC_STRIPEED_IMAGE) {
|
||||
if (mOutImageType == FW_RELOC_STRIPEED_IMAGE) {
|
||||
//
|
||||
// Check TeImage
|
||||
//
|
||||
@@ -2184,7 +2164,7 @@ Returns:
|
||||
//
|
||||
// Set new base address into image
|
||||
//
|
||||
if (OutImageType == FW_REBASE_IMAGE || OutImageType == FW_SET_ADDRESS_IMAGE) {
|
||||
if (mOutImageType == FW_REBASE_IMAGE || mOutImageType == FW_SET_ADDRESS_IMAGE) {
|
||||
if ((PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) && (PeHdr->Pe32.FileHeader.Machine != IMAGE_FILE_MACHINE_IA64)) {
|
||||
if (NewBaseAddress >= 0x100000000ULL) {
|
||||
Error (NULL, 0, 3000, "Invalid", "New base address is larger than 4G for 32bit PE image");
|
||||
@@ -2198,7 +2178,7 @@ Returns:
|
||||
//
|
||||
NewBaseAddress = (UINT64) (0 - NewBaseAddress);
|
||||
}
|
||||
if (OutImageType == FW_REBASE_IMAGE) {
|
||||
if (mOutImageType == FW_REBASE_IMAGE) {
|
||||
Status = RebaseImage (mInImageName, FileBuffer, NewBaseAddress);
|
||||
} else {
|
||||
Status = SetAddressToSectionHeader (mInImageName, FileBuffer, NewBaseAddress);
|
||||
@@ -2221,7 +2201,7 @@ Returns:
|
||||
//
|
||||
// Extract bin data from Pe image.
|
||||
//
|
||||
if (OutImageType == FW_BIN_IMAGE) {
|
||||
if (mOutImageType == FW_BIN_IMAGE) {
|
||||
if (FileLength < PeHdr->Pe32.OptionalHeader.SizeOfHeaders) {
|
||||
Error (NULL, 0, 3000, "Invalid", "FileSize of %s is not a legal size.", mInImageName);
|
||||
goto Finish;
|
||||
@@ -2230,7 +2210,7 @@ Returns:
|
||||
// Output bin data from exe file
|
||||
//
|
||||
FileLength = FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders;
|
||||
memcpy (FileBuffer, FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, FileLength);
|
||||
memmove (FileBuffer, FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, FileLength);
|
||||
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
|
||||
goto WriteFile;
|
||||
}
|
||||
@@ -2238,7 +2218,7 @@ Returns:
|
||||
//
|
||||
// Zero Debug Information of Pe Image
|
||||
//
|
||||
if (OutImageType == FW_ZERO_DEBUG_IMAGE) {
|
||||
if (mOutImageType == FW_ZERO_DEBUG_IMAGE) {
|
||||
Status = ZeroDebugData (FileBuffer, TRUE);
|
||||
if (EFI_ERROR (Status)) {
|
||||
Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%x", (int) Status);
|
||||
@@ -2255,7 +2235,7 @@ Returns:
|
||||
//
|
||||
// Set Time Stamp of Pe Image
|
||||
//
|
||||
if (OutImageType == FW_SET_STAMP_IMAGE) {
|
||||
if (mOutImageType == FW_SET_STAMP_IMAGE) {
|
||||
Status = SetStamp (FileBuffer, TimeStamp);
|
||||
if (EFI_ERROR (Status)) {
|
||||
goto Finish;
|
||||
@@ -2271,7 +2251,7 @@ Returns:
|
||||
//
|
||||
// Extract acpi data from pe image.
|
||||
//
|
||||
if (OutImageType == FW_ACPI_IMAGE) {
|
||||
if (mOutImageType == FW_ACPI_IMAGE) {
|
||||
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) ((UINT8 *) &(PeHdr->Pe32.OptionalHeader) + PeHdr->Pe32.FileHeader.SizeOfOptionalHeader);
|
||||
for (Index = 0; Index < PeHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
|
||||
if (strcmp ((char *)SectionHeader->Name, ".data") == 0 || strcmp ((char *)SectionHeader->Name, ".sdata") == 0) {
|
||||
@@ -2292,7 +2272,7 @@ Returns:
|
||||
//
|
||||
// Output Apci data to file
|
||||
//
|
||||
memcpy (FileBuffer, FileBuffer + SectionHeader->PointerToRawData, FileLength);
|
||||
memmove (FileBuffer, FileBuffer + SectionHeader->PointerToRawData, FileLength);
|
||||
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
|
||||
goto WriteFile;
|
||||
}
|
||||
@@ -2599,7 +2579,7 @@ Returns:
|
||||
//
|
||||
ZeroDebugData (FileBuffer, FALSE);
|
||||
|
||||
if (OutImageType == FW_TE_IMAGE) {
|
||||
if (mOutImageType == FW_TE_IMAGE) {
|
||||
if ((PeHdr->Pe32.FileHeader.NumberOfSections &~0xFF) || (Type &~0xFF)) {
|
||||
//
|
||||
// Pack the subsystem and NumberOfSections into 1 byte. Make sure they fit both.
|
||||
@@ -2622,7 +2602,7 @@ Returns:
|
||||
// Update Image to TeImage
|
||||
//
|
||||
FileLength = FileLength - TEImageHeader.StrippedSize;
|
||||
memcpy (FileBuffer + sizeof (EFI_TE_IMAGE_HEADER), FileBuffer + TEImageHeader.StrippedSize, FileLength);
|
||||
memmove (FileBuffer + sizeof (EFI_TE_IMAGE_HEADER), FileBuffer + TEImageHeader.StrippedSize, FileLength);
|
||||
FileLength = FileLength + sizeof (EFI_TE_IMAGE_HEADER);
|
||||
memcpy (FileBuffer, &TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER));
|
||||
VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength));
|
||||
|
@@ -1,6 +1,6 @@
|
||||
/** @file
|
||||
|
||||
Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
|
||||
This program and the accompanying materials are licensed and made available
|
||||
under the terms and conditions of the BSD License which accompanies this
|
||||
@@ -15,6 +15,26 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
#ifndef _GEN_FW_H_
|
||||
#define _GEN_FW_H_
|
||||
|
||||
//
|
||||
// Action for this tool.
|
||||
//
|
||||
#define FW_DUMMY_IMAGE 0
|
||||
#define FW_EFI_IMAGE 1
|
||||
#define FW_TE_IMAGE 2
|
||||
#define FW_ACPI_IMAGE 3
|
||||
#define FW_BIN_IMAGE 4
|
||||
#define FW_ZERO_DEBUG_IMAGE 5
|
||||
#define FW_SET_STAMP_IMAGE 6
|
||||
#define FW_MCI_IMAGE 7
|
||||
#define FW_MERGE_IMAGE 8
|
||||
#define FW_RELOC_STRIPEED_IMAGE 9
|
||||
#define FW_HII_PACKAGE_LIST_RCIMAGE 10
|
||||
#define FW_HII_PACKAGE_LIST_BINIMAGE 11
|
||||
#define FW_REBASE_IMAGE 12
|
||||
#define FW_SET_ADDRESS_IMAGE 13
|
||||
|
||||
#define DUMP_TE_HEADER 0x11
|
||||
|
||||
VOID
|
||||
SetHiiResourceHeader (
|
||||
UINT8 *HiiBinData,
|
||||
|
@@ -516,8 +516,6 @@ typedef struct {
|
||||
#define EFI_IMAGE_REL_BASED_IA64_IMM64 9
|
||||
#define EFI_IMAGE_REL_BASED_DIR64 10
|
||||
|
||||
#define EFI_IMAGE_REL_BASED_ARM_THUMB_MOVW 11
|
||||
#define EFI_IMAGE_REL_BASED_ARM_THUMB_MOVT 12
|
||||
|
||||
///
|
||||
/// Line number format.
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler main class and main function.
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -383,7 +383,7 @@ CVfrCompiler::Usage (
|
||||
CONST CHAR8 *Help[] = {
|
||||
" ",
|
||||
"VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
|
||||
"Copyright (c) 2004-2010 Intel Corporation. All rights reserved.",
|
||||
"Copyright (c) 2004-2011 Intel Corporation. All rights reserved.",
|
||||
" ",
|
||||
"Usage: VfrCompile [options] VfrFile",
|
||||
" ",
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler internal defintions.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -23,7 +23,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
|
||||
|
||||
#define PROGRAM_NAME "VfrCompile"
|
||||
#define VFR_COMPILER_VERSION " 1.95 (UEFI 2.1)"
|
||||
#define VFR_COMPILER_UPDATE_TIME " updated on 2009/05/20"
|
||||
#define VFR_COMPILER_UPDATE_TIME " updated on 2011/02/25"
|
||||
//
|
||||
// This is how we invoke the C preprocessor on the VFR source file
|
||||
// to resolve #defines, #includes, etc. To make C source files
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler error handler.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -34,6 +34,7 @@ static SVFR_ERROR_HANDLE VFR_ERROR_HANDLE_TABLE [] = {
|
||||
{ VFR_RETURN_VARSTOREID_REDEFINED, ": varstore id already defined" },
|
||||
{ VFR_RETURN_UNDEFINED, ": undefined" },
|
||||
{ VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION, ": some variable has not defined by a question"},
|
||||
{ VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR, ": Data Structure is defined by more than one varstores, it can't be referred as varstore, only varstore name could be used."},
|
||||
{ VFR_RETURN_GET_EFIVARSTORE_ERROR, ": get efi varstore error"},
|
||||
{ VFR_RETURN_EFIVARSTORE_USE_ERROR, ": can not use the efi varstore like this" },
|
||||
{ VFR_RETURN_EFIVARSTORE_SIZE_ERROR, ": unsupport efi varstore size should be <= 8 bytes" },
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
VfrCompiler Error definition
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -32,6 +32,7 @@ typedef enum {
|
||||
VFR_RETURN_VARSTOREID_REDEFINED,
|
||||
VFR_RETURN_UNDEFINED,
|
||||
VFR_RETURN_VAR_NOTDEFINED_BY_QUESTION,
|
||||
VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR,
|
||||
VFR_RETURN_GET_EFIVARSTORE_ERROR,
|
||||
VFR_RETURN_EFIVARSTORE_USE_ERROR,
|
||||
VFR_RETURN_EFIVARSTORE_SIZE_ERROR,
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
The definition of CFormPkg's member function
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -1697,6 +1697,25 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrGuid : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_GUID *mGuid;
|
||||
|
||||
public:
|
||||
CIfrGuid (UINT8 Size) : CIfrObj (EFI_IFR_GUID_OP, (CHAR8 **)&mGuid, sizeof (EFI_IFR_GUID)+Size),
|
||||
CIfrOpHeader (EFI_IFR_GUID_OP, &mGuid->Header, sizeof (EFI_IFR_GUID)+Size) {
|
||||
memset (&mGuid->Guid, 0, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetGuid (IN EFI_GUID *Guid) {
|
||||
memcpy (&mGuid->Guid, Guid, sizeof (EFI_GUID));
|
||||
}
|
||||
|
||||
VOID SetData (IN UINT8* DataBuff, IN UINT8 Size) {
|
||||
memcpy ((UINT8 *)mGuid + sizeof (EFI_IFR_GUID), DataBuff, Size);
|
||||
}
|
||||
};
|
||||
|
||||
class CIfrDup : public CIfrObj, public CIfrOpHeader {
|
||||
private:
|
||||
EFI_IFR_DUP *mDup;
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/*++
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -233,6 +233,11 @@ VfrParserStart (
|
||||
#token Refresh("refresh") "refresh"
|
||||
#token Interval("interval") "interval"
|
||||
#token VarstoreDevice("varstoredevice") "varstoredevice"
|
||||
#token GuidOp("guidop") "guidop"
|
||||
#token EndGuidOp("endguidop") "endguidop"
|
||||
#token DataType("datatype") "datatype"
|
||||
#token Data("data") "data"
|
||||
|
||||
//
|
||||
// Define the class and subclass tokens
|
||||
//
|
||||
@@ -559,10 +564,195 @@ vfrFormSetList :
|
||||
vfrStatementVarStoreNameValue |
|
||||
vfrStatementDefaultStore |
|
||||
vfrStatementDisableIfFormSet |
|
||||
vfrStatementSuppressIfFormSet
|
||||
vfrStatementSuppressIfFormSet |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
;
|
||||
|
||||
vfrStatementExtension:
|
||||
<<
|
||||
EFI_GUID Guid;
|
||||
CIfrGuid *GuidObj = NULL;
|
||||
CHAR8 *TypeName = NULL;
|
||||
UINT32 TypeSize = 0;
|
||||
UINT8 *DataBuff = NULL;
|
||||
UINT32 Size = 0;
|
||||
UINT8 Idx = 0;
|
||||
UINT32 LineNum;
|
||||
BOOLEAN IsStruct = FALSE;
|
||||
UINT32 ArrayNum = 0;
|
||||
>>
|
||||
L:GuidOp
|
||||
Uuid "=" guidDefinition[Guid]
|
||||
{"," DataType "="
|
||||
(
|
||||
U64:"UINT64" {OpenBracket AN1:Number CloseBracket <<ArrayNum = _STOU32(AN1->getText());>>}
|
||||
<< TypeName = U64->getText(); LineNum = U64->getLine(); >>
|
||||
| U32:"UINT32" {OpenBracket AN2:Number CloseBracket <<ArrayNum = _STOU32(AN2->getText());>>}
|
||||
<< TypeName = U32->getText(); LineNum = U32->getLine(); >>
|
||||
| U16:"UINT16" {OpenBracket AN3:Number CloseBracket <<ArrayNum = _STOU32(AN3->getText());>>}
|
||||
<< TypeName = U16->getText(); LineNum = U16->getLine(); >>
|
||||
| U8:"UINT8" {OpenBracket AN4:Number CloseBracket <<ArrayNum = _STOU32(AN4->getText());>>}
|
||||
<< TypeName = U8->getText(); LineNum = U8->getLine(); >>
|
||||
| BL:"BOOLEAN" {OpenBracket AN5:Number CloseBracket <<ArrayNum = _STOU32(AN5->getText());>>}
|
||||
<< TypeName = BL->getText(); LineNum = BL->getLine(); >>
|
||||
| SI:"EFI_STRING_ID" {OpenBracket AN6:Number CloseBracket <<ArrayNum = _STOU32(AN6->getText());>>}
|
||||
<< TypeName = SI->getText(); LineNum = SI->getLine(); >>
|
||||
| D:"EFI_HII_DATE" {OpenBracket AN7:Number CloseBracket <<ArrayNum = _STOU32(AN7->getText());>>}
|
||||
<< TypeName = D->getText(); LineNum = D->getLine(); IsStruct = TRUE;>>
|
||||
| T:"EFI_HII_TIME" {OpenBracket AN8:Number CloseBracket <<ArrayNum = _STOU32(AN8->getText());>>}
|
||||
<< TypeName = T->getText(); LineNum = T->getLine(); IsStruct = TRUE;>>
|
||||
| TN:StringIdentifier {OpenBracket AN9:Number CloseBracket <<ArrayNum = _STOU32(AN9->getText());>>}
|
||||
<< TypeName = TN->getText(); LineNum = TN->getLine(); IsStruct = TRUE;>>
|
||||
)
|
||||
<<
|
||||
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &TypeSize), LineNum);
|
||||
if (ArrayNum > 0) {
|
||||
Size = TypeSize*ArrayNum;
|
||||
} else {
|
||||
Size = TypeSize;
|
||||
}
|
||||
if (Size > (128 - sizeof (EFI_IFR_GUID))) return;
|
||||
DataBuff = (UINT8 *)malloc(Size);
|
||||
for (Idx = 0; Idx < Size; Idx++) {
|
||||
DataBuff[Idx] = 0;
|
||||
}
|
||||
>>
|
||||
vfrExtensionData [DataBuff, Size, TypeName, TypeSize, IsStruct, ArrayNum]
|
||||
}
|
||||
<<
|
||||
{
|
||||
GuidObj = new CIfrGuid(Size);
|
||||
if (GuidObj != NULL) {
|
||||
GuidObj->SetLineNo(L->getLine());
|
||||
GuidObj->SetGuid (&Guid);
|
||||
}
|
||||
}
|
||||
if (TypeName != NULL) {
|
||||
GuidObj->SetData(DataBuff, Size);
|
||||
}
|
||||
>>
|
||||
{","
|
||||
(
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndGuidOp << GuidObj->SetScope(1); CRT_END_OP (E); >>
|
||||
}
|
||||
<<
|
||||
if (GuidObj != NULL) delete GuidObj;
|
||||
if (DataBuff != NULL) free(DataBuff);
|
||||
>>
|
||||
";"
|
||||
;
|
||||
|
||||
vfrExtensionData[UINT8 *DataBuff, UINT32 Size, CHAR8 *TypeName, UINT32 TypeSize, BOOLEAN IsStruct, UINT32 ArrayNum]:
|
||||
<<
|
||||
CHAR8 *TFName = NULL;
|
||||
UINT32 ArrayIdx = 0;
|
||||
UINT16 FieldOffset;
|
||||
UINT8 FieldType;
|
||||
UINT32 FieldSize;
|
||||
UINT64 Data_U64 = 0;
|
||||
UINT32 Data_U32 = 0;
|
||||
UINT16 Data_U16 = 0;
|
||||
UINT8 Data_U8 = 0;
|
||||
BOOLEAN Data_BL = 0;
|
||||
EFI_STRING_ID Data_SID = 0;
|
||||
BOOLEAN IsArray = FALSE;
|
||||
UINT8 *ByteOffset = NULL;
|
||||
>>
|
||||
(
|
||||
("," "data" {OpenBracket IDX1:Number CloseBracket <<IsArray = TRUE;>>}
|
||||
<<
|
||||
ArrayIdx = 0;
|
||||
if (IsArray == TRUE) {
|
||||
ArrayIdx = _STOU8(IDX1->getText());
|
||||
if (ArrayIdx >= ArrayNum) return;
|
||||
IsArray = FALSE;
|
||||
}
|
||||
ByteOffset = DataBuff + (ArrayIdx * TypeSize);
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, TypeName);
|
||||
}
|
||||
>>
|
||||
("." FN:StringIdentifier
|
||||
<<
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, ".");
|
||||
_STRCAT(&TFName, FN->getText());
|
||||
}
|
||||
>>
|
||||
{
|
||||
OpenBracket IDX2:Number CloseBracket
|
||||
<<
|
||||
if (IsStruct == TRUE) {
|
||||
_STRCAT(&TFName, "[");
|
||||
_STRCAT(&TFName, IDX2->getText());
|
||||
_STRCAT(&TFName, "]");
|
||||
}
|
||||
>>
|
||||
}
|
||||
)*
|
||||
"=" RD:Number
|
||||
<<
|
||||
if (IsStruct == FALSE) {
|
||||
if (strcmp ("UINT64", TypeName) == 0) {
|
||||
Data_U64 = _STOU64(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U64, TypeSize);
|
||||
}else if (strcmp ("UINT32", TypeName) == 0) {
|
||||
Data_U32 = _STOU32(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U32, TypeSize);
|
||||
}else if (strcmp ("UINT16", TypeName) == 0) {
|
||||
Data_U16 = _STOU16(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U16, TypeSize);
|
||||
}else if (strcmp ("UINT8", TypeName) == 0) {
|
||||
Data_U8 = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset, &Data_U8, TypeSize);
|
||||
}else if (strcmp ("BOOLEAN", TypeName)== 0) {
|
||||
Data_BL = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset, &Data_BL, TypeSize);
|
||||
}else if (strcmp ("EFI_STRING_ID", TypeName) == 0) {
|
||||
Data_SID = _STOSID(RD->getText());
|
||||
memcpy (ByteOffset, &Data_SID, TypeSize);
|
||||
}
|
||||
} else {
|
||||
gCVfrVarDataTypeDB.GetDataFieldInfo(TFName, FieldOffset, FieldType, FieldSize);
|
||||
switch (FieldType) {
|
||||
case EFI_IFR_TYPE_NUM_SIZE_8:
|
||||
Data_U8 = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U8, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_16:
|
||||
Data_U16 = _STOU16(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U16, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_32:
|
||||
Data_U32 = _STOU32(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U32, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_NUM_SIZE_64:
|
||||
Data_U64 = _STOU64(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_U64, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_BOOLEAN:
|
||||
Data_BL = _STOU8(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_BL, FieldSize);
|
||||
break;
|
||||
case EFI_IFR_TYPE_STRING:
|
||||
Data_SID = _STOSID(RD->getText());
|
||||
memcpy (ByteOffset + FieldOffset, &Data_SID, FieldSize);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (TFName != NULL) { delete TFName; TFName = NULL; }
|
||||
>>
|
||||
)*
|
||||
)
|
||||
;
|
||||
|
||||
|
||||
vfrStatementDefaultStore :
|
||||
<< UINT16 DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; >>
|
||||
D:DefaultStore N:StringIdentifier ","
|
||||
@@ -1060,7 +1250,8 @@ vfrFormDefinition :
|
||||
vfrStatementLabel |
|
||||
vfrStatementBanner |
|
||||
// Just for framework vfr compatibility
|
||||
vfrStatementInvalid
|
||||
vfrStatementInvalid |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndForm <<
|
||||
if (mCompatibleMode) {
|
||||
@@ -1118,7 +1309,8 @@ vfrFormMapDefinition :
|
||||
vfrStatementQuestions |
|
||||
vfrStatementConditional |
|
||||
vfrStatementLabel |
|
||||
vfrStatementBanner
|
||||
vfrStatementBanner |
|
||||
vfrStatementExtension
|
||||
)*
|
||||
E:EndForm << CRT_END_OP (E); >>
|
||||
";"
|
||||
@@ -2146,7 +2338,8 @@ vfrStatementQuestionTag :
|
||||
vfrStatementNoSubmitIf |
|
||||
vfrStatementDisableIfQuest |
|
||||
vfrStatementRefresh |
|
||||
vfrStatementVarstoreDevice
|
||||
vfrStatementVarstoreDevice |
|
||||
vfrStatementExtension
|
||||
;
|
||||
|
||||
vfrStatementQuestionTagList :
|
||||
@@ -2175,6 +2368,7 @@ vfrStatementStatList :
|
||||
vfrStatementQuestions |
|
||||
vfrStatementConditionalNew |
|
||||
vfrStatementLabel |
|
||||
vfrStatementExtension |
|
||||
// Just for framework vfr compatibility
|
||||
vfrStatementInvalid
|
||||
;
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2008, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -622,6 +622,9 @@ CVfrVarDataTypeDB::ExtractFieldNameAndArrary (
|
||||
if (*VarStr == ']') {
|
||||
VarStr++;
|
||||
}
|
||||
if (*VarStr == '.') {
|
||||
VarStr++;
|
||||
}
|
||||
return VFR_RETURN_SUCCESS;
|
||||
case ']':
|
||||
return VFR_RETURN_DATA_STRING_ERROR;
|
||||
@@ -1456,10 +1459,8 @@ CVfrDataStorage::DeclareNameVarStoreBegin (
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mNameVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_NAME);
|
||||
@@ -1531,10 +1532,8 @@ CVfrDataStorage::DeclareEfiVarStore (
|
||||
return VFR_RETURN_EFIVARSTORE_SIZE_ERROR;
|
||||
}
|
||||
|
||||
for (pNode = mEfiVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
if (GetVarStoreId (StoreName, &VarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
VarStoreId = GetFreeVarStoreId (EFI_VFR_VARSTORE_EFI);
|
||||
@@ -1560,11 +1559,16 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
{
|
||||
SVfrVarStorageNode *pNew = NULL;
|
||||
SVfrDataType *pDataType = NULL;
|
||||
EFI_VARSTORE_ID TempVarStoreId;
|
||||
|
||||
if ((StoreName == NULL) || (Guid == NULL) || (DataTypeDB == NULL)) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
}
|
||||
|
||||
if (GetVarStoreId (StoreName, &TempVarStoreId) == VFR_RETURN_SUCCESS) {
|
||||
return VFR_RETURN_REDEFINED;
|
||||
}
|
||||
|
||||
CHECK_ERROR_RETURN(DataTypeDB->GetDataType (TypeName, &pDataType), VFR_RETURN_SUCCESS);
|
||||
|
||||
if (VarStoreId == EFI_VARSTORE_ID_INVALID) {
|
||||
@@ -1590,12 +1594,51 @@ CVfrDataStorage::DeclareBufferVarStore (
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreByDataType (
|
||||
IN CHAR8 *DataTypeName,
|
||||
OUT SVfrVarStorageNode **VarNode
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
SVfrVarStorageNode *MatchNode;
|
||||
|
||||
//
|
||||
// Framework VFR uses Data type name as varstore name, so don't need check again.
|
||||
//
|
||||
if (VfrCompatibleMode) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
MatchNode = NULL;
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mStorageInfo.mDataType->mTypeName, DataTypeName) == 0) {
|
||||
if (MatchNode == NULL) {
|
||||
MatchNode = pNode;
|
||||
} else {
|
||||
//
|
||||
// More than one varstores referred the same data structures.
|
||||
//
|
||||
return VFR_RETURN_VARSTORE_DATATYPE_REDEFINED_ERROR;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (MatchNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
}
|
||||
|
||||
*VarNode = MatchNode;
|
||||
return VFR_RETURN_SUCCESS;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
CVfrDataStorage::GetVarStoreId (
|
||||
IN CHAR8 *StoreName,
|
||||
OUT EFI_VARSTORE_ID *VarStoreId
|
||||
)
|
||||
{
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
SVfrVarStorageNode *pNode;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
@@ -1623,8 +1666,18 @@ CVfrDataStorage::GetVarStoreId (
|
||||
}
|
||||
|
||||
mCurrVarStorageNode = NULL;
|
||||
*VarStoreId = EFI_VARSTORE_ID_INVALID;
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
*VarStoreId = EFI_VARSTORE_ID_INVALID;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
if (pNode != NULL) {
|
||||
mCurrVarStorageNode = pNode;
|
||||
*VarStoreId = pNode->mVarStoreId;
|
||||
}
|
||||
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
EFI_VFR_RETURN_CODE
|
||||
@@ -1634,6 +1687,7 @@ CVfrDataStorage::GetBufferVarStoreDataTypeName (
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if ((StoreName == NULL) || (DataTypeName == NULL)) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
@@ -1645,8 +1699,16 @@ CVfrDataStorage::GetBufferVarStoreDataTypeName (
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
}
|
||||
|
||||
if (pNode == NULL) {
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
if (pNode->mStorageInfo.mDataType == NULL) {
|
||||
@@ -1664,6 +1726,7 @@ CVfrDataStorage::GetVarStoreType (
|
||||
)
|
||||
{
|
||||
SVfrVarStorageNode *pNode;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
if (StoreName == NULL) {
|
||||
return VFR_RETURN_FATAL_ERROR;
|
||||
@@ -1691,7 +1754,16 @@ CVfrDataStorage::GetVarStoreType (
|
||||
}
|
||||
|
||||
VarStoreType = EFI_VFR_VARSTORE_INVALID;
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
if (pNode != NULL) {
|
||||
VarStoreType = pNode->mVarStoreType;
|
||||
}
|
||||
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
EFI_VFR_VARSTORE_TYPE
|
||||
@@ -1841,6 +1913,7 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
{
|
||||
SVfrVarStorageNode *pNode = NULL;
|
||||
EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue;
|
||||
EFI_VFR_RETURN_CODE ReturnCode;
|
||||
|
||||
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
|
||||
if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
|
||||
@@ -1848,8 +1921,16 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
|
||||
}
|
||||
}
|
||||
|
||||
ReturnCode = VFR_RETURN_UNDEFINED;
|
||||
//
|
||||
// Assume that Data strucutre name is used as StoreName, and check again.
|
||||
//
|
||||
if (pNode == NULL) {
|
||||
return VFR_RETURN_UNDEFINED;
|
||||
ReturnCode = GetVarStoreByDataType (StoreName, &pNode);
|
||||
}
|
||||
|
||||
if (pNode == NULL) {
|
||||
return ReturnCode;
|
||||
}
|
||||
|
||||
gCVfrBufferConfig.Open ();
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
Vfr common library functions.
|
||||
|
||||
Copyright (c) 2004 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
Copyright (c) 2004 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
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
|
||||
@@ -307,6 +307,7 @@ public:
|
||||
EFI_VFR_RETURN_CODE GetVarStoreType (IN CHAR8 *, OUT EFI_VFR_VARSTORE_TYPE &);
|
||||
EFI_VFR_VARSTORE_TYPE GetVarStoreType (IN EFI_VARSTORE_ID);
|
||||
EFI_VFR_RETURN_CODE GetVarStoreName (IN EFI_VARSTORE_ID, OUT CHAR8 **);
|
||||
EFI_VFR_RETURN_CODE GetVarStoreByDataType (IN CHAR8 *, OUT SVfrVarStorageNode **);
|
||||
|
||||
EFI_VFR_RETURN_CODE GetBufferVarStoreDataTypeName (IN CHAR8 *, OUT CHAR8 **);
|
||||
EFI_VFR_RETURN_CODE GetEfiVarStoreInfo (IN EFI_VARSTORE_INFO *);
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Generate AutoGen.h, AutoGen.c and *.depex files
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
@@ -53,6 +53,39 @@ gAutoGenStringFileName = "%(module_name)sStrDefs.h"
|
||||
gAutoGenStringFormFileName = "%(module_name)sStrDefs.hpk"
|
||||
gAutoGenDepexFileName = "%(module_name)s.depex"
|
||||
|
||||
#
|
||||
# Template string to generic AsBuilt INF
|
||||
#
|
||||
gAsBuiltInfHeaderString = TemplateString("""## @file
|
||||
# ${module_name}
|
||||
#
|
||||
# DO NOT EDIT
|
||||
# FILE auto-generated Binary INF
|
||||
#
|
||||
##
|
||||
|
||||
[Defines]
|
||||
INF_VERSION = 0x00010016
|
||||
BASE_NAME = ${module_name}
|
||||
FILE_GUID = ${module_guid}
|
||||
MODULE_TYPE = ${module_module_type}
|
||||
VERSION_STRING = ${module_version_string}${BEGIN}
|
||||
UEFI_SPECIFICATION_VERSION = ${module_uefi_specification_version}${END}${BEGIN}
|
||||
PI_SPECIFICATION_VERSION = ${module_pi_specification_version}${END}
|
||||
|
||||
[Packages]${BEGIN}
|
||||
${package_item}${END}
|
||||
|
||||
[Binaries.${module_arch}]${BEGIN}
|
||||
${binary_item}${END}
|
||||
|
||||
[PcdEx]${BEGIN}
|
||||
${pcd_item}${END}
|
||||
|
||||
## @AsBuilt${BEGIN}
|
||||
## ${flags_item}${END}
|
||||
""")
|
||||
|
||||
## Base class for AutoGen
|
||||
#
|
||||
# This class just implements the cache mechanism of AutoGen objects.
|
||||
@@ -499,6 +532,7 @@ class PlatformAutoGen(AutoGen):
|
||||
Ma = ModuleAutoGen(self.Workspace, ModuleFile, self.BuildTarget,
|
||||
self.ToolChain, self.Arch, self.MetaFile)
|
||||
Ma.CreateMakeFile(True)
|
||||
Ma.CreateAsBuiltInf()
|
||||
|
||||
# no need to create makefile for the platform more than once
|
||||
if self.IsMakeFileCreated:
|
||||
@@ -1036,9 +1070,14 @@ class PlatformAutoGen(AutoGen):
|
||||
PlatformModule = self.Platform.Modules[str(Module)]
|
||||
|
||||
# add forced library instances (specified under LibraryClasses sections)
|
||||
for LibraryClass in self.Platform.LibraryClasses.GetKeys():
|
||||
if LibraryClass.startswith("NULL"):
|
||||
Module.LibraryClasses[LibraryClass] = self.Platform.LibraryClasses[LibraryClass]
|
||||
#
|
||||
# If a module has a MODULE_TYPE of USER_DEFINED,
|
||||
# do not link in NULL library class instances from the global [LibraryClasses.*] sections.
|
||||
#
|
||||
if Module.ModuleType != SUP_MODULE_USER_DEFINED:
|
||||
for LibraryClass in self.Platform.LibraryClasses.GetKeys():
|
||||
if LibraryClass.startswith("NULL") and self.Platform.LibraryClasses[LibraryClass, Module.ModuleType]:
|
||||
Module.LibraryClasses[LibraryClass] = self.Platform.LibraryClasses[LibraryClass, Module.ModuleType]
|
||||
|
||||
# add forced library instances (specified in module overrides)
|
||||
for LibraryClass in PlatformModule.LibraryClasses:
|
||||
@@ -1596,6 +1635,8 @@ class ModuleAutoGen(AutoGen):
|
||||
|
||||
self.IsMakeFileCreated = False
|
||||
self.IsCodeFileCreated = False
|
||||
self.IsAsBuiltInfCreated = False
|
||||
self.DepexGenerated = False
|
||||
|
||||
self.BuildDatabase = self.Workspace.BuildDatabase
|
||||
|
||||
@@ -1987,6 +2028,9 @@ class ModuleAutoGen(AutoGen):
|
||||
CreateDirectory(Source.Dir)
|
||||
|
||||
if File.IsBinary and File == Source and self._BinaryFileList != None and File in self._BinaryFileList:
|
||||
# Skip all files that are not binary libraries
|
||||
if not self.IsLibrary:
|
||||
continue
|
||||
RuleObject = self.BuildRules[TAB_DEFAULT_BINARY_FILE]
|
||||
elif FileType in self.BuildRules:
|
||||
RuleObject = self.BuildRules[FileType]
|
||||
@@ -2214,6 +2258,107 @@ class ModuleAutoGen(AutoGen):
|
||||
self._IncludePathList.append(str(Inc))
|
||||
return self._IncludePathList
|
||||
|
||||
## Create AsBuilt INF file the module
|
||||
#
|
||||
def CreateAsBuiltInf(self):
|
||||
if self.IsAsBuiltInfCreated:
|
||||
return
|
||||
|
||||
# Skip the following code for EDK I inf
|
||||
if self.AutoGenVersion < 0x00010005:
|
||||
return
|
||||
|
||||
# Skip the following code for libraries
|
||||
if self.IsLibrary:
|
||||
return
|
||||
|
||||
# Skip the following code for modules with no source files
|
||||
if self.SourceFileList == None or self.SourceFileList == []:
|
||||
return
|
||||
|
||||
# Skip the following code for modules without any binary files
|
||||
if self.BinaryFileList <> None and self.BinaryFileList <> []:
|
||||
return
|
||||
|
||||
### TODO: How to handles mixed source and binary modules
|
||||
|
||||
# Find all DynamicEx PCDs used by this module and dependent libraries
|
||||
# Also find all packages that the DynamicEx PCDs depend on
|
||||
Pcds = []
|
||||
Packages = []
|
||||
for Pcd in self.ModulePcdList + self.LibraryPcdList:
|
||||
if Pcd.Type in GenC.gDynamicExPcd:
|
||||
if Pcd not in Pcds:
|
||||
Pcds += [Pcd]
|
||||
for Package in self.DerivedPackageList:
|
||||
if Package not in Packages:
|
||||
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'DynamicEx') in Package.Pcds:
|
||||
Packages += [Package]
|
||||
elif (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, 'Dynamic') in Package.Pcds:
|
||||
Packages += [Package]
|
||||
|
||||
ModuleType = self.ModuleType
|
||||
if ModuleType == 'UEFI_DRIVER' and self.DepexGenerated:
|
||||
ModuleType = 'DXE_DRIVER'
|
||||
|
||||
AsBuiltInfDict = {
|
||||
'module_name' : self.Name,
|
||||
'module_guid' : self.Guid,
|
||||
'module_module_type' : ModuleType,
|
||||
'module_version_string' : self.Version,
|
||||
'module_uefi_specification_version' : [],
|
||||
'module_pi_specification_version' : [],
|
||||
'module_arch' : self.Arch,
|
||||
'package_item' : ['%s' % (Package.MetaFile.File.replace('\\','/')) for Package in Packages],
|
||||
'binary_item' : [],
|
||||
'pcd_item' : [],
|
||||
'flags_item' : []
|
||||
}
|
||||
|
||||
if 'UEFI_SPECIFICATION_VERSION' in self.Specification:
|
||||
AsBuiltInfDict['module_uefi_specification_version'] += [self.Specification['UEFI_SPECIFICATION_VERSION']]
|
||||
if 'PI_SPECIFICATION_VERSION' in self.Specification:
|
||||
AsBuiltInfDict['module_pi_specification_version'] += [self.Specification['PI_SPECIFICATION_VERSION']]
|
||||
|
||||
OutputDir = self.OutputDir.replace('\\','/').strip('/')
|
||||
if self.ModuleType in ['BASE', 'USER_DEFINED']:
|
||||
for Item in self.CodaTargetList:
|
||||
File = Item.Target.Path.replace('\\','/').strip('/').replace(OutputDir,'').strip('/')
|
||||
if Item.Target.Ext.lower() == '.aml':
|
||||
AsBuiltInfDict['binary_item'] += ['ASL|' + File]
|
||||
elif Item.Target.Ext.lower() == '.acpi':
|
||||
AsBuiltInfDict['binary_item'] += ['ACPI|' + File]
|
||||
else:
|
||||
AsBuiltInfDict['binary_item'] += ['BIN|' + File]
|
||||
else:
|
||||
for Item in self.CodaTargetList:
|
||||
File = Item.Target.Path.replace('\\','/').strip('/').replace(OutputDir,'').strip('/')
|
||||
if Item.Target.Ext.lower() == '.efi':
|
||||
AsBuiltInfDict['binary_item'] += ['PE32|' + self.Name + '.efi']
|
||||
else:
|
||||
AsBuiltInfDict['binary_item'] += ['BIN|' + File]
|
||||
if self.DepexGenerated:
|
||||
if self.ModuleType in ['PEIM']:
|
||||
AsBuiltInfDict['binary_item'] += ['PEI_DEPEX|' + self.Name + '.depex']
|
||||
if self.ModuleType in ['DXE_DRIVER','DXE_RUNTIME_DRIVER','DXE_SAL_DRIVER','UEFI_DRIVER']:
|
||||
AsBuiltInfDict['binary_item'] += ['DXE_DEPEX|' + self.Name + '.depex']
|
||||
if self.ModuleType in ['DXE_SMM_DRIVER']:
|
||||
AsBuiltInfDict['binary_item'] += ['SMM_DEPEX|' + self.Name + '.depex']
|
||||
|
||||
for Pcd in Pcds:
|
||||
AsBuiltInfDict['pcd_item'] += [Pcd.TokenSpaceGuidCName + '.' + Pcd.TokenCName]
|
||||
|
||||
for Item in self.BuildOption:
|
||||
if 'FLAGS' in self.BuildOption[Item]:
|
||||
AsBuiltInfDict['flags_item'] += ['%s:%s_%s_%s_%s_FLAGS = %s' % (self.ToolChainFamily, self.BuildTarget, self.ToolChain, self.Arch, Item, self.BuildOption[Item]['FLAGS'].strip())]
|
||||
|
||||
AsBuiltInf = TemplateString()
|
||||
AsBuiltInf.Append(gAsBuiltInfHeaderString.Replace(AsBuiltInfDict))
|
||||
|
||||
SaveFileOnChange(os.path.join(self.OutputDir, self.Name + '.inf'), str(AsBuiltInf), False)
|
||||
|
||||
self.IsAsBuiltInfCreated = True
|
||||
|
||||
## Create makefile for the module and its dependent libraries
|
||||
#
|
||||
# @param CreateLibraryMakeFile Flag indicating if or not the makefiles of
|
||||
@@ -2278,6 +2423,9 @@ class ModuleAutoGen(AutoGen):
|
||||
Dpx = GenDepex.DependencyExpression(self.DepexList[ModuleType], ModuleType, True)
|
||||
DpxFile = gAutoGenDepexFileName % {"module_name" : self.Name}
|
||||
|
||||
if len(Dpx.PostfixNotation) <> 0:
|
||||
self.DepexGenerated = True
|
||||
|
||||
if Dpx.Generate(path.join(self.OutputDir, DpxFile)):
|
||||
AutoGenList.append(str(DpxFile))
|
||||
else:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# Routines for generating AutoGen.h and AutoGen.c
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
@@ -1098,6 +1098,10 @@ def CreateLibraryPcdCode(Info, AutoGenC, AutoGenH, Pcd):
|
||||
ExtraData="[%s]" % str(Info))
|
||||
TokenNumber = PcdTokenNumber[TokenCName, TokenSpaceGuidCName]
|
||||
|
||||
# If PCD is DynamicEx, then use TokenNumber declared in DEC file
|
||||
if Pcd.Type in gDynamicExPcd:
|
||||
TokenNumber = int(Pcd.TokenValue, 0)
|
||||
|
||||
if Pcd.Type not in gItemTypeStringDatabase:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR,
|
||||
"Unknown PCD type [%s] of PCD %s.%s" % (Pcd.Type, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
|
||||
@@ -1677,11 +1681,11 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
|
||||
if 'PI_SPECIFICATION_VERSION' in Info.Module.Specification:
|
||||
PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
|
||||
else:
|
||||
PiSpecVersion = 0
|
||||
PiSpecVersion = '0x00000000'
|
||||
if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification:
|
||||
UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION']
|
||||
else:
|
||||
UefiSpecVersion = 0
|
||||
UefiSpecVersion = '0x00000000'
|
||||
Dict = {
|
||||
'Function' : Info.Module.ModuleEntryPointList,
|
||||
'PiSpecVersion' : PiSpecVersion,
|
||||
@@ -1689,14 +1693,15 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
|
||||
}
|
||||
|
||||
if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']:
|
||||
if NumEntryPoints != 1:
|
||||
EdkLogger.error(
|
||||
"build",
|
||||
AUTOGEN_ERROR,
|
||||
'%s must have exactly one entry point' % Info.ModuleType,
|
||||
File=str(Info),
|
||||
ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
|
||||
)
|
||||
if Info.SourceFileList <> None and Info.SourceFileList <> []:
|
||||
if NumEntryPoints != 1:
|
||||
EdkLogger.error(
|
||||
"build",
|
||||
AUTOGEN_ERROR,
|
||||
'%s must have exactly one entry point' % Info.ModuleType,
|
||||
File=str(Info),
|
||||
ExtraData= ", ".join(Info.Module.ModuleEntryPointList)
|
||||
)
|
||||
if Info.ModuleType == 'PEI_CORE':
|
||||
AutoGenC.Append(gPeiCoreEntryPointString.Replace(Dict))
|
||||
AutoGenH.Append(gPeiCoreEntryPointPrototype.Replace(Dict))
|
||||
@@ -1827,6 +1832,23 @@ def CreatePpiDefinitionCode(Info, AutoGenC, AutoGenH):
|
||||
# @param AutoGenH The TemplateString object for header file
|
||||
#
|
||||
def CreatePcdCode(Info, AutoGenC, AutoGenH):
|
||||
|
||||
# Collect Token Space GUIDs used by DynamicEc PCDs
|
||||
TokenSpaceList = []
|
||||
for Pcd in Info.ModulePcdList:
|
||||
if Pcd.Type in gDynamicExPcd and Pcd.TokenSpaceGuidCName not in TokenSpaceList:
|
||||
TokenSpaceList += [Pcd.TokenSpaceGuidCName]
|
||||
|
||||
# Add extern declarations to AutoGen.h if one or more Token Space GUIDs were found
|
||||
if TokenSpaceList <> []:
|
||||
AutoGenH.Append("\n// Definition of PCD Token Space GUIDs used in this module\n\n")
|
||||
if Info.ModuleType in ["USER_DEFINED", "BASE"]:
|
||||
GuidType = "GUID"
|
||||
else:
|
||||
GuidType = "EFI_GUID"
|
||||
for Item in TokenSpaceList:
|
||||
AutoGenH.Append('extern %s %s;\n' % (GuidType, Item))
|
||||
|
||||
if Info.IsLibrary:
|
||||
if Info.ModulePcdList:
|
||||
AutoGenH.Append("\n// PCD definitions\n")
|
||||
|
@@ -493,7 +493,7 @@ cleanlib:
|
||||
|
||||
# convert source files and binary files to build targets
|
||||
self.ResultFileList = [str(T.Target) for T in self._AutoGenObject.CodaTargetList]
|
||||
if len(self.ResultFileList) == 0:
|
||||
if len(self.ResultFileList) == 0 and len(self._AutoGenObject.SourceFileList) <> 0:
|
||||
EdkLogger.error("build", AUTOGEN_ERROR, "Nothing to build",
|
||||
ExtraData="[%s]" % str(self._AutoGenObject))
|
||||
|
||||
|
@@ -121,7 +121,7 @@ def GetLanguageCode(LangName, IsCompatibleMode, File):
|
||||
if length == 3 and LangName.isalpha():
|
||||
TempLangName = LangConvTable.get(LangName.lower())
|
||||
if TempLangName != None:
|
||||
return TempLangName
|
||||
return TempLangName
|
||||
return LangName
|
||||
else:
|
||||
EdkLogger.error("Unicode File Parser", FORMAT_INVALID, "Invalid ISO 639-2 language code : %s" % LangName, File)
|
||||
@@ -298,13 +298,36 @@ class UniFileClassObject(object):
|
||||
#
|
||||
# Use unique identifier
|
||||
#
|
||||
FindFlag = -1
|
||||
LineCount = 0
|
||||
for Line in FileIn:
|
||||
Line = FileIn[LineCount]
|
||||
LineCount += 1
|
||||
Line = Line.strip()
|
||||
#
|
||||
# Ignore comment line and empty line
|
||||
#
|
||||
if Line == u'' or Line.startswith(u'//'):
|
||||
continue
|
||||
|
||||
#
|
||||
# Process comment embeded in string define lines
|
||||
#
|
||||
FindFlag = Line.find(u'//')
|
||||
if FindFlag != -1:
|
||||
Line = Line.replace(Line[FindFlag:], u' ')
|
||||
if FileIn[LineCount].strip().startswith('#language'):
|
||||
Line = Line + FileIn[LineCount]
|
||||
FileIn[LineCount-1] = Line
|
||||
FileIn[LineCount] = os.linesep
|
||||
LineCount -= 1
|
||||
for Index in xrange (LineCount + 1, len (FileIn) - 1):
|
||||
if (Index == len(FileIn) -1):
|
||||
FileIn[Index] = os.linesep
|
||||
else:
|
||||
FileIn[Index] = FileIn[Index + 1]
|
||||
continue
|
||||
|
||||
Line = Line.replace(u'/langdef', u'#langdef')
|
||||
Line = Line.replace(u'/string', u'#string')
|
||||
Line = Line.replace(u'/language', u'#language')
|
||||
@@ -566,6 +589,6 @@ class UniFileClassObject(object):
|
||||
if __name__ == '__main__':
|
||||
EdkLogger.Initialize()
|
||||
EdkLogger.SetLevel(EdkLogger.DEBUG_0)
|
||||
a = UniFileClassObject(['C:\\Edk\\Strings.uni', 'C:\\Edk\\Strings2.uni'])
|
||||
a = UniFileClassObject([PathClass("C:\\Edk\\Strings.uni"), PathClass("C:\\Edk\\Strings2.uni")])
|
||||
a.ReToken()
|
||||
a.ShowMe()
|
||||
|
@@ -180,8 +180,10 @@ class ToolDefClassObject(object):
|
||||
EnvReference = gEnvRefPattern.findall(Value)
|
||||
for Ref in EnvReference:
|
||||
if Ref not in self.MacroDictionary:
|
||||
return False, Ref
|
||||
Value = Value.replace(Ref, self.MacroDictionary[Ref])
|
||||
Value = Value.replace(Ref, "")
|
||||
else:
|
||||
Value = Value.replace(Ref, self.MacroDictionary[Ref])
|
||||
|
||||
|
||||
MacroReference = gMacroRefPattern.findall(Value)
|
||||
for Ref in MacroReference:
|
||||
|
@@ -564,7 +564,17 @@ class FdfParser:
|
||||
|
||||
self.Rewind()
|
||||
|
||||
|
||||
def __GetIfListCurrentItemStat(self, IfList):
|
||||
if len(IfList) == 0:
|
||||
return True
|
||||
|
||||
for Item in IfList:
|
||||
if Item[1] == False:
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
|
||||
## PreprocessConditionalStatement() method
|
||||
#
|
||||
# Preprocess conditional statement.
|
||||
@@ -577,27 +587,28 @@ class FdfParser:
|
||||
IfList = []
|
||||
while self.__GetNextToken():
|
||||
if self.__Token == 'DEFINE':
|
||||
DefineLine = self.CurrentLineNumber - 1
|
||||
DefineOffset = self.CurrentOffsetWithinLine - len('DEFINE')
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected Macro name", self.FileName, self.CurrentLineNumber)
|
||||
Macro = self.__Token
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected value", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__GetStringData():
|
||||
pass
|
||||
Value = self.__Token
|
||||
if not Macro in InputMacroDict:
|
||||
FileLineTuple = GetRealFileLine(self.FileName, DefineLine + 1)
|
||||
MacProfile = MacroProfile(FileLineTuple[0], FileLineTuple[1])
|
||||
MacProfile.MacroName = Macro
|
||||
MacProfile.MacroValue = Value
|
||||
AllMacroList.append(MacProfile)
|
||||
self.__WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
|
||||
if self.__GetIfListCurrentItemStat(IfList):
|
||||
DefineLine = self.CurrentLineNumber - 1
|
||||
DefineOffset = self.CurrentOffsetWithinLine - len('DEFINE')
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected Macro name", self.FileName, self.CurrentLineNumber)
|
||||
Macro = self.__Token
|
||||
if not self.__IsToken( "="):
|
||||
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if not self.__GetNextToken():
|
||||
raise Warning("expected value", self.FileName, self.CurrentLineNumber)
|
||||
|
||||
if self.__GetStringData():
|
||||
pass
|
||||
Value = self.__Token
|
||||
if not Macro in InputMacroDict:
|
||||
FileLineTuple = GetRealFileLine(self.FileName, DefineLine + 1)
|
||||
MacProfile = MacroProfile(FileLineTuple[0], FileLineTuple[1])
|
||||
MacProfile.MacroName = Macro
|
||||
MacProfile.MacroValue = Value
|
||||
AllMacroList.append(MacProfile)
|
||||
self.__WipeOffArea.append(((DefineLine, DefineOffset), (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - 1)))
|
||||
|
||||
elif self.__Token in ('!ifdef', '!ifndef', '!if'):
|
||||
IfStartPos = (self.CurrentLineNumber - 1, self.CurrentOffsetWithinLine - len(self.__Token))
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# process FFS generation from INF statement
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -18,6 +18,8 @@
|
||||
import Rule
|
||||
import os
|
||||
import shutil
|
||||
import StringIO
|
||||
from struct import *
|
||||
from GenFdsGlobalVariable import GenFdsGlobalVariable
|
||||
import Ffs
|
||||
import subprocess
|
||||
@@ -50,7 +52,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
self.KeepRelocFromRule = None
|
||||
self.InDsc = True
|
||||
self.OptRomDefs = {}
|
||||
self.PiSpecVersion = 0
|
||||
self.PiSpecVersion = '0x00000000'
|
||||
|
||||
## __InfParse() method
|
||||
#
|
||||
@@ -121,7 +123,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
if len(self.SourceFileList) != 0 and not self.InDsc:
|
||||
EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName))
|
||||
|
||||
if self.ModuleType == 'SMM_CORE' and self.PiSpecVersion < 0x0001000A:
|
||||
if self.ModuleType == 'SMM_CORE' and int(self.PiSpecVersion, 16) < 0x0001000A:
|
||||
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName)
|
||||
|
||||
if Inf._Defs != None and len(Inf._Defs) > 0:
|
||||
@@ -177,13 +179,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
#
|
||||
# Convert Fv File Type for PI1.1 SMM driver.
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
|
||||
if Rule.FvFileType == 'DRIVER':
|
||||
Rule.FvFileType = 'SMM'
|
||||
#
|
||||
# Framework SMM Driver has no SMM FV file type
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
|
||||
if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE':
|
||||
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName)
|
||||
#
|
||||
@@ -409,9 +411,9 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
GenSecInputFile = None
|
||||
if Rule.FileName != None:
|
||||
GenSecInputFile = self.__ExtendMacro__(Rule.FileName)
|
||||
if os.path.isabs(GenSecInputFile):
|
||||
GenSecInputFile = os.path.normpath(GenSecInputFile)
|
||||
else:
|
||||
if os.path.isabs(GenSecInputFile):
|
||||
GenSecInputFile = os.path.normpath(GenSecInputFile)
|
||||
else:
|
||||
GenSecInputFile = os.path.normpath(os.path.join(self.EfiOutputPath, GenSecInputFile))
|
||||
else:
|
||||
FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)
|
||||
@@ -421,13 +423,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
#
|
||||
# Convert Fv Section Type for PI1.1 SMM driver.
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
|
||||
if SectionType == 'DXE_DEPEX':
|
||||
SectionType = 'SMM_DEPEX'
|
||||
#
|
||||
# Framework SMM Driver has no SMM_DEPEX section type
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
|
||||
if SectionType == 'SMM_DEPEX':
|
||||
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
|
||||
NoStrip = True
|
||||
@@ -583,19 +585,20 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
SectFiles = []
|
||||
SectAlignments = []
|
||||
Index = 1
|
||||
HasGneratedFlag = False
|
||||
for Sect in Rule.SectionList:
|
||||
SecIndex = '%d' %Index
|
||||
SectList = []
|
||||
#
|
||||
# Convert Fv Section Type for PI1.1 SMM driver.
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) >= 0x0001000A:
|
||||
if Sect.SectionType == 'DXE_DEPEX':
|
||||
Sect.SectionType = 'SMM_DEPEX'
|
||||
#
|
||||
# Framework SMM Driver has no SMM_DEPEX section type
|
||||
#
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A:
|
||||
if self.ModuleType == 'DXE_SMM_DRIVER' and int(self.PiSpecVersion, 16) < 0x0001000A:
|
||||
if Sect.SectionType == 'SMM_DEPEX':
|
||||
EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)
|
||||
#
|
||||
@@ -613,6 +616,51 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)
|
||||
else :
|
||||
SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)
|
||||
|
||||
if not HasGneratedFlag:
|
||||
UniVfrOffsetFileSection = ""
|
||||
ModuleFileName = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.InfFileName)
|
||||
InfData = GenFdsGlobalVariable.WorkSpace.BuildObject[PathClass(ModuleFileName), self.CurrentArch]
|
||||
#
|
||||
# Search the source list in InfData to find if there are .vfr file exist.
|
||||
#
|
||||
VfrUniBaseName = {}
|
||||
VfrUniOffsetList = []
|
||||
for SourceFile in InfData.Sources:
|
||||
if SourceFile.Type.upper() == ".VFR" :
|
||||
#
|
||||
# search the .map file to find the offset of vfr binary in the PE32+/TE file.
|
||||
#
|
||||
VfrUniBaseName[SourceFile.BaseName] = (SourceFile.BaseName + "Bin")
|
||||
if SourceFile.Type.upper() == ".UNI" :
|
||||
#
|
||||
# search the .map file to find the offset of Uni strings binary in the PE32+/TE file.
|
||||
#
|
||||
VfrUniBaseName["UniOffsetName"] = (self.BaseName + "Strings")
|
||||
|
||||
|
||||
if len(VfrUniBaseName) > 0:
|
||||
VfrUniOffsetList = self.__GetBuildOutputMapFileVfrUniInfo(VfrUniBaseName)
|
||||
#
|
||||
# Generate the Raw data of raw section
|
||||
#
|
||||
os.path.join( self.OutputPath, self.BaseName + '.offset')
|
||||
UniVfrOffsetFileName = os.path.join( self.OutputPath, self.BaseName + '.offset')
|
||||
UniVfrOffsetFileSection = os.path.join( self.OutputPath, self.BaseName + 'Offset' + '.raw')
|
||||
|
||||
self.__GenUniVfrOffsetFile (VfrUniOffsetList, UniVfrOffsetFileName)
|
||||
|
||||
UniVfrOffsetFileNameList = []
|
||||
UniVfrOffsetFileNameList.append(UniVfrOffsetFileName)
|
||||
"""Call GenSection"""
|
||||
GenFdsGlobalVariable.GenerateSection(UniVfrOffsetFileSection,
|
||||
UniVfrOffsetFileNameList,
|
||||
"EFI_SECTION_RAW"
|
||||
)
|
||||
os.remove(UniVfrOffsetFileName)
|
||||
SectList.append(UniVfrOffsetFileSection)
|
||||
HasGneratedFlag = True
|
||||
|
||||
for SecName in SectList :
|
||||
SectFiles.append(SecName)
|
||||
SectAlignments.append(Align)
|
||||
@@ -672,3 +720,116 @@ class FfsInfStatement(FfsInfStatementClassObject):
|
||||
result += ('-a', Rule.Alignment)
|
||||
|
||||
return result
|
||||
|
||||
## __GetBuildOutputMapFileVfrUniInfo() method
|
||||
#
|
||||
# Find the offset of UNI/INF object offset in the EFI image file.
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @param VfrUniBaseName A name list contain the UNI/INF object name.
|
||||
# @retval RetValue A list contain offset of UNI/INF object.
|
||||
#
|
||||
def __GetBuildOutputMapFileVfrUniInfo(self, VfrUniBaseName):
|
||||
|
||||
RetValue = []
|
||||
|
||||
MapFileName = os.path.join(self.EfiOutputPath, self.BaseName + ".map")
|
||||
try:
|
||||
fInputfile = open(MapFileName, "r", 0)
|
||||
try:
|
||||
FileLinesList = fInputfile.readlines()
|
||||
except:
|
||||
EdkLogger.error("GenFds", FILE_READ_FAILURE, "File read failed for %s" %MapFileName,None)
|
||||
finally:
|
||||
fInputfile.close()
|
||||
except:
|
||||
EdkLogger.error("GenFds", FILE_OPEN_FAILURE, "File open failed for %s" %MapFileName,None)
|
||||
|
||||
IsHex = False
|
||||
for eachLine in FileLinesList:
|
||||
for eachName in VfrUniBaseName.values():
|
||||
if eachLine.find(eachName) != -1:
|
||||
eachLine = eachLine.strip()
|
||||
Element = eachLine.split()
|
||||
#
|
||||
# MSFT/ICC/EBC map file
|
||||
#
|
||||
if (len(Element) == 4):
|
||||
try:
|
||||
int (Element[2], 16)
|
||||
IsHex = True
|
||||
except:
|
||||
IsHex = False
|
||||
|
||||
if IsHex:
|
||||
RetValue.append((eachName, Element[2]))
|
||||
IsHex = False
|
||||
#
|
||||
# GCC map file
|
||||
#
|
||||
elif (len(Element) == 2) and Element[0].startswith("0x"):
|
||||
RetValue.append((eachName, Element[0]))
|
||||
|
||||
return RetValue
|
||||
|
||||
## __GenUniVfrOffsetFile() method
|
||||
#
|
||||
# Generate the offset file for the module which contain VFR or UNI file.
|
||||
#
|
||||
# @param self The object pointer
|
||||
# @param VfrUniOffsetList A list contain the VFR/UNI offsets in the EFI image file.
|
||||
# @param UniVfrOffsetFileName The output offset file name.
|
||||
#
|
||||
def __GenUniVfrOffsetFile(self, VfrUniOffsetList, UniVfrOffsetFileName):
|
||||
|
||||
try:
|
||||
fInputfile = open(UniVfrOffsetFileName, "wb+", 0)
|
||||
except:
|
||||
EdkLogger.error("GenFds", FILE_OPEN_FAILURE, "File open failed for %s" %UniVfrOffsetFileName,None)
|
||||
|
||||
# Use a instance of StringIO to cache data
|
||||
fStringIO = StringIO.StringIO('')
|
||||
|
||||
for Item in VfrUniOffsetList:
|
||||
if (Item[0].find("Strings") != -1):
|
||||
#
|
||||
# UNI offset in image.
|
||||
# GUID + Offset
|
||||
# { 0x8913c5e0, 0x33f6, 0x4d86, { 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66 } }
|
||||
#
|
||||
UniGuid = [0xe0, 0xc5, 0x13, 0x89, 0xf6, 0x33, 0x86, 0x4d, 0x9b, 0xf1, 0x43, 0xef, 0x89, 0xfc, 0x6, 0x66]
|
||||
UniGuid = [chr(ItemGuid) for ItemGuid in UniGuid]
|
||||
fStringIO.write(''.join(UniGuid))
|
||||
UniValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (UniValue)
|
||||
else:
|
||||
#
|
||||
# VFR binary offset in image.
|
||||
# GUID + Offset
|
||||
# { 0xd0bc7cb4, 0x6a47, 0x495f, { 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2 } };
|
||||
#
|
||||
VfrGuid = [0xb4, 0x7c, 0xbc, 0xd0, 0x47, 0x6a, 0x5f, 0x49, 0xaa, 0x11, 0x71, 0x7, 0x46, 0xda, 0x6, 0xa2]
|
||||
VfrGuid = [chr(ItemGuid) for ItemGuid in VfrGuid]
|
||||
fStringIO.write(''.join(VfrGuid))
|
||||
type (Item[1])
|
||||
VfrValue = pack ('Q', int (Item[1], 16))
|
||||
fStringIO.write (VfrValue)
|
||||
|
||||
#
|
||||
# write data into file.
|
||||
#
|
||||
try :
|
||||
fInputfile.write (fStringIO.getvalue())
|
||||
except:
|
||||
EdkLogger.error("GenFds", FILE_WRITE_FAILURE, "Write data to file %s failed, please check whether the file been locked or using by other applications." %UniVfrOffsetFileName,None)
|
||||
|
||||
fStringIO.close ()
|
||||
fInputfile.close ()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# section base class
|
||||
#
|
||||
# Copyright (c) 2007, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -129,7 +129,7 @@ class Section (SectionClassObject):
|
||||
if FileType != None:
|
||||
for File in FfsInf.BinFileList:
|
||||
if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch:
|
||||
if File.Type == FileType or (FfsInf.PiSpecVersion >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
|
||||
if File.Type == FileType or (int(FfsInf.PiSpecVersion, 16) >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'):
|
||||
if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []:
|
||||
FileList.append(File.Path)
|
||||
else:
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# This file is used to create a database used by build tool
|
||||
#
|
||||
# Copyright (c) 2008 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2008 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
@@ -1425,7 +1425,17 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
if not self._ModuleType:
|
||||
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE,
|
||||
"MODULE_TYPE is not given", File=self.MetaFile)
|
||||
if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (self._Specification['PI_SPECIFICATION_VERSION'] < 0x0001000A):
|
||||
if self._ModuleType not in SUP_MODULE_LIST:
|
||||
RecordList = self._RawData[MODEL_META_DATA_HEADER, self._Arch, self._Platform]
|
||||
for Record in RecordList:
|
||||
Name = Record[0]
|
||||
if Name == "MODULE_TYPE":
|
||||
LineNo = Record[6]
|
||||
break
|
||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED,
|
||||
"MODULE_TYPE %s is not supported for EDK II, valid values are:\n %s" % (self._ModuleType,' '.join(l for l in SUP_MODULE_LIST)),
|
||||
File=self.MetaFile, Line=LineNo)
|
||||
if (self._Specification == None) or (not 'PI_SPECIFICATION_VERSION' in self._Specification) or (int(self._Specification['PI_SPECIFICATION_VERSION'], 16) < 0x0001000A):
|
||||
if self._ModuleType == SUP_MODULE_SMM_CORE:
|
||||
EdkLogger.error("build", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.MetaFile)
|
||||
if self._Defs and 'PCI_DEVICE_ID' in self._Defs and 'PCI_VENDOR_ID' in self._Defs \
|
||||
@@ -1894,7 +1904,12 @@ class InfBuildData(ModuleBuildClassObject):
|
||||
if self._Depex == None:
|
||||
self._Depex = tdict(False, 2)
|
||||
RecordList = self._RawData[MODEL_EFI_DEPEX, self._Arch]
|
||||
|
||||
|
||||
# If the module has only Binaries and no Sources, then ignore [Depex]
|
||||
if self.Sources == None or self.Sources == []:
|
||||
if self.Binaries <> None and self.Binaries <> []:
|
||||
return self._Depex
|
||||
|
||||
# PEIM and DXE drivers must have a valid [Depex] section
|
||||
if len(self.LibraryClass) == 0 and len(RecordList) == 0:
|
||||
if self.ModuleType == 'DXE_DRIVER' or self.ModuleType == 'PEIM' or self.ModuleType == 'DXE_SMM_DRIVER' or \
|
||||
|
@@ -4,7 +4,7 @@
|
||||
# This module contains the functionality to generate build report after
|
||||
# build all target completes successfully.
|
||||
#
|
||||
# Copyright (c) 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
# 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
|
||||
@@ -486,7 +486,7 @@ class ModuleReport(object):
|
||||
#
|
||||
if ModuleType == "DXE_SMM_DRIVER":
|
||||
PiSpec = M.Module.Specification.get("PI_SPECIFICATION_VERSION", "0x00010000")
|
||||
if int(PiSpec, 0) >= 0x0001000A:
|
||||
if int(PiSpec, 16) >= 0x0001000A:
|
||||
ModuleType = "SMM_DRIVER"
|
||||
self.DriverType = gDriverTypeMap.get(ModuleType, "0x2 (FREE_FORM)")
|
||||
self.UefiSpecVersion = M.Module.Specification.get("UEFI_SPECIFICATION_VERSION", "")
|
||||
|
@@ -1,7 +1,7 @@
|
||||
## @file
|
||||
# build a platform or a module
|
||||
#
|
||||
# Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>
|
||||
# Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.<BR>
|
||||
#
|
||||
# This program and the accompanying materials
|
||||
# are licensed and made available under the terms and conditions of the BSD License
|
||||
@@ -102,7 +102,8 @@ def CheckEnvVariable():
|
||||
#
|
||||
# Check EFI_SOURCE (R8 build convention). EDK_SOURCE will always point to ECP
|
||||
#
|
||||
os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
|
||||
if "ECP_SOURCE" not in os.environ:
|
||||
os.environ["ECP_SOURCE"] = os.path.join(WorkspaceDir, GlobalData.gEdkCompatibilityPkg)
|
||||
if "EFI_SOURCE" not in os.environ:
|
||||
os.environ["EFI_SOURCE"] = os.environ["ECP_SOURCE"]
|
||||
if "EDK_SOURCE" not in os.environ:
|
||||
@@ -888,7 +889,7 @@ class Build():
|
||||
self.LoadFixAddress = int (LoadFixAddressString, 16)
|
||||
else:
|
||||
self.LoadFixAddress = int (LoadFixAddressString)
|
||||
except:
|
||||
except:
|
||||
EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS %s is not valid dec or hex string" % (LoadFixAddressString))
|
||||
if self.LoadFixAddress < 0:
|
||||
EdkLogger.error("build", PARAMETER_INVALID, "FIX_LOAD_TOP_MEMORY_ADDRESS is set to the invalid negative value %s" % (LoadFixAddressString))
|
||||
@@ -908,6 +909,8 @@ class Build():
|
||||
self.FvList = []
|
||||
else:
|
||||
FdfParserObj = FdfParser(str(self.Fdf))
|
||||
for key in self.Db._GlobalMacros:
|
||||
InputMacroDict[key] = self.Db._GlobalMacros[key]
|
||||
FdfParserObj.ParseFile()
|
||||
for fvname in self.FvList:
|
||||
if fvname.upper() not in FdfParserObj.Profile.FvDict.keys():
|
||||
@@ -974,6 +977,7 @@ class Build():
|
||||
if not self.SkipAutoGen or Target == 'genmake':
|
||||
self.Progress.Start("Generating makefile")
|
||||
AutoGenObject.CreateMakeFile(CreateDepsMakeFile)
|
||||
AutoGenObject.CreateAsBuiltInf()
|
||||
self.Progress.Stop("done!")
|
||||
if Target == "genmake":
|
||||
return True
|
||||
@@ -1007,8 +1011,8 @@ class Build():
|
||||
InfFileNameList = ModuleList.keys()
|
||||
#InfFileNameList.sort()
|
||||
for InfFile in InfFileNameList:
|
||||
sys.stdout.write (".")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write (".")
|
||||
sys.stdout.flush()
|
||||
ModuleInfo = ModuleList[InfFile]
|
||||
ModuleName = ModuleInfo.BaseName
|
||||
ModuleOutputImage = ModuleInfo.Image.FileName
|
||||
@@ -1141,8 +1145,8 @@ class Build():
|
||||
## Collect MAP information of all modules
|
||||
#
|
||||
def _CollectModuleMapBuffer (self, MapBuffer, ModuleList):
|
||||
sys.stdout.write ("Generate Load Module At Fix Address Map")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write ("Generate Load Module At Fix Address Map")
|
||||
sys.stdout.flush()
|
||||
PatchEfiImageList = []
|
||||
PeiModuleList = {}
|
||||
BtModuleList = {}
|
||||
@@ -1187,11 +1191,11 @@ class Build():
|
||||
SmmModuleList[Module.MetaFile] = ImageInfo
|
||||
SmmSize += ImageInfo.Image.Size
|
||||
if Module.ModuleType == 'DXE_SMM_DRIVER':
|
||||
PiSpecVersion = 0
|
||||
if 'PI_SPECIFICATION_VERSION' in Module.Module.Specification:
|
||||
PiSpecVersion = Module.Module.Specification['PI_SPECIFICATION_VERSION']
|
||||
PiSpecVersion = '0x00000000'
|
||||
if 'PI_SPECIFICATION_VERSION' in Module.Module.Specification:
|
||||
PiSpecVersion = Module.Module.Specification['PI_SPECIFICATION_VERSION']
|
||||
# for PI specification < PI1.1, DXE_SMM_DRIVER also runs as BOOT time driver.
|
||||
if PiSpecVersion < 0x0001000A:
|
||||
if int(PiSpecVersion, 16) < 0x0001000A:
|
||||
BtModuleList[Module.MetaFile] = ImageInfo
|
||||
BtSize += ImageInfo.Image.Size
|
||||
break
|
||||
@@ -1245,7 +1249,7 @@ class Build():
|
||||
#
|
||||
# Get PCD offset in EFI image by GenPatchPcdTable function
|
||||
#
|
||||
PcdTable = parsePcdInfoFromMapFile(EfiImageMap, EfiImage)
|
||||
PcdTable = parsePcdInfoFromMapFile(EfiImageMap, EfiImage)
|
||||
#
|
||||
# Patch real PCD value by PatchPcdValue tool
|
||||
#
|
||||
@@ -1277,8 +1281,8 @@ class Build():
|
||||
self._RebaseModule (MapBuffer, RtBaseAddr, RtModuleList, TopMemoryAddress == 0)
|
||||
self._RebaseModule (MapBuffer, 0x1000, SmmModuleList, AddrIsOffset = False, ModeIsSmm = True)
|
||||
MapBuffer.write('\n\n')
|
||||
sys.stdout.write ("\n")
|
||||
sys.stdout.flush()
|
||||
sys.stdout.write ("\n")
|
||||
sys.stdout.flush()
|
||||
|
||||
## Save platform Map file
|
||||
#
|
||||
@@ -1291,10 +1295,10 @@ class Build():
|
||||
# Save address map into MAP file.
|
||||
#
|
||||
SaveFileOnChange(MapFilePath, MapBuffer.getvalue(), False)
|
||||
MapBuffer.close()
|
||||
if self.LoadFixAddress != 0:
|
||||
sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" %(MapFilePath))
|
||||
sys.stdout.flush()
|
||||
MapBuffer.close()
|
||||
if self.LoadFixAddress != 0:
|
||||
sys.stdout.write ("\nLoad Module At Fix Address Map file can be found at %s\n" %(MapFilePath))
|
||||
sys.stdout.flush()
|
||||
|
||||
## Build active platform for different build targets and different tool chains
|
||||
#
|
||||
@@ -1487,6 +1491,7 @@ class Build():
|
||||
|
||||
if not self.SkipAutoGen or self.Target == 'genmake':
|
||||
Ma.CreateMakeFile(True)
|
||||
Ma.CreateAsBuiltInf()
|
||||
if self.Target == "genmake":
|
||||
continue
|
||||
self.Progress.Stop("done!")
|
||||
|
Reference in New Issue
Block a user