Re: [edk2] [Patch V2 1/1] Document: Add PCD flexible format value EBNF in Fdf.

2019-03-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, Bob C 
Sent: Thursday, March 07, 2019 1:42 PM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Gao, Liming ; 
Zhu, Yonghong 
Subject: [Patch V2 1/1] Document: Add PCD flexible format value EBNF in Fdf.

BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=541

This patch is to add flexible PCD value format EBNF into Fdf spec.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
---
 3_edk_ii_fdf_file_format/32_fdf_definition.md | 25 
+
 3_edk_ii_fdf_file_format/35_[fd]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/36_[fv]_sections.md  |  4 ++--
 3_edk_ii_fdf_file_format/37_[capsule]_sections.md |  4 ++--
 README.md |  1 +
 5 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/3_edk_ii_fdf_file_format/32_fdf_definition.md 
b/3_edk_ii_fdf_file_format/32_fdf_definition.md
index db098cf..2b044ab 100644
--- a/3_edk_ii_fdf_file_format/32_fdf_definition.md
+++ b/3_edk_ii_fdf_file_format/32_fdf_definition.md
@@ -1,9 +1,9 @@
 

Re: [edk2] [Patch] BaseTools VolInfo: Fix XCODE5 build issue

2019-01-15 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Wednesday, January 16, 2019 2:45 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] BaseTools VolInfo: Fix XCODE5 build issue

XCODE5 reports warning "equality comparison with extraneous parentheses".
Remove extraneous parentheses around the comparison to silence this warning.
This issue is caused by commit 8daa4278e80c70e6caabc525cd122744488253f5.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Feng Bob C 
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c 
b/BaseTools/Source/C/VolInfo/VolInfo.c
index 89fe3a044d..c8a99face2 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -1573,7 +1573,7 @@ Returns:
   //
   // Update Image Base Address
   //
-  if ((ImgHdr->Pe32.OptionalHeader.Magic == 
EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC)) {
+  if (ImgHdr->Pe32.OptionalHeader.Magic == EFI_IMAGE_NT_OPTIONAL_HDR32_MAGIC) {
 ImgHdr->Pe32.OptionalHeader.ImageBase = (UINT32) NewPe32BaseAddress;
   } else if (ImgHdr->Pe32Plus.OptionalHeader.Magic == 
EFI_IMAGE_NT_OPTIONAL_HDR64_MAGIC) {
 ImgHdr->Pe32Plus.OptionalHeader.ImageBase = NewPe32BaseAddress;
-- 
2.13.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'

2018-12-03 Thread Zhu, Yonghong
Yes.  I prefer not to change it.

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Monday, December 03, 2018 11:19 PM
To: Zhu, Yonghong ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard shared 
variable for '*'

I was trying to change all use of *, without regard to the usage of it.

Do you think that mathematical * should not be changed?

-Jaben

> -Original Message-
> From: Zhu, Yonghong
> Sent: Sunday, December 02, 2018 6:31 PM
> To: Carsey, Jaben ; edk2-devel@lists.01.org
> Cc: Gao, Liming ; Zhu, Yonghong 
> 
> Subject: RE: [Patch v1 1/1] BaseTools: create and use a standard 
> shared variable for '*'
> Importance: High
> 
> Hi Jaben,
> 
> In this patch, it also changed the mathematics multiplicative '*' 
> (used in
> expression) to  TAB_STAR, is it by on purpose?
> Eg:
> -NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', 
> '>>', '!', '=', '>', '<',
> '?', ':']
> +NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', 
> + '~', '<<', '>>', '!', '=',
> '>', '<', '?', ':']
> 
> Best Regards,
> Zhu Yonghong
> 
> -----Original Message-
> From: Carsey, Jaben
> Sent: Friday, November 16, 2018 11:40 PM
> To: edk2-devel@lists.01.org
> Cc: Zhu, Yonghong ; Gao, Liming 
> 
> Subject: [Patch v1 1/1] BaseTools: create and use a standard shared 
> variable for '*'
> 
> add a variable for the string '*' and then use it instead of lots of '*'
> 
> Cc: Yonghong Zhu 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jaben Carsey 
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 54 ++---
> ---
>  BaseTools/Source/Python/AutoGen/BuildEngine.py | 10 ++--
>  BaseTools/Source/Python/BPDG/GenVpd.py | 14 ++---
>  BaseTools/Source/Python/Common/DataType.py |  1 +
>  BaseTools/Source/Python/Common/Expression.py   |  4 +-
>  BaseTools/Source/Python/Common/Misc.py |  2 +-
>  BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +
>  BaseTools/Source/Python/Common/VpdInfoFile.py  |  8 +--
>  BaseTools/Source/Python/GenFds/FdfParser.py|  5 +-
>  BaseTools/Source/Python/GenFds/GenFds.py   |  2 +-
>  BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
>  BaseTools/Source/Python/GenFds/Section.py  |  2 +-
>  BaseTools/Source/Python/Workspace/DscBuildData.py  |  6 +--
>  13 files changed, 70 insertions(+), 69 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index f3560bfc787d..25417c447061 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
>  PcdValue = Sku.DefaultValue
>  if PcdValue == "":
>  PcdValue  = Pcd.DefaultValue
> -if Sku.VpdOffset != '*':
> +if Sku.VpdOffset != TAB_STAR:
>  if PcdValue.startswith("{"):
>  Alignment = 8
>  elif PcdValue.startswith("L"):
> @@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
>  VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
>  SkuValueMap[PcdValue].append(Sku)
>  # if the offset of a VPD is *, then it need 
> to be fixed up by third party tool.
> -if not NeedProcessVpdMapFile and Sku.VpdOffset == 
> "*":
> +if not NeedProcessVpdMapFile and 
> + Sku.VpdOffset ==
> TAB_STAR:
>  NeedProcessVpdMapFile = True
>  if self.Platform.VpdToolGuid is None or 
> self.Platform.VpdToolGuid == '':
>  EdkLogger.error("Build", 
> FILE_NOT_FOUND, \ @@ -1522,7
> +1522,7 @@ class PlatformAutoGen(AutoGen):
>  PcdValue = Sku.DefaultValue
>  if PcdValue == "":
>  PcdValue  = DscPcdEntry.DefaultValue
> -if Sku.VpdOffset != '*':
> +if Sku.VpdOffset != TAB_STAR:
>  if PcdValue.startswith("{"):
>  Alignment = 8
> 

Re: [edk2] [Patch v1 1/1] BaseTools: create and use a standard shared variable for '*'

2018-12-02 Thread Zhu, Yonghong
Hi Jaben,

In this patch, it also changed the mathematics multiplicative '*' (used in 
expression) to  TAB_STAR, is it by on purpose? 
Eg:
-NonLetterOpLst = ['+', '-', '*', '/', '%', '&', '|', '^', '~', '<<', '>>', 
'!', '=', '>', '<', '?', ':']
+NonLetterOpLst = ['+', '-', TAB_STAR, '/', '%', '&', '|', '^', '~', '<<', 
'>>', '!', '=', '>', '<', '?', ':']

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Friday, November 16, 2018 11:40 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [Patch v1 1/1] BaseTools: create and use a standard shared variable 
for '*'

add a variable for the string '*' and then use it instead of lots of '*'

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 54 
++--
 BaseTools/Source/Python/AutoGen/BuildEngine.py | 10 ++--
 BaseTools/Source/Python/BPDG/GenVpd.py | 14 ++---
 BaseTools/Source/Python/Common/DataType.py |  1 +
 BaseTools/Source/Python/Common/Expression.py   |  4 +-
 BaseTools/Source/Python/Common/Misc.py |  2 +-
 BaseTools/Source/Python/Common/ToolDefClassObject.py   | 23 +
 BaseTools/Source/Python/Common/VpdInfoFile.py  |  8 +--
 BaseTools/Source/Python/GenFds/FdfParser.py|  5 +-
 BaseTools/Source/Python/GenFds/GenFds.py   |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  8 +--
 BaseTools/Source/Python/GenFds/Section.py  |  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py  |  6 +--
 13 files changed, 70 insertions(+), 69 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f3560bfc787d..25417c447061 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1438,7 +1438,7 @@ class PlatformAutoGen(AutoGen):
 PcdValue = Sku.DefaultValue
 if PcdValue == "":
 PcdValue  = Pcd.DefaultValue
-if Sku.VpdOffset != '*':
+if Sku.VpdOffset != TAB_STAR:
 if PcdValue.startswith("{"):
 Alignment = 8
 elif PcdValue.startswith("L"):
@@ -1462,7 +1462,7 @@ class PlatformAutoGen(AutoGen):
 VpdFile.Add(Pcd, SkuName, Sku.VpdOffset)
 SkuValueMap[PcdValue].append(Sku)
 # if the offset of a VPD is *, then it need to be 
fixed up by third party tool.
-if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":
+if not NeedProcessVpdMapFile and Sku.VpdOffset == 
TAB_STAR:
 NeedProcessVpdMapFile = True
 if self.Platform.VpdToolGuid is None or 
self.Platform.VpdToolGuid == '':
 EdkLogger.error("Build", FILE_NOT_FOUND, \ @@ 
-1522,7 +1522,7 @@ class PlatformAutoGen(AutoGen):
 PcdValue = Sku.DefaultValue
 if PcdValue == "":
 PcdValue  = DscPcdEntry.DefaultValue
-if Sku.VpdOffset != '*':
+if Sku.VpdOffset != TAB_STAR:
 if PcdValue.startswith("{"):
 Alignment = 8
 elif PcdValue.startswith("L"):
@@ -1545,7 +1545,7 @@ class PlatformAutoGen(AutoGen):
 SkuValueMap[PcdValue] = []
 VpdFile.Add(DscPcdEntry, SkuName, 
Sku.VpdOffset)
 SkuValueMap[PcdValue].append(Sku)
-if not NeedProcessVpdMapFile and Sku.VpdOffset 
== "*":
+if not NeedProcessVpdMapFile and Sku.VpdOffset 
== TAB_STAR:
 NeedProcessVpdMapFile = True
 if DscPcdEntry.DatumType == TAB_VOID and 
PcdValue.startswith("L"):
 UnicodePcdArray.add(DscPcdEntry) @@ -1573,7 
+1573,7 @@ class PlatformAutoGen(AutoGen):
 if os.path.exists(VpdMapFilePath):
 VpdFile.Read(VpdMapFilePath)
 
-# Fixup "*" offset
+# Fixup TAB_STAR offset
 for pcd in VpdSkuMap:
 vpdinfo = VpdFile.GetVpdInfo(pcd)
 if vpdinfo is None:
@@ -2210,

Re: [edk2] [Patch 0/3] Fix UEFI and Tiano Decompression logic issue

2018-11-10 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Friday, November 09, 2018 7:58 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/3] Fix UEFI and Tiano Decompression logic issue

https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by previous change with more checkers in 
UefiDecompress. In Decode() function, once mOutBuf is fully filled, Decode() 
should return. Current logic misses the checker of mOutBuf after while() loop.

Liming Gao (3):
  BaseTools: Fix UEFI and Tiano Decompression logic issue
  MdePkg BaseUefiDecompressLib: Fix UEFI Decompression logic issue
  IntelFrameworkModulePkg: Fix UEFI and Tiano Decompression logic issue

 BaseTools/Source/C/Common/Decompress.c 
 | 6 ++
 BaseTools/Source/C/TianoCompress/TianoCompress.c   
 | 6 ++
 
IntelFrameworkModulePkg/Library/BaseUefiTianoCustomDecompressLib/BaseUefiTianoCustomDecompressLib.c
 | 6 ++
 MdePkg/Library/BaseUefiDecompressLib/BaseUefiDecompressLib.c   
 | 6 ++
 4 files changed, 24 insertions(+)

--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

2018-11-08 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Gao, Liming 
Sent: Friday, November 09, 2018 7:58 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch 1/3] BaseTools: Fix UEFI and Tiano Decompression logic issue

https://bugzilla.tianocore.org/show_bug.cgi?id=1317

This is a regression issue caused by 041d89bc0f0119df37a5fce1d0f16495ff905089.
In Decode() function, once mOutBuf is fully filled, Decode() should return.
Current logic misses the checker of mOutBuf after while() loop.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Source/C/Common/Decompress.c   | 6 ++
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 6 ++
 2 files changed, 12 insertions(+)

diff --git a/BaseTools/Source/C/Common/Decompress.c 
b/BaseTools/Source/C/Common/Decompress.c
index 71313b1179..33e0f0d160 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -662,6 +662,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+return ;
+  }
 }
   }
 
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 2d6fc4c952..a77f6798ec 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -2682,6 +2682,12 @@ Returns: (VOID)
 
 BytesRemain--;
   }
+  //
+  // Once mOutBuf is fully filled, directly return
+  //
+  if (Sd->mOutBuf >= Sd->mOrigSize) {
+goto Done ;
+  }
 }
   }
 
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools build_rule.template: Update aslc rule for XCODE tool chain

2018-11-04 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Saturday, November 03, 2018 12:25 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] BaseTools build_rule.template: Update aslc rule for XCODE tool 
chain

Update aslc rule to rename the temp output file from .efi to .pecoff.
This change can avoid the conflict .efi file name in output directory.
One is the driver image, another is aslc temp output file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Conf/build_rule.template | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index ed54a55..3ab5606 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -478,8 +478,8 @@
 
 "$(ASLCC)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj  $(ASLCC_FLAGS) 
$(INC) ${src}
 "$(ASLDLINK)" -o $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(ASLDLINK_FLAGS) $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
-"$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS) 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi
-"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.efi 
$(GENFW_FLAGS)
+"$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS) 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.dll 
$(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff
+"$(GENFW)" -o ${dst} -c $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.pecoff 
$(GENFW_FLAGS)
   
   
 [Masm16-Code-File]
-- 
2.10.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 1/1] BaseTools tools_def.template: Add GCC link script in X86 ASLDLINK_FLAGS

2018-11-02 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Thursday, November 01, 2018 10:47 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch 1/1] BaseTools tools_def.template: Add GCC link script in X86 
ASLDLINK_FLAGS

This fix refers to commit 14ca435fb6c059eaeb7fe6eedbe4738ffaf336d0.
GCC link script is used to discard the unused section data from ELF image.
ASLDLINK_FLAGS requires it to remove the unnecessary section data, then GenFw 
can be used to retrieve the correct data section from ELF image.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index a22b96c0b8..e0e68fd7fb 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4253,7 +4253,7 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC47_AARCH64_ASLDLINK_FLAGS)
 DEFINE GCC49_IA32_CC_FLAGS   = DEF(GCC48_IA32_CC_FLAGS)
 DEFINE GCC49_X64_CC_FLAGS= DEF(GCC48_X64_CC_FLAGS)
 DEFINE GCC49_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x40
-DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) 
+-Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) 
+-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC49_IA32_X64_DLINK_FLAGS= DEF(GCC49_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC49_IA32_DLINK2_FLAGS   = DEF(GCC48_IA32_DLINK2_FLAGS)
 DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/Eot: Remove a duplication code in EotMain class

2018-11-01 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, October 31, 2018 3:49 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng 
Subject: [edk2] [PATCH] BaseTools/Eot: Remove a duplication code in EotMain 
class

From: Hess Chen 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Eot/EotMain.py | 365 -
 1 file changed, 365 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/EotMain.py 
b/BaseTools/Source/Python/Eot/EotMain.py
index 2ad93cc6b4..7eae4ac672 100644
--- a/BaseTools/Source/Python/Eot/EotMain.py
+++ b/BaseTools/Source/Python/Eot/EotMain.py
@@ -1083,371 +1083,6 @@ class Ffs(Image):
 State = property(_GetState, _SetState)
 
 
-_FfsGuid = "8C8CE578-8A3D-4F1C-9935-896185C32DD3"
-
-_GUID_  = struct.Struct("16x 1I2H8B")
-_LENGTH_= struct.Struct("16x 16x 1Q")
-_SIG_   = struct.Struct("16x 16x 8x 1I")
-_ATTR_  = struct.Struct("16x 16x 8x 4x 1I")
-_HLEN_  = struct.Struct("16x 16x 8x 4x 4x 1H")
-_CHECKSUM_  = struct.Struct("16x 16x 8x 4x 4x 2x 1H")
-
-def __init__(self, Name=''):
-Image.__init__(self)
-self.Name = Name
-self.FfsDict = sdict()
-self.OrderedFfsDict = sdict()
-self.UnDispatchedFfsDict = sdict()
-self.ProtocolList = sdict()
-
-def CheckArchProtocol(self):
-for Item in EotGlobalData.gArchProtocolGuids:
-if Item.lower() not in EotGlobalData.gProtocolList:
-return False
-return True
-
-def ParseDepex(self, Depex, Type):
-List = None
-if Type == 'Ppi':
-List = EotGlobalData.gPpiList
-if Type == 'Protocol':
-List = EotGlobalData.gProtocolList
-DepexStack = []
-DepexList = []
-DepexString = ''
-FileDepex = None
-CouldBeLoaded = True
-for Index in range(0, len(Depex.Expression)):
-Item = Depex.Expression[Index]
-if Item == 0x00:
-Index = Index + 1
-Guid = gGuidStringFormat % Depex.Expression[Index]
-if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] 
== 0x08:
-return (True, 'BEFORE %s' % Guid, [Guid, 'BEFORE'])
-elif Item == 0x01:
-Index = Index + 1
-Guid = gGuidStringFormat % Depex.Expression[Index]
-if Guid in self.OrderedFfsDict and Depex.Expression[Index + 1] 
== 0x08:
-return (True, 'AFTER %s' % Guid, [Guid, 'AFTER'])
-elif Item == 0x02:
-Index = Index + 1
-Guid = gGuidStringFormat % Depex.Expression[Index]
-if Guid.lower() in List:
-DepexStack.append(True)
-DepexList.append(Guid)
-else:
-DepexStack.append(False)
-DepexList.append(Guid)
-continue
-elif Item == 0x03 or Item == 0x04:
-DepexStack.append(eval(str(DepexStack.pop()) + ' ' + 
Depex._OPCODE_STRING_[Item].lower() + ' ' + str(DepexStack.pop(
-DepexList.append(str(DepexList.pop()) + ' ' + 
Depex._OPCODE_STRING_[Item].upper() + ' ' + str(DepexList.pop()))
-elif Item == 0x05:
-DepexStack.append(eval(Depex._OPCODE_STRING_[Item].lower() + ' 
' + str(DepexStack.pop(
-DepexList.append(Depex._OPCODE_STRING_[Item].lower() + ' ' + 
str(DepexList.pop()))
-elif Item == 0x06:
-DepexStack.append(True)
-DepexList.append('TRUE')
-DepexString = DepexString + 'TRUE' + ' '
-elif Item == 0x07:
-DepexStack.append(False)
-DepexList.append('False')
-DepexString = DepexString + 'FALSE' + ' '
-elif Item == 0x08:
-if Index != len(Depex.Expression) - 1:
-CouldBeLoaded = False
-else:
-CouldBeLoaded = DepexStack.pop()
-else:
-CouldBeLoaded = False
-if DepexList != []:
-DepexString = DepexList[0].strip()
-return (CouldBeLoaded, DepexString, FileDepex)
-
-def Dispatch(self, Db = None):
-if Db is None:
-return False
-self.UnDispatchedFfsDict = copy.copy(self.FfsDict)
-# Find PeiCore, DexCore, PeiPriori, DxePriori first
-FfsSecCoreGuid = None
-FfsPeiCoreGuid = None
-FfsDxeCoreGuid = None
-FfsPeiPrioriGuid = None
-FfsDxePrioriGuid = None
-for FfsID in self.UnDispatchedFfsDict:
-Ffs = self.UnDispatchedFfsDict[FfsID]
-  

Re: [edk2] [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with empty string

2018-10-30 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Tuesday, October 30, 2018 11:00 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] BaseTools ConvertFceToStructurePcd: Fix the array value with 
empty string

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/Scripts/ConvertFceToStructurePcd.py | 17 +++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Scripts/ConvertFceToStructurePcd.py 
b/BaseTools/Scripts/ConvertFceToStructurePcd.py
index 6ca51c4..9240b8f 100644
--- a/BaseTools/Scripts/ConvertFceToStructurePcd.py
+++ b/BaseTools/Scripts/ConvertFceToStructurePcd.py
@@ -303,7 +303,10 @@ class Config(object):
 list1 = [t for t in list1 if t != '']  # remove '' form list
 first_num = int(list1[0], 16)
 if list1[first_num + 1] == 'STRING':  # parser STRING
-  value = 'L%s' % list1[-1]
+  if list1[-1] == '""':
+value = "{0x0, 0x0}"
+  else:
+value = 'L%s' % list1[-1]
 elif list1[first_num + 1] == 'ORDERED_LIST':  # parser ORDERED_LIST
   value_total = int(list1[first_num + 2])
   list2 = list1[-value_total:]
@@ -505,12 +508,22 @@ class mainprocess(object):
 inf_list = self.del_repeat(inf_list)
 header_list = self.plus(self.del_repeat(header_list))
 title_all=list(set(title_list))
-info_list = self.del_repeat(info_list)
+info_list = self.remove_bracket(self.del_repeat(info_list))
 for i in range(len(info_list)-1,-1,-1):
   if len(info_list[i]) == 0:
 info_list.remove(info_list[i])
 return keys,title_all,info_list,header_list,inf_list
 
+  def remove_bracket(self,List):
+for i in List:
+  for j in i:
+tmp = j.split("|")
+if (('L"' in j) and ("[" in j)) or (tmp[1].strip() == '{0x0, 0x0}'):
+  tmp[0] = tmp[0][:tmp[0].index('[')]
+  List[List.index(i)][i.index(j)] = "|".join(tmp)
+else:
+  List[List.index(i)][i.index(j)] = j
+return List
 
   def write_all(self):
 title_flag=1
-- 
2.10.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] BaseTools: Fix merge in FDF parser for OptionROM override

2018-10-29 Thread Zhu, Yonghong
Thanks for the update.

Reviewed-by: Yonghong Zhu   

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tomas 
Pilar (tpilar)
Sent: Tuesday, October 30, 2018 12:53 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2] BaseTools: Fix merge in FDF parser for OptionROM 
override

Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Tomas Pilar 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 1c9a5130bf..44cc8f63d0 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -4396,8 +4396,8 @@ class FdfParser:
 raise Warning.ExpectedEquals(self.FileName, 
self.CurrentLineNumber)
 # Get a list of PCI IDs
 Overrides.PciDeviceId = ""
-while (self.__GetNextHexNumber()):
-Overrides.PciDeviceId = "{} 
{}".format(Overrides.PciDeviceId, self.__Token)
+while (self._GetNextHexNumber()):
+Overrides.PciDeviceId = "{} 
{}".format(Overrides.PciDeviceId, self._Token)
 if not Overrides.PciDeviceId:
 raise Warning.Expected("one or more Hex device ids", 
self.FileName, self.CurrentLineNumber)
 continue
-- 
2.17.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-InfSpecification][PATCH v2] Amend the OptionROM specification to allow multiple PCI_DEVICE_IDs

2018-10-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tomas 
Pilar (tpilar)
Sent: Monday, October 29, 2018 6:48 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [edk2-InfSpecification][PATCH v2] Amend the OptionROM 
specification to allow multiple PCI_DEVICE_IDs

The BaseTools have been updated to allow multiple PCI_DEVICE_IDs following the 
Device List introduced in the PCI Spec rev 3.0. This change documents the 
syntax.

Signed-off-by: Tomas Pilar 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 2_inf_overview/24_[defines]_section.md   | 2 +-
 3_edk_ii_inf_file_format/34_[defines]_section.md | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/2_inf_overview/24_[defines]_section.md 
b/2_inf_overview/24_[defines]_section.md
index 0afdfed..8e5706c 100644
--- a/2_inf_overview/24_[defines]_section.md
+++ b/2_inf_overview/24_[defines]_section.md
@@ -128,7 +128,7 @@ dispatch instance.
 |`CONSTRUCTOR`   |Not required - Library Only  
|CName   | This only applies to components 
that are libraries. It is required for EDK II libraries if the module's INF 
contains a Constructor element. This value is used to call the specified 
function before calling into the library itself.

  |
 |`DESTRUCTOR`|Not required - Library Only  
|CName   | This only applies to components 
that are libraries. This value is used to call the specified function before 
calling into the library itself.


  |
 |`SHADOW`|Not required - SEC, PEIM and PEI_CORE Driver 
modules only|TRUE  FALSE   | This boolean operator is 
used by `SEC`, `PEI_CORE` and `PEIM` modules to indicate if the module was 
coded to use `REGISTER_FOR_SHADOW`. If the value is TRUE, the .reloc section of 
the PE32 image is not removed, otherwise, the .reloc section is stripped to 
conserve space in the final binary images. The default value is FALSE.  
   |
-|`PCI_DEVICE_ID` |Not required - Required for UEFI PCI Option ROMs 
|UINT16 Value| The PCI Device Id for this 
device  



|
+|`PCI_DEVICE_ID` |Not required - Required for UEFI PCI Option ROMs 
|List of UINT16 Values   | The list of PCI Device Ids for 
this device 



|
 |`PCI_VENDOR_ID` |Not required - Required for UEFI PCI Option ROMs 
|UINT16 Value| The PCI Vendor Id for this 
device  



|
 |`PCI_CLASS_CODE`|Not required - Required for UEFI PCI Option ROMs 
|UINT8 Value | The PCI Class Code for this 
device  



   |
 |`PCI_REVISION`  |Not required - Required for UEFI PCI Option ROMs 
|UINT8 Value | The PCI revision for this device

Re: [edk2] [edk2-FdfSpecification][PATCH v2] Amend the OptionROM definition to allow multiple PCI_DEVICE_IDs

2018-10-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tomas 
Pilar (tpilar)
Sent: Monday, October 29, 2018 6:48 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [edk2-FdfSpecification][PATCH v2] Amend the OptionROM 
definition to allow multiple PCI_DEVICE_IDs

The BaseTools are updated to allow multiple PCI_DEVICE_ID fields following the 
Device List introduced in the PCI Spec rev 3.0. This commit documents the 
amended syntax.

Signed-off-by: Tomas Pilar 
Contributed-under: TianoCore Contribution Agreement 1.1
---
 3_edk_ii_fdf_file_format/311_pci_optionrom_section.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/3_edk_ii_fdf_file_format/311_pci_optionrom_section.md 
b/3_edk_ii_fdf_file_format/311_pci_optionrom_section.md
index 08f50e7..8267fbb 100644
--- a/3_edk_ii_fdf_file_format/311_pci_optionrom_section.md
+++ b/3_edk_ii_fdf_file_format/311_pci_optionrom_section.md
@@ -58,7 +58,7 @@ Conditional statements may be used anywhere within this 
section.
 ::=  "{" 
[ "PCI_VENDOR_ID"   ]
[ "PCI_CLASS_CODE"   ]
-   [ "PCI_DEVICE_ID"   ]
+   [ "PCI_DEVICE_ID"   [ 
+ ]* ]
[ "PCI_REVISION"   ]
[ "PCI_COMPRESS"   ]
 "}" 
@@ -108,6 +108,7 @@ for the .efi extension in the ENBF above.
 [OptionRom.AtapiPassThru]
   INF USE = IA32 OptionRomPkg/AtapiPassThruDxe/AtapiPassThruDxe.inf {
 PCI_REVISION = 0x0020
+PCI_DEVICE_ID = 0x0A03 0x0B03
   }
   INF USE = EBC OptionRomPkg/AtapiPassThruDxe/AtapiPassThruDxe.inf
 ```
--
2.17.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] BaseTools: Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code

2018-10-27 Thread Zhu, Yonghong
The code was synced from DevicePathFromText.c, not from DevicePathToText.c

So please update the title. Maybe: Sync the DevicePath Function update from 
MdePkg, and in the description to add detail function updates.

Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong

-Original Message-
From: Feng, YunhuaX 
Sent: Friday, October 26, 2018 4:37 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 1/1] BaseTools: Sync 
MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code

Sync MdePkg/Library/UefiDevicePathLib/DevicePathToText.c code

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/DevicePath/DevicePath.c |  2 +-
 BaseTools/Source/C/DevicePath/DevicePathFromText.c | 59 ++
 BaseTools/Source/C/Include/Protocol/DevicePath.h   |  2 +-
 3 files changed, 50 insertions(+), 13 deletions(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c 
b/BaseTools/Source/C/DevicePath/DevicePath.c
index 956bbffb5f..356f5f7e24 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -23,11 +23,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 // Utility version information
 //
 #define UTILITY_MAJOR_VERSION 0
 #define UTILITY_MINOR_VERSION 1
 
-EFI_GUID gEfiDebugPortDevicePathGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
+EFI_GUID gEfiDebugPortProtocolGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
 EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;  EFI_GUID gEfiVT100Guid = 
EFI_VT_100_GUID;  EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;  EFI_GUID 
gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;  EFI_GUID gEfiUartDevicePathGuid = 
EFI_UART_DEVICE_PATH_GUID; diff --git 
a/BaseTools/Source/C/DevicePath/DevicePathFromText.c 
b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
index bb74e2e170..555efa1acd 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
@@ -762,11 +762,20 @@ DevPathFromTextAcpiExp (
   ACPI_EXTENDED_DP,
   Length
   );
 
   AcpiEx->HID = EisaIdFromText (HIDStr);
-  AcpiEx->CID = EisaIdFromText (CIDStr);
+  //
+  // According to UEFI spec, the CID parametr is optional and has a default 
value of 0.
+  // So when the CID parametr is not specified or specified as 0 in the text 
device node.
+  // Set the CID to 0 in the ACPI extension device path structure.
+  //
+  if (*CIDStr == L'\0' || *CIDStr == L'0') {
+AcpiEx->CID = 0;
+  } else {
+AcpiEx->CID = EisaIdFromText (CIDStr);  }
   AcpiEx->UID = 0;
 
   AsciiStr = (CHAR8 *) ((UINT8 *)AcpiEx + sizeof 
(ACPI_EXTENDED_HID_DEVICE_PATH));
   //
   // HID string is NULL
@@ -1601,19 +1610,19 @@ DevPathFromTextEmmc (
 EFI_DEVICE_PATH_PROTOCOL *
 DevPathFromTextDebugPort (
CHAR16 *TextDeviceNode
   )
 {
-  VENDOR_DEFINED_MESSAGING_DEVICE_PATH  *Vend;
+  VENDOR_DEVICE_PATH  *Vend;
 
-  Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (
+  Vend = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
 MESSAGING_DEVICE_PATH,
 MSG_VENDOR_DP,
-(UINT16) sizeof 
(VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
+(UINT16) sizeof 
(VENDOR_DEVICE_PATH)
 );
 
-  CopyGuid (>Guid, );
+  CopyGuid (>Guid, );
 
   return (EFI_DEVICE_PATH_PROTOCOL *) Vend;
 }
 
 /**
@@ -1904,26 +1913,46 @@ ConvertFromTextUsbClass (
 
   VIDStr  = GetNextParamStr ();
   PIDStr  = GetNextParamStr ();
   if (UsbClassText->ClassExist) {
 ClassStr = GetNextParamStr ();
-UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+if (*ClassStr == L'\0') {
+  UsbClass->DeviceClass = 0xFF;
+} else {
+  UsbClass->DeviceClass = (UINT8) Strtoi (ClassStr);
+}
   } else {
 UsbClass->DeviceClass = UsbClassText->Class;
   }
   if (UsbClassText->SubClassExist) {
 SubClassStr = GetNextParamStr ();
-UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+if (*SubClassStr == L'\0') {
+  UsbClass->DeviceSubClass = 0xFF;
+} else {
+  UsbClass->DeviceSubClass = (UINT8) Strtoi (SubClassStr);
+}
   } else {
 UsbClass->DeviceSubClass = UsbClassText->SubClass;
   }
 
   ProtocolStr = GetNextParamStr ();
 
-  UsbClass->VendorId= (UINT16) Strtoi (VIDStr);
-  UsbClass->ProductId   = (UINT16) Strtoi (PIDStr);
-  UsbClass->DeviceProtocol  = (UINT8) Strtoi (ProtocolStr);
+  if (*VIDStr == L'\0') {
+UsbClass->VendorId= 0x;
+  } else {
+UsbClass->VendorId= (UINT16) S

Re: [edk2] [PATCH 1/1] BaseTools: Use VENDOR_DEVICE_PATH structure for Debug Port device path

2018-10-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Thursday, October 25, 2018 2:00 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 1/1] BaseTools: Use VENDOR_DEVICE_PATH structure for Debug Port 
device path

Copy code from Commit 9343d0a1cd09544686b14dba5b428d7bc811f6b9

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/DevicePath/DevicePath.c | 2 +-
 BaseTools/Source/C/DevicePath/DevicePathFromText.c | 6 +++---
 BaseTools/Source/C/Include/Protocol/DevicePath.h   | 2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/C/DevicePath/DevicePath.c 
b/BaseTools/Source/C/DevicePath/DevicePath.c
index 956bbffb5f..356f5f7e24 100644
--- a/BaseTools/Source/C/DevicePath/DevicePath.c
+++ b/BaseTools/Source/C/DevicePath/DevicePath.c
@@ -23,11 +23,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 // Utility version information
 //
 #define UTILITY_MAJOR_VERSION 0
 #define UTILITY_MINOR_VERSION 1
 
-EFI_GUID gEfiDebugPortDevicePathGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
+EFI_GUID gEfiDebugPortProtocolGuid = DEVICE_PATH_MESSAGING_DEBUGPORT;
 EFI_GUID gEfiPcAnsiGuid = EFI_PC_ANSI_GUID;  EFI_GUID gEfiVT100Guid = 
EFI_VT_100_GUID;  EFI_GUID gEfiVT100PlusGuid = EFI_VT_100_PLUS_GUID;  EFI_GUID 
gEfiVTUTF8Guid = EFI_VT_UTF8_GUID;  EFI_GUID gEfiUartDevicePathGuid = 
EFI_UART_DEVICE_PATH_GUID; diff --git 
a/BaseTools/Source/C/DevicePath/DevicePathFromText.c 
b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
index bb74e2e170..2647a2020c 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
@@ -1601,19 +1601,19 @@ DevPathFromTextEmmc (  EFI_DEVICE_PATH_PROTOCOL *  
DevPathFromTextDebugPort (
CHAR16 *TextDeviceNode
   )
 {
-  VENDOR_DEFINED_MESSAGING_DEVICE_PATH  *Vend;
+  VENDOR_DEVICE_PATH  *Vend;
 
-  Vend = (VENDOR_DEFINED_MESSAGING_DEVICE_PATH *) CreateDeviceNode (
+  Vend = (VENDOR_DEVICE_PATH *) CreateDeviceNode (
 MESSAGING_DEVICE_PATH,
 MSG_VENDOR_DP,
 (UINT16) sizeof 
(VENDOR_DEFINED_MESSAGING_DEVICE_PATH)
 );
 
-  CopyGuid (>Guid, );
+  CopyGuid (>Guid, );
 
   return (EFI_DEVICE_PATH_PROTOCOL *) Vend;  }
 
 /**
diff --git a/BaseTools/Source/C/Include/Protocol/DevicePath.h 
b/BaseTools/Source/C/Include/Protocol/DevicePath.h
index 68bb37e479..0295582cbd 100644
--- a/BaseTools/Source/C/Include/Protocol/DevicePath.h
+++ b/BaseTools/Source/C/Include/Protocol/DevicePath.h
@@ -1378,11 +1378,11 @@ extern EFI_GUID  gEfiDebugPortVariableGuid;
 
 //
 // DebugPort device path definitions...
 //
 #define DEVICE_PATH_MESSAGING_DEBUGPORT EFI_DEBUGPORT_PROTOCOL_GUID -extern 
EFI_GUID  gEfiDebugPortDevicePathGuid;
+extern EFI_GUID  gEfiDebugPortProtocolGuid;
 
 typedef struct {
   EFI_DEVICE_PATH_PROTOCOL  Header;
   EFI_GUID  Guid;
 } DEBUGPORT_DEVICE_PATH;
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue

2018-10-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Thursday, October 25, 2018 1:51 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 1/1] BaseTools: Fix BPDG tool print traceback info issue

Fix BPDG tool print traceback info issue and remove abundant code

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/BPDG/BPDG.py  | 5 -
 BaseTools/Source/Python/Common/VpdInfoFile.py | 5 ++---
 2 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/BPDG/BPDG.py 
b/BaseTools/Source/Python/BPDG/BPDG.py
index 2ec1516c0a..c30e062a69 100644
--- a/BaseTools/Source/Python/BPDG/BPDG.py
+++ b/BaseTools/Source/Python/BPDG/BPDG.py
@@ -151,11 +151,14 @@ def StartBpdg(InputFileName, MapFileName, VpdFileName, 
Force):
 GenVPD.GenerateVpdFile(MapFileName, VpdFileName)
 
 EdkLogger.info("- Vpd pcd fixed done! -")
 
 if __name__ == '__main__':
-r = main()
+try:
+r = main()
+except FatalError as e:
+r = e
 ## 0-127 is a safe return range, and 1 is a standard default error
 if r < 0 or r > 127: r = 1
 sys.exit(r)
 
 
diff --git a/BaseTools/Source/Python/Common/VpdInfoFile.py 
b/BaseTools/Source/Python/Common/VpdInfoFile.py
index 0485bf482e..2fb8e66fe9 100644
--- a/BaseTools/Source/Python/Common/VpdInfoFile.py
+++ b/BaseTools/Source/Python/Common/VpdInfoFile.py
@@ -252,11 +252,10 @@ def CallExtenalBPDGTool(ToolPath, VpdFileName):
 print(out)
 while PopenObject.returncode is None :
 PopenObject.wait()
 
 if PopenObject.returncode != 0:
-if PopenObject.returncode != 0:
-EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", 
str(error))
-EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail to 
execute BPDG tool with exit code: %d, the error message is: \n %s" % \
+EdkLogger.debug(EdkLogger.DEBUG_1, "Fail to call BPDG tool", 
str(error))
+EdkLogger.error("BPDG", BuildToolError.COMMAND_FAILURE, "Fail 
+ to execute BPDG tool with exit code: %d, the error message is: \n %s" 
+ % \
 (PopenObject.returncode, str(error)))
 
 return PopenObject.returncode
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch 1/2] BaseTools: Add $(INC)-like support when compiling .nasm files

2018-10-25 Thread Zhu, Yonghong
Yes, I agree.  I will help to update a V2.

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, October 25, 2018 10:20 PM
To: Zhu, Yonghong ; edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: RE: [edk2] [Patch 1/2] BaseTools: Add $(INC)-like support when 
compiling .nasm files



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Yonghong Zhu
> Sent: Thursday, October 25, 2018 12:38 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch 1/2] BaseTools: Add $(INC)-like support when 
> compiling .nasm files
> 
> From: zhijufan 
> 
> current edk2\BaseTools\Conf\build_rule.template, the compile of nasm 
> source files does not have the $(INC) support.
> 
> The '-I' option only includes the directory of the nasm source file 
> (${s_path}(+)). Hence, it will be impossible for nasm files to include 
> files outside of the nasm source file directory.
> 
> As a comparison, the compile of both .s and .asm have $(INC) support 
> in their compile commands.
> 
> Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1085
> Cc: Liming Gao 
> Cc: Yonghong Zhu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Source/Python/AutoGen/GenMake.py | 14 +-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index d94d8f9..8860d50 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -165,11 +165,11 @@ class BuildFile(object):
>  _INCLUDE_CMD_ = {
>  "nmake" :   '!INCLUDE',
>  "gmake" :   "include"
>  }
> 
> -_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : "-I",
> "RVCT" : "-I"}
> +_INC_FLAG_ = {TAB_COMPILER_MSFT : "/I", "GCC" : "-I", "INTEL" : 
> + "-I",
> "RVCT" : "-I", "NASM" : "-I"}
> 
>  ## Constructor of BuildFile
>  #
>  #   @param  AutoGenObject   Object of AutoGen class
>  #
> @@ -594,10 +594,22 @@ cleanlib:
>  "macro_name"   : "INC",
>  "source_file" : 
> IncludePathList
>  }
>  )
>  FileMacroList.append(FileMacro)
> +for File in self.FileCache.keys():
> +if not str(File).endswith('.nasm'):
> +continue
> +FileMacro = ""
> +IncludePathList = []
> +for P in  MyAgo.IncludePathList:
> +IncludePathList.append(self._INC_FLAG_['NASM'] +
> self.PlaceMacro(P, self.Macros))
> +if FileBuildRule.INC_LIST_MACRO in self.ListFileMacros:
> +
> self.ListFileMacros[FileBuildRule.INC_LIST_MACRO].append(self._INC_FLA
> G
> _['NASM'] + P)
> +FileMacro +=
> self._FILE_MACRO_TEMPLATE.Replace({"macro_name": "NASM_INC",
> "source_file": IncludePathList})

Why do we use += on FileMacro here?  Seems like = will be fine.  We can also 
skip initializing the FileMacro since it's only ever assigned here.

> +FileMacroList.append(FileMacro)
> +break
> 
>  # Generate macros used to represent files containing list of input 
> files
>  for ListFileMacro in self.ListFileMacros:
>  ListFileName = os.path.join(MyAgo.OutputDir, "%s.lst" %
> ListFileMacro.lower()[:len(ListFileMacro) - 5])
>  FileMacroList.append("%s = %s" % (ListFileMacro, 
> ListFileName))
> --
> 2.6.1.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2] BaseTools: Allow multiple PciDeviceId in Fdf OptionROM override

2018-10-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tomas 
Pilar (tpilar)
Sent: Wednesday, October 24, 2018 7:43 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2] BaseTools: Allow multiple PciDeviceId in Fdf 
OptionROM override

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Tomas Pilar 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 63687e98bb..8f53fbeb55 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1,3 +1,4 @@
+
 ## @file
 # parse FDF file
 #
@@ -4469,10 +4470,15 @@ class FdfParser:
 if self.__IsKeyword( "PCI_DEVICE_ID"):
 if not self.__IsToken( "="):
 raise Warning("expected '='", self.FileName, 
self.CurrentLineNumber)
-if not self.__GetNextHexNumber():
-raise Warning("expected Hex device id", self.FileName, 
self.CurrentLineNumber)
 
-Overrides.PciDeviceId = self.__Token
+# Get a list of PCI IDs
+Overrides.PciDeviceId = ""
+
+while (self.__GetNextHexNumber()):
+Overrides.PciDeviceId = "{} 
{}".format(Overrides.PciDeviceId, self.__Token)
+
+if not Overrides.PciDeviceId:
+raise Warning("expected one or more Hex device ids", 
self.FileName, self.CurrentLineNumber)
 continue
 
 if self.__IsKeyword( "PCI_REVISION"):
-- 
2.17.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch v3 0/6] BaseTools/GenFds: cleanup GenFds

2018-10-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jaben 
Carsey
Sent: Wednesday, October 24, 2018 1:29 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch v3 0/6] BaseTools/GenFds: cleanup GenFds

Cleanup to many files for GenFds. No command line visible changes are included.
1) refactor imports to reduce namespace clutter.
2) refactor to use existing sharable objects (and create a few new)
3) eliminate shadowing of names
4) remove double underscored private methods for PEP8
5) eliminate unused code/parameters/variables
6) add standard warnings and use them for common code

changes from v1:
1) do not shadow CapsuleFV.
2) rebase on master

changes from v2:
1) do not delete duplicate function calls.
2) add ".lower()" for GUID string comparison.
3) rebase on master

Jaben Carsey (6):
  BaseTools/GenFds: cleanup GenFds
  BaseTools/GenFds: change objects to sets
  Basetools/GenFds: refactor class FV
  BaseTools/GenFds: remove MacroDict parameter
  BaseTools/GenFds: refactor FdfParser warnings
  BaseTools/GenFds: create and use new variable in FdfParser

 BaseTools/Source/Python/CommonDataClass/FdfClass.py|   73 -
 BaseTools/Source/Python/Eot/EotMain.py |  372 +-
 BaseTools/Source/Python/GenFds/AprioriSection.py   |   45 +-
 BaseTools/Source/Python/GenFds/Capsule.py  |   26 +-
 BaseTools/Source/Python/GenFds/CapsuleData.py  |1 -
 BaseTools/Source/Python/GenFds/CompressSection.py  |4 +-
 BaseTools/Source/Python/GenFds/DataSection.py  |4 +-
 BaseTools/Source/Python/GenFds/DepexSection.py |5 +-
 BaseTools/Source/Python/GenFds/EfiSection.py   |   16 +-
 BaseTools/Source/Python/GenFds/FdfParser.py| 3780 
++--
 BaseTools/Source/Python/GenFds/Ffs.py  |   82 +-
 BaseTools/Source/Python/GenFds/FfsFileStatement.py |   37 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  |   10 +-
 BaseTools/Source/Python/GenFds/Fv.py   |   54 +-
 BaseTools/Source/Python/GenFds/FvImageSection.py   |6 +-
 BaseTools/Source/Python/GenFds/GenFds.py   |  160 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py |  208 +-
 BaseTools/Source/Python/GenFds/GuidSection.py  |4 +-
 BaseTools/Source/Python/GenFds/OptionRom.py|6 +-
 BaseTools/Source/Python/GenFds/Region.py   |   12 +-
 BaseTools/Source/Python/GenFds/UiSection.py|4 +-
 BaseTools/Source/Python/GenFds/VerSection.py   |   16 +-
 BaseTools/Source/Python/GenFds/Vtf.py  |   48 +-
 BaseTools/Source/Python/build/BuildReport.py   |5 +-
 24 files changed, 2576 insertions(+), 2402 deletions(-)

--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/Ecc: Update a checkpoint criteria.

2018-10-23 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, October 16, 2018 4:25 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng 
Subject: [edk2] [PATCH] BaseTools/Ecc: Update a checkpoint criteria.

From: Hess Chen 

Change the criteria of the checkpoint of "#ifndef" to remove the requirement of 
prefix '_'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Ecc/Check.py| 2 +-
 BaseTools/Source/Python/Ecc/EccToolError.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index fc86ad96f2..3bf86b42cd 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -1374,7 +1374,7 @@ class Check(object):
 RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
 for Record in RecordSet:
 Name = Record[1].replace('#ifndef', '').strip()
-if Name[0] != '_' or Name[-1] != '_':
+if Name[-1] != '_':
 if not 
EccGlobalData.gException.IsException(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 Name):
 
EccGlobalData.gDb.TblReport.Insert(ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT,
 OtherMsg="The #ifndef name [%s] does not follow the rules" % (Name), 
BelongsToTable=FileTable, BelongsToItem=Record[0])
 
diff --git a/BaseTools/Source/Python/Ecc/EccToolError.py 
b/BaseTools/Source/Python/Ecc/EccToolError.py
index ae0a31af8a..e327a7888d 100644
--- a/BaseTools/Source/Python/Ecc/EccToolError.py
+++ b/BaseTools/Source/Python/Ecc/EccToolError.py
@@ -167,7 +167,7 @@ gEccErrorMessage = {
 ERROR_NAMING_CONVENTION_CHECK_ALL : "",
 ERROR_NAMING_CONVENTION_CHECK_DEFINE_STATEMENT : "Only capital letters are 
allowed to be used for #define declarations",
 ERROR_NAMING_CONVENTION_CHECK_TYPEDEF_STATEMENT : "Only capital letters 
are allowed to be used for typedef declarations",
-ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start 
of an include file should use both prefix and postfix underscore characters, 
'_'",
+ERROR_NAMING_CONVENTION_CHECK_IFNDEF_STATEMENT : "The #ifndef at the start 
of an include file should use a postfix underscore characters, '_'",
 ERROR_NAMING_CONVENTION_CHECK_PATH_NAME : """Path name does not follow the 
rules: 1. First character should be upper case 2. Must contain lower case 
characters 3. No white space characters""",
 ERROR_NAMING_CONVENTION_CHECK_VARIABLE_NAME : """Variable name does not 
follow the rules: 1. First character should be upper case 2. Must contain lower 
case characters 3. No white space characters 4. Global variable name must start 
with a 'g'""",
 ERROR_NAMING_CONVENTION_CHECK_FUNCTION_NAME : """Function name does not 
follow the rules: 1. First character should be upper case 2. Must contain lower 
case characters 3. No white space characters""",
-- 
2.14.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typedef function.

2018-10-23 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, October 16, 2018 4:24 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng 
Subject: [edk2] [PATCH] BaseTools/ECC: Fix an identification issue of typedef 
function.

From: Hess Chen 

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Ecc/Check.py | 12 +++-
 BaseTools/Source/Python/Ecc/c.py |  8 ++--
 2 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index 3bf86b42cd..eb086362bd 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -586,13 +586,23 @@ class Check(object):
 if EccGlobalData.gConfig.IncludeFileCheckData == '1' or 
EccGlobalData.gConfig.IncludeFileCheckAll == '1' or 
EccGlobalData.gConfig.CheckAll == '1':
 EdkLogger.quiet("Checking header file data ...")
 
+# Get all typedef functions
+gAllTypedefFun = []
+for IdentifierTable in EccGlobalData.gIdentifierTableList:
+SqlCommand = """select Name from %s
+where Model = %s """ % (IdentifierTable, 
MODEL_IDENTIFIER_TYPEDEF)
+RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+for Record in RecordSet:
+if Record[0].startswith('('):
+gAllTypedefFun.append(Record[0])
+
 #for Dirpath, Dirnames, Filenames in self.WalkTree():
 #for F in Filenames:
 #if os.path.splitext(F)[1] in ('.h'):
 #FullName = os.path.join(Dirpath, F)
 #MsgList = c.CheckHeaderFileData(FullName)
 for FullName in EccGlobalData.gHFileList:
-MsgList = c.CheckHeaderFileData(FullName)
+MsgList = c.CheckHeaderFileData(FullName, 
+ gAllTypedefFun)
 
 # Doxygen document checking
 def DoxygenCheck(self):
diff --git a/BaseTools/Source/Python/Ecc/c.py b/BaseTools/Source/Python/Ecc/c.py
index 953f1630b6..b8d6adde16 100644
--- a/BaseTools/Source/Python/Ecc/c.py
+++ b/BaseTools/Source/Python/Ecc/c.py
@@ -2144,7 +2144,7 @@ def CheckBooleanValueComparison(FullFileName):
 
PrintErrorMsg(ERROR_PREDICATE_EXPRESSION_CHECK_BOOLEAN_VALUE, 'Predicate 
Expression: %s' % Exp, FileTable, Str[2])
 
 
-def CheckHeaderFileData(FullFileName):
+def CheckHeaderFileData(FullFileName, AllTypedefFun=[]):
 ErrorMsgList = []
 
 FileID = GetTableID(FullFileName, ErrorMsgList) @@ -2160,7 +2160,11 @@ def 
CheckHeaderFileData(FullFileName):
 ResultSet = Db.TblFile.Exec(SqlStatement)
 for Result in ResultSet:
 if not Result[1].startswith('extern'):
-PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable definition 
appears in header file', FileTable, Result[0])
+for Item in AllTypedefFun:
+if '(%s)' % Result[1] in Item:
+break
+else:
+PrintErrorMsg(ERROR_INCLUDE_FILE_CHECK_DATA, 'Variable 
+ definition appears in header file', FileTable, Result[0])
 
 SqlStatement = """ select ID
from Function
--
2.14.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/UPT: Fix an issue of UNI string checking.

2018-10-23 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, October 16, 2018 4:29 PM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng 
Subject: [edk2] [PATCH] BaseTools/UPT: Fix an issue of UNI string checking.

From: Hess Chen 

The tool now can detect the error that the content between double quotes 
contains another double quotes or enter key.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 .../Source/Python/UPT/Library/UniClassObject.py| 23 ++
 1 file changed, 23 insertions(+)

diff --git a/BaseTools/Source/Python/UPT/Library/UniClassObject.py 
b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
index 670cf3b4ee..cd575d5a34 100644
--- a/BaseTools/Source/Python/UPT/Library/UniClassObject.py
+++ b/BaseTools/Source/Python/UPT/Library/UniClassObject.py
@@ -566,6 +566,22 @@ class UniFileClassObject(object):
 if Line.startswith(u'#language') and len(Line.split()) == 2:
 MultiLineFeedExits = True
 
+#
+# Check the situation that there only has one '"' for the language 
entry
+#
+if Line.startswith(u'#string') and Line.find(u'#language') > 0 and 
Line.count(u'"') == 1:
+EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
+ExtraData='''The line %s misses '"' at the end 
of it in file %s'''
+% (LineCount, File.Path))
+
+#
+# Check the situation that there has more than 2 '"' for the 
language entry
+#
+if Line.startswith(u'#string') and Line.find(u'#language') > 0 and 
Line.replace(u'\\"', '').count(u'"') > 2:
+EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
+ExtraData='''The line %s has more than 2 '"' 
for language entry in file %s'''
+% (LineCount, File.Path))
+
 #
 # Between two String entry, can not contain line feed
 #
@@ -727,6 +743,13 @@ class UniFileClassObject(object):
 else:
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID, ExtraData=File.Path)
 elif Line.startswith(u'"'):
+#
+# Check the situation that there has more than 2 '"' for the 
language entry
+#
+if Line.replace(u'\\"', '').count(u'"') > 2:
+EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID,
+ExtraData='''The line %s has more than 2 
'"' for language entry in file %s'''
+% (LineCount, File.Path))
 if u'#string' in Line  or u'#language' in Line:
 EdkLogger.Error("Unicode File Parser", 
ToolError.FORMAT_INVALID, ExtraData=File.Path)
 NewLines.append(Line)
--
2.14.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] BaseTools/ECC: Add a checkpoint to check no usage for deprecated functions.

2018-10-23 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Thursday, October 18, 2018 9:20 AM
To: edk2-devel@lists.01.org
Cc: Chen, Hesheng 
Subject: [edk2] [PATCH V2] BaseTools/ECC: Add a checkpoint to check no usage 
for deprecated functions.

From: Hess Chen 

V2: change list to set

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen 
---
 BaseTools/Source/Python/Ecc/Check.py | 60 
 BaseTools/Source/Python/Ecc/Configuration.py |  3 ++  
BaseTools/Source/Python/Ecc/EccToolError.py  |  2 +
 BaseTools/Source/Python/Ecc/config.ini   |  2 +
 4 files changed, 67 insertions(+)

diff --git a/BaseTools/Source/Python/Ecc/Check.py 
b/BaseTools/Source/Python/Ecc/Check.py
index eb086362bd..d2192d10cb 100644
--- a/BaseTools/Source/Python/Ecc/Check.py
+++ b/BaseTools/Source/Python/Ecc/Check.py
@@ -270,6 +270,66 @@ class Check(object):
 self.FunctionLayoutCheckPrototype()
 self.FunctionLayoutCheckBody()
 self.FunctionLayoutCheckLocalVariable()
+self.FunctionLayoutCheckDeprecated()
+
+# To check if the deprecated functions are used
+def FunctionLayoutCheckDeprecated(self):
+if EccGlobalData.gConfig.CFunctionLayoutCheckNoDeprecated == '1' or 
EccGlobalData.gConfig.CFunctionLayoutCheckAll == '1' or 
EccGlobalData.gConfig.CheckAll == '1':
+EdkLogger.quiet("Checking function no deprecated one being 
+ used ...")
+
+DeprecatedFunctionSet = ('UnicodeValueToString',
+ 'AsciiValueToString',
+ 'StrCpy',
+ 'StrnCpy',
+ 'StrCat',
+ 'StrnCat',
+ 'UnicodeStrToAsciiStr',
+ 'AsciiStrCpy',
+ 'AsciiStrnCpy',
+ 'AsciiStrCat',
+ 'AsciiStrnCat',
+ 'AsciiStrToUnicodeStr',
+ 'PcdSet8',
+ 'PcdSet16',
+ 'PcdSet32',
+ 'PcdSet64',
+ 'PcdSetPtr',
+ 'PcdSetBool',
+ 'PcdSetEx8',
+ 'PcdSetEx16',
+ 'PcdSetEx32',
+ 'PcdSetEx64',
+ 'PcdSetExPtr',
+ 'PcdSetExBool',
+ 'LibPcdSet8',
+ 'LibPcdSet16',
+ 'LibPcdSet32',
+ 'LibPcdSet64',
+ 'LibPcdSetPtr',
+ 'LibPcdSetBool',
+ 'LibPcdSetEx8',
+ 'LibPcdSetEx16',
+ 'LibPcdSetEx32',
+ 'LibPcdSetEx64',
+ 'LibPcdSetExPtr',
+ 'LibPcdSetExBool',
+ 'GetVariable',
+ 'GetEfiGlobalVariable',
+ )
+
+for IdentifierTable in EccGlobalData.gIdentifierTableList:
+SqlCommand = """select ID, Name, BelongsToFile from %s
+where Model = %s """ % (IdentifierTable, 
MODEL_IDENTIFIER_FUNCTION_CALLING)
+RecordSet = EccGlobalData.gDb.TblFile.Exec(SqlCommand)
+for Record in RecordSet:
+for Key in DeprecatedFunctionSet:
+if Key == Record[1]:
+if not 
EccGlobalData.gException.IsException(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE,
 Key):
+OtherMsg = 'The function [%s] is deprecated 
which should NOT be used' % Key
+
EccGlobalData.gDb.TblReport.Insert(ERROR_C_FUNCTION_LAYOUT_CHECK_NO_DEPRECATE,
+   
OtherMsg=OtherMsg,
+   
BelongsToTable=IdentifierTable,
+   
+ BelongsToItem=Record[0])
 
 def WalkTree(self):
 IgnoredPattern = c.GetIgnoredDirListPattern() diff --git 
a/BaseTools/Source/Python/Ecc/Configuration.py 
b/BaseTools/Source/Python/Ecc/Configuration.py
index c19a3990c7..

Re: [edk2] [PATCH v1 1/1] BaseTools: delete unused file

2018-10-21 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, October 11, 2018 7:30 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 1/1] BaseTools: delete unused file

this file is not imported/used.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/Database.py | 120 
 1 file changed, 120 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Database.py 
b/BaseTools/Source/Python/Common/Database.py
deleted file mode 100644
index 1c543aeb41b1..
--- a/BaseTools/Source/Python/Common/Database.py
+++ /dev/null
@@ -1,120 +0,0 @@
-## @file
-# This file is used to create a database used by ECC tool -# -# Copyright (c) 
2007 - 2018, 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 Modules
-#
-from __future__ import absolute_import
-import sqlite3
-import Common.LongFilePathOs as os
-
-from . import EdkLogger as EdkLogger
-from CommonDataClass.DataClass import * -from .StringUtils import * -from 
.DataType import *
-
-from Table.TableDataModel import TableDataModel -from Table.TableFile import 
TableFile -from Table.TableInf import TableInf -from Table.TableDec import 
TableDec -from Table.TableDsc import TableDsc
-
-## Database
-#
-# This class defined the build databse
-# During the phase of initialization, the database will create all tables and 
-# insert all records of table DataModel -#
-# @param object:  Inherited from object class
-# @param DbPath:  A string for the path of the ECC database
-#
-# @var Conn:  Connection of the ECC database
-# @var Cur:   Cursor of the connection
-# @var TblDataModel:  Local instance for TableDataModel -# -class 
Database(object):
-def __init__(self, DbPath):
-if os.path.exists(DbPath):
-os.remove(DbPath)
-self.Conn = sqlite3.connect(DbPath, isolation_level = 'DEFERRED')
-self.Conn.execute("PRAGMA page_size=8192")
-self.Conn.execute("PRAGMA synchronous=OFF")
-self.Cur = self.Conn.cursor()
-self.TblDataModel = TableDataModel(self.Cur)
-self.TblFile = TableFile(self.Cur)
-self.TblInf = TableInf(self.Cur)
-self.TblDec = TableDec(self.Cur)
-self.TblDsc = TableDsc(self.Cur)
-
-## Initialize build database
-#
-# 1. Delete all old existing tables
-# 2. Create new tables
-# 3. Initialize table DataModel
-#
-def InitDatabase(self):
-EdkLogger.verbose("\nInitialize ECC database started ...")
-#
-# Drop all old existing tables
-#
-#self.TblDataModel.Drop()
-#self.TblDsc.Drop()
-#self.TblFile.Drop()
-
-#
-# Create new tables
-#
-self.TblDataModel.Create()
-self.TblFile.Create()
-self.TblInf.Create()
-self.TblDec.Create()
-self.TblDsc.Create()
-
-#
-# Initialize table DataModel
-#
-self.TblDataModel.InitTable()
-EdkLogger.verbose("Initialize ECC database ... DONE!")
-
-## Query a table
-#
-# @param Table:  The instance of the table to be queried
-#
-def QueryTable(self, Table):
-Table.Query()
-
-## Close entire database
-#
-# Commit all first
-# Close the connection and cursor
-#
-def Close(self):
-self.Conn.commit()
-self.Cur.close()
-self.Conn.close()
-
-##
-#
-# This acts like the main() function for the script, unless it is 'import'ed 
into another -# script.
-#
-if __name__ == '__main__':
-EdkLogger.Initialize()
-EdkLogger.SetLevel(EdkLogger.DEBUG_0)
-
-Db = Database(DATABASE_PATH)
-Db.InitDatabase()
-Db.QueryTable(Db.TblDataModel)
-Db.QueryTable(Db.TblFile)
-Db.QueryTable(Db.TblDsc)
-Db.Close()
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fixed a key error code bug.

2018-10-21 Thread Zhu, Yonghong
Hi Bob,

I fixed this issue by below patch,  I will check in the patch soon.
https://lists.01.org/pipermail/edk2-devel/2018-October/031161.html 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of BobCF
Sent: Sunday, October 21, 2018 7:42 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Fixed a key error code bug.

There is a code bug that used a wrong key. This Patch is to correct it.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f2146a7790..87d6107035 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -567,12 +567,12 @@ class WorkspaceAutoGen(AutoGen):
 if (Name, Guid) not in DecPcds:
 EdkLogger.error(
 'build',
 PARSER_ERROR,
 "PCD (%s.%s) used in FDF is not declared in DEC 
files." % (Guid, Name),
-File = self.FdfProfile.PcdFileLineDict[Name, Guid][0],
-Line = self.FdfProfile.PcdFileLineDict[Name, Guid][1]
+File = self.FdfProfile.PcdFileLineDict[Name, 
Guid,Fileds][0],
+Line = self.FdfProfile.PcdFileLineDict[Name, 
+ Guid,Fileds][1]
 )
 else:
 # Check whether Dynamic or DynamicEx PCD used in FDF file. 
If used, build break and give a error message.
 if (Name, Guid, TAB_PCDS_FIXED_AT_BUILD) in DecPcdsKey \
 or (Name, Guid, TAB_PCDS_PATCHABLE_IN_MODULE) in 
DecPcdsKey \ @@ -581,12 +581,12 @@ class WorkspaceAutoGen(AutoGen):
 elif (Name, Guid, TAB_PCDS_DYNAMIC) in DecPcdsKey or 
(Name, Guid, TAB_PCDS_DYNAMIC_EX) in DecPcdsKey:
 EdkLogger.error(
 'build',
 PARSER_ERROR,
 "Using Dynamic or DynamicEx type of PCD 
[%s.%s] in FDF file is not allowed." % (Guid, Name),
-File = self.FdfProfile.PcdFileLineDict[Name, 
Guid][0],
-Line = self.FdfProfile.PcdFileLineDict[Name, 
Guid][1]
+File = self.FdfProfile.PcdFileLineDict[Name, 
Guid,Fileds][0],
+Line = 
+ self.FdfProfile.PcdFileLineDict[Name, Guid,Fileds][1]
 )
 
 Pa = PlatformAutoGen(self, self.MetaFile, Target, Toolchain, Arch)
 #
 # Explicitly collect platform's dynamic PCDs
--
2.18.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] BaseTools: Update Makefile to exclude deleted file.

2018-10-18 Thread Zhu, Yonghong
Hi Marvin Häuser,

Liming sent some mail to notice that we drop the support of BaseTools Python 
run from the freeze binary in Windows OS, and he also sent patch to remove the 
steps to freeze python tool. So I don't think we need this patch now, please 
check it. Thanks.

https://lists.01.org/pipermail/edk2-devel/2018-September/029436.html 
 https://lists.01.org/pipermail/edk2-devel/2018-October/030969.html 
https://lists.01.org/pipermail/edk2-devel/2018-October/030589.html 

Best Regards,
Zhu Yonghong

-Original Message-
From: Marvin Häuser [mailto:marvin.haeu...@outlook.com] 
Sent: Monday, October 15, 2018 11:33 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH 1/1] BaseTools: Update Makefile to exclude deleted file.

GenFds/Attributes.py has been deleted in 1ad635b, but was not removed from the 
Python Makefile. Remove it for successful compilation on Windows.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 BaseTools/Source/Python/Makefile | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/Python/Makefile b/BaseTools/Source/Python/Makefile
index ac99259eb18a..2a80f1cf7fe9 100644
--- a/BaseTools/Source/Python/Makefile
+++ b/BaseTools/Source/Python/Makefile
@@ -114,7 +114,6 @@ 
CMD_BUILD=$(BASE_TOOLS_PATH)\Source\Python\build\BuildReport.py \
 $(BASE_TOOLS_PATH)\Source\Python\Eot\Report.py
 
 CMD_GENFDS=$(BASE_TOOLS_PATH)\Source\Python\GenFds\AprioriSection.py \
-$(BASE_TOOLS_PATH)\Source\Python\GenFds\Attribute.py \
 $(BASE_TOOLS_PATH)\Source\Python\GenFds\Capsule.py \
 $(BASE_TOOLS_PATH)\Source\Python\GenFds\CapsuleData.py \
 $(BASE_TOOLS_PATH)\Source\Python\GenFds\ComponentStatement.py \
--
2.19.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] FDF Specification Updates for PI 1.6 Standalone MM Components

2018-10-18 Thread Zhu, Yonghong
Got you. Thanks.
I will send out FDF spec update patch in recent days.
After that, you can get the latest draft revisions from 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Draft-Specification

Best Regards,
Zhu Yonghong

From: Cohen, Eugene [mailto:eug...@hp.com]
Sent: Thursday, October 18, 2018 11:17 PM
To: Zhu, Yonghong ; edk2-devel@lists.01.org; Shaw, 
Kevin W 
Subject: RE: FDF Specification Updates for PI 1.6 Standalone MM Components

Zhu Yonghong,

I was about to file one and then saw that one already exists:

https://bugzilla.tianocore.org/show_bug.cgi?id=551

This was created in May 2017.  So I guess my original question still applies: 
is there a plan (namely "when") for when this will get updated? :)

Thanks,

Eugene


From: edk2-devel 
mailto:edk2-devel-boun...@lists.01.org>> On 
Behalf Of Zhu, Yonghong
Sent: Wednesday, October 17, 2018 7:48 PM
To: Cohen, Eugene mailto:eug...@hp.com>>; 
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Shaw, Kevin W 
mailto:kevin.w.s...@intel.com>>
Subject: Re: [edk2] FDF Specification Updates for PI 1.6 Standalone MM 
Components

Hi Eugene,

Could you help to file a bugzilla ? thanks.
Refer to https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Issues

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, 
Eugene
Sent: Thursday, October 18, 2018 1:11 AM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Shaw, Kevin W 
mailto:kevin.w.s...@intel.com>>
Subject: [edk2] FDF Specification Updates for PI 1.6 Standalone MM Components

The FDF spec appears to be missing definitions for the new PI 1.6 component 
types like MM_CORE_STANDALONE and MM_STANDALONE.

Is there a plan to update the spec to reflect these new types?

See 
https://edk2-docs.gitbooks.io/edk-ii-fdf-specification/content/v/release/1.28/3_edk_ii_fdf_file_format/39_[rule]_sections.html#39-rule-sections<https://edk2-docs.gitbooks.io/edk-ii-fdf-specification/content/v/release/1.28/3_edk_ii_fdf_file_format/39_%5brule%5d_sections.html#39-rule-sections>


Thanks,

Eugene

___
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix one crash bug in the report for Fixed structure Pcd

2018-10-18 Thread Zhu, Yonghong
Yes. Thanks for the comment. I will update it when push it.

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, October 18, 2018 10:36 PM
To: Zhu, Yonghong ; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools: Fix one crash bug in the report for 
Fixed structure Pcd

Reviewed-by: Jaben Carsey 

Note that you could change your first 2 lines (of the new content in both 
places) to:
for Data in OverrideValues.values():

since you don't ever use the key later on...

-Jaben

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Yonghong Zhu
> Sent: Thursday, October 18, 2018 7:25 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [Patch] BaseTools: Fix one crash bug in the report for 
> Fixed structure Pcd
> 
> The case is:
> in the DSC file:
> SKUID_IDENTIFIER   = ALL
> 
> [SkuIds]
>   0|DEFAULT
>   1|A
> 
> [PcdsFixedAtBuild.common.A]
>   TokenSpaceGuid.Test401|{0x0F, 0x12}
>   TokenSpaceGuid.Test401.TEST401INT8ARRAY[0]|'B'
> 
> in the build report, Data = OverrideValues[Keys[0]], but the Keys[0] 
> is the keyword "DEFAULT", and in this case the "DEFAULT" SKU doesn't 
> save any value, then it cause the Data is empty, in the next code when 
> we use the code it cause crash.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu 
> ---
>  BaseTools/Source/Python/build/BuildReport.py | 23 
> +
> --
>  1 file changed, 13 insertions(+), 10 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/build/BuildReport.py
> b/BaseTools/Source/Python/build/BuildReport.py
> index 14143b3..5e2a664 100644
> --- a/BaseTools/Source/Python/build/BuildReport.py
> +++ b/BaseTools/Source/Python/build/BuildReport.py
> @@ -1089,14 +1089,16 @@ class PcdReport(object):
>  DscOverride = False
>  else:
>  if not Pcd.SkuInfoList:
>  OverrideValues = Pcd.SkuOverrideValues
>  if OverrideValues:
> -Keys = list(OverrideValues.keys())
> -Data = OverrideValues[Keys[0]]
> -Struct = list(Data.values())
> -DscOverride = 
> self.ParseStruct(Struct[0])
> +for key in OverrideValues.keys():
> +Data = OverrideValues[key]
> +Struct = list(Data.values())
> +if Struct:
> +DscOverride = 
> self.ParseStruct(Struct[0])
> +break
>  else:
>  SkuList = sorted(Pcd.SkuInfoList.keys())
>  for Sku in SkuList:
>  SkuInfo = Pcd.SkuInfoList[Sku]
>  if TypeName in ('DYNHII', 'DEXHII'):
> @@ -1265,16 +1267,17 @@ class PcdReport(object):
>  Value = "0x{:X} ({})".format(int(Value, 0), Value)
>  FileWrite(File, ' %-*s   : %6s %10s = %s' % (self.MaxLen, 
> Flag + ' ' +
> PcdTokenCName, TypeName, '(' + Pcd.DatumType + ')', Value))
>  if IsStructure:
>  OverrideValues = Pcd.SkuOverrideValues
>  if OverrideValues:
> -Keys = list(OverrideValues.keys())
> -Data = OverrideValues[Keys[0]]
> -Struct = list(Data.values())
> -if Struct:
> -OverrideFieldStruct = self.OverrideFieldValue(Pcd, 
> Struct[0])
> -self.PrintStructureInfo(File, OverrideFieldStruct)
> +for key in OverrideValues.keys():
> +Data = OverrideValues[key]
> +Struct = list(Data.values())
> +if Struct:
> +OverrideFieldStruct = 
> self.OverrideFieldValue(Pcd, Struct[0])
> +self.PrintStructureInfo(File, 
> OverrideFieldStruct)
> +break
>  self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, 
> DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue)
>  else:
>  FirstPrint = True
>  SkuList = sorted(Pcd.SkuInfoList.keys())
>  for Sku in S

Re: [edk2] [Patch 3/3] BaseTools: Add more checker in Decompress algorithm to access the valid buffer

2018-10-18 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Tuesday, October 16, 2018 10:06 AM
To: edk2-devel@lists.01.org
Cc: Holtsclaw, Brent 
Subject: [edk2] [Patch 3/3] BaseTools: Add more checker in Decompress algorithm 
to access the valid buffer

https://bugzilla.tianocore.org/show_bug.cgi?id=686

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Holtsclaw Brent 
Signed-off-by: Liming Gao 
---
 BaseTools/Source/C/Common/Decompress.c   | 23 +++--
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 26 +++-
 2 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/C/Common/Decompress.c 
b/BaseTools/Source/C/Common/Decompress.c
index 9906888..71313b1 100644
--- a/BaseTools/Source/C/Common/Decompress.c
+++ b/BaseTools/Source/C/Common/Decompress.c
@@ -194,12 +194,16 @@ Returns:
   UINT16  Avail;
   UINT16  NextCode;
   UINT16  Mask;
+  UINT16  MaxTableLength;
 
   for (Index = 1; Index <= 16; Index++) {
 Count[Index] = 0;
   }
 
   for (Index = 0; Index < NumOfChar; Index++) {
+if (BitLen[Index] > 16) {
+  return (UINT16) BAD_TABLE;
+}
 Count[BitLen[Index]]++;
   }
 
@@ -237,6 +241,7 @@ Returns:
 
   Avail = NumOfChar;
   Mask  = (UINT16) (1U << (15 - TableBits));
+  MaxTableLength = (UINT16) (1U << TableBits);
 
   for (Char = 0; Char < NumOfChar; Char++) {
 
@@ -250,6 +255,9 @@ Returns:
 if (Len <= TableBits) {
 
   for (Index = Start[Len]; Index < NextCode; Index++) {
+if (Index >= MaxTableLength) {
+  return (UINT16) BAD_TABLE;
+}
 Table[Index] = Char;
   }
 
@@ -643,10 +651,14 @@ Returns: (VOID)
 
   BytesRemain--;
   while ((INT16) (BytesRemain) >= 0) {
-Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
 if (Sd->mOutBuf >= Sd->mOrigSize) {
   return ;
 }
+if (DataIdx >= Sd->mOrigSize) {
+  Sd->mBadTableFlag = (UINT16) BAD_TABLE;
+  return ;
+}
+Sd->mDstBase[Sd->mOutBuf++] = Sd->mDstBase[DataIdx++];
 
 BytesRemain--;
   }
@@ -684,6 +696,7 @@ Returns:
 --*/
 {
   UINT8 *Src;
+  UINT32 CompSize;
 
   *ScratchSize  = sizeof (SCRATCH_DATA);
 
@@ -692,7 +705,13 @@ Returns:
 return EFI_INVALID_PARAMETER;
   }
 
+  CompSize = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
   *DstSize = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+
+  if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
+return EFI_INVALID_PARAMETER;
+  }
+
   return EFI_SUCCESS;
 }
 
@@ -752,7 +771,7 @@ Returns:
   CompSize  = Src[0] + (Src[1] << 8) + (Src[2] << 16) + (Src[3] << 24);
   OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
 
-  if (SrcSize < CompSize + 8) {
+  if (SrcSize < CompSize + 8 || (CompSize + 8) < 8) {
 return EFI_INVALID_PARAMETER;
   }
 
diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index b88d7da..2d6fc4c 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -1757,6 +1757,7 @@ Returns:
   SCRATCH_DATA  *Scratch;
   UINT8  *Src;
   UINT32 OrigSize;
+  UINT32 CompSize;
 
   SetUtilityName(UTILITY_NAME);
 
@@ -1765,6 +1766,7 @@ Returns:
   OutBuffer = NULL;
   Scratch   = NULL;
   OrigSize = 0;
+  CompSize = 0;
   InputLength = 0;
   InputFileName = NULL;
   OutputFileName = NULL;
@@ -2006,15 +2008,24 @@ Returns:
 }
 fwrite(OutBuffer, (size_t)(DstSize), 1, OutputFile);
   } else {
+if (InputLength < 8){
+  Error (NULL, 0, 3000, "Invalid", "The input file %s is too small.", 
InputFileName);
+  goto ERROR;
+}
 //
 // Get Compressed file original size
 //
 Src = (UINT8 *)FileBuffer;
 OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
+CompSize  = Src[0] + (Src[1] << 8) + (Src[2] <<16) + (Src[3] <<24);
 
 //
 // Allocate OutputBuffer
 //
+if (InputLength < CompSize + 8 || (CompSize + 8) < 8) {
+  Error (NULL, 0, 3000, "Invalid", "The input file %s data is invalid.", 
InputFileName);
+  goto ERROR;
+}
 OutBuffer = (UINT8 *)malloc(OrigSize);
 if (OutBuffer == NULL) {
   Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!"); @@ 
-2204,12 +2215,16 @@ Returns:
   UINT16  Mask;
   UINT16  WordOfStart;
   UINT16  WordOfCount;
+  UINT16  MaxTableLength;
 
   for (Index = 0; Index <= 16; Index++) {
 Count[Index] = 0;
   }
 
   for (Index = 0; Index < NumOfChar; Index++) {
+if (Bi

Re: [edk2] FDF Specification Updates for PI 1.6 Standalone MM Components

2018-10-17 Thread Zhu, Yonghong
Hi Eugene,

Could you help to file a bugzilla ? thanks.
Refer to https://github.com/tianocore/tianocore.github.io/wiki/Reporting-Issues 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Cohen, 
Eugene
Sent: Thursday, October 18, 2018 1:11 AM
To: edk2-devel@lists.01.org; Shaw, Kevin W 
Subject: [edk2] FDF Specification Updates for PI 1.6 Standalone MM Components

The FDF spec appears to be missing definitions for the new PI 1.6 component 
types like MM_CORE_STANDALONE and MM_STANDALONE.

Is there a plan to update the spec to reflect these new types? 

See 
https://edk2-docs.gitbooks.io/edk-ii-fdf-specification/content/v/release/1.28/3_edk_ii_fdf_file_format/39_[rule]_sections.html#39-rule-sections


Thanks,

Eugene

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Remove the step to freeze python tool

2018-10-17 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Gao, Liming 
Sent: Tuesday, October 16, 2018 11:09 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] BaseTools: Remove the step to freeze python tool

https://bugzilla.tianocore.org/show_bug.cgi?id=1257
Binary python tool is not supported anymore. So, the freeze python tool step is 
not required.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 BaseTools/BuildNotes.txt  |   3 +-
 BaseTools/Makefile|   4 +-
 BaseTools/ReadMe.txt  |   1 -
 BaseTools/Scripts/ShowEnvironment.bat |   1 -
 BaseTools/Source/Python/Makefile  | 315 --
 BaseTools/Source/Python/UPT/Makefile  |  41 -
 BaseTools/toolsetup.bat   |  36 +---
 7 files changed, 4 insertions(+), 397 deletions(-)  delete mode 100644 
BaseTools/Source/Python/UPT/Makefile

diff --git a/BaseTools/BuildNotes.txt b/BaseTools/BuildNotes.txt index 
0d77df0..e2b10fd 100644
--- a/BaseTools/BuildNotes.txt
+++ b/BaseTools/BuildNotes.txt
@@ -13,8 +13,7 @@ Quick Start
 ---
 
 Windows:
-  a) Set the PYTHON_FREEZER_PATH to the cx_Freeze installation directory
-  b) Go to the /BaseTools and run "toolsetup" script
+  a) Go to the /BaseTools and run "toolsetup" 
+ script
 
 Unix-like:
   a) make -C /BaseTools diff --git a/BaseTools/Makefile 
b/BaseTools/Makefile index b98cd85..e6932c7 100644
--- a/BaseTools/Makefile
+++ b/BaseTools/Makefile
@@ -17,13 +17,11 @@
 
 SUBDIRS = $(BASE_TOOLS_PATH)\Source\C $(BASE_TOOLS_PATH)\Source\Python
 
-all: c python
+all: c
 
 c :
   @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
$(BASE_TOOLS_PATH)\Source\C
 
-python:
-  @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all 
$(BASE_TOOLS_PATH)\Source\Python
 
 subdirs: $(SUBDIRS)
   @$(PYTHON_HOME)\python.exe 
$(BASE_TOOLS_PATH)\Source\C\Makefiles\NmakeSubdirs.py  all $** diff --git 
a/BaseTools/ReadMe.txt b/BaseTools/ReadMe.txt index db632f7..7d0486b 100644
--- a/BaseTools/ReadMe.txt
+++ b/BaseTools/ReadMe.txt
@@ -16,7 +16,6 @@ In addition to this, you should set the following environment 
variables:
  * EDK_TOOLS_PATH - Path to the BaseTools sub directory under the edk2 tree
  * BASE_TOOLS_PATH - The directory where the BaseTools source is located.
(It is the same directory where this README.txt is located.)
- * PYTHON_FREEZER_PATH - Path to where the python freezer tool is installed
 
 After this, you can run the toolsetup.bat file, which is in the same  
directory as this file.  It should setup the remainder of the environment, diff 
--git a/BaseTools/Scripts/ShowEnvironment.bat 
b/BaseTools/Scripts/ShowEnvironment.bat
index 5dd30b4..759a74d 100755
--- a/BaseTools/Scripts/ShowEnvironment.bat
+++ b/BaseTools/Scripts/ShowEnvironment.bat
@@ -52,7 +52,6 @@ if defined SRC_CONF @goto SetEnv
 @if not defined EDK_TOOLS_PATH @echo EDK_TOOLS_PATH   = Not Set
 @if defined BASE_TOOLS_PATH @echo BASE_TOOLS_PATH  = %BASE_TOOLS_PATH%
 @if defined EDK_TOOLS_BIN @echo EDK_TOOLS_BIN= %EDK_TOOLS_BIN%
-@if defined PYTHON_FREEZER_PATH @echo PYTHON_FREEZER_PATH  = 
%PYTHON_FREEZER_PATH%
 @if "%NT32PKG%"=="TRUE" (
 @echo.
 @echo NOTE: Please configure your build to use the following 
TOOL_CHAIN_TAG diff --git a/BaseTools/Source/Python/Makefile 
b/BaseTools/Source/Python/Makefile
index ac99259..b413d23 100644
--- a/BaseTools/Source/Python/Makefile
+++ b/BaseTools/Source/Python/Makefile
@@ -11,324 +11,9 @@
 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #
 
-!IFNDEF PYTHON_HOME
-!ERROR PYTHON_HOME must be defined!
-!ENDIF
-
-!IFDEF PYTHON_FREEZER_PATH
-!IF EXIST ($(PYTHON_FREEZER_PATH)\cxfreeze) -# Using cx_Freeze 4.2.3 with 
Python 2.7.2 -FREEZE=$(PYTHON_HOME)\python $(PYTHON_FREEZER_PATH)\cxfreeze 
-!ELSE -!ERROR PYTHON_FREEZER_PATH does not exist!
-!ENDIF
-!ENDIF
-
-MODULES=encodings.cp437,encodings.gbk,encodings.utf_16,encodings.utf_8,encodings.utf_16_le,encodings.latin_1,encodings.ascii
-
-# DOS del command doesn't support ":\\" in the file path, such as 
j:\\BaseTools. Convert ":\\" to ":\"
-BASE_TOOLS_PATH = $(BASE_TOOLS_PATH::\\=:\) -EDK_TOOLS_PATH  = 
$(EDK_TOOLS_PATH::\\=:\)
-
-BIN_DIR=$(EDK_TOOLS_PATH)\Bin\Win32
-
-APPLICATIONS=$(BIN_DIR)\build.exe $(BIN_DIR)\GenFds.exe $(BIN_DIR)\Trim.exe 
$(BIN_DIR)\TargetTool.exe $(BIN_DIR)\GenDepex.exe 
$(BIN_DIR)\GenPatchPcdTable.exe $(BIN_DIR)\PatchPcdValue.exe 
$(BIN_DIR)\BPDG.exe $(BIN_DIR)\UPT.exe $(BIN_DIR)\Rsa2048Sha256Sign.exe 
$(BIN_DIR)\Rsa2048Sha256GenerateKeys.exe $(BIN_DIR)\Pkcs7Sign.exe 
$(BIN_DIR)\Ecc.exe
-
-COMMON_PYTHON=$(BASE_TOOLS_PATH)\Source\Python\Common\BuildToolError.py \
-  $(BASE_TOOLS_PATH)\Source\Python\Common\Database.p

Re: [edk2] [PATCH] BaseTools/EOT: Change to call a program instead of calling Python API.

2018-10-16 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Tuesday, October 16, 2018 5:42 AM
To: Chen, Hesheng ; Zhu, Yonghong 
; edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH] BaseTools/EOT: Change to call a program instead of 
calling Python API.

Hess,

Thanks for the clarification. Makes sense!

I glanced at, but didn't read in detail the code... so.

Acked-by: Jaben Carsey 

> -Original Message-
> From: Chen, Hesheng
> Sent: Monday, October 15, 2018 2:34 PM
> To: Carsey, Jaben ; Zhu, Yonghong 
> ; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH] BaseTools/EOT: Change to call a program 
> instead of calling Python API.
> Importance: High
> 
> Hello Jaben,
> The API is provided by C code and we want Python tool to use it. The 
> tool used to call Python API from DLL files and now we need run Python 
> tools from source so we can't build a specific version of DLL binary 
> for it. The DLL file may be different for different version of Python. 
> So now we just call the C program directly for the API.
> 
> Best Regards,
> Chen, Hess
> Intel China Software Center
> Tel: +86-21-6116-6740
> Email: hesheng.c...@intel.com
> 
> -Original Message-
> From: Carsey, Jaben
> Sent: Tuesday, October 16, 2018 1:45 AM
> To: Zhu, Yonghong ; edk2-devel@lists.01.org
> Cc: Chen, Hesheng 
> Subject: RE: [edk2] [PATCH] BaseTools/EOT: Change to call a program 
> instead of calling Python API.
> 
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of Yonghong Zhu
> > Sent: Monday, October 15, 2018 3:24 AM
> > To: edk2-devel@lists.01.org
> > Cc: Chen, Hesheng 
> > Subject: [edk2] [PATCH] BaseTools/EOT: Change to call a program 
> > instead of calling Python API.
> >
> > From: hchen30 
> >
> > Update the EOT tool to call the program itself instead of calling 
> > the Python API when parsing FV images.
> 
> Why do we prefer to launch the separate python program instead of 
> calling the APIs?
> 
> 
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Hess Chen 
> > ---
> >  BaseTools/Source/Python/Eot/{Eot.py => EotMain.py} | 465
> > +++--
> > 
> >  BaseTools/Source/Python/Eot/InfParserLite.py   |  26 +-
> >  BaseTools/Source/Python/Eot/Parser.py  |  28 +-
> >  BaseTools/Source/Python/Eot/Report.py  |   6 +-
> >  BaseTools/Source/Python/build/BuildReport.py   |   2 +-
> >  5 files changed, 84 insertions(+), 443 deletions(-)  rename 
> > BaseTools/Source/Python/Eot/{Eot.py => EotMain.py} (75%)
> >
> > diff --git a/BaseTools/Source/Python/Eot/Eot.py
> > b/BaseTools/Source/Python/Eot/EotMain.py
> > similarity index 75%
> > rename from BaseTools/Source/Python/Eot/Eot.py
> > rename to BaseTools/Source/Python/Eot/EotMain.py
> > index ce83da1495..49a1494126 100644
> > --- a/BaseTools/Source/Python/Eot/Eot.py
> > +++ b/BaseTools/Source/Python/Eot/EotMain.py
> > @@ -17,18 +17,20 @@
> >  from __future__ import absolute_import  import
> Common.LongFilePathOs
> > as os, time, glob  import Common.EdkLogger as EdkLogger -from . 
> > import EotGlobalData
> > +import Eot.EotGlobalData as EotGlobalData
> >  from optparse import OptionParser
> >  from Common.StringUtils import NormPath  from Common import 
> > BuildToolError  from Common.Misc import 
> > GuidStructureStringToGuidString, sdict -from .InfParserLite import * 
> > -from . import c -from . import Database
> > +from Eot.Parser import *
> > +from Eot.InfParserLite import EdkInfParser from Common.StringUtils 
> > +import GetSplitValueList from Eot import c from Eot import Database
> >  from array import array
> > -from .Report import Report
> > +from Eot.Report import Report
> >  from Common.BuildVersion import gBUILD_VERSION -from .Parser import 
> > ConvertGuid
> > +from Eot.Parser import ConvertGuid
> >  from Common.LongFilePathSupport import OpenLongFilePath as open 
> > import struct  import uuid @@ -58,14 +60,14 @@ class Image(array):
> >
> >  self._SubImages = sdict() # {offset: Image()}
> >
> > -array.__init__(self, 'B')
> > +array.__init__(self)
> >
> >  def __repr__(self):
> >  return self._ID_
> >
> >  def __len__(self):
> >  Len = array.__len__(self)
> > -for Offset in self._SubImages:
> > +for Offset in self._SubImages.keys():
> >  Len += l

Re: [edk2] [PATCH 1/1] BaseTools: Fix regression boot hang issue by commit 0e982cf03dd5

2018-10-15 Thread Zhu, Yonghong
I pushed this patch first since it helped to fix the critical bug.
Version: SHA-1: 272ecccd793c8fb12f4f356ada18a870c2426603

Best Regards,
Zhu Yonghong


-Original Message-
From: Zhu, Yonghong 
Sent: Monday, October 15, 2018 6:18 PM
To: Feng, YunhuaX ; edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: RE: [PATCH 1/1] BaseTools: Fix regression boot hang issue by commit 
0e982cf03dd5

Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, October 15, 2018 5:04 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 1/1] BaseTools: Fix regression boot hang issue by commit 
0e982cf03dd5

Fix regression boot hang issue by commit 
0e982cf03dd5023b90def60c3656e5e18135ebac

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/Fv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Fv.py 
b/BaseTools/Source/Python/GenFds/Fv.py
index 510f2834a8..c66fc38327 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -202,12 +202,12 @@ class FV (FvClassObject):
 Signature = FvHeaderBuffer[0x28:0x32]
 if Signature and Signature.startswith('_FVH'):
 GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV 
Successfully" % self.UiFvName)
 GenFdsGlobalVariable.SharpCounter = 0
 
-Buffer.write(FvFileObj.read())
 FvFileObj.seek(0)
+Buffer.write(FvFileObj.read())
 # FV alignment position.
 FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
 if FvAlignmentValue >= 0x400:
 if FvAlignmentValue >= 0x10:
 if FvAlignmentValue >= 0x100:
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 1/1] BaseTools: Fix regression boot hang issue by commit 0e982cf03dd5

2018-10-15 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, October 15, 2018 5:04 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 1/1] BaseTools: Fix regression boot hang issue by commit 
0e982cf03dd5

Fix regression boot hang issue by commit 
0e982cf03dd5023b90def60c3656e5e18135ebac

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/Fv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Fv.py 
b/BaseTools/Source/Python/GenFds/Fv.py
index 510f2834a8..c66fc38327 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -202,12 +202,12 @@ class FV (FvClassObject):
 Signature = FvHeaderBuffer[0x28:0x32]
 if Signature and Signature.startswith('_FVH'):
 GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV 
Successfully" % self.UiFvName)
 GenFdsGlobalVariable.SharpCounter = 0
 
-Buffer.write(FvFileObj.read())
 FvFileObj.seek(0)
+Buffer.write(FvFileObj.read())
 # FV alignment position.
 FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
 if FvAlignmentValue >= 0x400:
 if FvAlignmentValue >= 0x10:
 if FvAlignmentValue >= 0x100:
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools/Tests: Update GNUmakefile to use python3 variable

2018-10-13 Thread Zhu, Yonghong
Hi Ard,

Thanks. I pushed this patch since it is critical block issue.
Version SHA-1: 678f85131238622e576705117e299d81cff755c9

Best Regards,
Zhu Yonghong

-Original Message-
From: Ard Biesheuvel [mailto:ard.biesheu...@linaro.org] 
Sent: Sunday, October 14, 2018 12:44 AM
To: Zhu, Yonghong 
Cc: edk2-devel@lists.01.org; Leif Lindholm 
Subject: Re: [Patch] BaseTools/Tests: Update GNUmakefile to use python3 variable

On 13 October 2018 at 18:40, Yonghong Zhu  wrote:
> Cover the case use do make -C BaseTools before run the .edksetup.sh 
> file.
>
> Cc: Ard Biesheuvel 
> Cc: Leif Lindholm 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu 

Reviewed-by: Ard Biesheuvel 
Tested-by: Ard Biesheuvel 

> ---
>  BaseTools/Tests/GNUmakefile | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/BaseTools/Tests/GNUmakefile b/BaseTools/Tests/GNUmakefile 
> index af334a8a..536f0b7 100644
> --- a/BaseTools/Tests/GNUmakefile
> +++ b/BaseTools/Tests/GNUmakefile
> @@ -12,10 +12,10 @@
>  #
>
>  all: test
>
>  test:
> -   @if command -v $(PYTHON3) >/dev/null 2>&1; then $(PYTHON3) 
> RunTests.py; else python RunTests.py; fi
> +   @if command -v python3 >/dev/null 2>&1; then python3 
> + RunTests.py; else echo "Error: Please install a python 3 tool!"; fi
>
>  clean:
> find . -name '*.pyc' -exec rm '{}' ';'
>
> --
> 2.6.1.windows.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [BaseTools] Python3 migration is done

2018-10-12 Thread Zhu, Yonghong
Hi All,

We finished to migrate edk2 master BaseTools code to support Python3. The 
Version is : SHA-1: ea787b6b55499e8f931201f8f49daaaeb2e4409f
So now we need to install a Python tool that version >= 3.6.
The install steps you can refer to : 
https<https://realpython.com/installing-python/>://realpython.com/installing-python/<https://realpython.com/installing-python/>
If you meet any issue please let me know, thanks in advance.

Best Regards,
Zhu Yonghong

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Add --uefi option to enable UefiCompress method

2018-10-12 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Friday, October 12, 2018 12:42 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Add --uefi option to enable UefiCompress 
method

From: Yunhua Feng 

Add one new option --uefi to enable UefiCompress.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/TianoCompress/TianoCompress.c | 81 +--- 
 BaseTools/Source/C/TianoCompress/TianoCompress.h |  2 +-
 2 files changed, 58 insertions(+), 25 deletions(-)

diff --git a/BaseTools/Source/C/TianoCompress/TianoCompress.c 
b/BaseTools/Source/C/TianoCompress/TianoCompress.c
index 9a548fae1e..b88d7da2ed 100644
--- a/BaseTools/Source/C/TianoCompress/TianoCompress.c
+++ b/BaseTools/Source/C/TianoCompress/TianoCompress.c
@@ -15,10 +15,11 @@ 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 "Compress.h"
+#include "Decompress.h"
 #include "TianoCompress.h"
 #include "EfiUtilityMsgs.h"
 #include "ParseInf.h"
 #include 
 #include "assert.h"
@@ -63,10 +64,11 @@ static BOOLEAN QuietMode = FALSE;  //  //  Global Variables 
 //  STATIC BOOLEAN ENCODE = FALSE;  STATIC BOOLEAN DECODE = FALSE;
+STATIC BOOLEAN UEFIMODE = FALSE;
 STATIC UINT8  *mSrc, *mDst, *mSrcUpperLimit, *mDstUpperLimit;  STATIC UINT8  
*mLevel, *mText, *mChildCount, *mBuf, mCLen[NC], mPTLen[NPT], *mLen;  STATIC 
INT16  mHeap[NC + 1];  STATIC INT32  mRemainder, mMatchLen, mBitCount, 
mHeapSize, mN;  STATIC UINT32 mBufSiz = 0, mOutputPos, mOutputMask, mSubBitBuf, 
mCrc; @@ -1701,10 +1703,12 @@ Returns:
 
   //
   // Details Option
   //
   fprintf (stdout, "Options:\n");
+  fprintf (stdout, "  --uefi\n\
+Enable UefiCompress, use TianoCompress when without this 
+ option\n");
   fprintf (stdout, "  -o FileName, --output FileName\n\
 File will be created to store the ouput content.\n");
   fprintf (stdout, "  -v, --verbose\n\
Turn on verbose output with informational messages.\n");
   fprintf (stdout, "  -q, --quiet\n\
@@ -1820,10 +1824,17 @@ Returns:
   argc--;
   argv++;
   continue;
 }
 
+if (stricmp(argv[0], "--uefi") == 0) {
+  UEFIMODE = TRUE;
+  argc--;
+  argv++;
+  continue;
+}
+
 if (stricmp (argv[0], "--debug") == 0) {
   argc-=2;
   argv++;
   Status = AsciiStringToUint64(argv[0], FALSE, );
   if (DebugLevel > 9) {
@@ -1937,21 +1948,29 @@ Returns:
   // First call TianoCompress to get DstSize
   //
   if (DebugMode) {
 DebugMsg(UTILITY_NAME, 0, DebugLevel, "Encoding", NULL);
   }
-  Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, 
);
+  if (UEFIMODE) {
+Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, 
+ );  } else {
+Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, 
+ OutBuffer, );  }
 
   if (Status == EFI_BUFFER_TOO_SMALL) {
 OutBuffer = (UINT8 *) malloc (DstSize);
 if (OutBuffer == NULL) {
   Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
   goto ERROR;
 }
   }
 
-  Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, 
);
+  if (UEFIMODE) {
+Status = EfiCompress ((UINT8 *)FileBuffer, InputLength, OutBuffer, 
+ );  } else {
+Status = TianoCompress ((UINT8 *)FileBuffer, InputLength, 
+ OutBuffer, );  }
   if (Status != EFI_SUCCESS) {
 Error (NULL, 0, 0007, "Error compressing file", NULL);
 goto ERROR;
   }
 
@@ -1977,36 +1996,50 @@ Returns:
   }
   else if (DECODE) {
   if (DebugMode) {
 DebugMsg(UTILITY_NAME, 0, DebugLevel, "Decoding\n", NULL);
   }
-  //
-  // Get Compressed file original size
-  //
-  Src = (UINT8 *)FileBuffer;
-  OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 24);
 
-  //
-  // Allocate OutputBuffer
-  //
-  OutBuffer = (UINT8 *)malloc(OrigSize);
-  if (OutBuffer == NULL) {
-Error (NULL, 0, 4001, "Resource:", "Memory cannot be allocated!");
-goto ERROR;
-   }
+  if (UEFIMODE) {
+Status = Extract((VOID *)FileBuffer, InputLength, (VOID *), 
, 1);
+if (Status != EFI_SUCCESS) {
+  goto ERROR;
+}
+fwrite(OutBuffer, (size_t)(DstSize), 1, OutputFile);  } else {
+//
+// Get Compressed file original size
+//
+Src = (UINT8 *)FileBuffer;
+OrigSize  = Src[4] + (Src[5] << 8) + (Src[6] << 16) + (Src[7] << 
+ 24);
 
-  Status = Decompress((VOID *)FileBuffer, (VOID *)OutBuffer, (VOID *)Scratch, 
2);
-  if (Status != EFI

Re: [edk2] [PATCH] BaseTools: Allow multiple PciDeviceId in Fdf OptionROM override

2018-10-11 Thread Zhu, Yonghong
Hi Pilar,

Will you update a V2 to cover Jaben's comment ?

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Carsey, 
Jaben
Sent: Monday, October 8, 2018 11:00 PM
To: Gao, Liming ; Tomas Pilar (tpilar) 
; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH] BaseTools: Allow multiple PciDeviceId in Fdf 
OptionROM override



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Gao, Liming
> Sent: Sunday, October 07, 2018 6:42 PM
> To: Tomas Pilar (tpilar) ; 
> edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] BaseTools: Allow multiple PciDeviceId in 
> Fdf OptionROM override
> 
> Pilar:
>   The change is good. Could you also update INF and FDF spec for this usage?
> If you don't know how to update INF and FDF spec, please submit BZ. I 
> will provide the spec patch.
> 
>   Reviewed-by: Liming Gao 
> 
> Thanks
> Liming
> >-Original Message-
> >From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> >Of Tomas Pilar (tpilar)
> >Sent: Tuesday, October 02, 2018 10:46 PM
> >To: edk2-devel@lists.01.org
> >Subject: [edk2] [PATCH] BaseTools: Allow multiple PciDeviceId in Fdf 
> >OptionROM override
> >
> >Contributed-under: TianoCore Contribution Agreement 1.1
> >Signed-off-by: Tomas Pilar 
> >---
> > BaseTools/Source/Python/GenFds/FdfParser.py | 11 ---
> > 1 file changed, 8 insertions(+), 3 deletions(-)
> >
> >diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py
> >b/BaseTools/Source/Python/GenFds/FdfParser.py
> >index 63687e98bb..a65f2cfd2d 100644
> >--- a/BaseTools/Source/Python/GenFds/FdfParser.py
> >+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
> >@@ -4469,10 +4469,15 @@ class FdfParser:
> > if self.__IsKeyword( "PCI_DEVICE_ID"):
> > if not self.__IsToken( "="):
> > raise Warning("expected '='", self.FileName,
> >self.CurrentLineNumber)
> >-if not self.__GetNextHexNumber():
> >-raise Warning("expected Hex device id", 
> >self.FileName,
> >self.CurrentLineNumber)
> >
> >-Overrides.PciDeviceId = self.__Token
> >+# Get a list of PCI IDs
> >+Overrides.PciDeviceId = ""
> >+
> >+while self.__GetNextHexNumber():
> >+Overrides.PciDeviceId += " " + self.__Token

Can we change to minimize looping string concatenation here?  This in a loop 
will cause lots of memory allocation/deallocation and slow things down.

Maybe : 
Overrides.PciDeviceId = "{} {}".format(Overrides.PciDeviceId, self.__Token)


> >+
> >+if not Overrides.PciDeviceId:
> >+raise Warning("expected one or more Hex 
> >+ device ids",
> >self.FileName, self.CurrentLineNumber)
> > continue
> >
> > if self.__IsKeyword( "PCI_REVISION"):
> >--
> >2.17.1
> >
> >___
> >edk2-devel mailing list
> >edk2-devel@lists.01.org
> >https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: do basic check in FvImage with header size and signature

2018-10-09 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Saturday, September 29, 2018 4:47 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: do basic check in FvImage with header size 
and signature

From: zhijufan 

Add some basic check in FvImage with header size and signature.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1181
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/GenFds/Fv.py | 44 
 1 file changed, 24 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/Fv.py 
b/BaseTools/Source/Python/GenFds/Fv.py
index 0d005eb..510f283 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -193,36 +193,40 @@ class FV (FvClassObject):
 )
 
 #
 # Write the Fv contents to Buffer
 #
-if os.path.isfile(FvOutputFile):
+if os.path.isfile(FvOutputFile) and os.path.getsize(FvOutputFile) 
>= 0x48:
 FvFileObj = open(FvOutputFile, 'rb')
-GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV 
Successfully" % self.UiFvName)
-GenFdsGlobalVariable.SharpCounter = 0
-
-Buffer.write(FvFileObj.read())
-FvFileObj.seek(0)
 # PI FvHeader is 0x48 byte
 FvHeaderBuffer = FvFileObj.read(0x48)
-# FV alignment position.
-FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
-if FvAlignmentValue >= 0x400:
-if FvAlignmentValue >= 0x10:
-if FvAlignmentValue >= 0x100:
-#The max alignment supported by FFS is 16M.
-self.FvAlignment = "16M"
+Signature = FvHeaderBuffer[0x28:0x32]
+if Signature and Signature.startswith('_FVH'):
+GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV 
Successfully" % self.UiFvName)
+GenFdsGlobalVariable.SharpCounter = 0
+
+Buffer.write(FvFileObj.read())
+FvFileObj.seek(0)
+# FV alignment position.
+FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E]) & 0x1F)
+if FvAlignmentValue >= 0x400:
+if FvAlignmentValue >= 0x10:
+if FvAlignmentValue >= 0x100:
+#The max alignment supported by FFS is 16M.
+self.FvAlignment = "16M"
+else:
+self.FvAlignment = str(FvAlignmentValue / 
0x10) + "M"
 else:
-self.FvAlignment = str(FvAlignmentValue / 
0x10) + "M"
+self.FvAlignment = str(FvAlignmentValue / 0x400) + 
"K"
 else:
-self.FvAlignment = str(FvAlignmentValue / 0x400) + "K"
+# FvAlignmentValue is less than 1K
+self.FvAlignment = str (FvAlignmentValue)
+FvFileObj.close()
+GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 
'fv'] = FvOutputFile
+GenFdsGlobalVariable.LargeFileInFvFlags.pop()
 else:
-# FvAlignmentValue is less than 1K
-self.FvAlignment = str (FvAlignmentValue)
-FvFileObj.close()
-GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 
'fv'] = FvOutputFile
-GenFdsGlobalVariable.LargeFileInFvFlags.pop()
+GenFdsGlobalVariable.ErrorLogger("Invalid FV file %s." % 
self.UiFvName)
 else:
 GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV 
file." %self.UiFvName)
 return FvOutputFile
 
 ## _GetBlockSize()
-- 
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] edk2-BaseTools-win32: Add notes to announce BaseTools Win32 doesn't work

2018-10-09 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Liming 
Gao
Sent: Wednesday, October 10, 2018 8:33 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch] edk2-BaseTools-win32: Add notes to announce BaseTools 
Win32 doesn't work

https://lists.01.org/pipermail/edk2-devel/2018-September/029436.html

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 Readme.txt | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Readme.txt b/Readme.txt
index 9caee63..793d1cd 100644
--- a/Readme.txt
+++ b/Readme.txt
@@ -1,3 +1,8 @@
+### NOTE ###
+This directory Win32 binaries doesn't work any longer to build EDK2 project.
+Please run BaseTools Python from source in Windows OS. Here is wiki:
+https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems#c
+ompile-tools
+
 Intel is a trademark or registered trademark of Intel Corporation or its  
subsidiaries in the United States and other countries.
 * Other names and brands may be claimed as the property of others.
--
2.10.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools Python: Migrate Python27 to Python36

2018-10-09 Thread Zhu, Yonghong
Hi All,

If no more comment, I hope to sync Python3 migration patches to edk2 master in 
this week. Thanks.

Best Regards,
Zhu Yonghong


-Original Message-
From: Kinney, Michael D 
Sent: Monday, October 01, 2018 11:14 PM
To: Gary Lin ; Zhu, Yonghong ; Kinney, 
Michael D 
Cc: Sun, Yanyan ; edk2-devel@lists.01.org; Chen, Hesheng 

Subject: RE: [edk2] [Patch] BaseTools Python: Migrate Python27 to Python36

Gary,

Please send the patch to edk2-devel.

Yonghong may not be available much this week, so you may not see a response 
form him till next week.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Gary Lin
> Sent: Monday, October 1, 2018 3:24 AM
> To: Zhu, Yonghong 
> Cc: Sun, Yanyan ; edk2- de...@lists.01.org; 
> Chen, Hesheng 
> Subject: Re: [edk2] [Patch] BaseTools Python: Migrate
> Python27 to Python36
> 
> On Wed, Sep 26, 2018 at 01:02:05PM +, Zhu, Yonghong
> wrote:
> > Hi All,
> >
> Hi Yonghong,
> 
> > Now we are working on bugzilla
> 55<https://bugzilla.tianocore.org/show_bug.cgi?id=55>
> (https://bugzilla.tianocore.org/show_bug.cgi?id=55)  to migrate 
> BaseTools python tool from Python27 to Python36.  After this 
> migration, the BaseTools will only support Python 3. And for now, user 
> need to install a Python version >= 3.6.
> > Here is the link: https://github.com/yzhu52/edk2.git
> Branch: Python3_V2
> > In this branch, after run edksetup script file, tool
> auto detect the Python tool that version >= 3.6,  tool would report 
> error if it can't find the python that >= 3.6.
> >
> I'm testing the branch and found a minor bug in edksetup.sh that 
> caused OvmfPkg/build.sh failed to build. I wrote a patch and it works 
> for me.
> Where should I send the patch? to the edk2-devel mailinglist directly?
> or a pull request in github?
> 
> Thanks,
> 
> Gary Lin
> 
> > Current we still in doing some validation for this
> migration, and not finish the update for UPT, ECC, EOT, Tests those 
> tools and scripts.
> > We already did following on this branch:
> >
> > 1.   Remove the "from __future__ import" items
> >
> > 2.   Update the xrange to range
> >
> > 3.   Update long to int
> >
> > 4.   Use input instead of raw_input
> >
> > 5.   Not use iteritems(), but use items()
> directly
> >
> > 6.   Remove the super() function argument
> >
> > 7.   Remove the itertools usage
> >
> > 8.   Fix some open file's read and write function
> >
> > 9.   Hand the bytes and str type difference
> >
> > 10.   Do some list and iterator update
> >
> > 11.   Change the division operation in the expression
> >
> > 12.   Use '\n' but not os.linesep
> >
> > 13.   Update the BinWrappers script
> >
> > 14.   Update edksetup script file
> >
> >
> > Your suggestions is highly appreciated.
> >
> > Best Regards,
> > Zhu Yonghong
> >
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
> >
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools/edksetup.sh: Handle the return value from grep

2018-10-08 Thread Zhu, Yonghong
Looks good to me. I will push this to Python3 branch.
Reviewed-by: Yonghong Zhu  

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gary Lin
Sent: Tuesday, October 2, 2018 11:36 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools/edksetup.sh: Handle the return value from grep

When SetupPython3() parses the possible python binary paths, it uses `grep 
"[[:digit:]]$"` to filter the python versions in the file name.
Since grep would return 1 when the last character of the file name is not a 
digit, OvmfPkg/build.sh would fail immediately when the function is handling 
some cases, e.g. "python3:".

This commit adds `|| true` to the grep command to make sure the command never 
returns 1 in any condition.

[NOTE: For the python3 branch]

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Gary Lin 
Cc: Liming Gao 
Cc: Yonghong Zhu 
---
 edksetup.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/edksetup.sh b/edksetup.sh
index 5ff3be19fb2f..d4e577e60781 100755
--- a/edksetup.sh
+++ b/edksetup.sh
@@ -115,7 +115,7 @@ function SetupPython3()  {
   for python in $(whereis python3)
   do
-python=$(echo $python | grep "[[:digit:]]$")
+python=$(echo $python | grep "[[:digit:]]$" || true)
 python_version=${python##*python}
 if [ -z "${python_version}" ];then
   continue
--
2.18.0

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] IntelFsp2Pkg/GenCfgOpt.py: Support PCD input from command line

2018-10-08 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Chiu, Chasel 
Sent: Monday, October 08, 2018 4:11 PM
To: edk2-devel@lists.01.org
Cc: Yao, Jiewen ; Gao, Liming ; 
Zhu, Yonghong ; Chiu, Chasel 
Subject: [PATCH V2] IntelFsp2Pkg/GenCfgOpt.py: Support PCD input from command 
line

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1231

Build system already support override PCD value by command line so add this 
support to GenCfgOpt.py Also update revision to 0.53

Test: Verified UPD header files generated can reflect different
  PCD values from --pcd build command input

Cc: Jiewen Yao 
Cc: Gao Liming 
Cc: Zhu Yonghong 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chasel Chiu 
---
 IntelFsp2Pkg/Tools/GenCfgOpt.py | 17 -
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/IntelFsp2Pkg/Tools/GenCfgOpt.py b/IntelFsp2Pkg/Tools/GenCfgOpt.py 
index 059cfcb7e4..15d33582ef 100644
--- a/IntelFsp2Pkg/Tools/GenCfgOpt.py
+++ b/IntelFsp2Pkg/Tools/GenCfgOpt.py
@@ -88,6 +88,8 @@ are permitted provided that the following conditions are met:
 **/
 """
 
+BuildOptionPcd = []
+
 class CLogicalExpression:
 def __init__(self):
 self.index= 0
@@ -561,6 +563,12 @@ EndList
 self._PcdsDict[Match.group(1)] = Match.group(2)
 if self.Debug:
 print "INFO : PCD %s = [ %s ]" % (Match.group(1), 
Match.group(2))
+i = 0
+while i < len(BuildOptionPcd):
+Match = re.match("\s*([\w\.]+)\s*\=\s*(\w+)", 
BuildOptionPcd[i])
+if Match:
+self._PcdsDict[Match.group(1)] = Match.group(2)
+i += 1
 else:
 Match = re.match("^\s*#\s+(!BSF|@Bsf|!HDR)\s+(.+)", DscLine)
 if Match:
@@ -1462,7 +1470,7 @@ EndList
 
 
 def Usage():
-print "GenCfgOpt Version 0.52"
+print "GenCfgOpt Version 0.53"
 print "Usage:"
 print "GenCfgOpt  UPDTXT  PlatformDscFile BuildFvDir 
[-D Macros]"
 print "GenCfgOpt  HEADER  PlatformDscFile BuildFvDir  InputHFile 
[-D Macros]"
@@ -1472,7 +1480,14 @@ def Main():
 #
 # Parse the options and args
 #
+i = 1
+
 GenCfgOpt = CGenCfgOpt()
+while i < len(sys.argv):
+if sys.argv[i].strip().lower() == "--pcd":
+BuildOptionPcd.append(sys.argv[i+1])
+i += 1
+i += 1
 argc = len(sys.argv)
 if argc < 4:
 Usage()
--
2.13.3.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] GenFds broken in latest basetools-win32

2018-10-07 Thread Zhu, Yonghong
Hi,

We planned to drop the support of BaseTools Python run from the freeze binary 
in Windows OS 
https://lists.01.org/pipermail/edk2-devel/2018-September/029436.html 

Please run BaseTools Python from source in Windows. Here is the step wiki  
https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems  Compile 
Tools section.

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Kurt 
Kennett
Sent: Tuesday, October 2, 2018 4:55 AM
To: edk2-devel@lists.01.org
Subject: [edk2] GenFds broken in latest basetools-win32

"genfds" seems broken in latest tiano-win32

Can anybody else repo this:

C:\repo\tiano-win32>genfds
Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 
27, in 
  File "GenFds\GenFds.py", line 24, in 
ValueError: Attempted relative import in non-package

K2
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] FDF spec: Support Structure PCD field assignment syntax in [Defines] section

2018-09-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Sunday, September 30, 2018 10:08 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] FDF spec: Support Structure PCD field assignment syntax in 
[Defines] section

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 3_edk_ii_fdf_file_format/34_[defines]_section.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/3_edk_ii_fdf_file_format/34_[defines]_section.md 
b/3_edk_ii_fdf_file_format/34_[defines]_section.md
index 4c8d08f..1bc30d9 100644
--- a/3_edk_ii_fdf_file_format/34_[defines]_section.md
+++ b/3_edk_ii_fdf_file_format/34_[defines]_section.md
@@ -61,7 +61,7 @@ Conditional statements may be used anywhere within this 
section.
::= {} {} {}
  ::= 
 ::= {} {(0-9)+ "." (0-9)+}
-   ::=  "SET"[] 
+   ::=  "SET"  {} {}  [] 

   ::= {} {} {} {}
  {} {} {}  ```
--
2.10.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: refactor the error for PCD value is negative or exceed max

2018-09-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Saturday, September 29, 2018 11:08 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: refactor the error for PCD value is negative 
or exceed max

From: zhijufan 

refactor the error handling for the PCD value that is negative or it exceed the 
max value.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/AutoGen/GenC.py | 57 - 
 BaseTools/Source/Python/BPDG/GenVpd.py  | 44 -  
BaseTools/Source/Python/Common/Misc.py  |  4 +++
 3 files changed, 30 insertions(+), 75 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
b/BaseTools/Source/Python/AutoGen/GenC.py
index f455f83..09626d0 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1013,54 +1013,23 @@ def CreateModulePcdCode(Info, AutoGenC, AutoGenH, Pcd):
 ValueNumber = int (Value, 0)
 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, 
TokenCName),
 ExtraData="[%s]" % str(Info))
-if Pcd.DatumType == TAB_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, 
TokenCName),
-ExtraData="[%s]" % str(Info))
-elif ValueNumber >= 0x1:
-EdkLogger.error("build", AUTOGEN_ERROR,
-"Too large PCD value for datum type [%s] 
of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
-ExtraData="[%s]" % str(Info))
-if not Value.endswith('ULL'):
-Value += 'ULL'
-elif Pcd.DatumType == TAB_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, 
TokenCName),
-ExtraData="[%s]" % str(Info))
-elif ValueNumber >= 0x1:
-EdkLogger.error("build", AUTOGEN_ERROR,
-"Too large PCD value for datum type [%s] 
of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
-ExtraData="[%s]" % str(Info))
-if not Value.endswith('U'):
-Value += 'U'
-elif Pcd.DatumType == TAB_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, 
TokenCName),
-ExtraData="[%s]" % str(Info))
-elif ValueNumber >= 0x1:
-EdkLogger.error("build", AUTOGEN_ERROR,
-"Too large PCD value for datum type [%s] 
of PCD %s.%s" % (Pcd.DatumType, Pcd.TokenSpaceGuidCName, TokenCName),
-ExtraData="[%s]" % str(Info))
-if not Value.endswith('U'):
-Value += 'U'
-elif Pcd.DatumType == TAB_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, 
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, TokenCName),
-ExtraData="[%s]" % str(Info))
-if not Value.endswith('U'):
-Value += 'U'
+if ValueNumber < 0:
+EdkLogger.error("bu

[edk2] [Patch] BaseTools Python: Migrate Python27 to Python36

2018-09-26 Thread Zhu, Yonghong
Hi All,

Now we are working on bugzilla 
55<https://bugzilla.tianocore.org/show_bug.cgi?id=55> 
(https://bugzilla.tianocore.org/show_bug.cgi?id=55)  to migrate BaseTools 
python tool from Python27 to Python36.  After this migration, the BaseTools 
will only support Python 3. And for now, user need to install a Python version 
>= 3.6.
Here is the link: https://github.com/yzhu52/edk2.git   Branch: Python3_V2
In this branch, after run edksetup script file, tool auto detect the Python 
tool that version >= 3.6,  tool would report error if it can't find the python 
that >= 3.6.

Current we still in doing some validation for this migration, and not finish 
the update for UPT, ECC, EOT, Tests those tools and scripts.
We already did following on this branch:

1.   Remove the "from __future__ import" items

2.   Update the xrange to range

3.   Update long to int

4.   Use input instead of raw_input

5.   Not use iteritems(), but use items() directly

6.   Remove the super() function argument

7.   Remove the itertools usage

8.   Fix some open file's read and write function

9.   Hand the bytes and str type difference

10.   Do some list and iterator update

11.   Change the division operation in the expression

12.   Use '\n' but not os.linesep

13.   Update the BinWrappers script

14.   Update edksetup script file


Your suggestions is highly appreciated.

Best Regards,
Zhu Yonghong

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix the wrong reference _GetSkuIds() in AutoGen code

2018-09-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Tuesday, September 25, 2018 9:36 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Carsey, Jaben 

Subject: [Patch] BaseTools: Fix the wrong reference _GetSkuIds() in AutoGen code

DscBuildData has been updated to define SkuIds instead of _GetSkuIds().
The consumer code should refer to SkuIds.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
Cc: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 5271b44..38f1260 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1153,7 +1153,7 @@ class PlatformAutoGen(AutoGen):
 VpdRegionBase = FdRegion.Offset
 break
 
-VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), 
self.DscBuildDataObj._GetSkuIds())
+VariableInfo = VariableMgr(self.DscBuildDataObj._GetDefaultStores(), 
self.DscBuildDataObj.SkuIds)
 VariableInfo.SetVpdRegionMaxSize(VpdRegionSize)
 VariableInfo.SetVpdRegionOffset(VpdRegionBase)
 Index = 0
