Sync EDKII BaseTools to BaseTools project r1903.

git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@10123 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
lgao4
2010-02-28 23:39:39 +00:00
parent fe35c03635
commit 52302d4dee
169 changed files with 48396 additions and 14798 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.

Binary file not shown.

Binary file not shown.

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2007-2009, Intel Corporation # Copyright (c) 2007-2010, Intel Corporation
# Portions copyright (c) 2008 - 2009, Apple Inc. All rights reserved. # 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
@ -237,8 +237,6 @@
<Command.GCC> <Command.GCC>
"$(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)" --only-keep-debug ${dst} $(DEBUG_DIR)(+)$(MODULE_NAME).pdb
"$(OBJCOPY)" -S ${dst}
"$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst} "$(OBJCOPY)" $(OBJCOPY_FLAGS) ${dst}
<Command.RVCT> <Command.RVCT>
@ -286,7 +284,16 @@
<OutputFile> <OutputFile>
$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(DEBUG_DIR)(+)$(MODULE_NAME).efi
<Command.MSFT, Command.INTEL, Command.GCC, Command.RVCT> <Command.MSFT, Command.INTEL, Command.RVCT>
GenFw -e $(MODULE_TYPE) -o ${dst} ${src}
$(CP) ${dst} $(OUTPUT_DIR)
$(CP) ${dst} $(BIN_DIR)
-$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
<Command.GCC>
$(OBJCOPY) --only-keep-debug ${src} $(BIN_DIR)(+)$(MODULE_NAME).debug
$(OBJCOPY) --strip-unneeded ${src}
$(OBJCOPY) --add-gnu-debuglink=$(BIN_DIR)(+)$(MODULE_NAME).debug ${src}
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)
@ -424,6 +431,9 @@
<InputFile> <InputFile>
*.mcb *.mcb
<ExtraDependency>
$(MAKE_FILE)
<OutputFile> <OutputFile>
$(OUTPUT_DIR)(+)$(MODULE_NAME).bin $(OUTPUT_DIR)(+)$(MODULE_NAME).bin

View File

@ -1,5 +1,5 @@
# #
# Copyright (c) 2006-2009, Intel Corporation # Copyright (c) 2006-2010, Intel Corporation
# Portions copyright (c) 2008-2009 Apple Inc. All rights reserved. # 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
@ -27,6 +27,19 @@ DEFINE VS2005x86_DLL = C:\Program Files (x86)\Microsoft Visual Studio 8\Commo
DEFINE VS2005x86_BINX64 = DEF(VS2005x86_BIN)\x86_amd64 DEFINE VS2005x86_BINX64 = DEF(VS2005x86_BIN)\x86_amd64
DEFINE VS2005x86_BIN64 = DEF(VS2005x86_BIN)\x86_ia64 DEFINE VS2005x86_BIN64 = DEF(VS2005x86_BIN)\x86_ia64
DEFINE VS2008_BIN = C:\Program Files\Microsoft Visual Studio 9.0\Vc\bin
DEFINE VS2008_DLL = C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE
DEFINE VS2008_BINX64 = DEF(VS2008_BIN)\x86_amd64
DEFINE VS2008_BIN64 = DEF(VS2008_BIN)\x86_ia64
DEFINE VS2008x86_BIN = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Vc\bin
DEFINE VS2008x86_DLL = C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE
DEFINE VS2008x86_BINX64 = DEF(VS2008x86_BIN)\x86_amd64
DEFINE VS2008x86_BIN64 = DEF(VS2008x86_BIN)\x86_ia64
DEFINE WINSDK_VERSION = v6.0A
DEFINE WINSDK_BIN = c:\Program Files\Microsoft SDKs\Windows\DEF(WINSDK_VERSION)\bin
DEFINE WINSDKx86_BIN = c:\Program Files (x86)\Microsoft SDKs\Windows\DEF(WINSDK_VERSION)\bin
# These defines are needed for certain Microsoft Visual Studio tools that # These defines are needed for certain Microsoft Visual Studio tools that
# are used by other toolchains. An example is that ICC on Windows normally # are used by other toolchains. An example is that ICC on Windows normally
@ -158,6 +171,7 @@ DEFINE ARMGCC_BIN = /
# ===================== # =====================
# VS2003 - win32 - Microsoft Visual Studio .NET 2003, Intel EBC, Intel ASL # VS2003 - win32 - Microsoft Visual Studio .NET 2003, Intel EBC, Intel ASL
# VS2005 - win32 - Microsoft Visual Studio 2005 Team Suite Edition, Intel EBC, Intel ASL (also compatible with VS 2005 Express, Standard, and Pro) # VS2005 - win32 - Microsoft Visual Studio 2005 Team Suite Edition, Intel EBC, Intel ASL (also compatible with VS 2005 Express, Standard, and Pro)
# VS2008 - win32 - Microsoft Visual Studio 2008 Team Suite with Intel ASL
# DDK3790 - win32 - Microsoft Windows DDK 3790.1830, Intel EBC, Intel ASL # DDK3790 - win32 - Microsoft Windows DDK 3790.1830, Intel EBC, Intel ASL
# UNIXGCC - UNIX GCC, No EBC, Intel ASL # UNIXGCC - UNIX GCC, No EBC, Intel ASL
# ELFGCC - Linux ELF GCC, No EBC, Intel ASL # ELFGCC - Linux ELF GCC, No EBC, Intel ASL
@ -166,12 +180,15 @@ DEFINE ARMGCC_BIN = /
# MYTOOLS - win32 - VS2005 for IA32/X64, WINDDK 3790.1830 for IPF, Intel EBC, Intel ASL # MYTOOLS - win32 - VS2005 for IA32/X64, WINDDK 3790.1830 for IPF, Intel EBC, Intel ASL
# VS2003xASL - win32 - Microsoft Visual Studio .NET 2003, Intel EBC, Microsoft ASL # VS2003xASL - win32 - Microsoft Visual Studio .NET 2003, Intel EBC, Microsoft ASL
# VS2005xASL - win32 - Microsoft Visual Studio 2005 Team Suite Edition, Intel EBC, Microsoft ASL # VS2005xASL - win32 - Microsoft Visual Studio 2005 Team Suite Edition, Intel EBC, Microsoft ASL
# VS2008xASL - win32 - Microsoft Visual Studio 2008 Team Suite with Microsoft ASL
# DDK3790xASL - win32 - Microsoft Windows DDK 3790.1830, Intel EBC, Microsoft ASL # DDK3790xASL - win32 - Microsoft Windows DDK 3790.1830, Intel EBC, Microsoft ASL
# CYGGCCxASL - win32 - CygWin GCC, Intel EBC, Microsoft ASL # CYGGCCxASL - win32 - CygWin GCC, Intel EBC, Microsoft ASL
# ICCxASL - win32 - Intel C Compiler V9.1, Intel EBC, Microsoft ASL # ICCxASL - win32 - Intel C Compiler V9.1, Intel EBC, Microsoft ASL
# VS2005x86 - win64 - Microsoft Visual Studio 2005 Team Suite Edition (x86), Intel EBC, Intel ASL (also compatible with VS 2005 Express, Standard, and Pro) # VS2005x86 - win64 - Microsoft Visual Studio 2005 Team Suite Edition (x86), Intel EBC, Intel ASL (also compatible with VS 2005 Express, Standard, and Pro)
# VS2008x86 - Microsoft Visual Studio 2008 (x86) w/ Intel ASL
# ICCx86 - win64 - Intel C Compiler V9.1 (x86), Intel EBC, Intel ASL # ICCx86 - win64 - Intel C Compiler V9.1 (x86), Intel EBC, Intel ASL
# VS2005x86xASL - win64 - Microsoft Visual Studio 2005 Team Suite Edition (x86), Intel EBC, Microsoft ASL (also compatible with VS 2005 Express, Standard, and Pro) # VS2005x86xASL - win64 - Microsoft Visual Studio 2005 Team Suite Edition (x86), Intel EBC, Microsoft ASL (also compatible with VS 2005 Express, Standard, and Pro)
# VS2008x86xASL - Microsoft Visual Studio 2008 (x86) w/ Microsoft ASL
# ICCx86xASL - win64 - Intel C Compiler V9.1 (x86), Intel EBC, Microsoft ASL # ICCx86xASL - win64 - Intel C Compiler V9.1 (x86), Intel EBC, Microsoft ASL
# CYGGCCx86 - win64 - CygWin GCC (x86), Intel EBC (x86), Intel ASL # CYGGCCx86 - win64 - CygWin GCC (x86), Intel EBC (x86), Intel ASL
# CYGGCCx86xASL - win64 - CygWin GCC (x86), Intel EBC (x86), Microsoft ASL # CYGGCCx86xASL - win64 - CygWin GCC (x86), Intel EBC (x86), Microsoft ASL
@ -853,6 +870,454 @@ RELEASE_VS2005x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:R
*_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC *_VS2005x86xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP *_VS2005x86xASL_EBC_DLINK_FLAGS = "C:\Program Files (x86)\Intel\EBC\Lib\EbcLib.lib" /NOLOGO /NODEFAULTLIB /MACHINE:EBC /OPT:REF /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /MAP
####################################################################################
#
# Microsoft Visual Studio 2008
#
# VS2008 - Microsoft Visual Studio 2005 All Edition, including Standard, Professional, Express, TeamSuite
# ASL - Intel ACPI Source Language Compiler
####################################################################################
# VS2008 - Microsoft Visual Studio 2008 ALL Edition, including Standard, Professional, Express, TeamSuite
*_VS2008_*_*_FAMILY = MSFT
*_VS2008_*_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008_*_MAKE_FLAGS = /nologo
*_VS2008_*_RC_PATH = DEF(WINSDK_BIN)\rc.exe
*_VS2008_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2008_*_APP_FLAGS = /nologo /E /TC
*_VS2008_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
##################
# ASL definitions
##################
*_VS2008_*_ASL_PATH = DEF(DEFAULT_WIN_ASL_BIN)
*_VS2008_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
*_VS2008_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
*_VS2008_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2008_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2008_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
##################
# IA32 definitions
##################
*_VS2008_IA32_*_DLL = DEF(VS2008_DLL)
*_VS2008_IA32_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008_IA32_CC_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_VFRPP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_SLINK_PATH = DEF(VS2008_BIN)\lib.exe
*_VS2008_IA32_DLINK_PATH = DEF(VS2008_BIN)\link.exe
*_VS2008_IA32_ASMLINK_PATH = DEF(WINDDK_BIN16)\link16.exe
*_VS2008_IA32_APP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_PP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_ASM_PATH = DEF(VS2008_BIN)\ml.exe
*_VS2008_IA32_ASLCC_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_ASLPP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008_IA32_ASLDLINK_PATH = DEF(VS2008_BIN)\link.exe
*_VS2008_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
RELEASE_VS2008_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2008_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
DEBUG_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
*_VS2008_IA32_ASMLINK_FLAGS = /nologo /tiny
##################
# X64 definitions
##################
*_VS2008_X64_*_DLL = DEF(VS2008_DLL)
*_VS2008_X64_CC_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_PP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_APP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_VFRPP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_ASM_PATH = DEF(VS2008_BINX64)\ml64.exe
*_VS2008_X64_SLINK_PATH = DEF(VS2008_BINX64)\lib.exe
*_VS2008_X64_DLINK_PATH = DEF(VS2008_BINX64)\link.exe
*_VS2008_X64_ASLCC_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_ASLPP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008_X64_ASLDLINK_PATH = DEF(VS2008_BINX64)\link.exe
DEBUG_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
RELEASE_VS2008_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2008_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
DEBUG_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
##################
# IPF definitions
##################
*_VS2008_IPF_*_DLL = DEF(VS2008_DLL)
*_VS2008_IPF_PP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_APP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_VFRPP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_CC_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_ASM_PATH = DEF(VS2008_BIN64)\ias.exe
*_VS2008_IPF_SLINK_PATH = DEF(VS2008_BIN64)\lib.exe
*_VS2008_IPF_DLINK_PATH = DEF(VS2008_BIN64)\link.exe
*_VS2008_IPF_ASLCC_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_ASLPP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008_IPF_ASLDLINK_PATH = DEF(VS2008_BIN64)\link.exe
DEBUG_VS2008_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32 /Zi
RELEASE_VS2008_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32
DEBUG_VS2008_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
RELEASE_VS2008_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
DEBUG_VS2008_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG
RELEASE_VS2008_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb
##################
# EBC definitions
##################
*_VS2008_EBC_*_FAMILY = INTEL
*_VS2008_EBC_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008_EBC_SLINK_PATH = DEF(EBC_BIN)\link.exe
*_VS2008_EBC_DLINK_PATH = DEF(EBC_BIN)\link.exe
*_VS2008_EBC_MAKE_FLAGS = /nologo
*_VS2008_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008_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
####################################################################################
#
# Microsoft Visual Studio 2008
#
# VS2008 - Microsoft Visual Studio 2008 All Edition, including Standard, Professional, Express, TeamSuite
# ASL - Microsoft ACPI Source Language Compiler (asl.exe)
####################################################################################
# VS2008xASL - Microsoft Visual Studio 2008 ALL Edition, including Standard, Professional, Express, TeamSuite
*_VS2008xASL_*_*_FAMILY = MSFT
*_VS2008xASL_*_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008xASL_*_MAKE_FLAG = /nologo
*_VS2008xASL_*_RC_PATH = DEF(WINSDK_BIN)\rc.exe
*_VS2008xASL_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2008xASL_*_APP_FLAGS = /nologo /E /TC
*_VS2008xASL_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008xASL_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
##################
# ASL definitions
##################
*_VS2008xASL_*_ASL_PATH = DEF(WIN_ASL_BIN)
*_VS2008xASL_*_ASL_FLAGS =
*_VS2008xASL_*_ASL_OUTFLAGS = DEF(MS_ASL_OUTFLAGS)
*_VS2008xASL_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2008xASL_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2008xASL_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
##################
# IA32 definitions
##################
*_VS2008xASL_IA32_*_DLL = DEF(VS2008_DLL)
*_VS2008xASL_IA32_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008xASL_IA32_CC_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_VFRPP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_SLINK_PATH = DEF(VS2008_BIN)\lib.exe
*_VS2008xASL_IA32_DLINK_PATH = DEF(VS2008_BIN)\link.exe
*_VS2008xASL_IA32_ASMLINK_PATH = DEF(WINDDK_BIN16)\link16.exe
*_VS2008xASL_IA32_APP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_PP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_ASM_PATH = DEF(VS2008_BIN)\ml.exe
*_VS2008xASL_IA32_ASLCC_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_ASLPP_PATH = DEF(VS2008_BIN)\cl.exe
*_VS2008xASL_IA32_ASLDLINK_PATH = DEF(VS2008_BIN)\link.exe
*_VS2008xASL_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2008xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
RELEASE_VS2008xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2008xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
DEBUG_VS2008xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
*_VS2008xASL_IA32_ASMLINK_FLAGS= /nologo /tiny
##################
# X64 definitions
##################
*_VS2008xASL_X64_*_DLL = DEF(VS2008_DLL)
*_VS2008xASL_X64_CC_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_PP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_APP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_VFRPP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_ASM_PATH = DEF(VS2008_BINX64)\ml64.exe
*_VS2008xASL_X64_SLINK_PATH = DEF(VS2008_BINX64)\lib.exe
*_VS2008xASL_X64_DLINK_PATH = DEF(VS2008_BINX64)\link.exe
*_VS2008xASL_X64_ASLCC_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_ASLPP_PATH = DEF(VS2008_BINX64)\cl.exe
*_VS2008xASL_X64_ASLDLINK_PATH = DEF(VS2008_BINX64)\link.exe
DEBUG_VS2008xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
RELEASE_VS2008xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2008xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
DEBUG_VS2008xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
##################
# IPF definitions
##################
*_VS2008xASL_IPF_*_DLL = DEF(VS2008_DLL)
*_VS2008xASL_IPF_PP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_APP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_VFRPP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_CC_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_ASM_PATH = DEF(VS2008_BIN64)\ias.exe
*_VS2008xASL_IPF_SLINK_PATH = DEF(VS2008_BIN64)\lib.exe
*_VS2008xASL_IPF_DLINK_PATH = DEF(VS2008_BIN64)\link.exe
*_VS2008xASL_IPF_ASLCC_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_ASLPP_PATH = DEF(VS2008_BIN64)\cl.exe
*_VS2008xASL_IPF_ASLDLINK_PATH = DEF(VS2008_BIN64)\link.exe
DEBUG_VS2008xASL_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32 /Zi
RELEASE_VS2008xASL_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32
DEBUG_VS2008xASL_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
RELEASE_VS2008xASL_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
DEBUG_VS2008xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG
RELEASE_VS2008xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF.ICF /IGNORE:4086 /MAP /ALIGN:32 /SECTION:.xdata,D /SECTION:.pdata,D /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb
##################
# EBC definitions
##################
*_VS2008xASL_EBC_*_FAMILY = INTEL
*_VS2008xASL_EBC_MAKE_PATH = DEF(VS2008_BIN)\nmake.exe
*_VS2008xASL_EBC_PP_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008xASL_EBC_VFRPP_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008xASL_EBC_CC_PATH = DEF(EBC_BIN)\iec.exe
*_VS2008xASL_EBC_SLINK_PATH = DEF(EBC_BIN)\link.exe
*_VS2008xASL_EBC_DLINK_PATH = DEF(EBC_BIN)\link.exe
*_VS2008xASL_EBC_MAKE_FLAGS = /nologo
*_VS2008xASL_EBC_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008xASL_EBC_CC_FLAGS = /nologo /c /WX /W3 /FIAutoGen.h /D$(MODULE_ENTRY_POINT)=$(ARCH_ENTRY_POINT)
*_VS2008xASL_EBC_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
*_VS2008xASL_EBC_SLINK_FLAGS = /lib /NOLOGO /MACHINE:EBC
*_VS2008xASL_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
####################################################################################
# VS2008x86 - Microsoft Visual Studio 2008 (x86) with Intel ASL
# ASL - Intel ACPI Source Language Compiler (iasl.exe)
####################################################################################
# VS2008x86 - Microsoft Visual Studio 2008 (x86) ALL Edition with Intel ASL
*_VS2008x86_*_*_FAMILY = MSFT
*_VS2008x86_*_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
*_VS2008xASL_*_MAKE_FLAG = /nologo
*_VS2008xASL_*_RC_PATH = DEF(WINSDKx86_BIN)\rc.exe
*_VS2008x86_*_MAKE_FLAGS = /nologo
*_VS2008x86_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2008x86_*_APP_FLAGS = /nologo /E /TC
*_VS2008x86_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008x86_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
##################
# ASL definitions
##################
*_VS2008x86_*_ASL_PATH = DEF(WIN_IASL_BIN)
*_VS2008x86_*_ASL_FLAGS = DEF(DEFAULT_WIN_ASL_FLAGS)
*_VS2008x86_*_ASL_OUTFLAGS = DEF(DEFAULT_WIN_ASL_OUTFLAGS)
*_VS2008x86_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2008x86_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2008x86_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
##################
# IA32 definitions
##################
*_VS2008x86_IA32_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86_IA32_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
*_VS2008x86_IA32_CC_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_VFRPP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_ASLCC_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_ASLPP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_SLINK_PATH = DEF(VS2008x86_BIN)\lib.exe
*_VS2008x86_IA32_DLINK_PATH = DEF(VS2008x86_BIN)\link.exe
*_VS2008x86_IA32_ASLDLINK_PATH= DEF(VS2008x86_BIN)\link.exe
*_VS2008x86_IA32_ASMLINK_PATH = DEF(WINDDK_BIN16)\link.exe
*_VS2008x86_IA32_APP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_PP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86_IA32_ASM_PATH = DEF(VS2008x86_BIN)\ml.exe
*_VS2008x86_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
RELEASE_VS2008x86_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2008x86_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
DEBUG_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
*_VS2008x86_IA32_ASMLINK_FLAGS= /nologo /tiny
##################
# X64 definitions
##################
*_VS2008x86_X64_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86_X64_CC_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_PP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_APP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_VFRPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_ASLCC_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_ASLPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86_X64_ASM_PATH = DEF(VS2008x86_BINX64)\ml64.exe
*_VS2008x86_X64_SLINK_PATH = DEF(VS2008x86_BINX64)\lib.exe
*_VS2008x86_X64_DLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
*_VS2008x86_X64_ASLDLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
DEBUG_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
RELEASE_VS2008x86_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2008x86_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
DEBUG_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
##################
# IPF definitions
##################
*_VS2008x86_IPF_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86_IPF_PP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_APP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_VFRPP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_ASLCC_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_ASLPP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_CC_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86_IPF_ASM_PATH = DEF(VS2008x86_BIN64)\ias.exe
*_VS2008x86_IPF_SLINK_PATH = DEF(VS2008x86_BIN64)\lib.exe
*_VS2008x86_IPF_DLINK_PATH = DEF(VS2008x86_BIN64)\link.exe
*_VS2008x86_IPF_ASLDLINK_PATH = DEF(VS2008x86_BIN64)\link.exe
DEBUG_VS2008x86_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32 /Zi
RELEASE_VS2008x86_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32
DEBUG_VS2008x86_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
RELEASE_VS2008x86_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
DEBUG_VS2008x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG
RELEASE_VS2008x86_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb
####################################################################################
# VS2008x86xASL - Microsoft Visual Studio 2008 with Microsoft ASL
# ASL - Microsoft ACPI Source Language Compiler (asl.exe)
####################################################################################
*_VS2008x86xASL_*_*_FAMILY = MSFT
*_VS2008x86xASL_*_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
*_VS2008xASL_*_MAKE_FLAG = /nologo
*_VS2008xASL_*_RC_PATH = DEF(WINSDKx86_BIN)\rc.exe
*_VS2008x86xASL_*_MAKE_FLAGS = /nologo
*_VS2008x86xASL_*_SLINK_FLAGS = /NOLOGO /LTCG
*_VS2008x86xASL_*_APP_FLAGS = /nologo /E /TC
*_VS2008x86xASL_*_PP_FLAGS = /nologo /E /TC /FIAutoGen.h
*_VS2008x86xASL_*_VFRPP_FLAGS = /nologo /E /TC /DVFRCOMPILE /FI$(MODULE_NAME)StrDefs.h
##################
# ASL definitions
##################
*_VS2008x86xASL_*_ASL_PATH = DEF(WIN_ASL_BIN)
*_VS2008x86xASL_*_ASL_FLAGS = DEF(MS_ASL_FLAGS)
*_VS2008x86xASL_*_ASL_OUTFLAGS = DEF(MS_ASL_OUTFLAGS)
*_VS2008x86xASL_*_ASLCC_FLAGS = DEF(MSFT_ASLCC_FLAGS)
*_VS2008x86xASL_*_ASLPP_FLAGS = DEF(MSFT_ASLPP_FLAGS)
*_VS2008x86xASL_*_ASLDLINK_FLAGS = DEF(MSFT_ASLDLINK_FLAGS)
##################
# IA32 definitions
##################
*_VS2008x86xASL_IA32_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86xASL_IA32_MAKE_PATH = DEF(VS2008x86_BIN)\nmake.exe
*_VS2008x86xASL_IA32_CC_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_VFRPP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_ASLCC_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_ASLPP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_SLINK_PATH = DEF(VS2008x86_BIN)\lib.exe
*_VS2008x86xASL_IA32_DLINK_PATH = DEF(VS2008x86_BIN)\link.exe
*_VS2008x86xASL_IA32_ASLDLINK_PATH= DEF(VS2008x86_BIN)\link.exe
*_VS2008x86xASL_IA32_ASMLINK_PATH = DEF(WINDDK_BIN16)\link.exe
*_VS2008x86xASL_IA32_APP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_PP_PATH = DEF(VS2008x86_BIN)\cl.exe
*_VS2008x86xASL_IA32_ASM_PATH = DEF(VS2008x86_BIN)\ml.exe
*_VS2008x86xASL_IA32_MAKE_FLAGS = /nologo
DEBUG_VS2008x86xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF /Gy /Zi /Gm
RELEASE_VS2008x86xASL_IA32_CC_FLAGS = /nologo /c /WX /GS- /W4 /Gs8192 /D UNICODE /O1ib2 /GL /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008x86xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd /Zi
RELEASE_VS2008x86xASL_IA32_ASM_FLAGS = /nologo /c /WX /W3 /Cx /coff /Zd
DEBUG_VS2008x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86xASL_IA32_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /MACHINE:I386 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
*_VS2008x86xASL_IA32_ASMLINK_FLAGS= /nologo /tiny
##################
# X64 definitions
##################
*_VS2008x86xASL_X64_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86xASL_X64_CC_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_PP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_APP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_VFRPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_ASLCC_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_ASLPP_PATH = DEF(VS2008x86_BINX64)\cl.exe
*_VS2008x86xASL_X64_ASM_PATH = DEF(VS2008x86_BINX64)\ml64.exe
*_VS2008x86xASL_X64_SLINK_PATH = DEF(VS2008x86_BINX64)\lib.exe
*_VS2008x86xASL_X64_DLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
*_VS2008x86xASL_X64_ASLDLINK_PATH = DEF(VS2008x86_BINX64)\link.exe
DEBUG_VS2008x86xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF /Zi /Gm
RELEASE_VS2008x86xASL_X64_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /Gs8192 /D UNICODE /O1ib2s /GL /Gy /FIAutoGen.h /EHs-c- /GR- /GF
DEBUG_VS2008x86xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd /Zi
RELEASE_VS2008x86xASL_X64_ASM_FLAGS = /nologo /c /WX /W3 /Cx /Zd
DEBUG_VS2008x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /DEBUG
RELEASE_VS2008x86xASL_X64_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /IGNORE:4086 /OPT:REF /OPT:ICF=10 /MAP /ALIGN:32 /Machine:AMD64 /LTCG /DLL /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:CONSOLE /SAFESEH:NO /BASE:0 /DRIVER /MERGE:.data=.text /MERGE:.rdata=.text
##################
# IPF definitions
##################
*_VS2008x86xASL_IPF_*_DLL = DEF(VS2008x86_DLL)
*_VS2008x86xASL_IPF_PP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_APP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_VFRPP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_ASLCC_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_ASLPP_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_CC_PATH = DEF(VS2008x86_BIN64)\cl.exe
*_VS2008x86xASL_IPF_ASM_PATH = DEF(VS2008x86_BIN64)\ias.exe
*_VS2008x86xASL_IPF_SLINK_PATH = DEF(VS2008x86_BIN64)\lib.exe
*_VS2008x86xASL_IPF_DLINK_PATH = DEF(VS2008x86_BIN64)\link.exe
*_VS2008x86xASL_IPF_ASLDLINK_PATH = DEF(VS2008x86_BIN64)\link.exe
DEBUG_VS2008x86xASL_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32 /Zi
RELEASE_VS2008x86xASL_IPF_CC_FLAGS = /nologo /c /WX /GS- /X /W4 /EHs-c- /GR- /Gy /Os /GL /FIAutoGen.h /QIPF_fr32
DEBUG_VS2008x86xASL_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4 -d debug
RELEASE_VS2008x86xASL_IPF_ASM_FLAGS = -N us -X explicit -M ilp64 -N so -W4
DEBUG_VS2008x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb /DEBUG
RELEASE_VS2008x86xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF,ICF /IGNORE:4086 /MAP /ALIGN:32 /MACHINE:IA64 /ENTRY:$(IMAGE_ENTRY_POINT) /SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER /SAFESEH:NO /BASE:0 /DRIVER /MAP:$(DEBUG_DIR)/$(BASE_NAME).map /PDB:$(DEBUG_DIR)/$(BASE_NAME).pdb
#################################################################################### ####################################################################################
# #
# Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Time Code Generation) # Microsoft Device Driver Kit 3790.1830 (IA-32, X64, Itanium, with Link Time Code Generation)
@ -1083,11 +1548,11 @@ RELEASE_DDK3790xASL_IPF_DLINK_FLAGS = /NOLOGO /NODEFAULTLIB /LTCG /DLL /OPT:REF
*_*_*_SYMRENAME_PATH = echo *_*_*_SYMRENAME_PATH = echo
*_*_*_SYMRENAME_FLAGS = Symbol renaming not needed for *_*_*_SYMRENAME_FLAGS = Symbol renaming not needed for
DEFINE GCC_ALL_CC_FLAGS = -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h DEFINE GCC_ALL_CC_FLAGS = -g -Os -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -c -include AutoGen.h
DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2 DEFINE GCC_IA32_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -m32 -malign-double -freorder-blocks -freorder-blocks-and-partition -O2
DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address DEFINE GCC_X64_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -mno-red-zone -Wno-address
DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency DEFINE GCC_IPF_CC_FLAGS = DEF(GCC_ALL_CC_FLAGS) -minline-int-divide-min-latency
DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib -s --pie DEFINE GCC_DLINK_FLAGS_COMMON = -nostdlib --pie
DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections DEFINE GCC_IA32_X64_DLINK_COMMON = DEF(GCC_DLINK_FLAGS_COMMON) --gc-sections
DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT) DEFINE GCC_IA32_X64_ASLDLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _ReferenceAcpiTable -u $(IMAGE_ENTRY_POINT)
DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map DEFINE GCC_IA32_X64_DLINK_FLAGS = DEF(GCC_IA32_X64_DLINK_COMMON) --entry _$(IMAGE_ENTRY_POINT) --file-alignment 0x20 --section-alignment 0x20 -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
@ -1104,9 +1569,9 @@ DEFINE GCC_IA32_RC_FLAGS = -I binary -O elf32-i386 -B i386 --re
DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii DEFINE GCC_X64_RC_FLAGS = -I binary -O elf64-x86-64 -B i386 --rename-section .data=.hii
DEFINE GCC_IPF_RC_FLAGS = -I binary -O elf64-ia64-little -B ia64 --rename-section .data=.hii DEFINE GCC_IPF_RC_FLAGS = -I binary -O elf64-ia64-little -B ia64 --rename-section .data=.hii
DEFINE GCC44_ALL_CC_FLAGS = -fshort-wchar -fno-stack-protector -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -ffunction-sections -c -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings DEFINE GCC44_ALL_CC_FLAGS = -g -fshort-wchar -fno-stack-protector -fno-strict-aliasing -Wall -Werror -Wno-missing-braces -Wno-array-bounds -ffunction-sections -fdata-sections -c -include AutoGen.h -DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -malign-double -D EFI32 DEFINE GCC44_IA32_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m32 -malign-double -D EFI32
DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -Wno-address DEFINE GCC44_X64_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) -m64 "-DEFIAPI=__attribute__((ms_abi))" -mno-red-zone -Wno-address
DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections DEFINE GCC44_IA32_X64_DLINK_COMMON = -nostdlib -n -q --gc-sections
DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry ReferenceAcpiTable -u ReferenceAcpiTable
DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map DEFINE GCC44_IA32_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) --entry $(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) -Map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
@ -1169,9 +1634,11 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_UNIXGCC_X64_ASLPP_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc *_UNIXGCC_X64_ASLPP_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc
*_UNIXGCC_X64_VFRPP_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc *_UNIXGCC_X64_VFRPP_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)gcc
*_UNIXGCC_X64_RC_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)objcopy *_UNIXGCC_X64_RC_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)objcopy
*_UNIXGCC_X64_OBJCOPY_PATH = DEF(UNIXGCC_X64_PETOOLS_PREFIX)objcopy
*_UNIXGCC_X64_CC_FLAGS = DEF(GCC_X64_CC_FLAGS) *_UNIXGCC_X64_CC_FLAGS = DEF(GCC_X64_CC_FLAGS)
*_UNIXGCC_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS) *_UNIXGCC_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
*_UNIXGCC_X64_OBJCOPY_FLAGS =
################## ##################
# IPF definitions # IPF definitions
@ -1228,15 +1695,14 @@ DEFINE GCC44_ASM_FLAGS = DEF(GCC_ASM_FLAGS)
*_GCC44_IA32_ASLCC_PATH = DEF(GCC44_IA32_PREFIX)gcc *_GCC44_IA32_ASLCC_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_ASLPP_PATH = DEF(GCC44_IA32_PREFIX)gcc *_GCC44_IA32_ASLPP_PATH = DEF(GCC44_IA32_PREFIX)gcc
*_GCC44_IA32_RC_PATH = DEF(GCC44_IA32_PREFIX)objcopy *_GCC44_IA32_RC_PATH = DEF(GCC44_IA32_PREFIX)objcopy
*_GCC44_IA32_OBJCOPY_PATH = DEF(GCC44_IA32_PREFIX)objcopy
*_GCC44_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32 *_GCC44_IA32_ASLCC_FLAGS = DEF(GCC_ASLCC_FLAGS) -m32
*_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_i386 *_GCC44_IA32_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) -m elf_i386
*_GCC44_IA32_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386 *_GCC44_IA32_ASM_FLAGS = DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386
*_GCC44_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS) *_GCC44_IA32_CC_FLAGS = DEF(GCC44_IA32_CC_FLAGS) -Os
*_GCC44_IA32_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386 *_GCC44_IA32_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) -m elf_i386 --oformat=elf32-i386
*_GCC44_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS) *_GCC44_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
*_GCC44_IA32_OBJCOPY_FLAGS =
#################################################################################### ####################################################################################
# #
@ -2250,17 +2716,17 @@ RELEASE_XCODE32_X64_ASM_FLAGS = -arch x86_64
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 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) # ARM definitions - (Assumes iPhone SDK installed on Snow Leopard)
################## ##################
*_XCODE32_ARM_ARCHCC_FLAGS = -arch armv6 -march=armv6 -mthumb *_XCODE32_ARM_ARCHCC_FLAGS = -arch armv7 -march=armv7 -mthumb
*_XCODE32_ARM_ARCHASM_FLAGS = -arch armv6 *_XCODE32_ARM_ARCHASM_FLAGS = -arch armv7
*_XCODE32_ARM_ARCHDLINK_FLAGS = -arch armv6 *_XCODE32_ARM_ARCHDLINK_FLAGS = -arch armv7
*_XCODE32_ARM_PLATFORM_FLAGS = *_XCODE32_ARM_PLATFORM_FLAGS =
*_XCODE32_ARM_CC_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc *_XCODE32_ARM_CC_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
*_XCODE32_ARM_SLINK_PATH = DEF(IPHONE_TOOLS)/usr/bin/libtool *_XCODE32_ARM_SLINK_PATH = DEF(IPHONE_TOOLS)/usr/bin/libtool
*_XCODE32_ARM_DLINK_PATH = DEF(IPHONE_TOOLS)/usr/bin/ld *_XCODE32_ARM_DLINK_PATH = ld
*_XCODE32_ARM_ASM_PATH = DEF(IPHONE_TOOLS)/usr/bin/as *_XCODE32_ARM_ASM_PATH = DEF(IPHONE_TOOLS)/usr/bin/as
*_XCODE32_ARM_PP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc *_XCODE32_ARM_PP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
*_XCODE32_ARM_VFRPP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc *_XCODE32_ARM_VFRPP_PATH = DEF(IPHONE_TOOLS)/usr/bin/gcc
@ -2291,8 +2757,8 @@ RELEASE_XCODE32_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) -mthumb-inter
# #
# Use default values, or override in DSC file # Use default values, or override in DSC file
# #
*_RVCT31_ARM_ARCHCC_FLAGS = --cpu Cortex-A8 --thumb *_RVCT31_ARM_ARCHCC_FLAGS = --thumb --cpu 7-A
*_RVCT31_ARM_ARCHASM_FLAGS = --cpu Cortex-A8 *_RVCT31_ARM_ARCHASM_FLAGS = --cpu 7-A
*_RVCT31_ARM_ARCHDLINK_FLAGS = *_RVCT31_ARM_ARCHDLINK_FLAGS =
*_RVCT31_ARM_PLATFORM_FLAGS = *_RVCT31_ARM_PLATFORM_FLAGS =
@ -2341,8 +2807,8 @@ RELEASE_RVCT31_ARM_CC_FLAGS = $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) --c90 -Ospac
# #
# Use default values, or override in DSC file # Use default values, or override in DSC file
# #
*_RVCT31CYGWIN_ARM_ARCHCC_FLAGS = --cpu Cortex-A8 --thumb *_RVCT31CYGWIN_ARM_ARCHCC_FLAGS = --thumb --cpu 7-A
*_RVCT31CYGWIN_ARM_ARCHASM_FLAGS = --cpu Cortex-A8 *_RVCT31CYGWIN_ARM_ARCHASM_FLAGS = --cpu 7-A
*_RVCT31CYGWIN_ARM_ARCHDLINK_FLAGS = *_RVCT31CYGWIN_ARM_ARCHDLINK_FLAGS =
*_RVCT31CYGWIN_ARM_PLATFORM_FLAGS = *_RVCT31CYGWIN_ARM_PLATFORM_FLAGS =

View File

@ -4,7 +4,7 @@ Abstract:
Patch the BPB information in boot sector image file. Patch the BPB information in boot sector image file.
Patch the MBR code in MBR image file. Patch the MBR code in MBR image file.
Copyright 2006 - 2008, Intel Corporation Copyright 2006 - 2010, 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
@ -56,7 +56,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
} }
void void

View File

@ -44,18 +44,6 @@ STATIC UINT32 mMaxWarnings = 0;
STATIC UINT32 mMaxWarningsPlusErrors = 0; STATIC UINT32 mMaxWarningsPlusErrors = 0;
STATIC INT8 mPrintLimitsSet = 0; STATIC INT8 mPrintLimitsSet = 0;
STATIC
VOID
PrintMessage (
CHAR8 *Type,
CHAR8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
CHAR8 *Text,
CHAR8 *MsgFmt,
va_list List
);
STATIC STATIC
VOID VOID
PrintLimitExceeded ( PrintLimitExceeded (
@ -151,12 +139,6 @@ Notes:
va_start (List, MsgFmt); va_start (List, MsgFmt);
PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List); PrintMessage ("ERROR", FileName, LineNumber, MessageCode, Text, MsgFmt, List);
va_end (List); va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_ERROR) {
mStatus = STATUS_ERROR;
}
} }
VOID VOID
@ -211,12 +193,6 @@ Returns:
va_start (List, MsgFmt); va_start (List, MsgFmt);
PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List); PrintMessage ("ERROR", mSourceFileName, mSourceFileLineNum, MessageCode, Text, MsgFmt, List);
va_end (List); va_end (List);
//
// Set status accordingly
//
if (mStatus < STATUS_ERROR) {
mStatus = STATUS_ERROR;
}
} }
VOID VOID
@ -396,7 +372,6 @@ Returns:
va_end (List); va_end (List);
} }
STATIC
VOID VOID
PrintMessage ( PrintMessage (
CHAR8 *Type, CHAR8 *Type,
@ -517,6 +492,15 @@ Notes:
sprintf (Line, "%s", mUtilityName); sprintf (Line, "%s", mUtilityName);
} }
} }
if (strcmp (Type, "ERROR") == 0) {
//
// Set status accordingly for ERROR information.
//
if (mStatus < STATUS_ERROR) {
mStatus = STATUS_ERROR;
}
}
} }
// //
@ -545,6 +529,7 @@ Notes:
vsprintf (Line2, MsgFmt, List); vsprintf (Line2, MsgFmt, List);
fprintf (stdout, " %s\n", Line2); fprintf (stdout, " %s\n", Line2);
} }
} }
STATIC STATIC

View File

@ -70,6 +70,17 @@ SetUtilityName (
) )
; ;
VOID
PrintMessage (
CHAR8 *Type,
CHAR8 *FileName,
UINT32 LineNumber,
UINT32 MessageCode,
CHAR8 *Text,
CHAR8 *MsgFmt,
va_list List
);
VOID VOID
Error ( Error (
CHAR8 *FileName, CHAR8 *FileName,

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -484,13 +484,14 @@ Returns:
--*/ --*/
{ {
UINT8 Index; UINT8 Index;
UINT64 HexNumber; UINT64 Value;
CHAR8 CurrentChar; CHAR8 CurrentChar;
// //
// Initialize the result // Initialize the result
// //
HexNumber = 0; Value = 0;
Index = 0;
// //
// Check input paramter // Check input paramter
@ -498,50 +499,65 @@ Returns:
if (AsciiString == NULL || ReturnValue == NULL) { if (AsciiString == NULL || ReturnValue == NULL) {
return EFI_INVALID_PARAMETER; return EFI_INVALID_PARAMETER;
} }
while (AsciiString[Index] == ' ') {
Index ++;
}
// //
// Add each character to the result // Add each character to the result
// //
if (IsHex || (AsciiString[0] == '0' && (AsciiString[1] == 'x' || AsciiString[1] == 'X'))) { if (IsHex || (AsciiString[Index] == '0' && (AsciiString[Index + 1] == 'x' || AsciiString[Index + 1] == 'X'))) {
//
// Verify string is a hex number
//
for (Index = 2; Index < strlen (AsciiString); Index++) {
if (isxdigit ((int)AsciiString[Index]) == 0) {
return EFI_ABORTED;
}
}
// //
// Convert the hex string. // Convert the hex string.
// //
for (Index = 2; AsciiString[Index] != '\0'; Index++) { for (Index = Index + 2; AsciiString[Index] != '\0'; Index++) {
CurrentChar = AsciiString[Index]; CurrentChar = AsciiString[Index];
HexNumber *= 16; if (CurrentChar == ' ') {
break;
}
//
// Verify Hex string
//
if (isxdigit ((int)CurrentChar) == 0) {
return EFI_ABORTED;
}
//
// Add hex value
//
Value *= 16;
if (CurrentChar >= '0' && CurrentChar <= '9') { if (CurrentChar >= '0' && CurrentChar <= '9') {
HexNumber += CurrentChar - '0'; Value += CurrentChar - '0';
} else if (CurrentChar >= 'a' && CurrentChar <= 'f') { } else if (CurrentChar >= 'a' && CurrentChar <= 'f') {
HexNumber += CurrentChar - 'a' + 10; Value += CurrentChar - 'a' + 10;
} else if (CurrentChar >= 'A' && CurrentChar <= 'F') { } else if (CurrentChar >= 'A' && CurrentChar <= 'F') {
HexNumber += CurrentChar - 'A' + 10; Value += CurrentChar - 'A' + 10;
} else {
//
// Unrecognized character
//
return EFI_ABORTED;
} }
} }
*ReturnValue = HexNumber; *ReturnValue = Value;
} else { } else {
// //
// Verify string is a number // Convert dec string is a number
// //
for (Index = 0; Index < strlen (AsciiString); Index++) { for (; Index < strlen (AsciiString); Index++) {
if (isdigit ((int)AsciiString[Index]) == 0) { CurrentChar = AsciiString[Index];
if (CurrentChar == ' ') {
break;
}
//
// Verify Dec string
//
if (isdigit ((int)CurrentChar) == 0) {
return EFI_ABORTED; return EFI_ABORTED;
} }
//
// Add dec value
//
Value = Value * 10;
Value += CurrentChar - '0';
} }
*ReturnValue = atol (AsciiString); *ReturnValue = Value;
} }
return EFI_SUCCESS; return EFI_SUCCESS;

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright 2006 - 2008, Intel Corporation Copyright 2006 - 2010, 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
@ -84,7 +84,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
} }
VOID VOID

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 1999-2008 Intel Corporation. All rights reserved Copyright (c) 1999-2010 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
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -1205,7 +1205,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright 2006 - 2008, Intel Corporation Copyright 2006 - 2010, 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
@ -542,7 +542,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 2009 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved.\n");
} }
VOID VOID

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2010, 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
@ -86,7 +86,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option

View File

@ -1,6 +1,6 @@
/** /**
Copyright (c) 2004-2008, Intel Corporation Copyright (c) 2004-2010, 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
@ -119,7 +119,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option
@ -287,6 +287,8 @@ Returns:
EFI_COMMON_SECTION_HEADER TempSectHeader; EFI_COMMON_SECTION_HEADER TempSectHeader;
EFI_TE_IMAGE_HEADER TeHeader; EFI_TE_IMAGE_HEADER TeHeader;
UINT32 TeOffset; UINT32 TeOffset;
EFI_GUID_DEFINED_SECTION GuidSectHeader;
UINT32 HeaderSize;
Size = 0; Size = 0;
Offset = 0; Offset = 0;
@ -330,6 +332,7 @@ Returns:
// 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.
// //
TeOffset = 0; TeOffset = 0;
HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
fread (&TempSectHeader, 1, sizeof (TempSectHeader), InFile); fread (&TempSectHeader, 1, sizeof (TempSectHeader), InFile);
if (TempSectHeader.Type == EFI_SECTION_TE) { if (TempSectHeader.Type == EFI_SECTION_TE) {
(*PESectionNum) ++; (*PESectionNum) ++;
@ -339,8 +342,14 @@ Returns:
} }
} else if (TempSectHeader.Type == EFI_SECTION_PE32) { } else if (TempSectHeader.Type == EFI_SECTION_PE32) {
(*PESectionNum) ++; (*PESectionNum) ++;
} else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
fseek (InFile, 0, SEEK_SET);
fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
HeaderSize = GuidSectHeader.DataOffset;
}
(*PESectionNum) ++;
} else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION || } else if (TempSectHeader.Type == EFI_SECTION_COMPRESSION ||
TempSectHeader.Type == EFI_SECTION_GUID_DEFINED ||
TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) { TempSectHeader.Type == EFI_SECTION_FIRMWARE_VOLUME_IMAGE) {
// //
// for the encapsulated section, assume it contains Pe/Te section // for the encapsulated section, assume it contains Pe/Te section
@ -364,11 +373,12 @@ Returns:
// But the different sections have the different section header. Necessary or not? // But the different sections have the different section header. Necessary or not?
// Based on section type to adjust offset? Todo // Based on section type to adjust offset? Todo
// //
if ((InputFileAlign [Index] != 0) && (((Size + sizeof (EFI_COMMON_SECTION_HEADER) + TeOffset) % InputFileAlign [Index]) != 0)) { if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
Offset = (Size + 2 * sizeof (EFI_COMMON_SECTION_HEADER) + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1); Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
Offset = Offset - Size - sizeof (EFI_COMMON_SECTION_HEADER) - TeOffset; Offset = Offset - Size - HeaderSize - TeOffset;
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) { if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
memset (FileBuffer + Size, 0, Offset);
SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size); SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size);
SectHeader->Type = EFI_SECTION_RAW; SectHeader->Type = EFI_SECTION_RAW;
SectHeader->Size[0] = (UINT8) (Offset & 0xff); SectHeader->Size[0] = (UINT8) (Offset & 0xff);

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2007 - 2009, Intel Corporation Copyright (c) 2007 - 2010, 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
@ -40,7 +40,7 @@ Abstract:
// //
#define UTILITY_MAJOR_VERSION 0 #define UTILITY_MAJOR_VERSION 0
#define UTILITY_MINOR_VERSION 1 #define UTILITY_MINOR_VERSION 1
#define GENFV_UPDATE_TIME " updated on 2008/11/21" #define GENFV_UPDATE_TIME " updated on 2010/2/1"
EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID; EFI_GUID mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;
@ -97,7 +97,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option
@ -126,11 +126,8 @@ Returns:
run in Flash. It supports DEC or HEX digital format.\n\ run in Flash. It supports DEC or HEX digital format.\n\
If it is set to zero, no rebase action will be taken\n"); If it is set to zero, no rebase action will be taken\n");
fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\ fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\
AddressFile is one file used to record boot driver base\n\ AddressFile is one file used to record the child\n\
address and runtime driver base address. And this tool\n\ FV base address when current FV base address is set.\n");
will update these two addresses after it relocates all\n\
boot drivers and runtime drivers in this fv iamge to\n\
the preferred loaded memory address.\n");
fprintf (stdout, " -m logfile, --map logfile\n\ fprintf (stdout, " -m logfile, --map logfile\n\
Logfile is the output fv map file name. if it is not\n\ Logfile is the output fv map file name. if it is not\n\
given, the FvName.map will be the default map file name\n"); given, the FvName.map will be the default map file name\n");
@ -194,10 +191,8 @@ Returns:
CHAR8 *InfFileImage; CHAR8 *InfFileImage;
UINT32 InfFileSize; UINT32 InfFileSize;
CHAR8 *OutFileName; CHAR8 *OutFileName;
CHAR8 ValueString[_MAX_PATH];
BOOLEAN CapsuleFlag; BOOLEAN CapsuleFlag;
BOOLEAN DumpCapsule; BOOLEAN DumpCapsule;
MEMORY_FILE AddrMemoryFile;
FILE *FpFile; FILE *FpFile;
EFI_CAPSULE_HEADER *CapsuleHeader; EFI_CAPSULE_HEADER *CapsuleHeader;
UINT64 LogLevel, TempNumber; UINT64 LogLevel, TempNumber;
@ -545,62 +540,6 @@ Returns:
VerboseMsg ("the output file name is %s", OutFileName); VerboseMsg ("the output file name is %s", OutFileName);
} }
//
// Read boot and runtime address from address file
//
if (AddrFileName != NULL) {
VerboseMsg ("the input address file name is %s", AddrFileName);
Status = GetFileImage (AddrFileName, &InfFileImage, &InfFileSize);
if (EFI_ERROR (Status)) {
return STATUS_ERROR;
}
AddrMemoryFile.FileImage = InfFileImage;
AddrMemoryFile.CurrentFilePointer = InfFileImage;
AddrMemoryFile.Eof = InfFileImage + InfFileSize;
//
// Read the boot driver base address for this FV image
//
Status = FindToken (&AddrMemoryFile, OPTIONS_SECTION_STRING, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, 0, ValueString);
if (Status == EFI_SUCCESS) {
//
// Get the base address
//
Status = AsciiStringToUint64 (ValueString, FALSE, &TempNumber);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, ValueString);
return STATUS_ERROR;
}
mFvDataInfo.BootBaseAddress = TempNumber;
DebugMsg (NULL, 0, 9, "Boot driver base address", "%s = %s", EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING, ValueString);
}
//
// Read the FV runtime driver base address
//
Status = FindToken (&AddrMemoryFile, OPTIONS_SECTION_STRING, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, 0, ValueString);
if (Status == EFI_SUCCESS) {
//
// Get the base address
//
Status = AsciiStringToUint64 (ValueString, FALSE, &TempNumber);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 2000, "Invalid parameter", "%s = %s", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, ValueString);
return STATUS_ERROR;
}
mFvDataInfo.RuntimeBaseAddress = TempNumber;
DebugMsg (NULL, 0, 9, "Runtime driver base address", "%s = %s", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, ValueString);
}
//
// free the allocated memory space for addr file.
//
free (InfFileImage);
InfFileImage = NULL;
InfFileSize = 0;
}
// //
// Read the INF file image // Read the INF file image
// //
@ -683,32 +622,22 @@ Returns:
// //
// update boot driver address and runtime driver address in address file // update boot driver address and runtime driver address in address file
// //
if (Status == EFI_SUCCESS && AddrFileName != NULL) { if (Status == EFI_SUCCESS && AddrFileName != NULL && mFvBaseAddressNumber > 0) {
FpFile = fopen (AddrFileName, "w"); FpFile = fopen (AddrFileName, "w");
if (FpFile == NULL) { if (FpFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", AddrFileName); Error (NULL, 0, 0001, "Error opening file", AddrFileName);
return STATUS_ERROR; return STATUS_ERROR;
} }
fprintf (FpFile, OPTIONS_SECTION_STRING); fprintf (FpFile, FV_BASE_ADDRESS_STRING);
fprintf (FpFile, "\n"); fprintf (FpFile, "\n");
if (mFvDataInfo.BootBaseAddress != 0) { for (Index = 0; Index < mFvBaseAddressNumber; Index ++) {
fprintf (FpFile, EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING);
fprintf ( fprintf (
FpFile, FpFile,
" = 0x%llx\n", "0x%llx\n",
(unsigned long long)mFvDataInfo.BootBaseAddress (unsigned long long)mFvBaseAddress[Index]
); );
DebugMsg (NULL, 0, 9, "Updated boot driver base address", "%s = 0x%llx", EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING, (unsigned long long) mFvDataInfo.BootBaseAddress);
}
if (mFvDataInfo.RuntimeBaseAddress != 0) {
fprintf (FpFile, EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING);
fprintf (
FpFile,
" = 0x%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);
} }
fflush (FpFile);
fclose (FpFile); fclose (FpFile);
} }

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -159,6 +159,9 @@ UINT8 m64kRecoveryStartupApDataArray[SIZEOF_ST
FV_INFO mFvDataInfo; FV_INFO mFvDataInfo;
CAP_INFO mCapDataInfo; CAP_INFO mCapDataInfo;
EFI_PHYSICAL_ADDRESS mFvBaseAddress[0x10];
UINT32 mFvBaseAddressNumber = 0;
EFI_STATUS EFI_STATUS
ParseFvInf ( ParseFvInf (
IN MEMORY_FILE *InfFile, IN MEMORY_FILE *InfFile,
@ -716,6 +719,11 @@ Returns:
EFI_TE_IMAGE_HEADER *TEImageHeader; EFI_TE_IMAGE_HEADER *TEImageHeader;
EFI_IMAGE_SECTION_HEADER *SectionHeader; EFI_IMAGE_SECTION_HEADER *SectionHeader;
unsigned long long TempLongAddress; unsigned long long TempLongAddress;
UINT32 TextVirtualAddress;
UINT32 DataVirtualAddress;
EFI_PHYSICAL_ADDRESS LinkTimeBaseAddress;
// //
// Init local variable // Init local variable
// //
@ -795,23 +803,29 @@ Returns:
// //
if (ImageBaseAddress == 0) { if (ImageBaseAddress == 0) {
fprintf (FvMapFile, "%s (dummy) (", KeyWord); fprintf (FvMapFile, "%s (dummy) (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) ImageBaseAddress); fprintf (FvMapFile, "BaseAddress=%010llx, ", (unsigned long long) ImageBaseAddress);
} else { } else {
fprintf (FvMapFile, "%s (", KeyWord); fprintf (FvMapFile, "%s (Fixed Flash Address, ", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08llx, ", (unsigned long long) (ImageBaseAddress + Offset)); fprintf (FvMapFile, "BaseAddress=0x%010llx, ", (unsigned long long) (ImageBaseAddress + Offset));
} }
fprintf (FvMapFile, "EntryPoint=%08llx, ", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint)); fprintf (FvMapFile, "EntryPoint=0x%010llx", (unsigned long long) (ImageBaseAddress + AddressOfEntryPoint));
fprintf (FvMapFile, "GUID=%s", FileGuidName);
fprintf (FvMapFile, ")\n"); fprintf (FvMapFile, ")\n");
fprintf (FvMapFile, "(GUID=%s", FileGuidName);
TextVirtualAddress = 0;
DataVirtualAddress = 0;
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=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress)); TextVirtualAddress = SectionHeader->VirtualAddress;
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) { } else if (stricmp ((CHAR8 *)SectionHeader->Name, ".data") == 0) {
fprintf (FvMapFile, ".databaseaddress=%08llx ", (unsigned long long) (ImageBaseAddress + SectionHeader->VirtualAddress)); DataVirtualAddress = SectionHeader->VirtualAddress;
} else if (stricmp ((CHAR8 *)SectionHeader->Name, ".sdata") == 0) {
DataVirtualAddress = SectionHeader->VirtualAddress;
} }
} }
fprintf (FvMapFile, "\n\n"); fprintf (FvMapFile, " .textbaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + TextVirtualAddress));
fprintf (FvMapFile, " .databaseaddress=0x%010llx", (unsigned long long) (ImageBaseAddress + DataVirtualAddress));
fprintf (FvMapFile, ")\n\n");
// //
// Open PeMapFile // Open PeMapFile
@ -826,6 +840,7 @@ Returns:
// //
// Output Functions information into Fv Map file // Output Functions information into Fv Map file
// //
LinkTimeBaseAddress = 0;
while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) { while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) {
// //
// Skip blank line // Skip blank line
@ -851,6 +866,9 @@ Returns:
// //
FunctionType = 2; FunctionType = 2;
fgets (Line, MAX_LINE_LEN, PeMapFile); fgets (Line, MAX_LINE_LEN, PeMapFile);
} else if (stricmp (KeyWord, "Preferred") ==0) {
sscanf (Line + strlen (" Preferred load address is"), "%llx", &TempLongAddress);
LinkTimeBaseAddress = (UINT64) TempLongAddress;
} }
continue; continue;
} }
@ -861,24 +879,14 @@ Returns:
sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName); sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
FunctionAddress = (UINT64) TempLongAddress; 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, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress)); fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
fprintf (FvMapFile, "(%08llx) F ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
} else {
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
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 %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName); sscanf (Line, "%s %s %llx %s", KeyWord, FunctionName, &TempLongAddress, FunctionTypeName);
FunctionAddress = (UINT64) TempLongAddress; 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, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress)); fprintf (FvMapFile, " 0x%010llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress - LinkTimeBaseAddress));
fprintf (FvMapFile, "(%08llx) FS ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName);
} else {
fprintf (FvMapFile, " %016llx ", (unsigned long long) (ImageBaseAddress + FunctionAddress));
fprintf (FvMapFile, "(%08llx) ", (unsigned long long) (FunctionAddress - Offset));
fprintf (FvMapFile, "%s\n", FunctionName); fprintf (FvMapFile, "%s\n", FunctionName);
} }
} }
@ -898,7 +906,8 @@ AddFile (
IN FV_INFO *FvInfo, IN FV_INFO *FvInfo,
IN UINTN Index, IN UINTN Index,
IN OUT EFI_FFS_FILE_HEADER **VtfFileImage, IN OUT EFI_FFS_FILE_HEADER **VtfFileImage,
IN FILE *FvMapFile IN FILE *FvMapFile,
IN FILE *FvReportFile
) )
/*++ /*++
@ -916,6 +925,7 @@ Arguments:
VtfFileImage A pointer to the VTF file within the FvImage. If this is equal VtfFileImage A pointer to the VTF file within the FvImage. If this is equal
to the end of the FvImage then no VTF previously found. to the end of the FvImage then no VTF previously found.
FvMapFile Pointer to FvMap File FvMapFile Pointer to FvMap File
FvReportFile Pointer to FvReport File
Returns: Returns:
@ -933,6 +943,7 @@ Returns:
UINT32 CurrentFileAlignment; UINT32 CurrentFileAlignment;
EFI_STATUS Status; EFI_STATUS Status;
UINTN Index1; UINTN Index1;
UINT8 FileGuidString[PRINTED_GUID_BUFFER_SIZE];
Index1 = 0; Index1 = 0;
// //
@ -1071,6 +1082,10 @@ Returns:
// copy VTF File // copy VTF File
// //
memcpy (*VtfFileImage, FileBuffer, FileSize); memcpy (*VtfFileImage, FileBuffer, FileSize);
PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
fprintf (FvReportFile, "0x%08X %s\n", (unsigned)(UINTN) (((UINT8 *)*VtfFileImage) - (UINTN)FvImage->FileImage), FileGuidString);
free (FileBuffer); free (FileBuffer);
DebugMsg (NULL, 0, 9, "Add VTF FFS file in FV image", NULL); DebugMsg (NULL, 0, 9, "Add VTF FFS file in FV image", NULL);
return EFI_SUCCESS; return EFI_SUCCESS;
@ -1106,6 +1121,8 @@ Returns:
// Copy the file // Copy the file
// //
memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize); memcpy (FvImage->CurrentFilePointer, FileBuffer, FileSize);
PrintGuidToBuffer ((EFI_GUID *) FileBuffer, FileGuidString, sizeof (FileGuidString), TRUE);
fprintf (FvReportFile, "0x%08X %s\n", (unsigned) (FvImage->CurrentFilePointer - FvImage->FileImage), FileGuidString);
FvImage->CurrentFilePointer += FileSize; FvImage->CurrentFilePointer += FileSize;
} else { } else {
Error (NULL, 0, 4002, "Resource", "FV space is full, cannot add file %s.", FvInfo->FvFiles[Index]); Error (NULL, 0, 4002, "Resource", "FV space is full, cannot add file %s.", FvInfo->FvFiles[Index]);
@ -1967,10 +1984,13 @@ Returns:
EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader; EFI_FIRMWARE_VOLUME_EXT_HEADER *FvExtHeader;
FILE *FvExtHeaderFile; FILE *FvExtHeaderFile;
UINTN FileSize; UINTN FileSize;
CHAR8 FvReportName[_MAX_PATH];
FILE *FvReportFile;
FvBufferHeader = NULL; FvBufferHeader = NULL;
FvFile = NULL; FvFile = NULL;
FvMapFile = NULL; FvMapFile = NULL;
FvReportFile = NULL;
if (InfFileImage != NULL) { if (InfFileImage != NULL) {
// //
@ -2109,6 +2129,12 @@ Returns:
} }
VerboseMsg ("FV Map file name is %s", FvMapName); VerboseMsg ("FV Map file name is %s", FvMapName);
//
// FvReport file to log the FV information in one Fvimage
//
strcpy (FvReportName, FvFileName);
strcat (FvReportName, ".txt");
// //
// Calculate the FV size and Update Fv Size based on the actual FFS files. // Calculate the FV size and Update Fv Size based on the actual FFS files.
// And Update mFvDataInfo data. // And Update mFvDataInfo data.
@ -2224,6 +2250,14 @@ Returns:
return EFI_ABORTED; return EFI_ABORTED;
} }
//
// Open FvReport file
//
FvReportFile = fopen(FvReportName, "w");
if (FvReportFile == NULL) {
Error (NULL, 0, 0001, "Error opening file", FvReportName);
return EFI_ABORTED;
}
// //
// record FV size information into FvMap file. // record FV size information into FvMap file.
// //
@ -2240,6 +2274,12 @@ Returns:
fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize)); fprintf (FvMapFile, " = 0x%x\n\n", (unsigned) (mFvTotalSize - mFvTakenSize));
} }
//
// record FV size information to FvReportFile.
//
fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);
fprintf (FvReportFile, "%s = 0x%x\n", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);
// //
// Add PI FV extension header // Add PI FV extension header
// //
@ -2263,7 +2303,7 @@ Returns:
// //
// Add the file // Add the file
// //
Status = AddFile (&FvImageMemoryFile, &mFvDataInfo, Index, &VtfFileImage, FvMapFile); Status = AddFile (&FvImageMemoryFile, &mFvDataInfo, Index, &VtfFileImage, FvMapFile, FvReportFile);
// //
// Exit if error detected while adding the file // Exit if error detected while adding the file
@ -2358,13 +2398,19 @@ Finish:
} }
if (FvFile != NULL) { if (FvFile != NULL) {
fflush (FvFile);
fclose (FvFile); fclose (FvFile);
} }
if (FvMapFile != NULL) { if (FvMapFile != NULL) {
fflush (FvMapFile);
fclose (FvMapFile); fclose (FvMapFile);
} }
if (FvReportFile != NULL) {
fflush (FvReportFile);
fclose (FvReportFile);
}
return Status; return Status;
} }
@ -2652,6 +2698,54 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
EFI_STATUS
GetChildFvFromFfs (
IN FV_INFO *FvInfo,
IN EFI_FFS_FILE_HEADER *FfsFile,
IN UINTN XipOffset
)
/*++
Routine Description:
This function gets all child FvImages in the input FfsFile, and records
their base address to the parent image.
Arguments:
FvInfo A pointer to FV_INFO struture.
FfsFile A pointer to Ffs file image that may contain FvImage.
XipOffset The offset address to the parent FvImage base.
Returns:
EFI_SUCCESS Base address of child Fv image is recorded.
--*/
{
EFI_STATUS Status;
UINTN Index;
EFI_FILE_SECTION_POINTER SubFvSection;
EFI_FIRMWARE_VOLUME_HEADER *SubFvImageHeader;
EFI_PHYSICAL_ADDRESS SubFvBaseAddress;
for (Index = 1;; Index++) {
//
// Find FV section
//
Status = GetSectionByType (FfsFile, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, Index, &SubFvSection);
if (EFI_ERROR (Status)) {
break;
}
SubFvImageHeader = (EFI_FIRMWARE_VOLUME_HEADER *) ((UINT8 *) SubFvSection.FVImageSection + sizeof (EFI_FIRMWARE_VOLUME_IMAGE_SECTION));
//
// Rebase on Flash
//
SubFvBaseAddress = FvInfo->BaseAddress + (UINTN) SubFvImageHeader - (UINTN) FfsFile + XipOffset;
mFvBaseAddress[mFvBaseAddressNumber ++ ] = SubFvBaseAddress;
}
return EFI_SUCCESS;
}
EFI_STATUS EFI_STATUS
FfsRebase ( FfsRebase (
IN OUT FV_INFO *FvInfo, IN OUT FV_INFO *FvInfo,
@ -2696,7 +2790,6 @@ Returns:
EFI_FFS_FILE_STATE SavedState; EFI_FFS_FILE_STATE SavedState;
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr; EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
EFI_TE_IMAGE_HEADER *TEImageHeader; EFI_TE_IMAGE_HEADER *TEImageHeader;
UINT8 Flags;
UINT8 *MemoryImagePointer; UINT8 *MemoryImagePointer;
EFI_IMAGE_SECTION_HEADER *SectionHeader; EFI_IMAGE_SECTION_HEADER *SectionHeader;
CHAR8 PeFileName [_MAX_PATH]; CHAR8 PeFileName [_MAX_PATH];
@ -2717,26 +2810,12 @@ Returns:
PeFileBuffer = NULL; PeFileBuffer = NULL;
// //
// Check XipAddress, BootAddress and RuntimeAddress // Don't need to relocate image when BaseAddress is not set.
// //
Flags = 0; if (FvInfo->BaseAddress == 0) {
XipBase = 0; return EFI_SUCCESS;
if (FvInfo->BaseAddress != 0) { }
Flags |= REBASE_XIP_FILE;
XipBase = FvInfo->BaseAddress + XipOffset; XipBase = FvInfo->BaseAddress + XipOffset;
}
if (FvInfo->BootBaseAddress != 0) {
Flags |= REBASE_BOOTTIME_FILE;
}
if (FvInfo->RuntimeBaseAddress != 0) {
Flags |= REBASE_RUNTIME_FILE;
}
//
// Don't Rebase this FFS.
// Only copy the original map file into the FvMap file
// for the image that is not required to be relocated.
//
// //
// We only process files potentially containing PE32 sections. // We only process files potentially containing PE32 sections.
@ -2749,6 +2828,16 @@ Returns:
case EFI_FV_FILETYPE_DRIVER: case EFI_FV_FILETYPE_DRIVER:
case EFI_FV_FILETYPE_DXE_CORE: case EFI_FV_FILETYPE_DXE_CORE:
break; break;
case EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE:
//
// Rebase the inside FvImage.
//
GetChildFvFromFfs (FvInfo, FfsFile, XipOffset);
//
// Search PE/TE section in FV sectin.
//
break;
default: default:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
@ -2809,13 +2898,6 @@ Returns:
case EFI_FV_FILETYPE_PEI_CORE: case EFI_FV_FILETYPE_PEI_CORE:
case EFI_FV_FILETYPE_PEIM: case EFI_FV_FILETYPE_PEIM:
case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER: case EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER:
if ((Flags & REBASE_XIP_FILE) == 0) {
//
// We aren't relocating XIP code, so skip it.
//
goto WritePeMap;
}
// //
// Check if section-alignment and file-alignment match or not // Check if section-alignment and file-alignment match or not
// //
@ -2889,9 +2971,6 @@ Returns:
case EFI_FV_FILETYPE_DRIVER: case EFI_FV_FILETYPE_DRIVER:
case EFI_FV_FILETYPE_DXE_CORE: case EFI_FV_FILETYPE_DXE_CORE:
switch (ImgHdr->Pe32.OptionalHeader.Subsystem) {
case EFI_IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER:
if ((Flags & REBASE_XIP_FILE) == REBASE_XIP_FILE) {
// //
// Check if section-alignment and file-alignment match or not // Check if section-alignment and file-alignment match or not
// //
@ -2904,55 +2983,6 @@ Returns:
} }
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile; NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;
BaseToUpdate = &XipBase; BaseToUpdate = &XipBase;
} else if ((Flags & REBASE_RUNTIME_FILE) == REBASE_RUNTIME_FILE) {
//
// make sure image base address at the section alignment
//
FvInfo->RuntimeBaseAddress = (FvInfo->RuntimeBaseAddress - ImageContext.ImageSize) & (~(ImageContext.SectionAlignment - 1));
FvInfo->RuntimeBaseAddress = FvInfo->RuntimeBaseAddress & (~(EFI_PAGE_SIZE - 1));
NewPe32BaseAddress = FvInfo->RuntimeBaseAddress;
BaseToUpdate = &(FvInfo->RuntimeBaseAddress);
} else {
//
// RT drivers aren't supposed to be relocated
//
goto WritePeMap;
}
break;
default:
//
// We treat all other subsystems the same as BS_DRIVER
//
if ((Flags & REBASE_XIP_FILE) == REBASE_XIP_FILE) {
//
// Check if section-alignment and file-alignment match or not
//
if ((ImgHdr->Pe32.OptionalHeader.SectionAlignment != ImgHdr->Pe32.OptionalHeader.FileAlignment)) {
//
// Xip module has the same section alignment and file alignment.
//
Error (NULL, 0, 3000, "Invalid", "Section-Alignment and File-Alignment do not match : %s.", FileName);
return EFI_ABORTED;
}
NewPe32BaseAddress = XipBase + (UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION) - (UINTN)FfsFile;
BaseToUpdate = &XipBase;
} else if ((Flags & REBASE_BOOTTIME_FILE) == REBASE_BOOTTIME_FILE) {
//
// make sure image base address at the Section and Page alignment
//
FvInfo->BootBaseAddress = (FvInfo->BootBaseAddress - ImageContext.ImageSize) & (~(ImageContext.SectionAlignment - 1));
FvInfo->BootBaseAddress = FvInfo->BootBaseAddress & (~(EFI_PAGE_SIZE - 1));
NewPe32BaseAddress = FvInfo->BootBaseAddress;
BaseToUpdate = &(FvInfo->BootBaseAddress);
} else {
//
// Skip all BS_DRIVER's
//
goto WritePeMap;
}
break;
}
break; break;
default: default:
@ -2962,10 +2992,17 @@ Returns:
return EFI_SUCCESS; return EFI_SUCCESS;
} }
//
// Relocation doesn't exist
//
if (ImageContext.RelocationsStripped) {
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
continue;
}
// //
// Relocation exist and rebase // Relocation exist and rebase
// //
if (!ImageContext.RelocationsStripped) {
// //
// Load and Relocate Image Data // Load and Relocate Image Data
// //
@ -3016,7 +3053,6 @@ Returns:
free (PeFileBuffer); free (PeFileBuffer);
PeFileBuffer = NULL; PeFileBuffer = NULL;
} }
}
// //
// Update Image Base Address // Update Image Base Address
@ -3033,11 +3069,6 @@ Returns:
return EFI_ABORTED; return EFI_ABORTED;
} }
//
// Update BASE address by add one page size.
//
*BaseToUpdate -= EFI_PAGE_SIZE;
// //
// Now update file checksum // Now update file checksum
// //
@ -3055,7 +3086,7 @@ Returns:
// //
// Get this module function address from ModulePeMapFile and add them into FvMap file // Get this module function address from ModulePeMapFile and add them into FvMap file
// //
WritePeMap:
// //
// Default use FileName as map file path // Default use FileName as map file path
// //
@ -3069,7 +3100,8 @@ WritePeMap:
if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE && if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE && FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE &&
FfsFile->Type != EFI_FV_FILETYPE_PEIM && FfsFile->Type != EFI_FV_FILETYPE_PEIM &&
FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER &&
FfsFile->Type != EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE
) { ) {
// //
// Only Peim code may have a TE section // Only Peim code may have a TE section
@ -3123,13 +3155,6 @@ WritePeMap:
// //
PdbPointer = PeCoffLoaderGetPdbPointer (ImageContext.Handle); PdbPointer = PeCoffLoaderGetPdbPointer (ImageContext.Handle);
if ((Flags & REBASE_XIP_FILE) == 0) {
//
// For none XIP PEIM module, their map info also are collected.
//
goto WriteTeMap;
}
// //
// Set new rebased address. // Set new rebased address.
// //
@ -3139,7 +3164,7 @@ WritePeMap:
// //
// if reloc is stripped, try to get the original efi image to get reloc info. // if reloc is stripped, try to get the original efi image to get reloc info.
// //
if (ImageContext.RelocationsStripped == TRUE) { if (ImageContext.RelocationsStripped) {
// //
// Construct the original efi file name // Construct the original efi file name
// //
@ -3194,11 +3219,17 @@ WritePeMap:
ImageContext.RelocationsStripped = FALSE; ImageContext.RelocationsStripped = FALSE;
} }
} }
//
// Relocation doesn't exist
//
if (ImageContext.RelocationsStripped) {
Warning (NULL, 0, 0, "Invalid", "The file %s has no .reloc section.", FileName);
continue;
}
// //
// Relocation exist and rebase // Relocation exist and rebase
// //
if (!ImageContext.RelocationsStripped) {
// //
// Load and Relocate Image Data // Load and Relocate Image Data
// //
@ -3256,7 +3287,6 @@ WritePeMap:
free (PeFileBuffer); free (PeFileBuffer);
PeFileBuffer = NULL; PeFileBuffer = NULL;
} }
}
// //
// Update Image Base Address // Update Image Base Address
@ -3279,7 +3309,7 @@ WritePeMap:
// //
// Get this module function address from ModulePeMapFile and add them into FvMap file // Get this module function address from ModulePeMapFile and add them into FvMap file
// //
WriteTeMap:
// //
// Default use FileName as map file path // Default use FileName as map file path
// //

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -67,6 +67,7 @@ Abstract:
#define OPTIONS_SECTION_STRING "[options]" #define OPTIONS_SECTION_STRING "[options]"
#define ATTRIBUTES_SECTION_STRING "[attributes]" #define ATTRIBUTES_SECTION_STRING "[attributes]"
#define FILES_SECTION_STRING "[files]" #define FILES_SECTION_STRING "[files]"
#define FV_BASE_ADDRESS_STRING "[FV_BASE_ADDRESS]"
// //
// Options section // Options section
@ -82,8 +83,6 @@ Abstract:
#define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE" #define EFI_CAPSULE_HEADER_SIZE_STRING "EFI_CAPSULE_HEADER_SIZE"
#define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS" #define EFI_CAPSULE_FLAGS_STRING "EFI_CAPSULE_FLAGS"
#define EFI_CAPSULE_VERSION_STRING "EFI_CAPSULE_VERSION" #define EFI_CAPSULE_VERSION_STRING "EFI_CAPSULE_VERSION"
#define EFI_FV_BOOT_DRIVER_BASE_ADDRESS_STRING "EFI_BOOT_DRIVER_BASE_ADDRESS"
#define EFI_FV_RUNTIME_DRIVER_BASE_ADDRESS_STRING "EFI_RUNTIME_DRIVER_BASE_ADDRESS"
#define EFI_FV_TOTAL_SIZE_STRING "EFI_FV_TOTAL_SIZE" #define EFI_FV_TOTAL_SIZE_STRING "EFI_FV_TOTAL_SIZE"
#define EFI_FV_TAKEN_SIZE_STRING "EFI_FV_TAKEN_SIZE" #define EFI_FV_TAKEN_SIZE_STRING "EFI_FV_TAKEN_SIZE"
@ -204,13 +203,6 @@ Abstract:
#define FIT_TYPE_MASK 0x7F #define FIT_TYPE_MASK 0x7F
#define CHECKSUM_BIT_MASK 0x80 #define CHECKSUM_BIT_MASK 0x80
//
// Rebase File type
//
#define REBASE_XIP_FILE 0x1
#define REBASE_BOOTTIME_FILE 0x2
#define REBASE_RUNTIME_FILE 0x4
// //
// Private data types // Private data types
// //
@ -228,8 +220,6 @@ typedef struct {
typedef struct { typedef struct {
BOOLEAN BaseAddressSet; BOOLEAN BaseAddressSet;
EFI_PHYSICAL_ADDRESS BaseAddress; EFI_PHYSICAL_ADDRESS BaseAddress;
EFI_PHYSICAL_ADDRESS BootBaseAddress;
EFI_PHYSICAL_ADDRESS RuntimeBaseAddress;
EFI_GUID FvFileSystemGuid; EFI_GUID FvFileSystemGuid;
BOOLEAN FvFileSystemGuidSet; BOOLEAN FvFileSystemGuidSet;
EFI_GUID FvNameGuid; EFI_GUID FvNameGuid;
@ -270,6 +260,9 @@ extern CAP_INFO mCapDataInfo;
extern EFI_GUID mEfiFirmwareFileSystem2Guid; extern EFI_GUID mEfiFirmwareFileSystem2Guid;
extern UINT32 mFvTotalSize; extern UINT32 mFvTotalSize;
extern UINT32 mFvTakenSize; extern UINT32 mFvTakenSize;
extern EFI_PHYSICAL_ADDRESS mFvBaseAddress[];
extern UINT32 mFvBaseAddressNumber;
// //
// Local function prototypes // Local function prototypes
// //

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -78,6 +78,8 @@ Abstract:
#define FW_RELOC_STRIPEED_IMAGE 9 #define FW_RELOC_STRIPEED_IMAGE 9
#define FW_HII_PACKAGE_LIST_RCIMAGE 10 #define FW_HII_PACKAGE_LIST_RCIMAGE 10
#define FW_HII_PACKAGE_LIST_BINIMAGE 11 #define FW_HII_PACKAGE_LIST_BINIMAGE 11
#define FW_REBASE_IMAGE 12
#define FW_SET_ADDRESS_IMAGE 13
#define DUMP_TE_HEADER 0x11 #define DUMP_TE_HEADER 0x11
@ -116,6 +118,12 @@ static const char *gHiiPackageRCFileHeader[] = {
STATIC CHAR8 *mInImageName; STATIC CHAR8 *mInImageName;
//
// Module image information
//
STATIC UINT32 mImageTimeStamp = 0;
STATIC UINT32 mImageSize = 0;
STATIC STATIC
EFI_STATUS EFI_STATUS
ZeroDebugData ( ZeroDebugData (
@ -190,7 +198,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option
@ -244,7 +252,9 @@ Returns:
fprintf (stdout, " -s timedate, --stamp timedate\n\ fprintf (stdout, " -s timedate, --stamp timedate\n\
timedate format is \"yyyy-mm-dd 00:00:00\". if timedata \n\ timedate format is \"yyyy-mm-dd 00:00:00\". if timedata \n\
is set to NOW, current system time is used. The support\n\ is set to NOW, current system time is used. The support\n\
date scope is 1970-1-1 8:0:0 ~ 2038-1-19 3:14:07\n\ date scope is 1970-01-01 00+timezone:00:00\n\
~ 2038-01-19 03+timezone:14:07\n\
The scope is adjusted according to the different zones.\n\
It can't be combined with other action options\n\ It can't be combined with other action options\n\
except for -o, -r option. It is a action option.\n\ except for -o, -r option. It is a action option.\n\
If it is combined with other action options, the later\n\ If it is combined with other action options, the later\n\
@ -288,6 +298,18 @@ Returns:
except for -o option. It is a action option.\n\ except for -o option. It is a action option.\n\
If it is combined with other action options, the later\n\ If it is combined with other action options, the later\n\
input action option will override the previous one.\n"); input action option will override the previous one.\n");
fprintf (stdout, " --rebase NewAddress Rebase image to new base address. New address \n\
is also set to the first none code section header.\n\
It can't be combined with other action options\n\
except for -o or -r option. It is a action option.\n\
If it is combined with other action options, the later\n\
input action option will override the previous one.\n");
fprintf (stdout, " --address NewAddress Set new address into the first none code \n\
section header of the input image.\n\
It can't be combined with other action options\n\
except for -o or -r option. It is a action option.\n\
If it is combined with other action options, the later\n\
input action option will override the previous one.\n");
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n"); fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n"); fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n"); fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
@ -860,6 +882,7 @@ ScanSections(
NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections; NtHdr->Pe32.FileHeader.NumberOfSections = CoffNbrSections;
NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL); NtHdr->Pe32.FileHeader.TimeDateStamp = (UINT32) time(NULL);
mImageTimeStamp = NtHdr->Pe32.FileHeader.TimeDateStamp;
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);
@ -1639,6 +1662,257 @@ Returns:
return HiiSectionHeader; return HiiSectionHeader;
} }
EFI_STATUS
RebaseImageRead (
IN VOID *FileHandle,
IN UINTN FileOffset,
IN OUT UINT32 *ReadSize,
OUT VOID *Buffer
)
/*++
Routine Description:
Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF file
Arguments:
FileHandle - The handle to the PE/COFF file
FileOffset - The offset, in bytes, into the file to read
ReadSize - The number of bytes to read from the file starting at FileOffset
Buffer - A pointer to the buffer to read the data into.
Returns:
EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the PE/COFF file starting at FileOffset
--*/
{
CHAR8 *Destination8;
CHAR8 *Source8;
UINT32 Length;
Destination8 = Buffer;
Source8 = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
Length = *ReadSize;
while (Length--) {
*(Destination8++) = *(Source8++);
}
return EFI_SUCCESS;
}
EFI_STATUS
SetAddressToSectionHeader (
IN CHAR8 *FileName,
IN OUT UINT8 *FileBuffer,
IN UINT64 NewPe32BaseAddress
)
/*++
Routine Description:
Set new base address into the section header of PeImage
Arguments:
FileName - Name of file
FileBuffer - Pointer to PeImage.
NewPe32BaseAddress - New Base Address for PE image.
Returns:
EFI_SUCCESS Set new base address into this image successfully.
--*/
{
EFI_STATUS Status;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
UINTN Index;
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
EFI_IMAGE_SECTION_HEADER *SectionHeader;
//
// Initialize context
//
memset (&ImageContext, 0, sizeof (ImageContext));
ImageContext.Handle = (VOID *) FileBuffer;
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
return Status;
}
if (ImageContext.RelocationsStripped) {
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
return Status;
}
//
// Get PeHeader pointer
//
ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
//
// Get section header list
//
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
(UINTN) ImgHdr +
sizeof (UINT32) +
sizeof (EFI_IMAGE_FILE_HEADER) +
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
);
//
// Set base address into the first section header that doesn't point to code section.
//
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
if ((SectionHeader->Characteristics & EFI_IMAGE_SCN_CNT_CODE) == 0) {
*(UINT64 *) &SectionHeader->PointerToRelocations = NewPe32BaseAddress;
break;
}
}
//
// No available section header is found.
//
if (Index == ImgHdr->Pe32.FileHeader.NumberOfSections) {
return EFI_NOT_FOUND;
}
//
// BaseAddress is set to section header.
//
return EFI_SUCCESS;
}
EFI_STATUS
RebaseImage (
IN CHAR8 *FileName,
IN OUT UINT8 *FileBuffer,
IN UINT64 NewPe32BaseAddress
)
/*++
Routine Description:
Set new base address into PeImage, and fix up PeImage based on new address.
Arguments:
FileName - Name of file
FileBuffer - Pointer to PeImage.
NewPe32BaseAddress - New Base Address for PE image.
Returns:
EFI_INVALID_PARAMETER - BaseAddress is not valid.
EFI_SUCCESS - Update PeImage is correctly.
--*/
{
EFI_STATUS Status;
PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
UINTN Index;
EFI_IMAGE_OPTIONAL_HEADER_UNION *ImgHdr;
UINT8 *MemoryImagePointer;
EFI_IMAGE_SECTION_HEADER *SectionHeader;
//
// Initialize context
//
memset (&ImageContext, 0, sizeof (ImageContext));
ImageContext.Handle = (VOID *) FileBuffer;
ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) RebaseImageRead;
Status = PeCoffLoaderGetImageInfo (&ImageContext);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s is not valid", FileName);
return Status;
}
if (ImageContext.RelocationsStripped) {
Error (NULL, 0, 3000, "Invalid", "The input PeImage %s has no relocation to be fixed up", FileName);
return Status;
}
//
// Get PeHeader pointer
//
ImgHdr = (EFI_IMAGE_OPTIONAL_HEADER_UNION *)(FileBuffer + ImageContext.PeCoffHeaderOffset);
//
// Load and Relocate Image Data
//
MemoryImagePointer = (UINT8 *) malloc ((UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
if (MemoryImagePointer == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated on rebase of %s", FileName);
return EFI_OUT_OF_RESOURCES;
}
memset ((VOID *) MemoryImagePointer, 0, (UINTN) ImageContext.ImageSize + ImageContext.SectionAlignment);
ImageContext.ImageAddress = ((UINTN) MemoryImagePointer + ImageContext.SectionAlignment - 1) & (~((INT64)ImageContext.SectionAlignment - 1));
Status = PeCoffLoaderLoadImage (&ImageContext);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid", "LocateImage() call failed on rebase of %s", FileName);
free ((VOID *) MemoryImagePointer);
return Status;
}
ImageContext.DestinationAddress = NewPe32BaseAddress;
Status = PeCoffLoaderRelocateImage (&ImageContext);
if (EFI_ERROR (Status)) {
Error (NULL, 0, 3000, "Invalid", "RelocateImage() call failed on rebase of %s", FileName);
free ((VOID *) MemoryImagePointer);
return Status;
}
//
// Copy Relocated data to raw image file.
//
SectionHeader = (EFI_IMAGE_SECTION_HEADER *) (
(UINTN) ImgHdr +
sizeof (UINT32) +
sizeof (EFI_IMAGE_FILE_HEADER) +
ImgHdr->Pe32.FileHeader.SizeOfOptionalHeader
);
for (Index = 0; Index < ImgHdr->Pe32.FileHeader.NumberOfSections; Index ++, SectionHeader ++) {
CopyMem (
FileBuffer + SectionHeader->PointerToRawData,
(VOID*) (UINTN) (ImageContext.ImageAddress + SectionHeader->VirtualAddress),
SectionHeader->SizeOfRawData
);
}
free ((VOID *) MemoryImagePointer);
//
// Update Image Base Address
//
if ((ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) && (ImgHdr->Pe32.FileHeader.Machine != IMAGE_FILE_MACHINE_IA64)) {
ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
} else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
} else {
Error (NULL, 0, 3000, "Invalid", "unknown PE magic signature %X in PE32 image %s",
ImgHdr->Pe32.OptionalHeader.Magic,
FileName
);
return EFI_ABORTED;
}
//
// Set new base address into section header
//
Status = SetAddressToSectionHeader (FileName, FileBuffer, NewPe32BaseAddress);
return Status;
}
int int
main ( main (
int argc, int argc,
@ -1686,6 +1960,8 @@ Returns:
UINT32 FileLength; UINT32 FileLength;
UINT8 *OutputFileBuffer; UINT8 *OutputFileBuffer;
UINT32 OutputFileLength; UINT32 OutputFileLength;
UINT8 *InputFileBuffer;
UINT32 InputFileLength;
RUNTIME_FUNCTION *RuntimeFunction; RUNTIME_FUNCTION *RuntimeFunction;
UNWIND_INFO *UnwindInfo; UNWIND_INFO *UnwindInfo;
STATUS Status; STATUS Status;
@ -1712,12 +1988,18 @@ Returns:
EFI_HII_PACKAGE_HEADER EndPackage; EFI_HII_PACKAGE_HEADER EndPackage;
UINT32 HiiSectionHeaderSize; UINT32 HiiSectionHeaderSize;
UINT8 *HiiSectionHeader; UINT8 *HiiSectionHeader;
UINT64 NewBaseAddress;
BOOLEAN NegativeAddr;
FILE *ReportFile;
CHAR8 *ReportFileName;
UINTN FileLen;
SetUtilityName (UTILITY_NAME); SetUtilityName (UTILITY_NAME);
// //
// Assign to fix compile warning // Assign to fix compile warning
// //
FileLen = 0;
InputFileNum = 0; InputFileNum = 0;
InputFileName = NULL; InputFileName = NULL;
mInImageName = NULL; mInImageName = NULL;
@ -1740,6 +2022,8 @@ Returns:
LogLevel = 0; LogLevel = 0;
OutputFileBuffer = NULL; OutputFileBuffer = NULL;
OutputFileLength = 0; OutputFileLength = 0;
InputFileBuffer = NULL;
InputFileLength = 0;
Optional32 = NULL; Optional32 = NULL;
Optional64 = NULL; Optional64 = NULL;
KeepExceptionTableFlag = FALSE; KeepExceptionTableFlag = FALSE;
@ -1752,6 +2036,8 @@ Returns:
memset (&HiiPackageListGuid, 0, sizeof (HiiPackageListGuid)); memset (&HiiPackageListGuid, 0, sizeof (HiiPackageListGuid));
HiiSectionHeaderSize = 0; HiiSectionHeaderSize = 0;
HiiSectionHeader = NULL; HiiSectionHeader = NULL;
NewBaseAddress = 0;
NegativeAddr = FALSE;
if (argc == 1) { if (argc == 1) {
Error (NULL, 0, 1001, "Missing options", "No input options."); Error (NULL, 0, 1001, "Missing options", "No input options.");
@ -1899,6 +2185,44 @@ Returns:
continue; continue;
} }
if ((stricmp (argv[0], "--rebase") == 0)) {
if (argv[1][0] == '-') {
NegativeAddr = TRUE;
Status = AsciiStringToUint64 (argv[1] + 1, FALSE, &Temp64);
} else {
NegativeAddr = FALSE;
Status = AsciiStringToUint64 (argv[1], FALSE, &Temp64);
}
if (Status != EFI_SUCCESS) {
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
goto Finish;
}
OutImageType = FW_REBASE_IMAGE;
NewBaseAddress = (UINT64) Temp64;
argc -= 2;
argv += 2;
continue;
}
if ((stricmp (argv[0], "--address") == 0)) {
if (argv[1][0] == '-') {
NegativeAddr = TRUE;
Status = AsciiStringToUint64 (argv[1] + 1, FALSE, &Temp64);
} else {
NegativeAddr = FALSE;
Status = AsciiStringToUint64 (argv[1], FALSE, &Temp64);
}
if (Status != EFI_SUCCESS) {
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
goto Finish;
}
OutImageType = FW_SET_ADDRESS_IMAGE;
NewBaseAddress = (UINT64) Temp64;
argc -= 2;
argv += 2;
continue;
}
if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--pad") == 0)) { if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--pad") == 0)) {
if (AsciiStringToUint64 (argv[1], FALSE, &Temp64) != EFI_SUCCESS) { if (AsciiStringToUint64 (argv[1], FALSE, &Temp64) != EFI_SUCCESS) {
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]);
@ -2090,6 +2414,12 @@ Returns:
case FW_HII_PACKAGE_LIST_BINIMAGE: case FW_HII_PACKAGE_LIST_BINIMAGE:
VerboseMsg ("Combine the input multi hii bin packages to one binary pacakge list file."); VerboseMsg ("Combine the input multi hii bin packages to one binary pacakge list file.");
break; break;
case FW_REBASE_IMAGE:
VerboseMsg ("Rebase the input image to new base address.");
break;
case FW_SET_ADDRESS_IMAGE:
VerboseMsg ("Set the preferred address into the section header of the input image");
break;
default: default:
break; break;
} }
@ -2114,33 +2444,52 @@ Returns:
} }
fread (OutputFileBuffer, 1, OutputFileLength, fpOut); fread (OutputFileBuffer, 1, OutputFileLength, fpOut);
fclose (fpOut); fclose (fpOut);
} fpOut = NULL;
fpOut = fopen (OutImageName, "wb");
if (!fpOut) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
} }
VerboseMsg ("Output file name is %s", OutImageName); VerboseMsg ("Output file name is %s", OutImageName);
} else if (!ReplaceFlag) { } else if (!ReplaceFlag && OutImageType != DUMP_TE_HEADER) {
if (OutImageType == DUMP_TE_HEADER) {
fpOut = stdout;
} else {
Error (NULL, 0, 1001, "Missing option", "output file"); Error (NULL, 0, 1001, "Missing option", "output file");
goto Finish; goto Finish;
} }
//
// Open input file and read file data into file buffer.
//
fpIn = fopen (mInImageName, "rb");
if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
} }
InputFileLength = _filelength (fileno (fpIn));
InputFileBuffer = malloc (InputFileLength);
if (InputFileBuffer == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
fclose (fpIn);
goto Finish;
}
fread (InputFileBuffer, 1, InputFileLength, fpIn);
fclose (fpIn);
DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) InputFileLength);
// //
// Combine multi binary HII package files. // Combine multi binary HII package files.
// //
if (OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE || OutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) { if (OutImageType == FW_HII_PACKAGE_LIST_RCIMAGE || OutImageType == FW_HII_PACKAGE_LIST_BINIMAGE) {
//
// Open output file handle.
//
fpOut = fopen (OutImageName, "wb");
if (!fpOut) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
}
// //
// Get hii package list lenght // Get hii package list lenght
// //
HiiPackageListHeader.PackageLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER); HiiPackageListHeader.PackageLength = sizeof (EFI_HII_PACKAGE_LIST_HEADER);
for (Index = 0; Index < InputFileNum; Index ++) { for (Index = 0; Index < InputFileNum; Index ++) {
fpIn = fopen (InputFileName [Index], "rb"); fpIn = fopen (InputFileName [Index], "rb");
if (!fpIn) { if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]); Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
goto Finish; goto Finish;
} }
@ -2186,7 +2535,7 @@ Returns:
HiiPackageDataPointer = HiiPackageListBuffer + sizeof (HiiPackageListHeader); HiiPackageDataPointer = HiiPackageListBuffer + sizeof (HiiPackageListHeader);
for (Index = 0; Index < InputFileNum; Index ++) { for (Index = 0; Index < InputFileNum; Index ++) {
fpIn = fopen (InputFileName [Index], "rb"); fpIn = fopen (InputFileName [Index], "rb");
if (!fpIn) { if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]); Error (NULL, 0, 0001, "Error opening file", InputFileName [Index]);
free (HiiPackageListBuffer); free (HiiPackageListBuffer);
goto Finish; goto Finish;
@ -2262,6 +2611,14 @@ Returns:
// Combine MciBinary files to one file // Combine MciBinary files to one file
// //
if (OutImageType == FW_MERGE_IMAGE) { if (OutImageType == FW_MERGE_IMAGE) {
//
// Open output file handle.
//
fpOut = fopen (OutImageName, "wb");
if (!fpOut) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
}
for (Index = 0; Index < InputFileNum; Index ++) { for (Index = 0; Index < InputFileNum; Index ++) {
fpIn = fopen (InputFileName [Index], "rb"); fpIn = fopen (InputFileName [Index], "rb");
if (!fpIn) { if (!fpIn) {
@ -2306,7 +2663,7 @@ Returns:
// //
if (OutImageType == FW_MCI_IMAGE) { if (OutImageType == FW_MCI_IMAGE) {
fpIn = fopen (mInImageName, "r"); fpIn = fopen (mInImageName, "r");
if (!fpIn) { if (fpIn == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName); Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish; goto Finish;
} }
@ -2400,63 +2757,21 @@ Returns:
// //
// Open the output file and write the buffer contents // Open the output file and write the buffer contents
// //
if (fpOut != NULL) {
if (fwrite (FileBuffer, FileLength, 1, fpOut) != 1) {
Error (NULL, 0, 0002, "Error writing file", OutImageName);
goto Finish;
}
}
if (ReplaceFlag) {
fpInOut = fopen (mInImageName, "wb");
if (fpInOut != NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
}
if (fwrite (FileBuffer, FileLength, 1, fpInOut) != 1) {
Error (NULL, 0, 0002, "Error writing file", mInImageName);
goto Finish;
}
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
// goto WriteFile;
// Convert Mci.TXT to Mci.bin file successfully
//
goto Finish;
} }
// //
// Open input file and read file data into file buffer. // Open input file and read file data into file buffer.
// //
fpIn = fopen (mInImageName, "rb"); FileLength = InputFileLength;
if (!fpIn) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
}
FileLength = _filelength (fileno (fpIn));
FileBuffer = malloc (FileLength); FileBuffer = malloc (FileLength);
if (FileBuffer == NULL) { if (FileBuffer == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!"); Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
fclose (fpIn);
goto Finish; goto Finish;
} }
memcpy (FileBuffer, InputFileBuffer, InputFileLength);
fread (FileBuffer, 1, FileLength, fpIn);
fclose (fpIn);
DebugMsg (NULL, 0, 9, "input file info", "the input file size is %u bytes", (unsigned) FileLength);
//
// Replace file
//
if (ReplaceFlag) {
fpInOut = fopen (mInImageName, "wb");
if (!fpInOut) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
}
}
// //
// Dump TeImage Header into output file. // Dump TeImage Header into output file.
// //
@ -2466,6 +2781,26 @@ Returns:
Error (NULL, 0, 3000, "Invalid", "TE header signature of file %s is not correct.", mInImageName); Error (NULL, 0, 3000, "Invalid", "TE header signature of file %s is not correct.", mInImageName);
goto Finish; goto Finish;
} }
//
// Open the output file handle.
//
if (ReplaceFlag) {
fpInOut = fopen (mInImageName, "wb");
if (fpInOut == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
}
} else {
if (OutImageName != NULL) {
fpOut = fopen (OutImageName, "wb");
} else {
fpOut = stdout;
}
if (fpOut == NULL) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
}
}
if (fpInOut != NULL) { if (fpInOut != NULL) {
fprintf (fpInOut, "Dump of file %s\n\n", mInImageName); fprintf (fpInOut, "Dump of file %s\n\n", mInImageName);
fprintf (fpInOut, "TE IMAGE HEADER VALUES\n"); fprintf (fpInOut, "TE IMAGE HEADER VALUES\n");
@ -2479,7 +2814,6 @@ Returns:
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 Base Relocation Directory\n", (unsigned) TEImageHeader.DataDirectory[0].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[0].Size);
fprintf (fpInOut, "%17X [%8X] RVA [size] of Debug Directory\n", (unsigned) TEImageHeader.DataDirectory[1].VirtualAddress, (unsigned) TEImageHeader.DataDirectory[1].Size); 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) {
fprintf (fpOut, "Dump of file %s\n\n", mInImageName); fprintf (fpOut, "Dump of file %s\n\n", mInImageName);
fprintf (fpOut, "TE IMAGE HEADER VALUES\n"); fprintf (fpOut, "TE IMAGE HEADER VALUES\n");
@ -2684,6 +3018,43 @@ Returns:
PeHdr->Pe32.FileHeader.Machine = IMAGE_FILE_MACHINE_ARMT; PeHdr->Pe32.FileHeader.Machine = IMAGE_FILE_MACHINE_ARMT;
} }
//
// Set new base address into image
//
if (OutImageType == FW_REBASE_IMAGE || OutImageType == FW_SET_ADDRESS_IMAGE) {
if ((PeHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) && (PeHdr->Pe32.FileHeader.Machine != IMAGE_FILE_MACHINE_IA64)) {
if (NewBaseAddress >= 0x100000000ULL) {
Error (NULL, 0, 3000, "Invalid", "New base address is larger than 4G for 32bit PE image");
goto Finish;
}
}
if (NegativeAddr) {
//
// Set Base Address to a negative value.
//
NewBaseAddress = (UINT64) (0 - NewBaseAddress);
}
if (OutImageType == FW_REBASE_IMAGE) {
Status = RebaseImage (mInImageName, FileBuffer, NewBaseAddress);
} else {
Status = SetAddressToSectionHeader (mInImageName, FileBuffer, NewBaseAddress);
}
if (EFI_ERROR (Status)) {
if (NegativeAddr) {
Error (NULL, 0, 3000, "Invalid", "Rebase/Set Image %s to Base address -0x%llx can't success", mInImageName, 0 - NewBaseAddress);
} else {
Error (NULL, 0, 3000, "Invalid", "Rebase/Set Image %s to Base address 0x%llx can't success", mInImageName, NewBaseAddress);
}
goto Finish;
}
//
// Write file
//
goto WriteFile;
}
// //
// Extract bin data from Pe image. // Extract bin data from Pe image.
// //
@ -2695,14 +3066,10 @@ Returns:
// //
// Output bin data from exe file // Output bin data from exe file
// //
if (fpOut != NULL) { FileLength = FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders;
fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpOut); memcpy (FileBuffer, FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, FileLength);
} VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
if (fpInOut != NULL) { goto WriteFile;
fwrite (FileBuffer + PeHdr->Pe32.OptionalHeader.SizeOfHeaders, 1, FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - PeHdr->Pe32.OptionalHeader.SizeOfHeaders));
goto Finish;
} }
// //
@ -2715,14 +3082,11 @@ Returns:
goto Finish; goto Finish;
} }
if (fpOut != NULL) { //
fwrite (FileBuffer, 1, FileLength, fpOut); // Write the updated Image
} //
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto WriteFile;
} }
// //
@ -2734,14 +3098,11 @@ Returns:
goto Finish; goto Finish;
} }
if (fpOut != NULL) { //
fwrite (FileBuffer, 1, FileLength, fpOut); // Write the updated Image
} //
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto WriteFile;
} }
// //
@ -2768,14 +3129,9 @@ Returns:
// //
// Output Apci data to file // Output Apci data to file
// //
if (fpOut != NULL) { memcpy (FileBuffer, FileBuffer + SectionHeader->PointerToRawData, FileLength);
fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpOut);
}
if (fpInOut != NULL) {
fwrite (FileBuffer + SectionHeader->PointerToRawData, 1, FileLength, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
goto Finish; goto WriteFile;
} }
} }
Error (NULL, 0, 3000, "Invalid", "failed to get ACPI table from %s.", mInImageName); Error (NULL, 0, 3000, "Invalid", "failed to get ACPI table from %s.", mInImageName);
@ -3106,36 +3462,50 @@ Returns:
// //
// Update Image to TeImage // Update Image to TeImage
// //
if (fpOut != NULL) { FileLength = FileLength - TEImageHeader.StrippedSize;
fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpOut); memcpy (FileBuffer + sizeof (EFI_TE_IMAGE_HEADER), FileBuffer + TEImageHeader.StrippedSize, FileLength);
fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpOut); FileLength = FileLength + sizeof (EFI_TE_IMAGE_HEADER);
} memcpy (FileBuffer, &TEImageHeader, sizeof (EFI_TE_IMAGE_HEADER));
if (fpInOut != NULL) { VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength));
fwrite (&TEImageHeader, 1, sizeof (EFI_TE_IMAGE_HEADER), fpInOut);
fwrite (FileBuffer + TEImageHeader.StrippedSize, 1, FileLength - TEImageHeader.StrippedSize, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) (FileLength - TEImageHeader.StrippedSize));
goto Finish;
} }
WriteFile: WriteFile:
// //
// Update Image to EfiImage // Update Image to EfiImage or TE image
// //
if (fpOut != NULL) { if (ReplaceFlag) {
fwrite (FileBuffer, 1, FileLength, fpOut); if ((FileLength != InputFileLength) || (memcmp (FileBuffer, InputFileBuffer, FileLength) != 0)) {
//
// Update File when File is changed.
//
fpInOut = fopen (mInImageName, "wb");
if (fpInOut == NULL) {
Error (NULL, 0, 0001, "Error opening file", mInImageName);
goto Finish;
} }
if (fpInOut != NULL) {
fwrite (FileBuffer, 1, FileLength, fpInOut); fwrite (FileBuffer, 1, FileLength, fpInOut);
}
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength); VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
}
} else {
if ((FileLength != OutputFileLength) || (memcmp (FileBuffer, OutputFileBuffer, FileLength) != 0)) {
fpOut = fopen (OutImageName, "wb");
if (fpOut == NULL) {
Error (NULL, 0, 0001, "Error opening output file", OutImageName);
goto Finish;
}
fwrite (FileBuffer, 1, FileLength, fpOut);
VerboseMsg ("the size of output file is %u bytes", (unsigned) FileLength);
}
}
mImageSize = FileLength;
Finish: Finish:
if (fpInOut != NULL) { if (fpInOut != NULL) {
if (GetUtilityStatus () != STATUS_SUCCESS) { if (GetUtilityStatus () != STATUS_SUCCESS) {
// //
// when file updates failed, original file is still recoveried. // when file updates failed, original file is still recovered.
// //
fwrite (FileBuffer, 1, FileLength, fpInOut); fwrite (InputFileBuffer, 1, InputFileLength, fpInOut);
} }
// //
// Write converted data into fpInOut file and close input file. // Write converted data into fpInOut file and close input file.
@ -3163,11 +3533,38 @@ Finish:
fpOut = fopen (OutImageName, "wb"); fpOut = fopen (OutImageName, "wb");
fwrite (OutputFileBuffer, 1, OutputFileLength, fpOut); fwrite (OutputFileBuffer, 1, OutputFileLength, fpOut);
fclose (fpOut); fclose (fpOut);
free (OutputFileBuffer);
} }
} }
} }
if (InputFileBuffer != NULL) {
free (InputFileBuffer);
}
if (OutputFileBuffer != NULL) {
free (OutputFileBuffer);
}
//
// Write module size and time stamp to report file.
//
if (OutImageName != NULL) {
FileLen = strlen (OutImageName);
}
if (FileLen >= 4 && strcmp (OutImageName + (FileLen - 4), ".efi") == 0) {
ReportFileName = (CHAR8 *) malloc (FileLen + 1);
if (ReportFileName != NULL) {
strcpy (ReportFileName, OutImageName);
strcpy (ReportFileName + (FileLen - 4), ".txt");
ReportFile = fopen (ReportFileName, "w+");
if (ReportFile != NULL) {
fprintf (ReportFile, "MODULE_SIZE = %u\n", (unsigned) mImageSize);
fprintf (ReportFile, "TIME_STAMP = %u\n", (unsigned) mImageTimeStamp);
fclose(ReportFile);
}
free (ReportFileName);
}
}
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 ());
return GetUtilityStatus (); return GetUtilityStatus ();
@ -3302,7 +3699,7 @@ Returns:
//Zero Debug Data and TimeStamp //Zero Debug Data and TimeStamp
// //
FileHdr->TimeDateStamp = 0; FileHdr->TimeDateStamp = 0;
mImageTimeStamp = 0;
if (ExportDirectoryEntryFileOffset != 0) { if (ExportDirectoryEntryFileOffset != 0) {
NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32)); NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32));
*NewTimeStamp = 0; *NewTimeStamp = 0;
@ -3316,6 +3713,7 @@ Returns:
if (DebugDirectoryEntryFileOffset != 0) { if (DebugDirectoryEntryFileOffset != 0) {
DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (FileBuffer + DebugDirectoryEntryFileOffset); DebugEntry = (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *) (FileBuffer + DebugDirectoryEntryFileOffset);
DebugEntry->TimeDateStamp = 0; DebugEntry->TimeDateStamp = 0;
mImageTimeStamp = 0;
if (ZeroDebugFlag) { if (ZeroDebugFlag) {
memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData); memset (FileBuffer + DebugEntry->FileOffset, 0, DebugEntry->SizeOfData);
memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY)); memset (DebugEntry, 0, sizeof (EFI_IMAGE_DEBUG_DIRECTORY_ENTRY));
@ -3542,7 +3940,7 @@ Returns:
// Set new stamp // Set new stamp
// //
FileHdr->TimeDateStamp = (UINT32) newtime; FileHdr->TimeDateStamp = (UINT32) newtime;
mImageTimeStamp = (UINT32) newtime;
if (ExportDirectoryEntryRva != 0) { if (ExportDirectoryEntryRva != 0) {
NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32)); NewTimeStamp = (UINT32 *) (FileBuffer + ExportDirectoryEntryFileOffset + sizeof (UINT32));
*NewTimeStamp = (UINT32) newtime; *NewTimeStamp = (UINT32) newtime;

View File

@ -1,3 +1,17 @@
/** @file
Ported ELF include files from FreeBSD
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/*- /*-
* Copyright (c) 1996-1998 John D. Polstra. * Copyright (c) 1996-1998 John D. Polstra.
* All rights reserved. * All rights reserved.

View File

@ -1,3 +1,16 @@
/** @file
Ported ELF include files from FreeBSD
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/*- /*-
* Copyright (c) 1996-1998 John D. Polstra. * Copyright (c) 1996-1998 John D. Polstra.
* All rights reserved. * All rights reserved.

View File

@ -1,3 +1,17 @@
/** @file
Ported ELF include files from FreeBSD
Copyright (c) 2009 - 2010, Apple, Inc. All rights reserved.
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
/*- /*-
* Copyright (c) 1998 John D. Polstra. * Copyright (c) 1998 John D. Polstra.
* All rights reserved. * All rights reserved.

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright 2006 - 2008, Intel Corporation Copyright 2006 - 2010, 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
@ -92,7 +92,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -Utility to generate the EfiLoader image containing page table.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 2008 - 2009 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 2008 - 2010 Intel Corporation. All rights reserved.\n");
} }
VOID VOID

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -27,6 +27,7 @@ Abstract:
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>
#include <Common/PiFirmwareFile.h> #include <Common/PiFirmwareFile.h>
#include <Protocol/GuidedSectionExtraction.h> #include <Protocol/GuidedSectionExtraction.h>
#include <IndustryStandard/PeImage.h>
#include "CommonLib.h" #include "CommonLib.h"
#include "Compress.h" #include "Compress.h"
@ -80,6 +81,11 @@ STATIC CHAR8 *mCompressionTypeName[] = { "PI_NONE", "PI_STD" };
#define EFI_GUIDED_SECTION_NONE 0x80 #define EFI_GUIDED_SECTION_NONE 0x80
STATIC CHAR8 *mGUIDedSectionAttribue[] = { "NONE", "PROCESSING_REQUIRED", "AUTH_STATUS_VALID"}; STATIC CHAR8 *mGUIDedSectionAttribue[] = { "NONE", "PROCESSING_REQUIRED", "AUTH_STATUS_VALID"};
STATIC CHAR8 *mAlignName[] = {
"1", "2", "4", "8", "16", "32", "64", "128", "256", "512",
"1K", "2K", "4K", "8K", "16K", "32K", "64K"
};
// //
// Crc32 GUID section related definitions. // Crc32 GUID section related definitions.
// //
@ -144,7 +150,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option
@ -180,6 +186,10 @@ Returns:
fprintf (stdout, " -j Number, --buildnumber Number\n\ fprintf (stdout, " -j Number, --buildnumber Number\n\
Number is an integer value between 0000 and 9999\n\ Number is an integer value between 0000 and 9999\n\
used in Ver section.\n"); used in Ver section.\n");
fprintf (stdout, " --sectionalign SectionAlign\n\
SectionAlign points to section alignment, which support\n\
the alignment scope 1~64K. It is specified in same\n\
order that the section file is input.\n");
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n"); fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");
fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n"); fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n");
fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n"); fprintf (stdout, " -d, --debug level Enable debug messages, at input debug level.\n");
@ -329,9 +339,50 @@ Done:
return Status; return Status;
} }
STATIC
EFI_STATUS
StringtoAlignment (
IN CHAR8 *AlignBuffer,
OUT UINT32 *AlignNumber
)
/*++
Routine Description:
Converts Align String to align value (1~64K).
Arguments:
AlignBuffer - Pointer to Align string.
AlignNumber - Pointer to Align value.
Returns:
EFI_SUCCESS Successfully convert align string to align value.
EFI_INVALID_PARAMETER Align string is invalid or align value is not in scope.
--*/
{
UINT32 Index = 0;
//
// Check AlignBuffer
//
if (AlignBuffer == NULL) {
return EFI_INVALID_PARAMETER;
}
for (Index = 0; Index < sizeof (mAlignName) / sizeof (CHAR8 *); Index ++) {
if (stricmp (AlignBuffer, mAlignName [Index]) == 0) {
*AlignNumber = 1 << Index;
return EFI_SUCCESS;
}
}
return EFI_INVALID_PARAMETER;
}
EFI_STATUS EFI_STATUS
GetSectionContents ( GetSectionContents (
CHAR8 **InputFileName, CHAR8 **InputFileName,
UINT32 *InputFileAlign,
UINT32 InputFileNum, UINT32 InputFileNum,
UINT8 *FileBuffer, UINT8 *FileBuffer,
UINT32 *BufferLength UINT32 *BufferLength
@ -347,6 +398,8 @@ Arguments:
InputFileName - Name of the input file. InputFileName - Name of the input file.
InputFileAlign - Alignment required by the input file data.
InputFileNum - Number of input files. Should be at least 1. InputFileNum - Number of input files. Should be at least 1.
FileBuffer - Output buffer to contain data FileBuffer - Output buffer to contain data
@ -363,9 +416,16 @@ Returns:
--*/ --*/
{ {
UINT32 Size; UINT32 Size;
UINT32 Offset;
UINT32 FileSize; UINT32 FileSize;
UINT32 Index; UINT32 Index;
FILE *InFile; FILE *InFile;
EFI_COMMON_SECTION_HEADER *SectHeader;
EFI_COMMON_SECTION_HEADER TempSectHeader;
EFI_TE_IMAGE_HEADER TeHeader;
UINT32 TeOffset;
EFI_GUID_DEFINED_SECTION GuidSectHeader;
UINT32 HeaderSize;
if (InputFileNum < 1) { if (InputFileNum < 1) {
Error (NULL, 0, 2000, "Invalid paramter", "must specify at least one input file"); Error (NULL, 0, 2000, "Invalid paramter", "must specify at least one input file");
@ -378,6 +438,8 @@ Returns:
} }
Size = 0; Size = 0;
Offset = 0;
TeOffset = 0;
// //
// Go through our array of file names and copy their contents // Go through our array of file names and copy their contents
// to the output buffer. // to the output buffer.
@ -406,11 +468,66 @@ Returns:
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 %u bytes", InputFileName[Index], (unsigned) FileSize); DebugMsg (NULL, 0, 9, "Input files", "the input file name is %s and the size is %u bytes", InputFileName[Index], (unsigned) FileSize);
//
// Adjust section buffer when section alignment is required.
//
if (InputFileAlign != NULL) {
//
// Check this section is Te/Pe section, and Calculate the numbers of Te/Pe section.
//
TeOffset = 0;
HeaderSize = sizeof (EFI_COMMON_SECTION_HEADER);
fread (&TempSectHeader, 1, sizeof (TempSectHeader), InFile);
if (TempSectHeader.Type == EFI_SECTION_TE) {
fread (&TeHeader, 1, sizeof (TeHeader), InFile);
if (TeHeader.Signature == EFI_TE_IMAGE_HEADER_SIGNATURE) {
TeOffset = TeHeader.StrippedSize - sizeof (TeHeader);
}
} else if (TempSectHeader.Type == EFI_SECTION_GUID_DEFINED) {
fseek (InFile, 0, SEEK_SET);
fread (&GuidSectHeader, 1, sizeof (GuidSectHeader), InFile);
if ((GuidSectHeader.Attributes & EFI_GUIDED_SECTION_PROCESSING_REQUIRED) == 0) {
HeaderSize = GuidSectHeader.DataOffset;
}
}
fseek (InFile, 0, SEEK_SET);
//
// Revert TeOffset to the converse value relative to Alignment
// This is to assure the original PeImage Header at Alignment.
//
if (TeOffset != 0) {
TeOffset = InputFileAlign [Index] - (TeOffset % InputFileAlign [Index]);
TeOffset = TeOffset % InputFileAlign [Index];
}
//
// make sure section data meet its alignment requirement by adding one raw pad section.
//
if ((InputFileAlign [Index] != 0) && (((Size + HeaderSize + TeOffset) % InputFileAlign [Index]) != 0)) {
Offset = (Size + sizeof (EFI_COMMON_SECTION_HEADER) + HeaderSize + TeOffset + InputFileAlign [Index] - 1) & ~(InputFileAlign [Index] - 1);
Offset = Offset - Size - HeaderSize - TeOffset;
if (FileBuffer != NULL && ((Size + Offset) < *BufferLength)) {
memset (FileBuffer + Size, 0, Offset);
SectHeader = (EFI_COMMON_SECTION_HEADER *) (FileBuffer + Size);
SectHeader->Type = EFI_SECTION_RAW;
SectHeader->Size[0] = (UINT8) (Offset & 0xff);
SectHeader->Size[1] = (UINT8) ((Offset & 0xff00) >> 8);
SectHeader->Size[2] = (UINT8) ((Offset & 0xff0000) >> 16);
}
DebugMsg (NULL, 0, 9, "Pad raw section for section data alignment", "Pad Raw section size is %u", (unsigned) Offset);
Size = Size + Offset;
}
}
// //
// 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.
// //
if (FileSize > 0 && FileBuffer != NULL && (Size + FileSize) <= *BufferLength) { if ((FileSize > 0) && (FileBuffer != NULL) && ((Size + FileSize) <= *BufferLength)) {
if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) { if (fread (FileBuffer + Size, (size_t) FileSize, 1, InFile) != 1) {
Error (NULL, 0, 0004, "Error reading file", InputFileName[Index]); Error (NULL, 0, 0004, "Error reading file", InputFileName[Index]);
fclose (InFile); fclose (InFile);
@ -437,6 +554,7 @@ Returns:
EFI_STATUS EFI_STATUS
GenSectionCompressionSection ( GenSectionCompressionSection (
CHAR8 **InputFileName, CHAR8 **InputFileName,
UINT32 *InputFileAlign,
UINT32 InputFileNum, UINT32 InputFileNum,
UINT8 SectCompSubType, UINT8 SectCompSubType,
UINT8 **OutFileBuffer UINT8 **OutFileBuffer
@ -454,6 +572,8 @@ Arguments:
InputFileName - Name of the input file. InputFileName - Name of the input file.
InputFileAlign - Alignment required by the input file data.
InputFileNum - Number of input files. Should be at least 1. InputFileNum - Number of input files. Should be at least 1.
SectCompSubType - Specify the compression algorithm requested. SectCompSubType - Specify the compression algorithm requested.
@ -487,6 +607,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
FileBuffer, FileBuffer,
&InputLength &InputLength
@ -503,6 +624,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
FileBuffer, FileBuffer,
&InputLength &InputLength
@ -524,6 +646,16 @@ Returns:
switch (SectCompSubType) { switch (SectCompSubType) {
case EFI_NOT_COMPRESSED: case EFI_NOT_COMPRESSED:
CompressedLength = InputLength; CompressedLength = InputLength;
//
// Copy file buffer to the none compressed data.
//
OutputBuffer = malloc (CompressedLength + sizeof (EFI_COMPRESSION_SECTION));
if (OutputBuffer == NULL) {
free (FileBuffer);
return EFI_OUT_OF_RESOURCES;
}
memcpy (OutputBuffer + sizeof (EFI_COMPRESSION_SECTION), FileBuffer, CompressedLength);
FileBuffer = OutputBuffer;
break; break;
case EFI_STANDARD_COMPRESSION: case EFI_STANDARD_COMPRESSION:
@ -599,6 +731,7 @@ Returns:
EFI_STATUS EFI_STATUS
GenSectionGuidDefinedSection ( GenSectionGuidDefinedSection (
CHAR8 **InputFileName, CHAR8 **InputFileName,
UINT32 *InputFileAlign,
UINT32 InputFileNum, UINT32 InputFileNum,
EFI_GUID *VendorGuid, EFI_GUID *VendorGuid,
UINT16 DataAttribute, UINT16 DataAttribute,
@ -618,6 +751,8 @@ Arguments:
InputFileName - Name of the input file. InputFileName - Name of the input file.
InputFileAlign - Alignment required by the input file data.
InputFileNum - Number of input files. Should be at least 1. InputFileNum - Number of input files. Should be at least 1.
VendorGuid - Specify vendor guid value. VendorGuid - Specify vendor guid value.
@ -662,6 +797,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
FileBuffer, FileBuffer,
&InputLength &InputLength
@ -678,6 +814,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
FileBuffer + Offset, FileBuffer + Offset,
&InputLength &InputLength
@ -797,7 +934,11 @@ Returns:
UINT8 *OutFileBuffer; UINT8 *OutFileBuffer;
EFI_STATUS Status; EFI_STATUS Status;
UINT64 LogLevel; UINT64 LogLevel;
UINT32 *InputFileAlign;
UINT32 InputFileAlignNum;
InputFileAlign = NULL;
InputFileAlignNum = 0;
InputFileName = NULL; InputFileName = NULL;
OutputFileName = NULL; OutputFileName = NULL;
SectionName = NULL; SectionName = NULL;
@ -809,7 +950,7 @@ Returns:
InputFileNum = 0; InputFileNum = 0;
SectType = EFI_SECTION_ALL; SectType = EFI_SECTION_ALL;
SectCompSubType = 0; SectCompSubType = 0;
SectGuidAttribute = 0; SectGuidAttribute = EFI_GUIDED_SECTION_NONE;
OutFileBuffer = NULL; OutFileBuffer = NULL;
InputLength = 0; InputLength = 0;
Status = STATUS_SUCCESS; Status = STATUS_SUCCESS;
@ -983,6 +1124,41 @@ Returns:
continue; continue;
} }
//
// Section File alignment requirement
//
if (stricmp (argv[0], "--sectionalign") == 0) {
if (InputFileAlignNum == 0) {
InputFileAlign = (UINT32 *) malloc (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
if (InputFileAlign == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return 1;
}
memset (InputFileAlign, 1, MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32));
} else if (InputFileAlignNum % MAXIMUM_INPUT_FILE_NUM == 0) {
InputFileAlign = (UINT32 *) realloc (
InputFileAlign,
(InputFileNum + MAXIMUM_INPUT_FILE_NUM) * sizeof (UINT32)
);
if (InputFileAlign == NULL) {
Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
return 1;
}
memset (&(InputFileAlign[InputFileNum]), 1, (MAXIMUM_INPUT_FILE_NUM * sizeof (UINT32)));
}
Status = StringtoAlignment (argv[1], &(InputFileAlign[InputFileAlignNum]));
if (EFI_ERROR (Status)) {
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);
goto Finish;
}
argc -= 2;
argv += 2;
InputFileAlignNum ++;
continue;
}
// //
// Get Input file name // Get Input file name
// //
@ -992,7 +1168,6 @@ Returns:
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated"); Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
return 1; return 1;
} }
memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *))); memset (InputFileName, 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
} else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) { } else if (InputFileNum % MAXIMUM_INPUT_FILE_NUM == 0) {
// //
@ -1007,7 +1182,6 @@ Returns:
Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated"); Error (NULL, 0, 4001, "Resource", "memory cannot be allcoated");
return 1; return 1;
} }
memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *))); memset (&(InputFileName[InputFileNum]), 0, (MAXIMUM_INPUT_FILE_NUM * sizeof (CHAR8 *)));
} }
@ -1016,6 +1190,11 @@ Returns:
argv ++; argv ++;
} }
if (InputFileAlignNum > 0 && InputFileAlignNum != InputFileNum) {
Error (NULL, 0, 1003, "Invalid option", "section alignment must be set for each section");
goto Finish;
}
VerboseMsg ("%s tool start.", UTILITY_NAME); VerboseMsg ("%s tool start.", UTILITY_NAME);
// //
@ -1050,14 +1229,11 @@ Returns:
memcpy (&VendorGuid, &mEfiCrc32SectionGuid, sizeof (EFI_GUID)); memcpy (&VendorGuid, &mEfiCrc32SectionGuid, sizeof (EFI_GUID));
} }
if (SectGuidAttribute == 0) {
SectGuidAttribute = EFI_GUIDED_SECTION_PROCESSING_REQUIRED;
}
if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) { if ((SectGuidAttribute & EFI_GUIDED_SECTION_NONE) != 0) {
// //
// NONE attribute, clear attribute value. // NONE attribute, clear attribute value.
// //
SectGuidAttribute = 0; SectGuidAttribute = SectGuidAttribute & ~EFI_GUIDED_SECTION_NONE;
} }
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",
(unsigned) VendorGuid.Data1, (unsigned) VendorGuid.Data1,
@ -1161,8 +1337,13 @@ Returns:
// //
switch (SectType) { switch (SectType) {
case EFI_SECTION_COMPRESSION: case EFI_SECTION_COMPRESSION:
if (InputFileAlign != NULL) {
free (InputFileAlign);
InputFileAlign = NULL;
}
Status = GenSectionCompressionSection ( Status = GenSectionCompressionSection (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
SectCompSubType, SectCompSubType,
&OutFileBuffer &OutFileBuffer
@ -1170,8 +1351,17 @@ Returns:
break; break;
case EFI_SECTION_GUID_DEFINED: case EFI_SECTION_GUID_DEFINED:
if (InputFileAlign != NULL && (CompareGuid (&VendorGuid, &mEfiCrc32SectionGuid) != 0)) {
//
// Only process alignment for the default known CRC32 guided section.
// For the unknown guided section, the alignment is processed when the dummy all section (EFI_SECTION_ALL) is generated.
//
free (InputFileAlign);
InputFileAlign = NULL;
}
Status = GenSectionGuidDefinedSection ( Status = GenSectionGuidDefinedSection (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
&VendorGuid, &VendorGuid,
SectGuidAttribute, SectGuidAttribute,
@ -1232,6 +1422,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
OutFileBuffer, OutFileBuffer,
&InputLength &InputLength
@ -1248,6 +1439,7 @@ Returns:
// //
Status = GetSectionContents ( Status = GetSectionContents (
InputFileName, InputFileName,
InputFileAlign,
InputFileNum, InputFileNum,
OutFileBuffer, OutFileBuffer,
&InputLength &InputLength
@ -1296,6 +1488,10 @@ Finish:
free (InputFileName); free (InputFileName);
} }
if (InputFileAlign != NULL) {
free (InputFileAlign);
}
if (OutFileBuffer != NULL) { if (OutFileBuffer != NULL) {
free (OutFileBuffer); free (OutFileBuffer);
} }

View File

@ -1,6 +1,6 @@
/** /**
Copyright (c) 1999-2008 Intel Corporation. All rights reserved Copyright (c) 1999-2010 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
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -342,7 +342,6 @@ Returns:
VtfInfo->LocationType = SECOND_VTF; VtfInfo->LocationType = SECOND_VTF;
} else { } else {
VtfInfo->LocationType = NONE; VtfInfo->LocationType = NONE;
Warning(UTILITY_NAME, 0, 0001, "Unknown location for component.", VtfInfo->CompName);
} }
} else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) { } else if (strnicmp (*TokenStr, "COMP_TYPE", 9) == 0) {
TokenStr++; TokenStr++;
@ -2408,7 +2407,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007 - 2009, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option
// //

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright 2006 - 2009, Intel Corporation Copyright 2006 - 2010, 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
@ -273,7 +273,7 @@ Version (
) )
{ {
printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -Utility to retrieve and update the boot sector or MBR.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 2007-2009 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 2007-2010 Intel Corporation. All rights reserved.\n");
} }

View File

@ -68,12 +68,10 @@ typedef UINT8 EFI_FFS_FILE_STATE;
#define FFS_ATTRIB_DATA_ALIGNMENT 0x38 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38
#define FFS_ATTRIB_CHECKSUM 0x40 #define FFS_ATTRIB_CHECKSUM 0x40
// //
// FFS_FIXED_CHECKSUM is the default checksum value used when the // FFS_FIXED_CHECKSUM is the checksum value used when the
// FFS_ATTRIB_CHECKSUM attribute bit is clear // FFS_ATTRIB_CHECKSUM attribute bit is clear
// note this is NOT an architecturally defined value, but is in this file for
// implementation convenience
// //
#define FFS_FIXED_CHECKSUM 0x5A #define FFS_FIXED_CHECKSUM 0xAA
// //
// FFS File State Bits. // FFS File State Bits.

View File

@ -3,7 +3,7 @@
IFR is primarily consumed by the EFI presentation engine, and produced by EFI IFR is primarily consumed by the EFI presentation engine, and produced by EFI
internal application and drivers as well as all add-in card option-ROM drivers internal application and drivers as well as all add-in card option-ROM drivers
Copyright (c) 2006 - 2009, Intel Corporation All rights reserved. Copyright (c) 2006 - 2010, 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
@ -618,6 +618,7 @@ typedef union {
#define EFI_IFR_DISABLE_IF_OP 0x1E #define EFI_IFR_DISABLE_IF_OP 0x1E
#define EFI_IFR_TO_LOWER_OP 0x20 #define EFI_IFR_TO_LOWER_OP 0x20
#define EFI_IFR_TO_UPPER_OP 0x21 #define EFI_IFR_TO_UPPER_OP 0x21
#define EFI_IFR_MAP_OP 0x22
#define EFI_IFR_ORDERED_LIST_OP 0x23 #define EFI_IFR_ORDERED_LIST_OP 0x23
#define EFI_IFR_VARSTORE_OP 0x24 #define EFI_IFR_VARSTORE_OP 0x24
#define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25 #define EFI_IFR_VARSTORE_NAME_VALUE_OP 0x25
@ -626,6 +627,10 @@ typedef union {
#define EFI_IFR_VERSION_OP 0x28 #define EFI_IFR_VERSION_OP 0x28
#define EFI_IFR_END_OP 0x29 #define EFI_IFR_END_OP 0x29
#define EFI_IFR_MATCH_OP 0x2A #define EFI_IFR_MATCH_OP 0x2A
#define EFI_IFR_GET_OP 0x2B
#define EFI_IFR_SET_OP 0x2C
#define EFI_IFR_READ_OP 0x2D
#define EFI_IFR_WRITE_OP 0x2E
#define EFI_IFR_EQUAL_OP 0x2F #define EFI_IFR_EQUAL_OP 0x2F
#define EFI_IFR_NOT_EQUAL_OP 0x30 #define EFI_IFR_NOT_EQUAL_OP 0x30
#define EFI_IFR_GREATER_THAN_OP 0x31 #define EFI_IFR_GREATER_THAN_OP 0x31
@ -672,6 +677,7 @@ typedef union {
#define EFI_IFR_VALUE_OP 0x5A #define EFI_IFR_VALUE_OP 0x5A
#define EFI_IFR_DEFAULT_OP 0x5B #define EFI_IFR_DEFAULT_OP 0x5B
#define EFI_IFR_DEFAULTSTORE_OP 0x5C #define EFI_IFR_DEFAULTSTORE_OP 0x5C
#define EFI_IFR_FORM_MAP_OP 0x5D
#define EFI_IFR_CATENATE_OP 0x5E #define EFI_IFR_CATENATE_OP 0x5E
#define EFI_IFR_GUID_OP 0x5F #define EFI_IFR_GUID_OP 0x5F
#define EFI_IFR_SECURITY_OP 0x60 #define EFI_IFR_SECURITY_OP 0x60
@ -730,14 +736,14 @@ typedef struct _EFI_IFR_VARSTORE {
typedef struct _EFI_IFR_VARSTORE_EFI { typedef struct _EFI_IFR_VARSTORE_EFI {
EFI_IFR_OP_HEADER Header; EFI_IFR_OP_HEADER Header;
UINT16 VarStoreId; EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid; EFI_GUID Guid;
UINT32 Attributes; UINT32 Attributes;
} EFI_IFR_VARSTORE_EFI; } EFI_IFR_VARSTORE_EFI;
typedef struct _EFI_IFR_VARSTORE_NAME_VALUE { typedef struct _EFI_IFR_VARSTORE_NAME_VALUE {
EFI_IFR_OP_HEADER Header; EFI_IFR_OP_HEADER Header;
UINT16 VarStoreId; EFI_VARSTORE_ID VarStoreId;
EFI_GUID Guid; EFI_GUID Guid;
} EFI_IFR_VARSTORE_NAME_VALUE; } EFI_IFR_VARSTORE_NAME_VALUE;
@ -747,7 +753,7 @@ typedef struct _EFI_IFR_FORM_SET {
EFI_STRING_ID FormSetTitle; EFI_STRING_ID FormSetTitle;
EFI_STRING_ID Help; EFI_STRING_ID Help;
UINT8 Flags; UINT8 Flags;
EFI_GUID ClassGuid[1]; // EFI_GUID ClassGuid[];
} EFI_IFR_FORM_SET; } EFI_IFR_FORM_SET;
typedef struct _EFI_IFR_END { typedef struct _EFI_IFR_END {
@ -1009,6 +1015,9 @@ typedef struct _EFI_IFR_ONE_OF_OPTION {
#define EFI_IFR_TYPE_DATE 0x06 #define EFI_IFR_TYPE_DATE 0x06
#define EFI_IFR_TYPE_STRING 0x07 #define EFI_IFR_TYPE_STRING 0x07
#define EFI_IFR_TYPE_OTHER 0x08 #define EFI_IFR_TYPE_OTHER 0x08
#define EFI_IFR_TYPE_UNDEFINED 0x09
#define EFI_IFR_TYPE_ACTION 0x0A
#define EFI_IFR_TYPE_BUFFER 0x0B
#define EFI_IFR_OPTION_DEFAULT 0x10 #define EFI_IFR_OPTION_DEFAULT 0x10
#define EFI_IFR_OPTION_DEFAULT_MFG 0x20 #define EFI_IFR_OPTION_DEFAULT_MFG 0x20
@ -1288,6 +1297,100 @@ typedef struct _EFI_IFR_SECURITY {
EFI_GUID Permissions; EFI_GUID Permissions;
} EFI_IFR_SECURITY; } EFI_IFR_SECURITY;
typedef struct _EFI_IFR_FORM_MAP_METHOD {
///
/// The string identifier which provides the human-readable name of
/// the configuration method for this standards map form.
///
EFI_STRING_ID MethodTitle;
///
/// Identifier which uniquely specifies the configuration methods
/// associated with this standards map form.
///
EFI_GUID MethodIdentifier;
} EFI_IFR_FORM_MAP_METHOD;
typedef struct _EFI_IFR_FORM_MAP {
///
/// The sequence that defines the type of opcode as well as the length
/// of the opcode being defined. Header.OpCode = EFI_IFR_FORM_MAP_OP.
///
EFI_IFR_OP_HEADER Header;
///
/// The unique identifier for this particular form.
///
EFI_FORM_ID FormId;
///
/// One or more configuration method's name and unique identifier.
///
// EFI_IFR_FORM_MAP_METHOD Methods[];
} EFI_IFR_FORM_MAP;
typedef struct _EFI_IFR_SET {
///
/// The sequence that defines the type of opcode as well as the length
/// of the opcode being defined. Header.OpCode = EFI_IFR_SET_OP.
///
EFI_IFR_OP_HEADER Header;
///
/// Specifies the identifier of a previously declared variable store to
/// use when storing the question's value.
///
EFI_VARSTORE_ID VarStoreId;
union {
///
/// A 16-bit Buffer Storage offset.
///
EFI_STRING_ID VarName;
///
/// A Name Value or EFI Variable name (VarName).
///
UINT16 VarOffset;
} VarStoreInfo;
///
/// Specifies the type used for storage.
///
UINT8 VarStoreType;
} EFI_IFR_SET;
typedef struct _EFI_IFR_GET {
///
/// The sequence that defines the type of opcode as well as the length
/// of the opcode being defined. Header.OpCode = EFI_IFR_GET_OP.
///
EFI_IFR_OP_HEADER Header;
///
/// Specifies the identifier of a previously declared variable store to
/// use when retrieving the value.
///
EFI_VARSTORE_ID VarStoreId;
union {
///
/// A 16-bit Buffer Storage offset.
///
EFI_STRING_ID VarName;
///
/// A Name Value or EFI Variable name (VarName).
///
UINT16 VarOffset;
} VarStoreInfo;
///
/// Specifies the type used for storage.
///
UINT8 VarStoreType;
} EFI_IFR_GET;
typedef struct _EFI_IFR_READ {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_READ;
typedef struct _EFI_IFR_WRITE {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_WRITE;
typedef struct _EFI_IFR_MAP {
EFI_IFR_OP_HEADER Header;
} EFI_IFR_MAP;
// //
// Keyboard Package // Keyboard Package
// //

View File

@ -1,3 +1,15 @@
@REM ## @file
@REM #
@REM # Copyright (c) 2007 - 2010, Intel Corporation
@REM # All rights reserved. This program and the accompanying materials
@REM # are licensed and made available under the terms and conditions of the BSD License
@REM # which accompanies this distribution. The full text of the license may be found at
@REM # http://opensource.org/licenses/bsd-license.php
@REM #
@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
@echo off @echo off
setlocal setlocal
SET NMAKE_COMMAND=%1 SET NMAKE_COMMAND=%1

View File

@ -1,3 +1,15 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
MAKEROOT ?= ../.. MAKEROOT ?= ../..
include $(MAKEROOT)/Makefiles/header.makefile include $(MAKEROOT)/Makefiles/header.makefile

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
DEPFILES = $(OBJECTS:%.o=%.d) DEPFILES = $(OBJECTS:%.o=%.d)
$(MAKEROOT)/libs-$(ARCH): $(MAKEROOT)/libs-$(ARCH):

View File

@ -1,8 +1,19 @@
## @file
#
# The makefile can be invoked with # The makefile can be invoked with
# ARCH = x86_64 or x64 for EM64T build # ARCH = x86_64 or x64 for EM64T build
# ARCH = ia32 or IA32 for IA32 build # ARCH = ia32 or IA32 for IA32 build
# ARCH = ia64 or IA64 for IA64 build # ARCH = ia64 or IA64 for IA64 build
# #
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
ARCH ?= IA32 ARCH ?= IA32
CYGWIN:=$(findstring CYGWIN, $(shell uname -s)) CYGWIN:=$(findstring CYGWIN, $(shell uname -s))

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
include $(MAKEROOT)/Makefiles/header.makefile include $(MAKEROOT)/Makefiles/header.makefile
LIBRARY = $(MAKEROOT)/libs/lib$(LIBNAME).a LIBRARY = $(MAKEROOT)/libs/lib$(LIBNAME).a

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
!INCLUDE ..\Makefiles\ms.common !INCLUDE ..\Makefiles\ms.common
APPLICATION = $(BIN_PATH)\$(APPNAME).exe APPLICATION = $(BIN_PATH)\$(APPNAME).exe

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
!IFNDEF EDK_TOOLS_PATH !IFNDEF EDK_TOOLS_PATH
!ERROR "Please set your EDK_TOOLS_PATH!" !ERROR "Please set your EDK_TOOLS_PATH!"
!ENDIF !ENDIF

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
!INCLUDE ..\Makefiles\ms.common !INCLUDE ..\Makefiles\ms.common
LIBRARY = $(LIB_PATH)\$(LIBNAME).lib LIBRARY = $(LIB_PATH)\$(LIBNAME).lib

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#DEPFILES = $(OBJECTS:%.o=%.d) #DEPFILES = $(OBJECTS:%.o=%.d)
.c.obj : .c.obj :

View File

@ -1,3 +1,16 @@
/** @file
Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Python.h> #include <Python.h>
#include <Decompress.h> #include <Decompress.h>

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
!INCLUDE ..\Makefiles\ms.common !INCLUDE ..\Makefiles\ms.common
APPNAME = GenSec APPNAME = GenSec

View File

@ -1,3 +1,14 @@
## @file
#
# Copyright (c) 2007 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
!INCLUDE ..\Makefiles\ms.common !INCLUDE ..\Makefiles\ms.common
APPNAME = GenSec APPNAME = GenSec

View File

@ -1,3 +1,16 @@
/** @file
Copyright (c) 2009 - 2010 Intel Corporation. All rights reserved
This program and the accompanying materials are licensed and made available
under the terms and conditions of the BSD License which accompanies this
distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
#include <Python.h> #include <Python.h>
#include <Windows.h> #include <Windows.h>
#include <Common/UefiBaseTypes.h> #include <Common/UefiBaseTypes.h>

View File

@ -2,7 +2,7 @@
Split a file into two pieces at the request offset. Split a file into two pieces at the request offset.
Copyright (c) 1999-2008 Intel Corporation. All rights reserved Copyright (c) 1999-2010 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
distribution. The full text of the license may be found at distribution. The full text of the license may be found at
@ -58,7 +58,7 @@ Returns:
--*/ --*/
{ {
printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION); printf ("%s v%d.%d -Utility to break a file into two pieces at the request offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n"); printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");
} }
void void

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2007 - 2008, Intel Corporation Copyright (c) 2007 - 2010, 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
@ -1695,7 +1695,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -31,6 +31,7 @@ Abstract:
#define MAX_VFR_LINE_LEN 4096 #define MAX_VFR_LINE_LEN 4096
#define EFI_IFR_MAX_LENGTH 0xFF #define EFI_IFR_MAX_LENGTH 0xFF
#define MAX_IFR_EXPRESSION_DEPTH 0x9
#define EFI_VARSTORE_ID_INVALID 0 #define EFI_VARSTORE_ID_INVALID 0
#define EFI_VAROFFSET_INVALID 0xFFFF #define EFI_VAROFFSET_INVALID 0xFFFF

View File

@ -2,7 +2,7 @@
VfrCompiler main class and main function. VfrCompiler main class and main function.
Copyright (c) 2004 - 2008, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -24,9 +24,19 @@ PACKAGE_DATA gCBuffer;
PACKAGE_DATA gRBuffer; PACKAGE_DATA gRBuffer;
VOID VOID
CVfrCompiler::DebugError () { CVfrCompiler::DebugError (
Error (NULL, 0, 0001, "Error parsing vfr file", " %s", mOptions.VfrFileName); IN CHAR8 *FileName,
//_asm int 3; IN UINT32 LineNumber,
IN UINT32 MessageCode,
IN CONST CHAR8 *Text,
IN CONST CHAR8 *MsgFmt,
...
)
{
va_list List;
va_start (List, MsgFmt);
PrintMessage ((CHAR8 *) "ERROR", FileName, LineNumber, MessageCode, (CHAR8 *) Text, (CHAR8 *) MsgFmt, List);
va_end (List);
} }
VOID VOID
@ -53,7 +63,7 @@ CVfrCompiler::OptionInitialization (
{ {
INT32 Index; INT32 Index;
SetUtilityName (PROGRAM_NAME); SetUtilityName ((CHAR8*) PROGRAM_NAME);
mOptions.VfrFileName[0] = '\0'; mOptions.VfrFileName[0] = '\0';
mOptions.RecordListFile[0] = '\0'; mOptions.RecordListFile[0] = '\0';
@ -84,11 +94,9 @@ CVfrCompiler::OptionInitialization (
mOptions.CreateRecordListFile = TRUE; mOptions.CreateRecordListFile = TRUE;
gCIfrRecordInfoDB.TurnOn (); gCIfrRecordInfoDB.TurnOn ();
} else if (stricmp(Argv[Index], "-i") == 0) { } else if (stricmp(Argv[Index], "-i") == 0) {
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
goto Fail;
Index++; Index++;
if ((Index >= Argc) || (Argv[Index][0] == '-')) { if ((Index >= Argc) || (Argv[Index][0] == '-')) {
Error (NULL, 0, 1001, "Missing option", "-i missing path argument"); DebugError (NULL, 0, 1001, "Missing option", "-i missing path argument");
goto Fail; goto Fail;
} }
@ -96,7 +104,7 @@ CVfrCompiler::OptionInitialization (
} else if (stricmp(Argv[Index], "-o") == 0 || stricmp(Argv[Index], "--output-directory") == 0 || stricmp(Argv[Index], "-od") == 0) { } else if (stricmp(Argv[Index], "-o") == 0 || stricmp(Argv[Index], "--output-directory") == 0 || stricmp(Argv[Index], "-od") == 0) {
Index++; Index++;
if ((Index >= Argc) || (Argv[Index][0] == '-')) { if ((Index >= Argc) || (Argv[Index][0] == '-')) {
Error (NULL, 0, 1001, "Missing option", "-o missing output directory name"); DebugError (NULL, 0, 1001, "Missing option", "-o missing output directory name");
goto Fail; goto Fail;
} }
strcpy (mOptions.OutputDirectory, Argv[Index]); strcpy (mOptions.OutputDirectory, Argv[Index]);
@ -109,17 +117,15 @@ CVfrCompiler::OptionInitialization (
strcat (mOptions.OutputDirectory, "\\"); strcat (mOptions.OutputDirectory, "\\");
} }
} }
DebugMsg (NULL, 0, 9, "Output Directory", mOptions.OutputDirectory); DebugMsg (NULL, 0, 9, (CHAR8 *) "Output Directory", mOptions.OutputDirectory);
} else if (stricmp(Argv[Index], "-b") == 0 || stricmp(Argv[Index], "--create-ifr-package") == 0 || stricmp(Argv[Index], "-ibin") == 0) { } else if (stricmp(Argv[Index], "-b") == 0 || stricmp(Argv[Index], "--create-ifr-package") == 0 || stricmp(Argv[Index], "-ibin") == 0) {
mOptions.CreateIfrPkgFile = TRUE; mOptions.CreateIfrPkgFile = TRUE;
} else if (stricmp(Argv[Index], "-n") == 0 || stricmp(Argv[Index], "--no-pre-processing") == 0 || stricmp(Argv[Index], "-nopp") == 0) { } else if (stricmp(Argv[Index], "-n") == 0 || stricmp(Argv[Index], "--no-pre-processing") == 0 || stricmp(Argv[Index], "-nopp") == 0) {
mOptions.SkipCPreprocessor = TRUE; mOptions.SkipCPreprocessor = TRUE;
} else if (stricmp(Argv[Index], "-f") == 0 || stricmp(Argv[Index], "--pre-processing-flag") == 0 || stricmp(Argv[Index], "-ppflag") == 0) { } else if (stricmp(Argv[Index], "-f") == 0 || stricmp(Argv[Index], "--pre-processing-flag") == 0 || stricmp(Argv[Index], "-ppflag") == 0) {
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
goto Fail;
Index++; Index++;
if ((Index >= Argc) || (Argv[Index][0] == '-')) { if ((Index >= Argc) || (Argv[Index][0] == '-')) {
Error (NULL, 0, 1001, "Missing option", "-od - missing C-preprocessor argument"); DebugError (NULL, 0, 1001, "Missing option", "-od - missing C-preprocessor argument");
goto Fail; goto Fail;
} }
@ -127,13 +133,13 @@ CVfrCompiler::OptionInitialization (
} else if (stricmp(Argv[Index], "-c") == 0 || stricmp(Argv[Index], "--compatible-framework") == 0) { } else if (stricmp(Argv[Index], "-c") == 0 || stricmp(Argv[Index], "--compatible-framework") == 0) {
mOptions.CompatibleMode = TRUE; mOptions.CompatibleMode = TRUE;
} else { } else {
Error (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]); DebugError (NULL, 0, 1000, "Unknown option", "unrecognized option %s", Argv[Index]);
goto Fail; goto Fail;
} }
} }
if (Index != Argc - 1) { if (Index != Argc - 1) {
Error (NULL, 0, 1001, "Missing option", "VFR file name is not specified."); DebugError (NULL, 0, 1001, "Missing option", "VFR file name is not specified.");
goto Fail; goto Fail;
} else { } else {
strcpy (mOptions.VfrFileName, Argv[Index]); strcpy (mOptions.VfrFileName, Argv[Index]);
@ -192,7 +198,7 @@ CVfrCompiler::AppendIncludePath (
} }
IncludePaths = new CHAR8[Len]; IncludePaths = new CHAR8[Len];
if (IncludePaths == NULL) { if (IncludePaths == NULL) {
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL); DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
return; return;
} }
IncludePaths[0] = '\0'; IncludePaths[0] = '\0';
@ -221,7 +227,7 @@ CVfrCompiler::AppendCPreprocessorOptions (
} }
Opt = new CHAR8[Len]; Opt = new CHAR8[Len];
if (Opt == NULL) { if (Opt == NULL) {
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL); DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
return; return;
} }
Opt[0] = 0; Opt[0] = 0;
@ -339,8 +345,8 @@ CVfrCompiler::CVfrCompiler (
IN CHAR8 **Argv IN CHAR8 **Argv
) )
{ {
mPreProcessCmd = PREPROCESSOR_COMMAND; mPreProcessCmd = (CHAR8 *) PREPROCESSOR_COMMAND;
mPreProcessOpt = PREPROCESSOR_OPTIONS; mPreProcessOpt = (CHAR8 *) PREPROCESSOR_OPTIONS;
OptionInitialization(Argc, Argv); OptionInitialization(Argc, Argv);
@ -377,6 +383,7 @@ CVfrCompiler::Usage (
CONST CHAR8 *Help[] = { CONST CHAR8 *Help[] = {
" ", " ",
"VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME, "VfrCompile version " VFR_COMPILER_VERSION VFR_COMPILER_UPDATE_TIME,
"Copyright (c) 2004-2010 Intel Corporation. All rights reserved.",
" ", " ",
"Usage: VfrCompile [options] VfrFile", "Usage: VfrCompile [options] VfrFile",
" ", " ",
@ -417,7 +424,7 @@ CVfrCompiler::PreProcess (
} }
if ((pVfrFile = fopen (mOptions.VfrFileName, "r")) == NULL) { if ((pVfrFile = fopen (mOptions.VfrFileName, "r")) == NULL) {
Error (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName); DebugError (NULL, 0, 0001, "Error opening the input VFR file", mOptions.VfrFileName);
goto Fail; goto Fail;
} }
fclose (pVfrFile); fclose (pVfrFile);
@ -433,7 +440,7 @@ CVfrCompiler::PreProcess (
PreProcessCmd = new CHAR8[CmdLen + 10]; PreProcessCmd = new CHAR8[CmdLen + 10];
if (PreProcessCmd == NULL) { if (PreProcessCmd == NULL) {
Error (NULL, 0, 4001, "Resource: memory can't be allocated", NULL); DebugError (NULL, 0, 4001, "Resource: memory can't be allocated", NULL);
goto Fail; goto Fail;
} }
strcpy (PreProcessCmd, mPreProcessCmd), strcat (PreProcessCmd, " "); strcpy (PreProcessCmd, mPreProcessCmd), strcat (PreProcessCmd, " ");
@ -448,7 +455,7 @@ CVfrCompiler::PreProcess (
strcat (PreProcessCmd, mOptions.PreprocessorOutputFileName); strcat (PreProcessCmd, mOptions.PreprocessorOutputFileName);
if (system (PreProcessCmd) != 0) { if (system (PreProcessCmd) != 0) {
Error (NULL, 0, 0003, "Error parsing file", "failed to spawn C preprocessor on VFR file %s\n", PreProcessCmd); DebugError (NULL, 0, 0003, "Error parsing file", "failed to spawn C preprocessor on VFR file %s\n", PreProcessCmd);
goto Fail; goto Fail;
} }
@ -484,7 +491,7 @@ CVfrCompiler::Compile (
gCVfrErrorHandle.SetInputFile (InFileName); gCVfrErrorHandle.SetInputFile (InFileName);
if ((pInFile = fopen (InFileName, "r")) == NULL) { if ((pInFile = fopen (InFileName, "r")) == NULL) {
Error (NULL, 0, 0001, "Error opening the input file", InFileName); DebugError (NULL, 0, 0001, "Error opening the input file", InFileName);
goto Fail; goto Fail;
} }
@ -504,7 +511,7 @@ CVfrCompiler::Compile (
Fail: Fail:
if (!IS_RUN_STATUS(STATUS_DEAD)) { if (!IS_RUN_STATUS(STATUS_DEAD)) {
Error (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName); DebugError (NULL, 0, 0003, "Error parsing", "compile error in file %s", InFileName);
SET_RUN_STATUS (STATUS_FAILED); SET_RUN_STATUS (STATUS_FAILED);
} }
if (pInFile != NULL) { if (pInFile != NULL) {
@ -534,7 +541,7 @@ CVfrCompiler::AdjustBin (
if (gCBuffer.Buffer != NULL && gRBuffer.Buffer != NULL) { if (gCBuffer.Buffer != NULL && gRBuffer.Buffer != NULL) {
UINT32 Index; UINT32 Index;
if (gCBuffer.Size != gRBuffer.Size) { if (gCBuffer.Size != gRBuffer.Size) {
Error (NULL, 0, 0001, "Error parsing vfr file", " %s. FormBinary Size 0x%X is not same to RecordBuffer Size 0x%X", mOptions.VfrFileName, gCBuffer.Size, gRBuffer.Size); DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. FormBinary Size 0x%X is not same to RecordBuffer Size 0x%X", mOptions.VfrFileName, gCBuffer.Size, gRBuffer.Size);
} }
for (Index = 0; Index < gCBuffer.Size; Index ++) { for (Index = 0; Index < gCBuffer.Size; Index ++) {
if (gCBuffer.Buffer[Index] != gRBuffer.Buffer[Index]) { if (gCBuffer.Buffer[Index] != gRBuffer.Buffer[Index]) {
@ -542,13 +549,13 @@ CVfrCompiler::AdjustBin (
} }
} }
if (Index != gCBuffer.Size) { if (Index != gCBuffer.Size) {
Error (NULL, 0, 0001, "Error parsing vfr file", " %s. the 0x%X byte is different between Form and Record", mOptions.VfrFileName, Index); DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s. the 0x%X byte is different between Form and Record", mOptions.VfrFileName, Index);
} }
DebugMsg (NULL, 0, 9, "IFR Buffer", "Form Buffer same to Record Buffer and Size is 0x%X", Index); DebugMsg (NULL, 0, 9, (CHAR8 *) "IFR Buffer", (CHAR8 *) "Form Buffer same to Record Buffer and Size is 0x%X", Index);
} else if (gCBuffer.Buffer == NULL && gRBuffer.Buffer == NULL) { } else if (gCBuffer.Buffer == NULL && gRBuffer.Buffer == NULL) {
//ok //ok
} else { } else {
Error (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName); DebugError (NULL, 0, 0001, "Error parsing vfr file", " %s.Buffer not allocated.", mOptions.VfrFileName);
} }
// //
@ -588,7 +595,7 @@ CVfrCompiler::GenBinary (
if (mOptions.CreateIfrPkgFile == TRUE) { if (mOptions.CreateIfrPkgFile == TRUE) {
if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) { if ((pFile = fopen (mOptions.PkgOutputFileName, "wb")) == NULL) {
Error (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName); DebugError (NULL, 0, 0001, "Error opening file", mOptions.PkgOutputFileName);
goto Fail; goto Fail;
} }
if (gCFormPkg.BuildPkg (pFile, &gRBuffer) != VFR_RETURN_SUCCESS) { if (gCFormPkg.BuildPkg (pFile, &gRBuffer) != VFR_RETURN_SUCCESS) {
@ -631,7 +638,7 @@ CVfrCompiler::GenCFile (
if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) { if (!mOptions.CreateIfrPkgFile || mOptions.CompatibleMode) {
if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) { if ((pFile = fopen (mOptions.COutputFileName, "w")) == NULL) {
Error (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName); DebugError (NULL, 0, 0001, "Error opening output C file", mOptions.COutputFileName);
goto Fail; goto Fail;
} }
@ -678,12 +685,12 @@ CVfrCompiler::GenRecordListFile (
} }
if ((pInFile = fopen (InFileName, "r")) == NULL) { if ((pInFile = fopen (InFileName, "r")) == NULL) {
Error (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName); DebugError (NULL, 0, 0001, "Error opening the input VFR preprocessor output file", InFileName);
return; return;
} }
if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) { if ((pOutFile = fopen (mOptions.RecordListFile, "w")) == NULL) {
Error (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile); DebugError (NULL, 0, 0001, "Error opening the record list file", mOptions.RecordListFile);
goto Err1; goto Err1;
} }
@ -713,8 +720,8 @@ Err1:
int int
main ( main (
IN INT32 Argc, IN int Argc,
IN CHAR8 **Argv IN char **Argv
) )
{ {
COMPILER_RUN_STATUS Status; COMPILER_RUN_STATUS Status;
@ -743,3 +750,4 @@ main (
return GetUtilityStatus (); return GetUtilityStatus ();
} }

View File

@ -102,7 +102,7 @@ public:
VOID GenBinary (VOID); VOID GenBinary (VOID);
VOID GenCFile (VOID); VOID GenCFile (VOID);
VOID GenRecordListFile (VOID); VOID GenRecordListFile (VOID);
VOID DebugError (VOID); VOID DebugError (IN CHAR8*, IN UINT32, IN UINT32, IN CONST CHAR8*, IN CONST CHAR8*, ...);
}; };
#endif #endif

View File

@ -135,7 +135,6 @@ CVfrErrorHandle::ParseFileScopeRecord (
IN UINT32 WholeScopeLine IN UINT32 WholeScopeLine
) )
{ {
CHAR8 *FullPathName = NULL;
SVfrFileScopeRecord *pNode = NULL; SVfrFileScopeRecord *pNode = NULL;
if (Record == NULL) { if (Record == NULL) {
@ -195,19 +194,19 @@ VOID
CVfrErrorHandle::PrintMsg ( CVfrErrorHandle::PrintMsg (
IN UINT32 LineNum, IN UINT32 LineNum,
IN CHAR8 *TokName, IN CHAR8 *TokName,
IN CHAR8 *MsgType, IN CONST CHAR8 *MsgType,
IN CHAR8 *ErrorMsg IN CONST CHAR8 *ErrorMsg
) )
{ {
CHAR8 *FileName = NULL; CHAR8 *FileName = NULL;
UINT32 FileLine; UINT32 FileLine;
if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) { if (strncmp ("Warning", MsgType, strlen ("Warning")) == 0) {
VerboseMsg (ErrorMsg); VerboseMsg ((CHAR8 *) ErrorMsg);
return; return;
} }
GetFileNameLineNum (LineNum, &FileName, &FileLine); GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg); Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
} }
UINT8 UINT8
@ -220,7 +219,7 @@ CVfrErrorHandle::HandleError (
UINT32 Index; UINT32 Index;
CHAR8 *FileName = NULL; CHAR8 *FileName = NULL;
UINT32 FileLine; UINT32 FileLine;
CHAR8 *ErrorMsg = NULL; CONST CHAR8 *ErrorMsg = NULL;
if (mVfrErrorHandleTable == NULL) { if (mVfrErrorHandleTable == NULL) {
return 1; return 1;
@ -235,7 +234,7 @@ CVfrErrorHandle::HandleError (
if (ErrorMsg != NULL) { if (ErrorMsg != NULL) {
GetFileNameLineNum (LineNum, &FileName, &FileLine); GetFileNameLineNum (LineNum, &FileName, &FileLine);
Error (FileName, FileLine, 0x3000, TokName, "\t%s\n", ErrorMsg); Error (FileName, FileLine, 0x3000, TokName, (CHAR8 *) "\t%s\n", (CHAR8 *) ErrorMsg);
return 1; return 1;
} else { } else {
return 0; return 0;

View File

@ -47,7 +47,7 @@ typedef enum {
typedef struct _SVFR_ERROR_HANDLE { typedef struct _SVFR_ERROR_HANDLE {
EFI_VFR_RETURN_CODE mErrorCode; EFI_VFR_RETURN_CODE mErrorCode;
CHAR8 *mErrorMsg; CONST CHAR8 *mErrorMsg;
} SVFR_ERROR_HANDLE; } SVFR_ERROR_HANDLE;
struct SVfrFileScopeRecord { struct SVfrFileScopeRecord {
@ -74,8 +74,8 @@ public:
VOID SetInputFile (IN CHAR8 *); VOID SetInputFile (IN CHAR8 *);
VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32); VOID ParseFileScopeRecord (IN CHAR8 *, IN UINT32);
VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *); VOID GetFileNameLineNum (IN UINT32, OUT CHAR8 **, OUT UINT32 *);
UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = "\0"); UINT8 HandleError (IN EFI_VFR_RETURN_CODE, IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL);
VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = "\0", IN CHAR8 *MsgType = "Error", IN CHAR8 *ErrorMsg = "\0"); VOID PrintMsg (IN UINT32 LineNum = 0, IN CHAR8 *TokName = NULL, IN CONST CHAR8 *MsgType = "Error", IN CONST CHAR8 *ErrorMsg = "");
}; };
#define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0) #define CHECK_ERROR_RETURN(f, v) do { EFI_VFR_RETURN_CODE r; if ((r = (f)) != (v)) { return r; } } while (0)

View File

@ -2,7 +2,7 @@
The definition of CFormPkg's member function The definition of CFormPkg's member function
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -25,7 +25,7 @@ SPendingAssign::SPendingAssign (
IN VOID *Addr, IN VOID *Addr,
IN UINT32 Len, IN UINT32 Len,
IN UINT32 LineNo, IN UINT32 LineNo,
IN CHAR8 *Msg IN CONST CHAR8 *Msg
) )
{ {
mKey = NULL; mKey = NULL;
@ -354,7 +354,7 @@ VOID
CFormPkg::_WRITE_PKG_LINE ( CFormPkg::_WRITE_PKG_LINE (
IN FILE *pFile, IN FILE *pFile,
IN UINT32 LineBytes, IN UINT32 LineBytes,
IN CHAR8 *LineHeader, IN CONST CHAR8 *LineHeader,
IN CHAR8 *BlkBuf, IN CHAR8 *BlkBuf,
IN UINT32 BlkSize IN UINT32 BlkSize
) )
@ -377,7 +377,7 @@ VOID
CFormPkg::_WRITE_PKG_END ( CFormPkg::_WRITE_PKG_END (
IN FILE *pFile, IN FILE *pFile,
IN UINT32 LineBytes, IN UINT32 LineBytes,
IN CHAR8 *LineHeader, IN CONST CHAR8 *LineHeader,
IN CHAR8 *BlkBuf, IN CHAR8 *BlkBuf,
IN UINT32 BlkSize IN UINT32 BlkSize
) )
@ -483,7 +483,7 @@ CFormPkg::AssignPending (
IN VOID *ValAddr, IN VOID *ValAddr,
IN UINT32 ValLen, IN UINT32 ValLen,
IN UINT32 LineNo, IN UINT32 LineNo,
IN CHAR8 *Msg IN CONST CHAR8 *Msg
) )
{ {
SPendingAssign *pNew; SPendingAssign *pNew;
@ -1242,7 +1242,7 @@ static struct {
{ 0, 0 }, // 0x1F { 0, 0 }, // 0x1F
{ sizeof (EFI_IFR_TO_LOWER), 0 }, // EFI_IFR_TO_LOWER_OP - 0x20 { sizeof (EFI_IFR_TO_LOWER), 0 }, // EFI_IFR_TO_LOWER_OP - 0x20
{ sizeof (EFI_IFR_TO_UPPER), 0 }, // EFI_IFR_TO_UPPER_OP - 0x21 { sizeof (EFI_IFR_TO_UPPER), 0 }, // EFI_IFR_TO_UPPER_OP - 0x21
{ 0, 0 }, // 0x22 { sizeof (EFI_IFR_MAP), 1 }, // EFI_IFR_MAP - 0x22
{ sizeof (EFI_IFR_ORDERED_LIST), 1 }, // EFI_IFR_ORDERED_LIST_OP - 0x23 { sizeof (EFI_IFR_ORDERED_LIST), 1 }, // EFI_IFR_ORDERED_LIST_OP - 0x23
{ sizeof (EFI_IFR_VARSTORE), 0 }, // EFI_IFR_VARSTORE_OP { sizeof (EFI_IFR_VARSTORE), 0 }, // EFI_IFR_VARSTORE_OP
{ sizeof (EFI_IFR_VARSTORE_NAME_VALUE), 0 }, // EFI_IFR_VARSTORE_NAME_VALUE_OP { sizeof (EFI_IFR_VARSTORE_NAME_VALUE), 0 }, // EFI_IFR_VARSTORE_NAME_VALUE_OP
@ -1250,8 +1250,11 @@ static struct {
{ sizeof (EFI_IFR_VARSTORE_DEVICE), 1 }, // EFI_IFR_VARSTORE_DEVICE_OP { sizeof (EFI_IFR_VARSTORE_DEVICE), 1 }, // EFI_IFR_VARSTORE_DEVICE_OP
{ sizeof (EFI_IFR_VERSION), 0 }, // EFI_IFR_VERSION_OP - 0x28 { sizeof (EFI_IFR_VERSION), 0 }, // EFI_IFR_VERSION_OP - 0x28
{ sizeof (EFI_IFR_END), 0 }, // EFI_IFR_END_OP { sizeof (EFI_IFR_END), 0 }, // EFI_IFR_END_OP
{ sizeof (EFI_IFR_MATCH), 1 }, // EFI_IFR_MATCH_OP - 0x2A { sizeof (EFI_IFR_MATCH), 0 }, // EFI_IFR_MATCH_OP - 0x2A
{ 0, 0 }, { 0, 0} , { 0, 0} , { 0, 0} , // 0x2B ~ 0x2E { sizeof (EFI_IFR_GET), 0 }, // EFI_IFR_GET - 0x2B
{ sizeof (EFI_IFR_SET), 0 }, // EFI_IFR_SET - 0x2C
{ sizeof (EFI_IFR_READ), 0 }, // EFI_IFR_READ - 0x2D
{ sizeof (EFI_IFR_WRITE), 0 }, // EFI_IFR_WRITE - 0x2E
{ sizeof (EFI_IFR_EQUAL), 0 }, // EFI_IFR_EQUAL_OP - 0x2F { sizeof (EFI_IFR_EQUAL), 0 }, // EFI_IFR_EQUAL_OP - 0x2F
{ sizeof (EFI_IFR_NOT_EQUAL), 0 }, // EFI_IFR_NOT_EQUAL_OP { sizeof (EFI_IFR_NOT_EQUAL), 0 }, // EFI_IFR_NOT_EQUAL_OP
{ sizeof (EFI_IFR_GREATER_THAN), 0 }, // EFI_IFR_GREATER_THAN_OP { sizeof (EFI_IFR_GREATER_THAN), 0 }, // EFI_IFR_GREATER_THAN_OP
@ -1298,7 +1301,7 @@ static struct {
{ sizeof (EFI_IFR_VALUE), 1 }, // EFI_IFR_VALUE_OP { sizeof (EFI_IFR_VALUE), 1 }, // EFI_IFR_VALUE_OP
{ sizeof (EFI_IFR_DEFAULT), 0 }, // EFI_IFR_DEFAULT_OP { sizeof (EFI_IFR_DEFAULT), 0 }, // EFI_IFR_DEFAULT_OP
{ sizeof (EFI_IFR_DEFAULTSTORE), 0 }, // EFI_IFR_DEFAULTSTORE_OP - 0x5C { sizeof (EFI_IFR_DEFAULTSTORE), 0 }, // EFI_IFR_DEFAULTSTORE_OP - 0x5C
{ 0, 0}, // 0x5D { sizeof (EFI_IFR_FORM_MAP), 1}, // EFI_IFR_FORM_MAP_OP - 0x5D
{ sizeof (EFI_IFR_CATENATE), 0 }, // EFI_IFR_CATENATE_OP { sizeof (EFI_IFR_CATENATE), 0 }, // EFI_IFR_CATENATE_OP
{ sizeof (EFI_IFR_GUID), 0 }, // EFI_IFR_GUID_OP { sizeof (EFI_IFR_GUID), 0 }, // EFI_IFR_GUID_OP
{ sizeof (EFI_IFR_SECURITY), 0 }, // EFI_IFR_SECURITY_OP - 0x60 { sizeof (EFI_IFR_SECURITY), 0 }, // EFI_IFR_SECURITY_OP - 0x60
@ -1313,9 +1316,9 @@ static struct {
"EFI_IFR_ACTION", "EFI_IFR_RESET_BUTTON", "EFI_IFR_FORM_SET", "EFI_IFR_REF", "EFI_IFR_NO_SUBMIT_IF", "EFI_IFR_INCONSISTENT_IF", "EFI_IFR_ACTION", "EFI_IFR_RESET_BUTTON", "EFI_IFR_FORM_SET", "EFI_IFR_REF", "EFI_IFR_NO_SUBMIT_IF", "EFI_IFR_INCONSISTENT_IF",
"EFI_IFR_EQ_ID_VAL", "EFI_IFR_EQ_ID_ID", "EFI_IFR_EQ_ID_LIST", "EFI_IFR_AND", "EFI_IFR_OR", "EFI_IFR_NOT", "EFI_IFR_EQ_ID_VAL", "EFI_IFR_EQ_ID_ID", "EFI_IFR_EQ_ID_LIST", "EFI_IFR_AND", "EFI_IFR_OR", "EFI_IFR_NOT",
"EFI_IFR_RULE", "EFI_IFR_GRAY_OUT_IF", "EFI_IFR_DATE", "EFI_IFR_TIME", "EFI_IFR_STRING", "EFI_IFR_REFRESH", "EFI_IFR_RULE", "EFI_IFR_GRAY_OUT_IF", "EFI_IFR_DATE", "EFI_IFR_TIME", "EFI_IFR_STRING", "EFI_IFR_REFRESH",
"EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_INVALID", "EFI_IFR_ORDERED_LIST", "EFI_IFR_DISABLE_IF", "EFI_IFR_INVALID", "EFI_IFR_TO_LOWER", "EFI_IFR_TO_UPPER", "EFI_IFR_MAP", "EFI_IFR_ORDERED_LIST",
"EFI_IFR_VARSTORE", "EFI_IFR_VARSTORE_NAME_VALUE", "EFI_IFR_VARSTORE_EFI", "EFI_IFR_VARSTORE_DEVICE", "EFI_IFR_VERSION", "EFI_IFR_END", "EFI_IFR_VARSTORE", "EFI_IFR_VARSTORE_NAME_VALUE", "EFI_IFR_VARSTORE_EFI", "EFI_IFR_VARSTORE_DEVICE", "EFI_IFR_VERSION", "EFI_IFR_END",
"EFI_IFR_MATCH", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_INVALID", "EFI_IFR_EQUAL", "EFI_IFR_MATCH", "EFI_IFR_GET", "EFI_IFR_SET", "EFI_IFR_READ", "EFI_IFR_WRITE", "EFI_IFR_EQUAL",
"EFI_IFR_NOT_EQUAL", "EFI_IFR_GREATER_THAN", "EFI_IFR_GREATER_EQUAL", "EFI_IFR_LESS_THAN", "EFI_IFR_LESS_EQUAL", "EFI_IFR_BITWISE_AND", "EFI_IFR_NOT_EQUAL", "EFI_IFR_GREATER_THAN", "EFI_IFR_GREATER_EQUAL", "EFI_IFR_LESS_THAN", "EFI_IFR_LESS_EQUAL", "EFI_IFR_BITWISE_AND",
"EFI_IFR_BITWISE_OR", "EFI_IFR_BITWISE_NOT", "EFI_IFR_SHIFT_LEFT", "EFI_IFR_SHIFT_RIGHT", "EFI_IFR_ADD", "EFI_IFR_SUBTRACT", "EFI_IFR_BITWISE_OR", "EFI_IFR_BITWISE_NOT", "EFI_IFR_SHIFT_LEFT", "EFI_IFR_SHIFT_RIGHT", "EFI_IFR_ADD", "EFI_IFR_SUBTRACT",
"EFI_IFR_MULTIPLY", "EFI_IFR_DIVIDE", "EFI_IFR_MODULO", "EFI_IFR_RULE_REF", "EFI_IFR_QUESTION_REF1", "EFI_IFR_QUESTION_REF2", "EFI_IFR_MULTIPLY", "EFI_IFR_DIVIDE", "EFI_IFR_MODULO", "EFI_IFR_RULE_REF", "EFI_IFR_QUESTION_REF1", "EFI_IFR_QUESTION_REF2",
@ -1323,7 +1326,7 @@ static struct {
"EFI_IFR_TO_UINT", "EFI_IFR_TO_STRING", "EFI_IFR_TO_BOOLEAN", "EFI_IFR_MID", "EFI_IFR_FIND", "EFI_IFR_TOKEN", "EFI_IFR_TO_UINT", "EFI_IFR_TO_STRING", "EFI_IFR_TO_BOOLEAN", "EFI_IFR_MID", "EFI_IFR_FIND", "EFI_IFR_TOKEN",
"EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE", "EFI_IFR_STRING_REF1","EFI_IFR_STRING_REF2", "EFI_IFR_CONDITIONAL", "EFI_IFR_QUESTION_REF3", "EFI_IFR_ZERO", "EFI_IFR_ONE",
"EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN", "EFI_IFR_ONES", "EFI_IFR_UNDEFINED", "EFI_IFR_LENGTH", "EFI_IFR_DUP", "EFI_IFR_THIS", "EFI_IFR_SPAN",
"EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_INVALID", "EFI_IFR_CATENATE", "EFI_IFR_GUID", "EFI_IFR_VALUE", "EFI_IFR_DEFAULT", "EFI_IFR_DEFAULTSTORE", "EFI_IFR_FORM_MAP", "EFI_IFR_CATENATE", "EFI_IFR_GUID",
"EFI_IFR_SECURITY", "EFI_IFR_SECURITY",
}; };
@ -1340,7 +1343,7 @@ CIFROBJ_DEBUG_PRINT (
#endif #endif
bool gCreateOp = TRUE; BOOLEAN gCreateOp = TRUE;
CIfrObj::CIfrObj ( CIfrObj::CIfrObj (
IN UINT8 OpCode, IN UINT8 OpCode,
@ -1396,4 +1399,4 @@ CIfrOpHeader::CIfrOpHeader (
mHeader = OpHdr.mHeader; mHeader = OpHdr.mHeader;
} }
UINT32 CIfrForm::FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE] = {0, }; UINT32 CIfrFormId::FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE] = {0, };

View File

@ -2,7 +2,7 @@
The definition of CFormPkg's member function The definition of CFormPkg's member function
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -81,7 +81,7 @@ struct SPendingAssign {
CHAR8 *mMsg; CHAR8 *mMsg;
struct SPendingAssign *mNext; struct SPendingAssign *mNext;
SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CHAR8 *); SPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *);
~SPendingAssign (); ~SPendingAssign ();
VOID SetAddrAndLen (IN VOID *, IN UINT32); VOID SetAddrAndLen (IN VOID *, IN UINT32);
@ -108,8 +108,8 @@ private:
UINT32 mPkgLength; UINT32 mPkgLength;
VOID _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CHAR8 *, IN CHAR8 *, IN UINT32); VOID _WRITE_PKG_LINE (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
VOID _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CHAR8 *, IN CHAR8 *, IN UINT32); VOID _WRITE_PKG_END (IN FILE *, IN UINT32 , IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
private: private:
SPendingAssign *PendingAssignList; SPendingAssign *PendingAssignList;
@ -131,7 +131,7 @@ public:
EFI_VFR_RETURN_CODE GenCFile (IN CHAR8 *, IN FILE *, IN PACKAGE_DATA *PkgData = NULL); EFI_VFR_RETURN_CODE GenCFile (IN CHAR8 *, IN FILE *, IN PACKAGE_DATA *PkgData = NULL);
public: public:
EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CHAR8 *Msg = NULL); EFI_VFR_RETURN_CODE AssignPending (IN CHAR8 *, IN VOID *, IN UINT32, IN UINT32, IN CONST CHAR8 *Msg = NULL);
VOID DoPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32); VOID DoPendingAssign (IN CHAR8 *, IN VOID *, IN UINT32);
bool HavePendingUnassigned (VOID); bool HavePendingUnassigned (VOID);
VOID PendingAssignPrintAll (VOID); VOID PendingAssignPrintAll (VOID);
@ -195,11 +195,11 @@ extern CIfrRecordInfoDB gCIfrRecordInfoDB;
/* /*
* The definition of CIfrObj * The definition of CIfrObj
*/ */
extern bool gCreateOp; extern BOOLEAN gCreateOp;
class CIfrObj { class CIfrObj {
private: private:
bool mDelayEmit; BOOLEAN mDelayEmit;
CHAR8 *mObjBinBuf; CHAR8 *mObjBinBuf;
UINT8 mObjBinLen; UINT8 mObjBinLen;
@ -227,7 +227,7 @@ public:
inline bool ExpendObjBin (IN UINT8 Size) { inline bool ExpendObjBin (IN UINT8 Size) {
if ((mDelayEmit == TRUE) && ((mObjBinLen + Size) > mObjBinLen)) { if ((mDelayEmit == TRUE) && ((mObjBinLen + Size) > mObjBinLen)) {
mObjBinLen += Size; mObjBinLen = mObjBinLen + Size;
return TRUE; return TRUE;
} else { } else {
return FALSE; return FALSE;
@ -248,7 +248,7 @@ public:
VOID IncLength (UINT8 Size) { VOID IncLength (UINT8 Size) {
if ((mHeader->Length + Size) > mHeader->Length) { if ((mHeader->Length + Size) > mHeader->Length) {
mHeader->Length += Size; mHeader->Length = mHeader->Length + Size;
} }
} }
@ -557,6 +557,7 @@ static CIfrMinMaxStepData *gCurrentMinMaxData = NULL;
class CIfrFormSet : public CIfrObj, public CIfrOpHeader { class CIfrFormSet : public CIfrObj, public CIfrOpHeader {
private: private:
EFI_IFR_FORM_SET *mFormSet; EFI_IFR_FORM_SET *mFormSet;
EFI_GUID *mClassGuid;
public: public:
CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)&mFormSet, Size), CIfrFormSet (UINT8 Size) : CIfrObj (EFI_IFR_FORM_SET_OP, (CHAR8 **)&mFormSet, Size),
@ -565,6 +566,7 @@ public:
mFormSet->FormSetTitle = EFI_STRING_ID_INVALID; mFormSet->FormSetTitle = EFI_STRING_ID_INVALID;
mFormSet->Flags = 0; mFormSet->Flags = 0;
memset (&mFormSet->Guid, 0, sizeof (EFI_GUID)); memset (&mFormSet->Guid, 0, sizeof (EFI_GUID));
mClassGuid = (EFI_GUID *) (mFormSet + 1);
} }
VOID SetGuid (IN EFI_GUID *Guid) { VOID SetGuid (IN EFI_GUID *Guid) {
@ -580,7 +582,7 @@ public:
} }
VOID SetClassGuid (IN EFI_GUID *Guid) { VOID SetClassGuid (IN EFI_GUID *Guid) {
memcpy (&(mFormSet->ClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID)); memcpy (&(mClassGuid[mFormSet->Flags++]), Guid, sizeof (EFI_GUID));
} }
UINT8 GetFlags() { UINT8 GetFlags() {
@ -620,10 +622,8 @@ public:
#define EFI_FORM_ID_MAX 0xFFFF #define EFI_FORM_ID_MAX 0xFFFF
#define EFI_FREE_FORM_ID_BITMAP_SIZE ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32) #define EFI_FREE_FORM_ID_BITMAP_SIZE ((EFI_FORM_ID_MAX + 1) / EFI_BITS_PER_UINT32)
class CIfrForm : public CIfrObj, public CIfrOpHeader { class CIfrFormId {
private: public:
EFI_IFR_FORM *mForm;
STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE]; STATIC UINT32 FormIdBitMap[EFI_FREE_FORM_ID_BITMAP_SIZE];
STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) { STATIC BOOLEAN ChekFormIdFree (IN EFI_FORM_ID FormId) {
@ -639,6 +639,11 @@ private:
FormIdBitMap[Index] |= (0x80000000 >> Offset); FormIdBitMap[Index] |= (0x80000000 >> Offset);
} }
};
class CIfrForm : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_FORM *mForm;
public: public:
CIfrForm () : CIfrObj (EFI_IFR_FORM_OP, (CHAR8 **)&mForm), CIfrForm () : CIfrObj (EFI_IFR_FORM_OP, (CHAR8 **)&mForm),
@ -654,11 +659,11 @@ public:
// //
return VFR_RETURN_INVALID_PARAMETER; return VFR_RETURN_INVALID_PARAMETER;
} }
if (CIfrForm::ChekFormIdFree (FormId) == FALSE) { if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
return VFR_RETURN_FORMID_REDEFINED; return VFR_RETURN_FORMID_REDEFINED;
} }
mForm->FormId = FormId; mForm->FormId = FormId;
CIfrForm::MarkFormIdUsed (FormId); CIfrFormId::MarkFormIdUsed (FormId);
return VFR_RETURN_SUCCESS; return VFR_RETURN_SUCCESS;
} }
@ -667,6 +672,44 @@ public:
} }
}; };
class CIfrFormMap : public CIfrObj, public CIfrOpHeader {
private:
EFI_IFR_FORM_MAP *mFormMap;
EFI_IFR_FORM_MAP_METHOD *mMethodMap;
public:
CIfrFormMap () : CIfrObj (EFI_IFR_FORM_MAP_OP, (CHAR8 **)&mFormMap, sizeof (EFI_IFR_FORM_MAP), TRUE),
CIfrOpHeader (EFI_IFR_FORM_MAP_OP, &mFormMap->Header) {
mFormMap->FormId = 0;
mMethodMap = (EFI_IFR_FORM_MAP_METHOD *) (mFormMap + 1);
}
EFI_VFR_RETURN_CODE SetFormId (IN EFI_FORM_ID FormId) {
if (FormId == 0) {
//
// FormId can't be 0.
//
return VFR_RETURN_INVALID_PARAMETER;
}
if (CIfrFormId::ChekFormIdFree (FormId) == FALSE) {
return VFR_RETURN_FORMID_REDEFINED;
}
mFormMap->FormId = FormId;
CIfrFormId::MarkFormIdUsed (FormId);
return VFR_RETURN_SUCCESS;
}
VOID SetFormMapMethod (IN EFI_STRING_ID MethodTitle, IN EFI_GUID *MethodGuid) {
if (ExpendObjBin (sizeof (EFI_IFR_FORM_MAP_METHOD))) {
IncLength (sizeof (EFI_IFR_FORM_MAP_METHOD));
mMethodMap->MethodTitle = MethodTitle;
memcpy (&(mMethodMap->MethodIdentifier), MethodGuid, sizeof (EFI_GUID));
mMethodMap ++;
}
}
};
class CIfrVarStore : public CIfrObj, public CIfrOpHeader { class CIfrVarStore : public CIfrObj, public CIfrOpHeader {
private: private:
EFI_IFR_VARSTORE *mVarStore; EFI_IFR_VARSTORE *mVarStore;
@ -696,7 +739,7 @@ public:
UINT8 Len; UINT8 Len;
if (Name != NULL) { if (Name != NULL) {
Len = strlen (Name); Len = (UINT8) strlen (Name);
if (Len != 0) { if (Len != 0) {
if (ExpendObjBin (Len) == TRUE) { if (ExpendObjBin (Len) == TRUE) {
IncLength (Len); IncLength (Len);
@ -832,6 +875,66 @@ public:
}; };
class CIfrRead : public CIfrObj, public CIfrOpHeader{
private:
EFI_IFR_READ *mRead;
public:
CIfrRead () : CIfrObj (EFI_IFR_READ_OP, (CHAR8 **)&mRead),
CIfrOpHeader (EFI_IFR_READ_OP, &mRead->Header) {}
};
class CIfrWrite : public CIfrObj, public CIfrOpHeader{
private:
EFI_IFR_WRITE *mWrite;
public:
CIfrWrite () : CIfrObj (EFI_IFR_WRITE_OP, (CHAR8 **)&mWrite),
CIfrOpHeader (EFI_IFR_WRITE_OP, &mWrite->Header) {}
};
class CIfrGet : public CIfrObj, public CIfrOpHeader{
private:
EFI_IFR_GET *mGet;
public:
CIfrGet (
IN UINT32 LineNo
) : CIfrObj (EFI_IFR_GET_OP, (CHAR8 **)&mGet),
CIfrOpHeader (EFI_IFR_GET_OP, &mGet->Header) {
SetLineNo (LineNo);
}
VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
mGet->VarStoreId = Info->mVarStoreId;
mGet->VarStoreInfo.VarName = Info->mInfo.mVarName;
mGet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
mGet->VarStoreType = Info->mVarType;
}
};
class CIfrSet : public CIfrObj, public CIfrOpHeader{
private:
EFI_IFR_SET *mSet;
public:
CIfrSet (
IN UINT32 LineNo
) : CIfrObj (EFI_IFR_SET_OP, (CHAR8 **)&mSet),
CIfrOpHeader (EFI_IFR_SET_OP, &mSet->Header) {
SetLineNo (LineNo);
}
VOID SetVarInfo (IN EFI_VARSTORE_INFO *Info) {
mSet->VarStoreId = Info->mVarStoreId;
mSet->VarStoreInfo.VarName = Info->mInfo.mVarName;
mSet->VarStoreInfo.VarOffset = Info->mInfo.mVarOffset;
mSet->VarStoreType = Info->mVarType;
}
};
class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader { class CIfrSubtitle : public CIfrObj, public CIfrOpHeader, public CIfrStatementHeader {
private: private:
EFI_IFR_SUBTITLE *mSubtitle; EFI_IFR_SUBTITLE *mSubtitle;
@ -2310,6 +2413,19 @@ public:
} }
}; };
class CIfrMap : public CIfrObj, public CIfrOpHeader{
private:
EFI_IFR_MAP *mMap;
public:
CIfrMap (
IN UINT32 LineNo
) : CIfrObj (EFI_IFR_MAP_OP, (CHAR8 **)&mMap),
CIfrOpHeader (EFI_IFR_MAP_OP, &mMap->Header) {
SetLineNo (LineNo);
}
};
class CIfrMatch : public CIfrObj, public CIfrOpHeader { class CIfrMatch : public CIfrObj, public CIfrOpHeader {
private: private:
EFI_IFR_MATCH *mMatch; EFI_IFR_MATCH *mMatch;

View File

@ -1,5 +1,5 @@
/*++ /*++
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -131,6 +131,9 @@ VfrParserStart (
#token EndList("endlist") "endlist" #token EndList("endlist") "endlist"
#token EndForm("endform") "endform" #token EndForm("endform") "endform"
#token Form("form") "form" #token Form("form") "form"
#token FormMap("formmap") "formmap"
#token MapTitle("maptitle") "maptitle"
#token MapGuid("mapguid") "mapguid"
#token Subtitle("subtitle") "subtitle" #token Subtitle("subtitle") "subtitle"
#token Help("help") "help" #token Help("help") "help"
#token Text("text") "text" #token Text("text") "text"
@ -214,6 +217,8 @@ VfrParserStart (
#token Rule("rule") "rule" #token Rule("rule") "rule"
#token EndRule("endrule") "endrule" #token EndRule("endrule") "endrule"
#token Value("value") "value" #token Value("value") "value"
#token Read("read") "read"
#token Write("write") "write"
#token ResetButton("resetbutton") "resetbutton" #token ResetButton("resetbutton") "resetbutton"
#token EndResetButton("endresetbutton") "endresetbutton" #token EndResetButton("endresetbutton") "endresetbutton"
#token DefaultStore("defaultstore") "defaultstore" #token DefaultStore("defaultstore") "defaultstore"
@ -251,6 +256,7 @@ VfrParserStart (
vfrProgram > [UINT8 Return] : vfrProgram > [UINT8 Return] :
<< <<
mParserStatus = 0; mParserStatus = 0;
mCIfrOpHdrIndex = 0;
mConstantOnlyInExpression = FALSE; mConstantOnlyInExpression = FALSE;
>> >>
( (
@ -335,82 +341,84 @@ vfrDataStructFields :
dataStructField64 : dataStructField64 :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"UINT64" D:"UINT64"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT64", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructField32 : dataStructField32 :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"UINT32" D:"UINT32"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT32", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructField16 : dataStructField16 :
<< UINT32 ArrayNum = 0; >> <<
UINT32 ArrayNum = 0;
>>
("UINT16" | "CHAR16") ("UINT16" | "CHAR16")
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT16", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), (CHAR8 *) "UINT16", ArrayNum), N); >>
; ;
dataStructField8 : dataStructField8 :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"UINT8" D:"UINT8"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "UINT8", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructFieldBool : dataStructFieldBool :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"BOOLEAN" D:"BOOLEAN"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "BOOLEAN", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructFieldString : dataStructFieldString :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"EFI_STRING_ID" D:"EFI_STRING_ID"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_STRING_ID", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructFieldDate : dataStructFieldDate :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"EFI_HII_DATE" D:"EFI_HII_DATE"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_DATE", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructFieldTime : dataStructFieldTime :
<< UINT32 ArrayNum = 0; >> << UINT32 ArrayNum = 0; >>
"EFI_HII_TIME" D:"EFI_HII_TIME"
N:StringIdentifier N:StringIdentifier
{ {
OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >> OpenBracket I:Number CloseBracket << ArrayNum = _STOU32(I->getText()); >>
} }
";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), "EFI_HII_TIME", ArrayNum), N); >> ";" << _PCATCH(gCVfrVarDataTypeDB.DataTypeAddField (N->getText(), D->getText(), ArrayNum), N); >>
; ;
dataStructFieldUser : dataStructFieldUser :
@ -486,24 +494,26 @@ vfrFormSetDefinition :
<< <<
switch (ClassGuidNum) { switch (ClassGuidNum) {
case 0: case 0:
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET)); FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID));
FSObj->SetClassGuid(&DefaultClassGuid); FSObj->SetClassGuid(&DefaultClassGuid);
break; break;
case 1: case 1:
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET)); FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&ClassGuid1); FSObj->SetClassGuid(&ClassGuid1);
break; break;
case 2: case 2:
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + sizeof(EFI_GUID)); FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&ClassGuid1); FSObj->SetClassGuid(&ClassGuid1);
FSObj->SetClassGuid(&ClassGuid2); FSObj->SetClassGuid(&ClassGuid2);
break; break;
default: case 3:
FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + 2 * sizeof(EFI_GUID)); FSObj = new CIfrFormSet(sizeof(EFI_IFR_FORM_SET) + ClassGuidNum * sizeof(EFI_GUID));
FSObj->SetClassGuid(&ClassGuid1); FSObj->SetClassGuid(&ClassGuid1);
FSObj->SetClassGuid(&ClassGuid2); FSObj->SetClassGuid(&ClassGuid2);
FSObj->SetClassGuid(&ClassGuid3); FSObj->SetClassGuid(&ClassGuid3);
break; break;
default:
break;
} }
SET_LINE_INFO (*FSObj, L); SET_LINE_INFO (*FSObj, L);
@ -542,6 +552,7 @@ vfrFormSetDefinition :
vfrFormSetList : vfrFormSetList :
( (
vfrFormDefinition | vfrFormDefinition |
vfrFormMapDefinition |
vfrStatementImage | vfrStatementImage |
vfrStatementVarStoreLinear | vfrStatementVarStoreLinear |
vfrStatementVarStoreEfi | vfrStatementVarStoreEfi |
@ -586,12 +597,13 @@ vfrStatementVarStoreLinear :
V:Varstore << VSObj.SetLineNo(V->getLine()); >> V:Varstore << VSObj.SetLineNo(V->getLine()); >>
( (
TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >> TN:StringIdentifier "," << TypeName = TN->getText(); LineNum = TN->getLine(); >>
| U8:"UINT8" "," << TypeName = "UINT8"; LineNum = U8->getLine(); >> | U8:"UINT8" "," << TypeName = U8->getText(); LineNum = U8->getLine(); >>
| U16:"UINT16" "," << TypeName = "UINT16"; LineNum = U16->getLine(); >> | U16:"UINT16" "," << TypeName = U16->getText(); LineNum = U16->getLine(); >>
| U32:"UINT32" "," << TypeName = "UINT32"; LineNum = U32->getLine(); >> | C16:"CHAR16" "," << TypeName = (CHAR8 *) "UINT16"; LineNum = C16->getLine(); >>
| U64:"UINT64" "," << TypeName = "UINT64"; LineNum = U64->getLine(); >> | U32:"UINT32" "," << TypeName = U32->getText(); LineNum = U32->getLine(); >>
| D:"EFI_HII_DATE" "," << TypeName = "EFI_HII_DATE"; LineNum = D->getLine(); >> | U64:"UINT64" "," << TypeName = U64->getText(); LineNum = U64->getLine(); >>
| T:"EFI_HII_TIME" "," << TypeName = "EFI_HII_TIME"; LineNum = T->getLine(); >> | D:"EFI_HII_DATE" "," << TypeName = D->getText(); LineNum = D->getLine(); >>
| T:"EFI_HII_TIME" "," << TypeName = T->getText(); LineNum = T->getLine(); >>
) )
{ Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR { Key "=" FID:Number "," << // Key is used to assign Varid in Framework VFR but no use in UEFI2.1 VFR
if (mCompatibleMode) { if (mCompatibleMode) {
@ -628,7 +640,7 @@ vfrStatementVarStoreLinear :
_PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN); _PCATCH(mCVfrDataStorage.GetVarStoreId(StoreName, &VarStoreId), SN);
VSObj.SetVarStoreId (VarStoreId); VSObj.SetVarStoreId (VarStoreId);
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum); _PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize(TypeName, &Size), LineNum);
VSObj.SetSize (Size); VSObj.SetSize ((UINT16) Size);
VSObj.SetName (SN->getText()); VSObj.SetName (SN->getText());
>> >>
";" ";"
@ -820,7 +832,7 @@ questionheaderFlagsField[UINT8 & Flags] :
| LateCheckFlag | LateCheckFlag
; ;
vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] : vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr, BOOLEAN CheckFlag = TRUE] :
<< <<
UINT32 Idx; UINT32 Idx;
UINT32 LineNo; UINT32 LineNo;
@ -853,9 +865,11 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :
); );
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType); VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
} }
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(VfrReturnCode, SN1); _PCATCH(VfrReturnCode, SN1);
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1); _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN1);
_PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1); _PCATCH(mCVfrDataStorage.GetNameVarStoreInfo (&$Info, Idx), SN1);
}
>> >>
) )
| |
@ -874,17 +888,21 @@ vfrStorageVarId[EFI_VARSTORE_INFO & Info, CHAR8 *&QuestVarIdStr] :
); );
VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType); VfrReturnCode = mCVfrDataStorage.GetVarStoreType (SName, VarStoreType);
} }
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(VfrReturnCode, SN2); _PCATCH(VfrReturnCode, SN2);
_PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2); _PCATCH(mCVfrDataStorage.GetVarStoreId (SName, &$Info.mVarStoreId), SN2);
if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) { if (VarStoreType == EFI_VFR_VARSTORE_BUFFER) {
_PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2); _PCATCH(mCVfrDataStorage.GetBufferVarStoreDataTypeName(SName, &TName), SN2);
_STRCAT(&VarStr, TName); _STRCAT(&VarStr, TName);
} }
}
>> >>
( (
"." << "." <<
if (CheckFlag || VfrReturnCode == VFR_RETURN_SUCCESS) {
_PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2); _PCATCH(((VarStoreType != EFI_VFR_VARSTORE_BUFFER) ? VFR_RETURN_EFIVARSTORE_USE_ERROR : VFR_RETURN_SUCCESS), SN2);
}
_STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, "."); _STRCAT(&VarIdStr, "."); _STRCAT(&VarStr, ".");
>> >>
SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >> SF:StringIdentifier << _STRCAT(&VarIdStr, SF->getText()); _STRCAT(&VarStr, SF->getText()); >>
@ -1079,6 +1097,33 @@ vfrFormDefinition :
";" ";"
; ;
vfrFormMapDefinition :
<<
CIfrFormMap *FMapObj = NULL;
UINT32 FormMapMethodNumber = 0;
EFI_GUID Guid;
>>
F:FormMap << FMapObj = new CIfrFormMap(); FMapObj->SetLineNo(F->getLine()); >>
FormId "=" S1:Number "," << _PCATCH(FMapObj->SetFormId (_STOFID(S1->getText())), S1); >>
(
MapTitle "=" "STRING_TOKEN" "\(" S2:Number "\)" ";"
MapGuid "=" guidDefinition[Guid] ";" << FMapObj->SetFormMapMethod (_STOFID(S2->getText()), &Guid); FormMapMethodNumber ++; >>
)* << if (FormMapMethodNumber == 0) {_PCATCH (VFR_RETURN_INVALID_PARAMETER, F->getLine(), "No MapMethod is set for FormMap!");} delete FMapObj;>>
(
vfrStatementImage |
vfrStatementLocked |
vfrStatementRules |
vfrStatementDefault |
vfrStatementStat |
vfrStatementQuestions |
vfrStatementConditional |
vfrStatementLabel |
vfrStatementBanner
)*
E:EndForm << CRT_END_OP (E); >>
";"
;
vfrStatementRules : vfrStatementRules :
<< CIfrRule RObj; >> << CIfrRule RObj; >>
R:Rule << RObj.SetLineNo(R->getLine()); >> R:Rule << RObj.SetLineNo(R->getLine()); >>
@ -1194,6 +1239,18 @@ vfrStatementValue :
"=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >> "=" vfrStatementExpression[0] << {CIfrEnd EndObj; EndObj.SetLineNo(V->getLine());} >>
; ;
vfrStatementRead :
<< CIfrRead RObj; >>
R:Read << RObj.SetLineNo(R->getLine()); >>
vfrStatementExpression[0] ";"
;
vfrStatementWrite :
<< CIfrWrite WObj; >>
W:Write << WObj.SetLineNo(W->getLine()); >>
vfrStatementExpression[0] ";"
;
vfrStatementSubTitle : vfrStatementSubTitle :
<< CIfrSubtitle SObj; >> << CIfrSubtitle SObj; >>
L:Subtitle << SObj.SetLineNo(L->getLine()); >> L:Subtitle << SObj.SetLineNo(L->getLine()); >>
@ -1268,8 +1325,8 @@ vfrStatementCrossReference :
vfrStatementGoto : vfrStatementGoto :
<< <<
UINT8 RefType = 1; UINT8 RefType = 1;
EFI_STRING_ID DevPath; EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
EFI_GUID FSId; EFI_GUID FSId = {0,};
EFI_FORM_ID FId; EFI_FORM_ID FId;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID; EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
UINT32 BitMask; UINT32 BitMask;
@ -2046,6 +2103,8 @@ vfrStatementQuestionOptionTag :
vfrStatementGrayOutIfQuest | vfrStatementGrayOutIfQuest |
vfrStatementValue | vfrStatementValue |
vfrStatementDefault | vfrStatementDefault |
vfrStatementRead |
vfrStatementWrite |
vfrStatementOptions vfrStatementOptions
; ;
@ -2479,6 +2538,7 @@ vfrStatementInvalidSaveRestoreDefaults :
#token StringRef("stringref") "stringref" #token StringRef("stringref") "stringref"
#token PushThis("pushthis") "pushthis" #token PushThis("pushthis") "pushthis"
#token Security("security") "security" #token Security("security") "security"
#token Get("get") "get"
#token True("TRUE") "TRUE" #token True("TRUE") "TRUE"
#token False("FALSE") "FALSE" #token False("FALSE") "FALSE"
#token One("ONE") "ONE" #token One("ONE") "ONE"
@ -2490,6 +2550,7 @@ vfrStatementInvalidSaveRestoreDefaults :
#token AND("AND") "AND" #token AND("AND") "AND"
#token OR("OR") "OR" #token OR("OR") "OR"
#token NOT("NOT") "NOT" #token NOT("NOT") "NOT"
#token Set("set") "set"
#token BitWiseNot("~") "\~" #token BitWiseNot("~") "\~"
#token BoolVal("boolval") "boolval" #token BoolVal("boolval") "boolval"
#token StringVal("stringval") "stringval" #token StringVal("stringval") "stringval"
@ -2500,12 +2561,13 @@ vfrStatementInvalidSaveRestoreDefaults :
#token Catenate("catenate") "catenate" #token Catenate("catenate") "catenate"
#token QuestionRefVal("questionrefval") "questionrefval" #token QuestionRefVal("questionrefval") "questionrefval"
#token StringRefVal("stringrefval") "stringrefval" #token StringRefVal("stringrefval") "stringrefval"
#token Map("map") "map"
// //
// Root expression extension function called by other function. // Root expression extension function called by other function.
// //
vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] : vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
<< if ($RootLevel == 0) {_CLEAR_SAVED_OPHDR ();} >> << if ($RootLevel == 0) {mCIfrOpHdrIndex ++; if (mCIfrOpHdrIndex >= MAX_IFR_EXPRESSION_DEPTH) _PCATCH (VFR_RETURN_INVALID_PARAMETER, 0, "The depth of expression exceeds the max supported level 8!"); _CLEAR_SAVED_OPHDR ();} >>
andTerm[$RootLevel, $ExpOpCount] andTerm[$RootLevel, $ExpOpCount]
( (
L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >> L:OR andTerm[$RootLevel, $ExpOpCount] << $ExpOpCount++; CIfrOr OObj(L->getLine()); >>
@ -2517,11 +2579,15 @@ vfrStatementExpression [UINT32 RootLevel, UINT32 ExpOpCount = 0] :
if ($ExpOpCount > 1 && $RootLevel == 0) { if ($ExpOpCount > 1 && $RootLevel == 0) {
if (_SET_SAVED_OPHDR_SCOPE()) { if (_SET_SAVED_OPHDR_SCOPE()) {
CIfrEnd EObj; CIfrEnd EObj;
if (mCIfrOpHdrLineNo != 0) { if (mCIfrOpHdrLineNo[mCIfrOpHdrIndex] != 0) {
EObj.SetLineNo (mCIfrOpHdrLineNo); EObj.SetLineNo (mCIfrOpHdrLineNo[mCIfrOpHdrIndex]);
} }
} }
} }
if ($RootLevel == 0) {
mCIfrOpHdrIndex --;
}
>> >>
; ;
@ -2664,6 +2730,7 @@ atomTerm [UINT32 & RootLevel, UINT32 & ExpOpCount]:
| vfrExpressionConstant[$RootLevel, $ExpOpCount] | vfrExpressionConstant[$RootLevel, $ExpOpCount]
| vfrExpressionUnaryOp[$RootLevel, $ExpOpCount] | vfrExpressionUnaryOp[$RootLevel, $ExpOpCount]
| vfrExpressionTernaryOp[$RootLevel, $ExpOpCount] | vfrExpressionTernaryOp[$RootLevel, $ExpOpCount]
| vfrExpressionMap[$RootLevel, $ExpOpCount]
| ( | (
L:NOT L:NOT
atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >> atomTerm[$RootLevel, $ExpOpCount] << { CIfrNot NObj(L->getLine()); $ExpOpCount++; } >>
@ -2705,6 +2772,7 @@ vfrExpressionBuildInFunction [UINT32 & RootLevel, UINT32 & ExpOpCount] :
| stringref1Exp[$RootLevel, $ExpOpCount] | stringref1Exp[$RootLevel, $ExpOpCount]
| pushthisExp[$RootLevel, $ExpOpCount] | pushthisExp[$RootLevel, $ExpOpCount]
| securityExp[$RootLevel, $ExpOpCount] | securityExp[$RootLevel, $ExpOpCount]
| getExp[$RootLevel, $ExpOpCount]
; ;
dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] : dupExp [UINT32 & RootLevel, UINT32 & ExpOpCount] :
@ -2937,8 +3005,8 @@ ideqvallistExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
questionref13Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] : questionref13Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<< <<
UINT8 Type = 0x1; UINT8 Type = 0x1;
EFI_STRING_ID DevPath; EFI_STRING_ID DevPath = EFI_STRING_ID_INVALID;
EFI_GUID Guid; EFI_GUID Guid = {0,};
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID; EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
UINT32 BitMask; UINT32 BitMask;
CHAR8 *QName = NULL; CHAR8 *QName = NULL;
@ -2990,8 +3058,19 @@ rulerefExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
// stringref (STR_FORM_SET_TITLE) // stringref (STR_FORM_SET_TITLE)
// //
stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] : stringref1Exp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<<
EFI_STRING_ID RefStringId = EFI_STRING_ID_INVALID;
>>
L:StringRef L:StringRef
"\(" S:Number "\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (_STOSID(S->getText())); $ExpOpCount++; } >> "\("
(
"STRING_TOKEN"
"\("
S:Number << RefStringId = _STOSID(S->getText()); >>
"\)"
| I:Number << RefStringId = _STOSID(I->getText()); >>
)
"\)" << { CIfrStringRef1 SR1Obj(L->getLine()); _SAVE_OPHDR_COND (SR1Obj, ($ExpOpCount == 0), L->getLine()); SR1Obj.SetStringId (RefStringId); $ExpOpCount++; } >>
; ;
pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : pushthisExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
@ -3006,6 +3085,84 @@ securityExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
"\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >> "\(" guidDefinition[Guid] "\)" << { CIfrSecurity SObj(L->getLine()); _SAVE_OPHDR_COND (SObj, ($ExpOpCount == 0), L->getLine()); SObj.SetPermissions (&Guid); } $ExpOpCount++; >>
; ;
numericVarStoreType [UINT8 & VarType] :
"NUMERIC_SIZE_1" << $VarType = EFI_IFR_NUMERIC_SIZE_1; >>
| "NUMERIC_SIZE_2" << $VarType = EFI_IFR_NUMERIC_SIZE_2; >>
| "NUMERIC_SIZE_4" << $VarType = EFI_IFR_NUMERIC_SIZE_4; >>
| "NUMERIC_SIZE_8" << $VarType = EFI_IFR_NUMERIC_SIZE_8; >>
;
getExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<<
EFI_VARSTORE_INFO Info;
CHAR8 *VarIdStr = NULL;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
UINT32 Mask = 0;
EFI_QUESION_TYPE QType = QUESTION_NORMAL;
UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
UINT32 VarSize = 0;
Info.mVarStoreId = 0;
>>
L:Get
"\("
vfrStorageVarId[Info, VarIdStr, FALSE]
{"\|" FLAGS "=" numericVarStoreType [VarType] }
"\)" <<
{
if (Info.mVarStoreId == 0) {
// support Date/Time question
mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
}
if (QType == QUESTION_DATE) {
Info.mVarType = EFI_IFR_TYPE_DATE;
} else if (QType == QUESTION_TIME) {
Info.mVarType = EFI_IFR_TYPE_TIME;
}
switch (Mask) {
case DATE_YEAR_BITMASK:
Info.mInfo.mVarOffset = 0;
break;
case DATE_DAY_BITMASK:
Info.mInfo.mVarOffset = 3;
break;
case TIME_HOUR_BITMASK:
Info.mInfo.mVarOffset = 0;
break;
case TIME_MINUTE_BITMASK:
Info.mInfo.mVarOffset = 1;
break;
case TIME_SECOND_BITMASK:
Info.mInfo.mVarOffset = 2;
break;
default:
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
break;
}
} else {
if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
}
if (VarType != EFI_IFR_TYPE_UNDEFINED) {
Info.mVarType = VarType;
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
Info.mVarTotalSize = VarSize;
}
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
if (VarSize != Info.mVarTotalSize) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
}
}
CIfrGet GObj(L->getLine());
_SAVE_OPHDR_COND (GObj, ($ExpOpCount == 0), L->getLine());
GObj.SetVarInfo (&Info);
delete VarIdStr;
$ExpOpCount++;
}
>>
;
vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] : vfrExpressionConstant[UINT32 & RootLevel, UINT32 & ExpOpCount] :
L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >> L1:True << CIfrTrue TObj(L1->getLine()); _SAVE_OPHDR_COND (TObj, ($ExpOpCount == 0), L1->getLine()); $ExpOpCount++; >>
| L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >> | L2:False << CIfrFalse FObj(L2->getLine()); _SAVE_OPHDR_COND (FObj, ($ExpOpCount == 0), L2->getLine()); $ExpOpCount++; >>
@ -3026,6 +3183,7 @@ vfrExpressionUnaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
| unintExp[$RootLevel, $ExpOpCount] | unintExp[$RootLevel, $ExpOpCount]
| toupperExp[$RootLevel, $ExpOpCount] | toupperExp[$RootLevel, $ExpOpCount]
| tolwerExp[$RootLevel, $ExpOpCount] | tolwerExp[$RootLevel, $ExpOpCount]
| setExp[$RootLevel, $ExpOpCount]
; ;
lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] : lengthExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
@ -3086,6 +3244,78 @@ tolwerExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<< { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >> << { CIfrToLower TLObj(L->getLine()); $ExpOpCount++; } >>
; ;
setExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
<<
EFI_VARSTORE_INFO Info;
CHAR8 *VarIdStr = NULL;
EFI_QUESTION_ID QId = EFI_QUESTION_ID_INVALID;
UINT32 Mask = 0;
EFI_QUESION_TYPE QType = QUESTION_NORMAL;
UINT8 VarType = EFI_IFR_TYPE_UNDEFINED;
UINT32 VarSize = 0;
Info.mVarStoreId = 0;
>>
L:Set
"\("
vfrStorageVarId[Info, VarIdStr, FALSE]
{"\|" FLAG "=" numericVarStoreType [VarType] }
"," vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
"\)"
<<
{
if (Info.mVarStoreId == 0) {
// support Date/Time question
mCVfrQuestionDB.GetQuestionId (NULL, VarIdStr, QId, Mask, &QType);
if (QId == EFI_QUESTION_ID_INVALID || Mask == 0 || QType == QUESTION_NORMAL) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
}
if (QType == QUESTION_DATE) {
Info.mVarType = EFI_IFR_TYPE_DATE;
} else if (QType == QUESTION_TIME) {
Info.mVarType = EFI_IFR_TYPE_TIME;
}
switch (Mask) {
case DATE_YEAR_BITMASK:
Info.mInfo.mVarOffset = 0;
break;
case DATE_DAY_BITMASK:
Info.mInfo.mVarOffset = 3;
break;
case TIME_HOUR_BITMASK:
Info.mInfo.mVarOffset = 0;
break;
case TIME_MINUTE_BITMASK:
Info.mInfo.mVarOffset = 1;
break;
case TIME_SECOND_BITMASK:
Info.mInfo.mVarOffset = 2;
break;
default:
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode can't get the enough varstore information");
break;
}
} else {
if ((mCVfrDataStorage.GetVarStoreType(Info.mVarStoreId) == EFI_VFR_VARSTORE_NAME) && (VarType == EFI_IFR_TYPE_UNDEFINED)) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support name string");
}
if (VarType != EFI_IFR_TYPE_UNDEFINED) {
Info.mVarType = VarType;
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
Info.mVarTotalSize = VarSize;
}
_PCATCH(gCVfrVarDataTypeDB.GetDataTypeSize (Info.mVarType, &VarSize), L->getLine(), "Get/Set opcode can't get var type size");
if (VarSize != Info.mVarTotalSize) {
_PCATCH(VFR_RETURN_UNSUPPORTED, L->getLine(), "Get/Set opcode don't support data array");
}
}
CIfrSet TSObj(L->getLine());
TSObj.SetVarInfo (&Info);
delete VarIdStr;
$ExpOpCount++;
}
>>
;
vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] : vfrExpressionTernaryOp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
conditionalExp[$RootLevel, $ExpOpCount] conditionalExp[$RootLevel, $ExpOpCount]
| findExp[$RootLevel, $ExpOpCount] | findExp[$RootLevel, $ExpOpCount]
@ -3161,6 +3391,20 @@ spanExp[UINT32 & RootLevel, UINT32 & ExpOpCount] :
"\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >> "\)" << { CIfrSpan SObj(S->getLine()); SObj.SetFlags(Flags); $ExpOpCount++; } >>
; ;
vfrExpressionMap [UINT32 & RootLevel, UINT32 & ExpOpCount]:
L:Map
"\("
vfrStatementExpressionSub[$RootLevel + 1, $ExpOpCount]
":" << { CIfrMap MObj(L->getLine()); } >>
(
vfrStatementExpression[0]
","
vfrStatementExpression[0]
";"
) *
E:"\)" << { CIfrEnd EObj; EObj.SetLineNo(E->getLine()); $ExpOpCount++; } >>
;
spanFlags [UINT8 & Flags] : spanFlags [UINT8 & Flags] :
N:Number << $Flags |= _STOU8(N->getText()); >> N:Number << $Flags |= _STOU8(N->getText()); >>
| "LAST_NON_MATCH" << $Flags |= 0x00; >> | "LAST_NON_MATCH" << $Flags |= 0x00; >>
@ -3185,8 +3429,9 @@ private:
CVfrQuestionDB mCVfrQuestionDB; CVfrQuestionDB mCVfrQuestionDB;
CVfrRulesDB mCVfrRulesDB; CVfrRulesDB mCVfrRulesDB;
CIfrOpHeader *mCIfrOpHdr; CIfrOpHeader * mCIfrOpHdr[MAX_IFR_EXPRESSION_DEPTH];
UINT32 mCIfrOpHdrLineNo; UINT32 mCIfrOpHdrLineNo[MAX_IFR_EXPRESSION_DEPTH];
UINT8 mCIfrOpHdrIndex;
VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0); VOID _SAVE_OPHDR_COND (IN CIfrOpHeader &, IN BOOLEAN, UINT32 LineNo = 0);
VOID _CLEAR_SAVED_OPHDR (VOID); VOID _CLEAR_SAVED_OPHDR (VOID);
BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID); BOOLEAN _SET_SAVED_OPHDR_SCOPE (VOID);
@ -3210,11 +3455,11 @@ private:
UINT32 _GET_CURRQEST_ARRAY_SIZE(); UINT32 _GET_CURRQEST_ARRAY_SIZE();
public: public:
VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CHAR8 *); VOID _PCATCH (IN INTN, IN INTN, IN ANTLRTokenPtr, IN CONST CHAR8 *);
VOID _PCATCH (IN EFI_VFR_RETURN_CODE); VOID _PCATCH (IN EFI_VFR_RETURN_CODE);
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr); VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN ANTLRTokenPtr);
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32); VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32);
VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CHAR8 *); VOID _PCATCH (IN EFI_VFR_RETURN_CODE, IN UINT32, IN CONST CHAR8 *);
VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32); VOID syn (ANTLRAbstractToken *, ANTLRChar *, SetWordType *, ANTLRTokenType, INT32);
@ -3231,7 +3476,7 @@ public:
EFI_FORM_ID _STOFID (IN CHAR8 *); EFI_FORM_ID _STOFID (IN CHAR8 *);
EFI_QUESTION_ID _STOQID (IN CHAR8 *); EFI_QUESTION_ID _STOQID (IN CHAR8 *);
VOID _STRCAT (IN OUT CHAR8 **, IN CHAR8 *); VOID _STRCAT (IN OUT CHAR8 **, IN CONST CHAR8 *);
VOID _DeclareDefaultLinearVarStore (IN UINT32); VOID _DeclareDefaultLinearVarStore (IN UINT32);
VOID _DeclareStandardDefaultStorage (IN UINT32); VOID _DeclareStandardDefaultStorage (IN UINT32);
@ -3259,11 +3504,11 @@ EfiVfrParser::_SAVE_OPHDR_COND (
) )
{ {
if (Cond == TRUE) { if (Cond == TRUE) {
if (mCIfrOpHdr != NULL) { if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
return ; return ;
} }
mCIfrOpHdr = new CIfrOpHeader(OpHdr); mCIfrOpHdr[mCIfrOpHdrIndex] = new CIfrOpHeader(OpHdr);
mCIfrOpHdrLineNo = LineNo; mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = LineNo;
} }
} }
@ -3272,8 +3517,8 @@ EfiVfrParser::_CLEAR_SAVED_OPHDR (
VOID VOID
) )
{ {
mCIfrOpHdr = NULL; mCIfrOpHdr[mCIfrOpHdrIndex] = NULL;
mCIfrOpHdrLineNo = 0; mCIfrOpHdrLineNo[mCIfrOpHdrIndex] = 0;
} }
BOOLEAN BOOLEAN
@ -3281,10 +3526,11 @@ EfiVfrParser::_SET_SAVED_OPHDR_SCOPE (
VOID VOID
) )
{ {
if (mCIfrOpHdr != NULL) { if (mCIfrOpHdr[mCIfrOpHdrIndex] != NULL) {
mCIfrOpHdr->SetScope (1); mCIfrOpHdr[mCIfrOpHdrIndex]->SetScope (1);
return TRUE; return TRUE;
} }
// //
// IfrOpHdr is not set, FALSE is return. // IfrOpHdr is not set, FALSE is return.
// //
@ -3367,7 +3613,7 @@ EfiVfrParser::_PCATCH (
IN INTN ReturnCode, IN INTN ReturnCode,
IN INTN ExpectCode, IN INTN ExpectCode,
IN ANTLRTokenPtr Tok, IN ANTLRTokenPtr Tok,
IN CHAR8 *ErrorMsg IN CONST CHAR8 *ErrorMsg
) )
{ {
if (ReturnCode != ExpectCode) { if (ReturnCode != ExpectCode) {
@ -3381,7 +3627,7 @@ EfiVfrParser::_PCATCH (
IN EFI_VFR_RETURN_CODE ReturnCode IN EFI_VFR_RETURN_CODE ReturnCode
) )
{ {
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode); mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode);
} }
VOID VOID
@ -3390,7 +3636,7 @@ EfiVfrParser::_PCATCH (
IN ANTLRTokenPtr Tok IN ANTLRTokenPtr Tok
) )
{ {
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText()); mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, Tok->getLine(), Tok->getText());
} }
VOID VOID
@ -3399,17 +3645,17 @@ EfiVfrParser::_PCATCH (
IN UINT32 LineNum IN UINT32 LineNum
) )
{ {
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, LineNum); mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum);
} }
VOID VOID
EfiVfrParser::_PCATCH ( EfiVfrParser::_PCATCH (
IN EFI_VFR_RETURN_CODE ReturnCode, IN EFI_VFR_RETURN_CODE ReturnCode,
IN UINT32 LineNum, IN UINT32 LineNum,
IN CHAR8 *ErrorMsg IN CONST CHAR8 *ErrorMsg
) )
{ {
mParserStatus += gCVfrErrorHandle.HandleError (ReturnCode, LineNum, ErrorMsg); mParserStatus = mParserStatus + gCVfrErrorHandle.HandleError (ReturnCode, LineNum, (CHAR8 *) ErrorMsg);
} }
VOID VOID
@ -3638,7 +3884,7 @@ EfiVfrParser::_STOQID (
VOID VOID
EfiVfrParser::_STRCAT ( EfiVfrParser::_STRCAT (
IN OUT CHAR8 **Dest, IN OUT CHAR8 **Dest,
IN CHAR8 *Src IN CONST CHAR8 *Src
) )
{ {
CHAR8 *NewStr; CHAR8 *NewStr;
@ -3674,6 +3920,7 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
SVfrVarStorageNode *pNode; SVfrVarStorageNode *pNode;
UINT32 TypeSize; UINT32 TypeSize;
BOOLEAN FirstNode; BOOLEAN FirstNode;
CONST CHAR8 VarName[] = "Setup";
FirstNode = TRUE; FirstNode = TRUE;
pNode = mCVfrDataStorage.GetBufferVarStoreList(); pNode = mCVfrDataStorage.GetBufferVarStoreList();
@ -3686,9 +3933,9 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
CIfrVarStore VSObj; CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo); VSObj.SetLineNo (LineNo);
VSObj.SetVarStoreId (0x1); //the first and only one Buffer Var Store VSObj.SetVarStoreId (0x1); //the first and only one Buffer Var Store
VSObj.SetSize (TypeSize); VSObj.SetSize ((UINT16) TypeSize);
//VSObj.SetName (gCVfrVarDataTypeDB.mFirstNewDataTypeName); //VSObj.SetName (gCVfrVarDataTypeDB.mFirstNewDataTypeName);
VSObj.SetName ("Setup"); VSObj.SetName ((CHAR8 *) VarName);
VSObj.SetGuid (&mFormsetGuid); VSObj.SetGuid (&mFormsetGuid);
#ifdef VFREXP_DEBUG #ifdef VFREXP_DEBUG
printf ("Create the default VarStoreName is %s\n", gCVfrVarDataTypeDB.mFirstNewDataTypeName); printf ("Create the default VarStoreName is %s\n", gCVfrVarDataTypeDB.mFirstNewDataTypeName);
@ -3703,9 +3950,9 @@ EfiVfrParser::_DeclareDefaultFrameworkVarStore (
CIfrVarStore VSObj; CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo); VSObj.SetLineNo (LineNo);
VSObj.SetVarStoreId (pNode->mVarStoreId); VSObj.SetVarStoreId (pNode->mVarStoreId);
VSObj.SetSize (pNode->mStorageInfo.mDataType->mTotalSize); VSObj.SetSize ((UINT16) pNode->mStorageInfo.mDataType->mTotalSize);
if (FirstNode) { if (FirstNode) {
VSObj.SetName ("Setup"); VSObj.SetName ((CHAR8 *) VarName);
FirstNode = FALSE; FirstNode = FALSE;
} else { } else {
VSObj.SetName (pNode->mVarStoreName); VSObj.SetName (pNode->mVarStoreName);
@ -3745,6 +3992,10 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
UINT32 Index; UINT32 Index;
CHAR8 **TypeNameList; CHAR8 **TypeNameList;
UINT32 ListSize; UINT32 ListSize;
CONST CHAR8 DateName[] = "Date";
CONST CHAR8 TimeName[] = "Time";
CONST CHAR8 DateType[] = "EFI_HII_DATE";
CONST CHAR8 TimeType[] = "EFI_HII_TIME";
gCVfrVarDataTypeDB.GetUserDefinedTypeNameList (&TypeNameList, &ListSize); gCVfrVarDataTypeDB.GetUserDefinedTypeNameList (&TypeNameList, &ListSize);
@ -3764,7 +4015,7 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId); mCVfrDataStorage.GetVarStoreId(TypeNameList[Index], &VarStoreId);
VSObj.SetVarStoreId (VarStoreId); VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size); gCVfrVarDataTypeDB.GetDataTypeSize(TypeNameList[Index], &Size);
VSObj.SetSize (Size); VSObj.SetSize ((UINT16) Size);
VSObj.SetName (TypeNameList[Index]); VSObj.SetName (TypeNameList[Index]);
VSObj.SetGuid (&mFormsetGuid); VSObj.SetGuid (&mFormsetGuid);
} }
@ -3773,45 +4024,45 @@ EfiVfrParser::_DeclareDefaultLinearVarStore (
// not required to declare Date and Time VarStore, // not required to declare Date and Time VarStore,
// because code to support old format Data and Time // because code to support old format Data and Time
// //
if (gCVfrVarDataTypeDB.IsTypeNameDefined ("Date") == FALSE) { if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) DateName) == FALSE) {
UINT32 Size; UINT32 Size;
EFI_VARSTORE_ID VarStoreId; EFI_VARSTORE_ID VarStoreId;
CIfrVarStore VSObj; CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo); VSObj.SetLineNo (LineNo);
mCVfrDataStorage.DeclareBufferVarStore ( mCVfrDataStorage.DeclareBufferVarStore (
"Date", (CHAR8 *) DateName,
&mFormsetGuid, &mFormsetGuid,
&gCVfrVarDataTypeDB, &gCVfrVarDataTypeDB,
"EFI_HII_DATE", (CHAR8 *) DateType,
EFI_VARSTORE_ID_INVALID EFI_VARSTORE_ID_INVALID
); );
mCVfrDataStorage.GetVarStoreId("Date", &VarStoreId); mCVfrDataStorage.GetVarStoreId((CHAR8 *) DateName, &VarStoreId);
VSObj.SetVarStoreId (VarStoreId); VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize("EFI_HII_DATE", &Size); gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) DateType, &Size);
VSObj.SetSize (Size); VSObj.SetSize ((UINT16) Size);
VSObj.SetName ("Date"); VSObj.SetName ((CHAR8 *) DateName);
VSObj.SetGuid (&mFormsetGuid); VSObj.SetGuid (&mFormsetGuid);
} }
if (gCVfrVarDataTypeDB.IsTypeNameDefined ("Time") == FALSE) { if (gCVfrVarDataTypeDB.IsTypeNameDefined ((CHAR8 *) TimeName) == FALSE) {
UINT32 Size; UINT32 Size;
EFI_VARSTORE_ID VarStoreId; EFI_VARSTORE_ID VarStoreId;
CIfrVarStore VSObj; CIfrVarStore VSObj;
VSObj.SetLineNo (LineNo); VSObj.SetLineNo (LineNo);
mCVfrDataStorage.DeclareBufferVarStore ( mCVfrDataStorage.DeclareBufferVarStore (
"Time", (CHAR8 *) TimeName,
&mFormsetGuid, &mFormsetGuid,
&gCVfrVarDataTypeDB, &gCVfrVarDataTypeDB,
"EFI_HII_TIME", (CHAR8 *) TimeType,
EFI_VARSTORE_ID_INVALID EFI_VARSTORE_ID_INVALID
); );
mCVfrDataStorage.GetVarStoreId("Time", &VarStoreId); mCVfrDataStorage.GetVarStoreId((CHAR8 *) TimeName, &VarStoreId);
VSObj.SetVarStoreId (VarStoreId); VSObj.SetVarStoreId (VarStoreId);
gCVfrVarDataTypeDB.GetDataTypeSize("EFI_HII_TIME", &Size); gCVfrVarDataTypeDB.GetDataTypeSize((CHAR8 *) TimeType, &Size);
VSObj.SetSize (Size); VSObj.SetSize ((UINT16) Size);
VSObj.SetName ("Time"); VSObj.SetName ((CHAR8 *) TimeName);
VSObj.SetGuid (&mFormsetGuid); VSObj.SetGuid (&mFormsetGuid);
} }
} }
@ -3826,7 +4077,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
// //
CIfrDefaultStore DSObj; CIfrDefaultStore DSObj;
mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD); mCVfrDefaultStore.RegisterDefaultStore (DSObj.GetObjBinAddr(), (CHAR8 *) "Standard Defaults", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_STANDARD);
DSObj.SetLineNo (LineNo); DSObj.SetLineNo (LineNo);
DSObj.SetDefaultName (EFI_STRING_ID_INVALID); DSObj.SetDefaultName (EFI_STRING_ID_INVALID);
DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD); DSObj.SetDefaultId (EFI_HII_DEFAULT_CLASS_STANDARD);
@ -3836,7 +4087,7 @@ EfiVfrParser::_DeclareStandardDefaultStorage (
// //
CIfrDefaultStore DSObjMF; CIfrDefaultStore DSObjMF;
mCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING); mCVfrDefaultStore.RegisterDefaultStore (DSObjMF.GetObjBinAddr(), (CHAR8 *) "Standard ManuFacturing", EFI_STRING_ID_INVALID, EFI_HII_DEFAULT_CLASS_MANUFACTURING);
DSObjMF.SetLineNo (LineNo); DSObjMF.SetLineNo (LineNo);
DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID); DSObjMF.SetDefaultName (EFI_STRING_ID_INVALID);
DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING); DSObjMF.SetDefaultId (EFI_HII_DEFAULT_CLASS_MANUFACTURING);

View File

@ -22,7 +22,7 @@ VOID
CVfrBinaryOutput::WriteLine ( CVfrBinaryOutput::WriteLine (
IN FILE *pFile, IN FILE *pFile,
IN UINT32 LineBytes, IN UINT32 LineBytes,
IN CHAR8 *LineHeader, IN CONST CHAR8 *LineHeader,
IN CHAR8 *BlkBuf, IN CHAR8 *BlkBuf,
IN UINT32 BlkSize IN UINT32 BlkSize
) )
@ -45,7 +45,7 @@ VOID
CVfrBinaryOutput::WriteEnd ( CVfrBinaryOutput::WriteEnd (
IN FILE *pFile, IN FILE *pFile,
IN UINT32 LineBytes, IN UINT32 LineBytes,
IN CHAR8 *LineHeader, IN CONST CHAR8 *LineHeader,
IN CHAR8 *BlkBuf, IN CHAR8 *BlkBuf,
IN UINT32 BlkSize IN UINT32 BlkSize
) )
@ -287,7 +287,7 @@ CVfrBufferConfig::Write (
switch (Mode) { switch (Mode) {
case 'a' : // add case 'a' : // add
if (Select (Name, Id) != 0) { if (Select (Name, Id) != 0) {
if ((pItem = new SConfigItem (Name, Id, Type, Offset, Width, Value)) == NULL) { if ((pItem = new SConfigItem (Name, Id, Type, Offset, (UINT16) Width, Value)) == NULL) {
return 2; return 2;
} }
if (mItemListHead == NULL) { if (mItemListHead == NULL) {
@ -455,7 +455,7 @@ CVfrBufferConfig::~CVfrBufferConfig (
CVfrBufferConfig gCVfrBufferConfig; CVfrBufferConfig gCVfrBufferConfig;
static struct { static struct {
CHAR8 *mTypeName; CONST CHAR8 *mTypeName;
UINT8 mType; UINT8 mType;
UINT32 mSize; UINT32 mSize;
UINT32 mAlign; UINT32 mAlign;
@ -744,20 +744,20 @@ CVfrVarDataTypeDB::InternalTypesListInit (
SVfrDataField *pDayField = new SVfrDataField; SVfrDataField *pDayField = new SVfrDataField;
strcpy (pYearField->mFieldName, "Year"); strcpy (pYearField->mFieldName, "Year");
GetDataType ("UINT8", &pYearField->mFieldType); GetDataType ((CHAR8 *)"UINT16", &pYearField->mFieldType);
pYearField->mOffset = 0; pYearField->mOffset = 0;
pYearField->mNext = pMonthField; pYearField->mNext = pMonthField;
pYearField->mArrayNum = 0; pYearField->mArrayNum = 0;
strcpy (pMonthField->mFieldName, "Month"); strcpy (pMonthField->mFieldName, "Month");
GetDataType ("UINT8", &pMonthField->mFieldType); GetDataType ((CHAR8 *)"UINT8", &pMonthField->mFieldType);
pMonthField->mOffset = 1; pMonthField->mOffset = 2;
pMonthField->mNext = pDayField; pMonthField->mNext = pDayField;
pMonthField->mArrayNum = 0; pMonthField->mArrayNum = 0;
strcpy (pDayField->mFieldName, "Day"); strcpy (pDayField->mFieldName, "Day");
GetDataType ("UINT8", &pDayField->mFieldType); GetDataType ((CHAR8 *)"UINT8", &pDayField->mFieldType);
pDayField->mOffset = 2; pDayField->mOffset = 3;
pDayField->mNext = NULL; pDayField->mNext = NULL;
pDayField->mArrayNum = 0; pDayField->mArrayNum = 0;
@ -768,19 +768,19 @@ CVfrVarDataTypeDB::InternalTypesListInit (
SVfrDataField *pSecondsField = new SVfrDataField; SVfrDataField *pSecondsField = new SVfrDataField;
strcpy (pHoursField->mFieldName, "Hours"); strcpy (pHoursField->mFieldName, "Hours");
GetDataType ("UINT8", &pHoursField->mFieldType); GetDataType ((CHAR8 *)"UINT8", &pHoursField->mFieldType);
pHoursField->mOffset = 0; pHoursField->mOffset = 0;
pHoursField->mNext = pMinutesField; pHoursField->mNext = pMinutesField;
pHoursField->mArrayNum = 0; pHoursField->mArrayNum = 0;
strcpy (pMinutesField->mFieldName, "Minutes"); strcpy (pMinutesField->mFieldName, "Minutes");
GetDataType ("UINT8", &pMinutesField->mFieldType); GetDataType ((CHAR8 *)"UINT8", &pMinutesField->mFieldType);
pMinutesField->mOffset = 1; pMinutesField->mOffset = 1;
pMinutesField->mNext = pSecondsField; pMinutesField->mNext = pSecondsField;
pMinutesField->mArrayNum = 0; pMinutesField->mArrayNum = 0;
strcpy (pSecondsField->mFieldName, "Seconds"); strcpy (pSecondsField->mFieldName, "Seconds");
GetDataType ("UINT8", &pSecondsField->mFieldType); GetDataType ((CHAR8 *)"UINT8", &pSecondsField->mFieldType);
pSecondsField->mOffset = 2; pSecondsField->mOffset = 2;
pSecondsField->mNext = NULL; pSecondsField->mNext = NULL;
pSecondsField->mArrayNum = 0; pSecondsField->mArrayNum = 0;
@ -853,7 +853,7 @@ CVfrVarDataTypeDB::Pack (
if (Action & VFR_PACK_SHOW) { if (Action & VFR_PACK_SHOW) {
sprintf (Msg, "value of pragma pack(show) == %d", mPackAlign); sprintf (Msg, "value of pragma pack(show) == %d", mPackAlign);
gCVfrErrorHandle.PrintMsg (LineNum, "", "Warning", Msg); gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Warning", Msg);
} }
if (Action & VFR_PACK_PUSH) { if (Action & VFR_PACK_PUSH) {
@ -870,7 +870,7 @@ CVfrVarDataTypeDB::Pack (
SVfrPackStackNode *pNode = NULL; SVfrPackStackNode *pNode = NULL;
if (mPackStack == NULL) { if (mPackStack == NULL) {
gCVfrErrorHandle.PrintMsg (LineNum, "", "Error", "#pragma pack(pop...) : more pops than pushes"); gCVfrErrorHandle.PrintMsg (LineNum, NULL, "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, "", "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'"); gCVfrErrorHandle.PrintMsg (LineNum, NULL, "Error", "expected pragma parameter to be '1', '2', '4', '8', or '16'");
} else { } else {
mPackAlign = PackAlign; mPackAlign = PackAlign;
} }
@ -1127,7 +1127,7 @@ CVfrVarDataTypeDB::GetDataFieldInfo (
CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS); CHECK_ERROR_RETURN(GetTypeField (FName, pType, pField), VFR_RETURN_SUCCESS);
pType = pField->mFieldType; pType = pField->mFieldType;
CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp), VFR_RETURN_SUCCESS); CHECK_ERROR_RETURN(GetFieldOffset (pField, ArrayIdx, Tmp), VFR_RETURN_SUCCESS);
Offset += Tmp; Offset = (UINT16) (Offset + Tmp);
Type = GetFieldWidth (pField); Type = GetFieldWidth (pField);
Size = GetFieldSize (pField, ArrayIdx); Size = GetFieldSize (pField, ArrayIdx);
} }
@ -1386,6 +1386,7 @@ CVfrDataStorage::GetFreeVarStoreId (
// //
// Assign the different ID range for the different type VarStore to support Framework Vfr // Assign the different ID range for the different type VarStore to support Framework Vfr
// //
Index = 0;
if ((!VfrCompatibleMode) || (VarType == EFI_VFR_VARSTORE_BUFFER)) { if ((!VfrCompatibleMode) || (VarType == EFI_VFR_VARSTORE_BUFFER)) {
Index = 0; Index = 0;
} else if (VarType == EFI_VFR_VARSTORE_EFI) { } else if (VarType == EFI_VFR_VARSTORE_EFI) {
@ -1838,13 +1839,11 @@ CVfrDataStorage::BufferVarStoreRequestElementAdd (
IN EFI_VARSTORE_INFO &Info IN EFI_VARSTORE_INFO &Info
) )
{ {
CHAR8 NewReqElt[128] = {'\0',};
CHAR8 *OldReqElt = NULL;
SVfrVarStorageNode *pNode = NULL; SVfrVarStorageNode *pNode = NULL;
EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue; EFI_IFR_TYPE_VALUE Value = gZeroEfiIfrTypeValue;
for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) { for (pNode = mBufferVarStoreList; pNode != NULL; pNode = pNode->mNext) {
if (strcmp (pNode->mVarStoreName, StoreName) == NULL) { if (strcmp (pNode->mVarStoreName, StoreName) == 0) {
break; break;
} }
} }
@ -2024,85 +2023,6 @@ CVfrDefaultStore::GetDefaultId (
return VFR_RETURN_UNDEFINED; return VFR_RETURN_UNDEFINED;
} }
STATIC
EFI_VFR_RETURN_CODE
AltCfgItemPrintToBuffer (
IN CHAR8 *NewAltCfg,
IN EFI_VARSTORE_INFO Info,
IN UINT8 Type,
IN EFI_IFR_TYPE_VALUE Value
)
{
UINT32 Index;
UINT8 *BufChar = NULL;
UINT32 Count = 0;
if (NewAltCfg != NULL) {
Count = sprintf (
NewAltCfg,
"&OFFSET=%x&WIDTH=%x&VALUE=",
Info.mInfo.mVarOffset,
Info.mVarTotalSize
);
NewAltCfg += Count;
switch (Type) {
case EFI_IFR_TYPE_NUM_SIZE_8 :
Count = sprintf (NewAltCfg, "%x", Value.u8);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_NUM_SIZE_16 :
Count = sprintf (NewAltCfg, "%x", Value.u16);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_NUM_SIZE_32 :
Count = sprintf (NewAltCfg, "%x", Value.u32);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_NUM_SIZE_64 :
Count = sprintf (NewAltCfg, "%x", Value.u64);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_BOOLEAN :
Count = sprintf (NewAltCfg, "%x", Value.b);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_TIME :
#if 1
Count = sprintf (NewAltCfg, "%x", *((UINT32 *)(&Value.time)));
NewAltCfg += Count;
#else
BufChar = (UINT8 *)&Value.time;
for (Index = 0; Index < sizeof(EFI_HII_TIME); Index++) {
Count = sprintf (NewAltCfg, "%02x", (UINT8)BufChar[Index]);
NewAltCfg += Count;
}
#endif
break;
case EFI_IFR_TYPE_DATE :
#if 1
Count = sprintf (NewAltCfg, "%x", *((UINT32 *)(&Value.date)));
NewAltCfg += Count;
#else
BufChar = (UINT8 *)&Value.date;
for (Index = 0; Index < sizeof(EFI_HII_DATE); Index++) {
Count = sprintf (NewAltCfg, "%02x", (UINT8)BufChar[Index]);
NewAltCfg += Count;
}
#endif
break;
case EFI_IFR_TYPE_STRING :
Count = sprintf (NewAltCfg, "%x", Value.string);
NewAltCfg += Count;
break;
case EFI_IFR_TYPE_OTHER :
return VFR_RETURN_UNSUPPORTED;
}
}
return VFR_RETURN_FATAL_ERROR;
}
EFI_VFR_RETURN_CODE EFI_VFR_RETURN_CODE
CVfrDefaultStore::BufferVarStoreAltConfigAdd ( CVfrDefaultStore::BufferVarStoreAltConfigAdd (
IN EFI_VARSTORE_ID DefaultId, IN EFI_VARSTORE_ID DefaultId,
@ -2340,6 +2260,7 @@ SVfrQuestionNode::SVfrQuestionNode (
mQuestionId = EFI_QUESTION_ID_INVALID; mQuestionId = EFI_QUESTION_ID_INVALID;
mBitMask = BitMask; mBitMask = BitMask;
mNext = NULL; mNext = NULL;
mQtype = QUESTION_NORMAL;
if (Name == NULL) { if (Name == NULL) {
mName = new CHAR8[strlen ("$DEFAULT") + 1]; mName = new CHAR8[strlen ("$DEFAULT") + 1];
@ -2509,6 +2430,9 @@ CVfrQuestionDB::RegisterOldDateQuestion (
pNode[0]->mQuestionId = QuestionId; pNode[0]->mQuestionId = QuestionId;
pNode[1]->mQuestionId = QuestionId; pNode[1]->mQuestionId = QuestionId;
pNode[2]->mQuestionId = QuestionId; pNode[2]->mQuestionId = QuestionId;
pNode[0]->mQtype = QUESTION_DATE;
pNode[1]->mQtype = QUESTION_DATE;
pNode[2]->mQtype = QUESTION_DATE;
pNode[0]->mNext = pNode[1]; pNode[0]->mNext = pNode[1];
pNode[1]->mNext = pNode[2]; pNode[1]->mNext = pNode[2];
pNode[2]->mNext = mQuestionList; pNode[2]->mNext = mQuestionList;
@ -2585,6 +2509,9 @@ CVfrQuestionDB::RegisterNewDateQuestion (
pNode[0]->mQuestionId = QuestionId; pNode[0]->mQuestionId = QuestionId;
pNode[1]->mQuestionId = QuestionId; pNode[1]->mQuestionId = QuestionId;
pNode[2]->mQuestionId = QuestionId; pNode[2]->mQuestionId = QuestionId;
pNode[0]->mQtype = QUESTION_DATE;
pNode[1]->mQtype = QUESTION_DATE;
pNode[2]->mQtype = QUESTION_DATE;
pNode[0]->mNext = pNode[1]; pNode[0]->mNext = pNode[1];
pNode[1]->mNext = pNode[2]; pNode[1]->mNext = pNode[2];
pNode[2]->mNext = mQuestionList; pNode[2]->mNext = mQuestionList;
@ -2651,6 +2578,9 @@ CVfrQuestionDB::RegisterOldTimeQuestion (
pNode[0]->mQuestionId = QuestionId; pNode[0]->mQuestionId = QuestionId;
pNode[1]->mQuestionId = QuestionId; pNode[1]->mQuestionId = QuestionId;
pNode[2]->mQuestionId = QuestionId; pNode[2]->mQuestionId = QuestionId;
pNode[0]->mQtype = QUESTION_TIME;
pNode[1]->mQtype = QUESTION_TIME;
pNode[2]->mQtype = QUESTION_TIME;
pNode[0]->mNext = pNode[1]; pNode[0]->mNext = pNode[1];
pNode[1]->mNext = pNode[2]; pNode[1]->mNext = pNode[2];
pNode[2]->mNext = mQuestionList; pNode[2]->mNext = mQuestionList;
@ -2727,6 +2657,9 @@ CVfrQuestionDB::RegisterNewTimeQuestion (
pNode[0]->mQuestionId = QuestionId; pNode[0]->mQuestionId = QuestionId;
pNode[1]->mQuestionId = QuestionId; pNode[1]->mQuestionId = QuestionId;
pNode[2]->mQuestionId = QuestionId; pNode[2]->mQuestionId = QuestionId;
pNode[0]->mQtype = QUESTION_TIME;
pNode[1]->mQtype = QUESTION_TIME;
pNode[2]->mQtype = QUESTION_TIME;
pNode[0]->mNext = pNode[1]; pNode[0]->mNext = pNode[1];
pNode[1]->mNext = pNode[2]; pNode[1]->mNext = pNode[2];
pNode[2]->mNext = mQuestionList; pNode[2]->mNext = mQuestionList;
@ -2800,13 +2733,17 @@ CVfrQuestionDB::GetQuestionId (
IN CHAR8 *Name, IN CHAR8 *Name,
IN CHAR8 *VarIdStr, IN CHAR8 *VarIdStr,
OUT EFI_QUESTION_ID &QuestionId, OUT EFI_QUESTION_ID &QuestionId,
OUT UINT32 &BitMask OUT UINT32 &BitMask,
OUT EFI_QUESION_TYPE *QType
) )
{ {
SVfrQuestionNode *pNode; SVfrQuestionNode *pNode;
QuestionId = EFI_QUESTION_ID_INVALID; QuestionId = EFI_QUESTION_ID_INVALID;
BitMask = 0x00000000; BitMask = 0x00000000;
if (QType != NULL) {
*QType = QUESTION_NORMAL;
}
if ((Name == NULL) && (VarIdStr == NULL)) { if ((Name == NULL) && (VarIdStr == NULL)) {
return ; return ;
@ -2827,6 +2764,9 @@ CVfrQuestionDB::GetQuestionId (
QuestionId = pNode->mQuestionId; QuestionId = pNode->mQuestionId;
BitMask = pNode->mBitMask; BitMask = pNode->mBitMask;
if (QType != NULL) {
*QType = pNode->mQtype;
}
break; break;
} }
@ -2877,3 +2817,4 @@ BOOLEAN VfrCompatibleMode = FALSE;
CVfrVarDataTypeDB gCVfrVarDataTypeDB; CVfrVarDataTypeDB gCVfrVarDataTypeDB;

View File

@ -2,7 +2,7 @@
Vfr common library functions. Vfr common library functions.
Copyright (c) 2004 - 2009, Intel Corporation Copyright (c) 2004 - 2010, 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
@ -36,8 +36,8 @@ extern BOOLEAN VfrCompatibleMode;
class CVfrBinaryOutput { class CVfrBinaryOutput {
public: public:
virtual VOID WriteLine (IN FILE *, IN UINT32, IN CHAR8 *, IN CHAR8 *, IN UINT32); virtual VOID WriteLine (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CHAR8 *, IN CHAR8 *, IN UINT32); virtual VOID WriteEnd (IN FILE *, IN UINT32, IN CONST CHAR8 *, IN CHAR8 *, IN UINT32);
}; };
UINT32 UINT32
@ -332,6 +332,7 @@ struct SVfrQuestionNode {
EFI_QUESTION_ID mQuestionId; EFI_QUESTION_ID mQuestionId;
UINT32 mBitMask; UINT32 mBitMask;
SVfrQuestionNode *mNext; SVfrQuestionNode *mNext;
EFI_QUESION_TYPE mQtype;
SVfrQuestionNode (IN CHAR8 *, IN CHAR8 *, IN UINT32 BitMask = 0); SVfrQuestionNode (IN CHAR8 *, IN CHAR8 *, IN UINT32 BitMask = 0);
~SVfrQuestionNode (); ~SVfrQuestionNode ();
@ -358,7 +359,7 @@ public:
VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); VOID RegisterOldTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &); VOID RegisterNewTimeQuestion (IN CHAR8 *, IN CHAR8 *, IN OUT EFI_QUESTION_ID &);
EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID); EFI_VFR_RETURN_CODE UpdateQuestionId (IN EFI_QUESTION_ID, IN EFI_QUESTION_ID);
VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &); VOID GetQuestionId (IN CHAR8 *, IN CHAR8 *, OUT EFI_QUESTION_ID &, OUT UINT32 &, OUT EFI_QUESION_TYPE *QType = NULL);
EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID); EFI_VFR_RETURN_CODE FindQuestion (IN EFI_QUESTION_ID);
EFI_VFR_RETURN_CODE FindQuestion (IN CHAR8 *); EFI_VFR_RETURN_CODE FindQuestion (IN CHAR8 *);
VOID PrintAllQuestion (IN VOID); VOID PrintAllQuestion (IN VOID);

View File

@ -1,6 +1,6 @@
/** @file /** @file
Copyright (c) 1999 - 2008, Intel Corporation Copyright (c) 1999 - 2010, 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
@ -1801,7 +1801,7 @@ Returns:
// //
// Copyright declaration // Copyright declaration
// //
fprintf (stdout, "Copyright (c) 2007, Intel Corporation. All rights reserved.\n\n"); fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");
// //
// Details Option // Details Option

View File

@ -1,7 +1,7 @@
## @file ## @file
# Generate AutoGen.h, AutoGen.c and *.depex files # Generate AutoGen.h, AutoGen.c and *.depex files
# #
# Copyright (c) 2007 - 2009, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -138,8 +138,7 @@ class WorkspaceAutoGen(AutoGen):
# @param SkuId SKU id from command line # @param SkuId SKU id from command line
# #
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb, def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,
BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId=''):
ReportFile=None, ReportType=None):
self.MetaFile = ActivePlatform.MetaFile self.MetaFile = ActivePlatform.MetaFile
self.WorkspaceDir = WorkspaceDir self.WorkspaceDir = WorkspaceDir
self.Platform = ActivePlatform self.Platform = ActivePlatform
@ -147,8 +146,6 @@ class WorkspaceAutoGen(AutoGen):
self.ToolChain = Toolchain self.ToolChain = Toolchain
self.ArchList = ArchList self.ArchList = ArchList
self.SkuId = SkuId self.SkuId = SkuId
self.ReportFile = ReportFile
self.ReportType = ReportType
self.BuildDatabase = MetaFileDb self.BuildDatabase = MetaFileDb
self.TargetTxt = BuildConfig self.TargetTxt = BuildConfig
@ -167,9 +164,11 @@ class WorkspaceAutoGen(AutoGen):
Fdf.ParseFile() Fdf.ParseFile()
PcdSet = Fdf.Profile.PcdDict PcdSet = Fdf.Profile.PcdDict
ModuleList = Fdf.Profile.InfList ModuleList = Fdf.Profile.InfList
self.FdfProfile = Fdf.Profile
else: else:
PcdSet = {} PcdSet = {}
ModuleList = [] ModuleList = []
self.FdfProfile = None
# apply SKU and inject PCDs from Flash Definition file # apply SKU and inject PCDs from Flash Definition file
for Arch in self.ArchList: for Arch in self.ArchList:
@ -185,325 +184,6 @@ class WorkspaceAutoGen(AutoGen):
Pa.CollectPlatformDynamicPcds() Pa.CollectPlatformDynamicPcds()
self.AutoGenObjectList.append(Pa) self.AutoGenObjectList.append(Pa)
AllPcds = {}
MaxLen = 0
for Pcd in Pa._DynaPcdList_ + Pa._NonDynaPcdList_:
if Pcd.TokenSpaceGuidCName not in AllPcds:
AllPcds[Pcd.TokenSpaceGuidCName] = {}
if Pcd.Type not in AllPcds[Pcd.TokenSpaceGuidCName]:
AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] = []
AllPcds[Pcd.TokenSpaceGuidCName][Pcd.Type] += [Pcd]
if len(Pcd.TokenCName) > MaxLen:
MaxLen = len(Pcd.TokenCName)
if self.ReportFile <> None:
try:
if os.path.exists(self.ReportFile):
os.remove(self.ReportFile)
Fd = open(self.ReportFile, "w")
Fd.write ('===============================================================================\n')
Fd.write ('Platform Configuration Database Report\n')
Fd.write ('===============================================================================\n')
Fd.write (' *P - Platform scoped PCD override in DSC file\n')
Fd.write (' *F - Platform scoped PCD override in FDF file\n')
Fd.write (' *M - Module scoped PCD override in DSC file\n')
Fd.write (' *C - Library has a constructor\n')
Fd.write (' *D - Library has a destructor\n')
Fd.write (' *CD - Library has both a constructor and a destructor\n')
Fd.write ('===============================================================================\n')
Fd.write ('\n')
Fd.write ('===============================================================================\n')
Fd.write ('PLATFORM: %s\n' % (ActivePlatform.MetaFile))
Fd.write ('===============================================================================\n')
for Key in AllPcds:
Fd.write ('%s\n' % (Key))
for Type in AllPcds[Key]:
TypeName = ''
DecType = Type
if Type == 'FixedAtBuild':
TypeName = 'FIXED'
if Type == 'PatchableInModule':
TypeName = 'PATCH'
if Type == 'FeatureFlag':
TypeName = 'FLAG'
if Type == 'Dynamic':
TypeName = 'DYN'
if Type == 'DynamicHii':
TypeName = 'DYNHII'
DecType = 'Dynamic'
if Type == 'DynamicVpd':
TypeName = 'DYNVPD'
DecType = 'Dynamic'
if Type == 'DynamicEx':
TypeName = 'DEX'
DecType = 'Dynamic'
if Type == 'DynamicExHii':
TypeName = 'DEXHII'
DecType = 'Dynamic'
if Type == 'DynamicExVpd':
TypeName = 'DEXVPD'
DecType = 'Dynamic'
for Pcd in AllPcds[Key][Type]:
DecDefaultValue = None
for F in Pa.Platform.Modules.keys():
for Package in Pa.Platform.Modules[F].M.Module.Packages:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
if DecDefaultValue == None:
DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
DscDefaultValue = None
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
if Pcd.DefaultValue.strip()[0:2].upper() == '0X':
PcdDefaultValueNumber = int(Pcd.DefaultValue.strip(), 16)
else:
PcdDefaultValueNumber = int(Pcd.DefaultValue.strip())
if DecDefaultValue == None:
DecMatch = True
else:
if DecDefaultValue.strip()[0:2].upper() == '0X':
DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
else:
DecDefaultValueNumber = int(DecDefaultValue.strip())
DecMatch = (DecDefaultValueNumber == PcdDefaultValueNumber)
if DscDefaultValue == None:
DscMatch = True
else:
if DscDefaultValue.strip()[0:2].upper() == '0X':
DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
else:
DscDefaultValueNumber = int(DscDefaultValue.strip())
DscMatch = (DscDefaultValueNumber == PcdDefaultValueNumber)
else:
if DecDefaultValue == None:
DecMatch = True
else:
DecMatch = (DecDefaultValue == Pcd.DefaultValue)
if DscDefaultValue == None:
DscMatch = True
else:
DscMatch = (DscDefaultValue == Pcd.DefaultValue)
if DecMatch:
Fd.write (' %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
else:
if DscMatch:
if (Pcd.TokenCName, Key) in PcdSet:
Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
else:
Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen + 2, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', Pcd.DefaultValue))
for F in Pa.Platform.Modules.keys():
for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
continue
if ModulePcd.TokenCName <> Pcd.TokenCName:
continue
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
else:
ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
Match = (ModulePcdDefaultValueNumber == PcdDefaultValueNumber)
else:
Match = (ModulePcd.DefaultValue == Pcd.DefaultValue)
if Match:
continue
Fd.write (' *M %*s = %s\n' % (MaxLen + 21, str(F).split('\\')[-1], ModulePcd.DefaultValue))
if not DecMatch and DscMatch and DecDefaultValue <> None:
Fd.write (' %*s = %s\n' % (MaxLen + 21, 'DEC DEFAULT', DecDefaultValue))
Fd.write ('\n')
Fd.write ('===============================================================================\n')
Fd.write ('===============================================================================\n')
for F in Pa.Platform.Modules.keys():
Fd.write ('\n')
Fd.write ('===============================================================================\n')
Fd.write ('MODULE: %s\n' % (F))
Fd.write ('===============================================================================\n')
Fd.write ('PLATFORM CONFIGURATION DATABASE\n')
Fd.write ('-------------------------------------------------------------------------------\n')
ModuleFirst = True
for Key in AllPcds:
First = True
for Type in AllPcds[Key]:
TypeName = ''
DecType = Type
if Type == 'FixedAtBuild':
TypeName = 'FIXED'
if Type == 'PatchableInModule':
TypeName = 'PATCH'
if Type == 'FeatureFlag':
TypeName = 'FLAG'
if Type == 'Dynamic':
TypeName = 'DYN'
if Type == 'DynamicHii':
TypeName = 'DYNHII'
DecType = 'Dynamic'
if Type == 'DynamicVpd':
TypeName = 'DYNVPD'
DecType = 'Dynamic'
if Type == 'DynamicEx':
TypeName = 'DEX'
DecType = 'Dynamic'
if Type == 'DynamicExHii':
TypeName = 'DEXHII'
DecType = 'Dynamic'
if Type == 'DynamicExVpd':
TypeName = 'DEXVPD'
DecType = 'Dynamic'
for Pcd in AllPcds[Key][Type]:
for ModulePcd in Pa.Platform.Modules[F].M.ModulePcdList + Pa.Platform.Modules[F].M.LibraryPcdList:
if ModulePcd.TokenSpaceGuidCName <> Pcd.TokenSpaceGuidCName:
continue
if ModulePcd.TokenCName <> Pcd.TokenCName:
continue
if ModulePcd.Type <> Pcd.Type:
continue
if First:
if ModuleFirst:
ModuleFirst = False
else:
Fd.write ('\n')
Fd.write ('%s\n' % (Key))
First = False
InfDefaultValue = ModulePcd.InfDefaultValue
if InfDefaultValue == '':
InfDefaultValue = None
DecDefaultValue = None
for Package in Pa.Platform.Modules[F].M.Module.Packages:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType) in Package.Pcds:
if DecDefaultValue == None:
DecDefaultValue = Package.Pcds[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, DecType].DefaultValue
DscDefaultValue = None
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds:
DscDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
DscModuleOverrideDefaultValue = None
if F in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules:
if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds:
DscModuleOverrideDefaultValue = self.BuildDatabase.WorkspaceDb.PlatformList[0].Modules[F].Pcds[(Pcd.TokenCName, Pcd.TokenSpaceGuidCName)].DefaultValue
if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'):
if ModulePcd.DefaultValue.strip()[0:2].upper() == '0X':
ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip(), 16)
else:
ModulePcdDefaultValueNumber = int(ModulePcd.DefaultValue.strip())
if DecDefaultValue == None:
DecMatch = True
else:
if DecDefaultValue.strip()[0:2].upper() == '0X':
DecDefaultValueNumber = int(DecDefaultValue.strip(), 16)
else:
DecDefaultValueNumber = int(DecDefaultValue.strip())
DecMatch = (DecDefaultValueNumber == ModulePcdDefaultValueNumber)
if InfDefaultValue == None:
InfMatch = True
else:
if InfDefaultValue.strip()[0:2].upper() == '0X':
InfDefaultValueNumber = int(InfDefaultValue.strip(), 16)
else:
InfDefaultValueNumber = int(InfDefaultValue.strip())
InfMatch = (InfDefaultValueNumber == ModulePcdDefaultValueNumber)
if DscDefaultValue == None:
DscMatch = True
else:
if DscDefaultValue.strip()[0:2].upper() == '0X':
DscDefaultValueNumber = int(DscDefaultValue.strip(), 16)
else:
DscDefaultValueNumber = int(DscDefaultValue.strip())
DscMatch = (DscDefaultValueNumber == ModulePcdDefaultValueNumber)
else:
if DecDefaultValue == None:
DecMatch = True
else:
DecMatch = (DecDefaultValue == ModulePcd.DefaultValue)
if InfDefaultValue == None:
InfMatch = True
else:
InfMatch = (InfDefaultValue == ModulePcd.DefaultValue)
if DscDefaultValue == None:
DscMatch = True
else:
DscMatch = (DscDefaultValue == ModulePcd.DefaultValue)
if DecMatch and InfMatch:
Fd.write (' %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
else:
if DscMatch and DscModuleOverrideDefaultValue == None:
if (Pcd.TokenCName, Key) in PcdSet:
Fd.write (' *F %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
else:
Fd.write (' *P %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
else:
Fd.write (' *M %-*s: %6s %10s = %-22s\n' % (MaxLen, Pcd.TokenCName, TypeName, '('+Pcd.DatumType+')', ModulePcd.DefaultValue))
if DscDefaultValue <> None:
Fd.write (' %*s = %s\n' % (MaxLen + 19, 'DSC DEFAULT', DscDefaultValue))
if InfDefaultValue <> None:
Fd.write (' %*s = %s\n' % (MaxLen + 19, 'INF DEFAULT', InfDefaultValue))
if DecDefaultValue <> None and not DecMatch:
Fd.write (' %*s = %s\n' % (MaxLen + 19, 'DEC DEFAULT', DecDefaultValue))
Fd.write ('-------------------------------------------------------------------------------\n')
Fd.write ('LIBRARIES\n')
Fd.write ('-------------------------------------------------------------------------------\n')
for Lib in Pa.Platform.Modules[F].M.DependentLibraryList:
if len(Lib.ConstructorList) > 0:
if len(Lib.DestructorList) > 0:
Fd.write (' *CD')
else:
Fd.write (' *C ')
else:
if len(Lib.DestructorList) > 0:
Fd.write (' *D ')
else:
Fd.write (' ')
Fd.write (' %s\n' % (Lib))
for Depex in Lib.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
Fd.write (' DEPEX = %s\n' % (Depex))
Fd.write ('-------------------------------------------------------------------------------\n')
Fd.write ('MODULE DEPENDENCY EXPRESSION\n')
if len(Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]) == 0:
Fd.write (' NONE\n')
else:
for Depex in Pa.Platform.Modules[F].M.Module.DepexExpression[Pa.Platform.Modules[F].M.Arch, Pa.Platform.Modules[F].M.ModuleType]:
Fd.write (' %s\n' % (Depex))
Fd.write ('-------------------------------------------------------------------------------\n')
Fd.write ('MODULE + LIBRARY DEPENDENCY EXPRESSION\n')
if Pa.Platform.Modules[F].M.ModuleType in Pa.Platform.Modules[F].M.DepexExpressionList:
if Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType] == '':
Fd.write (' NONE\n')
else:
Fd.write (' %s\n' % (Pa.Platform.Modules[F].M.DepexExpressionList[Pa.Platform.Modules[F].M.ModuleType]))
else:
Fd.write (' NONE\n')
Fd.write ('-------------------------------------------------------------------------------\n')
Fd.close()
except:
EdkLogger.error(None, FILE_OPEN_FAILURE, ExtraData=self.ReportFile)
self._BuildDir = None self._BuildDir = None
self._FvDir = None self._FvDir = None
self._MakeFileDir = None self._MakeFileDir = None
@ -647,6 +327,7 @@ class PlatformAutoGen(AutoGen):
self.SourceOverrideDir = None self.SourceOverrideDir = None
self.FdTargetList = self.Workspace.FdTargetList self.FdTargetList = self.Workspace.FdTargetList
self.FvTargetList = self.Workspace.FvTargetList self.FvTargetList = self.Workspace.FvTargetList
self.AllPcdList = []
# flag indicating if the makefile/C-code file has been created or not # flag indicating if the makefile/C-code file has been created or not
self.IsMakeFileCreated = False self.IsMakeFileCreated = False
@ -674,6 +355,8 @@ class PlatformAutoGen(AutoGen):
self._ToolChainFamily = None self._ToolChainFamily = None
self._BuildRuleFamily = None self._BuildRuleFamily = None
self._BuildOption = None # toolcode : option self._BuildOption = None # toolcode : option
self._EdkBuildOption = None # edktoolcode : option
self._EdkIIBuildOption = None # edkiitoolcode : option
self._PackageList = None self._PackageList = None
self._ModuleAutoGenList = None self._ModuleAutoGenList = None
self._LibraryAutoGenList = None self._LibraryAutoGenList = None
@ -779,6 +462,7 @@ class PlatformAutoGen(AutoGen):
% NoDatumTypePcdListString) % NoDatumTypePcdListString)
self._NonDynamicPcdList = self._NonDynaPcdList_ self._NonDynamicPcdList = self._NonDynaPcdList_
self._DynamicPcdList = self._DynaPcdList_ self._DynamicPcdList = self._DynaPcdList_
self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
# #
# Sort dynamic PCD list to: # Sort dynamic PCD list to:
@ -979,12 +663,24 @@ class PlatformAutoGen(AutoGen):
self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain] self._BuildRuleFamily = ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
return self._BuildRuleFamily return self._BuildRuleFamily
## Return the build options specific to this platform ## Return the build options specific for all modules in this platform
def _GetBuildOptions(self): def _GetBuildOptions(self):
if self._BuildOption == None: if self._BuildOption == None:
self._BuildOption = self._ExpandBuildOption(self.Platform.BuildOptions) self._BuildOption = self._ExpandBuildOption(self.Platform.BuildOptions)
return self._BuildOption return self._BuildOption
## Return the build options specific for EDK modules in this platform
def _GetEdkBuildOptions(self):
if self._EdkBuildOption == None:
self._EdkBuildOption = self._ExpandBuildOption(self.Platform.BuildOptions, EDK_NAME)
return self._EdkBuildOption
## Return the build options specific for EDKII modules in this platform
def _GetEdkIIBuildOptions(self):
if self._EdkIIBuildOption == None:
self._EdkIIBuildOption = self._ExpandBuildOption(self.Platform.BuildOptions, EDKII_NAME)
return self._EdkIIBuildOption
## Parse build_rule.txt in $(WORKSPACE)/Conf/build_rule.txt ## Parse build_rule.txt in $(WORKSPACE)/Conf/build_rule.txt
# #
# @retval BuildRule object # @retval BuildRule object
@ -1390,11 +1086,18 @@ class PlatformAutoGen(AutoGen):
# #
# @retval options Options expanded # @retval options Options expanded
# #
def _ExpandBuildOption(self, Options): def _ExpandBuildOption(self, Options, ModuleStyle=None):
BuildOptions = {} BuildOptions = {}
FamilyMatch = False FamilyMatch = False
FamilyIsNull = True FamilyIsNull = True
for Key in Options: for Key in Options:
if ModuleStyle != None and len (Key) > 2:
# Check Module style is EDK or EDKII.
# Only append build option for the matched style module.
if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
continue
elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
continue
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
@ -1422,6 +1125,13 @@ class PlatformAutoGen(AutoGen):
return BuildOptions return BuildOptions
for Key in Options: for Key in Options:
if ModuleStyle != None and len (Key) > 2:
# Check Module style is EDK or EDKII.
# Only append build option for the matched style module.
if ModuleStyle == EDK_NAME and Key[2] != EDK_NAME:
continue
elif ModuleStyle == EDKII_NAME and Key[2] != EDKII_NAME:
continue
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
@ -1451,7 +1161,11 @@ class PlatformAutoGen(AutoGen):
# @retval options The options appended with build options in platform # @retval options The options appended with build options in platform
# #
def ApplyBuildOption(self, Module): def ApplyBuildOption(self, Module):
PlatformOptions = self.BuildOption # Get the different options for the different style module
if Module.AutoGenVersion < 0x00010005:
PlatformOptions = self.EdkBuildOption
else:
PlatformOptions = self.EdkIIBuildOption
ModuleOptions = self._ExpandBuildOption(Module.BuildOptions) ModuleOptions = self._ExpandBuildOption(Module.BuildOptions)
if Module in self.Platform.Modules: if Module in self.Platform.Modules:
PlatformModule = self.Platform.Modules[str(Module)] PlatformModule = self.Platform.Modules[str(Module)]
@ -1499,6 +1213,8 @@ class PlatformAutoGen(AutoGen):
ToolChainFamily = property(_GetToolChainFamily) ToolChainFamily = property(_GetToolChainFamily)
BuildRuleFamily = property(_GetBuildRuleFamily) BuildRuleFamily = property(_GetBuildRuleFamily)
BuildOption = property(_GetBuildOptions) # toolcode : option BuildOption = property(_GetBuildOptions) # toolcode : option
EdkBuildOption = property(_GetEdkBuildOptions) # edktoolcode : option
EdkIIBuildOption = property(_GetEdkIIBuildOptions) # edkiitoolcode : option
BuildCommand = property(_GetBuildCommand) BuildCommand = property(_GetBuildCommand)
BuildRule = property(_GetBuildRule) BuildRule = property(_GetBuildRule)

View File

@ -1,7 +1,7 @@
## @file ## @file
# Routines for generating AutoGen.h and AutoGen.c # Routines for generating AutoGen.h and AutoGen.c
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -162,7 +162,7 @@ ${END}
GUID GuidTable[${PHASE}_GUID_TABLE_SIZE]; GUID GuidTable[${PHASE}_GUID_TABLE_SIZE];
${BEGIN} STRING_HEAD ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}]; ${BEGIN} STRING_HEAD ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}];
${END} ${END}
${BEGIN} VARIABLE_HEAD ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}[${VARIABLE_HEAD_NUMSKUS_DECL}]; ${BEGIN} VARIABLE_HEAD ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}];
${END} ${END}
${BEGIN} UINT8 StringTable${STRING_TABLE_INDEX}[${STRING_TABLE_LENGTH}]; /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */ ${BEGIN} UINT8 StringTable${STRING_TABLE_INDEX}[${STRING_TABLE_LENGTH}]; /* ${STRING_TABLE_CNAME}_${STRING_TABLE_GUID} */
${END} ${END}
@ -253,7 +253,7 @@ ${END}
}, },
/* LocalTokenNumberTable */ /* LocalTokenNumberTable */
{ {
${BEGIN} offsetof(${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}) | ${TOKEN_TYPE}, ${BEGIN} offsetof(${PHASE}_PCD_DATABASE, ${TOKEN_INIT}.${TOKEN_CNAME}_${TOKEN_GUID}${VARDEF_HEADER}) | ${TOKEN_TYPE},
${END} ${END}
}, },
/* GuidTable */ /* GuidTable */
@ -263,7 +263,7 @@ ${END}
}, },
${BEGIN} { ${STRING_HEAD_VALUE} }, /* ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] */ ${BEGIN} { ${STRING_HEAD_VALUE} }, /* ${STRING_HEAD_CNAME_DECL}_${STRING_HEAD_GUID_DECL}[${STRING_HEAD_NUMSKUS_DECL}] */
${END} ${END}
${BEGIN} /* ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}[${VARIABLE_HEAD_NUMSKUS_DECL}] */ ${BEGIN} /* ${VARIABLE_HEAD_CNAME_DECL}_${VARIABLE_HEAD_GUID_DECL}_Variable_Header[${VARIABLE_HEAD_NUMSKUS_DECL}] */
{ {
${VARIABLE_HEAD_VALUE} ${VARIABLE_HEAD_VALUE}
}, },
@ -453,7 +453,7 @@ ${END}
gSmmCoreEntryPointString = TemplateString(""" gSmmCoreEntryPointString = TemplateString("""
${BEGIN} ${BEGIN}
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
EFI_STATUS EFI_STATUS
@ -482,7 +482,7 @@ ${END}
gDxeSmmEntryPointString = [ gDxeSmmEntryPointString = [
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
EFI_STATUS EFI_STATUS
@ -497,11 +497,11 @@ ProcessModuleEntryPointList (
} }
"""), """),
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
static BASE_LIBRARY_JUMP_BUFFER mJumpContext; static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR; static EFI_STATUS mDriverEntryPointStatus;
VOID VOID
EFIAPI EFIAPI
@ -522,8 +522,9 @@ ProcessModuleEntryPointList (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
mDriverEntryPointStatus = EFI_LOAD_ERROR;
${BEGIN} ${BEGIN}
if (SetJump (&mJumpContext) == 0) { if (SetJump (&mJumpContext) == 0) {
ExitDriver (${Function} (ImageHandle, SystemTable)); ExitDriver (${Function} (ImageHandle, SystemTable));
@ -550,7 +551,7 @@ ${END}
gUefiDriverEntryPointString = [ gUefiDriverEntryPointString = [
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
EFI_STATUS EFI_STATUS
@ -564,7 +565,7 @@ ProcessModuleEntryPointList (
} }
"""), """),
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
${BEGIN} ${BEGIN}
@ -592,17 +593,20 @@ ExitDriver (
} }
"""), """),
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
const UINT32 _gDxeRevision = ${PiSpecVersion}; const UINT32 _gDxeRevision = ${PiSpecVersion};
static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
static EFI_STATUS mDriverEntryPointStatus;
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
ProcessModuleEntryPointList ( ProcessModuleEntryPointList (
IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable IN EFI_SYSTEM_TABLE *SystemTable
) )
{ {
mDriverEntryPointStatus = EFI_LOAD_ERROR;
${BEGIN} ${BEGIN}
if (SetJump (&mJumpContext) == 0) { if (SetJump (&mJumpContext) == 0) {
ExitDriver (${Function} (ImageHandle, SystemTable)); ExitDriver (${Function} (ImageHandle, SystemTable));
@ -612,9 +616,6 @@ ProcessModuleEntryPointList (
return mDriverEntryPointStatus; return mDriverEntryPointStatus;
} }
static BASE_LIBRARY_JUMP_BUFFER mJumpContext;
static EFI_STATUS mDriverEntryPointStatus = EFI_LOAD_ERROR;
VOID VOID
EFIAPI EFIAPI
ExitDriver ( ExitDriver (
@ -645,7 +646,7 @@ ${END}
gUefiApplicationEntryPointString = [ gUefiApplicationEntryPointString = [
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -658,7 +659,7 @@ ProcessModuleEntryPointList (
} }
"""), """),
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
${BEGIN} ${BEGIN}
EFI_STATUS EFI_STATUS
@ -685,7 +686,7 @@ ExitDriver (
} }
"""), """),
TemplateString(""" TemplateString("""
const UINT32 _gUefiDriverRevision = ${EfiSpecVersion}; const UINT32 _gUefiDriverRevision = ${UefiSpecVersion};
EFI_STATUS EFI_STATUS
EFIAPI EFIAPI
@ -876,13 +877,6 @@ ${FunctionCall}${END}
"""), """),
} }
gSpecificationString = TemplateString("""
${BEGIN}
#undef ${SpecificationName}
#define ${SpecificationName} ${SpecificationValue}
${END}
""")
gBasicHeaderFile = "Base.h" gBasicHeaderFile = "Base.h"
gModuleTypeHeaderFile = { gModuleTypeHeaderFile = {
@ -961,9 +955,55 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
Array = '' Array = ''
Value = Pcd.DefaultValue Value = Pcd.DefaultValue
Unicode = False Unicode = False
ValueNumber = 0
if Pcd.DatumType in ['UINT64', 'UINT32', 'UINT16', 'UINT8']:
try:
if Value.upper().startswith('0X'):
ValueNumber = int (Value, 16)
else:
ValueNumber = int (Value)
except:
EdkLogger.error("build", AUTOGEN_ERROR,
"PCD value is not valid dec or hex number for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
if Pcd.DatumType == 'UINT64': if Pcd.DatumType == 'UINT64':
if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR,
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif ValueNumber >= 0x10000000000000000:
EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
if not Value.endswith('ULL'): if not Value.endswith('ULL'):
Value += 'ULL' Value += 'ULL'
elif Pcd.DatumType == 'UINT32':
if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR,
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif ValueNumber >= 0x100000000:
EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif Pcd.DatumType == 'UINT16':
if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR,
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif ValueNumber >= 0x10000:
EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif Pcd.DatumType == 'UINT8':
if ValueNumber < 0:
EdkLogger.error("build", AUTOGEN_ERROR,
"PCD can't be set to negative value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
elif ValueNumber >= 0x100:
EdkLogger.error("build", AUTOGEN_ERROR,
"Too large PCD value for datum type [%s] of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, Pcd.TokenCName),
ExtraData="[%s]" % str(Info))
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '': if Pcd.MaxDatumSize == None or Pcd.MaxDatumSize == '':
EdkLogger.error("build", AUTOGEN_ERROR, EdkLogger.error("build", AUTOGEN_ERROR,
@ -1021,7 +1061,7 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName)) AutoGenH.Append('#define %s %s%s\n' %(GetModeName, Type, PcdVariableName))
elif Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE: elif Pcd.Type == TAB_PCDS_PATCHABLE_IN_MODULE:
AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value)) AutoGenH.Append('#define %s %s\n' %(PcdValueName, Value))
AutoGenC.Append('GLOBAL_REMOVE_IF_UNREFERENCED volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName)) AutoGenC.Append('volatile %s %s %s = %s;\n' %(Const, Pcd.DatumType, PcdVariableName, PcdValueName))
AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array)) AutoGenH.Append('extern volatile %s %s %s%s;\n' % (Const, Pcd.DatumType, PcdVariableName, Array))
AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName)) AutoGenH.Append('#define %s %s%s\n' % (GetModeName, Type, PcdVariableName))
else: else:
@ -1139,7 +1179,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
'SYSTEM_SKU_ID_VALUE' : '0' 'SYSTEM_SKU_ID_VALUE' : '0'
} }
for DatumType in ['UINT64','UINT32','UINT16','UINT8','BOOLEAN']: for DatumType in ['UINT64','UINT32','UINT16','UINT8','BOOLEAN', "VOID*"]:
Dict['VARDEF_CNAME_' + DatumType] = [] Dict['VARDEF_CNAME_' + DatumType] = []
Dict['VARDEF_GUID_' + DatumType] = [] Dict['VARDEF_GUID_' + DatumType] = []
Dict['VARDEF_SKUID_' + DatumType] = [] Dict['VARDEF_SKUID_' + DatumType] = []
@ -1174,7 +1214,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
Dict['GUID_STRUCTURE'] = [] Dict['GUID_STRUCTURE'] = []
Dict['SKUID_VALUE'] = [] Dict['SKUID_VALUE'] = []
Dict['VARDEF_HEADER'] = []
if Phase == 'DXE': if Phase == 'DXE':
Dict['SYSTEM_SKU_ID'] = '' Dict['SYSTEM_SKU_ID'] = ''
Dict['SYSTEM_SKU_ID_VALUE'] = '' Dict['SYSTEM_SKU_ID_VALUE'] = ''
@ -1223,7 +1263,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
Pcd.InitString = 'UNINIT' Pcd.InitString = 'UNINIT'
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_POINTER'] Pcd.TokenTypeList = ['PCD_TYPE_STRING']
elif Pcd.DatumType == 'BOOLEAN': elif Pcd.DatumType == 'BOOLEAN':
Pcd.TokenTypeList = ['PCD_DATUM_TYPE_UINT8'] Pcd.TokenTypeList = ['PCD_DATUM_TYPE_UINT8']
else: else:
@ -1270,21 +1310,32 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
Dict['GUID_STRUCTURE'].append(VariableGuidStructure) Dict['GUID_STRUCTURE'].append(VariableGuidStructure)
VariableHeadGuidIndex = GuidList.index(VariableGuid) VariableHeadGuidIndex = GuidList.index(VariableGuid)
if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
VariableHeadValueList.append('%d, %d, %s, offsetof(%s_PCD_DATABASE, Init.%s_%s)' %
(VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset,
Phase, CName, TokenSpaceGuid))
else:
VariableHeadValueList.append('%d, %d, %s, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s)' % VariableHeadValueList.append('%d, %d, %s, offsetof(%s_PCD_DATABASE, Init.%s_%s_VariableDefault_%s)' %
(VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset, (VariableHeadGuidIndex, VariableHeadStringIndex, Sku.VariableOffset,
Phase, CName, TokenSpaceGuid, SkuIdIndex)) Phase, CName, TokenSpaceGuid, SkuIdIndex))
Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName) Dict['VARDEF_CNAME_'+Pcd.DatumType].append(CName)
Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid) Dict['VARDEF_GUID_'+Pcd.DatumType].append(TokenSpaceGuid)
Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex) Dict['VARDEF_SKUID_'+Pcd.DatumType].append(SkuIdIndex)
if "PCD_TYPE_STRING" in Pcd.TokenTypeList:
Dict['VARDEF_VALUE_' + Pcd.DatumType].append("%s_%s[%d]" % (Pcd.TokenCName, TokenSpaceGuid, SkuIdIndex))
else:
Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue) Dict['VARDEF_VALUE_'+Pcd.DatumType].append(Sku.HiiDefaultValue)
elif Sku.VpdOffset != '': elif Sku.VpdOffset != '':
Pcd.TokenTypeList += ['PCD_TYPE_VPD'] Pcd.TokenTypeList += ['PCD_TYPE_VPD']
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
VpdHeadOffsetList.append(Sku.VpdOffset) VpdHeadOffsetList.append(Sku.VpdOffset)
else:
if Pcd.DatumType == 'VOID*': if Pcd.DatumType == 'VOID*':
Pcd.TokenTypeList += ['PCD_TYPE_STRING'] Pcd.TokenTypeList += ['PCD_TYPE_STRING']
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
if Sku.HiiDefaultValue != '' and Sku.DefaultValue == '':
Sku.DefaultValue = Sku.HiiDefaultValue
if Sku.DefaultValue != '': if Sku.DefaultValue != '':
NumberOfSizeItems += 1 NumberOfSizeItems += 1
Dict['STRING_TABLE_CNAME'].append(CName) Dict['STRING_TABLE_CNAME'].append(CName)
@ -1317,6 +1368,7 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
StringTableIndex += 1 StringTableIndex += 1
StringTableSize += (Size) StringTableSize += (Size)
else: else:
if "PCD_TYPE_HII" not in Pcd.TokenTypeList:
Pcd.TokenTypeList += ['PCD_TYPE_DATA'] Pcd.TokenTypeList += ['PCD_TYPE_DATA']
if Sku.DefaultValue == 'TRUE': if Sku.DefaultValue == 'TRUE':
Pcd.InitString = 'INIT' Pcd.InitString = 'INIT'
@ -1338,11 +1390,15 @@ def CreatePcdDatabasePhaseSpecificAutoGen (Platform, Phase):
Pcd.TokenTypeList = list(set(Pcd.TokenTypeList)) Pcd.TokenTypeList = list(set(Pcd.TokenTypeList))
if 'PCD_TYPE_HII' in Pcd.TokenTypeList: if 'PCD_TYPE_HII' in Pcd.TokenTypeList:
Dict['VARIABLE_HEAD_CNAME_DECL'].append(CName) Dict['VARIABLE_HEAD_CNAME_DECL'].append(CName)
Dict['VARIABLE_HEAD_GUID_DECL'].append(TokenSpaceGuid) Dict['VARIABLE_HEAD_GUID_DECL'].append(TokenSpaceGuid)
Dict['VARIABLE_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList)) Dict['VARIABLE_HEAD_NUMSKUS_DECL'].append(len(Pcd.SkuInfoList))
Dict['VARIABLE_HEAD_VALUE'].append('{ %s }\n' % ' },\n { '.join(VariableHeadValueList)) Dict['VARIABLE_HEAD_VALUE'].append('{ %s }\n' % ' },\n { '.join(VariableHeadValueList))
Dict['VARDEF_HEADER'].append('_Variable_Header')
else:
Dict['VARDEF_HEADER'].append('')
if 'PCD_TYPE_VPD' in Pcd.TokenTypeList: if 'PCD_TYPE_VPD' in Pcd.TokenTypeList:
Dict['VPD_HEAD_CNAME_DECL'].append(CName) Dict['VPD_HEAD_CNAME_DECL'].append(CName)
Dict['VPD_HEAD_GUID_DECL'].append(TokenSpaceGuid) Dict['VPD_HEAD_GUID_DECL'].append(TokenSpaceGuid)
@ -1614,14 +1670,14 @@ def CreateModuleEntryPointCode(Info, AutoGenC, AutoGenH):
PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION'] PiSpecVersion = Info.Module.Specification['PI_SPECIFICATION_VERSION']
else: else:
PiSpecVersion = 0 PiSpecVersion = 0
if 'EFI_SPECIFICATION_VERSION' in Info.Module.Specification: if 'UEFI_SPECIFICATION_VERSION' in Info.Module.Specification:
EfiSpecVersion = Info.Module.Specification['EFI_SPECIFICATION_VERSION'] UefiSpecVersion = Info.Module.Specification['UEFI_SPECIFICATION_VERSION']
else: else:
EfiSpecVersion = 0 UefiSpecVersion = 0
Dict = { Dict = {
'Function' : Info.Module.ModuleEntryPointList, 'Function' : Info.Module.ModuleEntryPointList,
'PiSpecVersion' : PiSpecVersion, 'PiSpecVersion' : PiSpecVersion,
'EfiSpecVersion': EfiSpecVersion 'UefiSpecVersion': UefiSpecVersion
} }
if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']: if Info.ModuleType in ['PEI_CORE', 'DXE_CORE', 'SMM_CORE']:
@ -1853,9 +1909,6 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH):
# header file Prologue # header file Prologue
AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-','_')})) AutoGenH.Append(gAutoGenHPrologueString.Replace({'File':'AUTOGENH','Guid':Info.Guid.replace('-','_')}))
if Info.AutoGenVersion >= 0x00010005: if Info.AutoGenVersion >= 0x00010005:
# specification macros
AutoGenH.Append(gSpecificationString.Replace({'SpecificationName':Info.Specification.keys(),
'SpecificationValue':Info.Specification.values()}))
# header files includes # header files includes
AutoGenH.Append("#include <%s>\n" % gBasicHeaderFile) AutoGenH.Append("#include <%s>\n" % gBasicHeaderFile)
if Info.ModuleType in gModuleTypeHeaderFile \ if Info.ModuleType in gModuleTypeHeaderFile \

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to generate DEPEX file for module's dependency expression # This file is used to generate DEPEX file for module's dependency expression
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -356,7 +356,7 @@ class DependencyExpression:
versionNumber = "0.04" versionNumber = "0.04"
__version__ = "%prog Version " + versionNumber __version__ = "%prog Version " + versionNumber
__copyright__ = "Copyright (c) 2007-2008, Intel Corporation All rights reserved." __copyright__ = "Copyright (c) 2007-2010, Intel Corporation All rights reserved."
__usage__ = "%prog [options] [dependency_expression_file]" __usage__ = "%prog [options] [dependency_expression_file]"
## Parse command line options ## Parse command line options

View File

@ -406,16 +406,8 @@ class UniFileClassObject(object):
# #
# Load multiple .uni files # Load multiple .uni files
# #
def LoadUniFiles(self, FileList = []): def LoadUniFiles(self, FileList):
if len(FileList) > 0: if len(FileList) > 0:
if len(FileList) > 1:
NewList = [];
for File in FileList:
NewList.append (File)
NewList.sort()
for File in NewList:
self.LoadUniFile(File)
else:
for File in FileList: for File in FileList:
self.LoadUniFile(File) self.LoadUniFile(File)
@ -488,7 +480,6 @@ class UniFileClassObject(object):
EdkLogger.debug(EdkLogger.DEBUG_5, Name) EdkLogger.debug(EdkLogger.DEBUG_5, Name)
Token = len(self.OrderedStringList[LangFind]) Token = len(self.OrderedStringList[LangFind])
self.AddStringToList(Name, LangFind, Value, Token, Referenced, LangKey, Index) self.AddStringToList(Name, LangFind, Value, Token, Referenced, LangKey, Index)
# #
# Retoken # Retoken
# #
@ -497,7 +488,17 @@ class UniFileClassObject(object):
ReferencedStringList = [] ReferencedStringList = []
NotReferencedStringList = [] NotReferencedStringList = []
Token = 0 Token = 0
#
# Order UNI token by their String Name
#
StringNameList = []
for Item in self.OrderedStringList[LangName]: for Item in self.OrderedStringList[LangName]:
StringNameList.append (Item.StringName)
StringNameList.sort()
for Name in StringNameList:
Item = self.FindStringValue (Name, LangName)
if Item.Referenced == True: if Item.Referenced == True:
Item.Token = Token Item.Token = Token
ReferencedStringList.append(Item) ReferencedStringList.append(Item)

View File

@ -1,4 +1,10 @@
# Copyright (c) 2007, Intel Corporation ## @file
# Python 'AutoGen' package initialization file.
#
# This file is required to make Python interpreter treat the directory
# as containing package.
#
# Copyright (c) 2007 - 2010, Intel Corporation<BR>
# 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
@ -6,5 +12,6 @@
# #
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
__all__ = ["AutoGen"] __all__ = ["AutoGen"]

View File

@ -84,7 +84,7 @@ UNKNOWN_ERROR = 0xFFFF
## Error message of each error code ## Error message of each error code
gErrorMessage = { gErrorMessage = {
FILE_NOT_FOUND : "File/directory not found", FILE_NOT_FOUND : "File/directory not found in workspace",
FILE_OPEN_FAILURE : "File open failure", FILE_OPEN_FAILURE : "File open failure",
FILE_WRITE_FAILURE : "File write failure", FILE_WRITE_FAILURE : "File write failure",
FILE_PARSE_FAILURE : "File parse failure", FILE_PARSE_FAILURE : "File parse failure",

View File

@ -73,6 +73,8 @@ EDK_COMPONENT_TYPE_BS_DRIVER = 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER' EDK_COMPONENT_TYPE_RT_DRIVER = 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER' EDK_COMPONENT_TYPE_SAL_RT_DRIVER = 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION' EDK_COMPONENT_TYPE_APPLICATION = 'APPLICATION'
EDK_NAME = 'EDK'
EDKII_NAME = 'EDKII'
BINARY_FILE_TYPE_FW = 'FW' BINARY_FILE_TYPE_FW = 'FW'
BINARY_FILE_TYPE_GUID = 'GUID' BINARY_FILE_TYPE_GUID = 'GUID'
@ -230,6 +232,19 @@ TAB_PCDS_DYNAMIC_EBC = TAB_PCDS + TAB_PCDS_DYNAMIC + TAB_SPLIT + TAB_ARCH_EBC
TAB_PCD_DYNAMIC_TYPE_LIST = [TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYNAMIC_VPD_NULL, TAB_PCDS_DYNAMIC_HII_NULL] TAB_PCD_DYNAMIC_TYPE_LIST = [TAB_PCDS_DYNAMIC_DEFAULT_NULL, TAB_PCDS_DYNAMIC_VPD_NULL, TAB_PCDS_DYNAMIC_HII_NULL]
TAB_PCD_DYNAMIC_EX_TYPE_LIST = [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PCDS_DYNAMIC_EX_VPD_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL] TAB_PCD_DYNAMIC_EX_TYPE_LIST = [TAB_PCDS_DYNAMIC_EX_DEFAULT_NULL, TAB_PCDS_DYNAMIC_EX_VPD_NULL, TAB_PCDS_DYNAMIC_EX_HII_NULL]
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE = 'PcdLoadFixAddressPeiCodePageNumber'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE_DATA_TYPE = 'UINT32'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE = 'PcdLoadFixAddressBootTimeCodePageNumber'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE_DATA_TYPE = 'UINT32'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE = 'PcdLoadFixAddressRuntimeCodePageNumber'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE_DATA_TYPE = 'UINT32'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE = 'PcdLoadFixAddressSmmCodePageNumber'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE_DATA_TYPE = 'UINT32'
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_LIST = [TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_PEI_PAGE_SIZE, \
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_DXE_PAGE_SIZE, \
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_RUNTIME_PAGE_SIZE, \
TAB_PCDS_PATCHABLE_LOAD_FIX_ADDRESS_SMM_PAGE_SIZE]
TAB_DEPEX = 'Depex' TAB_DEPEX = 'Depex'
TAB_DEPEX_COMMON = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_COMMON TAB_DEPEX_COMMON = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_COMMON
TAB_DEPEX_IA32 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IA32 TAB_DEPEX_IA32 = TAB_DEPEX + TAB_SPLIT + TAB_ARCH_IA32
@ -338,6 +353,7 @@ TAB_DSC_DEFINES_MAKEFILE_NAME = 'MAKEFILE_NAME'
TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress' TAB_DSC_DEFINES_BS_BASE_ADDRESS = 'BsBaseAddress'
TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress' TAB_DSC_DEFINES_RT_BASE_ADDRESS = 'RtBaseAddress'
TAB_DSC_DEFINES_DEFINE = 'DEFINE' TAB_DSC_DEFINES_DEFINE = 'DEFINE'
TAB_FIX_LOAD_TOP_MEMORY_ADDRESS = 'FIX_LOAD_TOP_MEMORY_ADDRESS'
# #
# TargetTxt Definitions # TargetTxt Definitions

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define each component of the build database # This file is used to define each component of the build database
# #
# Copyright (c) 2007 ~ 2008, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -748,7 +748,8 @@ class WorkspaceBuild(object):
# #
Pb.Specification = ModuleHeader.Specification Pb.Specification = ModuleHeader.Specification
Pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = ModuleHeader.EdkReleaseVersion Pb.Specification[TAB_INF_DEFINES_EDK_RELEASE_VERSION] = ModuleHeader.EdkReleaseVersion
Pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = ModuleHeader.EfiSpecificationVersion Pb.Specification[TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION] = ModuleHeader.UefiSpecificationVersion
Pb.Specification[TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION] = ModuleHeader.UefiSpecificationVersion
Pb.AutoGenVersion = int(ModuleHeader.InfVersion, 0) Pb.AutoGenVersion = int(ModuleHeader.InfVersion, 0)
# #

View File

@ -1439,10 +1439,17 @@ class FdfParser(object):
def __GetBlockStatements(self, Obj): def __GetBlockStatements(self, Obj):
if not self.__GetBlockStatement(Obj): if not self.__GetBlockStatement(Obj):
raise Warning("expected block statement At Line ", self.FileName, self.CurrentLineNumber) #set default block size is 1
Obj.BlockSizeList.append((1, Obj.Size, None))
return True
while self.__GetBlockStatement(Obj): while self.__GetBlockStatement(Obj):
pass pass
for Item in Obj.BlockSizeList:
if Item[0] == None or Item[1] == None:
raise Warning("expected block statement for Fd Section", self.FileName, self.CurrentLineNumber)
return True return True
## __GetBlockStatement() method ## __GetBlockStatement() method
@ -2329,6 +2336,8 @@ class FdfParser(object):
AlignValue = None AlignValue = None
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token AlignValue = self.__Token
BuildNum = None BuildNum = None
@ -2342,6 +2351,8 @@ class FdfParser(object):
BuildNum = self.__Token BuildNum = self.__Token
if self.__IsKeyword( "VERSION"): if self.__IsKeyword( "VERSION"):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken(): if not self.__GetNextToken():
@ -2356,6 +2367,8 @@ class FdfParser(object):
Obj.SectionList.append(VerSectionObj) Obj.SectionList.append(VerSectionObj)
elif self.__IsKeyword( "UI"): elif self.__IsKeyword( "UI"):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextToken(): if not self.__GetNextToken():
@ -2369,6 +2382,8 @@ class FdfParser(object):
Obj.SectionList.append(UiSectionObj) Obj.SectionList.append(UiSectionObj)
elif self.__IsKeyword( "FV_IMAGE"): elif self.__IsKeyword( "FV_IMAGE"):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
if not self.__IsToken( "="): if not self.__IsToken( "="):
raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected '=' At Line ", self.FileName, self.CurrentLineNumber)
if not self.__GetNextWord(): if not self.__GetNextWord():
@ -2409,6 +2424,8 @@ class FdfParser(object):
Obj.SectionList.append(FvImageSectionObj) Obj.SectionList.append(FvImageSectionObj)
elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"): elif self.__IsKeyword("PEI_DEPEX_EXP") or self.__IsKeyword("DXE_DEPEX_EXP") or self.__IsKeyword("SMM_DEPEX_EXP"):
if AlignValue == 'Auto':
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
DepexSectionObj = CommonDataClass.FdfClass.DepexSectionClassObject() DepexSectionObj = CommonDataClass.FdfClass.DepexSectionClassObject()
DepexSectionObj.Alignment = AlignValue DepexSectionObj.Alignment = AlignValue
DepexSectionObj.DepexType = self.__Token DepexSectionObj.DepexType = self.__Token
@ -2436,6 +2453,8 @@ class FdfParser(object):
if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\ if self.__Token not in ("COMPAT16", "PE32", "PIC", "TE", "FV_IMAGE", "RAW", "DXE_DEPEX",\
"UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_DEPEX"): "UI", "VERSION", "PEI_DEPEX", "SUBTYPE_GUID", "SMM_DEPEX"):
raise Warning("Unknown section type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) raise Warning("Unknown section type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if AlignValue == 'Auto'and (not self.__Token == 'PE32') and (not self.__Token == 'TE'):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
# DataSection # DataSection
DataSectionObj = CommonDataClass.FdfClass.DataSectionClassObject() DataSectionObj = CommonDataClass.FdfClass.DataSectionClassObject()
DataSectionObj.Alignment = AlignValue DataSectionObj.Alignment = AlignValue
@ -2585,6 +2604,8 @@ class FdfParser(object):
AlignValue = None AlignValue = None
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token AlignValue = self.__Token
if not self.__GetCglSection(FfsFileObj, AlignValue): if not self.__GetCglSection(FfsFileObj, AlignValue):
@ -2899,7 +2920,7 @@ class FdfParser(object):
AlignValue = "" AlignValue = ""
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token AlignValue = self.__Token
@ -2963,8 +2984,10 @@ class FdfParser(object):
CheckSum = True CheckSum = True
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
AlignValue = self.__Token AlignValue = self.__Token
if not self.__GetNextToken(): if not self.__GetNextToken():
@ -3034,14 +3057,6 @@ class FdfParser(object):
raise Warning("expected 'FV' At Line ", self.FileName, self.CurrentLineNumber) raise Warning("expected 'FV' At Line ", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.FvFileType = self.__Token FvImageSectionObj.FvFileType = self.__Token
if self.__GetAlignment():
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
FvImageSectionObj.Alignment = self.__Token
if self.__IsKeyword("FV"):
FvImageSectionObj.FvFileType = self.__Token
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber)
@ -3110,6 +3125,10 @@ class FdfParser(object):
EfiSectionObj.BuildNum = self.__Token EfiSectionObj.BuildNum = self.__Token
if self.__GetAlignment(): if self.__GetAlignment():
if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"):
raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber)
if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'):
raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber)
EfiSectionObj.Alignment = self.__Token EfiSectionObj.Alignment = self.__Token
if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword('RELOCS_RETAINED'): if self.__IsKeyword('RELOCS_STRIPPED') or self.__IsKeyword('RELOCS_RETAINED'):

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define each component of INF file # This file is used to define each component of INF file
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -85,7 +85,8 @@ class InfHeader(ModuleHeaderClass):
TAB_INF_DEFINES_BASE_NAME : "Name", TAB_INF_DEFINES_BASE_NAME : "Name",
TAB_INF_DEFINES_FILE_GUID : "Guid", TAB_INF_DEFINES_FILE_GUID : "Guid",
TAB_INF_DEFINES_MODULE_TYPE : "ModuleType", TAB_INF_DEFINES_MODULE_TYPE : "ModuleType",
TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "EfiSpecificationVersion", TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion", TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion",
# #
# Optional Fields # Optional Fields
@ -452,7 +453,7 @@ class Inf(InfObject):
print 'Guid =', M.Header[Arch].Guid print 'Guid =', M.Header[Arch].Guid
print 'Version =', M.Header[Arch].Version print 'Version =', M.Header[Arch].Version
print 'InfVersion =', M.Header[Arch].InfVersion print 'InfVersion =', M.Header[Arch].InfVersion
print 'EfiSpecificationVersion =', M.Header[Arch].EfiSpecificationVersion print 'UefiSpecificationVersion =', M.Header[Arch].UefiSpecificationVersion
print 'EdkReleaseVersion =', M.Header[Arch].EdkReleaseVersion print 'EdkReleaseVersion =', M.Header[Arch].EdkReleaseVersion
print 'ModuleType =', M.Header[Arch].ModuleType print 'ModuleType =', M.Header[Arch].ModuleType
print 'BinaryModule =', M.Header[Arch].BinaryModule print 'BinaryModule =', M.Header[Arch].BinaryModule

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define each component of INF file # This file is used to define each component of INF file
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -71,7 +71,8 @@ class InfHeader(ModuleHeaderClass):
TAB_INF_DEFINES_BASE_NAME : "Name", TAB_INF_DEFINES_BASE_NAME : "Name",
TAB_INF_DEFINES_FILE_GUID : "Guid", TAB_INF_DEFINES_FILE_GUID : "Guid",
TAB_INF_DEFINES_MODULE_TYPE : "ModuleType", TAB_INF_DEFINES_MODULE_TYPE : "ModuleType",
TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "EfiSpecificationVersion", TAB_INF_DEFINES_EFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION : "UefiSpecificationVersion",
TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion", TAB_INF_DEFINES_EDK_RELEASE_VERSION : "EdkReleaseVersion",
# Optional Fields # Optional Fields
@ -583,7 +584,7 @@ class Inf(InfObject):
ModuleHeader.PcdIsDriver = Value ModuleHeader.PcdIsDriver = Value
elif Name == TAB_INF_DEFINES_MODULE_TYPE: elif Name == TAB_INF_DEFINES_MODULE_TYPE:
ModuleHeader.ModuleType = Value ModuleHeader.ModuleType = Value
elif Name == TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION: elif Name in (TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION, TAB_INF_DEFINES_UEFI_SPECIFICATION_VERSION):
ModuleHeader.UefiSpecificationVersion = Value ModuleHeader.UefiSpecificationVersion = Value
elif Name == TAB_INF_DEFINES_PI_SPECIFICATION_VERSION: elif Name == TAB_INF_DEFINES_PI_SPECIFICATION_VERSION:
ModuleHeader.PiSpecificationVersion = Value ModuleHeader.PiSpecificationVersion = Value

View File

@ -22,6 +22,7 @@ import threading
import time import time
import re import re
import cPickle import cPickle
import array
from UserDict import IterableUserDict from UserDict import IterableUserDict
from UserList import UserList from UserList import UserList
@ -1343,6 +1344,90 @@ class PathClass(object):
Key = property(_GetFileKey) Key = property(_GetFileKey)
## Parse PE image to get the required PE informaion.
#
class PeImageClass():
## Constructor
#
# @param File FilePath of PeImage
#
def __init__(self, PeFile):
self.FileName = PeFile
self.IsValid = False
self.Size = 0
self.EntryPoint = 0
self.SectionAlignment = 0
self.SectionHeaderList = []
self.ErrorInfo = ''
try:
PeObject = open(PeFile, 'rb')
except:
self.ErrorInfo = self.FileName + ' can not be found\n'
return
# Read DOS header
ByteArray = array.array('B')
ByteArray.fromfile(PeObject, 0x3E)
ByteList = ByteArray.tolist()
# DOS signature should be 'MZ'
if self._ByteListToStr (ByteList[0x0:0x2]) != 'MZ':
self.ErrorInfo = self.FileName + ' has no valid DOS signature MZ'
return
# Read 4 byte PE Signature
PeOffset = self._ByteListToInt(ByteList[0x3C:0x3E])
PeObject.seek(PeOffset)
ByteArray = array.array('B')
ByteArray.fromfile(PeObject, 4)
# PE signature should be 'PE\0\0'
if ByteArray.tostring() != 'PE\0\0':
self.ErrorInfo = self.FileName + ' has no valid PE signature PE00'
return
# Read PE file header
ByteArray = array.array('B')
ByteArray.fromfile(PeObject, 0x14)
ByteList = ByteArray.tolist()
SecNumber = self._ByteListToInt(ByteList[0x2:0x4])
if SecNumber == 0:
self.ErrorInfo = self.FileName + ' has no section header'
return
# Read PE optional header
OptionalHeaderSize = self._ByteListToInt(ByteArray[0x10:0x12])
ByteArray = array.array('B')
ByteArray.fromfile(PeObject, OptionalHeaderSize)
ByteList = ByteArray.tolist()
self.EntryPoint = self._ByteListToInt(ByteList[0x10:0x14])
self.SectionAlignment = self._ByteListToInt(ByteList[0x20:0x24])
self.Size = self._ByteListToInt(ByteList[0x38:0x3C])
# Read each Section Header
for Index in range(SecNumber):
ByteArray = array.array('B')
ByteArray.fromfile(PeObject, 0x28)
ByteList = ByteArray.tolist()
SecName = self._ByteListToStr(ByteList[0:8])
SecVirtualSize = self._ByteListToInt(ByteList[8:12])
SecRawAddress = self._ByteListToInt(ByteList[20:24])
SecVirtualAddress = self._ByteListToInt(ByteList[12:16])
self.SectionHeaderList.append((SecName, SecVirtualAddress, SecRawAddress, SecVirtualSize))
self.IsValid = True
PeObject.close()
def _ByteListToStr(self, ByteList):
String = ''
for index in range(len(ByteList)):
if ByteList[index] == 0:
break
String += chr(ByteList[index])
return String
def _ByteListToInt(self, ByteList):
Value = 0
for index in range(len(ByteList) - 1, -1, -1):
Value = (Value << 8) | int(ByteList[index])
return Value
## ##
# #
# This acts like the main() function for the script, unless it is 'import'ed into another # This acts like the main() function for the script, unless it is 'import'ed into another

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define common parsing related functions used in parsing INF/DEC/DSC process # This file is used to define common parsing related functions used in parsing INF/DEC/DSC process
# #
# Copyright (c) 2008, Intel Corporation # Copyright (c) 2008 ~ 2010, 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
@ -709,6 +709,7 @@ def GetSource(Item, ContainerFile, FileRelativePath, LineNo = -1):
# @param ContainerFile: The file which describes the library class, used for error report # @param ContainerFile: The file which describes the library class, used for error report
# #
# @retval (List[0], List[1], List[2], List[3]) # @retval (List[0], List[1], List[2], List[3])
# @retval List
# #
def GetBinary(Item, ContainerFile, FileRelativePath, LineNo = -1): def GetBinary(Item, ContainerFile, FileRelativePath, LineNo = -1):
ItemNew = Item + DataType.TAB_VALUE_SPLIT ItemNew = Item + DataType.TAB_VALUE_SPLIT
@ -719,7 +720,14 @@ def GetBinary(Item, ContainerFile, FileRelativePath, LineNo = -1):
if List[3] != '': if List[3] != '':
CheckPcdTokenInfo(List[3], 'Binaries', ContainerFile, LineNo) CheckPcdTokenInfo(List[3], 'Binaries', ContainerFile, LineNo)
if len(List) == 4:
return (List[0], List[1], List[2], List[3]) return (List[0], List[1], List[2], List[3])
elif len(List) == 3:
return (List[0], List[1], List[2], '')
elif len(List) == 2:
return (List[0], List[1], '', '')
elif len(List) == 1:
return (List[0], '', '', '')
## Get Guids/Protocols/Ppis ## Get Guids/Protocols/Ppis
# #

View File

@ -0,0 +1,15 @@
## @file
# Python 'Common' package initialization file.
#
# This file is required to make Python interpreter treat the directory
# as containing package.
#
# Copyright (c) 2007 - 2010, Intel Corporation<BR>
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#

View File

@ -1,7 +1,7 @@
## @file ## @file
# classes represent data in FDF # classes represent data in FDF
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -168,6 +168,7 @@ class DepexSectionClassObject (SectionClassObject):
def __init__(self): def __init__(self):
self.DepexType = None self.DepexType = None
self.Expression = None self.Expression = None
self.ExpressionProcessed = False
## Compress section data in FDF ## Compress section data in FDF
# #
@ -231,6 +232,7 @@ class FvImageSectionClassObject (SectionClassObject):
self.FvFileType = None self.FvFileType = None
self.FvFileName = None self.FvFileName = None
self.FvFileExtension = None self.FvFileExtension = None
self.FvAddr = None
## GUIDed section data in FDF ## GUIDed section data in FDF
# #
@ -247,6 +249,9 @@ class GuidSectionClassObject (SectionClassObject) :
self.SectionType = None self.SectionType = None
self.ProcessRequired = False self.ProcessRequired = False
self.AuthStatusValid = False self.AuthStatusValid = False
self.FvAddr = []
self.FvParentAddr = None
self.IncludeFvSection = False
## UI section data in FDF ## UI section data in FDF
# #
@ -290,6 +295,7 @@ class RuleClassObject :
self.NameGuid = None self.NameGuid = None
self.Fixed = False self.Fixed = False
self.Alignment = None self.Alignment = None
self.SectAlignment = None
self.CheckSum = False self.CheckSum = False
self.FvFileType = None # for Ffs File Type self.FvFileType = None # for Ffs File Type
self.KeyStringList = [] self.KeyStringList = []

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define a class object to describe a module # This file is used to define a class object to describe a module
# #
# Copyright (c) 2007, Intel Corporation # Copyright (c) 2007 - 2010, 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
@ -34,7 +34,7 @@ from CommonClass import *
# PEI_PCD_DRIVER | DXE_PCD_DRIVER # PEI_PCD_DRIVER | DXE_PCD_DRIVER
# @var TianoR8FlashMap_h: To store value for TianoR8FlashMap_h # @var TianoR8FlashMap_h: To store value for TianoR8FlashMap_h
# @var InfVersion: To store value for InfVersion # @var InfVersion: To store value for InfVersion
# @var EfiSpecificationVersion: To store value for EfiSpecificationVersion # @var UefiSpecificationVersion: To store value for UefiSpecificationVersion
# @var EdkReleaseVersion: To store value for EdkReleaseVersion # @var EdkReleaseVersion: To store value for EdkReleaseVersion
# @var LibraryClass: To store value for LibraryClass, it is a set structure as # @var LibraryClass: To store value for LibraryClass, it is a set structure as
# [ LibraryClassClass, ...] # [ LibraryClassClass, ...]
@ -65,7 +65,6 @@ class ModuleHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass):
self.PcdIsDriver = '' self.PcdIsDriver = ''
self.TianoR8FlashMap_h = False self.TianoR8FlashMap_h = False
self.InfVersion = '' self.InfVersion = ''
self.EfiSpecificationVersion = ''
self.PiSpecificationVersion = '' self.PiSpecificationVersion = ''
self.UefiSpecificationVersion = '' self.UefiSpecificationVersion = ''
self.EdkReleaseVersion = '' self.EdkReleaseVersion = ''

View File

@ -0,0 +1,15 @@
## @file
# Python 'CommonDataClass' package initialization file.
#
# This file is required to make Python interpreter treat the directory
# as containing package.
#
# Copyright (c) 2007 - 2010, Intel Corporation<BR>
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#

View File

@ -1,3 +1,15 @@
/* @file
This file is used to be the grammar file of ECC tool
Copyright (c) 2009 - 2010, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php
THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
*/
grammar C; grammar C;
options { options {
@ -7,7 +19,47 @@ options {
k=2; k=2;
} }
@lexer::header{
## @file
# The file defines the Lexer for C source files.
#
# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
# This file is generated by running:
# java org.antlr.Tool C.g
#
# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at:
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
}
@header { @header {
## @file
# The file defines the parser for C source files.
#
# THIS FILE IS AUTO-GENENERATED. PLEASE DON NOT MODIFY THIS FILE.
# This file is generated by running:
# java org.antlr.Tool C.g
#
# Copyright (c) 2009 - 2010, Intel Corporation All rights reserved.
#
# This program and the accompanying materials are licensed and made available
# under the terms and conditions of the BSD License which accompanies this
# distribution. The full text of the license may be found at:
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
##
import CodeFragment import CodeFragment
import FileProfile import FileProfile
} }
@ -238,6 +290,7 @@ type_qualifier
| 'EFIAPI' | 'EFIAPI'
| 'EFI_BOOTSERVICE' | 'EFI_BOOTSERVICE'
| 'EFI_RUNTIMESERVICE' | 'EFI_RUNTIMESERVICE'
| 'PACKED'
; ;
declarator declarator

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to define checkpoints used by ECC tool # This file is used to define checkpoints used by ECC tool
# #
# Copyright (c) 2008, Intel Corporation # Copyright (c) 2008 - 2010, 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
@ -298,7 +298,11 @@ class Check(object):
for Key in RecordDict: for Key in RecordDict:
if len(RecordDict[Key]) > 1: if len(RecordDict[Key]) > 1:
for Item in RecordDict[Key]: for Item in RecordDict[Key]:
EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for '%s' is duplicate" % (Item[1]), BelongsToTable = 'File', BelongsToItem = Item[0]) Path = Item[1].replace(EccGlobalData.gWorkspace, '')
if Path.startswith('\\') or Path.startswith('/'):
Path = Path[1:]
if not EccGlobalData.gException.IsException(ERROR_INCLUDE_FILE_CHECK_NAME, Path):
EccGlobalData.gDb.TblReport.Insert(ERROR_INCLUDE_FILE_CHECK_NAME, OtherMsg = "The file name for [%s] is duplicate" % Path, BelongsToTable = 'File', BelongsToItem = Item[0])
# Check whether all include file contents is guarded by a #ifndef statement. # Check whether all include file contents is guarded by a #ifndef statement.
def IncludeFileCheckIfndef(self): def IncludeFileCheckIfndef(self):
@ -527,7 +531,7 @@ class Check(object):
if EccGlobalData.gConfig.MetaDataFileCheckPcdDuplicate == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1': if EccGlobalData.gConfig.MetaDataFileCheckPcdDuplicate == '1' or EccGlobalData.gConfig.MetaDataFileCheckAll == '1' or EccGlobalData.gConfig.CheckAll == '1':
EdkLogger.quiet("Checking for duplicate PCDs defined in both DSC and FDF files ...") EdkLogger.quiet("Checking for duplicate PCDs defined in both DSC and FDF files ...")
SqlCommand = """ SqlCommand = """
select A.ID, A.Value2, B.ID, B.Value2 from Dsc as A, Fdf as B select A.ID, A.Value2, A.BelongsToFile, B.ID, B.Value2, B.BelongsToFile from Dsc as A, Fdf as B
where A.Model >= %s and A.Model < %s where A.Model >= %s and A.Model < %s
and B.Model >= %s and B.Model < %s and B.Model >= %s and B.Model < %s
and A.Value2 = B.Value2 and A.Value2 = B.Value2
@ -537,10 +541,17 @@ class Check(object):
"""% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER) """% (MODEL_PCD, MODEL_META_DATA_HEADER, MODEL_PCD, MODEL_META_DATA_HEADER)
RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblDsc.Exec(SqlCommand)
for Record in RecordSet: for Record in RecordSet:
SqlCommand1 = """select Name from File where ID = %s""" %Record[2]
SqlCommand2 = """select Name from File where ID = %s""" %Record[5]
DscFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand1)[0][0])[0]
FdfFileName = os.path.splitext(EccGlobalData.gDb.TblDsc.Exec(SqlCommand2)[0][0])[0]
print DscFileName, 111, FdfFileName
if DscFileName != FdfFileName:
continue
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[1]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable = 'Dsc', BelongsToItem = Record[0]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[1]), BelongsToTable = 'Dsc', BelongsToItem = Record[0])
if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]): if not EccGlobalData.gException.IsException(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, Record[3]):
EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[3]), BelongsToTable = 'Fdf', BelongsToItem = Record[2]) EccGlobalData.gDb.TblReport.Insert(ERROR_META_DATA_FILE_CHECK_PCD_DUPLICATE, OtherMsg = "The PCD [%s] is defined in both FDF file and DSC file" % (Record[4]), BelongsToTable = 'Fdf', BelongsToItem = Record[3])
EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...") EdkLogger.quiet("Checking for duplicate PCDs defined in DEC files ...")
SqlCommand = """ SqlCommand = """
@ -664,7 +675,7 @@ class Check(object):
for Tbl in TableSet: for Tbl in TableSet:
TblName = 'Identifier' + str(Tbl[0]) TblName = 'Identifier' + str(Tbl[0])
SqlCommand = """ SqlCommand = """
select Name, ID from %s where value like '%%%s%%' and Model = %s select Name, ID from %s where value like '%s' and Model = %s
""" % (TblName, PcdName, MODEL_IDENTIFIER_FUNCTION_CALLING) """ % (TblName, PcdName, MODEL_IDENTIFIER_FUNCTION_CALLING)
RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand) RecordSet = EccGlobalData.gDb.TblInf.Exec(SqlCommand)
TblNumber = TblName.replace('Identifier', '') TblNumber = TblName.replace('Identifier', '')
@ -726,7 +737,13 @@ class Check(object):
# Naming Convention Check # Naming Convention Check
def NamingConventionCheck(self): def NamingConventionCheck(self):
if EccGlobalData.gConfig.NamingConventionCheckDefineStatement == '1' \
or EccGlobalData.gConfig.NamingConventionCheckTypedefStatement == '1' \
or EccGlobalData.gConfig.NamingConventionCheckIfndefStatement == '1' \
or EccGlobalData.gConfig.NamingConventionCheckVariableName == '1' \
or EccGlobalData.gConfig.NamingConventionCheckSingleCharacterVariable == '1' \
or EccGlobalData.gConfig.NamingConventionCheckAll == '1'\
or EccGlobalData.gConfig.CheckAll == '1':
for Dirpath, Dirnames, Filenames in self.WalkTree(): for Dirpath, Dirnames, Filenames in self.WalkTree():
for F in Filenames: for F in Filenames:
if os.path.splitext(F)[1] in ('.h', '.c'): if os.path.splitext(F)[1] in ('.h', '.c'):

View File

@ -1,7 +1,7 @@
## @file ## @file
# This file is used to be the main entrance of ECC tool # This file is used to be the main entrance of ECC tool
# #
# Copyright (c) 2009, Intel Corporation # Copyright (c) 2009 - 2010, 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
@ -43,7 +43,7 @@ class Ecc(object):
# Version and Copyright # Version and Copyright
self.VersionNumber = "0.01" self.VersionNumber = "0.01"
self.Version = "%prog Version " + self.VersionNumber self.Version = "%prog Version " + self.VersionNumber
self.Copyright = "Copyright (c) 2009, Intel Corporation All rights reserved." self.Copyright = "Copyright (c) 2009 - 2010, Intel Corporation All rights reserved."
self.InitDefaultConfigIni() self.InitDefaultConfigIni()
self.OutputFile = 'output.txt' self.OutputFile = 'output.txt'
@ -225,6 +225,9 @@ class Ecc(object):
EdkLogger.quiet("Loading ECC configuration ... done") EdkLogger.quiet("Loading ECC configuration ... done")
(Options, Target) = self.EccOptionParser() (Options, Target) = self.EccOptionParser()
if Options.Workspace:
os.environ["WORKSPACE"] = Options.Workspace
# Check workspace envirnoment # Check workspace envirnoment
if "WORKSPACE" not in os.environ: if "WORKSPACE" not in os.environ:
EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found", EdkLogger.error("ECC", BuildToolError.ATTRIBUTE_NOT_AVAILABLE, "Environment variable not found",
@ -244,6 +247,8 @@ class Ecc(object):
self.OutputFile = Options.OutputFile self.OutputFile = Options.OutputFile
if Options.ReportFile != None: if Options.ReportFile != None:
self.ReportFile = Options.ReportFile self.ReportFile = Options.ReportFile
if Options.ExceptionFile != None:
self.ExceptionFile = Options.ExceptionFile
if Options.Target != None: if Options.Target != None:
if not os.path.isdir(Options.Target): if not os.path.isdir(Options.Target):
EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target) EdkLogger.error("ECC", BuildToolError.OPTION_VALUE_INVALID, ExtraData="Target [%s] does NOT exist" % Options.Target)
@ -294,6 +299,8 @@ class Ecc(object):
help="Specify the name of an output file, if and only if one filename was specified.") help="Specify the name of an output file, if and only if one filename was specified.")
Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile", Parser.add_option("-r", "--reportfile filename", action="store", type="string", dest="ReportFile",
help="Specify the name of an report file, if and only if one filename was specified.") help="Specify the name of an report file, if and only if one filename was specified.")
Parser.add_option("-e", "--exceptionfile filename", action="store", type="string", dest="ExceptionFile",
help="Specify the name of an exception file, if and only if one filename was specified.")
Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.") Parser.add_option("-m", "--metadata", action="store_true", type=None, help="Only scan meta-data files information if this option is specified.")
Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.") Parser.add_option("-s", "--sourcecode", action="store_true", type=None, help="Only scan source code files information if this option is specified.")
Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.") Parser.add_option("-k", "--keepdatabase", action="store_true", type=None, help="The existing Ecc database will not be cleaned except report information if this option is specified.")
@ -307,6 +314,7 @@ class Ecc(object):
"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("-w", "--workspace", action="store", type="string", dest='Workspace', help="Specify workspace.")
(Opt, Args)=Parser.parse_args() (Opt, Args)=Parser.parse_args()

View File

@ -1,7 +1,7 @@
## @file ## @file
# Standardized Error Hanlding infrastructures. # Standardized Error Hanlding infrastructures.
# #
# Copyright (c) 20087, Intel Corporation # Copyright (c) 2008 - 2010, 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
@ -40,6 +40,8 @@ ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY = 5005
ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION = 5006 ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION = 5006
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE = 5007 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE = 5007
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008 ERROR_C_FUNCTION_LAYOUT_CHECK_NO_STATIC = 5008
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 = 5009
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 = 5010
ERROR_INCLUDE_FILE_CHECK_ALL = 6000 ERROR_INCLUDE_FILE_CHECK_ALL = 6000
ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001 ERROR_INCLUDE_FILE_CHECK_IFNDEF_STATEMENT_1 = 6001
@ -119,6 +121,8 @@ gEccErrorMessage = {
ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER : "Any optional functional modifiers should exist and next to the return type", ERROR_C_FUNCTION_LAYOUT_CHECK_OPTIONAL_FUNCTIONAL_MODIFIER : "Any optional functional modifiers should exist and next to the return type",
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME : """Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces""", ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_NAME : """Function name should be left justified, followed by the beginning of the parameter list, with the closing parenthesis on its own line, indented two spaces""",
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE : "Function prototypes in include files have the same form as function definitions", ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE : "Function prototypes in include files have the same form as function definitions",
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_2 : "Function prototypes in include files have different parameter number with function definitions",
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_PROTO_TYPE_3 : "Function prototypes in include files have different parameter modifier with function definitions",
ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY : "The body of a function should be contained by open and close braces that must be in the first column", ERROR_C_FUNCTION_LAYOUT_CHECK_FUNCTION_BODY : "The body of a function should be contained by open and close braces that must be in the first column",
ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module", ERROR_C_FUNCTION_LAYOUT_CHECK_DATA_DECLARATION : "The data declarations should be the first code in a module",
ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration", ERROR_C_FUNCTION_LAYOUT_CHECK_NO_INIT_OF_VARIABLE : "There should be no initialization of a variable as part of its declaration",
@ -155,7 +159,7 @@ gEccErrorMessage = {
ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5", ERROR_DOXYGEN_CHECK_FUNCTION_HEADER : "The function headers should follow Doxygen special documentation blocks in section 2.3.5",
ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""", ERROR_DOXYGEN_CHECK_COMMENT_DESCRIPTION : """The first line of text in a comment block should be a brief description of the element being documented and the brief description must end with a period.""",
ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section", ERROR_DOXYGEN_CHECK_COMMENT_FORMAT : "For comment line with '///< ... text ...' format, if it is used, it should be after the code section",
ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands @bug and @todo are allowed to mark the code", ERROR_DOXYGEN_CHECK_COMMAND : "Only Doxygen commands '@bug', '@todo', '@example', '@file', '@attention', '@param', '@post', '@pre', '@retval', '@return', '@sa', '@since', '@test', '@note', '@par' are allowed to mark the code",
ERROR_META_DATA_FILE_CHECK_ALL : "", ERROR_META_DATA_FILE_CHECK_ALL : "",
ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist", ERROR_META_DATA_FILE_CHECK_PATH_NAME : "The file defined in meta-data does not exist",

View File

@ -1,3 +1,16 @@
## @file
# This file is used to be the warning class of ECC tool
#
# Copyright (c) 2009 - 2010, Intel Corporation
# All rights reserved. This program and the accompanying materials
# are licensed and made available under the terms and conditions of the BSD License
# which accompanies this distribution. The full text of the license may be found at
# http://opensource.org/licenses/bsd-license.php
#
# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
#
## The exception class that used to report error messages when preprocessing ## The exception class that used to report error messages when preprocessing
# #
# Currently the "ToolName" is set to be "ECC PP". # Currently the "ToolName" is set to be "ECC PP".

Some files were not shown because too many files have changed in this diff Show More