Sync basetools' source and binary files with r1707 of the basetools project.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9257 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
vanjeff 2009-09-11 03:14:43 +00:00
parent f22911b49e
commit fd171542e0
91 changed files with 1794 additions and 974 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,6 +1,6 @@
# #
# Copyright (c) 2007-2009, Intel Corporation # Copyright (c) 2007-2009, Intel Corporation
# # Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved.
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # 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 # which accompanies this distribution. The full text of the license may be found at
@ -125,8 +125,9 @@
<Command.MSFT, Command.INTEL> <Command.MSFT, Command.INTEL>
"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src} "$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
<Command.GCC> <Command.GCC, Command.RVCT>
"$(CC)" -o ${dst} $(CC_FLAGS) $(INC) ${src} # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
"$(CC)" $(CC_FLAGS) -o ${dst} $(INC) ${src}
"$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst} "$(SYMRENAME)" $(SYMRENAME_FLAGS) ${dst}
[C-Header-File] [C-Header-File]
@ -139,7 +140,7 @@
[Assembly-Code-File.COMMON.COMMON] [Assembly-Code-File.COMMON.COMMON]
<InputFile.MSFT, InputFile.INTEL> <InputFile.MSFT, InputFile.INTEL, InputFile.RVCT>
?.asm, ?.Asm, ?.ASM ?.asm, ?.Asm, ?.ASM
<InputFile.GCC> <InputFile.GCC>
@ -156,10 +157,11 @@
Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i Trim --source-code --convert-hex -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii "$(ASM)" /Fo${dst} $(ASM_FLAGS) /I${s_path} $(INC) ${d_path}(+)${s_base}.iii
<Command.GCC> <Command.GCC, Command.RVCT>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o ${dst} $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} $(INC) ${d_path}(+)${s_base}.iii
[Assembly-Code-File.COMMON.IPF] [Assembly-Code-File.COMMON.IPF]
<InputFile> <InputFile>
@ -174,7 +176,8 @@
<Command.MSFT, Command.INTEL> <Command.MSFT, Command.INTEL>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i "$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o ${dst} $(ASM_FLAGS) ${d_path}(+)${s_base}.iii # For RVCTCYGWIN ASM_FLAGS must be first to work around pathing issues
"$(ASM)" $(ASM_FLAGS) -o ${dst} ${d_path}(+)${s_base}.iii
[Visual-Form-Representation-File] [Visual-Form-Representation-File]
<InputFile> <InputFile>
@ -191,9 +194,8 @@
<Command> <Command>
-$(MD) $(OUTPUT_DIR)(+)${s_dir} > NUL 2>&1 -$(MD) $(OUTPUT_DIR)(+)${s_dir} > NUL 2>&1
"$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i "$(VFRPP)" $(VFRPP_FLAGS) $(INC) ${src} > $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
Trim --vfr-file -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
-$(MD) ${d_path} > NUL 2>&1 -$(MD) ${d_path} > NUL 2>&1
"$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.iii "$(VFR)" $(VFR_FLAGS) --output-directory ${d_path} $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.i
[Object-File] [Object-File]
<InputFile> <InputFile>
@ -209,6 +211,16 @@
<Command.GCC> <Command.GCC>
"$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @"$(OBJECT_FILES_LIST)" "$(SLINK)" -cr ${dst} $(SLINK_FLAGS) @"$(OBJECT_FILES_LIST)"
<Command.RVCT>
"$(SLINK)" $(SLINK_FLAGS) ${dst} --via $(OBJECT_FILES_LIST)
<Command.RVCTCYGWIN>
# $(OBJECT_FILES_LIST) has wrong paths for cygwin
"$(SLINK)" $(SLINK_FLAGS) ${dst} $(OBJECT_FILES)
<Command.XCODE>
"$(SLINK)" $(SLINK_FLAGS) ${dst} -filelist $(OBJECT_FILES_LIST)
[Static-Library-File] [Static-Library-File]
<InputFile> <InputFile>
*.lib *.lib
@ -226,6 +238,17 @@
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @"$(STATIC_LIBRARY_FILES_LIST)" -\) $(DLINK2_FLAGS) "$(DLINK)" -o ${dst} $(DLINK_FLAGS) -\( $(DLINK_SPATH) @"$(STATIC_LIBRARY_FILES_LIST)" -\) $(DLINK2_FLAGS)
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
<Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
<Command.RVCTCYGWIN>
#$(STATIC_LIBRARY_FILES_LIST) has wrong paths for cygwin
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
<Command.XCODE>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
[Static-Library-File.USER_DEFINED] [Static-Library-File.USER_DEFINED]
<InputFile> <InputFile>
*.lib *.lib
@ -242,6 +265,17 @@
<Command.GCC> <Command.GCC>
"$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS) "$(DLINK)" $(DLINK_FLAGS) -\( $(DLINK_SPATH) @$(STATIC_LIBRARY_FILES_LIST) -\) $(DLINK2_FLAGS)
<Command.RVCT>
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) --via $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
<Command.RVCTCYGWIN>
#$(STATIC_LIBRARY_FILES_LIST) has the wrong paths for cygwin
"$(DLINK)" $(DLINK_FLAGS) -o ${dst} $(DLINK_SPATH) $(STATIC_LIBRARY_FILES) $(DLINK2_FLAGS)
<Command.XCODE>
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) $(DLINK_SPATH) -filelist $(STATIC_LIBRARY_FILES_LIST) $(DLINK2_FLAGS)
[Dynamic-Library-File] [Dynamic-Library-File]
<InputFile> <InputFile>
?.dll ?.dll
@ -249,12 +283,22 @@
<OutputFile> <OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(DEBUG_DIR)(+)$(MODULE_NAME).efi
<Command> <Command.MSFT, Command.INTEL, Command.GCC, Command.RVCT>
GenFw -e $(MODULE_TYPE) -o ${dst} ${src} GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
$(CP) ${dst} $(OUTPUT_DIR) $(CP) ${dst} $(OUTPUT_DIR)
$(CP) ${dst} $(BIN_DIR) $(CP) ${dst} $(BIN_DIR)
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR) -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
<Command.XCODE>
# tool to convert Mach-O to PE/COFF
"$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
# create symbol file for GDB debug
-$(DSYMUTIL) ${src}
GenFw -e $(MODULE_TYPE) -o ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
$(CP) ${dst} $(OUTPUT_DIR)
$(CP) ${dst} $(BIN_DIR)
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
[Dependency-Expression-File] [Dependency-Expression-File]
<InputFile> <InputFile>
?.dxs, ?.Dxs, ?.DXS ?.dxs, ?.Dxs, ?.DXS
@ -327,6 +371,13 @@
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll
<Command.XCODE>
"$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASLCC_FLAGS) $(INC) ${src}
"$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
"$(MTOC)" -subsystem $(MODULE_TYPE) $(MTOC_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi
GenFw -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi
[Masm16-Code-File] [Masm16-Code-File]
<InputFile> <InputFile>
?.asm16, ?.Asm16, ?.ASM16 ?.asm16, ?.Asm16, ?.ASM16
@ -342,6 +393,20 @@
"$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src} "$(ASM)" /nologo /c /omf /Fo$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj ${src}
"$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,, "$(ASMLINK)" $(ASMLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj,${dst},,,,
<Command.GCC>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
"$(DLINK)" -o ${dst} $(DLINK_FLAGS) -( $(DLINK_SPATH) $(LIBS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj -)
<Command.XCODE>
"$(PP)" $(PP_FLAGS) $(INC) ${src} > ${d_path}(+)${s_base}.i
Trim --source-code -o ${d_path}(+)${s_base}.iii ${d_path}(+)${s_base}.i
"$(ASM)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj $(ASM_FLAGS) $(INC) ${d_path}(+)${s_base}.iii
"$(SLINK)" $(SLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
otool -t $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.slib | hex2bin.py ${dst}
[Microcode-File] [Microcode-File]
<InputFile> <InputFile>
?.txt, ?.TXT, ?.Txt, ?.mut ?.txt, ?.TXT, ?.Txt, ?.mut

View File

@ -1,5 +1,6 @@
# #
# Copyright (c) 2006-2009, Intel Corporation # Copyright (c) 2006-2009, Intel Corporation
# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved.
# #
# All rights reserved. This program and the accompanying materials # All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License # are licensed and made available under the terms and conditions of the BSD License
@ -100,6 +101,12 @@ DEFINE ICC_WIN_ASLPP_FLAGS = /nologo /EP /C
DEFINE ICC_WIN_ASLCC_FLAGS = /Y- /TC /WX- /Od /Dmain=ReferenceAcpiTable DEFINE ICC_WIN_ASLCC_FLAGS = /Y- /TC /WX- /Od /Dmain=ReferenceAcpiTable
DEFINE ICC_WIN_ASLDLINK_FLAGS = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libmmt /NODEFAULTLIB:libirc DEFINE ICC_WIN_ASLDLINK_FLAGS = /NODEFAULTLIB /ENTRY:ReferenceAcpiTable /SUBSYSTEM:CONSOLE /NODEFAULTLIB:libmmt /NODEFAULTLIB:libirc
DEFINE IPHONE_TOOLS = /Developer/Platforms/iPhoneOS.platform/Developer
DEFINE RVCT31_TOOLS_PATH = c:/Program Files/ARM/RVCT/Programs/3.1/761/win_32-pentium
DEFINE RVCT31CYGWIN_TOOLS_PATH = /cygdrive/c/Program\ Files/ARM/RVCT/Programs/3.1/761/win_32-pentium
# Update to the location of the gcc executables
DEFINE ARMGCC_BIN = /
#################################################################################### ####################################################################################
# #
@ -2040,6 +2047,267 @@ RELEASE_MYTOOLS_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT
*_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_MYTOOLS_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_MYTOOLS_EBC_DLINK_FLAGS = "C:\Program Files\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP
####################################################################################
#
# Xcode Support for building on Mac OS X (Snow Leopard)
#
####################################################################################
# XCODE32 - Xcode 3.2 Tools (Snow Leopard)
*_XCODE32_*_*_FAMILY = GCC
*_XCODE32_*_*_BUILDRULEFAMILY = XCODE
*_XCODE32_*_ASL_PATH = /usr/bin/iasl
*_XCODE32_*_MAKE_PATH = make
# This tool needs to be installed seperatly from Xcode 3.2
*_XCODE32_*_MTOC_PATH = /Developer/usr/bin/mtoc
*_XCODE32_*_DSYMUTIL_PATH = /usr/bin/dsymutil
DEBUG_XCODE32_*_MTOC_FLAGS = -align 0x20 -d $(DEBUG_DIR)/$(MODULE_NAME).dll
RELEASE_XCODE32_*_MTOC_FLAGS = -align 0x20
##################
# IA32 definitions
##################
*_XCODE32_IA32_CC_PATH = gcc
*_XCODE32_IA32_SLINK_PATH = libtool
*_XCODE32_IA32_DLINK_PATH = ld
*_XCODE32_IA32_ASM_PATH = as
*_XCODE32_IA32_PP_PATH = gcc
*_XCODE32_IA32_VFRPP_PATH = gcc
*_XCODE32_IA32_ASL_PATH = iasl
*_XCODE32_IA32_ASLCC_PATH = gcc
*_XCODE32_IA32_ASLPP_PATH = gcc
*_XCODE32_IA32_ASLDLINK_PATH = ld
DEBUG_XCODE32_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
RELEASE_XCODE32_IA32_DLINK_FLAGS = -arch i386 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_XCODE32_IA32_SLINK_FLAGS = -static -o
DEBUG_XCODE32_IA32_ASM_FLAGS = -arch i386 -g
RELEASE_XCODE32_IA32_ASM_FLAGS = -arch i386
*_XCODE32_IA32_PP_FLAGS = -arch i386 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_XCODE32_IA32_VFRPP_FLAGS = -arch i386 -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
DEBUG_XCODE32_IA32_CC_FLAGS = -arch i386 -save-temps -g -O0 -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector
RELEASE_XCODE32_IA32_CC_FLAGS = -arch i386 -Oz -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector
*_XCODE32_IA32_ASLCC_FLAGS = -arch i386 -x c -save-temps -g -O0 -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h -mdynamic-no-pic
*_XCODE32_IA32_ASLDLINK_FLAGS = -arch i386 -e _main -preload -segalign 0x20 -slow_stubs -pie -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_XCODE32_IA32_ASLPP_FLAGS = -arch i386 -x c -E
*_XCODE32_IA32_ASL_FLAGS =
##################
# X64 definitions - still a work in progress. This tool chain does not produce
# the correct ABI, it is just used to compile the code....
##################
*_XCODE32_X64_CC_PATH = gcc-4.2
*_XCODE32_X64_SLINK_PATH = libtool
*_XCODE32_X64_DLINK_PATH = ld
*_XCODE32_X64_ASM_PATH = as
*_XCODE32_X64_PP_PATH = gcc-4.2
*_XCODE32_X64_VFRPP_PATH = gcc-4.2
*_XCODE32_X64_ASL_PATH = iasl
*_XCODE32_X64_ASLCC_PATH = gcc
*_XCODE32_X64_ASLPP_PATH = gcc
*_XCODE32_X64_ASLDLINK_PATH = ld
*_XCODE32_X64_DLINK_FLAGS = -arch x86_64 -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -seg1addr 0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
*_XCODE32_X64_SLINK_FLAGS = -static -o
DEBUG_XCODE32_X64_ASM_FLAGS = -arch x86_64 -g
RELEASE_XCODE32_X64_ASM_FLAGS = -arch x86_64
*_XCODE32_X64_PP_FLAGS = -arch x86_64 -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_XCODE32_X64_VFRPP_FLAGS = -arch x86_64 -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
DEBUG_XCODE32_X64_CC_FLAGS = -arch x86_64 -save-temps -g -O0 -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector
RELEASE_XCODE32_X64_CC_FLAGS = -arch x86_64 -Oz -combine -mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-address -fomit-frame-pointer -static -c -include AutoGen.h -fno-stack-protector
##################
# ARM definitions - still a work in progress (Assumes iPhone SDK installed)
##################
*_XCODE32_ARM_ARCHCC_FLAGS = -arch armv6 -march=armv6 -mthumb
*_XCODE32_ARM_ARCHASM_FLAGS = -arch armv6
*_XCODE32_ARM_ARCHDLINK_FLAGS = -arch armv6
*_XCODE32_ARM_PLATFORM_FLAGS =
*_XCODE32_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib
*_XCODE32_ARM_CC_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
*_XCODE32_ARM_SLINK_PATH = DEF(IPHONE_TOOLS)/usr/bin/libtool
*_XCODE32_ARM_DLINK_PATH = DEF(IPHONE_TOOLS)/usr/bin/ld
*_XCODE32_ARM_ASM_PATH = DEF(IPHONE_TOOLS)/usr/bin/as
*_XCODE32_ARM_PP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
*_XCODE32_ARM_VFRPP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
DEBUG_XCODE32_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Darwin-i386/ARM/DEBUG_XCODE32/$(INTRINSIC_FLAGS)
RELEASE_XCODE32_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) -u _$(IMAGE_ENTRY_POINT) -e _$(IMAGE_ENTRY_POINT) -preload -segalign 0x20 -slow_stubs -pie -all_load -dead_strip -seg1addr 0x220 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Darwin-i386/ARM/RELEASE_XCODE32/$(INTRINSIC_FLAGS)
*_XCODE32_ARM_SLINK_FLAGS = -static -o
DEBUG_XCODE32_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -g
RELEASE_XCODE32_ARM_ASM_FLAGS = $(ARCHASM_FLAGS)
*_XCODE32_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_XCODE32_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
DEBUG_XCODE32_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-interwork -g -Oz -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector
RELEASE_XCODE32_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-interwork -Oz -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h -mdynamic-no-pic -fno-stack-protector
####################################################################################
#
# ARM Tools
#
####################################################################################
# RVCT31 - Tools from ARM
*_RVCT31_*_*_FAMILY = RVCT
#
# Use default values, or override in DSC file
#
*_RVCT31_ARM_ARCHCC_FLAGS = --thumb --cpu ARM1176JZF-S
*_RVCT31_ARM_ARCHASM_FLAGS = --cpu ARM1176JZF-S
*_RVCT31_ARM_ARCHDLINK_FLAGS =
*_RVCT31_ARM_PLATFORM_FLAGS =
*_RVCT31_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib
DEBUG_RVCT31_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Win32/ARM/DEBUG_RVCT31/$(INTRINSIC_FLAGS)
RELEASE_RVCT31_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list $(DEST_DIR_DEBUG)/$(BASE_NAME).map ENV(EDK_TOOLS_PATH)/Bin/Win32/ARM/RELEASE_RVCT31/$(INTRINSIC_FLAGS)
*_RVCT31_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) --apcs /interwork
*_RVCT31_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
*_RVCT31_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
*_RVCT31_ARM_MAKE_PATH = nmake
*_RVCT31_ARM_SLINK_FLAGS = --partial -o
DEBUG_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167
RELEASE_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --enum_is_int --preinclude AutoGen.h --diag_warning 167
##################
# ARM definitions
##################
*_RVCT31_ARM_CC_PATH = DEF(RVCT31_TOOLS_PATH)/armcc
*_RVCT31_ARM_SLINK_PATH = DEF(RVCT31_TOOLS_PATH)/armlink
*_RVCT31_ARM_DLINK_PATH = DEF(RVCT31_TOOLS_PATH)/armlink
*_RVCT31_ARM_ASM_PATH = DEF(RVCT31_TOOLS_PATH)/armasm
*_RVCT31_ARM_PP_PATH = DEF(RVCT31_TOOLS_PATH)/armcc
*_RVCT31_ARM_VFRPP_PATH = DEF(RVCT31_TOOLS_PATH)/armcc
*_RVCT31_ARM_FROMELF_PATH = DEF(RVCT31_TOOLS_PATH)/fromelf
####################################################################################
#
# ARM Tools & Cygwin
#
####################################################################################
# ARMCYGWIN - Tools from ARM in a Cygwin environment
*_RVCT31CYGWIN_*_*_FAMILY = RVCT
*_RVCT31CYGWIN_*_*_BUILDRULEFAMILY = RVCTCYGWIN
*_RVCT31CYGWIN_ARM_CCPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc
*_RVCT31CYGWIN_ARM_SLINKPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink
*_RVCT31CYGWIN_ARM_DLINKPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armlink
*_RVCT31CYGWIN_ARM_ASMPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armasm
*_RVCT31CYGWIN_ARM_PPPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc
*_RVCT31CYGWIN_ARM_VFRPPPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/armcc
*_RVCT31CYGWIN_ARM_FROMELFPATH_FLAG = DEF(RVCT31CYGWIN_TOOLS_PATH)/fromelf
#
# Use default values, or override in DSC file
#
*_RVCT31CYGWIN_ARM_ARCHCC_FLAGS = --thumb --cpu ARM1176JZF-S
*_RVCT31CYGWIN_ARM_ARCHASM_FLAGS = --cpu ARM1176JZF-S
*_RVCT31CYGWIN_ARM_ARCHDLINK_FLAGS =
*_RVCT31CYGWIN_ARM_PLATFORM_FLAGS =
*_RVCT31CYGWIN_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib
DEBUG_RVCT31CYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` ENV(EDK_TOOLS_PATH)/Bin/CYGWIN_NT-5.1-i686/ARM/DEBUG_RVCT31CYGWIN/$(INTRINSIC_FLAGS)
RELEASE_RVCT31CYGWIN_ARM_DLINK_FLAGS = "$(DLINKPATH_FLAG)" $(ARCHDLINK_FLAGS) --entry $(IMAGE_ENTRY_POINT) --ro-base 0 --no_scanlib --reloc --no_exceptions --datacompressor off --strict --symbols --map --list `cygpath -m $(DEST_DIR_DEBUG)/$(BASE_NAME).map` ENV(EDK_TOOLS_PATH)/Bin/CYGWIN_NT-5.1-i686/ARM/DEBUG_RVCT31CYGWIN/$(INTRINSIC_FLAGS)
*_RVCT31CYGWIN_ARM_ASM_FLAGS = "$(ASMPATH_FLAG)" $(ARCHASM_FLAGS) --apcs /interwork
*_RVCT31CYGWIN_ARM_PP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E
*_RVCT31CYGWIN_ARM_VFRPP_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -DVFRCOMPILE --preinclude `cygpath -m $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h`
*_RVCT31CYGWIN_ARM_MAKE_PATH = make
*_RVCT31CYGWIN_ARM_SLINK_FLAGS = "$(SLINKPATH_FLAG)" --partial -o
DEBUG_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c -g -O2 --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167
RELEASE_RVCT31CYGWIN_ARM_CC_FLAGS = "$(CCPATH_FLAG)" $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -c --no_autoinline --asm --gnu --apcs /interwork --signed_chars --no_unaligned_access --split_sections --preinclude AutoGen.h --diag_warning 167
##################
# ARM definitions
##################
*_RVCT31CYGWIN_ARM_CC_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_SLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_DLINK_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_ASM_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_PP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_VFRPP_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
*_RVCT31CYGWIN_ARM_FROMELF_PATH = ENV(WORKSPACE)/BaseTools/Bin/CYGWIN_NT-5.1-i686/armcc_wrapper.py
####################################################################################
#
# ARM GCC (GCC 4.1.1, etc.)
#
####################################################################################
# ARMGCC - ARM version of the GCC cross compiler
*_ARMGCC_*_*_FAMILY = GCC
*_ARMGCC_*_MAKE_PATH = make
##################
# ASL definitions
##################
*_ARMGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
*_ARMGCCC_*_ASL_FLAGS =
*_ARMGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
*_ARMGCC_*_ASLPP_FLAGS = -x c -E -P
*_ARMGCC_*_ASLCC_FLAGS = -x c
*_ARMGCC_*_ASLDLINK_FLAGS = DEF(UNIXGCC_DLINK_FLAGS_COMMON) --entry _ReferenceAcpiTable
##################
# ARM definitions
##################
*_ARMGCC_ARM_ASLCC_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc
*_ARMGCC_ARM_ASLDLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ld
*_ARMGCC_ARM_ASLPP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc
*_ARMGCC_ARM_CC_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc
*_ARMGCC_ARM_SLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ar
*_ARMGCC_ARM_DLINK_PATH = DEF(ARMGCC_BIN)/arm-elf-ld
*_ARMGCC_ARM_ASM_PATH = DEF(ARMGCC_BIN)/arm-elf-as
*_ARMGCC_ARM_PP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc
*_ARMGCC_ARM_VFRPP_PATH = DEF(ARMGCC_BIN)/arm-elf-gcc
#
# Use default values, or override in DSC file
#
*_ARMGCC_ARM_ARCHCC_FLAGS =
*_ARMGCC_ARM_ARCHASM_FLAGS =
*_ARMGCC_ARM_ARCHDLINK_FLAGS =
*_ARMGCC_ARM_PLATFORM_FLAGS =
*_ARMGCC_ARM_INTRINSIC_FLAGS = CompilerIntrinsicsLib.lib
DEBUG_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian -g
RELEASE_ARMGCC_ARM_ASM_FLAGS = $(ARCHASM_FLAGS) -mlittle-endian
*_ARMGCC_ARM_PP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -E -x assembler-with-cpp -include $(DEST_DIR_DEBUG)/AutoGen.h
*_ARMGCC_ARM_VFRPP_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -x c -E -P -DVFRCOMPILE --include $(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
*_ARMGCC_ARM_MAKE_PATH = make
*_ARMGCC_ARM_SLINK_FLAGS = -r
*_ARMGCC_ARM_DLINK_FLAGS = $(ARCHDLINK_FLAGS) --emit-relocs --oformat=elf32-littlearm -nostdlib -u $(IMAGE_ENTRY_POINT) -e $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
# --gc-sections
DEBUG_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -g -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h
RELEASE_ARMGCC_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mfpu=fpa -mlittle-endian -O2 -mabi=aapcs -mapcs -fno-short-enums -save-temps -combine -fsigned-char -fshort-wchar -fno-strict-aliasing -ffunction-sections -fdata-sections -Wall -Werror -Wno-missing-braces -fomit-frame-pointer -c -include AutoGen.h
################## ##################
# VfrCompiler definitions # VfrCompiler definitions
################## ##################

View File

@ -66,7 +66,7 @@ Notes:
or modules because the AutoGen.* files have been be removed. The "makefile" itself or modules because the AutoGen.* files have been be removed. The "makefile" itself
cannot generate AutoGen.* files. Only "build" command can. cannot generate AutoGen.* files. Only "build" command can.
3) All .exe binary file including C and python tools are generated from: 3) All .exe binary file including C and python tools are generated from:
r1655 <buildtools_project>\BaseTools\Source\ + r1662 VfrCompiler tool update r1707 <buildtools_project>\BaseTools\Source\ + r1707 VfrCompiler tool update
Brief usage for Migration Tool MigrationMsa2Inf.exe: Brief usage for Migration Tool MigrationMsa2Inf.exe:
1. Command line format: 1. Command line format:
@ -190,4 +190,4 @@ Brief usage for Migration Tool Fpd2Dsc.exe:
7. Pyton Source 7. Pyton Source
r767 <buildtools_project>\BaseTools\Source\Python\Fpd2Dsc r767 <buildtools_project>\BaseTools\Source\Python\Fpd2Dsc
17-July-2009 10-Sep-2009

View File

@ -371,13 +371,13 @@ Return:
if ((FatType == FatTypeFat32) && if ((FatType == FatTypeFat32) &&
(FatBpb->Fat12_16.BPB_TotSec32 == 0)) { (FatBpb->Fat12_16.BPB_TotSec32 == 0)) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_TotSec32 - %04x, expected: Non-Zero", DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_TotSec32 - %04x, expected: Non-Zero",
FatBpb->Fat12_16.BPB_TotSec32); (unsigned) FatBpb->Fat12_16.BPB_TotSec32);
return FatTypeUnknown; return FatTypeUnknown;
} }
if ((FatType == FatTypeFat32) && if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_FATSz32 == 0)) { (FatBpb->Fat32.BPB_FATSz32 == 0)) {
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_FATSz32 - %08x, expected: Non-Zero", DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E3003: FAT32 - BPB_FATSz32 - %08x, expected: Non-Zero",
FatBpb->Fat32.BPB_FATSz32); (unsigned) FatBpb->Fat32.BPB_FATSz32);
return FatTypeUnknown; return FatTypeUnknown;
} }
if ((FatType == FatTypeFat32) && if ((FatType == FatTypeFat32) &&
@ -388,7 +388,7 @@ Return:
if ((FatType == FatTypeFat32) && if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_RootClus != 2)) { (FatBpb->Fat32.BPB_RootClus != 2)) {
DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT32 - BPB_RootClus - %08x, expected: %04x", DebugMsg (NULL, 0, DEBUG_WARN, NULL, "ERROR: E3003: FAT32 - BPB_RootClus - %08x, expected: %04x",
FatBpb->Fat32.BPB_RootClus, 2); (unsigned) FatBpb->Fat32.BPB_RootClus, 2);
} }
if ((FatType == FatTypeFat32) && if ((FatType == FatTypeFat32) &&
(FatBpb->Fat32.BPB_FSInfo != 1)) { (FatBpb->Fat32.BPB_FSInfo != 1)) {
@ -523,14 +523,14 @@ ParseBootSector (
printf (" 16 Sectors per FAT (small vol.) %04x\n", FatBpb.Fat12_16.BPB_FATSz16); printf (" 16 Sectors per FAT (small vol.) %04x\n", FatBpb.Fat12_16.BPB_FATSz16);
printf (" 18 Sectors per track %04x\n", FatBpb.Fat12_16.BPB_SecPerTrk); printf (" 18 Sectors per track %04x\n", FatBpb.Fat12_16.BPB_SecPerTrk);
printf (" 1A Heads %04x\n", FatBpb.Fat12_16.BPB_NumHeads); printf (" 1A Heads %04x\n", FatBpb.Fat12_16.BPB_NumHeads);
printf (" 1C Hidden sectors %08x\n", FatBpb.Fat12_16.BPB_HiddSec); printf (" 1C Hidden sectors %08x\n", (unsigned) FatBpb.Fat12_16.BPB_HiddSec);
printf (" 20 Sectors (over 32MB) %08x\n", FatBpb.Fat12_16.BPB_TotSec32); printf (" 20 Sectors (over 32MB) %08x\n", (unsigned) FatBpb.Fat12_16.BPB_TotSec32);
printf ("\n"); printf ("\n");
if (FatType != FatTypeFat32) { if (FatType != FatTypeFat32) {
printf (" 24 BIOS drive %02x\n", FatBpb.Fat12_16.BS_DrvNum); printf (" 24 BIOS drive %02x\n", FatBpb.Fat12_16.BS_DrvNum);
printf (" 25 (Unused) %02x\n", FatBpb.Fat12_16.BS_Reserved1); printf (" 25 (Unused) %02x\n", FatBpb.Fat12_16.BS_Reserved1);
printf (" 26 Ext. boot signature %02x\n", FatBpb.Fat12_16.BS_BootSig); printf (" 26 Ext. boot signature %02x\n", FatBpb.Fat12_16.BS_BootSig);
printf (" 27 Volume serial number %08x\n", FatBpb.Fat12_16.BS_VolID); printf (" 27 Volume serial number %08x\n", (unsigned) FatBpb.Fat12_16.BS_VolID);
printf (" 2B Volume lable %c%c%c%c%c%c%c%c%c%c%c\n", printf (" 2B Volume lable %c%c%c%c%c%c%c%c%c%c%c\n",
FatBpb.Fat12_16.BS_VolLab[0], FatBpb.Fat12_16.BS_VolLab[0],
FatBpb.Fat12_16.BS_VolLab[1], FatBpb.Fat12_16.BS_VolLab[1],
@ -555,10 +555,10 @@ ParseBootSector (
printf ("\n"); printf ("\n");
} else { } else {
printf ("FAT32 Section\n"); printf ("FAT32 Section\n");
printf (" 24 Sectors per FAT (large vol.) %08x\n", FatBpb.Fat32.BPB_FATSz32); printf (" 24 Sectors per FAT (large vol.) %08x\n", (unsigned) FatBpb.Fat32.BPB_FATSz32);
printf (" 28 Flags %04x\n", FatBpb.Fat32.BPB_ExtFlags); printf (" 28 Flags %04x\n", FatBpb.Fat32.BPB_ExtFlags);
printf (" 2A Version %04x\n", FatBpb.Fat32.BPB_FSVer); printf (" 2A Version %04x\n", FatBpb.Fat32.BPB_FSVer);
printf (" 2C Root dir 1st cluster %08x\n", FatBpb.Fat32.BPB_RootClus); printf (" 2C Root dir 1st cluster %08x\n", (unsigned) FatBpb.Fat32.BPB_RootClus);
printf (" 30 FSInfo sector %04x\n", FatBpb.Fat32.BPB_FSInfo); printf (" 30 FSInfo sector %04x\n", FatBpb.Fat32.BPB_FSInfo);
printf (" 32 Backup boot sector %04x\n", FatBpb.Fat32.BPB_BkBootSec); printf (" 32 Backup boot sector %04x\n", FatBpb.Fat32.BPB_BkBootSec);
printf (" 34 (Reserved) %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n", printf (" 34 (Reserved) %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
@ -578,7 +578,7 @@ ParseBootSector (
printf (" 40 BIOS drive %02x\n", FatBpb.Fat32.BS_DrvNum); printf (" 40 BIOS drive %02x\n", FatBpb.Fat32.BS_DrvNum);
printf (" 41 (Unused) %02x\n", FatBpb.Fat32.BS_Reserved1); printf (" 41 (Unused) %02x\n", FatBpb.Fat32.BS_Reserved1);
printf (" 42 Ext. boot signature %02x\n", FatBpb.Fat32.BS_BootSig); printf (" 42 Ext. boot signature %02x\n", FatBpb.Fat32.BS_BootSig);
printf (" 43 Volume serial number %08x\n", FatBpb.Fat32.BS_VolID); printf (" 43 Volume serial number %08x\n", (unsigned) FatBpb.Fat32.BS_VolID);
printf (" 47 Volume lable %c%c%c%c%c%c%c%c%c%c%c\n", printf (" 47 Volume lable %c%c%c%c%c%c%c%c%c%c%c\n",
FatBpb.Fat32.BS_VolLab[0], FatBpb.Fat32.BS_VolLab[0],
FatBpb.Fat32.BS_VolLab[1], FatBpb.Fat32.BS_VolLab[1],
@ -738,7 +738,7 @@ ParseMbr (
printf (" Offset Title Value\n"); printf (" Offset Title Value\n");
printf ("==================================================================\n"); printf ("==================================================================\n");
printf (" 0 Master bootstrap loader code (not list)\n"); printf (" 0 Master bootstrap loader code (not list)\n");
printf (" 1B8 Windows disk signature %08x\n", Mbr.UniqueMbrSignature); printf (" 1B8 Windows disk signature %08x\n", (unsigned) Mbr.UniqueMbrSignature);
printf ("\n"); printf ("\n");
printf ("Partition Table Entry #1\n"); printf ("Partition Table Entry #1\n");
printf (" 1BE 80 = active partition %02x\n", Mbr.PartitionRecord[0].BootIndicator); printf (" 1BE 80 = active partition %02x\n", Mbr.PartitionRecord[0].BootIndicator);
@ -749,8 +749,8 @@ ParseMbr (
printf (" 1C3 End head %02x\n", Mbr.PartitionRecord[0].EndHead); printf (" 1C3 End head %02x\n", Mbr.PartitionRecord[0].EndHead);
printf (" 1C4 End sector %02x\n", Mbr.PartitionRecord[0].EndSector); printf (" 1C4 End sector %02x\n", Mbr.PartitionRecord[0].EndSector);
printf (" 1C5 End cylinder %02x\n", Mbr.PartitionRecord[0].EndTrack); printf (" 1C5 End cylinder %02x\n", Mbr.PartitionRecord[0].EndTrack);
printf (" 1C6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[0].StartingLBA); printf (" 1C6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[0].StartingLBA);
printf (" 1CA Sectors in partition %08x\n", Mbr.PartitionRecord[0].SizeInLBA); printf (" 1CA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[0].SizeInLBA);
printf ("\n"); printf ("\n");
printf ("Partition Table Entry #2\n"); printf ("Partition Table Entry #2\n");
printf (" 1CE 80 = active partition %02x\n", Mbr.PartitionRecord[1].BootIndicator); printf (" 1CE 80 = active partition %02x\n", Mbr.PartitionRecord[1].BootIndicator);
@ -761,8 +761,8 @@ ParseMbr (
printf (" 1D3 End head %02x\n", Mbr.PartitionRecord[1].EndHead); printf (" 1D3 End head %02x\n", Mbr.PartitionRecord[1].EndHead);
printf (" 1D4 End sector %02x\n", Mbr.PartitionRecord[1].EndSector); printf (" 1D4 End sector %02x\n", Mbr.PartitionRecord[1].EndSector);
printf (" 1D5 End cylinder %02x\n", Mbr.PartitionRecord[1].EndTrack); printf (" 1D5 End cylinder %02x\n", Mbr.PartitionRecord[1].EndTrack);
printf (" 1D6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[1].StartingLBA); printf (" 1D6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[1].StartingLBA);
printf (" 1DA Sectors in partition %08x\n", Mbr.PartitionRecord[1].SizeInLBA); printf (" 1DA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[1].SizeInLBA);
printf ("\n"); printf ("\n");
printf ("Partition Table Entry #3\n"); printf ("Partition Table Entry #3\n");
printf (" 1DE 80 = active partition %02x\n", Mbr.PartitionRecord[2].BootIndicator); printf (" 1DE 80 = active partition %02x\n", Mbr.PartitionRecord[2].BootIndicator);
@ -773,8 +773,8 @@ ParseMbr (
printf (" 1E3 End head %02x\n", Mbr.PartitionRecord[2].EndHead); printf (" 1E3 End head %02x\n", Mbr.PartitionRecord[2].EndHead);
printf (" 1E4 End sector %02x\n", Mbr.PartitionRecord[2].EndSector); printf (" 1E4 End sector %02x\n", Mbr.PartitionRecord[2].EndSector);
printf (" 1E5 End cylinder %02x\n", Mbr.PartitionRecord[2].EndTrack); printf (" 1E5 End cylinder %02x\n", Mbr.PartitionRecord[2].EndTrack);
printf (" 1E6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[2].StartingLBA); printf (" 1E6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[2].StartingLBA);
printf (" 1EA Sectors in partition %08x\n", Mbr.PartitionRecord[2].SizeInLBA); printf (" 1EA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[2].SizeInLBA);
printf ("\n"); printf ("\n");
printf ("Partition Table Entry #4\n"); printf ("Partition Table Entry #4\n");
printf (" 1EE 80 = active partition %02x\n", Mbr.PartitionRecord[3].BootIndicator); printf (" 1EE 80 = active partition %02x\n", Mbr.PartitionRecord[3].BootIndicator);
@ -785,8 +785,8 @@ ParseMbr (
printf (" 1F3 End head %02x\n", Mbr.PartitionRecord[3].EndHead); printf (" 1F3 End head %02x\n", Mbr.PartitionRecord[3].EndHead);
printf (" 1F4 End sector %02x\n", Mbr.PartitionRecord[3].EndSector); printf (" 1F4 End sector %02x\n", Mbr.PartitionRecord[3].EndSector);
printf (" 1F5 End cylinder %02x\n", Mbr.PartitionRecord[3].EndTrack); printf (" 1F5 End cylinder %02x\n", Mbr.PartitionRecord[3].EndTrack);
printf (" 1F6 Sectors preceding partition %08x\n", Mbr.PartitionRecord[3].StartingLBA); printf (" 1F6 Sectors preceding partition %08x\n", (unsigned) Mbr.PartitionRecord[3].StartingLBA);
printf (" 1FA Sectors in partition %08x\n", Mbr.PartitionRecord[3].SizeInLBA); printf (" 1FA Sectors in partition %08x\n", (unsigned) Mbr.PartitionRecord[3].SizeInLBA);
printf ("\n"); printf ("\n");
printf (" 1FE Signature %04x\n", Mbr.Signature); printf (" 1FE Signature %04x\n", Mbr.Signature);
printf ("\n"); printf ("\n");

View File

@ -856,6 +856,7 @@ Returns:
PeHdr = NULL; PeHdr = NULL;
TeHdr = NULL; TeHdr = NULL;
OptionHeader.Header = NULL;
// //
// Assume success // Assume success
// //
@ -1352,6 +1353,7 @@ PeCoffLoaderGetPdbPointer (
// //
// Get the DebugEntry offset in the raw data image. // Get the DebugEntry offset in the raw data image.
// //
CodeViewEntryPointer = NULL;
for (Index1 = 0; Index1 < Index; Index1 ++) { for (Index1 = 0; Index1 < Index; Index1 ++) {
if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) && if ((DebugEntry->RVA >= SectionHeader[Index1].VirtualAddress) &&
(DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) { (DebugEntry->RVA < (SectionHeader[Index1].VirtualAddress + SectionHeader[Index1].Misc.VirtualSize))) {

View File

@ -472,7 +472,7 @@ Returns:
printf ( printf (
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
Guid->Data1, (unsigned) Guid->Data1,
Guid->Data2, Guid->Data2,
Guid->Data3, Guid->Data3,
Guid->Data4[0], Guid->Data4[0],
@ -529,7 +529,7 @@ Returns:
sprintf ( sprintf (
(CHAR8 *)Buffer, (CHAR8 *)Buffer,
"%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
Guid->Data1, (unsigned) Guid->Data1,
Guid->Data2, Guid->Data2,
Guid->Data3, Guid->Data3,
Guid->Data4[0], Guid->Data4[0],
@ -545,7 +545,7 @@ Returns:
sprintf ( sprintf (
(CHAR8 *)Buffer, (CHAR8 *)Buffer,
"%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
Guid->Data1, (unsigned) Guid->Data1,
Guid->Data2, Guid->Data2,
Guid->Data3, Guid->Data3,
Guid->Data4[0], Guid->Data4[0],

View File

@ -34,7 +34,7 @@ Abstract:
// //
STATIC STATUS mStatus = STATUS_SUCCESS; STATIC STATUS mStatus = STATUS_SUCCESS;
STATIC CHAR8 mUtilityName[50] = { 0 }; STATIC CHAR8 mUtilityName[50] = { 0 };
STATIC UINT32 mPrintLogLevel = INFO_LOG_LEVEL; STATIC UINT64 mPrintLogLevel = INFO_LOG_LEVEL;
STATIC CHAR8 *mSourceFileName = NULL; STATIC CHAR8 *mSourceFileName = NULL;
STATIC UINT32 mSourceFileLineNum = 0; STATIC UINT32 mSourceFileLineNum = 0;
STATIC UINT32 mErrorCount = 0; STATIC UINT32 mErrorCount = 0;
@ -355,7 +355,7 @@ VOID
DebugMsg ( DebugMsg (
CHAR8 *FileName, CHAR8 *FileName,
UINT32 LineNumber, UINT32 LineNumber,
UINT32 MsgLevel, UINT64 MsgLevel,
CHAR8 *Text, CHAR8 *Text,
CHAR8 *MsgFmt, CHAR8 *MsgFmt,
... ...
@ -495,7 +495,7 @@ Notes:
if (Cptr != NULL) { if (Cptr != NULL) {
sprintf (Line, ": %s", Cptr); sprintf (Line, ": %s", Cptr);
if (LineNumber != 0) { if (LineNumber != 0) {
sprintf (Line2, "(%d)", LineNumber); sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2); strcat (Line, Line2);
} }
} }
@ -509,7 +509,7 @@ Notes:
} }
sprintf (Line, "%s", Cptr); sprintf (Line, "%s", Cptr);
if (LineNumber != 0) { if (LineNumber != 0) {
sprintf (Line2, "(%d)", LineNumber); sprintf (Line2, "(%u)", (unsigned) LineNumber);
strcat (Line, Line2); strcat (Line, Line2);
} }
} else { } else {
@ -524,7 +524,7 @@ Notes:
// message for you. It has to be decimal digits too. // message for you. It has to be decimal digits too.
// //
if (MessageCode != 0) { if (MessageCode != 0) {
sprintf (Line2, ": %s %04d", Type, MessageCode); sprintf (Line2, ": %s %04u", Type, (unsigned) MessageCode);
} else { } else {
sprintf (Line2, ": %s", Type); sprintf (Line2, ": %s", Type);
} }
@ -665,7 +665,7 @@ Returns:
VOID VOID
SetPrintLevel ( SetPrintLevel (
UINT32 LogLevel UINT64 LogLevel
) )
/*++ /*++
@ -843,7 +843,7 @@ TestUtilityMessages (
) )
{ {
CHAR8 *ArgStr = "ArgString"; CHAR8 *ArgStr = "ArgString";
INTN ArgInt; int ArgInt;
ArgInt = 0x12345678; ArgInt = 0x12345678;
// //

View File

@ -96,7 +96,7 @@ VOID
DebugMsg ( DebugMsg (
CHAR8 *FileName, CHAR8 *FileName,
UINT32 LineNumber, UINT32 LineNumber,
UINT32 MsgLevel, UINT64 MsgLevel,
CHAR8 *OffendingText, CHAR8 *OffendingText,
CHAR8 *MsgFmt, CHAR8 *MsgFmt,
... ...
@ -123,7 +123,7 @@ KeyMsg (
VOID VOID
SetPrintLevel ( SetPrintLevel (
UINT32 LogLevel UINT64 LogLevel
); );
VOID VOID

View File

@ -86,7 +86,7 @@ MyCheck (
"Invalid parameter(s).\n", "Invalid parameter(s).\n",
Final, Final,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -98,7 +98,7 @@ MyCheck (
"Invalid parameter.\n", "Invalid parameter.\n",
Final, Final,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -121,12 +121,12 @@ MyCheck (
"\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n", "\nFile=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Final, Final,
File, File,
(UINT32)Line, (unsigned)Line,
Tmp->File, Tmp->File,
(UINT32)Tmp->Line, (unsigned) Tmp->Line,
(UINT32)Tmp->Size, (unsigned) Tmp->Size,
*(UINT32 *) (Tmp->Buffer), (unsigned) *(UINT32 *) (Tmp->Buffer),
*(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)]) (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
); );
exit (1); exit (1);
@ -141,17 +141,17 @@ MyCheck (
"\nSome allocated items have not been freed.\n", "\nSome allocated items have not been freed.\n",
Final, Final,
File, File,
(UINT32)Line (unsigned)Line
); );
for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) { for (Tmp = MyAllocData; Tmp != NULL; Tmp = Tmp->Next) {
printf ( printf (
"File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n", "File=%s, Line=%u, nSize=%u, Head=%xh, Tail=%xh\n",
Tmp->File, Tmp->File,
(UINT32)Tmp->Line, (unsigned) Tmp->Line,
(UINT32)Tmp->Size, (unsigned) Tmp->Size,
*(UINT32 *) (Tmp->Buffer), (unsigned) *(UINT32 *) (Tmp->Buffer),
*(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)]) (unsigned) *(UINT32 *) (&Tmp->Buffer[Tmp->Size + sizeof (UINT32)])
); );
} }
} }
@ -201,9 +201,9 @@ MyAlloc (
printf ( printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)" "\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n", "\nInvalid parameter(s).\n",
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -214,9 +214,9 @@ MyAlloc (
printf ( printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)" "\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n", "\nInvalid parameter.\n",
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -238,9 +238,9 @@ MyAlloc (
printf ( printf (
"\nMyAlloc(Size=%u, File=%s, Line=%u)" "\nMyAlloc(Size=%u, File=%s, Line=%u)"
"\nOut of memory.\n", "\nOut of memory.\n",
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -315,9 +315,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)" "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter(s).\n", "\nInvalid parameter(s).\n",
Ptr, Ptr,
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -328,9 +328,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)" "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nInvalid parameter.\n", "\nInvalid parameter.\n",
Ptr, Ptr,
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -349,9 +349,9 @@ MyRealloc (
"\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)" "\nMyRealloc(Ptr=%p, Size=%u, File=%s, Line=%u)"
"\nCould not find buffer.\n", "\nCould not find buffer.\n",
Ptr, Ptr,
(UINT32)Size, (unsigned)Size,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -421,7 +421,7 @@ MyFree (
"\nInvalid parameter(s).\n", "\nInvalid parameter(s).\n",
Ptr, Ptr,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -433,7 +433,7 @@ MyFree (
"\nInvalid parameter.\n", "\nInvalid parameter.\n",
Ptr, Ptr,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -453,7 +453,7 @@ MyFree (
"\nCalled before memory allocated.\n", "\nCalled before memory allocated.\n",
Ptr, Ptr,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);
@ -486,7 +486,7 @@ MyFree (
"\nNot found.\n", "\nNot found.\n",
Ptr, Ptr,
File, File,
(UINT32)Line (unsigned)Line
); );
exit (1); exit (1);

View File

@ -122,6 +122,7 @@ Returns:
GUID_SEC_TOOL_ENTRY *NewGuidTool; GUID_SEC_TOOL_ENTRY *NewGuidTool;
FirstGuidTool = NULL; FirstGuidTool = NULL;
LastGuidTool = NULL;
while (TRUE) { while (TRUE) {
NextLine = ReadMemoryFileLine (InputFile); NextLine = ReadMemoryFileLine (InputFile);

View File

@ -379,10 +379,10 @@ Returns:
--*/ --*/
{ {
INT32 Index; INT32 Index;
UINT32 Data1; unsigned Data1;
UINT32 Data2; unsigned Data2;
UINT32 Data3; unsigned Data3;
UINT16 Data4[8]; unsigned Data4[8];
if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) { if (AsciiGuidBuffer == NULL || GuidBuffer == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
@ -416,7 +416,7 @@ Returns:
// //
Index = sscanf ( Index = sscanf (
AsciiGuidBuffer, AsciiGuidBuffer,
"%08x-%04x-%04x-%02hx%02hx-%02hx%02hx%02hx%02hx%02hx%02hx", "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
&Data1, &Data1,
&Data2, &Data2,
&Data3, &Data3,

View File

@ -536,7 +536,7 @@ Returns:
--*/ --*/
{ {
UINT32 Val; unsigned Val;
SkipWhiteSpace (&mGlobals.SourceFile); SkipWhiteSpace (&mGlobals.SourceFile);
if (EndOfFile (&mGlobals.SourceFile)) { if (EndOfFile (&mGlobals.SourceFile)) {
@ -554,7 +554,7 @@ Returns:
mGlobals.SourceFile.FileBufferPtr += 2; mGlobals.SourceFile.FileBufferPtr += 2;
sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val); sscanf (mGlobals.SourceFile.FileBufferPtr, "%x", &Val);
*Value = Val; *Value = (UINT32) Val;
while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) { while (isxdigit (mGlobals.SourceFile.FileBufferPtr[0])) {
mGlobals.SourceFile.FileBufferPtr++; mGlobals.SourceFile.FileBufferPtr++;
} }
@ -634,7 +634,7 @@ Returns:
// depth. // depth.
// //
if (mGlobals.VerboseFile) { if (mGlobals.VerboseFile) {
fprintf (stdout, "%*cProcessing file '%s'\n", (INT32)NestDepth * 2, ' ', SourceFile->FileName); fprintf (stdout, "%*cProcessing file '%s'\n", (int)NestDepth * 2, ' ', SourceFile->FileName);
fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName); fprintf (stdout, "Parent source file = '%s'\n", ParentSourceFile->FileName);
} }
@ -642,7 +642,7 @@ Returns:
// Make sure we didn't exceed our maximum nesting depth // Make sure we didn't exceed our maximum nesting depth
// //
if (NestDepth > MAX_NEST_DEPTH) { if (NestDepth > MAX_NEST_DEPTH) {
Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%d)", SourceFile->FileName, NestDepth); Error (NULL, 0, 3001, "Not Supported", "%s exceeeds max nesting depth (%u)", SourceFile->FileName, (unsigned) NestDepth);
Status = STATUS_ERROR; Status = STATUS_ERROR;
goto Finish; goto Finish;
} }
@ -698,7 +698,7 @@ Returns:
fseek (SourceFile->Fptr, 0, SEEK_END); fseek (SourceFile->Fptr, 0, SEEK_END);
SourceFile->FileSize = ftell (SourceFile->Fptr); SourceFile->FileSize = ftell (SourceFile->Fptr);
if (mGlobals.VerboseFile) { if (mGlobals.VerboseFile) {
printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize); printf ("FileSize = %u (0x%X)\n", (unsigned) SourceFile->FileSize, (unsigned) SourceFile->FileSize);
} }
fseek (SourceFile->Fptr, 0, SEEK_SET); fseek (SourceFile->Fptr, 0, SEEK_SET);
@ -819,7 +819,7 @@ Returns:
} }
printf ("'\n"); printf ("'\n");
printf ("FileSize = %d (0x%X)\n", (INT32)SourceFile->FileSize, (UINT32)SourceFile->FileSize); printf ("FileSize = %u (0x%X)\n", (unsigned)SourceFile->FileSize, (unsigned)SourceFile->FileSize);
RewindFile (SourceFile); RewindFile (SourceFile);
} }
} }
@ -1282,7 +1282,7 @@ Returns:
--*/ --*/
{ {
UINT32 Value32; unsigned Value32;
UINT32 Index; UINT32 Index;
FILE_POSITION FPos; FILE_POSITION FPos;
CHAR8 TempString[20]; CHAR8 TempString[20];

View File

@ -131,7 +131,7 @@ Return:
UINT64 : file size of input file UINT64 : file size of input file
--*/ --*/
{ {
UINT64 filesize, offset, length; UINT32 filesize, offset, length;
CHAR8 Buffer[8*1024]; CHAR8 Buffer[8*1024];
fseek (in, 0, SEEK_END); fseek (in, 0, SEEK_END);
@ -252,7 +252,7 @@ Returns:
continue; continue;
} }
// //
// Don't recognize the paramter, should be regarded as the input file name. // Don't recognize the parameter, should be regarded as the input file name.
// //
InputFileNames[InputFileCount] = argv[0]; InputFileNames[InputFileCount] = argv[0];
InputFileCount++; InputFileCount++;
@ -309,9 +309,9 @@ Returns:
// And in the same time update the EfiLdrHeader and EfiLdrImage array // And in the same time update the EfiLdrHeader and EfiLdrImage array
// //
EfiLdrImage[i].Offset = EfiLdrHeader.FileLength; EfiLdrImage[i].Offset = EfiLdrHeader.FileLength;
EfiLdrImage[i].Length = filesize; EfiLdrImage[i].Length = (UINT32) filesize;
strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1); strncpy ((CHAR8*) EfiLdrImage[i].FileName, InputFileNames[i], sizeof (EfiLdrImage[i].FileName) - 1);
EfiLdrHeader.FileLength += filesize; EfiLdrHeader.FileLength += (UINT32) filesize;
EfiLdrHeader.NumberOfImages++; EfiLdrHeader.NumberOfImages++;
} }

View File

@ -88,8 +88,8 @@ Returns:
// If dumping an image, then do that and quit // If dumping an image, then do that and quit
// //
if (mOptions.DumpOption == 1) { if (mOptions.DumpOption == 1) {
for (FList = mOptions.FileList; FList != NULL; FList = FList->Next) { if (mOptions.FileList != NULL) {
if ((Ptr0 = strstr ((CONST CHAR8 *)FList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) { if ((Ptr0 = strstr ((CONST CHAR8 *) mOptions.FileList->FileName, DEFAULT_OUTPUT_EXTENSION)) != NULL) {
DumpImage (mOptions.FileList); DumpImage (mOptions.FileList);
goto BailOut; goto BailOut;
} else { } else {
@ -163,7 +163,7 @@ Returns:
} }
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" Output size = 0x%X\n", Size); VerboseMsg(" Output size = 0x%X\n", (unsigned) Size);
} }
if (Status != STATUS_SUCCESS) { if (Status != STATUS_SUCCESS) {
@ -238,7 +238,8 @@ Returns:
UINT32 Index; UINT32 Index;
UINT8 ByteCheckSum; UINT8 ByteCheckSum;
PciDs23 = NULL;
PciDs30 = NULL;
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
// //
@ -255,7 +256,7 @@ Returns:
fseek (InFptr, 0, SEEK_END); fseek (InFptr, 0, SEEK_END);
FileSize = ftell (InFptr); FileSize = ftell (InFptr);
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" File size = 0x%X\n", FileSize); VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
} }
fseek (InFptr, 0, SEEK_SET); fseek (InFptr, 0, SEEK_SET);
@ -365,7 +366,7 @@ Returns:
Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1); Buffer[FileSize - 1] = (UINT8) ((~ByteCheckSum) + 1);
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" Checksum = %02x\n\n", (UINT32) Buffer[FileSize - 1]); VerboseMsg(" Checksum = %02x\n\n", Buffer[FileSize - 1]);
} }
// //
@ -495,7 +496,7 @@ Returns:
} }
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" File size = 0x%X\n", FileSize); VerboseMsg(" File size = 0x%X\n", (unsigned) FileSize);
} }
// //
// Allocate memory for the entire file (in case we have to compress), then // Allocate memory for the entire file (in case we have to compress), then
@ -540,7 +541,7 @@ Returns:
// Now compute the size, then swap buffer pointers. // Now compute the size, then swap buffer pointers.
// //
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" Comp size = 0x%X\n", CompressedFileSize); VerboseMsg(" Comp size = 0x%X\n", (unsigned) CompressedFileSize);
} }
TotalSize = CompressedFileSize + HeaderSize; TotalSize = CompressedFileSize + HeaderSize;
@ -820,7 +821,7 @@ Returns:
} }
if (mOptions.Verbose) { if (mOptions.Verbose) {
VerboseMsg(" Got subsystem = 0x%X from image\n", (int) *SubSystem); VerboseMsg(" Got subsystem = 0x%X from image\n", *SubSystem);
} }
// //
@ -999,7 +1000,7 @@ Returns:
return 1; return 1;
} }
if (DebugLevel > 9) { if (DebugLevel > 9) {
Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", Argv[1]); Error (NULL, 0, 2000, "Invalid option value", "Debug Level range is 0-9, current input level is %d", Argv[1]);
return 1; return 1;
} }
if (DebugLevel>=5 && DebugLevel<=9) { if (DebugLevel>=5 && DebugLevel<=9) {
@ -1301,10 +1302,10 @@ Returns:
// //
// Dump the contents of the header // Dump the contents of the header
// //
fprintf (stdout, "Image %d -- Offset 0x%X\n", ImageCount, ImageStart); fprintf (stdout, "Image %u -- Offset 0x%X\n", (unsigned) ImageCount, (unsigned) ImageStart);
fprintf (stdout, " ROM header contents\n"); fprintf (stdout, " ROM header contents\n");
fprintf (stdout, " Signature 0x%04X\n", (UINT32) PciRomHdr.Signature); fprintf (stdout, " Signature 0x%04X\n", PciRomHdr.Signature);
fprintf (stdout, " PCIR offset 0x%04X\n", (UINT32) PciRomHdr.PcirOffset); fprintf (stdout, " PCIR offset 0x%04X\n", PciRomHdr.PcirOffset);
// //
// Find PCI data structure // Find PCI data structure
// //
@ -1349,11 +1350,11 @@ Returns:
fprintf ( fprintf (
stdout, stdout,
" Class Code 0x%06X\n", " Class Code 0x%06X\n",
(UINT32) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16)) (unsigned) (PciDs23.ClassCode[0] | (PciDs23.ClassCode[1] << 8) | (PciDs23.ClassCode[2] << 16))
); );
fprintf (stdout, " Image size 0x%X\n", PciDs23.ImageLength * 512); fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs23.ImageLength * 512);
fprintf (stdout, " Code revision: 0x%04X\n", PciDs23.CodeRevision); fprintf (stdout, " Code revision: 0x%04X\n", PciDs23.CodeRevision);
fprintf (stdout, " Indicator 0x%02X", (UINT32) PciDs23.Indicator); fprintf (stdout, " Indicator 0x%02X", PciDs23.Indicator);
} else { } else {
fprintf ( fprintf (
stdout, stdout,
@ -1367,18 +1368,18 @@ Returns:
fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId); fprintf (stdout, " Device ID 0x%04X\n", PciDs30.DeviceId);
fprintf (stdout, " Length 0x%04X\n", PciDs30.Length); fprintf (stdout, " Length 0x%04X\n", PciDs30.Length);
fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision); fprintf (stdout, " Revision 0x%04X\n", PciDs30.Revision);
fprintf (stdout, " DeviceListOffset 0x%02X\n", (UINT32) PciDs30.DeviceListOffset); fprintf (stdout, " DeviceListOffset 0x%02X\n", PciDs30.DeviceListOffset);
fprintf ( fprintf (
stdout, stdout,
" Class Code 0x%06X\n", " Class Code 0x%06X\n",
(UINT32) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16)) (unsigned) (PciDs30.ClassCode[0] | (PciDs30.ClassCode[1] << 8) | (PciDs30.ClassCode[2] << 16))
); );
fprintf (stdout, " Image size 0x%X\n", PciDs30.ImageLength * 512); fprintf (stdout, " Image size 0x%X\n", (unsigned) PciDs30.ImageLength * 512);
fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision); fprintf (stdout, " Code revision: 0x%04X\n", PciDs30.CodeRevision);
fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", (UINT32) PciDs30.MaxRuntimeImageLength); fprintf (stdout, " MaxRuntimeImageLength 0x%02X\n", PciDs30.MaxRuntimeImageLength);
fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", (UINT32) PciDs30.ConfigUtilityCodeHeaderOffset); fprintf (stdout, " ConfigUtilityCodeHeaderOffset 0x%02X\n", PciDs30.ConfigUtilityCodeHeaderOffset);
fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", (UINT32) PciDs30.DMTFCLPEntryPointOffset); fprintf (stdout, " DMTFCLPEntryPointOffset 0x%02X\n", PciDs30.DMTFCLPEntryPointOffset);
fprintf (stdout, " Indicator 0x%02X", (UINT32) PciDs30.Indicator); fprintf (stdout, " Indicator 0x%02X", PciDs30.Indicator);
} }
// //
// Print the indicator, used to flag the last image // Print the indicator, used to flag the last image
@ -1392,9 +1393,9 @@ Returns:
// Print the code type. If EFI code, then we can provide more info. // Print the code type. If EFI code, then we can provide more info.
// //
if (mOptions.Pci23 == 1) { if (mOptions.Pci23 == 1) {
fprintf (stdout, " Code type 0x%02X", (UINT32) PciDs23.CodeType); fprintf (stdout, " Code type 0x%02X", PciDs23.CodeType);
} else { } else {
fprintf (stdout, " Code type 0x%02X", (UINT32) PciDs30.CodeType); fprintf (stdout, " Code type 0x%02X", PciDs30.CodeType);
} }
if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) { if (PciDs23.CodeType == PCI_CODE_TYPE_EFI_IMAGE || PciDs30.CodeType == PCI_CODE_TYPE_EFI_IMAGE) {
fprintf (stdout, " (EFI image)\n"); fprintf (stdout, " (EFI image)\n");
@ -1414,11 +1415,11 @@ Returns:
// //
// Now dump more info // Now dump more info
// //
fprintf (stdout, " EFI Signature 0x%04X\n", EfiRomHdr.EfiSignature); fprintf (stdout, " EFI Signature 0x%04X\n", (unsigned) EfiRomHdr.EfiSignature);
fprintf ( fprintf (
stdout, stdout,
" Compression Type 0x%04X ", " Compression Type 0x%04X ",
(UINT32) EfiRomHdr.CompressionType EfiRomHdr.CompressionType
); );
if (EfiRomHdr.CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) { if (EfiRomHdr.CompressionType == EFI_PCI_EXPANSION_ROM_HEADER_COMPRESSED) {
fprintf (stdout, "(compressed)\n"); fprintf (stdout, "(compressed)\n");
@ -1441,8 +1442,8 @@ Returns:
fprintf ( fprintf (
stdout, stdout,
" EFI image offset 0x%04X (@0x%X)\n", " EFI image offset 0x%04X (@0x%X)\n",
(UINT32) EfiRomHdr.EfiImageHeaderOffset, EfiRomHdr.EfiImageHeaderOffset,
(UINT32) (EfiRomHdr.EfiImageHeaderOffset + ImageStart) EfiRomHdr.EfiImageHeaderOffset + (unsigned) ImageStart
); );
} else { } else {

View File

@ -26,6 +26,9 @@ Abstract:
#include <string.h> #include <string.h>
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>
#include "ParseInf.h"
#include "EfiUtilityMsgs.h"
// //
// Utility Name // Utility Name
// //
@ -259,9 +262,9 @@ Routine Description:
} else { } else {
fprintf ( fprintf (
stdout, stdout,
"%c: - DiskNum: %d, Type: %s\n", "%c: - DiskNum: %u, Type: %s\n",
DriveInfo.VolumeLetter, DriveInfo.VolumeLetter,
DriveInfo.DiskNumber, (unsigned) DriveInfo.DiskNumber,
DriveInfo.DriveType->Description DriveInfo.DriveType->Description
); );
} }
@ -438,11 +441,9 @@ ProcessBsOrMbr (
BYTE DiskPartition[0x200] = {0}; BYTE DiskPartition[0x200] = {0};
BYTE DiskPartitionBackup[0x200] = {0}; BYTE DiskPartitionBackup[0x200] = {0};
DWORD BytesReturn; DWORD BytesReturn;
DWORD DbrOffset;
INT DrvNumOffset; INT DrvNumOffset;
HANDLE InputHandle; HANDLE InputHandle;
HANDLE OutputHandle; HANDLE OutputHandle;
BOOL WriteToDisk;
ERROR_STATUS Status; ERROR_STATUS Status;
DWORD InputDbrOffset; DWORD InputDbrOffset;
DWORD OutputDbrOffset; DWORD OutputDbrOffset;
@ -731,7 +732,7 @@ main (
return 1; return 1;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
return 1; return 1;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);

View File

@ -22,6 +22,7 @@ Abstract:
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "ParseInf.h"
#include "EfiUtilityMsgs.h" #include "EfiUtilityMsgs.h"
#include "CommonLib.h" #include "CommonLib.h"
#include "Crc32.h" #include "Crc32.h"
@ -104,7 +105,7 @@ Returns:
int int
main ( main (
INT32 argc, int argc,
CHAR8 *argv[] CHAR8 *argv[]
) )
/*++ /*++
@ -222,7 +223,7 @@ Returns:
goto Finish; goto Finish;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
goto Finish; goto Finish;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);
@ -294,7 +295,7 @@ Returns:
fread (FileBuffer, 1, FileSize, InFile); fread (FileBuffer, 1, FileSize, InFile);
fclose (InFile); fclose (InFile);
VerboseMsg ("the size of the input file is %d bytes", FileSize); VerboseMsg ("the size of the input file is %u bytes", (unsigned) FileSize);
// //
// Open output file // Open output file
@ -318,9 +319,9 @@ Returns:
// Done, write output file. // Done, write output file.
// //
fwrite (&Crc32Value, 1, sizeof (Crc32Value), OutFile); fwrite (&Crc32Value, 1, sizeof (Crc32Value), OutFile);
VerboseMsg ("The calculated CRC32 value is 0x%08x", Crc32Value); VerboseMsg ("The calculated CRC32 value is 0x%08x", (unsigned) Crc32Value);
fwrite (FileBuffer, 1, FileSize, OutFile); fwrite (FileBuffer, 1, FileSize, OutFile);
VerboseMsg ("the size of the encoded file is %d bytes", FileSize + sizeof (UINT32)); VerboseMsg ("the size of the encoded file is %u bytes", (unsigned) FileSize + sizeof (UINT32));
} else { } else {
// //
// Verify Crc32 Value // Verify Crc32 Value
@ -330,7 +331,7 @@ Returns:
Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!"); Error (NULL, 0, 3000, "Invalid", "Calculate CRC32 value failed!");
goto Finish; goto Finish;
} }
VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", Crc32Value, *(UINT32 *)FileBuffer); VerboseMsg ("The calculated CRC32 value is 0x%08x and File Crc32 value is 0x%08x", (unsigned) Crc32Value, (unsigned) (*(UINT32 *)FileBuffer));
if (Crc32Value != *(UINT32 *)FileBuffer) { if (Crc32Value != *(UINT32 *)FileBuffer) {
Error (NULL, 0, 3000, "Invalid", "CRC32 value of input file is not correct!"); Error (NULL, 0, 3000, "Invalid", "CRC32 value of input file is not correct!");
Status = STATUS_ERROR; Status = STATUS_ERROR;
@ -340,7 +341,7 @@ Returns:
// Done, write output file. // Done, write output file.
// //
fwrite (FileBuffer + sizeof (UINT32), 1, FileSize - sizeof (UINT32), OutFile); fwrite (FileBuffer + sizeof (UINT32), 1, FileSize - sizeof (UINT32), OutFile);
VerboseMsg ("the size of the decoded file is %d bytes", FileSize - sizeof (UINT32)); VerboseMsg ("the size of the decoded file is %u bytes", (unsigned) FileSize - sizeof (UINT32));
} }
Finish: Finish:

View File

@ -322,7 +322,7 @@ Returns:
FileSize = ftell (InFile); FileSize = ftell (InFile);
fseek (InFile, 0, SEEK_SET); fseek (InFile, 0, SEEK_SET);
DebugMsg (NULL, 0, 9, "Input section files", DebugMsg (NULL, 0, 9, "Input section files",
"the input section name is %s and the size is %d bytes", InputFileName[Index], FileSize); "the input section name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
// //
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section. // Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
@ -374,7 +374,7 @@ Returns:
SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16); SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
} }
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment",
"Pad Raw section size is %d", Offset); "Pad Raw section size is %u", (unsigned) Offset);
Size = Size + Offset; Size = Size + Offset;
} }
@ -409,7 +409,7 @@ Returns:
int int
main ( main (
INT32 argc, int argc,
CHAR8 *argv[] CHAR8 *argv[]
) )
/*++ /*++
@ -679,7 +679,7 @@ Returns:
goto Finish; goto Finish;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
goto Finish; goto Finish;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);
@ -719,7 +719,7 @@ Returns:
VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]); VerboseMsg ("Fv File type is %s", mFfsFileType [FfsFiletype]);
VerboseMsg ("Output file name is %s", OutputFileName); VerboseMsg ("Output file name is %s", OutputFileName);
VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", VerboseMsg ("FFS File Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
FileGuid.Data1, (unsigned) FileGuid.Data1,
FileGuid.Data2, FileGuid.Data2,
FileGuid.Data3, FileGuid.Data3,
FileGuid.Data4[0], FileGuid.Data4[0],
@ -744,7 +744,7 @@ Returns:
// //
InputFileAlign[Index] = 1; InputFileAlign[Index] = 1;
} }
VerboseMsg ("the %dth input section name is %s and section alignment is %d", Index, InputFileName[Index], InputFileAlign[Index]); VerboseMsg ("the %dth input section name is %s and section alignment is %u", Index, InputFileName[Index], (unsigned) InputFileAlign[Index]);
} }
// //
@ -763,7 +763,7 @@ Returns:
if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE || if ((FfsFiletype == EFI_FV_FILETYPE_SECURITY_CORE ||
FfsFiletype == EFI_FV_FILETYPE_PEI_CORE || FfsFiletype == EFI_FV_FILETYPE_PEI_CORE ||
FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) { FfsFiletype == EFI_FV_FILETYPE_DXE_CORE) && (PeSectionNum != 1)) {
Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %d Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum); Error (NULL, 0, 2000, "Invalid parameter", "Fv File type %s must have one and only one Pe or Te section, but %u Pe/Te section are input", mFfsFileType [FfsFiletype], PeSectionNum);
goto Finish; goto Finish;
} }
@ -810,7 +810,7 @@ Returns:
// //
// Update FFS Alignment based on the max alignment required by input section files // Update FFS Alignment based on the max alignment required by input section files
// //
VerboseMsg ("the max alignment of all input sections is %d", MaxAlignment); VerboseMsg ("the max alignment of all input sections is %u", (unsigned) MaxAlignment);
for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) { for (Index = 0; Index < sizeof (mFfsValidAlign) / sizeof (UINT32) - 1; Index ++) {
if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) { if ((MaxAlignment > mFfsValidAlign [Index]) && (MaxAlignment <= mFfsValidAlign [Index + 1])) {
break; break;
@ -819,14 +819,14 @@ Returns:
if (FfsAlign < Index) { if (FfsAlign < Index) {
FfsAlign = Index; FfsAlign = Index;
} }
VerboseMsg ("the alignment of the genreated FFS file is %d", mFfsValidAlign [FfsAlign + 1]); VerboseMsg ("the alignment of the generated FFS file is %u", (unsigned) mFfsValidAlign [FfsAlign + 1]);
FfsFileHeader.Attributes = FfsAttrib | (FfsAlign << 3); FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3));
// //
// Now FileSize includes the EFI_FFS_FILE_HEADER // Now FileSize includes the EFI_FFS_FILE_HEADER
// //
FileSize += sizeof (EFI_FFS_FILE_HEADER); FileSize += sizeof (EFI_FFS_FILE_HEADER);
VerboseMsg ("the size of the genreated FFS file is %d bytes", FileSize); VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize);
FfsFileHeader.Size[0] = (UINT8) (FileSize & 0xFF); FfsFileHeader.Size[0] = (UINT8) (FileSize & 0xFF);
FfsFileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8); FfsFileHeader.Size[1] = (UINT8) ((FileSize & 0xFF00) >> 8);
FfsFileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16); FfsFileHeader.Size[2] = (UINT8) ((FileSize & 0xFF0000) >> 16);

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -141,7 +141,7 @@ Returns:
fprintf (stdout, " --FvNameGuid GuidValue is the Fv Name Guid value.\n\ fprintf (stdout, " --FvNameGuid GuidValue is the Fv Name Guid value.\n\
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n"); Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");
fprintf (stdout, " --capflag CapFlag Capsule Reset Flag can be PersistAcrossReset,\n\ fprintf (stdout, " --capflag CapFlag Capsule Reset Flag can be PersistAcrossReset,\n\
or PopulateSystemTable or not set.\n"); or PopulateSystemTable or InitiateReset or not set\n");
fprintf (stdout, " --capheadsize HeadSize\n\ fprintf (stdout, " --capheadsize HeadSize\n\
HeadSize is one HEX or DEC format value\n\ HeadSize is one HEX or DEC format value\n\
HeadSize is required by Capsule Image.\n"); HeadSize is required by Capsule Image.\n");
@ -218,6 +218,7 @@ Returns:
Index = 0; Index = 0;
mFvTotalSize = 0; mFvTotalSize = 0;
mFvTakenSize = 0; mFvTakenSize = 0;
Status = EFI_SUCCESS;
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
@ -312,7 +313,7 @@ Returns:
return STATUS_ERROR; return STATUS_ERROR;
} }
mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber; mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;
DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%x", EFI_BLOCK_SIZE_STRING, TempNumber); DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);
argc -= 2; argc -= 2;
argv += 2; argv += 2;
continue; continue;
@ -329,7 +330,7 @@ Returns:
return STATUS_ERROR; return STATUS_ERROR;
} }
mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber; mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;
DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%x", EFI_NUM_BLOCKS_STRING, TempNumber); DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);
argc -= 2; argc -= 2;
argv += 2; argv += 2;
continue; continue;
@ -341,7 +342,7 @@ Returns:
return STATUS_ERROR; return STATUS_ERROR;
} }
strcpy (mFvDataInfo.FvFiles[Index], argv[1]); strcpy (mFvDataInfo.FvFiles[Index], argv[1]);
DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index + 1, argv[1]); DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index + 1, argv[1]);
argc -= 2; argc -= 2;
argv += 2; argv += 2;
@ -356,8 +357,8 @@ Returns:
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]); Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
return STATUS_ERROR; return STATUS_ERROR;
} }
mFvDataInfo.SizeofFvFiles[Index] = TempNumber; mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;
DebugMsg (NULL, 0, 9, "FV component file size", "the %dth size is %s", Index + 1, argv[1]); DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);
argc -= 2; argc -= 2;
argv += 2; argv += 2;
} }
@ -388,7 +389,7 @@ Returns:
return STATUS_ERROR; return STATUS_ERROR;
} }
mCapDataInfo.HeaderSize = (UINT32) TempNumber; mCapDataInfo.HeaderSize = (UINT32) TempNumber;
DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%x", EFI_CAPSULE_HEADER_SIZE_STRING, TempNumber); DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);
argc -= 2; argc -= 2;
argv += 2; argv += 2;
continue; continue;
@ -406,6 +407,8 @@ Returns:
mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE; mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
} else if (strcmp (argv[1], "PersistAcrossReset") == 0) { } else if (strcmp (argv[1], "PersistAcrossReset") == 0) {
mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET; mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
} else if (strcmp (argv[1], "InitiateReset") == 0) {
mCapDataInfo.Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_INITIATE_RESET;
} else { } else {
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]); Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
return STATUS_ERROR; return STATUS_ERROR;
@ -506,7 +509,7 @@ Returns:
return STATUS_ERROR; return STATUS_ERROR;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, current input level is %d", (int) LogLevel);
return STATUS_ERROR; return STATUS_ERROR;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);
@ -625,20 +628,20 @@ Returns:
} }
fprintf (FpFile, "Capsule %s Image Header Information\n", InfFileName); fprintf (FpFile, "Capsule %s Image Header Information\n", InfFileName);
fprintf (FpFile, " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n", fprintf (FpFile, " GUID %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\n",
CapsuleHeader->CapsuleGuid.Data1, (unsigned) CapsuleHeader->CapsuleGuid.Data1,
(UINT32) CapsuleHeader->CapsuleGuid.Data2, (unsigned) CapsuleHeader->CapsuleGuid.Data2,
(UINT32) CapsuleHeader->CapsuleGuid.Data3, (unsigned) CapsuleHeader->CapsuleGuid.Data3,
(UINT32) CapsuleHeader->CapsuleGuid.Data4[0], (unsigned) CapsuleHeader->CapsuleGuid.Data4[0],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[1], (unsigned) CapsuleHeader->CapsuleGuid.Data4[1],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[2], (unsigned) CapsuleHeader->CapsuleGuid.Data4[2],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[3], (unsigned) CapsuleHeader->CapsuleGuid.Data4[3],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[4], (unsigned) CapsuleHeader->CapsuleGuid.Data4[4],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[5], (unsigned) CapsuleHeader->CapsuleGuid.Data4[5],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[6], (unsigned) CapsuleHeader->CapsuleGuid.Data4[6],
(UINT32) CapsuleHeader->CapsuleGuid.Data4[7]); (unsigned) CapsuleHeader->CapsuleGuid.Data4[7]);
fprintf (FpFile, " Header size 0x%08X\n", CapsuleHeader->HeaderSize); fprintf (FpFile, " Header size 0x%08X\n", (unsigned) CapsuleHeader->HeaderSize);
fprintf (FpFile, " Flags 0x%08X\n", CapsuleHeader->Flags); fprintf (FpFile, " Flags 0x%08X\n", (unsigned) CapsuleHeader->Flags);
fprintf (FpFile, " Capsule image size 0x%08X\n", CapsuleHeader->CapsuleImageSize); fprintf (FpFile, " Capsule image size 0x%08X\n", (unsigned) CapsuleHeader->CapsuleImageSize);
fclose (FpFile); fclose (FpFile);
} else if (CapsuleFlag) { } else if (CapsuleFlag) {
VerboseMsg ("Create capsule image"); VerboseMsg ("Create capsule image");
@ -657,7 +660,7 @@ Returns:
} else { } else {
VerboseMsg ("Create Fv image and its map file"); VerboseMsg ("Create Fv image and its map file");
if (mFvDataInfo.BaseAddress != 0) { if (mFvDataInfo.BaseAddress != 0) {
VerboseMsg ("FvImage Rebase Address is 0x%X", mFvDataInfo.BaseAddress); VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
} }
// //
// Call the GenerateFvImage to generate Fv Image // Call the GenerateFvImage to generate Fv Image
@ -690,21 +693,29 @@ Returns:
fprintf (FpFile, "\n"); fprintf (FpFile, "\n");
if (mFvDataInfo.BootBaseAddress != 0) { if (mFvDataInfo.BootBaseAddress != 0) {
fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING); fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);
fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.BootBaseAddress); fprintf (
DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.BootBaseAddress); FpFile,
" = 0x%llx\n",
(unsigned long long)mFvDataInfo.BootBaseAddress
);
DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.BootBaseAddress);
} }
if (mFvDataInfo.RuntimeBaseAddress != 0) { if (mFvDataInfo.RuntimeBaseAddress != 0) {
fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING); fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);
fprintf (FpFile, " = 0x%lx\n", mFvDataInfo.RuntimeBaseAddress); fprintf (
DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%x", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, mFvDataInfo.RuntimeBaseAddress); FpFile,
" = 0x%llx\n",
(unsigned long long)mFvDataInfo.RuntimeBaseAddress
);
DebugMsg (NULL, 0, 9, "Updated runtime driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.RuntimeBaseAddress);
} }
fclose (FpFile); fclose (FpFile);
} }
if (Status == EFI_SUCCESS) { if (Status == EFI_SUCCESS) {
DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, mFvTotalSize); DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, mFvTakenSize); DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, mFvTotalSize - mFvTakenSize); DebugMsg (NULL, 0, 9, "The space Fv size", "%s = 0x%x", EFI_FV_SPACE_SIZE_STRING, (unsigned) (mFvTotalSize - mFvTakenSize));
} }
VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ()); VerboseMsg ("%s tool done with return code is 0x%x.", UTILITY_NAME, GetUtilityStatus ());

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -184,7 +184,8 @@ Returns:
{ {
CHAR8 Value[_MAX_PATH]; CHAR8 Value[_MAX_PATH];
UINT64 Value64; UINT64 Value64;
UINTN Index, Number, Index1; UINTN Index;
UINTN Number;
EFI_STATUS Status; EFI_STATUS Status;
EFI_GUID GuidValue; EFI_GUID GuidValue;
@ -371,7 +372,7 @@ Returns:
// Add the file // Add the file
// //
strcpy (FvInfo->FvFiles[Number + Index], Value); strcpy (FvInfo->FvFiles[Number + Index], Value);
DebugMsg (NULL, 0, 9, "FV component file", "the %dth name is %s", Index, Value); DebugMsg (NULL, 0, 9, "FV component file", "the %uth name is %s", (unsigned) Index, Value);
} else { } else {
break; break;
} }
@ -514,6 +515,7 @@ EFI_STATUS
AddPadFile ( AddPadFile (
IN OUT MEMORY_FILE *FvImage, IN OUT MEMORY_FILE *FvImage,
IN UINT32 DataAlignment, IN UINT32 DataAlignment,
IN VOID *FvEnd,
IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader IN EFI_FIRMWARE_VOLUME_EXT_HEADER *ExtHeader
) )
/*++ /*++
@ -525,9 +527,10 @@ Routine Description:
Arguments: Arguments:
FvImage The memory image of the FV to add it to. The current offset FvImage The memory image of the FV to add it to.
must be valid. The current offset must be valid.
DataAlignment The data alignment of the next FFS file. DataAlignment The data alignment of the next FFS file.
FvEnd End of the empty data in FvImage.
ExtHeader PI FvExtHeader Optional ExtHeader PI FvExtHeader Optional
Returns: Returns:
@ -556,30 +559,6 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
//
// Write pad file header
//
PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
//
// Verify that we have enough space for the file header
//
if (ExtHeader != NULL) {
if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER) + ExtHeader->ExtHeaderSize) >= (UINTN) FvImage->Eof) {
return EFI_OUT_OF_RESOURCES;
}
} else {
if ((UINTN) (PadFile + sizeof (EFI_FFS_FILE_HEADER)) >= (UINTN) FvImage->Eof) {
return EFI_OUT_OF_RESOURCES;
}
}
//
// write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
//
PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
PadFile->Attributes = 0;
// //
// Calculate the pad file size // Calculate the pad file size
// //
@ -587,11 +566,7 @@ Returns:
// This is the earliest possible valid offset (current plus pad file header // This is the earliest possible valid offset (current plus pad file header
// plus the next file header) // plus the next file header)
// //
if (ExtHeader != NULL) {
PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2) + ExtHeader->ExtHeaderSize;
} else {
PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2); PadFileSize = (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage + (sizeof (EFI_FFS_FILE_HEADER) * 2);
}
// //
// Add whatever it takes to get to the next aligned address // Add whatever it takes to get to the next aligned address
@ -609,6 +584,31 @@ Returns:
// //
PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage; PadFileSize -= (UINTN) FvImage->CurrentFilePointer - (UINTN) FvImage->FileImage;
//
// Append extension header size
//
if (ExtHeader != NULL) {
PadFileSize = PadFileSize + ExtHeader->ExtHeaderSize;
}
//
// Verify that we have enough space for the file header
//
if (((UINTN) FvImage->CurrentFilePointer + PadFileSize) > (UINTN) FvEnd) {
return EFI_OUT_OF_RESOURCES;
}
//
// Write pad file header
//
PadFile = (EFI_FFS_FILE_HEADER *) FvImage->CurrentFilePointer;
//
// Write PadFile FFS header with PadType, don't need to set PAD file guid in its header.
//
PadFile->Type = EFI_FV_FILETYPE_FFS_PAD;
PadFile->Attributes = 0;
// //
// Write pad file size (calculated size minus next file header size) // Write pad file size (calculated size minus next file header size)
// //
@ -631,24 +631,24 @@ Returns:
(EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage (EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage
); );
//
// Update the current FV pointer
//
FvImage->CurrentFilePointer += PadFileSize;
if (ExtHeader != NULL) { if (ExtHeader != NULL) {
// //
// Copy Fv Extension Header and Set Fv Extension header offset // Copy Fv Extension Header and Set Fv Extension header offset
// //
memcpy (PadFile + 1, ExtHeader, ExtHeader->ExtHeaderSize); memcpy (PadFile + 1, ExtHeader, ExtHeader->ExtHeaderSize);
((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) (PadFile + 1) - (UINTN) FvImage->FileImage); ((EFI_FIRMWARE_VOLUME_HEADER *) FvImage->FileImage)->ExtHeaderOffset = (UINT16) ((UINTN) (PadFile + 1) - (UINTN) FvImage->FileImage);
//
// Make next file start at QWord Boundry
//
while (((UINTN) FvImage->CurrentFilePointer & (EFI_FFS_FILE_HEADER_ALIGNMENT - 1)) != 0) {
FvImage->CurrentFilePointer++;
} }
//
// Verify that we have enough space (including the padding)
//
if (((UINTN)PadFile + PadFileSize) >= (UINTN) FvImage->Eof) {
return EFI_OUT_OF_RESOURCES;
} }
//
// Update the current FV pointer
//
FvImage->CurrentFilePointer += PadFileSize;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -726,7 +726,7 @@ Returns:
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr; EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
EFI_TE_IMAGE_HEADER *TEImageHeader; EFI_TE_IMAGE_HEADER *TEImageHeader;
EFI_IMAGE_SECTION_HEADER *SectionHeader; EFI_IMAGE_SECTION_HEADER *SectionHeader;
unsigned long long TempLongAddress;
// //
// Init local variable // Init local variable
// //
@ -806,20 +806,20 @@ Returns:
// //
if (ImageBaseAddress == 0) { if (ImageBaseAddress == 0) {
fprintf (FvMapFile, "%s (dummy) (", KeyWord); fprintf (FvMapFile, "%s (dummy) (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress); fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) ImageBaseAddress);
} else { } else {
fprintf (FvMapFile, "%s (", KeyWord); fprintf (FvMapFile, "%s (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset); fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) (ImageBaseAddress + Offset));
} }
fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint); fprintf (FvMapFile, "EntryPoint=%08llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
fprintf (FvMapFile, "GUID=%s", FileGuidName); fprintf (FvMapFile, "GUID=%s", FileGuidName);
fprintf (FvMapFile, ")\n"); fprintf (FvMapFile, ")\n");
for (; Index > 0; Index --, SectionHeader ++) { for (; Index > 0; Index --, SectionHeader ++) {
if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) { if (stricmp ((CHAR8 *)SectionHeader->Name, ".text") == 0) {
fprintf (FvMapFile, ".textbaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress); fprintf (FvMapFile, ".textbaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) { } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {
fprintf (FvMapFile, ".databaseaddress=%08lx ",ImageBaseAddress + SectionHeader->VirtualAddress); fprintf (FvMapFile, ".databaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress));
} }
} }
fprintf (FvMapFile, "\n\n"); fprintf (FvMapFile, "\n\n");
@ -869,25 +869,27 @@ Returns:
// Printf Function Information // Printf Function Information
// //
if (FunctionType == 1) { if (FunctionType == 1) {
sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName); sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
FunctionAddress = (UINT64) TempLongAddress;
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) { if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress); fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
fprintf (FvMapFile, "(%08lx) F ", FunctionAddress - Offset); fprintf (FvMapFile, "(%08llx) F ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName); fprintf (FvMapFile, "%s\n", FunctionName);
} else { } else {
fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress); fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset); fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName); fprintf (FvMapFile, "%s\n", FunctionName);
} }
} else if (FunctionType == 2) { } else if (FunctionType == 2) {
sscanf (Line, "%s %s %lx %s", KeyWord, FunctionName, &FunctionAddress, FunctionTypeName); sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
FunctionAddress = (UINT64) TempLongAddress;
if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) { if (FunctionTypeName [1] == '\0' && (FunctionTypeName [0] == 'f' || FunctionTypeName [0] == 'F')) {
fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress); fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
fprintf (FvMapFile, "(%08lx) FS ", FunctionAddress - Offset); fprintf (FvMapFile, "(%08llx) FS ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName); fprintf (FvMapFile, "%s\n", FunctionName);
} else { } else {
fprintf (FvMapFile, " %016lx ", ImageBaseAddress + FunctionAddress); fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
fprintf (FvMapFile, "(%08lx) ", FunctionAddress - Offset); fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName); fprintf (FvMapFile, "%s\n", FunctionName);
} }
} }
@ -1028,7 +1030,7 @@ Returns:
// //
for (Index1 = 0; Index1 < Index; Index1 ++) { for (Index1 = 0; Index1 < Index; Index1 ++) {
if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) { if (CompareGuid ((EFI_GUID *) FileBuffer, &mFileGuidArray [Index1]) == 0) {
Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %dth file have the same file GUID.", Index1 + 1, Index + 1); Error (NULL, 0, 2000, "Invalid parameter", "the %dth file and %uth file have the same file GUID.", (unsigned) Index1 + 1, (unsigned) Index + 1);
PrintGuid ((EFI_GUID *) FileBuffer); PrintGuid ((EFI_GUID *) FileBuffer);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -1067,7 +1069,7 @@ Returns:
// Sanity check. The file MUST align appropriately // Sanity check. The file MUST align appropriately
// //
if (((UINTN) *VtfFileImage + sizeof (EFI_FFS_FILE_HEADER) - (UINTN) FvImage->FileImage) % (1 << CurrentFileAlignment)) { if (((UINTN) *VtfFileImage + sizeof (EFI_FFS_FILE_HEADER) - (UINTN) FvImage->FileImage) % (1 << CurrentFileAlignment)) {
Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %d-byte boundary.", 1 << CurrentFileAlignment); Error (NULL, 0, 3000, "Invalid", "VTF file cannot be aligned on a %u-byte boundary.", (unsigned) (1 << CurrentFileAlignment));
free (FileBuffer); free (FileBuffer);
return EFI_ABORTED; return EFI_ABORTED;
} }
@ -1096,7 +1098,7 @@ Returns:
// //
// Add pad file if necessary // Add pad file if necessary
// //
Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, NULL); Status = AddPadFile (FvImage, 1 << CurrentFileAlignment, *VtfFileImage, NULL);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property."); Error (NULL, 0, 4002, "Resource", "FV space is full, could not add pad file for data alignment property.");
free (FileBuffer); free (FileBuffer);
@ -1105,7 +1107,7 @@ Returns:
// //
// Add file // Add file
// //
if ((FvImage->CurrentFilePointer + FileSize) < FvImage->Eof) { if ((UINTN) (FvImage->CurrentFilePointer + FileSize) <= (UINTN) (*VtfFileImage)) {
// //
// Rebase the PE or TE image in FileBuffer of FFS file for XIP. // Rebase the PE or TE image in FileBuffer of FFS file for XIP.
// Rebase Bs and Rt drivers for the debug genfvmap tool. // Rebase Bs and Rt drivers for the debug genfvmap tool.
@ -1174,6 +1176,10 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
if ((UINTN) VtfFileImage < (UINTN) FvImage->CurrentFilePointer) {
return EFI_INVALID_PARAMETER;
}
// //
// Pad file starts at beginning of free space // Pad file starts at beginning of free space
// //
@ -1261,11 +1267,11 @@ Returns:
UINT8 *BytePointer2; UINT8 *BytePointer2;
UINT16 *WordPointer; UINT16 *WordPointer;
UINT16 CheckSum; UINT16 CheckSum;
UINT32 IpiVector;
UINTN Index; UINTN Index;
EFI_FFS_FILE_STATE SavedState; EFI_FFS_FILE_STATE SavedState;
UINT64 FitAddress; UINT64 FitAddress;
FIT_TABLE *FitTablePtr; FIT_TABLE *FitTablePtr;
UINT32 IpiVector;
// //
// Verify input parameters // Verify input parameters
@ -1325,7 +1331,7 @@ Returns:
SecCorePhysicalAddress = FvInfo->BaseAddress; SecCorePhysicalAddress = FvInfo->BaseAddress;
SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage; SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
SecCorePhysicalAddress += EntryPoint; SecCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress); DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);
// //
// Find the PEI Core // Find the PEI Core
@ -1365,7 +1371,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress; PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage; PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint; PeiCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress); DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
if (MachineType == EFI_IMAGE_MACHINE_IA64) { if (MachineType == EFI_IMAGE_MACHINE_IA64) {
// //
@ -1381,8 +1387,8 @@ Returns:
// //
if (PeiCorePhysicalAddress & 0xF) { if (PeiCorePhysicalAddress & 0xF) {
Error (NULL, 0, 3000, "Invalid", Error (NULL, 0, 3000, "Invalid",
"PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %Xh.", "PEI_CORE entry point is not aligned on a 16 byte boundary, address specified is %llXh.",
PeiCorePhysicalAddress (unsigned long long) PeiCorePhysicalAddress
); );
return EFI_ABORTED; return EFI_ABORTED;
} }
@ -1411,8 +1417,8 @@ Returns:
// //
if (SecCorePhysicalAddress & 0xF) { if (SecCorePhysicalAddress & 0xF) {
Error (NULL, 0, 3000, "Invalid", Error (NULL, 0, 3000, "Invalid",
"SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %Xh.", "SALE_ENTRY entry point is not aligned on a 16 byte boundary, address specified is %llXh.",
SecCorePhysicalAddress (unsigned long long) SecCorePhysicalAddress
); );
return EFI_ABORTED; return EFI_ABORTED;
} }
@ -1448,7 +1454,7 @@ Returns:
// //
Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET); Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - IA32_SEC_CORE_ENTRY_OFFSET);
Ia32SecEntryOffset = SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2); Ia32SecEntryOffset = (INT32) (SecCorePhysicalAddress - (FV_IMAGES_TOP_ADDRESS - IA32_SEC_CORE_ENTRY_OFFSET + 2));
if (Ia32SecEntryOffset <= -65536) { if (Ia32SecEntryOffset <= -65536) {
Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K."); Error (NULL, 0, 3000, "Invalid", "The SEC EXE file size is too large, it must be less than 64K.");
return STATUS_ERROR; return STATUS_ERROR;
@ -1461,7 +1467,7 @@ Returns:
// //
Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 4); Ia32ResetAddressPtr = (UINT32 *) ((UINTN) FvImage->Eof - 4);
*Ia32ResetAddressPtr = (UINT32) (FvInfo->BaseAddress); *Ia32ResetAddressPtr = (UINT32) (FvInfo->BaseAddress);
DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%X.", FvInfo->BaseAddress); DebugMsg (NULL, 0, 9, "update BFV base address in the top FV image", "BFV base address = 0x%llX.", (unsigned long long) FvInfo->BaseAddress);
// //
// Update the Startup AP in the FVH header block ZeroVector region. // Update the Startup AP in the FVH header block ZeroVector region.
@ -1507,9 +1513,9 @@ Returns:
// //
// IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV. // IpiVector at the 4k aligned address in the top 2 blocks in the PEI FV.
// //
IpiVector = FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer); IpiVector = (UINT32) (FV_IMAGES_TOP_ADDRESS - ((UINTN) FvImage->Eof - (UINTN) BytePointer));
DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", IpiVector); DebugMsg (NULL, 0, 9, "Startup AP Vector address", "IpiVector at 0x%X", (unsigned) IpiVector);
if (IpiVector & 0xFFF != 0) { if ((IpiVector & 0xFFF) != 0) {
Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned"); Error (NULL, 0, 3000, "Invalid", "Startup AP Vector address are not 4K aligned, because the FV size is not 4K aligned");
return EFI_ABORTED; return EFI_ABORTED;
} }
@ -1527,7 +1533,7 @@ Returns:
// Volume Top File, but if you have one for some reason don't crash... // Volume Top File, but if you have one for some reason don't crash...
// //
} else { } else {
Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", (UINT32) MachineType); Error (NULL, 0, 3000, "Invalid", "machine type=0x%X in PEI core.", MachineType);
return EFI_ABORTED; return EFI_ABORTED;
} }
@ -1575,7 +1581,7 @@ Routine Description:
FIQ +24 FIQ +24
We support two schemes on ARM. We support two schemes on ARM.
1) Begining of the FV is the reset vector 1) Beginning of the FV is the reset vector
2) Reset vector is data bytes FDF file and that code branches to reset vector 2) Reset vector is data bytes FDF file and that code branches to reset vector
in the beginning of the FV (fixed size offset). in the beginning of the FV (fixed size offset).
@ -1671,7 +1677,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress; PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage; PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint; PeiCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress); DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
if (MachineType == EFI_IMAGE_MACHINE_ARMT) { if (MachineType == EFI_IMAGE_MACHINE_ARMT) {
memset (ResetVector, 0, sizeof (ResetVector)); memset (ResetVector, 0, sizeof (ResetVector));
@ -1726,7 +1732,7 @@ Returns:
SecCorePhysicalAddress = FvInfo->BaseAddress; SecCorePhysicalAddress = FvInfo->BaseAddress;
SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage; SecCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
SecCorePhysicalAddress += EntryPoint; SecCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%X", SecCorePhysicalAddress); DebugMsg (NULL, 0, 9, "SecCore physical entry point address", "Address = 0x%llX", (unsigned long long) SecCorePhysicalAddress);
// //
// Find the PEI Core. It may not exist if SEC loads DXE core directly // Find the PEI Core. It may not exist if SEC loads DXE core directly
@ -1764,7 +1770,7 @@ Returns:
PeiCorePhysicalAddress = FvInfo->BaseAddress; PeiCorePhysicalAddress = FvInfo->BaseAddress;
PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage; PeiCorePhysicalAddress += (UINTN) Pe32Section.Pe32Section + sizeof (EFI_SECTION_PE32) - (UINTN) FvImage->FileImage;
PeiCorePhysicalAddress += EntryPoint; PeiCorePhysicalAddress += EntryPoint;
DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%X", PeiCorePhysicalAddress); DebugMsg (NULL, 0, 9, "PeiCore physical entry point address", "Address = 0x%llX", (unsigned long long) PeiCorePhysicalAddress);
} }
@ -1880,7 +1886,7 @@ Returns:
// Verify NT header is expected // Verify NT header is expected
// //
if (ImgHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) { if (ImgHdr->Pe32.Signature != EFI_IMAGE_NT_SIGNATURE) {
Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", ImgHdr->Pe32.Signature); Error (NULL, 0, 3000, "Invalid", "Unrecognized image signature 0x%08X.", (unsigned) ImgHdr->Pe32.Signature);
return EFI_UNSUPPORTED; return EFI_UNSUPPORTED;
} }
// //
@ -1990,7 +1996,7 @@ Returns:
// //
if (mFvDataInfo.FvFileSystemGuidSet) { if (mFvDataInfo.FvFileSystemGuidSet) {
DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", DebugMsg (NULL, 0, 9, "FV File System Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
mFvDataInfo.FvFileSystemGuid.Data1, (unsigned) mFvDataInfo.FvFileSystemGuid.Data1,
mFvDataInfo.FvFileSystemGuid.Data2, mFvDataInfo.FvFileSystemGuid.Data2,
mFvDataInfo.FvFileSystemGuid.Data3, mFvDataInfo.FvFileSystemGuid.Data3,
mFvDataInfo.FvFileSystemGuid.Data4[0], mFvDataInfo.FvFileSystemGuid.Data4[0],
@ -2007,7 +2013,7 @@ Returns:
// //
if (mFvDataInfo.FvNameGuidSet) { if (mFvDataInfo.FvNameGuidSet) {
DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", DebugMsg (NULL, 0, 9, "FV Name Guid", "%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
mFvDataInfo.FvNameGuid.Data1, (unsigned) mFvDataInfo.FvNameGuid.Data1,
mFvDataInfo.FvNameGuid.Data2, mFvDataInfo.FvNameGuid.Data2,
mFvDataInfo.FvNameGuid.Data3, mFvDataInfo.FvNameGuid.Data3,
mFvDataInfo.FvNameGuid.Data4[0], mFvDataInfo.FvNameGuid.Data4[0],
@ -2043,7 +2049,7 @@ Returns:
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
return Status; return Status;
} }
VerboseMsg ("the generated FV image size is %d bytes", mFvDataInfo.Size); VerboseMsg ("the generated FV image size is %u bytes", (unsigned) mFvDataInfo.Size);
// //
// support fv image and empty fv image // support fv image and empty fv image
@ -2120,7 +2126,7 @@ Returns:
// //
// If there is no FFS file, generate one empty FV // If there is no FFS file, generate one empty FV
// //
if (mFvDataInfo.FvFiles[0][0] == 0) { if (mFvDataInfo.FvFiles[0][0] == 0 && !mFvDataInfo.FvNameGuidSet) {
goto WriteFile; goto WriteFile;
} }
@ -2155,15 +2161,15 @@ Returns:
// //
if (mFvTotalSize != 0) { if (mFvTotalSize != 0) {
fprintf (FvMapFile, EFI_FV_TOTAL_SIZE_STRING); fprintf (FvMapFile, EFI_FV_TOTAL_SIZE_STRING);
fprintf (FvMapFile, " = 0x%x\n", mFvTotalSize); fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTotalSize);
} }
if (mFvTakenSize != 0) { if (mFvTakenSize != 0) {
fprintf (FvMapFile, EFI_FV_TAKEN_SIZE_STRING); fprintf (FvMapFile, EFI_FV_TAKEN_SIZE_STRING);
fprintf (FvMapFile, " = 0x%x\n", mFvTakenSize); fprintf (FvMapFile, " = 0x%x\n", (unsigned) mFvTakenSize);
} }
if (mFvTotalSize != 0 && mFvTakenSize != 0) { if (mFvTotalSize != 0 && mFvTakenSize != 0) {
fprintf (FvMapFile, EFI_FV_SPACE_SIZE_STRING); fprintf (FvMapFile, EFI_FV_SPACE_SIZE_STRING);
fprintf (FvMapFile, " = 0x%x\n\n", mFvTotalSize - mFvTakenSize); fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));
} }
// //
@ -2172,7 +2178,7 @@ Returns:
if (mFvDataInfo.FvNameGuidSet) { if (mFvDataInfo.FvNameGuidSet) {
memcpy (&FvExtHeader.FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID)); memcpy (&FvExtHeader.FvName, &mFvDataInfo.FvNameGuid, sizeof (EFI_GUID));
FvExtHeader.ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER); FvExtHeader.ExtHeaderSize = sizeof (EFI_FIRMWARE_VOLUME_EXT_HEADER);
AddPadFile (&FvImageMemoryFile, 8, &FvExtHeader); AddPadFile (&FvImageMemoryFile, 4, VtfFileImage, &FvExtHeader);
// //
// Fv Extension header change update Fv Header Check sum // Fv Extension header change update Fv Header Check sum
// //
@ -2382,7 +2388,9 @@ Returns:
UINT32 FfsAlignment; UINT32 FfsAlignment;
EFI_FFS_FILE_HEADER FfsHeader; EFI_FFS_FILE_HEADER FfsHeader;
BOOLEAN VtfFileFlag; BOOLEAN VtfFileFlag;
UINTN VtfFileSize;
VtfFileSize = 0;
VtfFileFlag = FALSE; VtfFileFlag = FALSE;
fpin = NULL; fpin = NULL;
Index = 0; Index = 0;
@ -2453,12 +2461,10 @@ Returns:
return EFI_ABORTED; return EFI_ABORTED;
} }
VtfFileFlag = TRUE; VtfFileFlag = TRUE;
// VtfFileSize = FfsFileSize;
// The space between Vft File and the latest file must be able to contain continue;
// one ffs file header in order to add one pad file.
//
CurrentOffset += sizeof (EFI_FFS_FILE_HEADER);
} }
// //
// Get the alignment of FFS file // Get the alignment of FFS file
// //
@ -2489,8 +2495,8 @@ Returns:
CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1); CurrentOffset = (CurrentOffset + EFI_FFS_FILE_HEADER_ALIGNMENT - 1) & ~(EFI_FFS_FILE_HEADER_ALIGNMENT - 1);
} }
} }
CurrentOffset += VtfFileSize;
DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", CurrentOffset, FvInfoPtr->Size); DebugMsg (NULL, 0, 9, "FvImage size", "The caculated fv image size is 0x%x and the current set fv image size is 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
if (FvInfoPtr->Size == 0) { if (FvInfoPtr->Size == 0) {
// //
@ -2504,7 +2510,7 @@ Returns:
// //
// Not invalid // Not invalid
// //
Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", CurrentOffset, FvInfoPtr->Size); Error (NULL, 0, 3000, "Invalid", "the required fv image size 0x%x exceeds the set fv image size 0x%x", (unsigned) CurrentOffset, (unsigned) FvInfoPtr->Size);
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
@ -2628,7 +2634,7 @@ Returns:
// Check XipAddress, BootAddress and RuntimeAddress // Check XipAddress, BootAddress and RuntimeAddress
// //
Flags = 0; Flags = 0;
XipBase = 0;
if (FvInfo->BaseAddress != 0) { if (FvInfo->BaseAddress != 0) {
Flags |= REBASE_XIP_FILE; Flags |= REBASE_XIP_FILE;
XipBase = FvInfo->BaseAddress + XipOffset; XipBase = FvInfo->BaseAddress + XipOffset;
@ -2686,7 +2692,7 @@ Returns:
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead; ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext); Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status); Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status; return Status;
} }
@ -2785,7 +2791,7 @@ Returns:
ImageContext.Handle = PeFileBuffer; ImageContext.Handle = PeFileBuffer;
Status = PeCoffLoaderGetImageInfo (&ImageContext); Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, Status); Error (NULL, 0, 3000, "Invalid PeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status; return Status;
} }
ImageContext.RelocationsStripped = FALSE; ImageContext.RelocationsStripped = FALSE;
@ -2935,7 +2941,7 @@ Returns:
ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress; ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
} else { } else {
Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s", Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
(UINT32) ImgHdr->Pe32.OptionalHeader.Magic, ImgHdr->Pe32.OptionalHeader.Magic,
FileName FileName
); );
return EFI_ABORTED; return EFI_ABORTED;
@ -3018,7 +3024,7 @@ WritePeMap:
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead; ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext); Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status); Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status; return Status;
} }
@ -3101,7 +3107,7 @@ WritePeMap:
ImageContext.Handle = PeFileBuffer; ImageContext.Handle = PeFileBuffer;
Status = PeCoffLoaderGetImageInfo (&ImageContext); Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, Status); Error (NULL, 0, 3000, "Invalid TeImage", "The input file is %s and the return status is %x", FileName, (int) Status);
return Status; return Status;
} }
ImageContext.RelocationsStripped = FALSE; ImageContext.RelocationsStripped = FALSE;
@ -3365,8 +3371,14 @@ Returns:
if (Status == EFI_SUCCESS) { if (Status == EFI_SUCCESS) {
if (strstr (Value, "PopulateSystemTable") != NULL) { if (strstr (Value, "PopulateSystemTable") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE; CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET | CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE;
if (strstr (Value, "InitiateReset") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
}
} else if (strstr (Value, "PersistAcrossReset") != NULL) { } else if (strstr (Value, "PersistAcrossReset") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET; CapInfo->Flags |= CAPSULE_FLAGS_PERSIST_ACROSS_RESET;
if (strstr (Value, "InitiateReset") != NULL) {
CapInfo->Flags |= CAPSULE_FLAGS_INITIATE_RESET;
}
} else { } else {
Error (NULL, 0, 2000, "Invalid parameter", "invalid Flag setting for %s.", EFI_CAPSULE_FLAGS_STRING); Error (NULL, 0, 2000, "Invalid parameter", "invalid Flag setting for %s.", EFI_CAPSULE_FLAGS_STRING);
return EFI_ABORTED; return EFI_ABORTED;
@ -3403,7 +3415,7 @@ Returns:
// Add the file // Add the file
// //
strcpy (CapInfo->CapFiles[Index], Value); strcpy (CapInfo->CapFiles[Index], Value);
DebugMsg (NULL, 0, 9, "Capsule component file", "the %dth file name is %s", Index, CapInfo->CapFiles[Index]); DebugMsg (NULL, 0, 9, "Capsule component file", "the %uth file name is %s", (unsigned) Index, CapInfo->CapFiles[Index]);
} else { } else {
break; break;
} }
@ -3568,7 +3580,7 @@ Returns:
fwrite (CapBuffer, 1, CapSize, fpout); fwrite (CapBuffer, 1, CapSize, fpout);
fclose (fpout); fclose (fpout);
VerboseMsg ("The size of the generated capsule image is %d bytes", CapSize); VerboseMsg ("The size of the generated capsule image is %u bytes", (unsigned) CapSize);
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@ -23,6 +23,7 @@ Abstract:
#ifndef __GNUC__ #ifndef __GNUC__
#include <windows.h> #include <windows.h>
#include <io.h>
#endif #endif
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
@ -43,6 +44,8 @@ Abstract:
#include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h> #include <IndustryStandard/MemoryMappedConfigurationSpaceAccessTable.h>
#include "CommonLib.h" #include "CommonLib.h"
#include "PeCoffLib.h"
#include "ParseInf.h"
#include "EfiUtilityMsgs.h" #include "EfiUtilityMsgs.h"
#include "elf_common.h" #include "elf_common.h"
@ -321,6 +324,10 @@ Returns:
ExpectedLength = sizeof(EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE); ExpectedLength = sizeof(EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE);
break; break;
default: default:
if (AcpiHeader->Revision > EFI_ACPI_3_0_FIXED_ACPI_DESCRIPTION_TABLE_REVISION) {
ExpectedLength = AcpiHeader->Length;
break;
}
Error (NULL, 0, 3000, "Invalid", "FACP revision check failed."); Error (NULL, 0, 3000, "Invalid", "FACP revision check failed.");
return STATUS_ERROR; return STATUS_ERROR;
} }
@ -335,7 +342,10 @@ Returns:
// //
case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE: case EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_SIGNATURE:
Facs = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)AcpiTable; Facs = (EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE *)AcpiTable;
if ((Facs->Version != 0) && if (Facs->Version > EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) {
break;
}
if ((Facs->Version != EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
(Facs->Version != EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) && (Facs->Version != EFI_ACPI_2_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION) &&
(Facs->Version != EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION)){ (Facs->Version != EFI_ACPI_3_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION)){
Error (NULL, 0, 3000, "Invalid", "FACS version check failed."); Error (NULL, 0, 3000, "Invalid", "FACS version check failed.");
@ -354,8 +364,7 @@ Returns:
// //
case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE: case EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_SIGNATURE:
if (AcpiHeader->Revision > EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION) { if (AcpiHeader->Revision > EFI_ACPI_3_0_DIFFERENTIATED_SYSTEM_DESCRIPTION_TABLE_REVISION) {
Error (NULL, 0, 3000, "Invalid", "DSDT revision check failed."); break;
return STATUS_ERROR;
} }
if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) { if (AcpiHeader->Length <= sizeof(EFI_ACPI_DESCRIPTION_HEADER)) {
Error (NULL, 0, 3000, "Invalid", "DSDT length check failed."); Error (NULL, 0, 3000, "Invalid", "DSDT length check failed.");
@ -367,6 +376,9 @@ Returns:
// "APIC" Multiple APIC Description Table // "APIC" Multiple APIC Description Table
// //
case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE: case EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_SIGNATURE:
if (AcpiHeader->Revision > EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) {
break;
}
if ((AcpiHeader->Revision != EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) && if ((AcpiHeader->Revision != EFI_ACPI_1_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
(AcpiHeader->Revision != EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) && (AcpiHeader->Revision != EFI_ACPI_2_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION) &&
(AcpiHeader->Revision != EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION)) { (AcpiHeader->Revision != EFI_ACPI_3_0_MULTIPLE_APIC_DESCRIPTION_TABLE_REVISION)) {
@ -383,6 +395,9 @@ Returns:
// "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table // "MCFG" PCI Express Memory Mapped Configuration Space Base Address Description Table
// //
case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE: case EFI_ACPI_3_0_PCI_EXPRESS_MEMORY_MAPPED_CONFIGURATION_SPACE_BASE_ADDRESS_DESCRIPTION_TABLE_SIGNATURE:
if (AcpiHeader->Revision > EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
break;
}
if (AcpiHeader->Revision != EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) { if (AcpiHeader->Revision != EFI_ACPI_MEMORY_MAPPED_CONFIGURATION_SPACE_ACCESS_TABLE_REVISION) {
Error (NULL, 0, 3000, "Invalid", "MCFG revision check failed."); Error (NULL, 0, 3000, "Invalid", "MCFG revision check failed.");
return STATUS_ERROR; return STATUS_ERROR;
@ -437,7 +452,7 @@ Elf_Phdr *gPhdrBase;
// PE section alignment. // PE section alignment.
// //
const UINT32 CoffAlignment = 0x20; const UINT32 CoffAlignment = 0x20;
const UINT32 CoffNbrSections = 4; const UINT16 CoffNbrSections = 4;
// //
// Current offset in coff file. // Current offset in coff file.
@ -508,7 +523,7 @@ CheckElfHeader(
return 0; return 0;
} }
if (Ehdr->e_version != EV_CURRENT) { if (Ehdr->e_version != EV_CURRENT) {
Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%d) not EV_CURRENT (%d)", Ehdr->e_version, EV_CURRENT); Error (NULL, 0, 3000, "Unsupported", "ELF e_version (%u) not EV_CURRENT (%d)", (unsigned) Ehdr->e_version, EV_CURRENT);
return 0; return 0;
} }
@ -707,7 +722,7 @@ ScanSections(
} }
NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections; NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections;
NtHdr->Pe32.FileHeader.TimeDateStamp = time(NULL); NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);
NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0; NtHdr->Pe32.FileHeader.PointerToSymbolTable = 0;
NtHdr->Pe32.FileHeader.NumberOfSymbols = 0; NtHdr->Pe32.FileHeader.NumberOfSymbols = 0;
NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader); NtHdr->Pe32.FileHeader.SizeOfOptionalHeader = sizeof(NtHdr->Pe32.OptionalHeader);
@ -787,7 +802,7 @@ WriteSections(
// //
// Ignore for unkown section type. // Ignore for unkown section type.
// //
VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (UINTN)Shdr->sh_type); VerboseMsg ("%s unknown section type %x. We directly copy this section into Coff file", mInImageName, (unsigned)Shdr->sh_type);
break; break;
} }
} }
@ -846,7 +861,7 @@ WriteSections(
- (SecOffset - SecShdr->sh_addr); - (SecOffset - SecShdr->sh_addr);
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
} }
} else if (Ehdr->e_machine == EM_ARM) { } else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) { switch (ELF32_R_TYPE(Rel->r_info)) {
@ -862,7 +877,7 @@ WriteSections(
*(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx]; *(UINT32 *)Targ = *(UINT32 *)Targ - SymShdr->sh_addr + CoffSectionsOffset[Sym->st_shndx];
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
} }
} }
} }
@ -918,7 +933,7 @@ CoffAddFixup(
// //
// Fill the entry. // Fill the entry.
// //
CoffAddFixupEntry((Type << 12) | (Offset & 0xfff)); CoffAddFixupEntry((UINT16) ((Type << 12) | (Offset & 0xfff)));
} }
@ -976,7 +991,7 @@ WriteRelocations(
EFI_IMAGE_REL_BASED_HIGHLOW); EFI_IMAGE_REL_BASED_HIGHLOW);
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF_R_TYPE(Rel->r_info));
} }
} else if (Ehdr->e_machine == EM_ARM) { } else if (Ehdr->e_machine == EM_ARM) {
switch (ELF32_R_TYPE(Rel->r_info)) { switch (ELF32_R_TYPE(Rel->r_info)) {
@ -993,10 +1008,10 @@ WriteRelocations(
); );
break; break;
default: default:
Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, ELF32_R_TYPE(Rel->r_info)); Error (NULL, 0, 3000, "Invalid", "%s unhandled section type %x.", mInImageName, (unsigned) ELF32_R_TYPE(Rel->r_info));
} }
} else { } else {
Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %d (processor type).", Ehdr->e_machine); Error (NULL, 0, 3000, "Not Supported", "This tool does not support relocations for ELF with e_machine %u (processor type).", (unsigned) Ehdr->e_machine);
} }
} }
} }
@ -1214,19 +1229,20 @@ ZeroXdataSection (
CHAR8 KeyWord [MAX_LINE_LEN]; CHAR8 KeyWord [MAX_LINE_LEN];
CHAR8 SectionName [MAX_LINE_LEN]; CHAR8 SectionName [MAX_LINE_LEN];
UINT32 FunctionType = 0; UINT32 FunctionType = 0;
UINT32 SectionOffset; unsigned SectionOffset = 0;
UINT32 SectionLength; unsigned SectionLength = 0;
UINT32 SectionNumber; unsigned SectionNumber = 0;
CHAR8 *PdbPointer; CHAR8 *PdbPointer;
INT32 Index = 0; INT32 Index;
UINT32 Index2;
for (Index = 0; Index < SectionTotalNumber; Index ++) { for (Index2 = 0; Index2 < SectionTotalNumber; Index2++) {
if (stricmp ((char *)SectionHeader[Index].Name, ".zdata") == 0) { if (stricmp ((char *)SectionHeader[Index2].Name, ".zdata") == 0) {
// //
// try to zero the customized .zdata section, which is mapped to .xdata // try to zero the customized .zdata section, which is mapped to .xdata
// //
memset (FileBuffer + SectionHeader[Index].PointerToRawData, 0, SectionHeader[Index].SizeOfRawData); memset (FileBuffer + SectionHeader[Index2].PointerToRawData, 0, SectionHeader[Index2].SizeOfRawData);
DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[Index].PointerToRawData, SectionHeader[Index].SizeOfRawData); DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[Index2].PointerToRawData, (unsigned) SectionHeader[Index2].SizeOfRawData);
return; return;
} }
} }
@ -1329,7 +1345,7 @@ ZeroXdataSection (
// Zero .xdata Section data // Zero .xdata Section data
// //
memset (FileBuffer + SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, 0, SectionLength); memset (FileBuffer + SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, 0, SectionLength);
DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength); DebugMsg (NULL, 0, 9, NULL, "Zero the .xdata section for PE image at Offset 0x%x and Length 0x%x", (unsigned) SectionHeader[SectionNumber-1].PointerToRawData + SectionOffset, SectionLength);
fclose (fpMapFile); fclose (fpMapFile);
return; return;
} }
@ -1610,7 +1626,7 @@ Returns:
goto Finish; goto Finish;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
goto Finish; goto Finish;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);
@ -1631,7 +1647,7 @@ Returns:
InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)); InputFileName = (CHAR8 **) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *));
if (InputFileName == NULL) { if (InputFileName == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return EFI_OUT_OF_RESOURCES; goto Finish;
} }
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *))); memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
@ -1646,7 +1662,7 @@ Returns:
if (InputFileName == NULL) { if (InputFileName == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return EFI_OUT_OF_RESOURCES; goto Finish;
} }
memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *))); memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
@ -1883,7 +1899,7 @@ Returns:
} }
if (Index != FileLength) { if (Index != FileLength) {
Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, FileLength, Index); Error (NULL, 0, 3000, "Invalid", "file length of %s (0x%x) does not equal expected TotalSize: 0x%04X.", mInImageName, (unsigned) FileLength, (unsigned) Index);
goto Finish; goto Finish;
} }
@ -1899,7 +1915,7 @@ Returns:
Index += sizeof (*DataPointer); Index += sizeof (*DataPointer);
} }
if (CheckSum != 0) { if (CheckSum != 0) {
Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", CheckSum, mInImageName); Error (NULL, 0, 3000, "Invalid", "checksum (0x%x) failed on file %s.", (unsigned) CheckSum, mInImageName);
goto Finish; goto Finish;
} }
// //
@ -1923,7 +1939,7 @@ Returns:
goto Finish; goto Finish;
} }
} }
VerboseMsg ("the size of output file is %d bytes", FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
// //
// Convert Mci.TXT to Mci.bin file successfully // Convert Mci.TXT to Mci.bin file successfully
// //
@ -1950,7 +1966,7 @@ Returns:
fread (FileBuffer, 1, FileLength, fpIn); fread (FileBuffer, 1, FileLength, fpIn);
fclose (fpIn); fclose (fpIn);
DebugMsg (NULL, 0, 9, "input file info", "the input file size is %d bytes", FileLength); DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) FileLength);
// //
// Replace file // Replace file
@ -1978,11 +1994,11 @@ Returns:
fprintf (fpInOut, "%17X number of sections\n", TEImageHeader.NumberOfSections); fprintf (fpInOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
fprintf (fpInOut, "%17X subsystems\n", TEImageHeader.Subsystem); fprintf (fpInOut, "%17X subsystems\n", TEImageHeader.Subsystem);
fprintf (fpInOut, "%17X stripped size\n", TEImageHeader.StrippedSize); fprintf (fpInOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
fprintf (fpInOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint); fprintf (fpInOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
fprintf (fpInOut, "%17X base of code\n", TEImageHeader.BaseOfCode); fprintf (fpInOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
fprintf (fpInOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase); fprintf (fpInOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size); fprintf (fpInOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size); fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
} }
if (fpOut != NULL) { if (fpOut != NULL) {
@ -1992,11 +2008,11 @@ Returns:
fprintf (fpOut, "%17X number of sections\n", TEImageHeader.NumberOfSections); fprintf (fpOut, "%17X number of sections\n", TEImageHeader.NumberOfSections);
fprintf (fpOut, "%17X subsystems\n", TEImageHeader.Subsystem); fprintf (fpOut, "%17X subsystems\n", TEImageHeader.Subsystem);
fprintf (fpOut, "%17X stripped size\n", TEImageHeader.StrippedSize); fprintf (fpOut, "%17X stripped size\n", TEImageHeader.StrippedSize);
fprintf (fpOut, "%17X entry point\n", TEImageHeader.AddressOfEntryPoint); fprintf (fpOut, "%17X entry point\n", (unsigned) TEImageHeader.AddressOfEntryPoint);
fprintf (fpOut, "%17X base of code\n", TEImageHeader.BaseOfCode); fprintf (fpOut, "%17X base of code\n", (unsigned) TEImageHeader.BaseOfCode);
fprintf (fpOut, "%17lX image base\n", (long unsigned int)TEImageHeader.ImageBase); fprintf (fpOut, "%17llX image base\n", (unsigned long long)TEImageHeader.ImageBase);
fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", TEImageHeader.DataDirectory[0].VirtualAddress, TEImageHeader.DataDirectory[0].Size); fprintf (fpOut, "%17X [%8X] RVA [size] of Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", TEImageHeader.DataDirectory[1].VirtualAddress, TEImageHeader.DataDirectory[1].Size); fprintf (fpOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size);
} }
goto Finish; goto Finish;
} }
@ -2201,7 +2217,7 @@ Returns:
if (fpInOut != NULL) { if (fpInOut != NULL) {
fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpInOut); fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders); VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders));
goto Finish; goto Finish;
} }
@ -2211,7 +2227,7 @@ Returns:
if (OutImageType == FW_ZERO_DEBUG_IMAGE) { if (OutImageType == FW_ZERO_DEBUG_IMAGE) {
Status = ZeroDebugData (FileBuffer, TRUE); Status = ZeroDebugData (FileBuffer, TRUE);
if (EFI_ERROR (Status)) { if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%lx", (UINTN) Status); Error (NULL, 0, 3000, "Invalid", "Zero DebugData Error status is 0x%x", (int) Status);
goto Finish; goto Finish;
} }
@ -2221,7 +2237,7 @@ Returns:
if (fpInOut != NULL) { if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut); fwrite (FileBuffer, 1, FileLength, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto Finish;
} }
@ -2240,7 +2256,7 @@ Returns:
if (fpInOut != NULL) { if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut); fwrite (FileBuffer, 1, FileLength, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto Finish;
} }
@ -2274,7 +2290,7 @@ Returns:
if (fpInOut != NULL) { if (fpInOut != NULL) {
fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpInOut); fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto Finish;
} }
} }
@ -2291,7 +2307,7 @@ Returns:
DosHdr->e_lfanew = BackupDosHdr.e_lfanew; DosHdr->e_lfanew = BackupDosHdr.e_lfanew;
for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) { for (Index = sizeof (EFI_IMAGE_DOS_HEADER); Index < (UINT32 ) DosHdr->e_lfanew; Index++) {
FileBuffer[Index] = DosHdr->e_cp; FileBuffer[Index] = (UINT8) DosHdr->e_cp;
} }
} }
@ -2397,7 +2413,7 @@ Returns:
Optional32->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize); Optional32->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
SectionHeader->SizeOfRawData = AllignedRelocSize; SectionHeader->SizeOfRawData = AllignedRelocSize;
FileLength = Optional32->SizeOfImage; FileLength = Optional32->SizeOfImage;
DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize); DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
} }
} }
} }
@ -2505,7 +2521,7 @@ Returns:
Optional64->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize); Optional64->SizeOfInitializedData -= (SectionHeader->SizeOfRawData - AllignedRelocSize);
SectionHeader->SizeOfRawData = AllignedRelocSize; SectionHeader->SizeOfRawData = AllignedRelocSize;
FileLength = Optional64->SizeOfImage; FileLength = Optional64->SizeOfImage;
DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %d", SectionHeader->SizeOfRawData - AllignedRelocSize); DebugMsg (NULL, 0, 9, "Remove the zero padding bytes at the end of the base relocations", "The size of padding bytes is %u", (unsigned) (SectionHeader->SizeOfRawData - AllignedRelocSize));
} }
} }
} }
@ -2561,8 +2577,8 @@ Returns:
goto Finish; goto Finish;
} }
DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %X", DebugMsg (NULL, 0, 9, "TeImage Header Info", "Machine type is %X, Number of sections is %X, Stripped size is %X, EntryPoint is %X, BaseOfCode is %X, ImageBase is %llX",
TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, TEImageHeader.AddressOfEntryPoint, TEImageHeader.BaseOfCode, TEImageHeader.ImageBase); TEImageHeader.Machine, TEImageHeader.NumberOfSections, TEImageHeader.StrippedSize, (unsigned) TEImageHeader.AddressOfEntryPoint, (unsigned) TEImageHeader.BaseOfCode, (unsigned long long) TEImageHeader.ImageBase);
// //
// Update Image to TeImage // Update Image to TeImage
// //
@ -2574,7 +2590,7 @@ Returns:
fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpInOut); fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpInOut);
fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpInOut); fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength - TEImageHeader.StrippedSize); VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - TEImageHeader.StrippedSize));
goto Finish; goto Finish;
} }
WriteFile: WriteFile:
@ -2587,7 +2603,7 @@ WriteFile:
if (fpInOut != NULL) { if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut); fwrite (FileBuffer, 1, FileLength, fpInOut);
} }
VerboseMsg ("the size of output file is %d bytes", FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
Finish: Finish:
if (fpInOut != NULL) { if (fpInOut != NULL) {
@ -2831,8 +2847,11 @@ Returns:
// Init variable. // Init variable.
// //
DebugDirectoryEntryRva = 0; DebugDirectoryEntryRva = 0;
DebugDirectoryEntryFileOffset = 0;
ExportDirectoryEntryRva = 0; ExportDirectoryEntryRva = 0;
ExportDirectoryEntryFileOffset = 0;
ResourceDirectoryEntryRva = 0; ResourceDirectoryEntryRva = 0;
ResourceDirectoryEntryFileOffset = 0;
// //
// Get time and date that will be set. // Get time and date that will be set.
// //
@ -3041,6 +3060,7 @@ Returns:
{ {
CHAR8 Line[MAX_LINE_LEN]; CHAR8 Line[MAX_LINE_LEN];
CHAR8 *cptr; CHAR8 *cptr;
unsigned ScannedData = 0;
Line[MAX_LINE_LEN - 1] = 0; Line[MAX_LINE_LEN - 1] = 0;
while (1) { while (1) {
@ -3080,10 +3100,11 @@ Returns:
for (; *cptr && isspace(*cptr); cptr++) { for (; *cptr && isspace(*cptr); cptr++) {
} }
if (isxdigit (*cptr)) { if (isxdigit (*cptr)) {
if (sscanf (cptr, "%X", Data) != 1) { if (sscanf (cptr, "%X", &ScannedData) != 1) {
return STATUS_ERROR; return STATUS_ERROR;
} }
} }
*Data = (UINT32) ScannedData;
return STATUS_SUCCESS; return STATUS_SUCCESS;
} }

View File

@ -1,88 +0,0 @@
/*-
* Copyright (c) 1998 John D. Polstra.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $FreeBSD: src/sys/sys/elf_generic.h,v 1.6.14.2 2007/12/03 21:30:36 marius Exp $
*/
#ifndef _SYS_ELF_GENERIC_H_
#define _SYS_ELF_GENERIC_H_ 1
#include <sys/cdefs.h>
/*
* Definitions of generic ELF names which relieve applications from
* needing to know the word size.
*/
#if __ELF_WORD_SIZE != 32 && __ELF_WORD_SIZE != 64
#error "__ELF_WORD_SIZE must be defined as 32 or 64"
#endif
#define ELF_CLASS __CONCAT(ELFCLASS,__ELF_WORD_SIZE)
#if BYTE_ORDER == LITTLE_ENDIAN
#define ELF_DATA ELFDATA2LSB
#elif BYTE_ORDER == BIG_ENDIAN
#define ELF_DATA ELFDATA2MSB
#else
#error "Unknown byte order"
#endif
#define __elfN(x) __CONCAT(__CONCAT(__CONCAT(elf,__ELF_WORD_SIZE),_),x)
#define __ElfN(x) __CONCAT(__CONCAT(__CONCAT(Elf,__ELF_WORD_SIZE),_),x)
#define __ELFN(x) __CONCAT(__CONCAT(__CONCAT(ELF,__ELF_WORD_SIZE),_),x)
#define __ElfType(x) typedef __ElfN(x) __CONCAT(Elf_,x)
__ElfType(Addr);
__ElfType(Half);
__ElfType(Off);
__ElfType(Sword);
__ElfType(Word);
__ElfType(Ehdr);
__ElfType(Shdr);
__ElfType(Phdr);
__ElfType(Dyn);
__ElfType(Rel);
__ElfType(Rela);
__ElfType(Sym);
__ElfType(Verdef);
__ElfType(Verdaux);
__ElfType(Verneed);
__ElfType(Vernaux);
__ElfType(Versym);
/* Non-standard ELF types. */
__ElfType(Hashelt);
__ElfType(Size);
__ElfType(Ssize);
#define ELF_R_SYM __ELFN(R_SYM)
#define ELF_R_TYPE __ELFN(R_TYPE)
#define ELF_R_INFO __ELFN(R_INFO)
#define ELF_ST_BIND __ELFN(ST_BIND)
#define ELF_ST_TYPE __ELFN(ST_TYPE)
#define ELF_ST_INFO __ELFN(ST_INFO)
#endif /* !_SYS_ELF_GENERIC_H_ */

View File

@ -35,6 +35,7 @@ Abstract:
#include <string.h> #include <string.h>
#include "VirtualMemory.h" #include "VirtualMemory.h"
#include "EfiUtilityMsgs.h" #include "EfiUtilityMsgs.h"
#include "ParseInf.h"
#define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000 #define EFI_PAGE_BASE_OFFSET_IN_LDR 0x70000
#define EFI_PAGE_BASE_ADDRESS (EFI_PAGE_BASE_OFFSET_IN_LDR + 0x20000) #define EFI_PAGE_BASE_ADDRESS (EFI_PAGE_BASE_OFFSET_IN_LDR + 0x20000)
@ -252,7 +253,7 @@ return:
FileSize = ftell (NoPageFile); FileSize = ftell (NoPageFile);
fseek (NoPageFile, 0, SEEK_SET); fseek (NoPageFile, 0, SEEK_SET);
if (FileSize > gPageTableOffsetInFile) { if (FileSize > gPageTableOffsetInFile) {
Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%x) exceeds the Page Table Offset (0x%x)", FileSize, gPageTableOffsetInFile); Error (NoPageFileName, 0, 0x4002, "Invalid parameter option", "Input file size (0x%lx) exceeds the Page Table Offset (0x%x)", FileSize, (unsigned) gPageTableOffsetInFile);
fclose (PageFile); fclose (PageFile);
fclose (NoPageFile); fclose (NoPageFile);
return -1; return -1;
@ -380,7 +381,7 @@ main (
return STATUS_ERROR; return STATUS_ERROR;
} }
if (TempValue > 9) { if (TempValue > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", TempValue); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) TempValue);
return STATUS_ERROR; return STATUS_ERROR;
} }
argc -= 2; argc -= 2;

View File

@ -160,7 +160,8 @@ Returns:
EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\ EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION,\n\
EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\ EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW,\n\
EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\ EFI_SECTION_FREEFORM_SUBTYPE_GUID,\n\
EFI_SECTION_PEI_DEPEX. if -s option is not given, \n\ EFI_SECTION_PEI_DEPEX, EFI_SECTION_SMM_DEPEX.\n\
if -s option is not given, \n\
EFI_SECTION_ALL is default section type.\n"); EFI_SECTION_ALL is default section type.\n");
fprintf (stdout, " -c [Type], --compress [Type]\n\ fprintf (stdout, " -c [Type], --compress [Type]\n\
Compress method type can be PI_NONE or PI_STD.\n\ Compress method type can be PI_NONE or PI_STD.\n\
@ -282,16 +283,16 @@ Returns:
fseek (InFile, 0, SEEK_END); fseek (InFile, 0, SEEK_END);
InputFileLength = ftell (InFile); InputFileLength = ftell (InFile);
fseek (InFile, 0, SEEK_SET); fseek (InFile, 0, SEEK_SET);
DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %d bytes", InputFileName[0], InputFileLength); DebugMsg (NULL, 0, 9, "Input file", "File name is %s and File size is %u bytes", InputFileName[0], (unsigned) InputFileLength);
TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength; TotalLength = sizeof (EFI_COMMON_SECTION_HEADER) + InputFileLength;
// //
// Size must fit in 3 bytes // Size must fit in 3 bytes
// //
if (TotalLength >= MAX_SECTION_SIZE) { if (TotalLength >= MAX_SECTION_SIZE) {
Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%dM).", InputFileName[0], TotalLength, MAX_SECTION_SIZE>>20); Error (NULL, 0, 2000, "Invalid paramter", "%s file size (0x%X) exceeds section size limit(%uM).", InputFileName[0], (unsigned) TotalLength, MAX_SECTION_SIZE>>20);
goto Done; goto Done;
} }
VerboseMsg ("the size of the created section file is %d bytes", TotalLength); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
// //
// Fill in the fields in the local section header structure // Fill in the fields in the local section header structure
// //
@ -404,7 +405,7 @@ Returns:
fseek (InFile, 0, SEEK_END); fseek (InFile, 0, SEEK_END);
FileSize = ftell (InFile); FileSize = ftell (InFile);
fseek (InFile, 0, SEEK_SET); fseek (InFile, 0, SEEK_SET);
DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %d bytes", InputFileName[Index], FileSize); DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
// //
// Now read the contents of the file into the buffer // Now read the contents of the file into the buffer
// Buffer must be enough to contain the file content. // Buffer must be enough to contain the file content.
@ -561,10 +562,10 @@ Returns:
} }
DebugMsg (NULL, 0, 9, "comprss file size", DebugMsg (NULL, 0, 9, "comprss file size",
"the original section size is %d bytes and the compressed section size is %d bytes", InputLength, CompressedLength); "the original section size is %d bytes and the compressed section size is %u bytes", (unsigned) InputLength, (unsigned) CompressedLength);
TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION); TotalLength = CompressedLength + sizeof (EFI_COMPRESSION_SECTION);
if (TotalLength >= MAX_SECTION_SIZE) { if (TotalLength >= MAX_SECTION_SIZE) {
Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20); Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
if (FileBuffer != NULL) { if (FileBuffer != NULL) {
free (FileBuffer); free (FileBuffer);
} }
@ -573,7 +574,7 @@ Returns:
} }
return STATUS_ERROR; return STATUS_ERROR;
} }
VerboseMsg ("the size of the created section file is %d bytes", TotalLength); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
// //
// Add the section header for the compressed data // Add the section header for the compressed data
@ -708,7 +709,7 @@ Returns:
TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER); TotalLength = InputLength + sizeof (CRC32_SECTION_HEADER);
if (TotalLength >= MAX_SECTION_SIZE) { if (TotalLength >= MAX_SECTION_SIZE) {
Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20); Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
free (FileBuffer); free (FileBuffer);
return STATUS_ERROR; return STATUS_ERROR;
} }
@ -722,12 +723,12 @@ Returns:
Crc32GuidSect->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID; Crc32GuidSect->GuidSectionHeader.Attributes = EFI_GUIDED_SECTION_AUTH_STATUS_VALID;
Crc32GuidSect->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER); Crc32GuidSect->GuidSectionHeader.DataOffset = sizeof (CRC32_SECTION_HEADER);
Crc32GuidSect->CRC32Checksum = Crc32Checksum; Crc32GuidSect->CRC32Checksum = Crc32Checksum;
DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", Crc32GuidSect->GuidSectionHeader.DataOffset); DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", Crc32GuidSect->GuidSectionHeader.DataOffset);
} else { } else {
TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION); TotalLength = InputLength + sizeof (EFI_GUID_DEFINED_SECTION);
if (TotalLength >= MAX_SECTION_SIZE) { if (TotalLength >= MAX_SECTION_SIZE) {
Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%dM).", MAX_SECTION_SIZE>>20); Error (NULL, 0, 2000, "Invalid paramter", "The size of all files exceeds section size limit(%uM).", MAX_SECTION_SIZE>>20);
free (FileBuffer); free (FileBuffer);
return STATUS_ERROR; return STATUS_ERROR;
} }
@ -739,10 +740,10 @@ Returns:
VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16); VendorGuidSect->CommonHeader.Size[2] = (UINT8) ((TotalLength & 0xff0000) >> 16);
memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID)); memcpy (&(VendorGuidSect->SectionDefinitionGuid), VendorGuid, sizeof (EFI_GUID));
VendorGuidSect->Attributes = DataAttribute; VendorGuidSect->Attributes = DataAttribute;
VendorGuidSect->DataOffset = sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize; VendorGuidSect->DataOffset = (UINT16) (sizeof (EFI_GUID_DEFINED_SECTION) + DataHeaderSize);
DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %d", VendorGuidSect->DataOffset); DebugMsg (NULL, 0, 9, "Guided section", "Data offset is %u", VendorGuidSect->DataOffset);
} }
VerboseMsg ("the size of the created section file is %d bytes", TotalLength); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) TotalLength);
// //
// Set OutFileBuffer // Set OutFileBuffer
@ -785,7 +786,7 @@ Returns:
CHAR8 *CompressionName; CHAR8 *CompressionName;
CHAR8 *StringBuffer; CHAR8 *StringBuffer;
EFI_GUID VendorGuid = mZeroGuid; EFI_GUID VendorGuid = mZeroGuid;
INT32 VersionNumber; int VersionNumber;
UINT8 SectType; UINT8 SectType;
UINT8 SectCompSubType; UINT8 SectCompSubType;
UINT16 SectGuidAttribute; UINT16 SectGuidAttribute;
@ -972,7 +973,7 @@ Returns:
goto Finish; goto Finish;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0~9, currnt input level is %d", (int) LogLevel);
goto Finish; goto Finish;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);
@ -1059,7 +1060,7 @@ Returns:
SectGuidAttribute = 0; SectGuidAttribute = 0;
} }
VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X", VerboseMsg ("Vendor Guid is %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X",
VendorGuid.Data1, (unsigned) VendorGuid.Data1,
VendorGuid.Data2, VendorGuid.Data2,
VendorGuid.Data3, VendorGuid.Data3,
VendorGuid.Data4[0], VendorGuid.Data4[0],
@ -1077,7 +1078,7 @@ Returns:
VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]); VerboseMsg ("Guid Attribute is %s", mGUIDedSectionAttribue[EFI_GUIDED_SECTION_AUTH_STATUS_VALID]);
} }
if (SectGuidHeaderLength != 0) { if (SectGuidHeaderLength != 0) {
VerboseMsg ("Guid Data Header size is 0x%x", SectGuidHeaderLength); VerboseMsg ("Guid Data Header size is 0x%llx", (unsigned long long) SectGuidHeaderLength);
} }
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) { } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_PE32]) == 0) {
SectType = EFI_SECTION_PE32; SectType = EFI_SECTION_PE32;
@ -1087,6 +1088,8 @@ Returns:
SectType = EFI_SECTION_TE; SectType = EFI_SECTION_TE;
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) { } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_DXE_DEPEX]) == 0) {
SectType = EFI_SECTION_DXE_DEPEX; SectType = EFI_SECTION_DXE_DEPEX;
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_SMM_DEPEX]) == 0) {
SectType = EFI_SECTION_SMM_DEPEX;
} else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) { } else if (stricmp (SectionName, mSectionTypeName[EFI_SECTION_VERSION]) == 0) {
SectType = EFI_SECTION_VERSION; SectType = EFI_SECTION_VERSION;
if (VersionNumber < 0 || VersionNumber > 9999) { if (VersionNumber < 0 || VersionNumber > 9999) {
@ -1139,7 +1142,7 @@ Returns:
// Check whether there is output file // Check whether there is output file
// //
for (Index = 0; Index < InputFileNum; Index ++) { for (Index = 0; Index < InputFileNum; Index ++) {
VerboseMsg ("the %dth input file name is %s", Index, InputFileName[Index]); VerboseMsg ("the %uth input file name is %s", (unsigned) Index, InputFileName[Index]);
} }
if (OutputFileName == NULL) { if (OutputFileName == NULL) {
Error (NULL, 0, 1001, "Missing options", "Output file"); Error (NULL, 0, 1001, "Missing options", "Output file");
@ -1199,7 +1202,7 @@ Returns:
VersionSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16); VersionSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
VersionSect->BuildNumber = (UINT16) VersionNumber; VersionSect->BuildNumber = (UINT16) VersionNumber;
Ascii2UnicodeString (StringBuffer, VersionSect->VersionString); Ascii2UnicodeString (StringBuffer, VersionSect->VersionString);
VerboseMsg ("the size of the created section file is %d bytes", Index); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
break; break;
case EFI_SECTION_USER_INTERFACE: case EFI_SECTION_USER_INTERFACE:
@ -1219,7 +1222,7 @@ Returns:
UiSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8); UiSect->CommonHeader.Size[1] = (UINT8) ((Index & 0xff00) >> 8);
UiSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16); UiSect->CommonHeader.Size[2] = (UINT8) ((Index & 0xff0000) >> 16);
Ascii2UnicodeString (StringBuffer, UiSect->FileNameString); Ascii2UnicodeString (StringBuffer, UiSect->FileNameString);
VerboseMsg ("the size of the created section file is %d bytes", Index); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) Index);
break; break;
case EFI_SECTION_ALL: case EFI_SECTION_ALL:
@ -1250,7 +1253,7 @@ Returns:
&InputLength &InputLength
); );
} }
VerboseMsg ("the size of the created section file is %d bytes", InputLength); VerboseMsg ("the size of the created section file is %u bytes", (unsigned) InputLength);
break; break;
default: default:
// //
@ -1266,7 +1269,7 @@ Returns:
} }
if (Status != EFI_SUCCESS || OutFileBuffer == NULL) { if (Status != EFI_SUCCESS || OutFileBuffer == NULL) {
Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (UINTN) Status); Error (NULL, 0, 2000, "Status is not successful", "Status value is 0x%X", (int) Status);
goto Finish; goto Finish;
} }

View File

@ -122,8 +122,8 @@ Returns:
CHAR8 StrPtr[40]; CHAR8 StrPtr[40];
CHAR8 *Token; CHAR8 *Token;
UINTN Length; UINTN Length;
UINT32 Major; unsigned Major;
UINT32 Minor; unsigned Minor;
Major = 0; Major = 0;
Minor = 0; Minor = 0;
@ -278,7 +278,7 @@ InitializeComps (
Routine Description: Routine Description:
This function intializes the relevant global variable which is being This function initializes the relevant global variable which is being
used to store the information retrieved from INF file. This also initializes used to store the information retrieved from INF file. This also initializes
the VTF symbol file. the VTF symbol file.
@ -316,7 +316,7 @@ ParseAndUpdateComponents (
Routine Description: Routine Description:
This function intializes the relevant global variable which is being This function initializes the relevant global variable which is being
used to store the information retrieved from INF file. used to store the information retrieved from INF file.
Arguments: Arguments:
@ -347,7 +347,7 @@ Returns:
} else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) { } else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) {
TokenStr++; TokenStr++;
if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) { if (AsciiStringToUint64 (*TokenStr, FALSE, &StringValue) != EFI_SUCCESS) {
Error (NULL, 0, 5001, "Cannot get: \"0x%x\".", *TokenStr); Error (NULL, 0, 5001, "Cannot get: \"0x%s\".", *TokenStr);
return ; return ;
} }
@ -1970,7 +1970,7 @@ Returns:
Fv1BaseAddress = StartAddress1; Fv1BaseAddress = StartAddress1;
Fv1EndAddress = Fv1BaseAddress + Size1; Fv1EndAddress = Fv1BaseAddress + Size1;
if (Fv1EndAddress != 0x100000000 || Size1 < 0x100000) { if (Fv1EndAddress != 0x100000000ULL || Size1 < 0x100000) {
Error (NULL, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!"); Error (NULL, 0, 2000, "Invalid parameter", "Error BaseAddress and Size parameters!");
if (Size1 < 0x100000) { if (Size1 < 0x100000) {
Error (NULL, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!"); Error (NULL, 0, 2000, "Invalid parameter", "The FwVolumeSize must be larger than 1M!");
@ -2281,11 +2281,7 @@ Returns:
// //
TokenAddress += BaseAddress &~IPF_CACHE_BIT; TokenAddress += BaseAddress &~IPF_CACHE_BIT;
#ifdef __GNUC__ fprintf (DestFile, "%s | %016llX | %s | %s%s\n", Type, (unsigned long long) TokenAddress, Section, BaseToken, Token);
fprintf (DestFile, "%s | %016lX | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);
#else
fprintf (DestFile, "%s | %016I64X | %s | %s%s\n", Type, TokenAddress, Section, BaseToken, Token);
#endif
} }
} }
@ -2689,7 +2685,7 @@ Returns:
break; break;
case EFI_ABORTED: case EFI_ABORTED:
Error (NULL, 0, 3000, "Invaild", "Error detected while creating the file image."); Error (NULL, 0, 3000, "Invalid", "Error detected while creating the file image.");
break; break;
case EFI_OUT_OF_RESOURCES: case EFI_OUT_OF_RESOURCES:
@ -2697,11 +2693,11 @@ Returns:
break; break;
case EFI_VOLUME_CORRUPTED: case EFI_VOLUME_CORRUPTED:
Error (NULL, 0, 3000, "Invaild", "No base address was specified."); Error (NULL, 0, 3000, "Invalid", "No base address was specified.");
break; break;
default: default:
Error (NULL, 0, 3000, "Invaild", "GenVtfImage function returned unknown status %x.",Status ); Error (NULL, 0, 3000, "Invalid", "GenVtfImage function returned unknown status %x.", (int) Status );
break; break;
} }
} }

View File

@ -33,6 +33,9 @@ Abstract:
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#ifndef __GNUC__
#include <io.h>
#endif
#include "assert.h" #include "assert.h"
#include <Common/PiFirmwareFile.h> #include <Common/PiFirmwareFile.h>
#include "ParseInf.h" #include "ParseInf.h"

View File

@ -27,6 +27,9 @@ Abstract:
#include <string.h> #include <string.h>
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>
#include "ParseInf.h"
#include "EfiUtilityMsgs.h"
// //
// Utility Name // Utility Name
// //
@ -293,10 +296,10 @@ PrintUsage (
[-h, --help]\n"); [-h, --help]\n");
} }
INTN int
main ( main (
INTN argc, int argc,
CHAR8 *argv[] char *argv[]
) )
{ {
CHAR8 *AppName; CHAR8 *AppName;
@ -393,7 +396,7 @@ main (
return 1; return 1;
} }
if (LogLevel > 9) { if (LogLevel > 9) {
Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", LogLevel); Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);
return 1; return 1;
} }
SetPrintLevel (LogLevel); SetPrintLevel (LogLevel);

View File

@ -26,7 +26,7 @@
#include <stdarg.h> #include <stdarg.h>
// //
// Modifiers to absract standard types to aid in debug of problems // Modifiers to abstract standard types to aid in debug of problems
// //
#define CONST const #define CONST const
#define STATIC static #define STATIC static
@ -38,8 +38,8 @@
// //
#ifndef IN #ifndef IN
// //
// Some other envirnments use this construct, so #ifndef to prevent // Some other environments use this construct, so #ifndef to prevent
// mulitple definition. // multiple definition.
// //
#define IN #define IN
#define OUT #define OUT
@ -68,13 +68,13 @@
// //
// Support for variable length argument lists using the ANSI standard. // Support for variable length argument lists using the ANSI standard.
// //
// Since we are using the ANSI standard we used the standard nameing and // Since we are using the ANSI standard we used the standard naming and
// did not folow the coding convention // did not follow the coding convention
// //
// VA_LIST - typedef for argument list. // VA_LIST - typedef for argument list.
// VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use. // VA_START (VA_LIST Marker, argument before the ...) - Init Marker for use.
// VA_END (VA_LIST Marker) - Clear Marker // VA_END (VA_LIST Marker) - Clear Marker
// VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argumnet from // VA_ARG (VA_LIST Marker, var arg size) - Use Marker to get an argument from
// the ... list. You must know the size and pass it in this macro. // the ... list. You must know the size and pass it in this macro.
// //
// example: // example:
@ -136,12 +136,12 @@
#define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field))) #define _CR(Record, TYPE, Field) ((TYPE *) ((CHAR8 *) (Record) - (CHAR8 *) &(((TYPE *) 0)->Field)))
/// ///
/// ALIGN_POINTER - aligns a pointer to the lowest boundry /// ALIGN_POINTER - aligns a pointer to the lowest boundary
/// ///
#define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1)))) #define ALIGN_POINTER(p, s) ((VOID *) ((UINTN)(p) + (((s) - ((UINTN) (p))) & ((s) - 1))))
/// ///
/// ALIGN_VARIABLE - aligns a variable up to the next natural boundry for int size of a processor /// ALIGN_VARIABLE - aligns a variable up to the next natural boundary for int size of a processor
/// ///
#define ALIGN_VARIABLE(Value, Adjustment) \ #define ALIGN_VARIABLE(Value, Adjustment) \
Adjustment = 0U; \ Adjustment = 0U; \

View File

@ -134,6 +134,7 @@ typedef UINT8 EFI_SECTION_TYPE;
#define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18 #define EFI_SECTION_FREEFORM_SUBTYPE_GUID 0x18
#define EFI_SECTION_RAW 0x19 #define EFI_SECTION_RAW 0x19
#define EFI_SECTION_PEI_DEPEX 0x1B #define EFI_SECTION_PEI_DEPEX 0x1B
#define EFI_SECTION_SMM_DEPEX 0x1C
typedef struct { typedef struct {
UINT8 Size[3]; UINT8 Size[3];

View File

@ -1,7 +1,7 @@
/** @file /** @file
Defines for the EFI Capsule functionality. Defines for the EFI Capsule functionality.
Copyright (c) 2006 - 2008, Intel Corporation All rights reserved. Copyright (c) 2006 - 2009, Intel Corporation All rights reserved.
This program and the accompanying materials are licensed and made available This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this under the terms and conditions of the BSD License which accompanies this
@ -30,5 +30,6 @@ typedef struct {
#define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000 #define CAPSULE_FLAGS_PERSIST_ACROSS_RESET 0x00010000
#define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000 #define CAPSULE_FLAGS_POPULATE_SYSTEM_TABLE 0x00020000
#define CAPSULE_FLAGS_INITIATE_RESET 0x00040000
#endif // #ifndef _EFI_CAPSULE_H_ #endif // #ifndef _EFI_CAPSULE_H_

View File

@ -839,7 +839,7 @@ typedef struct _EFI_IFR_REF4 {
typedef struct _EFI_IFR_RESET_BUTTON { typedef struct _EFI_IFR_RESET_BUTTON {
EFI_IFR_OP_HEADER Header; EFI_IFR_OP_HEADER Header;
EFI_IFR_QUESTION_HEADER Question; EFI_IFR_STATEMENT_HEADER Statement;
EFI_DEFAULT_ID DefaultId; EFI_DEFAULT_ID DefaultId;
} EFI_IFR_RESET_BUTTON; } EFI_IFR_RESET_BUTTON;

View File

@ -54,7 +54,7 @@
#pragma warning ( disable : 4057 ) #pragma warning ( disable : 4057 )
// //
// ASSERT(FALSE) or while (TRUE) are legal constructes so supress this warning // ASSERT(FALSE) or while (TRUE) are legal constructs so suppress this warning
// //
#pragma warning ( disable : 4127 ) #pragma warning ( disable : 4127 )
@ -141,7 +141,7 @@ typedef INT32 INTN;
// //
// Modifier to ensure that all protocol member functions and EFI intrinsics // Modifier to ensure that all protocol member functions and EFI intrinsics
// use the correct C calling convention. All protocol member functions and // use the correct C calling convention. All protocol member functions and
// EFI intrinsics are required to modify thier member functions with EFIAPI. // EFI intrinsics are required to modify their member functions with EFIAPI.
// //
#if _MSC_EXTENSIONS #if _MSC_EXTENSIONS
// //

View File

@ -114,6 +114,7 @@ typedef struct {
#define EFI_ACPI_1_0_TMR_VAL_EXT (1 << 8) #define EFI_ACPI_1_0_TMR_VAL_EXT (1 << 8)
#define EFI_ACPI_1_0_DCK_CAP (1 << 9) #define EFI_ACPI_1_0_DCK_CAP (1 << 9)
#define EFI_ACPI_1_0_FIRMWARE_ACPI_CONTROL_STRUCTURE_VERSION 0x0
// //
// Firmware ACPI Control Structure // Firmware ACPI Control Structure
// //

View File

@ -208,7 +208,7 @@ int main2(int numArgs, const char *args[], char *rs)
CFileSeqInStream inStream; CFileSeqInStream inStream;
CFileOutStream outStream; CFileOutStream outStream;
int res; int res;
int encodeMode; int encodeMode = 0;
Bool modeWasSet = False; Bool modeWasSet = False;
const char *inputFile = NULL; const char *inputFile = NULL;
const char *outputFile = "file.tmp"; const char *outputFile = "file.tmp";

View File

@ -25,7 +25,7 @@ endif
INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE)
CPPFLAGS = $(INCLUDE) CPPFLAGS = $(INCLUDE)
CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -c -g CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -fno-merge-constants -nostdlib -Wall -Werror -c -g
.PHONY: all .PHONY: all
.PHONY: install .PHONY: install

View File

@ -44,6 +44,6 @@ LINKER = $(LD)
INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC) INC = -I . -I $(SOURCE_PATH)\Include -I $(ARCH_INCLUDE) -I $(SOURCE_PATH)\Common $(INC)
CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE CFLAGS = $(CFLAGS) /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /W4 /WX /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE
CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE CPPFLAGS = $(CPPFLAGS) /EHsc /nologo /c /Zi /Od /RTC1 /D _DEBUG /MTd /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE

View File

@ -19,6 +19,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#include <stdlib.h> #include <stdlib.h>
#ifdef __GNUC__ #ifdef __GNUC__
#include <unistd.h> #include <unistd.h>
#else
#include <direct.h>
#endif #endif
#include <ctype.h> #include <ctype.h>
#include "ParseInf.h" #include "ParseInf.h"
@ -219,7 +221,7 @@ Returns:
CHAR8 *OutputDir = NULL; CHAR8 *OutputDir = NULL;
CHAR8 *OutFileName1 = NULL; CHAR8 *OutFileName1 = NULL;
CHAR8 *OutFileName2 = NULL; CHAR8 *OutFileName2 = NULL;
UINT64 SplitValue = -1; UINT64 SplitValue = (UINT64) -1;
FILE *Out1; FILE *Out1;
FILE *Out2; FILE *Out2;
CHAR8 *OutName1 = NULL; CHAR8 *OutName1 = NULL;

View File

@ -84,7 +84,7 @@ STATIC UINT16 *mFreq, *mSortPtr, mLenCnt[17], mLeft[2 * NC - 1], mRight[2 * NC -
STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL; STATIC NODE mPos, mMatchPos, mAvail, *mPosition, *mParent, *mPrev, *mNext = NULL;
static UINTN DebugLevel; static UINT64 DebugLevel;
static BOOLEAN DebugMode; static BOOLEAN DebugMode;
// //
// functions // functions
@ -185,7 +185,6 @@ Returns:
*DstSize = mCompSize + 1 + 8; *DstSize = mCompSize + 1 + 8;
return EFI_SUCCESS; return EFI_SUCCESS;
} }
return EFI_SUCCESS;
} }
STATIC STATIC

View File

@ -202,6 +202,10 @@ CVfrErrorHandle::PrintMsg (
CHAR8 *FileName = NULL; CHAR8 *FileName = NULL;
UINT32 FileLine; UINT32 FileLine;
if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {
VerboseMsg (ErrorMsg);
return;
}
GetFileNameLineNum (LineNum, &FileName, &FileLine); GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg); Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg);
} }

View File

@ -787,11 +787,22 @@ CIfrRecordInfoDB::IfrRecordInfoUpdate (
) )
{ {
SIfrRecord *pNode; SIfrRecord *pNode;
SIfrRecord *Prev;
if ((pNode = GetRecordInfoFromIdx (RecordIdx)) == NULL) { if ((pNode = GetRecordInfoFromIdx (RecordIdx)) == NULL) {
return; return;
} }
if (LineNo == 0) {
//
// Line number is not specified explicitly, try to use line number of previous opcode
//
Prev = GetRecordInfoFromIdx (RecordIdx - 1);
if (Prev != NULL) {
LineNo = Prev->mLineNo;
}
}
pNode->mLineNo = LineNo; pNode->mLineNo = LineNo;
pNode->mOffset = Offset; pNode->mOffset = Offset;
pNode->mBinBufLen = BinBufLen; pNode->mBinBufLen = BinBufLen;

View File

@ -399,6 +399,7 @@ public:
}; };
static CIfrQuestionHeader *gCurrentQuestion = NULL; static CIfrQuestionHeader *gCurrentQuestion = NULL;
static CIfrObj *gCurrentIfrOpcode = NULL;
/* /*
* The definition of CIfrMinMaxStepData * The definition of CIfrMinMaxStepData
@ -537,6 +538,12 @@ public:
} }
EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) { EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
if (FormId == 0) {
//
// FormId can't be 0.
//
return VFR_RETURN_INVALID_PARAMETER;
}
if (CIfrForm::ChekFormIdFree (FormId) == FALSE) { if (CIfrForm::ChekFormIdFree (FormId) == FALSE) {
return VFR_RETURN_FORMID_REDEFINED; return VFR_RETURN_FORMID_REDEFINED;
} }
@ -856,7 +863,7 @@ private:
public: public:
CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton), CIfrResetButton () : CIfrObj (EFI_IFR_RESET_BUTTON_OP, (CHAR8 **)&mResetButton),
CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header), CIfrOpHeader (EFI_IFR_RESET_BUTTON_OP, &mResetButton->Header),
CIfrStatementHeader (&mResetButton->Question.Header) { CIfrStatementHeader (&mResetButton->Statement) {
mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD; mResetButton->DefaultId = EFI_HII_DEFAULT_CLASS_STANDARD;
} }
@ -975,10 +982,12 @@ public:
CIfrMinMaxStepData (&mNumeric->data) { CIfrMinMaxStepData (&mNumeric->data) {
mNumeric->Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC; mNumeric->Flags = EFI_IFR_NUMERIC_SIZE_1 | EFI_IFR_DISPLAY_UINT_DEC;
gCurrentQuestion = this; gCurrentQuestion = this;
gCurrentIfrOpcode = this;
} }
~CIfrNumeric () { ~CIfrNumeric () {
gCurrentQuestion = NULL; gCurrentQuestion = NULL;
gCurrentIfrOpcode = NULL;
} }
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) { EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {
@ -1009,10 +1018,12 @@ public:
CIfrMinMaxStepData (&mOneOf->data) { CIfrMinMaxStepData (&mOneOf->data) {
mOneOf->Flags = 0; mOneOf->Flags = 0;
gCurrentQuestion = this; gCurrentQuestion = this;
gCurrentIfrOpcode = this;
} }
~CIfrOneOf () { ~CIfrOneOf () {
gCurrentQuestion = NULL; gCurrentQuestion = NULL;
gCurrentIfrOpcode = NULL;
} }
EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) { EFI_VFR_RETURN_CODE SetFlags (IN UINT8 HFlags, IN UINT8 LFlags) {

View File

@ -1087,9 +1087,73 @@ vfrStatementDefault :
D:Default << DObj.SetLineNo(D->getLine()); >> D:Default << DObj.SetLineNo(D->getLine()); >>
( (
( (
vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); >> vfrStatementValue "," << IsExp = TRUE; DObj.SetScope (1); CIfrEnd EndObj1; EndObj1.SetLineNo(D->getLine()); >>
| "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," | "=" vfrConstantValueField[_GET_CURRQEST_DATATYPE()] > [Val] "," <<
<< DObj.SetType (_GET_CURRQEST_DATATYPE()); DObj.SetValue(Val); >>
if (gCurrentIfrOpcode != NULL && gCurrentIfrOpcode->GetObjBinAddr() != NULL) {
EFI_IFR_OP_HEADER *TempOpCode;
TempOpCode = (EFI_IFR_OP_HEADER *) gCurrentIfrOpcode->GetObjBinAddr();
switch (TempOpCode->OpCode) {
case EFI_IFR_NUMERIC_OP:
EFI_IFR_NUMERIC *TempNumricCode;
TempNumricCode = (EFI_IFR_NUMERIC *) TempOpCode;
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64:
if (Val.u64 < TempNumricCode->data.u64.MinValue || Val.u64 > TempNumricCode->data.u64.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
if (Val.u32 < TempNumricCode->data.u32.MinValue || Val.u32 > TempNumricCode->data.u32.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
if (Val.u16 < TempNumricCode->data.u16.MinValue || Val.u16 > TempNumricCode->data.u16.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
if (Val.u8 < TempNumricCode->data.u8.MinValue || Val.u8 > TempNumricCode->data.u8.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "Numeric default value must be between MinValue and MaxValue.");
}
break;
}
break;
case EFI_IFR_ONE_OF_OP:
EFI_IFR_ONE_OF *TempOneOfCode;
TempOneOfCode = (EFI_IFR_ONE_OF *) TempOpCode;
if (TempOneOfCode->data.u64.MinValue != 0 || TempOneOfCode->data.u64.MaxValue != 0 || TempOneOfCode->data.u64.Step != 0) {
//OneOf MinMaxStep Data is set, Val value will be checked for MinMaxStep.
switch (_GET_CURRQEST_DATATYPE()) {
case EFI_IFR_TYPE_NUM_SIZE_64:
if (Val.u64 < TempOneOfCode->data.u64.MinValue || Val.u64 > TempOneOfCode->data.u64.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_32:
if (Val.u32 < TempOneOfCode->data.u32.MinValue || Val.u32 > TempOneOfCode->data.u32.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_16:
if (Val.u16 < TempOneOfCode->data.u16.MinValue || Val.u16 > TempOneOfCode->data.u16.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_8:
if (Val.u8 < TempOneOfCode->data.u8.MinValue || Val.u8 > TempOneOfCode->data.u8.MaxValue) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, D->getLine(), "OneOf default value must be between MinValue and MaxValue.");
}
break;
}
}
break;
}
}
DObj.SetType (_GET_CURRQEST_DATATYPE());
DObj.SetValue(Val);
>>
) )
{ {
DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >> DefaultStore "=" SN:StringIdentifier "," << _PCATCH(mCVfrDefaultStore.GetDefaultId (SN->getText(), &DefaultId), SN); DObj.SetDefaultId (DefaultId); >>
@ -1167,7 +1231,7 @@ flagsField :
vfrStatementValue : vfrStatementValue :
<< CIfrValue VObj; >> << CIfrValue VObj; >>
V:Value << VObj.SetLineNo(V->getLine()); >> V:Value << VObj.SetLineNo(V->getLine()); >>
"=" vfrStatementExpression[0] "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
; ;
vfrStatementSubTitle : vfrStatementSubTitle :
@ -1588,15 +1652,30 @@ vfrStatementDate :
; ;
minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] : minMaxDateStepDefault[EFI_HII_DATE & D, UINT8 KeyValue] :
Minimum "=" Number "," Minimum "=" MinN:Number ","
Maximum "=" Number "," Maximum "=" MaxN:Number ","
{ "step" "=" Number "," } { "step" "=" Number "," }
{ {
"default" "=" N:Number "," << "default" "=" N:Number "," <<
switch (KeyValue) { switch (KeyValue) {
case 0: D.Year = _STOU16(N->getText()); break; case 0:
case 1: D.Month = _STOU8(N->getText()); break; D.Year = _STOU16(N->getText());
case 2: D.Day = _STOU8(N->getText()); break; if (D.Year < _STOU16 (MinN->getText()) || D.Year > _STOU16 (MaxN->getText())) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Year default value must be between Min year and Max year.");
}
break;
case 1:
D.Month = _STOU8(N->getText());
if (D.Month < 1 || D.Month > 12) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Month default value must be between 1 and 12.");
}
break;
case 2:
D.Day = _STOU8(N->getText());
if (D.Day < 1 || D.Day > 31) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Day default value must be between 1 and 31.");
}
break;
} }
>> >>
} }
@ -1642,10 +1721,30 @@ vfrSetMinMaxStep[CIfrMinMaxStepData & MMSDObj] :
Maximum "=" A:Number "," Maximum "=" A:Number ","
<< <<
switch (_GET_CURRQEST_DATATYPE ()) { switch (_GET_CURRQEST_DATATYPE ()) {
case EFI_IFR_TYPE_NUM_SIZE_64 : MaxU8 = _STOU64(A->getText()); break; case EFI_IFR_TYPE_NUM_SIZE_64 :
case EFI_IFR_TYPE_NUM_SIZE_32 : MaxU4 = _STOU32(A->getText()); break; MaxU8 = _STOU64(A->getText());
case EFI_IFR_TYPE_NUM_SIZE_16 : MaxU2 = _STOU16(A->getText()); break; if (MaxU8 < MinU8) {
case EFI_IFR_TYPE_NUM_SIZE_8 : MaxU1 = _STOU8(A->getText()); break; _PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_32 :
MaxU4 = _STOU32(A->getText());
if (MaxU4 < MinU4) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_16 :
MaxU2 = _STOU16(A->getText());
if (MaxU2 < MinU2) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
case EFI_IFR_TYPE_NUM_SIZE_8 :
MaxU1 = _STOU8(A->getText());
if (MaxU1 < MinU1) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, A->getLine(), "Maximum can't be less than Minimum");
}
break;
} }
>> >>
{ {
@ -1894,9 +1993,24 @@ minMaxTimeStepDefault[EFI_HII_TIME & T, UINT8 KeyValue] :
{ {
"default" "=" N:Number "," << "default" "=" N:Number "," <<
switch (KeyValue) { switch (KeyValue) {
case 0: T.Hour = _STOU8(N->getText()); break; case 0:
case 1: T.Minute = _STOU8(N->getText()); break; T.Hour = _STOU8(N->getText());
case 2: T.Second = _STOU8(N->getText()); break; if (T.Hour > 23) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Hour default value must be between 0 and 23.");
}
break;
case 1:
T.Minute = _STOU8(N->getText());
if (T.Minute > 59) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Minute default value must be between 0 and 59.");
}
break;
case 2:
T.Second = _STOU8(N->getText());
if (T.Second > 59) {
_PCATCH (VFR_RETURN_INVALID_PARAMETER, N->getLine(), "Second default value must be between 0 and 59.");
}
break;
} }
>> >>
} }
@ -3090,7 +3204,6 @@ public:
VOID _STRCAT (IN OUT CHAR8 **, IN CHAR8 *); VOID _STRCAT (IN OUT CHAR8 **, IN CHAR8 *);
VOID _CRGUID (EFI_GUID *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *, CHAR8 *);
VOID _DeclareDefaultLinearVarStore (IN UINT32); VOID _DeclareDefaultLinearVarStore (IN UINT32);
VOID _DeclareStandardDefaultStorage (IN UINT32); VOID _DeclareStandardDefaultStorage (IN UINT32);
VOID _DeclareDefaultFrameworkVarStore (IN UINT32); VOID _DeclareDefaultFrameworkVarStore (IN UINT32);
@ -3490,35 +3603,6 @@ EfiVfrParser::_STRCAT (
*Dest = NewStr; *Dest = NewStr;
} }
VOID
EfiVfrParser::_CRGUID (
IN EFI_GUID *Guid,
IN CHAR8 *G1,
IN CHAR8 *G2,
IN CHAR8 *G3,
IN CHAR8 *G4,
IN CHAR8 *G5,
IN CHAR8 *G6,
IN CHAR8 *G7,
IN CHAR8 *G8,
IN CHAR8 *G9,
IN CHAR8 *G10,
IN CHAR8 *G11
)
{
Guid->Data1 = _STOU32 (G1);
Guid->Data2 = _STOU16 (G2);
Guid->Data3 = _STOU16 (G3);
Guid->Data4[0] = _STOU8(G4);
Guid->Data4[1] = _STOU8(G5);
Guid->Data4[2] = _STOU8(G6);
Guid->Data4[3] = _STOU8(G7);
Guid->Data4[4] = _STOU8(G8);
Guid->Data4[5] = _STOU8(G9);
Guid->Data4[6] = _STOU8(G10);
Guid->Data4[7] = _STOU8(G11);
}
// //
// framework vfr to default declare varstore for each structure // framework vfr to default declare varstore for each structure
// //

View File

@ -870,7 +870,7 @@ CVfrVarDataTypeDB::Pack (
SVfrPackStackNode *pNode = NULL; SVfrPackStackNode *pNode = NULL;
if (mPackStack == NULL) { if (mPackStack == NULL) {
gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "#pragma pack(pop...) : more pops than pushes"); gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "#pragma pack(pop...) : more pops than pushes");
} }
for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) { for (pNode = mPackStack; pNode != NULL; pNode = pNode->mNext) {
@ -884,7 +884,7 @@ CVfrVarDataTypeDB::Pack (
if (Action & VFR_PACK_ASSIGN) { if (Action & VFR_PACK_ASSIGN) {
PackAlign = (Number > 1) ? Number + Number % 2 : Number; PackAlign = (Number > 1) ? Number + Number % 2 : Number;
if ((PackAlign == 0) || (PackAlign > 16)) { if ((PackAlign == 0) || (PackAlign > 16)) {
gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", "expected pragma parameter to be '1', '2', '4', '8', or '16'"); gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
} else { } else {
mPackAlign = PackAlign; mPackAlign = PackAlign;
} }

View File

@ -2,7 +2,7 @@
Vfr common library functions. Vfr common library functions.
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2009, Intel Corporation
All rights reserved. This program and the accompanying materials All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License 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 which accompanies this distribution. The full text of the license may be found at
@ -421,7 +421,4 @@ public:
UINT8 GetRuleId (IN CHAR8 *); UINT8 GetRuleId (IN CHAR8 *);
}; };
#define MIN(v1, v2) (((v1) < (v2)) ? (v1) : (v2))
#define MAX(v1, v2) (((v1) > (v2)) ? (v1) : (v2))
#endif #endif

View File

@ -164,7 +164,7 @@ Returns:
EFI_FIRMWARE_VOLUME_HEADER *FvImage; EFI_FIRMWARE_VOLUME_HEADER *FvImage;
UINT32 FvSize; UINT32 FvSize;
EFI_STATUS Status; EFI_STATUS Status;
UINT32 Offset; int Offset;
BOOLEAN ErasePolarity; BOOLEAN ErasePolarity;
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
@ -622,8 +622,8 @@ Returns:
// //
// Print FV header information // Print FV header information
// //
printf ("Signature: %s (%X)\n", (char *) Signature, VolumeHeader.Signature); printf ("Signature: %s (%X)\n", (char *) Signature, (unsigned) VolumeHeader.Signature);
printf ("Attributes: %X\n", VolumeHeader.Attributes); printf ("Attributes: %X\n", (unsigned) VolumeHeader.Attributes);
if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) { if (VolumeHeader.Attributes & EFI_FVB2_READ_DISABLED_CAP) {
printf (" EFI_FVB2_READ_DISABLED_CAP\n"); printf (" EFI_FVB2_READ_DISABLED_CAP\n");
@ -907,8 +907,8 @@ Returns:
BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY); BytesRead += sizeof (EFI_FV_BLOCK_MAP_ENTRY);
if (BlockMap.NumBlocks != 0) { if (BlockMap.NumBlocks != 0) {
printf ("Number of Blocks: 0x%08X\n", BlockMap.NumBlocks); printf ("Number of Blocks: 0x%08X\n", (unsigned) BlockMap.NumBlocks);
printf ("Block Length: 0x%08X\n", BlockMap.Length); printf ("Block Length: 0x%08X\n", (unsigned) BlockMap.Length);
Size += BlockMap.NumBlocks * BlockMap.Length; Size += BlockMap.NumBlocks * BlockMap.Length;
} }
@ -924,7 +924,7 @@ Returns:
return EFI_ABORTED; return EFI_ABORTED;
} }
printf ("Total Volume Size: 0x%08X\n", Size); printf ("Total Volume Size: 0x%08X\n", (unsigned) Size);
*FvSize = Size; *FvSize = Size;
@ -998,7 +998,7 @@ Returns:
// //
FileLength = GetLength (FileHeader->Size); FileLength = GetLength (FileHeader->Size);
printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage)); printf ("File Offset: 0x%08X\n", (unsigned) ((UINTN) FileHeader - (UINTN) FvImage));
printf ("File Length: 0x%08X\n", FileLength); printf ("File Length: 0x%08X\n", (unsigned) FileLength);
printf ("File Attributes: 0x%02X\n", FileHeader->Attributes); printf ("File Attributes: 0x%02X\n", FileHeader->Attributes);
printf ("File State: 0x%02X\n", FileHeader->State); printf ("File State: 0x%02X\n", FileHeader->State);
@ -1242,7 +1242,7 @@ Returns:
SectionName = SectionNameToStr (Type); SectionName = SectionNameToStr (Type);
printf ("------------------------------------------------------------\n"); printf ("------------------------------------------------------------\n");
printf (" Type: %s\n Size: 0x%08X\n", SectionName, SectionLength); printf (" Type: %s\n Size: 0x%08X\n", SectionName, (unsigned) SectionLength);
free (SectionName); free (SectionName);
switch (Type) { switch (Type) {
@ -1288,7 +1288,7 @@ Returns:
CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION); CompressedLength = SectionLength - sizeof (EFI_COMPRESSION_SECTION);
UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength; UncompressedLength = ((EFI_COMPRESSION_SECTION *) Ptr)->UncompressedLength;
CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType; CompressionType = ((EFI_COMPRESSION_SECTION *) Ptr)->CompressionType;
printf (" Uncompressed Length: 0x%08X\n", UncompressedLength); printf (" Uncompressed Length: 0x%08X\n", (unsigned) UncompressedLength);
if (CompressionType == EFI_NOT_COMPRESSED) { if (CompressionType == EFI_NOT_COMPRESSED) {
printf (" Compression Type: EFI_NOT_COMPRESSED\n"); printf (" Compression Type: EFI_NOT_COMPRESSED\n");
@ -1342,7 +1342,7 @@ Returns:
return EFI_SECTION_ERROR; return EFI_SECTION_ERROR;
} }
} else { } else {
Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", (UINT32) CompressionType); Error (NULL, 0, 0003, "unrecognized compression type", "type 0x%X", CompressionType);
return EFI_SECTION_ERROR; return EFI_SECTION_ERROR;
} }
@ -1365,8 +1365,8 @@ Returns:
printf (" SectionDefinitionGuid: "); printf (" SectionDefinitionGuid: ");
PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid); PrintGuid (&((EFI_GUID_DEFINED_SECTION *) Ptr)->SectionDefinitionGuid);
printf ("\n"); printf ("\n");
printf (" DataOffset: 0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset); printf (" DataOffset: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->DataOffset);
printf (" Attributes: 0x%04X\n", ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes); printf (" Attributes: 0x%04X\n", (unsigned) ((EFI_GUID_DEFINED_SECTION *) Ptr)->Attributes);
ExtractionTool = ExtractionTool =
LookupGuidedSectionToolPath ( LookupGuidedSectionToolPath (
@ -1465,7 +1465,7 @@ Returns:
// //
// Unknown section, return error // Unknown section, return error
// //
Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", (UINT32) Type); Error (NULL, 0, 0003, "unrecognized section type found", "section type = 0x%X", Type);
return EFI_SECTION_ERROR; return EFI_SECTION_ERROR;
} }
@ -1588,7 +1588,7 @@ Returns:
break; break;
default: default:
printf ("Unrecognized byte in depex: 0x%X\n", (UINT32) *Ptr); printf ("Unrecognized byte in depex: 0x%X\n", *Ptr);
return EFI_SUCCESS; return EFI_SUCCESS;
} }
} }
@ -1732,11 +1732,14 @@ LoadGuidedSectionToolsTxt (
{ {
CHAR8* PeerFilename; CHAR8* PeerFilename;
CHAR8* Places[] = { CHAR8* Places[] = {
FirmwareVolumeFilename, NULL,
//mUtilityFilename, //NULL,
}; };
UINTN Index; UINTN Index;
Places[0] = FirmwareVolumeFilename;
//Places[1] = mUtilityFilename;
mParsedGuidedSectionTools = NULL; mParsedGuidedSectionTools = NULL;
for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) { for (Index = 0; Index < (sizeof(Places)/sizeof(Places[0])); Index++) {

View File

@ -1061,12 +1061,45 @@ class PlatformAutoGen(AutoGen):
# #
def _ExpandBuildOption(self, Options): def _ExpandBuildOption(self, Options):
BuildOptions = {} BuildOptions = {}
FamilyMatch = False
FamilyIsNull = True
for Key in Options: for Key in Options:
Family = Key[0] Family = Key[0]
Target, Tag, Arch, Tool, Attr = Key[1].split("_") Target, Tag, Arch, Tool, Attr = Key[1].split("_")
# if tool chain family doesn't match, skip it # if tool chain family doesn't match, skip it
if Family and Tool in self.ToolDefinition and Family != self.ToolDefinition[Tool]["FAMILY"]: if Tool in self.ToolDefinition and Family != "":
FamilyIsNull = False
if self.ToolDefinition[Tool].get(TAB_TOD_DEFINES_BUILDRULEFAMILY, "") != "":
if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_BUILDRULEFAMILY]:
continue continue
elif Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
continue
FamilyMatch = True
# expand any wildcard
if Target == "*" or Target == self.BuildTarget:
if Tag == "*" or Tag == self.ToolChain:
if Arch == "*" or Arch == self.Arch:
if Tool not in BuildOptions:
BuildOptions[Tool] = {}
if Attr != "FLAGS" or Attr not in BuildOptions[Tool]:
BuildOptions[Tool][Attr] = Options[Key]
else:
# append options for the same tool
BuildOptions[Tool][Attr] += " " + Options[Key]
# Build Option Family has been checked, which need't to be checked again for family.
if FamilyMatch or FamilyIsNull:
return BuildOptions
for Key in Options:
Family = Key[0]
Target, Tag, Arch, Tool, Attr = Key[1].split("_")
# if tool chain family doesn't match, skip it
if Tool not in self.ToolDefinition or Family =="":
continue
# option has been added before
if Family != self.ToolDefinition[Tool][TAB_TOD_DEFINES_FAMILY]:
continue
# expand any wildcard # expand any wildcard
if Target == "*" or Target == self.BuildTarget: if Target == "*" or Target == self.BuildTarget:
if Tag == "*" or Tag == self.ToolChain: if Tag == "*" or Tag == self.ToolChain:

View File

@ -1308,8 +1308,14 @@ ${END}\t@cd $(BUILD_DIR)\n
if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "": if PlatformInfo.FdfFile != None and PlatformInfo.FdfFile != "":
FdfFileList = [PlatformInfo.FdfFile] FdfFileList = [PlatformInfo.FdfFile]
# macros passed to GenFds # macros passed to GenFds
# MacroList.append('"%s=%s"' % ("WORKSPACE", GlobalData.gWorkspace))
MacroList.append('"%s=%s"' % ("EFI_SOURCE", GlobalData.gEfiSource))
MacroList.append('"%s=%s"' % ("EDK_SOURCE", GlobalData.gEdkSource))
for MacroName in GlobalData.gGlobalDefines: for MacroName in GlobalData.gGlobalDefines:
if GlobalData.gGlobalDefines[MacroName] != "":
MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName])) MacroList.append('"%s=%s"' % (MacroName, GlobalData.gGlobalDefines[MacroName]))
else:
MacroList.append('"%s"' % MacroName)
else: else:
FdfFileList = [] FdfFileList = []

View File

@ -171,7 +171,13 @@ def CreateHFileContent(BaseName, UniObjectClass):
if Name != None: if Name != None:
Line = '' Line = ''
if Referenced == True: if Referenced == True:
if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
Line = DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4)
else:
Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) Line = DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4)
else:
if (ValueStartPtr - len(DEFINE_STR + Name)) <= 0:
Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
else: else:
Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED Line = COMMENT_DEFINE_STR + ' ' + Name + ' ' * (ValueStartPtr - len(DEFINE_STR + Name)) + DecToHexStr(Token, 4) + COMMENT_NOT_REFERENCED
Str = WriteLine(Str, Line) Str = WriteLine(Str, Line)

View File

@ -385,6 +385,7 @@ class Dsc(DscObject):
for IncludeFile in IncludeFiles: for IncludeFile in IncludeFiles:
if IncludeFile[1] == Arch or IncludeFile[1] == TAB_ARCH_COMMON.upper(): if IncludeFile[1] == Arch or IncludeFile[1] == TAB_ARCH_COMMON.upper():
Filename = CheckFileExist(self.WorkspaceDir, IncludeFile[0], ContainerFile, TAB_LIBRARIES, '', IncludeFile[2]) Filename = CheckFileExist(self.WorkspaceDir, IncludeFile[0], ContainerFile, TAB_LIBRARIES, '', IncludeFile[2])
if os.path.exists(Filename):
for NewItem in open(Filename, 'r').readlines(): for NewItem in open(Filename, 'r').readlines():
if CleanString(NewItem) == '': if CleanString(NewItem) == '':
continue continue

View File

@ -1599,7 +1599,7 @@ class FdfParser(object):
if not self.__GetNextWord(): if not self.__GetNextWord():
return True return True
if not self.__Token in ("SET", "FV", "FILE", "DATA"): if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE"):
self.__UndoToken() self.__UndoToken()
RegionObj.PcdOffset = self.__GetNextPcdName() RegionObj.PcdOffset = self.__GetNextPcdName()
self.Profile.PcdDict[RegionObj.PcdOffset] = RegionObj.Offset + long(Fd.BaseAddress, 0) self.Profile.PcdDict[RegionObj.PcdOffset] = RegionObj.Offset + long(Fd.BaseAddress, 0)
@ -1620,10 +1620,14 @@ class FdfParser(object):
if not self.__GetNextWord(): if not self.__GetNextWord():
return True return True
if self.__Token == "FV": elif self.__Token == "FV":
self.__UndoToken() self.__UndoToken()
self.__GetRegionFvType( RegionObj) self.__GetRegionFvType( RegionObj)
elif self.__Token == "CAPSULE":
self.__UndoToken()
self.__GetRegionCapType( RegionObj)
elif self.__Token == "FILE": elif self.__Token == "FILE":
self.__UndoToken() self.__UndoToken()
self.__GetRegionFileType( RegionObj) self.__GetRegionFileType( RegionObj)
@ -1665,6 +1669,37 @@ class FdfParser(object):
RegionObj.RegionDataList.append(self.__Token) RegionObj.RegionDataList.append(self.__Token)
## __GetRegionCapType() method
#
# Get region capsule data for region
#
# @param self The object pointer
# @param RegionObj for whom region data is got
#
def __GetRegionCapType(self, RegionObj):
if not self.__IsKeyword("CAPSULE"):
raise Warning("expected Keyword 'CAPSULE' at line", self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
raise Warning("expected '=' at line", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
raise Warning("expected CAPSULE name at line", self.FileName, self.CurrentLineNumber)
RegionObj.RegionType = "CAPSULE"
RegionObj.RegionDataList.append(self.__Token)
while self.__IsKeyword("CAPSULE"):
if not self.__IsToken("="):
raise Warning("expected '=' at line", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
raise Warning("expected CAPSULE name at line", self.FileName, self.CurrentLineNumber)
RegionObj.RegionDataList.append(self.__Token)
## __GetRegionFileType() method ## __GetRegionFileType() method
# #
# Get region file data for region # Get region file data for region
@ -2713,7 +2748,7 @@ class FdfParser(object):
Arch = self.__SkippedChars.rstrip(".") Arch = self.__SkippedChars.rstrip(".")
if Arch.upper() not in ("IA32", "X64", "IPF", "EBC", "ARM", "COMMON"): if Arch.upper() not in ("IA32", "X64", "IPF", "EBC", "ARM", "COMMON"):
raise Warning("Unknown Arch At line ", self.FileName, self.CurrentLineNumber) raise Warning("Unknown Arch '%s'" % Arch, self.FileName, self.CurrentLineNumber)
ModuleType = self.__GetModuleType() ModuleType = self.__GetModuleType()
@ -2763,7 +2798,7 @@ class FdfParser(object):
"DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \
"UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \ "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \
"SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \ "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \
"PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION"): "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"):
raise Warning("Unknown Module type At line ", self.FileName, self.CurrentLineNumber) raise Warning("Unknown Module type At line ", self.FileName, self.CurrentLineNumber)
return self.__Token return self.__Token
@ -2803,11 +2838,11 @@ class FdfParser(object):
raise Warning("expected FILE At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected FILE At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextWord(): if not self.__GetNextWord():
raise Warning("expected FV type At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected FFS type At Line ", self.FileName, self.CurrentLineNumber)
Type = self.__Token.strip().upper() Type = self.__Token.strip().upper()
if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\ if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\
"PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE"): "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"):
raise Warning("Unknown FV type At line ", self.FileName, self.CurrentLineNumber) raise Warning("Unknown FV type At line ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="): if not self.__IsToken("="):

View File

@ -418,6 +418,14 @@ def RealPath(File, Dir='', OverrideDir=''):
return NewFile return NewFile
def RealPath2(File, Dir='', OverrideDir=''): def RealPath2(File, Dir='', OverrideDir=''):
if OverrideDir:
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
if NewFile:
if OverrideDir[-1] == os.path.sep:
return NewFile[len(OverrideDir):], NewFile[0:len(OverrideDir)]
else:
return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)]
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))] NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(Dir, File))]
if NewFile: if NewFile:
if Dir: if Dir:
@ -428,10 +436,6 @@ def RealPath2(File, Dir='', OverrideDir=''):
else: else:
return NewFile, '' return NewFile, ''
if OverrideDir:
NewFile = GlobalData.gAllFiles[os.path.normpath(os.path.join(OverrideDir, File))]
if NewFile:
return NewFile[len(OverrideDir)+1:], NewFile[0:len(OverrideDir)]
return None, None return None, None
## Check if gvien file exists or not ## Check if gvien file exists or not

View File

@ -29,6 +29,7 @@ from Common.FdfClassObject import Fdf
from Common.String import NormPath from Common.String import NormPath
from Common import BuildToolError from Common import BuildToolError
import c import c
import re, string
from Exception import * from Exception import *
## Ecc ## Ecc
@ -115,10 +116,11 @@ class Ecc(object):
Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+') Op = open(EccGlobalData.gConfig.MetaDataFileCheckPathOfGenerateFileList, 'w+')
#SkipDirs = Read from config file #SkipDirs = Read from config file
SkipDirs = EccGlobalData.gConfig.SkipDirList SkipDirs = EccGlobalData.gConfig.SkipDirList
SkipDirString = string.join(SkipDirs, '|')
p = re.compile(r'.*[\\/](?:%s)[\\/]?.*' % SkipDirString)
for Root, Dirs, Files in os.walk(EccGlobalData.gTarget): for Root, Dirs, Files in os.walk(EccGlobalData.gTarget):
for Dir in Dirs: if p.match(Root.upper()):
if Dir.upper() in SkipDirs: continue
Dirs.remove(Dir)
for Dir in Dirs: for Dir in Dirs:
Dirname = os.path.join(Root, Dir) Dirname = os.path.join(Root, Dir)

View File

@ -21,6 +21,7 @@ import os
import subprocess import subprocess
import StringIO import StringIO
from Common.Misc import SaveFileOnChange from Common.Misc import SaveFileOnChange
from GenFds import GenFds
T_CHAR_LF = '\n' T_CHAR_LF = '\n'
@ -39,17 +40,26 @@ class Capsule (CapsuleClassObject) :
self.BlockSize = None self.BlockSize = None
# For GenFv # For GenFv
self.BlockNum = None self.BlockNum = None
self.CapsuleName = None
## Generate capsule ## Generate capsule
# #
# @param self The object pointer # @param self The object pointer
# @retval string Generated Capsule file path
# #
def GenCapsule(self): def GenCapsule(self):
if self.UiCapsuleName.upper() + 'cap' in GenFds.ImageBinDict.keys():
return GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap']
GenFdsGlobalVariable.InfLogger( "\nGenerate %s Capsule" %self.UiCapsuleName)
CapInfFile = self.GenCapInf() CapInfFile = self.GenCapInf()
CapInfFile.writelines("[files]" + T_CHAR_LF) CapInfFile.writelines("[files]" + T_CHAR_LF)
CapFileList = []
for CapsuleDataObj in self.CapsuleDataList : for CapsuleDataObj in self.CapsuleDataList :
CapsuleDataObj.CapsuleName = self.CapsuleName
FileName = CapsuleDataObj.GenCapsuleSubItem() FileName = CapsuleDataObj.GenCapsuleSubItem()
CapsuleDataObj.CapsuleName = None
CapFileList.append(FileName)
CapInfFile.writelines("EFI_FILE_NAME = " + \ CapInfFile.writelines("EFI_FILE_NAME = " + \
FileName + \ FileName + \
T_CHAR_LF) T_CHAR_LF)
@ -63,9 +73,14 @@ class Capsule (CapsuleClassObject) :
GenFdsGlobalVariable.GenerateFirmwareVolume( GenFdsGlobalVariable.GenerateFirmwareVolume(
CapOutputFile, CapOutputFile,
[self.CapInfFileName], [self.CapInfFileName],
Capsule=True Capsule=True,
FfsList=CapFileList
) )
GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s Capsule Successfully" %self.UiCapsuleName)
GenFdsGlobalVariable.SharpCounter = 0 GenFdsGlobalVariable.SharpCounter = 0
GenFds.ImageBinDict[self.UiCapsuleName.upper() + 'cap'] = CapOutputFile
return CapOutputFile
## Generate inf file for capsule ## Generate inf file for capsule
# #

View File

@ -45,6 +45,7 @@ class CapsuleFfs (CapsuleData):
# #
def __init_(self) : def __init_(self) :
self.Ffs = None self.Ffs = None
self.FvName = None
## generate FFS capsule data ## generate FFS capsule data
# #
@ -64,7 +65,9 @@ class CapsuleFv (CapsuleData):
# @param self The object pointer # @param self The object pointer
# #
def __init__(self) : def __init__(self) :
self.Ffs = None
self.FvName = None self.FvName = None
self.CapsuleName = None
## generate FV capsule data ## generate FV capsule data
# #
@ -76,9 +79,11 @@ class CapsuleFv (CapsuleData):
if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper()) FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
FdBuffer = StringIO.StringIO('') FdBuffer = StringIO.StringIO('')
FvObj.CapsuleName = self.CapsuleName
FvFile = FvObj.AddToBuffer(FdBuffer) FvFile = FvObj.AddToBuffer(FdBuffer)
FvObj.CapsuleName = None
FdBuffer.close()
return FvFile return FvFile
else: else:
FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName) FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)
return FvFile return FvFile

View File

@ -26,6 +26,7 @@ from CommonDataClass.FdfClass import FDClassObject
from Common import EdkLogger from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
from Common.Misc import SaveFileOnChange from Common.Misc import SaveFileOnChange
from GenFds import GenFds
## generate FD ## generate FD
# #
@ -42,11 +43,12 @@ class FD(FDClassObject):
# #
# Generate FD # Generate FD
# #
# @param self The object pointer
# @param FvBinDict dictionary contains generated FV name and its file name
# @retval string Generated FD file name # @retval string Generated FD file name
# #
def GenFd (self, FvBinDict): def GenFd (self):
if self.FdUiName.upper() + 'fd' in GenFds.ImageBinDict.keys():
return GenFds.ImageBinDict[self.FdUiName.upper() + 'fd']
# #
# Print Information # Print Information
# #
@ -80,7 +82,7 @@ class FD(FDClassObject):
PadRegion = Region.Region() PadRegion = Region.Region()
PadRegion.Offset = PreviousRegionStart + PreviousRegionSize PadRegion.Offset = PreviousRegionStart + PreviousRegionSize
PadRegion.Size = RegionObj.Offset - PadRegion.Offset PadRegion.Size = RegionObj.Offset - PadRegion.Offset
PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, FvBinDict, self.vtfRawDict, self.DefineVarDict) PadRegion.AddToBuffer(FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
PreviousRegionStart = RegionObj.Offset PreviousRegionStart = RegionObj.Offset
PreviousRegionSize = RegionObj.Size PreviousRegionSize = RegionObj.Size
# #
@ -89,23 +91,19 @@ class FD(FDClassObject):
if PreviousRegionSize > self.Size: if PreviousRegionSize > self.Size:
EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s size too small' % self.FdUiName) EdkLogger.error("GenFds", GENFDS_ERROR, 'FD %s size too small' % self.FdUiName)
GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function') GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function')
RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, FvBinDict, self.vtfRawDict, self.DefineVarDict) RegionObj.AddToBuffer (FdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict)
# #
# Create a empty Fd file # Create a empty Fd file
# #
GenFdsGlobalVariable.VerboseLogger ('Create an empty Fd file') GenFdsGlobalVariable.VerboseLogger ('Create an empty Fd file')
FdFileName = os.path.join(GenFdsGlobalVariable.FvDir, FdFileName = os.path.join(GenFdsGlobalVariable.FvDir,self.FdUiName + '.fd')
self.FdUiName + '.fd')
#FdFile = open(FdFileName, 'wb')
# #
# Write the buffer contents to Fd file # Write the buffer contents to Fd file
# #
GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file') GenFdsGlobalVariable.VerboseLogger('Write the buffer contents to Fd file')
SaveFileOnChange(FdFileName, FdBuffer.getvalue()) SaveFileOnChange(FdFileName, FdBuffer.getvalue())
#FdFile.write(FdBuffer.getvalue());
#FdFile.close();
FdBuffer.close(); FdBuffer.close();
GenFds.ImageBinDict[self.FdUiName.upper() + 'fd'] = FdFileName
return FdFileName return FdFileName
## generate VTF ## generate VTF

View File

@ -173,7 +173,7 @@ class FileProfile :
self.FdDict = {} self.FdDict = {}
self.FvDict = {} self.FvDict = {}
self.CapsuleList = [] self.CapsuleDict = {}
self.VtfList = [] self.VtfList = []
self.RuleDict = {} self.RuleDict = {}
self.OptRomDict = {} self.OptRomDict = {}
@ -1622,7 +1622,7 @@ class FdfParser:
if not self.__GetNextWord(): if not self.__GetNextWord():
return True return True
if not self.__Token in ("SET", "FV", "FILE", "DATA"): if not self.__Token in ("SET", "FV", "FILE", "DATA", "CAPSULE"):
self.__UndoToken() self.__UndoToken()
RegionObj.PcdOffset = self.__GetNextPcdName() RegionObj.PcdOffset = self.__GetNextPcdName()
self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0)) self.Profile.PcdDict[RegionObj.PcdOffset] = "0x%08X" % (RegionObj.Offset + long(Fd.BaseAddress, 0))
@ -1639,10 +1639,14 @@ class FdfParser:
if not self.__GetNextWord(): if not self.__GetNextWord():
return True return True
if self.__Token == "FV": elif self.__Token == "FV":
self.__UndoToken() self.__UndoToken()
self.__GetRegionFvType( RegionObj) self.__GetRegionFvType( RegionObj)
elif self.__Token == "CAPSULE":
self.__UndoToken()
self.__GetRegionCapType( RegionObj)
elif self.__Token == "FILE": elif self.__Token == "FILE":
self.__UndoToken() self.__UndoToken()
self.__GetRegionFileType( RegionObj) self.__GetRegionFileType( RegionObj)
@ -1684,6 +1688,37 @@ class FdfParser:
RegionObj.RegionDataList.append(self.__Token) RegionObj.RegionDataList.append(self.__Token)
## __GetRegionCapType() method
#
# Get region capsule data for region
#
# @param self The object pointer
# @param RegionObj for whom region data is got
#
def __GetRegionCapType(self, RegionObj):
if not self.__IsKeyword("CAPSULE"):
raise Warning("expected Keyword 'CAPSULE'", self.FileName, self.CurrentLineNumber)
if not self.__IsToken("="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
raise Warning("expected CAPSULE name", self.FileName, self.CurrentLineNumber)
RegionObj.RegionType = "CAPSULE"
RegionObj.RegionDataList.append(self.__Token)
while self.__IsKeyword("CAPSULE"):
if not self.__IsToken("="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken():
raise Warning("expected CAPSULE name", self.FileName, self.CurrentLineNumber)
RegionObj.RegionDataList.append(self.__Token)
## __GetRegionFileType() method ## __GetRegionFileType() method
# #
# Get region file data for region # Get region file data for region
@ -2624,7 +2659,7 @@ class FdfParser:
CapsuleObj.CreateFile = self.__Token CapsuleObj.CreateFile = self.__Token
self.__GetCapsuleStatements(CapsuleObj) self.__GetCapsuleStatements(CapsuleObj)
self.Profile.CapsuleList.append(CapsuleObj) self.Profile.CapsuleDict[CapsuleObj.UiCapsuleName] = CapsuleObj
return True return True
## __GetCapsuleStatements() method ## __GetCapsuleStatements() method
@ -2638,10 +2673,9 @@ class FdfParser:
self.__GetCapsuleTokens(Obj) self.__GetCapsuleTokens(Obj)
self.__GetDefineStatements(Obj) self.__GetDefineStatements(Obj)
self.__GetSetStatements(Obj) self.__GetSetStatements(Obj)
self.__GetCapsuleData(Obj) self.__GetCapsuleData(Obj)
## __GetCapsuleStatements() method ## __GetCapsuleTokens() method
# #
# Get token statements for capsule # Get token statements for capsule
# #
@ -3558,12 +3592,14 @@ class FdfParser:
def __GetOptRomOverrides(self, Obj): def __GetOptRomOverrides(self, Obj):
if self.__IsToken('{'): if self.__IsToken('{'):
Overrides = OptionRom.OverrideAttribs() Overrides = OptionRom.OverrideAttribs()
while True:
if self.__IsKeyword( "PCI_VENDOR_ID"): if self.__IsKeyword( "PCI_VENDOR_ID"):
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex vendor id", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex vendor id", self.FileName, self.CurrentLineNumber)
Overrides.PciVendorId = self.__Token Overrides.PciVendorId = self.__Token
continue
if self.__IsKeyword( "PCI_CLASS_CODE"): if self.__IsKeyword( "PCI_CLASS_CODE"):
if not self.__IsToken( "="): if not self.__IsToken( "="):
@ -3571,6 +3607,7 @@ class FdfParser:
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex class code", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex class code", self.FileName, self.CurrentLineNumber)
Overrides.PciClassCode = self.__Token Overrides.PciClassCode = self.__Token
continue
if self.__IsKeyword( "PCI_DEVICE_ID"): if self.__IsKeyword( "PCI_DEVICE_ID"):
if not self.__IsToken( "="): if not self.__IsToken( "="):
@ -3579,6 +3616,7 @@ class FdfParser:
raise Warning("expected Hex device id", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex device id", self.FileName, self.CurrentLineNumber)
Overrides.PciDeviceId = self.__Token Overrides.PciDeviceId = self.__Token
continue
if self.__IsKeyword( "PCI_REVISION"): if self.__IsKeyword( "PCI_REVISION"):
if not self.__IsToken( "="): if not self.__IsToken( "="):
@ -3586,22 +3624,20 @@ class FdfParser:
if not self.__GetNextHexNumber(): if not self.__GetNextHexNumber():
raise Warning("expected Hex revision", self.FileName, self.CurrentLineNumber) raise Warning("expected Hex revision", self.FileName, self.CurrentLineNumber)
Overrides.PciRevision = self.__Token Overrides.PciRevision = self.__Token
continue
if self.__IsKeyword( "COMPRESS"): if self.__IsKeyword( "COMPRESS"):
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '='", self.FileName, self.CurrentLineNumber) raise Warning("expected '='", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken(): if not self.__GetNextToken():
raise Warning("expected TRUE/FALSE for compress", self.FileName, self.CurrentLineNumber) raise Warning("expected TRUE/FALSE for compress", self.FileName, self.CurrentLineNumber)
Overrides.NeedCompress = self.__Token.upper() == 'TRUE'
continue
if self.__Token.upper() == 'TRUE': if self.__IsToken( "}"):
Overrides.NeedCompress = True break
else:
if not self.__IsToken( "}"): EdkLogger.error("FdfParser", FORMAT_INVALID, File=self.FileName, Line=self.CurrentLineNumber)
if self.__Token not in ("PCI_CLASS_CODE", "PCI_VENDOR_ID", "PCI_DEVICE_ID", "PCI_REVISION", "COMPRESS"):
raise Warning("unknown attribute %s" % self.__Token, self.FileName, self.CurrentLineNumber)
raise Warning("expected '}'", self.FileName, self.CurrentLineNumber)
Obj.OverrideAttribs = Overrides Obj.OverrideAttribs = Overrides
@ -3636,6 +3672,50 @@ class FdfParser:
return True return True
## __GetCapInFd() method
#
# Get Cap list contained in FD
#
# @param self The object pointer
# @param FdName FD name
# @retval CapList List of Capsule in FD
#
def __GetCapInFd (self, FdName):
CapList = []
if FdName.upper() in self.Profile.FdDict.keys():
FdObj = self.Profile.FdDict[FdName.upper()]
for elementRegion in FdObj.RegionList:
if elementRegion.RegionType == 'CAPSULE':
for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".cap"):
continue
if elementRegionData != None and elementRegionData.upper() not in CapList:
CapList.append(elementRegionData.upper())
return CapList
## __GetReferencedFdCapTuple() method
#
# Get FV and FD list referenced by a capsule image
#
# @param self The object pointer
# @param CapObj Capsule section to be searched
# @param RefFdList referenced FD by section
# @param RefFvList referenced FV by section
#
def __GetReferencedFdCapTuple(self, CapObj, RefFdList = [], RefFvList = []):
for CapsuleDataObj in CapObj.CapsuleDataList :
if CapsuleDataObj.FvName != None and CapsuleDataObj.FvName.upper() not in RefFvList:
RefFvList.append (CapsuleDataObj.FvName.upper())
elif CapsuleDataObj.Ffs != None:
if isinstance(CapsuleDataObj.Ffs, FfsFileStatement.FileStatement):
if CapsuleDataObj.Ffs.FvName != None and CapsuleDataObj.Ffs.FvName.upper() not in RefFvList:
RefFvList.append(CapsuleDataObj.Ffs.FvName.upper())
elif CapsuleDataObj.Ffs.FdName != None and CapsuleDataObj.Ffs.FdName.upper() not in RefFdList:
RefFdList.append(CapsuleDataObj.Ffs.FdName.upper())
else:
self.__GetReferencedFdFvTupleFromSection(CapsuleDataObj.Ffs, RefFdList, RefFvList)
## __GetFvInFd() method ## __GetFvInFd() method
# #
@ -3653,6 +3733,8 @@ class FdfParser:
for elementRegion in FdObj.RegionList: for elementRegion in FdObj.RegionList:
if elementRegion.RegionType == 'FV': if elementRegion.RegionType == 'FV':
for elementRegionData in elementRegion.RegionDataList: for elementRegionData in elementRegion.RegionDataList:
if elementRegionData.endswith(".fv"):
continue
if elementRegionData != None and elementRegionData.upper() not in FvList: if elementRegionData != None and elementRegionData.upper() not in FvList:
FvList.append(elementRegionData.upper()) FvList.append(elementRegionData.upper())
return FvList return FvList
@ -3711,17 +3793,19 @@ class FdfParser:
# @retval False Not exists cycle reference # @retval False Not exists cycle reference
# #
def CycleReferenceCheck(self): def CycleReferenceCheck(self):
#
CycleRefExists = False # Check the cycle between FV and FD image
#
try: MaxLength = len (self.Profile.FvDict)
for FvName in self.Profile.FvDict.keys(): for FvName in self.Profile.FvDict.keys():
LogStr = "Cycle Reference Checking for FV: %s\n" % FvName LogStr = "\nCycle Reference Checking for FV: %s\n" % FvName
RefFvStack = [] RefFvStack = []
RefFvStack.append(FvName) RefFvStack.append(FvName)
FdAnalyzedList = [] FdAnalyzedList = []
while RefFvStack != []: Index = 0
while RefFvStack != [] and Index < MaxLength:
Index = Index + 1
FvNameFromStack = RefFvStack.pop() FvNameFromStack = RefFvStack.pop()
if FvNameFromStack.upper() in self.Profile.FvDict.keys(): if FvNameFromStack.upper() in self.Profile.FvDict.keys():
FvObj = self.Profile.FvDict[FvNameFromStack.upper()] FvObj = self.Profile.FvDict[FvNameFromStack.upper()]
@ -3736,35 +3820,99 @@ class FdfParser:
if RefFdName in FdAnalyzedList: if RefFdName in FdAnalyzedList:
continue continue
LogStr += "FD %s is referenced by FV %s\n" % (RefFdName, FvNameFromStack) LogStr += "FV %s contains FD %s\n" % (FvNameFromStack, RefFdName)
FvInFdList = self.__GetFvInFd(RefFdName) FvInFdList = self.__GetFvInFd(RefFdName)
if FvInFdList != []: if FvInFdList != []:
LogStr += "FD %s contains FV: " % RefFdName for FvNameInFd in FvInFdList:
for FvObj in FvInFdList: LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)
LogStr += FvObj if FvNameInFd not in RefFvStack:
LogStr += ' \n' RefFvStack.append(FvNameInFd)
if FvObj not in RefFvStack:
RefFvStack.append(FvObj)
if FvName in RefFvStack: if FvName in RefFvStack or FvNameFromStack in RefFvStack:
CycleRefExists = True EdkLogger.info(LogStr)
raise Warning(LogStr) return True
FdAnalyzedList.append(RefFdName) FdAnalyzedList.append(RefFdName)
for RefFvName in RefFvList: for RefFvName in RefFvList:
LogStr += "FV %s is referenced by FV %s\n" % (RefFvName, FvNameFromStack) LogStr += "FV %s contains FV %s\n" % (FvNameFromStack, RefFvName)
if RefFvName not in RefFvStack: if RefFvName not in RefFvStack:
RefFvStack.append(RefFvName) RefFvStack.append(RefFvName)
if FvName in RefFvStack: if FvName in RefFvStack or FvNameFromStack in RefFvStack:
CycleRefExists = True EdkLogger.info(LogStr)
raise Warning(LogStr) return True
except Warning: #
print LogStr # Check the cycle between Capsule and FD image
#
MaxLength = len (self.Profile.CapsuleDict)
for CapName in self.Profile.CapsuleDict.keys():
#
# Capsule image to be checked.
#
LogStr = "\n\n\nCycle Reference Checking for Capsule: %s\n" % CapName
RefCapStack = []
RefCapStack.append(CapName)
FdAnalyzedList = []
FvAnalyzedList = []
finally: Index = 0
return CycleRefExists while RefCapStack != [] and Index < MaxLength:
Index = Index + 1
CapNameFromStack = RefCapStack.pop()
if CapNameFromStack.upper() in self.Profile.CapsuleDict.keys():
CapObj = self.Profile.CapsuleDict[CapNameFromStack.upper()]
else:
continue
RefFvList = []
RefFdList = []
self.__GetReferencedFdCapTuple(CapObj, RefFdList, RefFvList)
FvListLength = 0
FdListLength = 0
while FvListLength < len (RefFvList) or FdListLength < len (RefFdList):
for RefFdName in RefFdList:
if RefFdName in FdAnalyzedList:
continue
LogStr += "Capsule %s contains FD %s\n" % (CapNameFromStack, RefFdName)
CapInFdList = self.__GetCapInFd(RefFdName)
if CapInFdList != []:
for CapNameInFd in CapInFdList:
LogStr += "FD %s contains Capsule %s\n" % (RefFdName,CapNameInFd)
if CapNameInFd not in RefCapStack:
RefCapStack.append(CapNameInFd)
if CapName in RefCapStack or CapNameFromStack in RefCapStack:
EdkLogger.info(LogStr)
return True
FvInFdList = self.__GetFvInFd(RefFdName)
if FvInFdList != []:
for FvNameInFd in FvInFdList:
LogStr += "FD %s contains FV %s\n" % (RefFdName,FvNameInFd)
if FvNameInFd not in RefFvList:
RefFvList.append(FvNameInFd)
FdAnalyzedList.append(RefFdName)
#
# the number of the parsed FV and FD image
#
FvListLength = len (RefFvList)
FdListLength = len (RefFdList)
for RefFvName in RefFvList:
if RefFvName in FvAnalyzedList:
continue
LogStr += "Capsule %s contains FV %s\n" % (CapNameFromStack, RefFvName)
if RefFvName.upper() in self.Profile.FvDict.keys():
FvObj = self.Profile.FvDict[RefFvName.upper()]
else:
continue
self.__GetReferencedFdFvTuple(FvObj, RefFdList, RefFvList)
FvAnalyzedList.append(RefFvName)
return False
if __name__ == "__main__": if __name__ == "__main__":
parser = FdfParser("..\LakeportX64Pkg.fdf") parser = FdfParser("..\LakeportX64Pkg.fdf")

View File

@ -78,8 +78,7 @@ class FileStatement (FileStatementClassObject) :
if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName)) EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))
Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper()) Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())
FvBin = {} FileName = Fd.GenFd()
FileName = Fd.GenFd(FvBin)
SectionFiles = [FileName] SectionFiles = [FileName]
elif self.FileName != None: elif self.FileName != None:

View File

@ -44,6 +44,7 @@ class FV (FvClassObject):
self.BaseAddress = None self.BaseAddress = None
self.InfFileName = None self.InfFileName = None
self.FvAddressFileName = None self.FvAddressFileName = None
self.CapsuleName = None
## AddToBuffer() ## AddToBuffer()
# #
@ -61,10 +62,27 @@ class FV (FvClassObject):
# #
def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}) : def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', VtfDict=None, MacroDict = {}) :
if self.UiFvName.upper() in GenFds.FvBinDict.keys(): if self.UiFvName.upper() + 'fv' in GenFds.ImageBinDict.keys():
return GenFds.FvBinDict[self.UiFvName.upper()] return GenFds.ImageBinDict[self.UiFvName.upper() + 'fv']
GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV ..." %self.UiFvName) #
# Check whether FV in Capsule is in FD flash region.
# If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.
#
if self.CapsuleName != None:
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
for RegionObj in FdObj.RegionList:
if RegionObj.RegionType == 'FV':
for RegionData in RegionObj.RegionDataList:
if RegionData.endswith(".fv"):
continue
elif RegionData.upper() + 'fv' in GenFds.ImageBinDict.keys():
continue
elif self.UiFvName.upper() == RegionData.upper():
GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))
GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)
self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict) self.__InitializeInf__(BaseAddress, BlockSize, BlockNum, ErasePloarity, VtfDict)
# #
@ -115,12 +133,12 @@ class FV (FvClassObject):
# #
FvFileObj = open ( FvOutputFile,'r+b') FvFileObj = open ( FvOutputFile,'r+b')
GenFdsGlobalVariable.InfLogger( "\nGenerate %s FV Successfully" %self.UiFvName) GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" %self.UiFvName)
GenFdsGlobalVariable.SharpCounter = 0 GenFdsGlobalVariable.SharpCounter = 0
Buffer.write(FvFileObj.read()) Buffer.write(FvFileObj.read())
FvFileObj.close() FvFileObj.close()
GenFds.FvBinDict[self.UiFvName.upper()] = FvOutputFile GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
return FvOutputFile return FvOutputFile
## __InitializeInf__() ## __InitializeInf__()

View File

@ -20,7 +20,7 @@ import sys
import os import os
import linecache import linecache
import FdfParser import FdfParser
from Common.BuildToolError import * import Common.BuildToolError as BuildToolError
from GenFdsGlobalVariable import GenFdsGlobalVariable from GenFdsGlobalVariable import GenFdsGlobalVariable
from Workspace.WorkspaceDatabase import WorkspaceDatabase from Workspace.WorkspaceDatabase import WorkspaceDatabase
from Workspace.BuildClassObject import PcdClassObject from Workspace.BuildClassObject import PcdClassObject
@ -77,10 +77,10 @@ def main():
EdkLogger.SetLevel(EdkLogger.INFO) EdkLogger.SetLevel(EdkLogger.INFO)
if (Options.Workspace == None): if (Options.Workspace == None):
EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "WORKSPACE not defined", EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined",
ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
elif not os.path.exists(Options.Workspace): elif not os.path.exists(Options.Workspace):
EdkLogger.error("GenFds", BuildToolError.PARAMETER_INVALID, "WORKSPACE is invalid", EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid",
ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.")
else: else:
Workspace = os.path.normcase(Options.Workspace) Workspace = os.path.normcase(Options.Workspace)
@ -95,17 +95,17 @@ def main():
FdfFilename = Options.filename FdfFilename = Options.filename
FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename) FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename)
else: else:
EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing FDF filename") EdkLogger.error("GenFds", OPTION_MISSING, "Missing FDF filename")
if (Options.BuildTarget): if (Options.BuildTarget):
GenFdsGlobalVariable.TargetName = Options.BuildTarget GenFdsGlobalVariable.TargetName = Options.BuildTarget
else: else:
EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build target") EdkLogger.error("GenFds", OPTION_MISSING, "Missing build target")
if (Options.ToolChain): if (Options.ToolChain):
GenFdsGlobalVariable.ToolChainTag = Options.ToolChain GenFdsGlobalVariable.ToolChainTag = Options.ToolChain
else: else:
EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing tool chain tag") EdkLogger.error("GenFds", OPTION_MISSING, "Missing tool chain tag")
if FdfFilename[0:2] == '..': if FdfFilename[0:2] == '..':
FdfFilename = os.path.realpath(FdfFilename) FdfFilename = os.path.realpath(FdfFilename)
@ -113,7 +113,7 @@ def main():
FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) FdfFilename = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename)
if not os.path.exists(FdfFilename): if not os.path.exists(FdfFilename):
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=FdfFilename) EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename)
GenFdsGlobalVariable.FdfFile = FdfFilename GenFdsGlobalVariable.FdfFile = FdfFilename
GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename) GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename)
@ -128,19 +128,19 @@ def main():
ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform) ActivePlatform = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, ActivePlatform)
if not os.path.exists(ActivePlatform) : if not os.path.exists(ActivePlatform) :
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!") EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
if ActivePlatform.find(Workspace) == -1: if ActivePlatform.find(Workspace) == -1:
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!") EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist in Workspace!")
ActivePlatform = ActivePlatform.replace(Workspace, '') ActivePlatform = ActivePlatform.replace(Workspace, '')
if len(ActivePlatform) > 0 : if len(ActivePlatform) > 0 :
if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/': if ActivePlatform[0] == '\\' or ActivePlatform[0] == '/':
ActivePlatform = ActivePlatform[1:] ActivePlatform = ActivePlatform[1:]
else: else:
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, "ActivePlatform doesn't exist!") EdkLogger.error("GenFds", FILE_NOT_FOUND, "ActivePlatform doesn't exist!")
else : else :
EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing active platform") EdkLogger.error("GenFds", OPTION_MISSING, "Missing active platform")
GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace) GenFdsGlobalVariable.ActivePlatform = PathClass(NormPath(ActivePlatform), Workspace)
@ -148,26 +148,28 @@ def main():
if os.path.isfile(BuildConfigurationFile) == True: if os.path.isfile(BuildConfigurationFile) == True:
TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile) TargetTxtClassObject.TargetTxtClassObject(BuildConfigurationFile)
else: else:
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=BuildConfigurationFile) EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=BuildConfigurationFile)
if Options.Macros: if Options.Macros:
for Pair in Options.Macros: for Pair in Options.Macros:
Pair.strip('"') Pair.strip('"')
List = Pair.split('=') List = Pair.split('=')
if len(List) == 2: if len(List) == 2:
FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
if List[0].strip() == "EFI_SOURCE": if List[0].strip() == "EFI_SOURCE":
GlobalData.gEfiSource = List[1].strip() GlobalData.gEfiSource = List[1].strip()
continue
elif List[0].strip() == "EDK_SOURCE": elif List[0].strip() == "EDK_SOURCE":
GlobalData.gEdkSource = List[1].strip() GlobalData.gEdkSource = List[1].strip()
continue
else: else:
GlobalData.gEdkGlobal[List[0].strip()] = List[1].strip() GlobalData.gEdkGlobal[List[0].strip()] = List[1].strip()
FdfParser.InputMacroDict[List[0].strip()] = List[1].strip()
else: else:
FdfParser.InputMacroDict[List[0].strip()] = None FdfParser.InputMacroDict[List[0].strip()] = ""
"""call Workspace build create database""" """call Workspace build create database"""
os.environ["WORKSPACE"] = Workspace os.environ["WORKSPACE"] = Workspace
BuildWorkSpace = WorkspaceDatabase(':memory:', GlobalData.gGlobalDefines) BuildWorkSpace = WorkspaceDatabase(':memory:', FdfParser.InputMacroDict)
BuildWorkSpace.InitDatabase() BuildWorkSpace.InitDatabase()
# #
@ -179,7 +181,7 @@ def main():
if (Options.archList) : if (Options.archList) :
ArchList = Options.archList.split(',') ArchList = Options.archList.split(',')
else: else:
# EdkLogger.error("GenFds", BuildToolError.OPTION_MISSING, "Missing build ARCH") # EdkLogger.error("GenFds", OPTION_MISSING, "Missing build ARCH")
ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList ArchList = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList
TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList) TargetArchList = set(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, 'COMMON'].SupArchList) & set(ArchList)
@ -206,7 +208,7 @@ def main():
OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir) OutputDir = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, OutputDir)
if not os.path.exists(OutputDir): if not os.path.exists(OutputDir):
EdkLogger.error("GenFds", BuildToolError.FILE_NOT_FOUND, ExtraData=OutputDir) EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=OutputDir)
GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir GenFdsGlobalVariable.OutputDirDict[Key] = OutputDir
""" Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """ """ Parse Fdf file, has to place after build Workspace as FDF may contain macros from DSC file """
@ -214,20 +216,20 @@ def main():
FdfParserObj.ParseFile() FdfParserObj.ParseFile()
if FdfParserObj.CycleReferenceCheck(): if FdfParserObj.CycleReferenceCheck():
EdkLogger.error("GenFds", BuildToolError.FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file") EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Cycle Reference Detected in FDF file")
if (Options.uiFdName) : if (Options.uiFdName) :
if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys(): if Options.uiFdName.upper() in FdfParserObj.Profile.FdDict.keys():
GenFds.OnlyGenerateThisFd = Options.uiFdName GenFds.OnlyGenerateThisFd = Options.uiFdName
else: else:
EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID, EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
"No such an FD in FDF file: %s" % Options.uiFdName) "No such an FD in FDF file: %s" % Options.uiFdName)
if (Options.uiFvName) : if (Options.uiFvName) :
if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys(): if Options.uiFvName.upper() in FdfParserObj.Profile.FvDict.keys():
GenFds.OnlyGenerateThisFv = Options.uiFvName GenFds.OnlyGenerateThisFv = Options.uiFvName
else: else:
EdkLogger.error("GenFds", BuildToolError.OPTION_VALUE_INVALID, EdkLogger.error("GenFds", OPTION_VALUE_INVALID,
"No such an FV in FDF file: %s" % Options.uiFvName) "No such an FV in FDF file: %s" % Options.uiFvName)
"""Modify images from build output if the feature of loading driver at fixed address is on.""" """Modify images from build output if the feature of loading driver at fixed address is on."""
@ -240,8 +242,8 @@ def main():
GenFds.DisplayFvSpaceInfo(FdfParserObj) GenFds.DisplayFvSpaceInfo(FdfParserObj)
except FdfParser.Warning, X: except FdfParser.Warning, X:
EdkLogger.error(X.ToolName, BuildToolError.FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False) EdkLogger.error(X.ToolName, FORMAT_INVALID, File=X.FileName, Line=X.LineNumber, ExtraData=X.Message, RaiseError = False)
ReturnCode = BuildToolError.FORMAT_INVALID ReturnCode = FORMAT_INVALID
except FatalError, X: except FatalError, X:
if Options.debug != None: if Options.debug != None:
import traceback import traceback
@ -309,8 +311,8 @@ def myOptionParser():
# #
class GenFds : class GenFds :
FdfParsef = None FdfParsef = None
# FvName in FDF, FvBinFile name # FvName, FdName, CapName in FDF, Image file name
FvBinDict = {} ImageBinDict = {}
OnlyGenerateThisFd = None OnlyGenerateThisFd = None
OnlyGenerateThisFv = None OnlyGenerateThisFv = None
@ -324,17 +326,17 @@ class GenFds :
def GenFd (OutputDir, FdfParser, WorkSpace, ArchList): def GenFd (OutputDir, FdfParser, WorkSpace, ArchList):
GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList) GenFdsGlobalVariable.SetDir ('', FdfParser, WorkSpace, ArchList)
GenFdsGlobalVariable.VerboseLogger(" Gen Fd !") GenFdsGlobalVariable.VerboseLogger(" Generate all Fd images and their required FV and Capsule images!")
if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): if GenFds.OnlyGenerateThisFd != None and GenFds.OnlyGenerateThisFd.upper() in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper()) FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(GenFds.OnlyGenerateThisFd.upper())
if FdObj != None: if FdObj != None:
FdObj.GenFd(GenFds.FvBinDict) FdObj.GenFd()
elif GenFds.OnlyGenerateThisFv == None: elif GenFds.OnlyGenerateThisFd == None:
for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():
FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName] FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName]
FdObj.GenFd(GenFds.FvBinDict) FdObj.GenFd()
GenFdsGlobalVariable.VerboseLogger(" Gen FV ! ") GenFdsGlobalVariable.VerboseLogger("\n Generate other FV images! ")
if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): if GenFds.OnlyGenerateThisFv != None and GenFds.OnlyGenerateThisFv.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper()) FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(GenFds.OnlyGenerateThisFv.upper())
if FvObj != None: if FvObj != None:
@ -343,7 +345,7 @@ class GenFds :
FvObj.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(FvObj)) FvObj.AddToBuffer(Buffer, None, GenFds.GetFvBlockSize(FvObj))
Buffer.close() Buffer.close()
return return
elif GenFds.OnlyGenerateThisFd == None: elif GenFds.OnlyGenerateThisFv == None:
for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): for FvName in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
Buffer = StringIO.StringIO('') Buffer = StringIO.StringIO('')
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName] FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict[FvName]
@ -352,12 +354,14 @@ class GenFds :
Buffer.close() Buffer.close()
if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None: if GenFds.OnlyGenerateThisFv == None and GenFds.OnlyGenerateThisFd == None:
GenFdsGlobalVariable.VerboseLogger(" Gen Capsule !") if GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict != {}:
for CapsuleObj in GenFdsGlobalVariable.FdfParser.Profile.CapsuleList: GenFdsGlobalVariable.VerboseLogger("\n Generate other Capsule images!")
for CapsuleName in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[CapsuleName]
CapsuleObj.GenCapsule() CapsuleObj.GenCapsule()
if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}: if GenFdsGlobalVariable.FdfParser.Profile.OptRomDict != {}:
GenFdsGlobalVariable.VerboseLogger(" Gen Option ROM !") GenFdsGlobalVariable.VerboseLogger("\n Generate all Option ROM!")
for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys(): for DriverName in GenFdsGlobalVariable.FdfParser.Profile.OptRomDict.keys():
OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName] OptRomObj = GenFdsGlobalVariable.FdfParser.Profile.OptRomDict[DriverName]
OptRomObj.AddToBuffer(None) OptRomObj.AddToBuffer(None)

View File

@ -360,7 +360,7 @@ class GenFdsGlobalVariable:
try: try:
PopenObject = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr= subprocess.PIPE) PopenObject = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr= subprocess.PIPE)
except Exception, X: except Exception, X:
EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0])) EdkLogger.error("GenFds", COMMAND_FAILURE, ExtraData="%s: %s" % (str(X), cmd[0]))
(out, error) = PopenObject.communicate() (out, error) = PopenObject.communicate()
while PopenObject.returncode == None : while PopenObject.returncode == None :
@ -371,7 +371,7 @@ class GenFdsGlobalVariable:
GenFdsGlobalVariable.InfLogger (error) GenFdsGlobalVariable.InfLogger (error)
if PopenObject.returncode != 0: if PopenObject.returncode != 0:
print "###", cmd print "###", cmd
EdkLogger.error("GenFds", BuildToolError.COMMAND_FAILURE, errorMess) EdkLogger.error("GenFds", COMMAND_FAILURE, errorMess)
def VerboseLogger (msg): def VerboseLogger (msg):
EdkLogger.verbose(msg) EdkLogger.verbose(msg)
@ -380,7 +380,7 @@ class GenFdsGlobalVariable:
EdkLogger.info(msg) EdkLogger.info(msg)
def ErrorLogger (msg, File = None, Line = None, ExtraData = None): def ErrorLogger (msg, File = None, Line = None, ExtraData = None):
EdkLogger.error('GenFds', BuildToolError.GENFDS_ERROR, msg, File, Line, ExtraData) EdkLogger.error('GenFds', GENFDS_ERROR, msg, File, Line, ExtraData)
def DebugLogger (Level, msg): def DebugLogger (Level, msg):
EdkLogger.debug(Level, msg) EdkLogger.debug(Level, msg)

View File

@ -49,6 +49,14 @@ class OptRomInfStatement (FfsInfStatement):
if self.OverrideAttribs == None: if self.OverrideAttribs == None:
self.OverrideAttribs = OptionRom.OverrideAttribs() self.OverrideAttribs = OptionRom.OverrideAttribs()
if self.OverrideAttribs.NeedCompress == None:
self.OverrideAttribs.NeedCompress = self.OptRomDefs.get ('COMPRESS')
if self.OverrideAttribs.NeedCompress is not None:
if self.OverrideAttribs.NeedCompress.upper() not in ('TRUE', 'FALSE'):
GenFdsGlobalVariable.ErrorLogger( "Expected TRUE/FALSE for COMPRESS: %s" %self.InfFileName)
self.OverrideAttribs.NeedCompress = \
self.OverrideAttribs.NeedCompress.upper() == 'TRUE'
if self.OverrideAttribs.PciVendorId == None: if self.OverrideAttribs.PciVendorId == None:
self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID') self.OverrideAttribs.PciVendorId = self.OptRomDefs.get ('PCI_VENDOR_ID')

View File

@ -135,6 +135,6 @@ class OverrideAttribs:
self.PciClassCode = None self.PciClassCode = None
self.PciDeviceId = None self.PciDeviceId = None
self.PciRevision = None self.PciRevision = None
self.NeedCompress = False self.NeedCompress = None

View File

@ -20,10 +20,10 @@ from GenFdsGlobalVariable import GenFdsGlobalVariable
import StringIO import StringIO
from CommonDataClass.FdfClass import RegionClassObject from CommonDataClass.FdfClass import RegionClassObject
import os import os
from stat import *
from Common import EdkLogger from Common import EdkLogger
from Common.BuildToolError import * from Common.BuildToolError import *
## generate Region ## generate Region
# #
# #
@ -52,9 +52,9 @@ class Region(RegionClassObject):
# @retval string Generated FV file path # @retval string Generated FV file path
# #
def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, FvBinDict, vtfDict = None, MacroDict = {}): def AddToBuffer(self, Buffer, BaseAddress, BlockSizeList, ErasePolarity, ImageBinDict, vtfDict = None, MacroDict = {}):
Size = self.Size Size = self.Size
GenFdsGlobalVariable.InfLogger('Generate Region at Offset 0x%X' % self.Offset) GenFdsGlobalVariable.InfLogger('\nGenerate Region at Offset 0x%X' % self.Offset)
GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" %Size) GenFdsGlobalVariable.InfLogger(" Region Size = 0x%X" %Size)
GenFdsGlobalVariable.SharpCounter = 0 GenFdsGlobalVariable.SharpCounter = 0
@ -62,15 +62,14 @@ class Region(RegionClassObject):
# #
# Get Fv from FvDict # Get Fv from FvDict
# #
FvBuffer = StringIO.StringIO('')
RegionBlockSize = self.BlockSizeOfRegion(BlockSizeList) RegionBlockSize = self.BlockSizeOfRegion(BlockSizeList)
RegionBlockNum = self.BlockNumOfRegion(RegionBlockSize) RegionBlockNum = self.BlockNumOfRegion(RegionBlockSize)
self.FvAddress = int(BaseAddress, 16) + self.Offset self.FvAddress = int(BaseAddress, 16) + self.Offset
FvBaseAddress = '0x%X' %self.FvAddress FvBaseAddress = '0x%X' %self.FvAddress
FvOffset = 0
for RegionData in self.RegionDataList: for RegionData in self.RegionDataList:
FileName = None
if RegionData.endswith(".fv"): if RegionData.endswith(".fv"):
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict) RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s'%RegionData) GenFdsGlobalVariable.InfLogger(' Region FV File Name = .fv : %s'%RegionData)
@ -79,17 +78,14 @@ class Region(RegionClassObject):
if not os.path.exists(RegionData): if not os.path.exists(RegionData):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData) EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
BinFile = open (RegionData, 'r+b') FileName = RegionData
FvBuffer.write(BinFile.read()) elif RegionData.upper() + 'fv' in ImageBinDict.keys():
if FvBuffer.len > Size: GenFdsGlobalVariable.InfLogger(' Region Name = FV')
EdkLogger.error("GenFds", GENFDS_ERROR, FileName = ImageBinDict[RegionData.upper() + 'fv']
"Size of FV File (%s) is larger than Region Size 0x%X specified." \ else:
% (RegionData, Size)) #
break # Generate FvImage.
#
if RegionData.upper() in FvBinDict.keys():
continue
FvObj = None FvObj = None
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys(): if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper()) FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(RegionData.upper())
@ -106,56 +102,141 @@ class Region(RegionClassObject):
BlockSize = FvObj.BlockSizeList[0][0] BlockSize = FvObj.BlockSizeList[0][0]
if FvObj.BlockSizeList[0][1] != None: if FvObj.BlockSizeList[0][1] != None:
BlockNum = FvObj.BlockSizeList[0][1] BlockNum = FvObj.BlockSizeList[0][1]
self.FvAddress = self.FvAddress + FvBuffer.len self.FvAddress = self.FvAddress + FvOffset
FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment) FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)
if self.FvAddress % FvAlignValue != 0: if self.FvAddress % FvAlignValue != 0:
EdkLogger.error("GenFds", GENFDS_ERROR, EdkLogger.error("GenFds", GENFDS_ERROR,
"FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment)) "FV (%s) is NOT %s Aligned!" % (FvObj.UiFvName, FvObj.FvAlignment))
FvBuffer = StringIO.StringIO('')
FvBaseAddress = '0x%X' %self.FvAddress FvBaseAddress = '0x%X' %self.FvAddress
FileName = FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict) FvObj.AddToBuffer(FvBuffer, FvBaseAddress, BlockSize, BlockNum, ErasePolarity, vtfDict)
if FvBuffer.len > Size: if FvBuffer.len > Size:
FvBuffer.close()
EdkLogger.error("GenFds", GENFDS_ERROR, EdkLogger.error("GenFds", GENFDS_ERROR,
"Size of FV (%s) is larger than Region Size 0x%X specified." % (RegionData, Size)) "Size of FV (%s) is larger than Region Size 0x%X specified." % (RegionData, Size))
#
# Put the generated image into FD buffer.
#
Buffer.write(FvBuffer.getvalue())
FvBuffer.close()
FvOffset = FvOffset + FvBuffer.len
Size = Size - FvBuffer.len
continue
else: else:
EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData)) EdkLogger.error("GenFds", GENFDS_ERROR, "FV (%s) is NOT described in FDF file!" % (RegionData))
#
# Add the exist Fv image into FD buffer
if FvBuffer.len > 0: #
Buffer.write(FvBuffer.getvalue()) if FileName != None:
else: FileLength = os.stat(FileName)[ST_SIZE]
BinFile = open (FileName, 'rb') if FileLength > Size:
EdkLogger.error("GenFds", GENFDS_ERROR,
"Size of FV File (%s) is larger than Region Size 0x%X specified." \
% (RegionData, Size))
BinFile = open (FileName, 'r+b')
Buffer.write(BinFile.read()) Buffer.write(BinFile.read())
BinFile.close()
Size = Size - FileLength
#
# Pad the left buffer
#
if Size > 0:
if (ErasePolarity == '1') :
PadData = 0xFF
else :
PadData = 0
for i in range(0, Size):
Buffer.write(pack('B', PadData))
FvBuffer.close() if self.RegionType == 'CAPSULE':
#
if self.RegionType == 'FILE': # Get Capsule from Capsule Dict
FvBuffer = StringIO.StringIO('') #
for RegionData in self.RegionDataList: for RegionData in self.RegionDataList:
if RegionData.endswith(".cap"):
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict) RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
GenFdsGlobalVariable.InfLogger(' Region File Name = FILE: %s'%RegionData) GenFdsGlobalVariable.InfLogger(' Region CAPSULE Image Name = .cap : %s'%RegionData)
if RegionData[1] != ':' : if RegionData[1] != ':' :
RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData) RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData): if not os.path.exists(RegionData):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData) EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
BinFile = open (RegionData, 'r+b') FileName = RegionData
FvBuffer.write(BinFile.read()) elif RegionData.upper() + 'cap' in ImageBinDict.keys():
if FvBuffer.len > Size : GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
EdkLogger.error("GenFds", GENFDS_ERROR, FileName = ImageBinDict[RegionData.upper() + 'cap']
"Size of File (%s) large than Region Size " % RegionData) else:
#
# Generate Capsule image and Put it into FD buffer
#
CapsuleObj = None
if RegionData.upper() in GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict.keys():
CapsuleObj = GenFdsGlobalVariable.FdfParser.Profile.CapsuleDict[RegionData.upper()]
if CapsuleObj != None :
CapsuleObj.CapsuleName = RegionData.upper()
GenFdsGlobalVariable.InfLogger(' Region Name = CAPSULE')
#
# Call GenFv tool to generate Capsule Image
#
FileName = CapsuleObj.GenCapsule()
CapsuleObj.CapsuleName = None
else:
EdkLogger.error("GenFds", GENFDS_ERROR, "Capsule (%s) is NOT described in FDF file!" % (RegionData))
# #
# If File contents less than region size, append "0xff" after it # Add the capsule image into FD buffer
# #
if FvBuffer.len < Size: FileLength = os.stat(FileName)[ST_SIZE]
for index in range(0, (Size-FvBuffer.len)): if FileLength > Size:
if (ErasePolarity == '1'): EdkLogger.error("GenFds", GENFDS_ERROR,
FvBuffer.write(pack('B', int('0xFF', 16))) "Size 0x%X of Capsule File (%s) is larger than Region Size 0x%X specified." \
else: % (FileLength, RegionData, Size))
FvBuffer.write(pack('B', int('0x00', 16))) BinFile = open (FileName, 'r+b')
Buffer.write(FvBuffer.getvalue()) Buffer.write(BinFile.read())
FvBuffer.close() BinFile.close()
Size = Size - FileLength
#
# Pad the left buffer
#
if Size > 0:
if (ErasePolarity == '1') :
PadData = 0xFF
else :
PadData = 0
for i in range(0, Size):
Buffer.write(pack('B', PadData))
if self.RegionType == 'FILE':
for RegionData in self.RegionDataList:
RegionData = GenFdsGlobalVariable.MacroExtend(RegionData, MacroDict)
if RegionData[1] != ':' :
RegionData = os.path.join (GenFdsGlobalVariable.WorkSpaceDir, RegionData)
if not os.path.exists(RegionData):
EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=RegionData)
#
# Add the file image into FD buffer
#
FileLength = os.stat(RegionData)[ST_SIZE]
if FileLength > Size:
EdkLogger.error("GenFds", GENFDS_ERROR,
"Size of File (%s) is larger than Region Size 0x%X specified." \
% (RegionData, Size))
GenFdsGlobalVariable.InfLogger(' Region File Name = %s'%RegionData)
BinFile = open (RegionData, 'r+b')
Buffer.write(BinFile.read())
BinFile.close()
Size = Size - FileLength
#
# Pad the left buffer
#
if Size > 0:
if (ErasePolarity == '1') :
PadData = 0xFF
else :
PadData = 0
for i in range(0, Size):
Buffer.write(pack('B', PadData))
if self.RegionType == 'DATA' : if self.RegionType == 'DATA' :
GenFdsGlobalVariable.InfLogger(' Region Name = DATA') GenFdsGlobalVariable.InfLogger(' Region Name = DATA')
@ -168,12 +249,16 @@ class Region(RegionClassObject):
else: else:
for item in Data : for item in Data :
Buffer.write(pack('B', int(item, 16))) Buffer.write(pack('B', int(item, 16)))
if DataSize < Size: Size = Size - DataSize
if (ErasePolarity == '1'): #
# Pad the left buffer
#
if Size > 0:
if (ErasePolarity == '1') :
PadData = 0xFF PadData = 0xFF
else: else :
PadData = 0 PadData = 0
for i in range(Size - DataSize): for i in range(0, Size):
Buffer.write(pack('B', PadData)) Buffer.write(pack('B', PadData))
if self.RegionType == None: if self.RegionType == None:

View File

@ -16,6 +16,7 @@
# #
import os import os
import time import time
import copy
import Common.EdkLogger as EdkLogger import Common.EdkLogger as EdkLogger
from CommonDataClass.DataClass import * from CommonDataClass.DataClass import *
@ -55,7 +56,7 @@ class MetaFileParser(object):
self._FileType = FileType self._FileType = FileType
self.MetaFile = FilePath self.MetaFile = FilePath
self._FileDir = os.path.dirname(self.MetaFile) self._FileDir = os.path.dirname(self.MetaFile)
self._Macros = {} self._Macros = copy.copy(Macros)
# for recursive parsing # for recursive parsing
self._Owner = Owner self._Owner = Owner
@ -87,6 +88,8 @@ class MetaFileParser(object):
## Set parsing complete flag in both class and table ## Set parsing complete flag in both class and table
def _Done(self): def _Done(self):
self._Finished = True self._Finished = True
## Do not set end flag when processing included files
if self._From == -1:
self._Table.SetEndFlag() self._Table.SetEndFlag()
## Return the table containg parsed data ## Return the table containg parsed data
@ -208,6 +211,9 @@ class MetaFileParser(object):
if TokenList[0] == '': if TokenList[0] == '':
EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given", EdkLogger.error('Parser', FORMAT_INVALID, "No macro name given",
ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1) ExtraData=self._CurrentLine, File=self.MetaFile, Line=self._LineIndex+1)
# Macros defined in the command line override ones defined in the meta-data file
if not TokenList[0] in self._Macros:
if len(TokenList) == 1: if len(TokenList) == 1:
self._Macros[TokenList[0]] = '' self._Macros[TokenList[0]] = ''
else: else:

View File

@ -17,6 +17,7 @@
import sqlite3 import sqlite3
import os import os
import os.path import os.path
import pickle
import Common.EdkLogger as EdkLogger import Common.EdkLogger as EdkLogger
import Common.GlobalData as GlobalData import Common.GlobalData as GlobalData
@ -24,6 +25,7 @@ import Common.GlobalData as GlobalData
from Common.String import * from Common.String import *
from Common.DataType import * from Common.DataType import *
from Common.Misc import * from Common.Misc import *
from types import *
from CommonDataClass.CommonClass import SkuInfoClass from CommonDataClass.CommonClass import SkuInfoClass
@ -1109,6 +1111,7 @@ class InfBuildData(ModuleBuildClassObject):
"BS_DRIVER" : "DXE_DRIVER", "BS_DRIVER" : "DXE_DRIVER",
"RT_DRIVER" : "DXE_RUNTIME_DRIVER", "RT_DRIVER" : "DXE_RUNTIME_DRIVER",
"SAL_RT_DRIVER" : "DXE_SAL_DRIVER", "SAL_RT_DRIVER" : "DXE_SAL_DRIVER",
"SMM_DRIVER" : "SMM_DRIVER",
# "BS_DRIVER" : "DXE_SMM_DRIVER", # "BS_DRIVER" : "DXE_SMM_DRIVER",
# "BS_DRIVER" : "UEFI_DRIVER", # "BS_DRIVER" : "UEFI_DRIVER",
"APPLICATION" : "UEFI_APPLICATION", "APPLICATION" : "UEFI_APPLICATION",
@ -2098,6 +2101,41 @@ class WorkspaceDatabase(object):
# @return Bool value for whether need renew workspace databse # @return Bool value for whether need renew workspace databse
# #
def _CheckWhetherDbNeedRenew (self, force, DbPath): def _CheckWhetherDbNeedRenew (self, force, DbPath):
DbDir = os.path.split(DbPath)[0]
MacroFilePath = os.path.normpath(os.path.join(DbDir, "build.mac"))
MacroMatch = False
if os.path.exists(MacroFilePath) and os.path.isfile(MacroFilePath):
LastMacros = None
try:
f = open(MacroFilePath,'r')
LastMacros = pickle.load(f)
f.close()
except IOError:
pass
except:
f.close()
if LastMacros != None and type(LastMacros) is DictType:
if LastMacros == self._GlobalMacros:
MacroMatch = True
for Macro in LastMacros.keys():
if not (Macro in self._GlobalMacros and LastMacros[Macro] == self._GlobalMacros[Macro]):
MacroMatch = False;
break;
if not MacroMatch:
# save command line macros to file
try:
f = open(MacroFilePath,'w')
pickle.dump(self._GlobalMacros, f, 2)
f.close()
except IOError:
pass
except:
f.close()
force = True
# if database does not exist, we need do nothing # if database does not exist, we need do nothing
if not os.path.exists(DbPath): return False if not os.path.exists(DbPath): return False

View File

@ -158,13 +158,6 @@ def CheckEnvVariable():
EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found", EdkLogger.error("build", ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
ExtraData="PATH") ExtraData="PATH")
# for macro replacement in R9 DSC/DEC/INF file
GlobalData.gGlobalDefines["WORKSPACE"] = ""
# for macro replacement in R8 INF file
GlobalData.gGlobalDefines["EFI_SOURCE"] = EfiSourceDir
GlobalData.gGlobalDefines["EDK_SOURCE"] = EdkSourceDir
GlobalData.gWorkspace = WorkspaceDir GlobalData.gWorkspace = WorkspaceDir
GlobalData.gEfiSource = EfiSourceDir GlobalData.gEfiSource = EfiSourceDir
GlobalData.gEdkSource = EdkSourceDir GlobalData.gEdkSource = EdkSourceDir
@ -705,8 +698,8 @@ class Build():
self.TargetTxt = TargetTxtClassObject() self.TargetTxt = TargetTxtClassObject()
self.ToolDef = ToolDefClassObject() self.ToolDef = ToolDefClassObject()
#self.Db = WorkspaceDatabase(None, GlobalData.gGlobalDefines, self.Reparse) self.Db = WorkspaceDatabase(None, GlobalData.gGlobalDefines, self.Reparse)
self.Db = WorkspaceDatabase(None, {}, self.Reparse) #self.Db = WorkspaceDatabase(None, {}, self.Reparse)
self.BuildDatabase = self.Db.BuildObject self.BuildDatabase = self.Db.BuildObject
self.Platform = None self.Platform = None
@ -1258,6 +1251,7 @@ def MyOptionParser():
"including library instances selected, final dependency expression, "\ "including library instances selected, final dependency expression, "\
"and warning messages, etc.") "and warning messages, etc.")
Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.") Parser.add_option("-d", "--debug", action="store", type="int", help="Enable debug messages at specified level.")
Parser.add_option("-D", "--define", action="append", type="string", dest="Macros", help="Macro: \"Name [= Value]\".")
(Opt, Args)=Parser.parse_args() (Opt, Args)=Parser.parse_args()
return (Opt, Args) return (Opt, Args)
@ -1321,7 +1315,7 @@ def Main():
EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target, EdkLogger.error("build", OPTION_NOT_SUPPORTED, "Not supported target [%s]." % Target,
ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget))) ExtraData="Please select one of: %s" %(' '.join(gSupportedTarget)))
# GlobalData.gGlobalDefines = ParseDefines(Option.Defines) GlobalData.gGlobalDefines = ParseDefines(Option.Macros)
# #
# Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH # Check environment variable: EDK_TOOLS_PATH, WORKSPACE, PATH
# #

View File

@ -29,8 +29,8 @@ class Tests(TestTools.BaseToolsTest):
def SingleFileTest(self, filename): def SingleFileTest(self, filename):
try: try:
py_compile.compile(filename, doraise=True) py_compile.compile(filename, doraise=True)
except: except Exception, e:
self.fail('syntax error: ' + filename) self.fail('syntax error: %s, Error is %s' % (filename, str(e)))
def MakePythonSyntaxCheckTests(): def MakePythonSyntaxCheckTests():
def GetAllPythonSourceFiles(): def GetAllPythonSourceFiles():

View File

@ -3,7 +3,7 @@
@REM however it may be executed directly from the BaseTools project folder @REM however it may be executed directly from the BaseTools project folder
@REM if the file is not executed within a WORKSPACE\BaseTools folder. @REM if the file is not executed within a WORKSPACE\BaseTools folder.
@REM @REM
@REM Copyright (c) 2006 - 2008, Intel Corporation. All rights reserved. @REM Copyright (c) 2006 - 2009, Intel Corporation. All rights reserved.
@REM @REM
@REM This program and the accompanying materials are licensed and made available @REM This program and the accompanying materials are licensed and made available
@REM under the terms and conditions of the BSD Licensewhich accompanies this @REM under the terms and conditions of the BSD Licensewhich accompanies this
@ -261,7 +261,7 @@ goto end
set PYTHON_HOME=%PYTHONHOME% set PYTHON_HOME=%PYTHONHOME%
) else ( ) else (
echo. echo.
echo !!! ERROR !!! PYTHON is required to build or execute the tools !!! echo !!! ERROR !!! PYTHON_HOME is required to build or execute the tools, please set it. !!!
echo. echo.
goto end goto end
) )