-- 
2.10.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] UEFIPayload build issue

2018-09-21 Thread Zhu, Yonghong
Hi Wim Vervoorn,

May I know your steps? 
From the error message, seems you freeze the BaseTools to binary exe file,  and 
this failure was caused by the cxfreeze step.
We recommend run BaseTools Python from source in Windows. Thanks.

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Wim 
Vervoorn
Sent: Friday, September 21, 2018 4:44 AM
To: edk2-devel@lists.01.org
Subject: [edk2] UEFIPayload build issue



Hello,

I am trying to build the new UEFIPayload from the staging repo.

The build proceeds pretty well but then I got this message:

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\cx_Freeze\initscripts\Console.py", line 
27, in 
exec(code, m.__dict__)
  File "GenFds\GenFds.py", line 24, in 
ValueError: Attempted relative import in non-package


build.exe...
: error 7000: Failed to execute command
GenFds -f 
C:\git\SlimBootPayload\UEFIPayload\UefiPayloadPkg\UefiPayloadPkg.fdf 
--conf=c:\git\slimbootpayload\edk2\conf -o 
c:\git\slimbootpayload\edk2\Build\UefiPayloadPkgX64\DEBUG_VS2015x86 -t 
VS2015x86 -b DEBUG -p 
C:\git\SlimBootPayload\UEFIPayload\UefiPayloadPkg\UefiPayloadPkgIA32X64.dsc -a 
IA32,X64  -D "EFI_SOURCE=c:\\git\\slimbootpayload\\edk2\\edkcompatibilitypkg"  
-D "EDK_SOURCE=c:\\git\\slimbootpayload\\edk2\\edkcompatibilitypkg"  -D 
"TOOL_CHAIN_TAG=VS2015x86"  -D "TOOLCHAIN=VS2015x86"  -D "TARGET=DEBUG"  -D 
"FAMILY=MSFT"  -D "WORKSPACE=c:\\git\\slimbootpayload\\edk2"  -D 
"EDK_TOOLS_PATH=c:\\git\\slimbootpayload\\edk2\\basetools"  -D 
"BD_ARCH=IA32X64"  -D "ARCH=IA32 X64"  -D 
"ECP_SOURCE=c:\\git\\slimbootpayload\\edk2\\edkcompatibilitypkg" 
[C:\git\SlimBootPayload\edk2]

- Failed -

So far I haven’t figured out what is causing this issue. It is good to note 
that use the tools from the master of the edk2 repo (status of today).

Suggestions are welcome.

Wim Vervoorn

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
--- Begin Message ---
Hi, all
  Now, we are working to migrate BaseTools Python tool from Python27 to 
Python36. To reduce the migration effort, we will only verify BaseTools Python 
tool run from source. That means we will stop to support the freeze python tool 
as windows exe. In fact, we get the report that edk2-BaseTools-win32 doesn't 
work. We don't plan to fix it. If you still use the freeze python tool exe, 
please run BaseTools Python from source in Windows. Here is the step wiki 
https://github.com/tianocore/tianocore.github.io/wiki/Windows-systems Compile 
Tools section. After migrate to Python36, we will update wiki page to document 
Python36 step.

>From now, we will stop to freeze python tool, remove 
>Edk2\BaseTools\Source\Python\Makefile, and stop update edk2-BaseTools-win32 
>github repo. And, I will reset edk2-BaseTools-win32 binary to match edk2 
>vUDK2018 tag. If you require the freeze python tool, you can maintain your 
>step to freeze the python tool. Here is the link 
>https://docs.python-guide.org/shipping/freezing/ to introduce the different 
>freezing solutions.

Thanks
Liming

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
--- End Message ---
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 0/9] BaseTools: refactor Workspace classes

2018-09-20 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jaben 
Carsey
Sent: Tuesday, September 11, 2018 6:18 AM
To: edk2-devel@lists.01.org
Subject: [edk2] [PATCH v2 0/9] BaseTools: refactor Workspace classes

update the classes for the following:
1) use decorators for property
2) use decorators for caching property and caching function
  - this allows for objects to reduce in size as they get used
3) remove unused variables and properties
4) use tuple instead of custom class when apropriate
5) remove callers from accessing "private" data and use the existing properties
6) removed a circular dependency between APIs

v2:
fix error where class attribute M was accidentally removed.

Jaben Carsey (9):
  BaseTools: Refactor PlatformAutoGen
  BaseTools: AutoGen refactor WorkspaceAutoGen class
  BaseTools: AutoGen - refactor class properties
  BaseTools: refactor class properties
  BaseTools: Workspace classes refactor properties
  BaseTools: refactor Build Database objects
  BaseTools: Don't save unused workspace data
  BaseTools: refactor to not overcreate ModuleAutoGen objects
  BaseTools: refactor to cache InfBuildData data

 BaseTools/Source/Python/AutoGen/AutoGen.py | 692 +++---
 BaseTools/Source/Python/AutoGen/GenMake.py |  20 +-
 BaseTools/Source/Python/Common/Misc.py |  90 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  |   4 +-
 BaseTools/Source/Python/Workspace/BuildClassObject.py  |  39 +-
 BaseTools/Source/Python/Workspace/DecBuildData.py  |  65 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py  | 151 ++--
 BaseTools/Source/Python/Workspace/InfBuildData.py  | 954 
+---
 BaseTools/Source/Python/Workspace/MetaFileParser.py|  18 +-
 BaseTools/Source/Python/Workspace/WorkspaceDatabase.py |  16 +-
 BaseTools/Source/Python/build/build.py |   4 +-
 11 files changed, 933 insertions(+), 1120 deletions(-)

--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: remove PyUtility and open the file with unbuffered

2018-09-17 Thread Zhu, Yonghong
Please ignore this one, I will separate it into two patches.

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Monday, September 17, 2018 2:43 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: remove PyUtility and open the file with 
unbuffered

the PyUtility is not used, so we remove it.
And update the open file with unbuffered to avoid the case that the file is not 
wrote but directly used in later when the host's multiple thread is very strong.

Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/C/PyUtility/Makefile|  25 ---
 BaseTools/Source/C/PyUtility/PyUtility.c | 106 ---
 BaseTools/Source/C/PyUtility/setup.py|  42 ---
 BaseTools/Source/Python/Common/Misc.py   |  16 +---
 BaseTools/Source/Python/Common/PyUtility.pyd | Bin 6144 -> 0 bytes
 5 files changed, 3 insertions(+), 186 deletions(-)  delete mode 100644 
BaseTools/Source/C/PyUtility/Makefile
 delete mode 100644 BaseTools/Source/C/PyUtility/PyUtility.c
 delete mode 100644 BaseTools/Source/C/PyUtility/setup.py
 delete mode 100644 BaseTools/Source/Python/Common/PyUtility.pyd

diff --git a/BaseTools/Source/C/PyUtility/Makefile 
b/BaseTools/Source/C/PyUtility/Makefile
deleted file mode 100644
index 5829070..000
--- a/BaseTools/Source/C/PyUtility/Makefile
+++ /dev/null
@@ -1,25 +0,0 @@
-## @file
-# Makefile
-#
-# Copyright (c) 2007 - 2014, 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
-
-APPNAME = GenSec
-
-LIBS = $(LIB_PATH)\Common.lib
-
-OBJECTS = PyUtility.obj
-
-#CFLAGS = $(CFLAGS) /nodefaultlib:libc.lib
-
-!INCLUDE ..\Makefiles\ms.app
-
diff --git a/BaseTools/Source/C/PyUtility/PyUtility.c 
b/BaseTools/Source/C/PyUtility/PyUtility.c
deleted file mode 100644
index d14b872..000
--- a/BaseTools/Source/C/PyUtility/PyUtility.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/** @file
-Python Utility
-
-Copyright (c) 2009 - 2018, 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 
-#include 
-#include 
-
-/*
- SaveFileToDisk(FilePath, Content)
-*/
-STATIC
-PyObject*
-SaveFileToDisk (
-  PyObject*Self,
-  PyObject*Args
-  )
-{
-  CHAR8 *File;
-  UINT8 *Data;
-  UINTN DataLength;
-  UINTN WriteBytes;
-  UINTN Status;
-  HANDLEFileHandle;
-  PyObject  *ReturnValue = Py_False;
-
-  Status = PyArg_ParseTuple(
-Args,
-"ss#",
-,
-,
-
-);
-  if (Status == 0) {
-return NULL;
-  }
-
-  FileHandle = CreateFile(
-File,
-GENERIC_WRITE,
-FILE_SHARE_WRITE|FILE_SHARE_READ|FILE_SHARE_DELETE,
-NULL,
-CREATE_ALWAYS,
-FILE_ATTRIBUTE_NORMAL,
-NULL
-);
-  if (FileHandle == INVALID_HANDLE_VALUE) {
-PyErr_SetString(PyExc_Exception, "File creation failure");
-return NULL;
-  }
-
-  while (WriteFile(FileHandle, Data, DataLength, , NULL)) {
-if (DataLength <= WriteBytes) {
-  DataLength = 0;
-  break;
-}
-
-Data += WriteBytes;
-DataLength -= WriteBytes;
-  }
-
-  if (DataLength != 0) {
-// file saved unsuccessfully
-PyErr_SetString(PyExc_Exception, "File write failure");
-goto Done;
-  }
-
-  //
-  // Flush buffer may slow down the whole build performance (average 10s 
slower)
-  //
-  //if (!FlushFileBuffers(FileHandle)) {
-  //  PyErr_SetString(PyExc_Exception, "File flush failure");
-  //  goto Done;
-  //}
-
-  // success!
-  ReturnValue = Py_True;
-
-Done:
-  CloseHandle(FileHandle);
-  return ReturnValue;
-}
-
-STATIC INT8 SaveFileToDiskDocs[] = "SaveFileToDisk(): Make sure the file is 
saved to disk\n";
-
-STATIC PyMethodDef PyUtility_Funcs[] = {
-  {"SaveFileToDisk", (PyCFunction)SaveFileToDisk, METH_VARARGS, 
SaveFileToDiskDocs},
-  {NULL, NULL, 0, NULL}
-};
-

Re: [edk2] [PATCH] BaseTools: Regression bug Linux script used windows line format

2018-09-16 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Friday, September 14, 2018 11:23 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Regression bug Linux script used windows line format

regression by 15e20228258c1714cd90207a52101a5b1b54cd2c
and 9f3594782de9051cbf599f9af006903ed3f6669e
Linux execute script must use '\n' not '\r\n' for end of line

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/BinWrappers/PosixLike/BPDG   | 2 +-
 BaseTools/BinWrappers/PosixLike/GenFds | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/BinWrappers/PosixLike/BPDG 
b/BaseTools/BinWrappers/PosixLike/BPDG
index bca1bae96a..276c7ea207 100755
--- a/BaseTools/BinWrappers/PosixLike/BPDG
+++ b/BaseTools/BinWrappers/PosixLike/BPDG
@@ -9,6 +9,6 @@ fi
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here  dir=$(dirname "$full_cmd")  
cmd=${full_cmd##*/}
 
 export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
-exec "${python_exe:-python}" -m $cmd.$cmd "$@"
+exec "${python_exe:-python}" -m $cmd.$cmd "$@"
diff --git a/BaseTools/BinWrappers/PosixLike/GenFds 
b/BaseTools/BinWrappers/PosixLike/GenFds
index bca1bae96a..276c7ea207 100755
--- a/BaseTools/BinWrappers/PosixLike/GenFds
+++ b/BaseTools/BinWrappers/PosixLike/GenFds
@@ -9,6 +9,6 @@ fi
 full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a 
discussion of why $0 is not a good choice here  dir=$(dirname "$full_cmd")  
cmd=${full_cmd##*/}
 
 export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
-exec "${python_exe:-python}" -m $cmd.$cmd "$@"
+exec "${python_exe:-python}" -m $cmd.$cmd "$@"
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix a bug for Unused PCDs section display in the report

2018-09-13 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Thursday, September 13, 2018 1:36 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Fix a bug for Unused PCDs section display in 
the report

From: zhijufan 

Fix a regression issue caused by ac4578af364, when there doesn't exist not used 
PCD, it also display the not used Pcd section in the report.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=1170
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/build/BuildReport.py | 12 +++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index c7fa1b9..49bcd9c 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -886,11 +886,21 @@ class PcdReport(object):
 def GenerateReport(self, File, ModulePcdSet):
 if not ModulePcdSet:
 if self.ConditionalPcds:
 self.GenerateReportDetail(File, ModulePcdSet, 1)
 if self.UnusedPcds:
-self.GenerateReportDetail(File, ModulePcdSet, 2)
+IsEmpty = True
+for Token in self.UnusedPcds:
+TokenDict = self.UnusedPcds[Token]
+for Type in TokenDict:
+if TokenDict[Type]:
+IsEmpty = False
+break
+if not IsEmpty:
+break
+if not IsEmpty:
+self.GenerateReportDetail(File, ModulePcdSet, 2)
 self.GenerateReportDetail(File, ModulePcdSet)
 
 ##
 # Generate report for PCD information
 #
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools\GenFds: remove extra content

2018-09-12 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Tuesday, September 11, 2018 6:16 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools\GenFds: remove extra content

remove uncalled functions
remove extra blank lines
remove commented out code

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 56 
 1 file changed, 56 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 7e1be659fca5..1f7d59bb51b0 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -1120,28 +1120,6 @@ class FdfParser:
 else:
 return False
 
-def __GetNextOp(self):
-# Skip leading spaces, if exist.
-self.__SkipWhiteSpace()
-if self.__EndOfFile():
-return False
-# Record the token start position, the position of the first non-space 
char.
-StartPos = self.CurrentOffsetWithinLine
-while not self.__EndOfLine():
-TempChar = self.__CurrentChar()
-# Try to find the end char that is not a space
-if not str(TempChar).isspace():
-self.__GetOneChar()
-else:
-break
-else:
-return False
-
-if StartPos != self.CurrentOffsetWithinLine:
-self.__Token = self.__CurrentLine()[StartPos : 
self.CurrentOffsetWithinLine]
-return True
-else:
-return False
 ## __GetNextGuid() method
 #
 #   Get next token unit before a seperator
@@ -1247,28 +1225,6 @@ class FdfParser:
 self.__UndoToken()
 return False
 
-## __GetNextPcdName() method
-#
-#   Get next PCD token space C name and PCD C name pair before a seperator
-#   If found, the decimal data is put into self.__Token
-#
-#   @param  selfThe object pointer
-#   @retval Tuple   PCD C name and PCD token space C name pair
-#
-def __GetNextPcdName(self):
-if not self.__GetNextWord():
-raise Warning("expected format of 
.", self.FileName, self.CurrentLineNumber)
-pcdTokenSpaceCName = self.__Token
-
-if not self.__IsToken( "."):
-raise Warning("expected format of 
.", self.FileName, self.CurrentLineNumber)
-
-if not self.__GetNextWord():
-raise Warning("expected format of 
.", self.FileName, self.CurrentLineNumber)
-pcdCName = self.__Token
-
-return (pcdCName, pcdTokenSpaceCName)
-
 def __GetNextPcdSettings(self):
 if not self.__GetNextWord():
 raise Warning("expected format of 
.", self.FileName, self.CurrentLineNumber) @@ 
-3681,7 +3637,6 @@ class FdfParser:
   ModuleType.upper() + \
   '.'+ \
   TemplateName.upper() ] = RuleObj
-#self.Profile.RuleList.append(rule)
 return True
 
 ## __GetModuleType() method
@@ -4139,7 +4094,6 @@ class FdfParser:
 #   @retval False   Not able to find section statement
 #
 def __GetRuleEncapsulationSection(self, Rule):
-
 if self.__IsKeyword( "COMPRESS"):
 Type = "PI_STD"
 if self.__IsKeyword("PI_STD") or self.__IsKeyword("PI_NONE"):
@@ -4207,7 +4161,6 @@ class FdfParser:
 #   @retval False   Not able to find a VTF
 #
 def __GetVtf(self):
-
 if not self.__GetNextToken():
 return False
 
@@ -4279,7 +4232,6 @@ class FdfParser:
 #   @retval False   Not able to find a component
 #
 def __GetComponentStatement(self, VtfObj):
-
 if not self.__IsKeyword("COMP_NAME"):
 return False
 
@@ -4413,7 +4365,6 @@ class FdfParser:
 #   @retval False   Not able to find a OptionROM
 #
 def __GetOptionRom(self):
-
 if not self.__GetNextToken():
 return False
 
@@ -4454,7 +4405,6 @@ class FdfParser:
 #   @retval False   Not able to find inf statement
 #
 def __GetOptRomInfStatement(self, Obj):
-
 if not self.__IsKeyword( "INF"):
 return False
 
@@ -4557,7 +4507,6 @@ class FdfParser:
 #   @retval False   Not able to find FILE statement
 #
 def __GetOptRomFileStatement(self, Obj):
-
 if not self.__IsKeyword( "FILE"):
 return False
 
@@ -4592,7 +4541,6 @@ class FdfParser:
 #   @retval CapList List of Capsule in FD
 #
 def __GetCapInFd (self, FdName):
-
 CapList = []
 if FdName.upper() in self.Profile.FdDict:
 FdObj

Re: [edk2] [Patch] BaseTools: Align the boolean type PCD value's display in the report

2018-09-12 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, September 12, 2018 9:50 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Align the boolean type PCD value's display 
in the report

From: zhijufan 

This patch align the boolean type PCD value's display in the build report. 
Original it may display 0x0, also may use 0 for the same PCD.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/build/BuildReport.py | 19 +--
 1 file changed, 17 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index a598d64..c7fa1b9 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1012,11 +1012,11 @@ class PcdReport(object):
 FileWrite(File, "")
 FileWrite(File, Key)
 First = False
 
 
-if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
 PcdValueNumber = int(PcdValue.strip(), 0)
 if DecDefaultValue is None:
 DecMatch = True
 else:
 DecDefaultValueNumber = int(DecDefaultValue.strip(), 
0) @@ -1100,10 +1100,19 @@ class PcdReport(object):
 DecMatch = False
 
 #
 # Report PCD item according to their override relationship
 #
+if Pcd.DatumType == 'BOOLEAN':
+if DscDefaultValue:
+DscDefaultValue = str(int(DscDefaultValue, 0))
+if DecDefaultValue:
+DecDefaultValue = str(int(DecDefaultValue, 0))
+if InfDefaultValue:
+InfDefaultValue = str(int(InfDefaultValue, 0))
+if Pcd.DefaultValue:
+Pcd.DefaultValue = str(int(Pcd.DefaultValue, 
+ 0))
 if DecMatch:
 self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, 
IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, 
DecDefaultValue, '  ')
 elif InfDefaultValue and InfMatch:
 self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, 
IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, 
DecDefaultValue, '*M')
 elif BuildOptionMatch:
@@ -1124,13 +1133,15 @@ class PcdReport(object):
 continue
 if not BuildOptionMatch:
 ModuleOverride = 
self.ModulePcdOverride.get((Pcd.TokenCName, Pcd.TokenSpaceGuidCName), {})
 for ModulePath in ModuleOverride:
 ModuleDefault = ModuleOverride[ModulePath]
-if Pcd.DatumType in TAB_PCD_CLEAN_NUMERIC_TYPES:
+if Pcd.DatumType in TAB_PCD_NUMERIC_TYPES:
 ModulePcdDefaultValueNumber = 
int(ModuleDefault.strip(), 0)
 Match = (ModulePcdDefaultValueNumber == 
PcdValueNumber)
+if Pcd.DatumType == 'BOOLEAN':
+ModuleDefault = 
+ str(ModulePcdDefaultValueNumber)
 else:
 Match = (ModuleDefault.strip() == 
PcdValue.strip())
 if Match:
 continue
 IsByteArray, ArrayList = 
ByteArrayForamt(ModuleDefault.strip())
@@ -1245,10 +1256,12 @@ class PcdReport(object):
 if SkuInfo.DefaultStoreDict:
 DefaultStoreList = 
sorted(SkuInfo.DefaultStoreDict.keys())
 for DefaultStore in DefaultStoreList:
 Value = SkuInfo.DefaultStoreDict[DefaultStore]
 IsByteArray, ArrayList = ByteArrayForamt(Value)
+if Pcd.DatumType == 'BOOLEAN':
+Value = str(int(Value, 0))
 if FirstPrint:
 FirstPrint = False
 if IsByteArray:
 if self.DefaultStoreSingle and 
self.SkuSingle:
 FileWrite(File, ' %-*s   : %6s %10s = 
%s' % (self.MaxLen, Flag + ' ' + PcdTokenCName, TypeName, '(' + Pcd.DatumType + 
')', '{'))
@@ -1307,10 +1320,12 @@ class PcdReport(object):
 self.PrintStructureInfo(File, 
OverrideF

Re: [edk2] [PATCH] BaseTools: pcd in commandLine.

2018-09-11 Thread Zhu, Yonghong
The patch's subject is too generic.

Best Regards,
Zhu Yonghong


-Original Message-
From: Zhao, ZhiqiangX 
Sent: Wednesday, September 12, 2018 9:41 AM
To: edk2-devel@lists.01.org
Cc: Zhao, ZhiqiangX ; Gao, Liming 
; Zhu, Yonghong ; Feng, Bob C 

Subject: [PATCH] BaseTools: pcd in commandLine.

In command line, the latter full assign value in commandLine should override 
the former field assign value.
For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}".

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 17 +
 BaseTools/Source/Python/build/BuildReport.py  | 20 
 2 files changed, 33 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index aaef404772..74cb135bbd 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1032,6 +1032,23 @@ class DscBuildData(PlatformBuildClassObject):
 PcdItem = BuildData.Pcds[key]
 if (TokenSpaceGuidCName, TokenCName) == 
(PcdItem.TokenSpaceGuidCName, PcdItem.TokenCName) and FieldName =="":
 PcdItem.DefaultValue = pcdvalue
+#In command line, the latter full assign value in commandLine should 
override the former field assign value.
+#For example, --pcd Token.pcd.field="" --pcd Token.pcd=H"{}"
+delete_assign = []
+field_assign = {}
+if GlobalData.BuildOptionPcd:
+for pcdTuple in GlobalData.BuildOptionPcd:
+TokenSpaceGuid, Token, Field = pcdTuple[0], pcdTuple[1], 
pcdTuple[2]
+if Field:
+if (TokenSpaceGuid, Token) not in field_assign:
+field_assign[TokenSpaceGuid, Token] = []
+field_assign[TokenSpaceGuid, Token].append(pcdTuple)
+else:
+if (TokenSpaceGuid, Token) in field_assign:
+delete_assign.extend(field_assign[TokenSpaceGuid, 
Token])
+field_assign[TokenSpaceGuid, Token] = []
+for item in delete_assign:
+GlobalData.BuildOptionPcd.remove(item)
 
 @staticmethod
 def HandleFlexiblePcd(TokenSpaceGuidCName, TokenCName, PcdValue, 
PcdDatumType, GuidDict, FieldName=''):
diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index a598d64244..3886a7a55e 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -982,12 +982,16 @@ class PcdReport(object):
 PcdValue = DecDefaultValue
 if DscDefaultValue:
 PcdValue = DscDefaultValue
-Pcd.DefaultValue = PcdValue
+#The DefaultValue of StructurePcd already be the latest, no 
need to update.
+if not self.IsStructurePcd(Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName):
+Pcd.DefaultValue = PcdValue
 if ModulePcdSet is not None:
 if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in 
ModulePcdSet:
 continue
 InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName, Type]
-Pcd.DefaultValue = PcdValue
+#The DefaultValue of StructurePcd already be the latest, 
no need to update.
+if not self.IsStructurePcd(Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName):
+Pcd.DefaultValue = PcdValue
 if InfDefaultValue:
 try:
 InfDefaultValue = 
ValueExpressionEx(InfDefaultValue, Pcd.DatumType, self._GuidDict)(True) @@ 
-1003,7 +1007,9 @@ class PcdReport(object):
 if pcd[2]:
 continue
 PcdValue = pcd[3]
-Pcd.DefaultValue = PcdValue
+#The DefaultValue of StructurePcd already be the 
latest, no need to update.
+if not self.IsStructurePcd(Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName):
+Pcd.DefaultValue = PcdValue
 BuildOptionMatch = True
 break
 
@@ -1050,7 +1056,7 @@ class PcdReport(object):
 DscMatch = (DscDefaultValue.strip() == 
PcdValue.strip())
 
 IsStructure = False
-if GlobalData.gStructurePcd and (self.Arch in 
GlobalData.gStructurePcd) and ((Pcd.TokenCName, Pcd.TokenSpaceGuidCName) in 
GlobalData.gStructurePcd[self.Arch]):
+   

Re: [edk2] [Patch] BaseTools: Report error for incorrect hex value format

2018-09-11 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, September 11, 2018 10:51 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Report error for incorrect hex value format

From: zhijufan 

The case is user use 0x1} as a hex value for Pcd, it directly cause tool report 
traceback info. This patch add more error info.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Common/Misc.py | 5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 2cf9574..430bf6b 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1412,11 +1412,14 @@ def ParseFieldValue (Value):
 if Value.startswith('DEVICE_PATH(') and Value.endswith(')'):
 Value = Value.replace("DEVICE_PATH(", '').rstrip(')')
 Value = Value.strip().strip('"')
 return ParseDevPathValue(Value)
 if Value.lower().startswith('0x'):
-Value = int(Value, 16)
+try:
+Value = int(Value, 16)
+except:
+raise BadExpression("invalid hex value: %s" % Value)
 if Value == 0:
 return 0, 1
 return Value, (Value.bit_length() + 7) / 8
 if Value[0].isdigit():
 Value = int(Value, 10)
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools/GenFds: delete unused file

2018-09-09 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, September 06, 2018 10:06 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools/GenFds: delete unused file

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/Attribute.py | 28 
 1 file changed, 28 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/Attribute.py 
b/BaseTools/Source/Python/GenFds/Attribute.py
deleted file mode 100644
index 97b4ae01c633..
--- a/BaseTools/Source/Python/GenFds/Attribute.py
+++ /dev/null
@@ -1,28 +0,0 @@
-## @file
-# name value pair
-#
-#  Copyright (c) 2007 - 2018, 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 Modules
-#
-
-## name value pair
-#
-#
-class Attribute:
-## The constructor
-#
-#   @param  selfThe object pointer
-def __init__(self):
-self.Name = None
-self.Value = None
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: refactor to remove duplicate functions

2018-09-06 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, September 06, 2018 5:51 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
Feng, Bob C 
Subject: [PATCH v1 1/1] BaseTools: refactor to remove duplicate functions

Update GenFdsGlobalVariable GetAlignment to support G.
replace use of local function in Region with updated shared function.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Bob C Feng 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 11 +-
 BaseTools/Source/Python/GenFds/Region.py   | 21 
+---
 2 files changed, 7 insertions(+), 25 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 
b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index eb106b574420..77873d36b98a 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -512,14 +512,15 @@ class GenFdsGlobalVariable:
 
 @staticmethod
 def GetAlignment (AlignString):
-if AlignString is None:
+if not AlignString:
 return 0
-if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", 
"128K", "256K", "512K"):
+if AlignString.endswith('K'):
 return int (AlignString.rstrip('K')) * 1024
-elif AlignString in ("1M", "2M", "4M", "8M", "16M"):
+if AlignString.endswith('M'):
 return int (AlignString.rstrip('M')) * 1024 * 1024
-else:
-return int (AlignString)
+if AlignString.endswith('G'):
+return int (AlignString.rstrip('G')) * 1024 * 1024 * 1024
+return int (AlignString)
 
 @staticmethod
 def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, 
Align=None, diff --git a/BaseTools/Source/Python/GenFds/Region.py 
b/BaseTools/Source/Python/GenFds/Region.py
index 7f94b3d66b55..5242b74c9e70 100644
--- a/BaseTools/Source/Python/GenFds/Region.py
+++ b/BaseTools/Source/Python/GenFds/Region.py
@@ -124,7 +124,7 @@ class Region(RegionClassObject):
 #
 self.BlockInfoOfRegion(BlockSizeList, FvObj)
 self.FvAddress = self.FvAddress + FvOffset
-FvAlignValue = self.GetFvAlignValue(FvObj.FvAlignment)
+FvAlignValue = 
+ GenFdsGlobalVariable.GetAlignment(FvObj.FvAlignment)
 if self.FvAddress % FvAlignValue != 0:
 EdkLogger.error("GenFds", GENFDS_ERROR,
 "FV (%s) is NOT %s Aligned!" % 
(FvObj.UiFvName, FvObj.FvAlignment)) @@ -277,25 +277,6 @@ class 
Region(RegionClassObject):
 GenFdsGlobalVariable.InfLogger('   Region Name = None')
 self.PadBuffer(Buffer, ErasePolarity, Size)
 
-def GetFvAlignValue(self, Str):
-AlignValue = 1
-Granu = 1
-Str = Str.strip().upper()
-if Str.endswith('K'):
-Granu = 1024
-Str = Str[:-1]
-elif Str.endswith('M'):
-Granu = 1024 * 1024
-Str = Str[:-1]
-elif Str.endswith('G'):
-Granu = 1024 * 1024 * 1024
-Str = Str[:-1]
-else:
-pass
-
-AlignValue = int(Str) * Granu
-return AlignValue
-
 ## BlockSizeOfRegion()
 #
 #   @param  BlockSizeListList of block information
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix a bug about list the PCD in "not used" section

2018-09-05 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, September 05, 2018 10:52 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Fix a bug about list the PCD in "not used" 
section

From: zhijufan 

Defined a pcd in Ovmf.dec and used that pcd in AcpiPlatformDxe.inf, then assign 
a value to that pcd from DSC, then build Ovmf platform successfully. But this 
Pcd was wrongly listed into not used section in the report.txt file.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/build/BuildReport.py | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index deb88a7..a598d64 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -817,10 +817,13 @@ class PcdReport(object):
 if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, PcdType) 
in package.Pcds:
 Pcd.DatumType = package.Pcds[(Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName, PcdType)].DatumType
 break
 
 PcdList = self.AllPcds.setdefault(Pcd.TokenSpaceGuidCName, 
{}).setdefault(Pcd.Type, [])
+UnusedPcdList = 
self.UnusedPcds.setdefault(Pcd.TokenSpaceGuidCName, {}).setdefault(Pcd.Type, [])
+if Pcd in UnusedPcdList:
+UnusedPcdList.remove(Pcd)
 if Pcd not in PcdList and Pcd not in UnusedPcdFullList:
 UnusedPcdFullList.append(Pcd)
 if len(Pcd.TokenCName) > self.MaxLen:
 self.MaxLen = len(Pcd.TokenCName)
 
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools/GenFds: remove function without callers

2018-09-05 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, September 06, 2018 6:26 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools/GenFds: remove function without callers

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 17 -
 1 file changed, 17 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py 
b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
index eb106b574420..d859a905eb84 100644
--- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
+++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py
@@ -591,23 +591,6 @@ class GenFdsGlobalVariable:
 
 GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate FV")
 
-@staticmethod
-def GenerateVtf(Output, Input, BaseAddress=None, FvSize=None):
-if not GenFdsGlobalVariable.NeedsUpdate(Output, Input):
-return
-GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update 
because of newer %s" % (Output, Input))
-
-Cmd = ["GenVtf"]
-if BaseAddress and FvSize \
-and len(BaseAddress) == len(FvSize):
-for I in range(0, len(BaseAddress)):
-Cmd += ("-r", BaseAddress[I], "-s", FvSize[I])
-Cmd += ("-o", Output)
-for F in Input:
-Cmd += ("-f", F)
-
-GenFdsGlobalVariable.CallExternalTool(Cmd, "Failed to generate VTF")
-
 @staticmethod
 def GenerateFirmwareImage(Output, Input, Type="efi", SubType=None, 
Zero=False,
   Strip=False, Replace=False, TimeStamp=None, 
Join=False,
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Report more clear error message for PCD used in expression

2018-09-04 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, September 04, 2018 3:16 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Report more clear error message for PCD used 
in expression

From: zhijufan 

Only the FeatureFlag type or FixedAtBuild type can be used in the expression.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Common/Expression.py  | 2 +-
 BaseTools/Source/Python/Common/RangeExpression.py | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Expression.py 
b/BaseTools/Source/Python/Common/Expression.py
index 78c69fa..ff92710 100644
--- a/BaseTools/Source/Python/Common/Expression.py
+++ b/BaseTools/Source/Python/Common/Expression.py
@@ -27,11 +27,11 @@ ERR_STRING_EXPR = 'This operator cannot be used in 
string expression: [%
 ERR_SNYTAX  = 'Syntax error, the rest of expression cannot be 
evaluated: [%s].'
 ERR_MATCH   = 'No matching right parenthesis.'
 ERR_STRING_TOKEN= 'Bad string token: [%s].'
 ERR_MACRO_TOKEN = 'Bad macro token: [%s].'
 ERR_EMPTY_TOKEN = 'Empty token is not allowed.'
-ERR_PCD_RESOLVE = 'PCD token cannot be resolved: [%s].'
+ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild 
type: [%s].'
 ERR_VALID_TOKEN = 'No more valid token found from rest of string: 
[%s].'
 ERR_EXPR_TYPE   = 'Different types found in expression.'
 ERR_OPERATOR_UNSUPPORT  = 'Unsupported operator: [%s]'
 ERR_REL_NOT_IN  = 'Expect "IN" after "not" operator.'
 WRN_BOOL_EXPR   = 'Operand of boolean type cannot be used in 
arithmetic expression.'
diff --git a/BaseTools/Source/Python/Common/RangeExpression.py 
b/BaseTools/Source/Python/Common/RangeExpression.py
index 20581ed..407dc06 100644
--- a/BaseTools/Source/Python/Common/RangeExpression.py
+++ b/BaseTools/Source/Python/Common/RangeExpression.py
@@ -24,11 +24,11 @@ ERR_STRING_EXPR = 'This operator cannot be used in string 
expression: [%s].'
 ERR_SNYTAX = 'Syntax error, the rest of expression cannot be evaluated: [%s].'
 ERR_MATCH = 'No matching right parenthesis.'
 ERR_STRING_TOKEN = 'Bad string token: [%s].'
 ERR_MACRO_TOKEN = 'Bad macro token: [%s].'
 ERR_EMPTY_TOKEN = 'Empty token is not allowed.'
-ERR_PCD_RESOLVE = 'PCD token cannot be resolved: [%s].'
+ERR_PCD_RESOLVE = 'The PCD should be FeatureFlag type or FixedAtBuild type: 
[%s].'
 ERR_VALID_TOKEN = 'No more valid token found from rest of string: [%s].'
 ERR_EXPR_TYPE = 'Different types found in expression.'
 ERR_OPERATOR_UNSUPPORT = 'Unsupported operator: [%s]'
 ERR_REL_NOT_IN = 'Expect "IN" after "not" operator.'
 WRN_BOOL_EXPR = 'Operand of boolean type cannot be used in arithmetic 
expression.'
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Extend the keyword "!include"/"!if" to case-insensitive

2018-09-04 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, September 04, 2018 10:38 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Extend the keyword "!include"/"!if" to 
case-insensitive

From: zhijufan 

Extend the keyword "!include", "!if", etc to case-insensitive.
Current DSC parser already support it, while FDF parser only support the lower 
case, so this patch add the support for FDF parser.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 8de0b48..7e1be65 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -,10 +,12 @@ class FdfParser:
 
 EndPos = self.CurrentOffsetWithinLine
 if self.CurrentLineNumber != StartLine:
 EndPos = len(self.Profile.FileLinesList[StartLine-1])
 self.__Token = self.Profile.FileLinesList[StartLine-1][StartPos : 
EndPos]
+if self.__Token.lower() in [TAB_IF, TAB_END_IF, TAB_ELSE_IF, TAB_ELSE, 
TAB_IF_DEF, TAB_IF_N_DEF, TAB_ERROR, TAB_INCLUDE]:
+self.__Token = self.__Token.lower()
 if StartPos != self.CurrentOffsetWithinLine:
 return True
 else:
 return False
 
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: minimize assignment processing

2018-08-30 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Wednesday, August 29, 2018 6:51 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: minimize assignment processing

Reverse the checking and only assign once to each variable.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623fd3..e4f5cba156c5 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1534,15 +1534,16 @@ class DscBuildData(PlatformBuildClassObject):
 PcdValueDict[PcdCName, TokenSpaceGuid] = {SkuName:(PcdValue, 
DatumType, MaxDatumSize)}
 
 for ((PcdCName, TokenSpaceGuid), PcdSetting) in 
PcdValueDict.iteritems():
-PcdValue = None
-DatumType = None
-MaxDatumSize = None
-if TAB_COMMON in PcdSetting:
-PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON]
-if TAB_DEFAULT in PcdSetting:
-PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT]
 if self.SkuIdMgr.SystemSkuId in PcdSetting:
 PcdValue, DatumType, MaxDatumSize = 
PcdSetting[self.SkuIdMgr.SystemSkuId]
+elif TAB_DEFAULT in PcdSetting:
+PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_DEFAULT]
+elif TAB_COMMON in PcdSetting:
+PcdValue, DatumType, MaxDatumSize = PcdSetting[TAB_COMMON]
+else:
+PcdValue = None
+DatumType = None
+MaxDatumSize = None
 
 Pcds[PcdCName, TokenSpaceGuid] = PcdClassObject(
 PcdCName,
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: Clarify a DSC parsing error about PCDs

2018-08-30 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Wednesday, August 29, 2018 11:16 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
Hamel, Lee M 
Subject: [PATCH v1 1/1] BaseTools: Clarify a DSC parsing error about PCDs

This error needs the information about which DEC files were searched.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Cc: Lee Hamel 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DscBuildData.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623fd3..0c4f2a928c39 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -859,7 +859,7 @@ class DscBuildData(PlatformBuildClassObject):
 
 if (PcdCName, TokenSpaceGuid) not in self._DecPcds:
 EdkLogger.error('build', PARSER_ERROR,
-"Pcd (%s.%s) defined in DSC is not declared in DEC 
files. Arch: ['%s']" % (TokenSpaceGuid, PcdCName, self._Arch),
+"Pcd (%s.%s) defined in DSC is not declared in DEC 
files referenced in INF files in FDF. Arch: ['%s']" % (TokenSpaceGuid, 
PcdCName, self._Arch),
 File=self.MetaFile, Line=LineNo)
 ValueList, IsValid, Index = AnalyzeDscPcd(Setting, PcdType, 
self._DecPcds[PcdCName, TokenSpaceGuid].DatumType)
 if not IsValid:
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: Refactor to remove functionally equivalent functions

2018-08-30 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Wednesday, August 29, 2018 10:42 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: Refactor to remove functionally equivalent 
functions

IsSupportedArch and IsBinaryModule return the same value under the same 
curcimstances.  Remove newer one with fewer callers and send them to the other 
function.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 4 ++--
 BaseTools/Source/Python/Workspace/InfBuildData.py | 8 +---
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..5c0df45bb90a 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1092,7 +1092,7 @@ class PlatformAutoGen(AutoGen):
 for Inf in self._AsBuildInfList:
 InfClass = PathClass(NormPath(Inf), GlobalData.gWorkspace, 
self.Arch)
 M = self.BuildDatabase[InfClass, self.Arch, self.BuildTarget, 
self.ToolChain]
-if not M.IsSupportedArch:
+if not M.IsBinaryModule:
 continue
 self._AsBuildModuleList.append(InfClass)
 # get library/modules for build @@ -1347,7 +1347,7 @@ class 
PlatformAutoGen(AutoGen):
 # If a module INF in FDF but not in current arch's DSC module 
list, it must be module (either binary or source)
 # for different Arch. PCDs in source module for different Arch 
is already added before, so skip the source module here.
 # For binary module, if in current arch, we need to list the 
PCDs into database.
-if not M.IsSupportedArch:
+if not M.IsBinaryModule:
 continue
 # Override the module PCD setting by platform setting
 ModulePcdList = self.ApplyPcdSetting(M, M.Pcds) diff --git 
a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 7c3d712efe63..44ced491ad55 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -578,12 +578,7 @@ class InfBuildData(ModuleBuildClassObject):
 EdkLogger.error('build', RESOURCE_NOT_AVAILABLE, 
ExtraData=ErrorInfo, File=self.MetaFile)
 
 return Binaries
-## Check whether it exists the binaries with current ARCH in AsBuild INF
-def _IsSupportedArch(self):
-if self._GetBinaries() and not self._GetSourceFiles():
-return True
-else:
-return False
+
 ## Retrieve source files
 def _GetSourceFiles(self):
 # Ignore all source files in a binary build mode @@ -1170,4 +1165,3 @@ 
class InfBuildData(ModuleBuildClassObject):
 Depex   = property(_GetDepex)
 DepexExpression = property(_GetDepexExpression)
 IsBinaryModule  = property(_IsBinaryModule)
-IsSupportedArch = property(_IsSupportedArch)
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: include variable namespace GUIDs of HII PCDs in Guid.xref

2018-08-30 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, August 29, 2018 11:57 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: include variable namespace GUIDs of HII PCDs 
in Guid.xref

From: zhijufan 

[PcdsDynamicHii]
gFooTokenSpaceGuid.PcdBar|L"Variable"|gVarNameSpaceGuid|0x0|FALSE|NV,BS

This patch add the variable namespace GUIDs in "Guid.xref" that are used with 
dynamic HII PCDs.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=452
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 11 +++
 1 file changed, 11 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 2307a19..9dec9c5 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -601,16 +601,27 @@ class GenFds :
 print(ModuleObj.BaseName + ' ' + ModuleObj.ModuleType)
 
 def GenerateGuidXRefFile(BuildDb, ArchList, FdfParserObj):
 GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, 
"Guid.xref")
 GuidXRefFile = BytesIO('')
+PkgGuidDict = {}
 GuidDict = {}
 ModuleList = []
 FileGuidList = []
 GuidPattern = gGuidPattern
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
+PkgList = 
GenFdsGlobalVariable.WorkSpace.GetPackageList(GenFdsGlobalVariable.ActivePlatform,
 Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag)
+for P in PkgList:
+PkgGuidDict.update(P.Guids)
+for Name, Guid in PlatformDataBase.Pcds:
+Pcd = PlatformDataBase.Pcds[Name, Guid]
+if Pcd.Type in [TAB_PCDS_DYNAMIC_HII, TAB_PCDS_DYNAMIC_EX_HII]:
+for SkuId in Pcd.SkuInfoList:
+Sku = Pcd.SkuInfoList[SkuId]
+if Sku.VariableGuid and Sku.VariableGuid in 
PkgGuidDict.keys():
+GuidDict[Sku.VariableGuid] = 
+ PkgGuidDict[Sku.VariableGuid]
 for ModuleFile in PlatformDataBase.Modules:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 if Module in ModuleList:
 continue
 else:
--
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' from DataType

2018-08-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Saturday, August 25, 2018 12:33 AM
To: edk2-devel@lists.01.org
Cc: Feng, Bob C ; Zhu, Yonghong ; 
Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: Create and use a shared value for 'MSFT' 
from DataType

I see lots of 'MSFT' throughout code and this can reduce them.

Cc: Bob Feng 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py  |  8 
 BaseTools/Source/Python/AutoGen/BuildEngine.py  |  8 
 BaseTools/Source/Python/AutoGen/GenMake.py  |  3 ++-
 BaseTools/Source/Python/Common/DataType.py  |  2 ++
 BaseTools/Source/Python/Ecc/MetaFileWorkspace/MetaFileParser.py |  2 +-
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py  |  4 ++--
 BaseTools/Source/Python/Workspace/DscBuildData.py   |  4 ++--
 BaseTools/Source/Python/Workspace/InfBuildData.py   | 14 
+++---
 BaseTools/Source/Python/build/build.py  |  2 +-
 9 files changed, 25 insertions(+), 22 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..cb302189d2a3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -80,7 +80,7 @@ gEfiVarStoreNamePattern = re.compile("\s*name\s*=\s*(\w+)")  
gEfiVarStoreGuidPattern = re.compile("\s*guid\s*=\s*({.*?{.*?}\s*})")
 
 ## Mapping Makefile type
-gMakeTypeMap = {"MSFT":"nmake", "GCC":"gmake"}
+gMakeTypeMap = {TAB_COMPILER_MSFT:"nmake", "GCC":"gmake"}
 
 
 ## Build rule configuration file
@@ -1843,7 +1843,7 @@ class PlatformAutoGen(AutoGen):
or not ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]:
 EdkLogger.verbose("No tool chain family found in configuration 
for %s. Default to MSFT." \
% self.ToolChain)
-self._ToolChainFamily = "MSFT"
+self._ToolChainFamily = TAB_COMPILER_MSFT
 else:
 self._ToolChainFamily = 
ToolDefinition[TAB_TOD_DEFINES_FAMILY][self.ToolChain]
 return self._ToolChainFamily
@@ -1856,7 +1856,7 @@ class PlatformAutoGen(AutoGen):
or not 
ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]:
 EdkLogger.verbose("No tool chain family found in configuration 
for %s. Default to MSFT." \
% self.ToolChain)
-self._BuildRuleFamily = "MSFT"
+self._BuildRuleFamily = TAB_COMPILER_MSFT
 else:
 self._BuildRuleFamily = 
ToolDefinition[TAB_TOD_DEFINES_BUILDRULEFAMILY][self.ToolChain]
 return self._BuildRuleFamily
@@ -2978,7 +2978,7 @@ class ModuleAutoGen(AutoGen):
 # Regular expression for finding Include Directories, the difference 
between MSFT and INTEL/GCC/RVCT
 # is the former use /I , the Latter used -I to specify include 
directories
 #
-if self.PlatformInfo.ToolChainFamily in ('MSFT'):
+if self.PlatformInfo.ToolChainFamily in (TAB_COMPILER_MSFT):
 BuildOptIncludeRegEx = gBuildOptIncludePatternMsft
 elif self.PlatformInfo.ToolChainFamily in ('INTEL', 'GCC', 'RVCT'):
 BuildOptIncludeRegEx = gBuildOptIncludePatternOther diff --git 
a/BaseTools/Source/Python/AutoGen/BuildEngine.py 
b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 4291da9001b8..ac7a6687552c 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -318,7 +318,7 @@ class BuildRule:
 #   @param  LineIndex   The line number from which the parsing 
will begin
 #   @param  SupportedFamily The list of supported tool chain families
 #
-def __init__(self, File=None, Content=None, LineIndex=0, 
SupportedFamily=["MSFT", "INTEL", "GCC", "RVCT"]):
+def __init__(self, File=None, Content=None, LineIndex=0, 
SupportedFamily=[TAB_COMPILER_MSFT, "INTEL", "GCC", "RVCT"]):
 self.RuleFile = File
 # Read build rules from file if it's not none
 if File is not None:
@@ -596,17 +596,17 @@ if __name__ == '__main__':
 EdkLogger.Initialize()
 if len(sys.argv) > 1:
 Br = BuildRule(sys.argv[1])
-print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", "MSFT"][1]))
+print(str(Br[".c", SUP_MODULE_DXE_DRIVER, "IA32", 
+ TAB_COMPILER_MSFT][1]))
 print()
 print(str(Br[".c", SUP_MODULE_DXE_DRIVER,

Re: [edk2] [PATCH v1 1/1] BaseTools: AutoGen.py remove unused import

2018-08-28 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Tuesday, August 28, 2018 6:08 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: AutoGen.py remove unused import

AutoGen does not use anything defined in BuildClassObject

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b28388967..314a321e95c6 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -39,7 +39,6 @@ from Common.StringUtils import *  import Common.GlobalData as 
GlobalData  from GenFds.FdfParser import *  from CommonDataClass.CommonClass 
import SkuInfoClass -from Workspace.BuildClassObject import *  from 
GenPatchPcdTable.GenPatchPcdTable import parsePcdInfoFromMapFile  import 
Common.VpdInfoFile as VpdInfoFile  from .GenPcdDb import CreatePcdDatabaseCode
--
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Add check only VOID* type Pcd need the maxsize info

2018-08-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Monday, August 27, 2018 10:03 AM
To: edk2-devel@lists.01.org
Cc: Fan, ZhijuX ; Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Add check only VOID* type Pcd need the 
maxsize info

From: zhijufan 

Add check for the datum type keyword "VOID*", only the VOID* type Pcd need the 
additional maxsize info.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Source/Python/Common/Misc.py| 53 +++
 .../Source/Python/Workspace/DscBuildData.py   |  2 +-
 .../Source/Python/Workspace/MetaFileParser.py |  4 ++
 3 files changed, 23 insertions(+), 36 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 74a5f0bca5..5a63c83a2a 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -1432,9 +1432,9 @@ def ParseFieldValue (Value):
 ## AnalyzeDscPcd
 #
 #  Analyze DSC PCD value, since there is no data type info in DSC -#  This 
fuction is used to match functions (AnalyzePcdData) used for retrieving PCD 
value from database
+#  This function is used to match functions (AnalyzePcdData) used for 
+retrieving PCD value from database
 #  1. Feature flag: TokenSpace.PcdCName|PcdValue -#  2. Fix and 
Patch:TokenSpace.PcdCName|PcdValue[|MaxSize]
+#  2. Fix and Patch:TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]]
 #  3. Dynamic default:
 # TokenSpace.PcdCName|PcdValue[|VOID*[|MaxSize]]
 # TokenSpace.PcdCName|PcdValue
@@ -1442,7 +1442,7 @@ def ParseFieldValue (Value):
 # TokenSpace.PcdCName|VpdOffset[|VpdValue]
 # TokenSpace.PcdCName|VpdOffset[|MaxSize[|VpdValue]]
 #  5. Dynamic HII:
-# TokenSpace.PcdCName|HiiString|VaiableGuid|VariableOffset[|HiiValue]
+# TokenSpace.PcdCName|HiiString|VariableGuid|VariableOffset[|HiiValue]
 #  PCD value needs to be located in such kind of string, and the PCD value 
might be an expression in which
 #there might have "|" operator, also in string value.
 #
@@ -1458,42 +1458,20 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
 FieldList = AnalyzePcdExpression(Setting)
 
 IsValid = True
-if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, 
MODEL_PCD_FEATURE_FLAG):
+if PcdType in (MODEL_PCD_FIXED_AT_BUILD, MODEL_PCD_PATCHABLE_IN_MODULE, 
MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
 Value = FieldList[0]
 Size = ''
-if len(FieldList) > 1:
-if FieldList[1].upper().startswith("0X") or FieldList[1].isdigit():
-Size = FieldList[1]
-else:
-DataType = FieldList[1]
-
-if len(FieldList) > 2:
-Size = FieldList[2]
-if DataType == "":
-IsValid = (len(FieldList) <= 1)
-else:
-IsValid = (len(FieldList) <= 3)
-# Value, Size = ParseFieldValue(Value)
-if Size:
-try:
-int(Size, 16) if Size.upper().startswith("0X") else int(Size)
-except:
+if len(FieldList) > 1 and FieldList[1]:
+DataType = FieldList[1]
+if FieldList[1] != TAB_VOID:
 IsValid = False
-Size = -1
-return [str(Value), '', str(Size)], IsValid, 0
-elif PcdType in (MODEL_PCD_DYNAMIC_DEFAULT, MODEL_PCD_DYNAMIC_EX_DEFAULT):
-Value = FieldList[0]
-Size = Type = ''
-if len(FieldList) > 1:
-Type = FieldList[1]
-else:
-Type = DataType
 if len(FieldList) > 2:
 Size = FieldList[2]
-if DataType == "":
-IsValid = (len(FieldList) <= 1)
-else:
-IsValid = (len(FieldList) <= 3)
+if IsValid:
+if DataType == "":
+IsValid = (len(FieldList) <= 1)
+else:
+IsValid = (len(FieldList) <= 3)
 
 if Size:
 try:
@@ -1501,7 +1479,12 @@ def AnalyzeDscPcd(Setting, PcdType, DataType=''):
 except:
 IsValid = False
 Size = -1
-return [Value, Type, str(Size)], IsValid, 0
+return [str(Value), DataType, str(Size)], IsValid, 0
+elif PcdType == MODEL_PCD_FEATURE_FLAG:
+Value = FieldList[0]
+Size = ''
+IsValid = (len(FieldList) <= 1)
+return [Value, DataType, str(Size)], IsValid, 0
 elif PcdType in (MODEL_PCD_DYNAMIC_VPD, MODEL_PCD_DYNAMIC_EX_VPD):
 VpdOffset = FieldList[0]
 Value = Size = ''
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index a4ad53ee15..748452623f 100644
--- a/BaseTools/Source

Re: [edk2] Can we use python 3 to build edk2?

2018-08-27 Thread Zhu, Yonghong
We have a bugzilla. https://bugzilla.tianocore.org/show_bug.cgi?id=55 
Current I am working on it. And planned to finish to migrate to Python 3 before 
end of October.

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Laszlo 
Ersek
Sent: Monday, August 27, 2018 9:27 PM
To: heyi@linaro.org
Cc: Kinney, Michael D ; edk2-devel@lists.01.org; 
Gary Ching-Pang Lin ; Gao, Liming 
Subject: Re: [edk2] Can we use python 3 to build edk2?

On 08/27/18 13:53, heyi@linaro.org wrote:
> It is said that python3 is not compatible with python2.

Did you mean s/said/sad/? :)

> Can we use python3 to build edk2?

Gary and Mike wrote several BaseTools patches for python3 compatibility; I'm 
unsure if we have a high-level tracker BZ for that. I don't know the current 
status. Adding Mike and Gary.

Thanks
Laszlo
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] Can we use python 3 to build edk2?

2018-08-27 Thread Zhu, Yonghong
We are in migrating BaseTools to Python3.

Best Regards,
Zhu Yonghong

-Original Message-
From: heyi@linaro.org [mailto:heyi@linaro.org] 
Sent: Monday, August 27, 2018 7:53 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: Can we use python 3 to build edk2?

It is said that python3 is not compatible with python2. Can we use python3 to 
build edk2?

Thanks,

Heyi
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 0/3] Optimizing code

2018-08-23 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu 

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Wednesday, August 08, 2018 2:55 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH 0/3] Optimizing code

Modify class OrderedListDict, remove cmp and use hashlib instead of
md5

Yunhua Feng (3):
  BaseTools: Modify class OrderedListDict
  BaseTools: remove cmp due to deprecated in python3
  BaseTools: Use hashlib instead of md5

 BaseTools/Source/Python/AutoGen/AutoGen.py|  6 +++---
 BaseTools/Source/Python/BPDG/GenVpd.py|  4 ++--
 BaseTools/Source/Python/UPT/GenMetaFile/GenDecFile.py |  4 ++--  
BaseTools/Source/Python/UPT/GenMetaFile/GenInfFile.py |  4 ++--
 BaseTools/Source/Python/UPT/InstallPkg.py | 12 ++--
 BaseTools/Source/Python/UPT/MkPkg.py  |  4 ++--
 BaseTools/Source/Python/UPT/RmPkg.py  |  4 ++--
 BaseTools/Source/Python/Workspace/MetaFileParser.py   |  6 +++---
 BaseTools/Source/Python/Workspace/WorkspaceCommon.py  |  6 +-
 9 files changed, 27 insertions(+), 23 deletions(-)

--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH V2] BaseTools: Fix regression issue by b23414f6540d

2018-08-20 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Tuesday, August 21, 2018 8:49 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
Carsey, Jaben 
Subject: [PATCH V2] BaseTools: Fix regression issue by b23414f6540d

V2: Renaming function DepexExpressionTokenList to  DepexExpressionDict instead 
of changing the callers

Fix regression issue by b23414f6540d4f336b6f00b44681911d469f9a04
AttributeError: 'ModuleAutoGen' object has no attribute 'DepexExpressionDict'

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 3b1ddc74e8..d30a9be6ee 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2899,11 +2899,11 @@ class ModuleAutoGen(AutoGen):
 ## Merge dependency expression
 #
 #   @retval listThe token list of the dependency expression after 
parsed
 #
 @cached_property
-def DepexExpressionTokenList(self):
+def DepexExpressionDict(self):
 if self.DxsFile or self.IsLibrary or TAB_DEPENDENCY_EXPRESSION_FILE in 
self.FileTypes:
 return {}
 
 RetVal = {self.ModuleType:''}
 
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: remove unused setter functions

2018-08-19 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Saturday, August 18, 2018 12:18 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: remove unused setter functions

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/DecBuildData.py | 17 +--  
BaseTools/Source/Python/Workspace/DscBuildData.py | 17 +--  
BaseTools/Source/Python/Workspace/InfBuildData.py | 30 ++--
 3 files changed, 4 insertions(+), 60 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DecBuildData.py 
b/BaseTools/Source/Python/Workspace/DecBuildData.py
index 7eeca9524529..45beaebc63ef 100644
--- a/BaseTools/Source/Python/Workspace/DecBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DecBuildData.py
@@ -116,21 +116,6 @@ class DecBuildData(PackageBuildClassObject):
 def _GetArch(self):
 return self._Arch
 
-## Set architecture
-#
-#   Changing the default ARCH to another may affect all other information
-# because all information in a platform may be ARCH-related. That's
-# why we need to clear all internal used members, in order to cause all
-# information to be re-retrieved.
-#
-#   @param  Value   The value of ARCH
-#
-def _SetArch(self, Value):
-if self._Arch == Value:
-return
-self._Arch = Value
-self._Clear()
-
 ## Retrieve all information in [Defines] section
 #
 #   (Retriving all [Defines] information in one-shot is just to save time.)
@@ -469,7 +454,7 @@ class DecBuildData(PackageBuildClassObject):
 
 
 _Macros = property(_GetMacros)
-Arch = property(_GetArch, _SetArch)
+Arch = property(_GetArch)
 PackageName = property(_GetPackageName)
 Guid = property(_GetFileGuid)
 Version = property(_GetVersion)
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index c7f07f464646..a4ad53ee1558 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -308,21 +308,6 @@ class DscBuildData(PlatformBuildClassObject):
 def _GetArch(self):
 return self._Arch
 
-## Set architecture
-#
-#   Changing the default ARCH to another may affect all other information
-# because all information in a platform may be ARCH-related. That's
-# why we need to clear all internal used members, in order to cause all
-# information to be re-retrieved.
-#
-#   @param  Value   The value of ARCH
-#
-def _SetArch(self, Value):
-if self._Arch == Value:
-return
-self._Arch = Value
-self._Clear()
-
 ## Retrieve all information in [Defines] section
 #
 #   (Retriving all [Defines] information in one-shot is just to save time.)
@@ -2849,7 +2834,7 @@ class DscBuildData(PlatformBuildClassObject):
 self._DecPcds, self._GuidDict = GetDeclaredPcd(self, self._Bdb, 
self._Arch, self._Target, self._Toolchain, PkgSet)
 return self._DecPcds
 _Macros = property(_GetMacros)
-Arch= property(_GetArch, _SetArch)
+Arch= property(_GetArch)
 Platform= property(_GetPlatformName)
 PlatformName= property(_GetPlatformName)
 Guid= property(_GetFileGuid)
diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 29e68aeb3bf3..8bff96b14942 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -173,36 +173,10 @@ class InfBuildData(ModuleBuildClassObject):
 def _GetArch(self):
 return self._Arch
 
-## Set architecture
-#
-#   Changing the default ARCH to another may affect all other information
-# because all information in a platform may be ARCH-related. That's
-# why we need to clear all internal used members, in order to cause all
-# information to be re-retrieved.
-#
-#   @param  Value   The value of ARCH
-#
-def _SetArch(self, Value):
-if self._Arch == Value:
-return
-self._Arch = Value
-self._Clear()
-
 ## Return the name of platform employing this module
 def _GetPlatform(self):
 return self._Platform
 
-## Change the name of platform employing this module
-#
-#   Changing the default name of platform to another may affect some 
information
-# because they may be PLATFORM-related. That's why we need to clear all 
internal
-# used members, in order to cause all information to be re-retrieved.
-#
-def _SetPlatform(self, Value):
-if self._Platform == Value:
-return
-self._Platform = Value

Re: [edk2] [PATCH v1 1/1] BaseTools: remove unused code

2018-08-17 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Carsey, Jaben 
Sent: Friday, August 17, 2018 7:24 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: remove unused code

the if statment just has pass statement.
invert if condition and just use do the else work.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Workspace/InfBuildData.py | 6 +-
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/InfBuildData.py 
b/BaseTools/Source/Python/Workspace/InfBuildData.py
index 29e68aeb3bf3..44eaebf62e50 100644
--- a/BaseTools/Source/Python/Workspace/InfBuildData.py
+++ b/BaseTools/Source/Python/Workspace/InfBuildData.py
@@ -370,11 +370,7 @@ class InfBuildData(ModuleBuildClassObject):
 self._Sources.append(File)
 else:
 ToolList = self._NMAKE_FLAG_PATTERN_.findall(Name)
-if len(ToolList) == 0 or len(ToolList) != 1:
-pass
-#EdkLogger.warn("build", "Don't know how to do with 
macro [%s]" % Name,
-#   File=self.MetaFile, Line=LineNo)
-else:
+if len(ToolList) == 1:
 if self._BuildOptions is None:
 self._BuildOptions = OrderedDict()
 
-- 
2.16.2.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] BaseTools: Eot - fix variable names

2018-08-13 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Wednesday, August 08, 2018 6:37 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH v1 1/1] BaseTools: Eot - fix variable names

1) currently a couple classes use m instead of self (including some mixed 
functions that should have previously failed).
2) deleted some blank lines.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Eot/Eot.py | 298 ++--
 1 file changed, 144 insertions(+), 154 deletions(-)

diff --git a/BaseTools/Source/Python/Eot/Eot.py 
b/BaseTools/Source/Python/Eot/Eot.py
index 6fb882642bff..ce83da14957b 100644
--- a/BaseTools/Source/Python/Eot/Eot.py
+++ b/BaseTools/Source/Python/Eot/Eot.py
@@ -123,49 +123,49 @@ class CompressedImage(Image):
 _ORIG_SIZE_ = struct.Struct("1I")
 _CMPRS_TYPE_= struct.Struct("4x 1B")
 
-def __init__(m, CompressedData=None, CompressionType=None, 
UncompressedLength=None):
-Image.__init__(m)
+def __init__(self, CompressedData=None, CompressionType=None, 
UncompressedLength=None):
+Image.__init__(self)
 if UncompressedLength is not None:
-m.UncompressedLength = UncompressedLength
+self.UncompressedLength = UncompressedLength
 if CompressionType is not None:
-m.CompressionType = CompressionType
+self.CompressionType = CompressionType
 if CompressedData is not None:
-m.Data = CompressedData
+self.Data = CompressedData
 
-def __str__(m):
+def __str__(self):
 global gIndention
-S = "algorithm=%s uncompressed=%x" % (m.CompressionType, 
m.UncompressedLength)
-for Sec in m.Sections:
+S = "algorithm=%s uncompressed=%x" % (self.CompressionType, 
self.UncompressedLength)
+for Sec in self.Sections:
 S += '\n' + str(Sec)
 
 return S
 
-def _SetOriginalSize(m, Size):
-m.SetField(m._ORIG_SIZE_, 0, Size)
+def _SetOriginalSize(self, Size):
+self.SetField(self._ORIG_SIZE_, 0, Size)
 
-def _GetOriginalSize(m):
-return m.GetField(m._ORIG_SIZE_)[0]
+def _GetOriginalSize(self):
+return self.GetField(self._ORIG_SIZE_)[0]
 
-def _SetCompressionType(m, Type):
-m.SetField(m._CMPRS_TYPE_, 0, Type)
+def _SetCompressionType(self, Type):
+self.SetField(self._CMPRS_TYPE_, 0, Type)
 
-def _GetCompressionType(m):
-return m.GetField(m._CMPRS_TYPE_)[0]
+def _GetCompressionType(self):
+return self.GetField(self._CMPRS_TYPE_)[0]
 
-def _GetSections(m):
+def _GetSections(self):
 try:
 from . import EfiCompressor
 TmpData = EfiCompressor.FrameworkDecompress(
-m[m._HEADER_SIZE_:],
-len(m) - m._HEADER_SIZE_
+self[self._HEADER_SIZE_:],
+len(self) - self._HEADER_SIZE_
 )
 DecData = array('B')
 DecData.fromstring(TmpData)
 except:
 from . import EfiCompressor
 TmpData = EfiCompressor.UefiDecompress(
-m[m._HEADER_SIZE_:],
-len(m) - m._HEADER_SIZE_
+self[self._HEADER_SIZE_:],
+len(self) - self._HEADER_SIZE_
 )
 DecData = array('B')
 DecData.fromstring(TmpData) @@ -195,20 +195,20 @@ class Ui(Image):
 _HEADER_ = struct.Struct("")
 _HEADER_SIZE_ = 0
 
-def __init__(m):
-Image.__init__(m)
+def __init__(self):
+Image.__init__(self)
 
-def __str__(m):
-return m.String
+def __str__(self):
+return self.String
 
-def _Unpack(m):
+def _Unpack(self):
 # keep header in this Image object
-m.empty()
-m.extend(m._BUF_[m._OFF_ : m._OFF_ + m._LEN_])
-return len(m)
+self.empty()
+self.extend(self._BUF_[self._OFF_ : self._OFF_ + self._LEN_])
+return len(self)
 
-def _GetUiString(m):
-return codecs.utf_16_decode(m[0:-2].tostring())[0]
+def _GetUiString(self):
+return codecs.utf_16_decode(self[0:-2].tostring())[0]
 
 String = property(_GetUiString)
 
@@ -250,18 +250,18 @@ class Depex(Image):
 0x09:   _OPCODE_,   #"SOR"
 }
 
-def __init__(m):
-Image.__init__(m)
-m._ExprList = []
+def __init__(self):
+Image.__init__(self)
+self._ExprList = []
 
-def __str__(m):
+def __str__(self):
 g

Re: [edk2] [PATCH v1 0/5] Refactor AutoGen - class ModuleAutoGen

2018-08-12 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Carsey, 
Jaben
Sent: Friday, August 03, 2018 11:46 PM
To: Carsey, Jaben ; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH v1 0/5] Refactor AutoGen - class ModuleAutoGen

Please ignore the numbering. My error. There are only 3 parts of this series.

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Jaben Carsey
> Sent: Friday, August 03, 2018 8:11 AM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v1 0/5] Refactor AutoGen - class ModuleAutoGen
> 
> This adds a decorator based caching mechanism for general use.
> This then changes ModuleAutoGen to use the mechanism via decorators 
> for some functions and properties.  This allows for reduction in 
> object size for objects as the functions are replaced by smaller data 
> blobs.
> Also some small cleanups.
> 
> Jaben Carsey (5):
>   BaseTools: AutoGen refactor ModuleAutoGen caching
>   BaseTools: AutoGen - tag a function as cachable
>   BaseTools: AutoGen refactor to iterate less
> 
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 1852 +---
> 
>  BaseTools/Source/Python/AutoGen/BuildEngine.py |   36 +-
>  BaseTools/Source/Python/AutoGen/GenC.py|2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py |   12 +-
>  BaseTools/Source/Python/Common/caching.py  |   47 +
>  5 files changed, 888 insertions(+), 1061 deletions(-)  create mode 
> 100644 BaseTools/Source/Python/Common/caching.py
> 
> --
> 2.16.2.windows.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid parameter

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Carsey, 
Jaben
Sent: Friday, August 03, 2018 11:07 PM
To: Gao, Liming ; edk2-devel@lists.01.org
Subject: Re: [edk2] [PATCH v1 1/1] PatchCheck - add error message for invalid 
parameter

Absolutely.  I should have thought to add that.

"Python ScriptCheck.py t"

Assuming there is no commit or file called "t".  Basically just anything that 
is not a commit identifier nor a filename.  I found it when I tried to select a 
commit and misspelled it.

-Jaben

> -Original Message-
> From: Gao, Liming
> Sent: Friday, August 03, 2018 2:44 AM
> To: Carsey, Jaben ; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v1 1/1] PatchCheck - add error message for 
> invalid parameter
> Importance: High
> 
> Jaben:
>   Could you give me one failure case? Then, I can further understand 
> the patch.
> 
> Thanks
> Liming
> >-Original Message-
> >From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> >Of Jaben Carsey
> >Sent: Friday, August 03, 2018 7:21 AM
> >To: edk2-devel@lists.01.org
> >Cc: Gao, Liming 
> >Subject: [edk2] [PATCH v1 1/1] PatchCheck - add error message for 
> >invalid parameter
> >
> >Currently if an invalid parameter is passed, it gives a stack trace.
> >This changes it to an error message.
> >
> >Cc: Liming Gao 
> >Cc: Yonghong Zhu 
> >Contributed-under: TianoCore Contribution Agreement 1.1
> >Signed-off-by: Jaben Carsey 
> >---
> > BaseTools/Scripts/PatchCheck.py | 9 ++---
> > 1 file changed, 6 insertions(+), 3 deletions(-)
> >
> >diff --git a/BaseTools/Scripts/PatchCheck.py 
> >b/BaseTools/Scripts/PatchCheck.py
> >index 7b7fba8b7044..96b3cdf1fd8a 100755
> >--- a/BaseTools/Scripts/PatchCheck.py
> >+++ b/BaseTools/Scripts/PatchCheck.py
> >@@ -1,7 +1,7 @@
> > ## @file
> > #  Check a patch for various format issues  # -#  Copyright (c) 2015 
> >- 2017, Intel Corporation. All rights reserved.
> >+#  Copyright (c) 2015 - 2018, 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 
> >@@ -528,6 +528,8 @@ class CheckGitCommits:
> > print('Checking git commit:', commit)
> > patch = self.read_patch_from_git(commit)
> > self.ok &= CheckOnePatch(commit, patch).ok
> >+if not commits:
> >+print("Couldn't find commit matching: 
> >+ '{}'".format(rev_spec))
> >
> > def read_commit_list_from_git(self, rev_spec, max_count):
> > # Run git to get the commit patch @@ -536,7 +538,7 @@ class 
> >CheckGitCommits:
> > cmd.append('--max-count=' + str(max_count))
> > cmd.append(rev_spec)
> > out = self.run_git(*cmd)
> >-return out.split()
> >+return out.split() if out else []
> >
> > def read_patch_from_git(self, commit):
> > # Run git to get the commit patch @@ -548,7 +550,8 @@ class 
> >CheckGitCommits:
> > p = subprocess.Popen(cmd,
> >  stdout=subprocess.PIPE,
> >  stderr=subprocess.STDOUT)
> >-return p.communicate()[0].decode('utf-8', 'ignore')
> >+Result = p.communicate()
> >+return Result[0].decode('utf-8', 'ignore') if Result[0] and
> >Result[0].find("fatal")!=0 else None
> >
> > class CheckOnePatchFile:
> > """Performs a patch check for a single file.
> >--
> >2.16.2.windows.1
> >
> >___
> >edk2-devel mailing list
> >edk2-devel@lists.01.org
> >https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Add Dns and BluetoothLE DevicePath

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, August 06, 2018 3:37 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Add Dns and BluetoothLE DevicePath

Add Dns and BluetoothLE for support DevicePath

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/DevicePath/DevicePathFromText.c | 127 +
 1 file changed, 127 insertions(+)

diff --git a/BaseTools/Source/C/DevicePath/DevicePathFromText.c 
b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
index bfd91d23b5..bb74e2e170 100644
--- a/BaseTools/Source/C/DevicePath/DevicePathFromText.c
+++ b/BaseTools/Source/C/DevicePath/DevicePathFromText.c
@@ -2537,10 +2537,135 @@ DevPathFromTextWiFi (
 
   return (EFI_DEVICE_PATH_PROTOCOL *) WiFiDp;  }
 
 /**
+  Converts a text device path node to Bluetooth LE device path structure.
+
+  @param TextDeviceNode  The input Text device path node.
+
+  @return A pointer to the newly-created Bluetooth LE device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextBluetoothLE (
+  IN CHAR16 *TextDeviceNode
+  )
+{
+  CHAR16 *BluetoothLeAddrStr;
+  CHAR16 *BluetoothLeAddrTypeStr;
+  BLUETOOTH_LE_DEVICE_PATH   *BluetoothLeDp;
+
+  BluetoothLeAddrStr = GetNextParamStr ();
+  BluetoothLeAddrTypeStr = GetNextParamStr ();  
+ BluetoothLeDp = (BLUETOOTH_LE_DEVICE_PATH *) CreateDeviceNode (
+ MESSAGING_DEVICE_PATH,
+ MSG_BLUETOOTH_LE_DP,
+ (UINT16) sizeof 
(BLUETOOTH_LE_DEVICE_PATH)
+ );
+
+  BluetoothLeDp->Address.Type = (UINT8) Strtoi 
+(BluetoothLeAddrTypeStr);
+  StrHexToBytes (
+BluetoothLeAddrStr, sizeof (BluetoothLeDp->Address.Address) * 2,
+BluetoothLeDp->Address.Address, sizeof (BluetoothLeDp->Address.Address)
+);
+  return (EFI_DEVICE_PATH_PROTOCOL *) BluetoothLeDp; }
+
+/**
+  Converts a text device path node to DNS device path structure.
+
+  @param TextDeviceNode  The input Text device path node.
+
+  @return A pointer to the newly-created DNS device path structure.
+
+**/
+EFI_DEVICE_PATH_PROTOCOL *
+DevPathFromTextDns (
+  IN CHAR16 *TextDeviceNode
+  )
+{
+  CHAR16*DeviceNodeStr;
+  CHAR16*DeviceNodeStrPtr;
+  UINT32DnsServerIpCount;
+  UINT16DnsDeviceNodeLength;
+  DNS_DEVICE_PATH   *DnsDeviceNode;
+  UINT32DnsServerIpIndex;
+  CHAR16*DnsServerIp;
+
+
+  //
+  // Count the DNS server address number.
+  //
+  DeviceNodeStr = UefiDevicePathLibStrDuplicate (TextDeviceNode);  if 
+ (DeviceNodeStr == NULL) {
+return NULL;
+  }
+
+  DeviceNodeStrPtr = DeviceNodeStr;
+
+  DnsServerIpCount = 0;
+  while (DeviceNodeStrPtr != NULL && *DeviceNodeStrPtr != L'\0') {
+GetNextParamStr ();
+DnsServerIpCount ++;
+  }
+
+  free (DeviceNodeStr);
+  DeviceNodeStr = NULL;
+
+  //
+  // One or more instances of the DNS server address in EFI_IP_ADDRESS,  
+ // otherwise, NULL will be returned.
+  //
+  if (DnsServerIpCount == 0) {
+return NULL;
+  }
+
+  //
+  // Create the DNS DeviceNode.
+  //
+  DnsDeviceNodeLength = (UINT16) (sizeof (EFI_DEVICE_PATH_PROTOCOL) + sizeof 
(UINT8) + DnsServerIpCount * sizeof (EFI_IP_ADDRESS));
+  DnsDeviceNode   = (DNS_DEVICE_PATH *) CreateDeviceNode (
+  MESSAGING_DEVICE_PATH,
+  MSG_DNS_DP,
+  DnsDeviceNodeLength
+  );  if (DnsDeviceNode == 
+ NULL) {
+return NULL;
+  }
+
+  //
+  // Confirm the DNS server address is IPv4 or IPv6 type.
+  //
+  DeviceNodeStrPtr = TextDeviceNode;
+  while (!IS_NULL (*DeviceNodeStrPtr)) {
+if (*DeviceNodeStrPtr == L'.') {
+  DnsDeviceNode->IsIPv6 = 0x00;
+  break;
+}
+
+if (*DeviceNodeStrPtr == L':') {
+  DnsDeviceNode->IsIPv6 = 0x01;
+  break;
+}
+
+DeviceNodeStrPtr++;
+  }
+
+  for (DnsServerIpIndex = 0; DnsServerIpIndex < DnsServerIpCount; 
DnsServerIpIndex++) {
+DnsServerIp = GetNextParamStr ();
+if (DnsDeviceNode->IsIPv6 == 0x00) {
+  StrToIpv4Address (DnsServerIp,  NULL, 
&(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v4), NULL);
+} else {
+  StrToIpv6Address (DnsServerIp, NULL, 
&(DnsDeviceNode->DnsServerIp[DnsServerIpIndex].v6), NULL);
+}
+  }
+
+  return (EFI_DEVICE_PATH_PROTOCOL *) DnsDeviceNode; }
+
+/**
   Converts a text device path node to URI device path structure.
 
   @param TextDeviceNode  The input Text device path node.
 
   @return A pointer to the newly-created URI device path structure.
@@ -3

Re: [edk2] [PATCH] BaseTools: Fix report flexible value issue

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Tuesday, August 07, 2018 2:24 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Fix report flexible value issue

Report flexible value in INF file encounter error

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/build/BuildReport.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 50717b7c86..deb88a7817 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -983,10 +983,15 @@ class PcdReport(object):
 if ModulePcdSet is not None:
 if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in 
ModulePcdSet:
 continue
 InfDefaultValue, PcdValue = ModulePcdSet[Pcd.TokenCName, 
Pcd.TokenSpaceGuidCName, Type]
 Pcd.DefaultValue = PcdValue
+if InfDefaultValue:
+try:
+InfDefaultValue = 
ValueExpressionEx(InfDefaultValue, Pcd.DatumType, self._GuidDict)(True)
+except BadExpression as InfDefaultValue:
+EdkLogger.error('BuildReport', FORMAT_INVALID, 
"PCD Value: %s, Type: %s" % (InfDefaultValue, Pcd.DatumType))
 if InfDefaultValue == "":
 InfDefaultValue = None
 
 BuildOptionMatch = False
 if GlobalData.BuildOptionPcd:
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Remove duplicate function declaration

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Wednesday, August 08, 2018 9:59 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Remove duplicate function declaration

Remove duplicate function declaration

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/C/DevicePath/UefiDevicePathLib.h | 7 ---
 1 file changed, 7 deletions(-)

diff --git a/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h 
b/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
index 7bc974d771..1801eb33e6 100644
--- a/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
+++ b/BaseTools/Source/C/DevicePath/UefiDevicePathLib.h
@@ -378,17 +378,10 @@ CreateDeviceNode (
UINT8   NodeType,
UINT8   NodeSubType,
UINT16  NodeLength
   );
 
- EFI_DEVICE_PATH_PROTOCOL *
-CreateDeviceNode (
-   UINT8   NodeType,
-   UINT8   NodeSubType,
-   UINT16  NodeLength
-  );
-
 BOOLEAN
 IsDevicePathMultiInstance (
CONST EFI_DEVICE_PATH_PROTOCOL  *DevicePath
   );
 
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Optimizing code for function doesn't match

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, August 06, 2018 9:11 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Optimizing code for function doesn't match

Optimizing code for function doesn't match name and comment

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=924

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/AutoGen/BuildEngine.py | 30 --
 1 file changed, 14 insertions(+), 16 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/BuildEngine.py 
b/BaseTools/Source/Python/AutoGen/BuildEngine.py
index 8a32343846..4291da9001 100644
--- a/BaseTools/Source/Python/AutoGen/BuildEngine.py
+++ b/BaseTools/Source/Python/AutoGen/BuildEngine.py
@@ -528,30 +528,28 @@ class BuildRule:
 ExtraData="Unknown subsection: %s" % 
self.RuleContent[LineIndex])
 ## Parse  sub-section
 #
 #   @param  LineIndex   The line index of build rule text
 #
-def ParseInputFile(self, LineIndex):
+def ParseInputFileSubSection(self, LineIndex):
 FileList = [File.strip() for File in 
self.RuleContent[LineIndex].split(",")]
 for ToolChainFamily in self._FamilyList:
-InputFiles = self._RuleInfo[ToolChainFamily, self._State]
-if InputFiles is None:
-InputFiles = []
-self._RuleInfo[ToolChainFamily, self._State] = InputFiles
-InputFiles.extend(FileList)
+if self._RuleInfo[ToolChainFamily, self._State] is None:
+self._RuleInfo[ToolChainFamily, self._State] = []
+self._RuleInfo[ToolChainFamily, 
+ self._State].extend(FileList)
 
 ## Parse  sub-section
+## Parse  sub-section
+## Parse  sub-section
 #
 #   @param  LineIndex   The line index of build rule text
 #
-def ParseCommon(self, LineIndex):
+def ParseCommonSubSection(self, LineIndex):
 for ToolChainFamily in self._FamilyList:
-Items = self._RuleInfo[ToolChainFamily, self._State]
-if Items is None:
-Items = []
-self._RuleInfo[ToolChainFamily, self._State] = Items
-Items.append(self.RuleContent[LineIndex])
+if self._RuleInfo[ToolChainFamily, self._State] is None:
+self._RuleInfo[ToolChainFamily, self._State] = []
+self._RuleInfo[ToolChainFamily, 
+ self._State].append(self.RuleContent[LineIndex])
 
 ## Get a build rule via [] operator
 #
 #   @param  FileExt The extension of a file
 #   @param  ToolChainFamily The tool chain family name
@@ -582,14 +580,14 @@ class BuildRule:
 _StateHandler = {
 _SectionHeader : ParseSectionHeader,
 _Section   : ParseSection,
 _SubSectionHeader  : ParseSubSectionHeader,
 _SubSection: ParseSubSection,
-_InputFile : ParseInputFile,
-_OutputFile: ParseCommon,
-_ExtraDependency   : ParseCommon,
-_Command   : ParseCommon,
+_InputFile : ParseInputFileSubSection,
+_OutputFile: ParseCommonSubSection,
+_ExtraDependency   : ParseCommonSubSection,
+_Command   : ParseCommonSubSection,
 _UnknownSection: SkipSection,
 }
 
 # This acts like the main() function for the script, unless it is 'import'ed 
into another  # script.
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Use gGuidPattern for Guid regular expression

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, August 06, 2018 9:02 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Use gGuidPattern for Guid regular expression

Use GlobalData.py gGuidPattern for Guid regular expression

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 7 ++-
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index 156aae1d0e..2307a19cbe 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -42,10 +42,11 @@ from Common.Misc import GuidStructureStringToGuidString  
from Common.BuildVersion import gBUILD_VERSION  from Common.MultipleWorkspace 
import MultipleWorkspace as mws  from . import FfsFileStatement  import glob  
from struct import unpack
+from Common.GlobalData import gGuidPattern
 
 ## Version and Copyright
 versionNumber = "1.0" + ' ' + gBUILD_VERSION  __version__ = "%prog Version " + 
versionNumber  __copyright__ = "Copyright (c) 2007 - 2018, Intel Corporation  
All rights reserved."
@@ -603,15 +604,11 @@ class GenFds :
 GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, 
"Guid.xref")
 GuidXRefFile = BytesIO('')
 GuidDict = {}
 ModuleList = []
 FileGuidList = []
-GuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
-   "([0-9a-fA-F]){4}-"
-   "([0-9a-fA-F]){4}-"
-   "([0-9a-fA-F]){4}-"
-   "([0-9a-fA-F]){12}\s*")
+GuidPattern = gGuidPattern
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 for ModuleFile in PlatformDataBase.Modules:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 if Module in ModuleList:
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Debug message make confused

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Feng, YunhuaX 
Sent: Monday, August 06, 2018 9:09 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [PATCH] BaseTools: Debug message make confused

Debug message make confused

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=995

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 06ff84b4cd..033ad644c1 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -3238,11 +3238,11 @@ class ModuleAutoGen(AutoGen):
 ToolChainFamilySet = {"", "*", self.ToolChainFamily, 
self.BuildRuleFamily}
 for F in self.Module.Sources:
 # match tool chain
 if F.TagName not in ToolChainTagSet:
 EdkLogger.debug(EdkLogger.DEBUG_9, "The toolchain [%s] for 
processing file [%s] is found, "
-"but [%s] is needed" % (F.TagName, str(F), 
self.ToolChain))
+"but [%s] is currently used" % (F.TagName, 
str(F), self.ToolChain))
 continue
 # match tool chain family or build rule family
 if F.ToolChainFamily not in ToolChainFamilySet:
 EdkLogger.debug(
 EdkLogger.DEBUG_0,
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] DSC Spec: Update SkuId and DefaultStore name as C name style

2018-08-07 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Gao, Liming 
Sent: Tuesday, August 07, 2018 5:47 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong 
Subject: [Patch] DSC Spec: Update SkuId and DefaultStore name as C name style

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
Cc: Yonghong Zhu 
---
 3_edk_ii_dsc_file_format/310_pcd_sections.md| 15 +--
 3_edk_ii_dsc_file_format/313_[defaultstores]_section.md |  3 +--
 3_edk_ii_dsc_file_format/35_[defines]_section.md|  2 +-
 3_edk_ii_dsc_file_format/37_[skuids]_section.md |  3 +--
 4 files changed, 8 insertions(+), 15 deletions(-)

diff --git a/3_edk_ii_dsc_file_format/310_pcd_sections.md 
b/3_edk_ii_dsc_file_format/310_pcd_sections.md
index 1879923..741a620 100644
--- a/3_edk_ii_dsc_file_format/310_pcd_sections.md
+++ b/3_edk_ii_dsc_file_format/310_pcd_sections.md
@@ -138,8 +138,7 @@ file.
   ::=  [","  "PcdsFeatureFlag" ]*
 ::= "."  ["." ]
::=  [ ]*
-  ::= 
-   ::= 
+  ::= 
  ::= 
  ::= {} {} {}
 ```
@@ -219,8 +218,7 @@ fields that are separated by the pipe character, "|".
::=  [","  "PcdsFixedAtBuild" ]*
  ::= "."  ["." ]
 ::=  [ ]*
-   ::= 
-::= 
+   ::= 
  ::= {} {} {} 
{}
   ::=   [ ] 
   ::= if (pcddatumtype == "BOOLEAN"):
@@ -327,8 +325,7 @@ of the DSC file.
 ]*
  ::= "."  ["." ]
 ::=  [ ]*
-   ::= 
-::= 
+   ::= 
  ::= {} {} {} 
{}
   ::=   [ ] 
   ::= if (pcddatumtype == "BOOLEAN"):
@@ -466,8 +463,7 @@ sections of the DSC file.
 ::= "."  ["." ]["." ]
  ::=  [ ]*
::= 
-::= 
- ::= 
+::= 
::=  [ ] 
::= if (pcddatumtype == "BOOLEAN"):
{} {} @@ -681,8 +677,7 @@ 
sections of the DSC file.
 ::= "."  ["." ]["." ]
  ::=  [ ]*
::= 
-::= 
- ::= 
+::= 
::=  [ ] 
::= if (pcddatumtype == "BOOLEAN"):
{} {} diff --git 
a/3_edk_ii_dsc_file_format/313_[defaultstores]_section.md 
b/3_edk_ii_dsc_file_format/313_[defaultstores]_section.md
index 614ed01..23dec7d 100644
--- a/3_edk_ii_dsc_file_format/313_[defaultstores]_section.md
+++ b/3_edk_ii_dsc_file_format/313_[defaultstores]_section.md
@@ -47,8 +47,7 @@ be applied in PcdsDynamicHii/PcdsDynamicExHii section.
 ```c
  ::= "[DefaultStores]" 
 {*}
- ::= 
-::= 
+ ::= 
 ```
 
  Example
diff --git a/3_edk_ii_dsc_file_format/35_[defines]_section.md 
b/3_edk_ii_dsc_file_format/35_[defines]_section.md
index 3961e4c..7337415 100644
--- a/3_edk_ii_dsc_file_format/35_[defines]_section.md
+++ b/3_edk_ii_dsc_file_format/35_[defines]_section.md
@@ -131,7 +131,7 @@ The `!include` statement may be used in a `[Defines]` 
section.
*
*
 ::= {} {(0-9)+ "." (0-9)+}
-::=  [ ]*
+::=  [ ]*
  ::=  [ ]*
  ::= "FIX_LOAD_TOP_MEMORY_ADDRESS"   
   ::= 
diff --git a/3_edk_ii_dsc_file_format/37_[skuids]_section.md 
b/3_edk_ii_dsc_file_format/37_[skuids]_section.md
index 8e70b33..4c4d990 100644
--- a/3_edk_ii_dsc_file_format/37_[skuids]_section.md
+++ b/3_edk_ii_dsc_file_format/37_[skuids]_section.md
@@ -52,8 +52,7 @@ The `!include` file can only contain an ASCII (not Unicode) 
list of  ```c
  ::= "[SkuIds]" 
 {*} {} - ::=  
   [ ] 
-::= 
+ ::= [ ] 
 ```
 
  Example
--
2.8.0.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools/BinToPcd: Open output file as text file

2018-08-05 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Sun, Yanyan 
Sent: Monday, August 6, 2018 10:17 AM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
Sun, Yanyan 
Subject: RE: [Patch] BaseTools/BinToPcd: Open output file as text file

Mike:

Tried this patch, seems that the issue is fixed.

-Original Message-
From: Kinney, Michael D
Sent: Saturday, August 04, 2018 4:48 AM
To: edk2-devel@lists.01.org
Cc: Sun, Yanyan ; Zhu, Yonghong ; 
Gao, Liming ; Kinney, Michael D 

Subject: [Patch] BaseTools/BinToPcd: Open output file as text file

https://bugzilla.tianocore.org/show_bug.cgi?id=1069

Undo changes from following commit:

https://github.com/tianocore/edk2/commit/83964ebc5e74549d6efc7134af19150a0b2079aa

Change the open mode for the output file from 'wb' to 'w' so the output file is 
written as a text file and not a binary file.

This resolves the issue where the text file was not writable from Python 3.x 
and also removes b'' from output file when the string was encoded as a 
bytearray.

Cc: YanYan Sun 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/BinToPcd.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py 
index 1495a36933..316cc6117f 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -70,8 +70,7 @@ if __name__ == '__main__':
 #
 # Return a PCD value of the form '{0x01, 0x02, ...}' along with the 
PCD length in bytes
 #
-PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for 
Item in Buffer]) + '}'
-return PcdValue.encode (), len (Buffer)
+return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) 
+ for Item in Buffer])) + '}', len (Buffer)
 
 #
 # Create command line argument parser object @@ -81,7 +80,7 @@ if __name__ 
== '__main__':
   conflict_handler = 'resolve')
 parser.add_argument ("-i", "--input", dest = 'InputFile', type = 
argparse.FileType ('rb'), action='append', required = True,
  help = "Input binary filename.  Multiple input files 
are combined into a single PCD.")
-parser.add_argument ("-o", "--output", dest = 'OutputFile', type = 
argparse.FileType ('wb'),
+parser.add_argument ("-o", "--output", dest = 'OutputFile', type = 
+ argparse.FileType ('w'),
  help = "Output filename for PCD value or PCD 
statement")
 parser.add_argument ("-p", "--pcd", dest = 'PcdName', type = 
ValidatePcdName,
  help = "Name of the PCD in the form 
.")
--
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools/Pkcs7Sign: Add PKCS7 test key include files

2018-08-02 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Kinney, Michael D 
Sent: Friday, August 3, 2018 9:39 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming ; 
Kinney, Michael D 
Subject: [Patch] BaseTools/Pkcs7Sign: Add PKCS7 test key include files

https://bugzilla.tianocore.org/show_bug.cgi?id=1073

Add PCD statement include files for the PKCS7 test key.
* gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer
* gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr

These include files can be used in !include statements in PCD sections of a 
platform DSC file to assign these PCDs to the test key certificate values.

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 BaseTools/Source/Python/Pkcs7Sign/Readme.md| 40 ++
 ...ecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc |  1 +  
...kenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc |  1 +
 3 files changed, 42 insertions(+)
 create mode 100644 
BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
 create mode 100644 
BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr.inc

diff --git a/BaseTools/Source/Python/Pkcs7Sign/Readme.md 
b/BaseTools/Source/Python/Pkcs7Sign/Readme.md
index fee0327876..5315b7fca4 100644
--- a/BaseTools/Source/Python/Pkcs7Sign/Readme.md
+++ b/BaseTools/Source/Python/Pkcs7Sign/Readme.md
@@ -116,3 +116,43 @@ Convert Key and Certificate for signing. Password is 
removed with -nodes flag fo
 
 openssl smime -verify -inform DER -in test.bin.p7 -content test.bin 
-CAfile TestRoot.pub.pem -out test.org.bin
 
+## Generate DSC PCD include files for Certificate
+
+The `BinToPcd` utility can be used to convert the binary Certificate 
+file to a text file can be included from a DSC file to set a PCD to the 
+contents of the Certificate file.
+
+The following 2 PCDs can be set to the PKCS7 Certificate value.  The 
+first one supports a single certificate.  The second one supports 
+multiple certificate values using the XDR format.
+* `gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer`
+* `gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr`
+
+Generate DSC PCD include files:
+```
+BinToPcd.py -i TestRoot.cer -p 
+gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer -o 
+TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
+BinToPcd.py -i TestRoot.cer -p 
+gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr -x -o 
+TestRoot.cer.gFmpDevicePkgTokenSpaceGuid.PcdFmpDevicePkcs7CertBufferXdr
+.inc
+```
+
+These files can be used in `!include` statements in DSC file PCD sections.  
For example:
+
+* Platform scoped fixed at build PCD section ``` [PcdsFixedAtBuild]
+  !include 
+BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpac
+eGuid.PcdPkcs7CertBuffer.inc
+```
+
+* Platform scoped patchable in module PCD section ``` 
+[PcdsPatchableInModule]
+  !include 
+BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceG
+uid.PcdFmpDevicePkcs7CertBufferXdr.inc
+```
+
+* Module scoped fixed at build PCD section ``` [Components]
+  FmpDevicePkg/FmpDxe/FmpDxe.inf {
+
+  !include 
+BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gFmpDevicePkgTokenSpaceG
+uid.PcdFmpDevicePkcs7CertBufferXdr.inc
+  }
+```
diff --git 
a/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
 
b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer.inc
new file mode 100644
index 00..907c70dd92
--- /dev/null
+++ b/BaseTools/Source/Python/Pkcs7Sign/TestRoot.cer.gEfiSecurityPkgToke
+++ nSpaceGuid.PcdPkcs7CertBuffer.inc
@@ -0,0 +1 @@
+  gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x30, 0x82, 0x03, 
+ 0xEC, 0x30, 0x82, 0x02, 0xD4, 0xA0, 0x03, 0x02, 0x01, 0x02, 0x02, 
+ 0x09, 0x00, 0xC0, 0x91, 0xC5, 0xE2, 0xB7, 0x66, 0xC0, 0xF8, 0x30, 
+ 0x0D, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 0xF7, 0x0D, 0x01, 0x01, 
+ 0x0B, 0x05, 0x00, 0x30, 0x81, 0x82, 0x31, 0x0B, 0x30, 0x09, 0x06, 
+ 0x03, 0x55, 0x04, 0x06, 0x13, 0x02, 0x43, 0x4E, 0x31, 0x0B, 0x30, 
+ 0x09, 0x06, 0x03, 0x55, 0x04, 0x08, 0x0C, 0x02, 0x53, 0x48, 0x31, 
+ 0x0B, 0x30, 0x09, 0x06, 0x03, 0x55, 0x04, 0x07, 0x0C, 0x02, 0x53, 
+ 0x48, 0x31, 0x12, 0x30, 0x10, 0x06, 0x03, 0x55, 0x04, 0x0A, 0x0C, 
+ 0x09, 0x54, 0x69, 0x61, 0x6E, 0x6F, 0x43, 0x6F, 0x72, 0x65, 0x31, 
+ 0x0E, 0x30, 0x0C, 0x06, 0x03, 0x55, 0x04, 0x0B, 0x0C, 0x05, 0x45, 
+ 0x44, 0x4B, 0x49, 0x49, 0x31, 0x11, 0x30, 0x0F, 0x06, 0x03, 0x55, 
+ 0x04, 0x03, 0x0C, 0x08, 0x54, 0x65, 0x73, 0x74, 0x52, 0x6F, 0x6F, 
+ 0x74, 0x31, 0x22, 0x30, 0x20, 0x06, 0x09, 0x2A, 0x86, 0x48, 0x86, 
+ 0xF7, 0x0D, 0x01, 0x09, 0x01, 0x16, 0x13, 0x65, 0x64, 0x6B, 0x69, 
+ 0x69, 0x40, 0x74, 0x69, 0x61, 0x6E, 0x6F, 0x63, 0x6F, 0x72, 0x65, 
+ 0x2E, 0x6F, 0x72, 0x67, 0x30, 0x1E, 0x17, 0x0D, 0x31, 0x37

Re: [edk2] [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray()

2018-08-02 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Kinney, Michael D 
Sent: Friday, August 3, 2018 5:26 AM
To: edk2-devel@lists.01.org
Cc: Sun, Yanyan ; Zhu, Yonghong ; 
Gao, Liming ; Kinney, Michael D 

Subject: [Patch] BaseTools/BinToPcd: Encode string returned from ByteArray()

https://bugzilla.tianocore.org/show_bug.cgi?id=1069

The ByteArray() method returns a string with the hex bytes of a PCD value.  
Make sure the string is always encoded as a string, so it can be used to build 
a complete PCD statement string and be written out to a file.  This change is 
required for Python 3.x compatibility.

Cc: YanYan Sun 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/BinToPcd.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py 
index 25b74f6004..1495a36933 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -70,7 +70,8 @@ if __name__ == '__main__':
 #
 # Return a PCD value of the form '{0x01, 0x02, ...}' along with the 
PCD length in bytes
 #
-return '{' + (', '.join (['0x{Byte:02X}'.format (Byte = Item) for Item 
in Buffer])) + '}', len (Buffer)
+PcdValue = '{' + ', '.join (['0x{Byte:02X}'.format (Byte = Item) for 
Item in Buffer]) + '}'
+return PcdValue.encode (), len (Buffer)
 
 #
 # Create command line argument parser object
--
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID value for Driver

2018-08-02 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, July 31, 2018 8:19 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Guid.xref doesn't specify the correct GUID 
value for Driver

From: Yunhua Feng 

In DSC, we can define the driver with the different FILE GUID. So, this driver 
name and its FILE GUID should also be listed in Build output Guid.xref. But 
now, Guid.xref still lists the driver MODULE_GUID.

The case in Platform.dsc:
  MdeModulePkg/Universal/DriverSampleDxe/DriverSampleDxe.inf {

  FILE_GUID = 3A4A354F-6935-40fa-B19C-500EEEBF0BC2

  PcdLib|MdePkg/Library/BasePcdLibNull/BasePcdLibNull.inf
  }

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/GenFds.py | 11 ++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/GenFds.py 
b/BaseTools/Source/Python/GenFds/GenFds.py
index a7c1e6c853..156aae1d0e 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -603,19 +603,28 @@ class GenFds :
 GuidXRefFileName = os.path.join(GenFdsGlobalVariable.FvDir, 
"Guid.xref")
 GuidXRefFile = BytesIO('')
 GuidDict = {}
 ModuleList = []
 FileGuidList = []
+GuidPattern = re.compile("\s*([0-9a-fA-F]){8}-"
+   "([0-9a-fA-F]){4}-"
+   "([0-9a-fA-F]){4}-"
+   "([0-9a-fA-F]){4}-"
+   "([0-9a-fA-F]){12}\s*")
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 for ModuleFile in PlatformDataBase.Modules:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
 if Module in ModuleList:
 continue
 else:
 ModuleList.append(Module)
-GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+GuidMatch = GuidPattern.match(ModuleFile.BaseName)
+if GuidMatch is not None:
+GuidXRefFile.write("%s %s\n" % (ModuleFile.BaseName, 
Module.BaseName))
+else:
+GuidXRefFile.write("%s %s\n" % (Module.Guid, 
+ Module.BaseName))
 for key, item in Module.Protocols.items():
 GuidDict[key] = item
 for key, item in Module.Guids.items():
 GuidDict[key] = item
 for key, item in Module.Ppis.items():
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue

2018-08-01 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Kinney, Michael D 
Sent: Wednesday, August 01, 2018 12:29 AM
To: edk2-devel@lists.01.org
Cc: Sun, Yanyan ; Zhu, Yonghong ; 
Gao, Liming ; Kinney, Michael D 

Subject: [Patch] BaseTools/BinToPcd: Fix Python 2.7.x compatibility issue

https://bugzilla.tianocore.org/show_bug.cgi?id=1042

Convert Buffer to type bytearray before converting to a string of hex byte 
values so the type of items in Buffer is consistent for both Python 2.7.x and 
Python 3.x.

Cc: YanYan Sun 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 
---
 BaseTools/Scripts/BinToPcd.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py 
index c42e37bd11..25b74f6004 100644
--- a/BaseTools/Scripts/BinToPcd.py
+++ b/BaseTools/Scripts/BinToPcd.py
@@ -66,7 +66,7 @@ if __name__ == '__main__':
 #
 # If Xdr flag is not set, then concatenate all the data
 #
-Buffer = b''.join (Buffer)
+Buffer = bytearray (b''.join (Buffer))
 #
 # Return a PCD value of the form '{0x01, 0x02, ...}' along with the 
PCD length in bytes
 #
--
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Use pickle to replace cPickle

2018-07-31 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, July 31, 2018 8:24 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Use pickle to replace cPickle

From: Yunhua Feng 

Use pickle to replace cPickle because of python3 removed cPickle

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/Common/Misc.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index fd948c727a..74a5f0bca5 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -19,11 +19,11 @@ import Common.LongFilePathOs as os  import sys  import 
string  import threading  import time  import re -import cPickle
+import pickle
 import array
 import shutil
 from struct import pack
 from UserDict import IterableUserDict
 from UserList import UserList
@@ -497,11 +497,11 @@ def SaveFileOnChange(File, Content, IsBinaryFile=True):
 #
 def DataDump(Data, File):
 Fd = None
 try:
 Fd = open(File, 'wb')
-cPickle.dump(Data, Fd, cPickle.HIGHEST_PROTOCOL)
+pickle.dump(Data, Fd, pickle.HIGHEST_PROTOCOL)
 except:
 EdkLogger.error("", FILE_OPEN_FAILURE, ExtraData=File, 
RaiseError=False)
 finally:
 if Fd is not None:
 Fd.close()
@@ -516,11 +516,11 @@ def DataDump(Data, File):
 def DataRestore(File):
 Data = None
 Fd = None
 try:
 Fd = open(File, 'rb')
-Data = cPickle.load(Fd)
+Data = pickle.load(Fd)
 except Exception as e:
 EdkLogger.verbose("Failed to load [%s]\n\t%s" % (File, str(e)))
 Data = None
 finally:
 if Fd is not None:
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: remove unused import thread

2018-07-31 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Tuesday, July 31, 2018 8:21 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: remove unused import thread

From: Yunhua Feng 

remove unused import thread

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/Common/Misc.py | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Source/Python/Common/Misc.py 
b/BaseTools/Source/Python/Common/Misc.py
index 79d1ff28f5..fd948c727a 100644
--- a/BaseTools/Source/Python/Common/Misc.py
+++ b/BaseTools/Source/Python/Common/Misc.py
@@ -16,11 +16,10 @@
 #
 from __future__ import absolute_import
 import Common.LongFilePathOs as os
 import sys
 import string
-import thread
 import threading
 import time
 import re
 import cPickle
 import array
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [staging/FmpDevicePkg-master 0/8] Fix GenerateCapsule issues

2018-07-29 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: Kinney, Michael D 
Sent: Monday, July 30, 2018 2:08 AM
To: edk2-devel@lists.01.org
Cc: Sean Brogan ; Yao, Jiewen 
; Zhu, Yonghong ; Gao, Liming 
; Kinney, Michael D 
Subject: [staging/FmpDevicePkg-master 0/8] Fix GenerateCapsule issues

https://bugzilla.tianocore.org/show_bug.cgi?id=1021
https://bugzilla.tianocore.org/show_bug.cgi?id=1022
https://bugzilla.tianocore.org/show_bug.cgi?id=1026
https://bugzilla.tianocore.org/show_bug.cgi?id=1030
https://bugzilla.tianocore.org/show_bug.cgi?id=1024
https://bugzilla.tianocore.org/show_bug.cgi?id=1025
https://bugzilla.tianocore.org/show_bug.cgi?id=1029
https://bugzilla.tianocore.org/show_bug.cgi?id=1031
https://bugzilla.tianocore.org/show_bug.cgi?id=1046
https://bugzilla.tianocore.org/show_bug.cgi?id=1048
https://bugzilla.tianocore.org/show_bug.cgi?id=1050
https://bugzilla.tianocore.org/show_bug.cgi?id=1028

Fix issues found during validation tests of the GenerateCapsule tool

Cc: Sean Brogan 
Cc: Jiewen Yao 
Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney 

Kinney, Michael D (8):
  BaseTools/Capsule: Add max value checks to Capsule Generation tools
  BaseTools/Capsule: Remove support for PopulateSystemTable
  BaseTools/Capsule: Fix CertType GUID byte order
  BaseTools/Capsule: Do not support -o with --dump-info
  BaseTools/Capsule: Update help for --fw-version and --lsv
  BaseTools/Capsule: Update file header with tool limitations
  BaseTools/Capsule: Prevent traceback during signing operations
  BaseTools/Capsule: Support capsules without a payload header

 BaseTools/Source/Python/Capsule/GenerateCapsule.py | 73 --
 .../Python/Common/Uefi/Capsule/FmpAuthHeader.py|  2 +-
 2 files changed, 54 insertions(+), 21 deletions(-)

-- 
2.14.2.windows.3

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Update build report for StructurePcd value

2018-07-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Thursday, July 26, 2018 9:07 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Update build report for StructurePcd value

From: Yunhua Feng 

Update build report to display the structure Pcd value that from FDF file.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/build/BuildReport.py | 14 --
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 27680019dc..d973db5c77 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -966,11 +966,10 @@ class PcdReport(object):
 Field = ''
 for (CName, Guid, Field) in self.FdfPcdSet:
 if CName == PcdTokenCName and Guid == Key:
 DscDefaultValue = self.FdfPcdSet[(CName, Guid, Field)]
 break
-DscDefaultValue = self.FdfPcdSet.get((Pcd.TokenCName, Key), 
DscDefaultValue)
 if DscDefaultValue != DscDefaultValBak:
 try:
 DscDefaultValue = ValueExpressionEx(DscDefaultValue, 
Pcd.DatumType, self._GuidDict)(True)
 except BadExpression as DscDefaultValue:
 EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD 
Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) @@ -1082,12 +1081,17 @@ 
class PcdReport(object):
 OverrideFieldStruct = 
self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]])
 DscOverride = 
self.ParseStruct(OverrideFieldStruct)
 if DscOverride:
 break
 if DscOverride:
+DscDefaultValue = True
 DscMatch = True
 DecMatch = False
+else:
+DscDefaultValue = True
+DscMatch = True
+DecMatch = False
 
 #
 # Report PCD item according to their override relationship
 #
 if DecMatch:
@@ -1344,20 +1348,26 @@ class PcdReport(object):
 for Key, Values in OverrideStruct.items():
 if Values[1] and Values[1].endswith('.dsc'):
 OverrideFieldStruct[Key] = Values
 if Pcd.PcdFieldValueFromFdf:
 for Key, Values in Pcd.PcdFieldValueFromFdf.items():
+if Key in OverrideFieldStruct and Values[0] == 
OverrideFieldStruct[Key][0]:
+continue
 OverrideFieldStruct[Key] = Values
 if Pcd.PcdFieldValueFromComm:
 for Key, Values in Pcd.PcdFieldValueFromComm.items():
+if Key in OverrideFieldStruct and Values[0] == 
OverrideFieldStruct[Key][0]:
+continue
 OverrideFieldStruct[Key] = Values
 return OverrideFieldStruct
 
 def PrintStructureInfo(self, File, Struct):
-for Key, Value in Struct.items():
+for Key, Value in sorted(Struct.items(), key=lambda x: x[0]):
 if Value[1] and 'build command options' in Value[1]:
 FileWrite(File, '*B  %-*s = %s' % (self.MaxLen + 4, '.' + 
Key, Value[0]))
+elif Value[1] and Value[1].endswith('.fdf'):
+FileWrite(File, '*F  %-*s = %s' % (self.MaxLen + 4, '.' + 
Key, Value[0]))
 else:
 FileWrite(File, '%-*s = %s' % (self.MaxLen + 4, '.' + 
Key, Value[0]))
 
 def StrtoHex(self, value):
 try:
--
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Fix build crash when fdf is empty file

2018-07-27 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Thursday, July 26, 2018 11:19 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Fix build crash when fdf is empty file

From: Yunhua Feng 

Fix build crash when fdf is empty file

Fix https://bugzilla.tianocore.org/show_bug.cgi?id=912

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/GenFds/FdfParser.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index 4be790a819..ae6b10f1e3 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -421,10 +421,12 @@ class FdfParser:
 def __CurrentLine(self):
 return self.Profile.FileLinesList[self.CurrentLineNumber - 1]
 
 def __StringToList(self):
 self.Profile.FileLinesList = [list(s) for s in 
self.Profile.FileLinesList]
+if not self.Profile.FileLinesList:
+EdkLogger.error('FdfParser', FILE_READ_FAILURE, 'The file is 
empty!', File=self.FileName)
 self.Profile.FileLinesList[-1].append(' ')
 
 def __ReplaceFragment(self, StartPos, EndPos, Value = ' '):
 if StartPos[0] == EndPos[0]:
 Offset = StartPos[1]
-- 
2.12.2.windows.2

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] FFS Alignment and the FDF Specification

2018-07-26 Thread Zhu, Yonghong


How about get the doc from 
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II-Draft-Specification
 ? This is current latest.

Or  
https://edk2-docs.gitbooks.io/edk-ii-fdf-specification/content/v/release/1.28.01/
 , this is the one match with UDK2018.

And current latest BaseTools it should also support the 16M FFS alignment.
I think the version you use in fact it is 1.27, but we made a typo error in the 
FDF spec that marked it as 1.28.  you can check the revision history or the 
value in the FDF_SPECIFICATION  in the spec.

Best Regards,
Zhu Yonghong


-Original Message-
From: Tim Lewis [mailto:tim.le...@insyde.com] 
Sent: Friday, July 27, 2018 9:09 AM
To: Zhu, Yonghong ; edk2-devel@lists.01.org
Subject: RE: [edk2] FFS Alignment and the FDF Specification

1.28. 

2.5.6 says: Alignment - Data (value is one of: 1, 2 4, 8, 16, 32, 64 128, 512, 
1K, 2K, 4K, 8K, 16K,32K, 64K) byte aligned

The grammar 3.2.1 says:

 ::= {"Auto"} {"8"} {"16"} {"32"} {"64"} {"128"}{"512"} 
{"1K"} {"4K"} {"32K"} {"64K"}

This is the version from the EDK2 specs page.

-Original Message-
From: edk2-devel  On Behalf Of Zhu, Yonghong
Sent: Thursday, July 26, 2018 5:59 PM
To: Tim Lewis ; edk2-devel@lists.01.org
Subject: Re: [edk2] FFS Alignment and the FDF Specification

Which version of FDF spec you use now ? I remember current we already support 
16M ffs alignment.  FDF spec Version 1.28 have such info "Per PI 1.6 to extend 
FFS alignment to 16M".

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tim Lewis
Sent: Friday, July 27, 2018 8:55 AM
To: edk2-devel@lists.01.org
Subject: [edk2] FFS Alignment and the FDF Specification

Is my understanding correct: the FDF specification only supports a maximum of 
64KB alignment for files (section 2.5.6), but the PI specification supports 
(table 7), up to 16MB alignment. Or am I misreading it?

Thanks,

Tim

-Original Message-
From: edk2-devel  On Behalf Of Andrew Fish
Sent: Thursday, July 19, 2018 11:26 AM
To: Marvin H?user 
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] Help on AutoGen Files

Udit,

As Marvin points out the [LibraryClasses] section of the INF file are going to 
imply the order of the library constructor calls in the AutoGen

Worst case you can demote FpgaInterfaceInit () from being a constructor to just 
being a public library function that the other lib can call explicitly from its 
constructor. Maybe that is too drastic and you could must move a function out 
of FpgaInterfaceInit () and make that function part of the Public library 
interface?

Thanks,

Andrew Fish

> On Jul 19, 2018, at 11:14 AM, Marvin H?user 
> 
wrote:
> 
> Hey Udit,
> 
> You cannot explicitly influence the order of the calls, but implicitly 
> via
the dependency tree, which means you need to make SerialPortLib depend on your 
LibraryClass instance.
> You did not mention which SerialPortLib instance you use, but probably 
> you
need to execute FpgaInterfaceInit() earlier in platform code or fork 
SerialPortLib for now.
> 
> Regards,
> Marvin
> 
>> -Original Message-
>> From: edk2-devel  On Behalf Of Udit 
>> Kumar
>> Sent: Thursday, July 19, 2018 9:33 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] Help on AutoGen Files
>> 
>> Hi Experts,
>> How I can change the order of initialization in Constructor list of
autogen file.
>> In my build system, if I look at
>> MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
>> Below is function of Library Constructor List
>> 
>> VOID
>> EFIAPI
>> ProcessLibraryConstructorList (
>>  IN   EFI_PEI_FILE_HANDLE   FileHandle,
>>  IN CONST EFI_PEI_SERVICES  **PeiServices
>>  )
>> {
>>  EFI_STATUS  Status;
>> 
>>  Status = BaseDebugLibSerialPortConstructor ();  ASSERT_EFI_ERROR 
>> (Status);
>> 
>>  Status = PeiServicesTablePointerLibConstructor (FileHandle, 
>> PeiServices);  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = TimerConstructor ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = FpgaInterfaceInit ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>> }
>> 
>> 
>> My problem is SerialPortConstructor needs frequency, which can be 
>> retrieved after  FpgaInterfaceInit() Therefore, my preferred way for 
>> this constructor list will be
>> FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()
>> 
>> how I can achieve this.
>> 
>> 
>> Many Thanks
>> Udit
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://

Re: [edk2] FFS Alignment and the FDF Specification

2018-07-26 Thread Zhu, Yonghong
Which version of FDF spec you use now ? I remember current we already support 
16M ffs alignment.  FDF spec Version 1.28 have such info "Per PI 1.6 to extend 
FFS alignment to 16M".

Best Regards,
Zhu Yonghong

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Tim Lewis
Sent: Friday, July 27, 2018 8:55 AM
To: edk2-devel@lists.01.org
Subject: [edk2] FFS Alignment and the FDF Specification

Is my understanding correct: the FDF specification only supports a maximum of 
64KB alignment for files (section 2.5.6), but the PI specification supports 
(table 7), up to 16MB alignment. Or am I misreading it?

Thanks,

Tim

-Original Message-
From: edk2-devel  On Behalf Of Andrew Fish
Sent: Thursday, July 19, 2018 11:26 AM
To: Marvin H?user 
Cc: edk2-devel@lists.01.org
Subject: Re: [edk2] Help on AutoGen Files

Udit,

As Marvin points out the [LibraryClasses] section of the INF file are going to 
imply the order of the library constructor calls in the AutoGen

Worst case you can demote FpgaInterfaceInit () from being a constructor to just 
being a public library function that the other lib can call explicitly from its 
constructor. Maybe that is too drastic and you could must move a function out 
of FpgaInterfaceInit () and make that function part of the Public library 
interface?

Thanks,

Andrew Fish

> On Jul 19, 2018, at 11:14 AM, Marvin H?user 
> 
wrote:
> 
> Hey Udit,
> 
> You cannot explicitly influence the order of the calls, but implicitly 
> via
the dependency tree, which means you need to make SerialPortLib depend on your 
LibraryClass instance.
> You did not mention which SerialPortLib instance you use, but probably 
> you
need to execute FpgaInterfaceInit() earlier in platform code or fork 
SerialPortLib for now.
> 
> Regards,
> Marvin
> 
>> -Original Message-
>> From: edk2-devel  On Behalf Of Udit 
>> Kumar
>> Sent: Thursday, July 19, 2018 9:33 AM
>> To: edk2-devel@lists.01.org
>> Subject: [edk2] Help on AutoGen Files
>> 
>> Hi Experts,
>> How I can change the order of initialization in Constructor list of
autogen file.
>> In my build system, if I look at
>> MdeModulePkg/Universal/PCD/Pei/Pcd/DEBUG/AutoGen.c
>> Below is function of Library Constructor List
>> 
>> VOID
>> EFIAPI
>> ProcessLibraryConstructorList (
>>  IN   EFI_PEI_FILE_HANDLE   FileHandle,
>>  IN CONST EFI_PEI_SERVICES  **PeiServices
>>  )
>> {
>>  EFI_STATUS  Status;
>> 
>>  Status = BaseDebugLibSerialPortConstructor ();  ASSERT_EFI_ERROR 
>> (Status);
>> 
>>  Status = PeiServicesTablePointerLibConstructor (FileHandle, 
>> PeiServices);  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = TimerConstructor ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>>  Status = FpgaInterfaceInit ();
>>  ASSERT_EFI_ERROR (Status);
>> 
>> }
>> 
>> 
>> My problem is SerialPortConstructor needs frequency, which can be 
>> retrieved after  FpgaInterfaceInit() Therefore, my preferred way for 
>> this constructor list will be
>> FpgaInterfaceInit() followed by  BaseDebugLibSerialPortConstructor()
>> 
>> how I can achieve this.
>> 
>> 
>> Many Thanks
>> Udit
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION incorrect

2018-07-25 Thread Zhu, Yonghong
Good, the patch is not push, I can update it.

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Thursday, July 26, 2018 9:24 AM
To: Zhu, Yonghong 
Cc: edk2-devel@lists.01.org; Gao, Liming 
Subject: Re: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION 
incorrect

Can we change the code to allocate fewer strings?

'0x' + '{0:04x}{1:04x}'.format(...)

Could be just:

'0x{0:04x}{1:04x}'.format(...

Jaben

> On Jul 25, 2018, at 5:41 PM, Zhu, Yonghong  wrote:
> 
> Reviewed-by: Yonghong Zhu 
> 
> Best Regards,
> Zhu Yonghong
> 
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Yonghong Zhu
> Sent: Wednesday, July 25, 2018 11:41 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [PATCH] BaseTools: Parse decimal format INF_VERSION 
> incorrect
> 
> From: Yunhua Feng 
> 
> hex number 0x00010019, the major number is 0001, the minor number is 0019.
> the decimal number 1.25, the major number is 1, and the minor number 
> is 25
> 
> Fix https://bugzilla.tianocore.org/show_bug.cgi?id=921
> 
> Cc: Liming Gao 
> Cc: Yonghong Zhu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yunhua Feng 
> ---
> BaseTools/Source/Python/Workspace/MetaFileParser.py | 9 ++---
> 1 file changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
> b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> index fbfc182c8b..250cbf79a9 100644
> --- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
> +++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
> @@ -374,13 +374,16 @@ class MetaFileParser(object):
> if Name == 'INF_VERSION':
> if hexVersionPattern.match(Value):
> self._Version = int(Value, 0)
> elif decVersionPattern.match(Value):
> ValueList = Value.split('.')
> -Major = '%04o' % int(ValueList[0], 0)
> -Minor = '%04o' % int(ValueList[1], 0)
> -self._Version = int('0x' + Major + Minor, 0)
> +Major = int(ValueList[0], 0)
> +Minor = int(ValueList[1], 0)
> +if Major > 0x or Minor > 0x:
> +EdkLogger.error('Parser', FORMAT_INVALID, "Invalid 
> version number",
> +ExtraData=self._CurrentLine, 
> File=self.MetaFile, Line=self._LineIndex + 1)
> +self._Version = int('0x' + 
> + '{0:04x}{1:04x}'.format(Major, Minor), 0)
> else:
> EdkLogger.error('Parser', FORMAT_INVALID, "Invalid version 
> number",
> ExtraData=self._CurrentLine, 
> File=self.MetaFile, Line=self._LineIndex + 1)
> 
> if isinstance(self, InfParser) and self._Version < 0x00010005:
> --
> 2.12.2.windows.2
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fix bug about *M value not display decimal and hexadecimal

2018-07-25 Thread Zhu, Yonghong
Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Wednesday, July 25, 2018 8:47 AM
To: edk2-devel@lists.01.org
Cc: Gao, Liming 
Subject: [edk2] [Patch] BaseTools: Fix bug about *M value not display decimal 
and hexadecimal

From: Yunhua Feng 

V2: Add the check for Pcd DatumType

report format like as below:
 *M Shell.inf = 0xFF (255)

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/build/BuildReport.py | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/build/BuildReport.py 
b/BaseTools/Source/Python/build/BuildReport.py
index 176a390..dd5d1c0 100644
--- a/BaseTools/Source/Python/build/BuildReport.py
+++ b/BaseTools/Source/Python/build/BuildReport.py
@@ -1117,11 +1117,17 @@ class PcdReport(object):
 if IsByteArray:
 FileWrite(File, ' *M %-*s = %s' % 
(self.MaxLen + 15, ModulePath, '{'))
 for Array in ArrayList:
 FileWrite(File, Array)
 else:
-FileWrite(File, ' *M %-*s = %s' % 
(self.MaxLen + 15, ModulePath, ModuleDefault.strip()))
+Value =  ModuleDefault.strip()
+if Pcd.DatumType in 
TAB_PCD_CLEAN_NUMERIC_TYPES:
+if Value.startswith(('0x', '0X')):
+Value = '{} ({:d})'.format(Value, 
int(Value, 0))
+else:
+Value = "0x{:X} 
({})".format(int(Value, 0), Value)
+FileWrite(File, ' *M %-*s = %s' % 
(self.MaxLen + 15, ModulePath, Value))
 
 if ModulePcdSet is None:
 FileWrite(File, gSectionEnd)
 else:
 if not ReportSubType and ModulePcdSet:
-- 
2.6.1.windows.1

___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


  1   2   3   4   5   >