Re: [edk2] [PATCH 3/4] UefiCpuPkg/MpInitLib: fix register restore issue in AP wakeup

2018-09-04 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org]
> Sent: Monday, September 3, 2018 11:16 AM
> To: edk2-devel@lists.01.org
> Cc: Ni, Ruiyu ; Dong, Eric ; Yao,
> Jiewen ; Laszlo Ersek ; Zeng,
> Star 
> Subject: [edk2] [PATCH 3/4] UefiCpuPkg/MpInitLib: fix register restore issue
> in AP wakeup
> 
> The conflict issues are introduced by Stack Guard feature enabled for PEI.
> 
> The first is CR0 which should be restored after CR3 and CR4.
> Another is TR which should not be passed from BSP to AP during init phase.
> 
> Cc: Eric Dong 
> Cc: Laszlo Ersek 
> Cc: Ruiyu Ni 
> Cc: Jiewen Yao 
> Cc: Star Zeng 
> Cc: "Ware, Ryan R" 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jian J Wang 
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 8 ++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 377876643f..709fbc1575 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -217,9 +217,9 @@ RestoreVolatileRegisters (
>CPUID_VERSION_INFO_EDXVersionInfoEdx;
>IA32_TSS_DESCRIPTOR   *Tss;
> 
> -  AsmWriteCr0 (VolatileRegisters->Cr0);
>AsmWriteCr3 (VolatileRegisters->Cr3);
>AsmWriteCr4 (VolatileRegisters->Cr4);
> +  AsmWriteCr0 (VolatileRegisters->Cr0);
> 
>if (IsRestoreDr) {
>  AsmCpuid (CPUID_VERSION_INFO, NULL, NULL, NULL,
> ); @@ -1558,7 +1558,7 @@ MpInitLibInitialize (
>ApLoopMode  = GetApLoopMode ();
> 
>//
> -  // Save BSP's Control registers for APs
> +  // Save BSP's Control registers for APs.
>//
>SaveVolatileRegisters ();
> 
> @@ -1656,6 +1656,10 @@ MpInitLibInitialize (
>//
>CopyMem ((VOID *)ApIdtBase, (VOID *)VolatileRegisters.Idtr.Base,
> VolatileRegisters.Idtr.Limit + 1);
>VolatileRegisters.Idtr.Base = ApIdtBase;
> +  //
> +  // Don't pass BSP's TR to APs to avoid AP init failure.
> +  //
> +  VolatileRegisters.Tr = 0;
>CopyMem (>CpuData[0].VolatileRegisters,
> , sizeof (VolatileRegisters));
>//
>// Set BSP basic information
> --
> 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] MdeModulePkg: Remove trailing white space

2018-09-04 Thread Bi, Dandan
Reviewed-by: Dandan Bi 


Thanks,
Dandan

-Original Message-
From: Zeng, Star 
Sent: Wednesday, September 5, 2018 10:01 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star ; Bi, Dandan ; Gao, 
Liming ; Wang, Jian J ; Fu, Siyuan 
; Wu, Jiaxin 
Subject: [PATCH] MdeModulePkg: Remove trailing white space

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

Cc: Dandan Bi 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/Ppi/Ppi.c|  4 +--
 MdeModulePkg/Include/Library/NetLib.h  |  2 +-
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   |  2 +-
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c |  4 +--
 MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c|  2 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  | 14 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 30 +++---
 7 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c 
index d8ba2dd42b59..6f03858b8a94 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -143,7 +143,7 @@ ConvertPointerInRanges (
 
   Migrate Single PPI Pointer from the temporary memory to PEI installed memory.
 
-  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size 
+  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size
  and location of temporary RAM, the stack location and 
the BFV location.
   @param PrivateData Pointer to PeiCore's private data structure.
   @param PpiPointer  Pointer to Ppi
@@ -179,7 +179,7 @@ ConvertSinglePpiPointer (
 
   Migrate PPI Pointers from the temporary memory to PEI installed memory.
 
-  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size 
+  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size
  and location of temporary RAM, the stack location and 
the BFV location.
   @param PrivateData Pointer to PeiCore's private data structure.
 
diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index b7ef99c7b568..09779739213e 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -424,7 +424,7 @@ NetGetIpClass (
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
   mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
   PPP link).
-  
+
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c 
b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 91c6849a4658..20fd29a3a87f 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -765,7 +765,7 @@ GetFmpHandleBufferByType (
 MatchedHandleBuffer[MatchedNumberOfHandles] = HandleBuffer[Index];
   }
   if (MatchedResetRequiredBuffer != NULL) {
-MatchedResetRequiredBuffer[MatchedNumberOfHandles] = 
(((TempFmpImageInfo->AttributesSupported & 
+MatchedResetRequiredBuffer[MatchedNumberOfHandles] = 
+ (((TempFmpImageInfo->AttributesSupported &
  
IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0) &&
  
((TempFmpImageInfo->AttributesSetting &
  
IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0)); diff --git 
a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 63f4724062e9..9e3ea2490928 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -656,7 +656,7 @@ NetGetIpClass (
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
   mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
   PPP link).
-  
+
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
@@ -671,7 +671,7 @@ NetIp4IsUnicast (
   )
 {
   INTN   MaskLength;
-  
+
   ASSERT (NetMask != 0);
 
   if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) { diff --git 
a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c 
b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
index 219059760e97..129e90ca11b4 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -296,7 +296,7 @@ CreateFmpBasedEsrt (
 
   Table->FwResourceCount= 0;
   

[edk2] [Patch] BaseTools: Fix the RaiseError variable issue caused by 855698fb69f

2018-09-04 Thread Yonghong Zhu
The bug is that it cause the RaiseError always be set to TRUE even we
call the function with FALSE parameter.

Cc: Hess Chen 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu 
---
 BaseTools/Source/Python/Common/EdkLogger.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/Common/EdkLogger.py 
b/BaseTools/Source/Python/Common/EdkLogger.py
index 80697bf..af77074 100644
--- a/BaseTools/Source/Python/Common/EdkLogger.py
+++ b/BaseTools/Source/Python/Common/EdkLogger.py
@@ -196,12 +196,12 @@ def error(ToolName, ErrorCode, Message=None, File=None, 
Line=None, ExtraData=Non
 LogText =  _ErrorMessageTemplate % TemplateDict
 else:
 LogText = _ErrorMessageTemplateWithoutFile % TemplateDict
 
 _ErrorLogger.log(ERROR, LogText)
-RaiseError = IsRaiseError
-if RaiseError:
+
+if RaiseError and IsRaiseError:
 raise FatalError(ErrorCode)
 
 # Log information which should be always put out
 quiet   = _ErrorLogger.error
 
-- 
2.6.1.windows.1

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


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

2018-09-04 Thread Yonghong Zhu
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


Re: [edk2] [PATCH] MdeModulePkg: Remove trailing white space

2018-09-04 Thread Fu, Siyuan
Reviewed-by: Fu Siyuan 

> -Original Message-
> From: Zeng, Star
> Sent: Wednesday, September 5, 2018 10:01 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Bi, Dandan ;
> Gao, Liming ; Wang, Jian J ;
> Fu, Siyuan ; Wu, Jiaxin 
> Subject: [PATCH] MdeModulePkg: Remove trailing white space
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1144
> 
> Cc: Dandan Bi 
> Cc: Liming Gao 
> Cc: Jian J Wang 
> Cc: Siyuan Fu 
> Cc: Jiaxin Wu 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Core/Pei/Ppi/Ppi.c|  4 +--
>  MdeModulePkg/Include/Library/NetLib.h  |  2 +-
>  .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   |  2 +-
>  MdeModulePkg/Library/DxeNetLib/DxeNetLib.c |  4 +--
>  MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c|  2 +-
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  | 14 +-
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 30 +++--
> -
>  7 files changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
> b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
> index d8ba2dd42b59..6f03858b8a94 100644
> --- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
> +++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
> @@ -143,7 +143,7 @@ ConvertPointerInRanges (
> 
>Migrate Single PPI Pointer from the temporary memory to PEI installed
> memory.
> 
> -  @param SecCoreData Points to a data structure containing SEC to PEI
> handoff data, such as the size
> +  @param SecCoreData Points to a data structure containing SEC to PEI
> handoff data, such as the size
>   and location of temporary RAM, the stack
> location and the BFV location.
>@param PrivateData Pointer to PeiCore's private data structure.
>@param PpiPointer  Pointer to Ppi
> @@ -179,7 +179,7 @@ ConvertSinglePpiPointer (
> 
>Migrate PPI Pointers from the temporary memory to PEI installed memory.
> 
> -  @param SecCoreData Points to a data structure containing SEC to PEI
> handoff data, such as the size
> +  @param SecCoreData Points to a data structure containing SEC to PEI
> handoff data, such as the size
>   and location of temporary RAM, the stack
> location and the BFV location.
>@param PrivateData Pointer to PeiCore's private data structure.
> 
> diff --git a/MdeModulePkg/Include/Library/NetLib.h
> b/MdeModulePkg/Include/Library/NetLib.h
> index b7ef99c7b568..09779739213e 100644
> --- a/MdeModulePkg/Include/Library/NetLib.h
> +++ b/MdeModulePkg/Include/Library/NetLib.h
> @@ -424,7 +424,7 @@ NetGetIpClass (
>except when the originator is one of the endpoints of a point-to-point
> link with a 31-bit
>mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special
> network environment (e.g.
>PPP link).
> -
> +
>@param[in]  IpThe IP to check against.
>@param[in]  NetMask   The mask of the IP.
> 
> diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> index 91c6849a4658..20fd29a3a87f 100644
> --- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> +++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
> @@ -765,7 +765,7 @@ GetFmpHandleBufferByType (
>  MatchedHandleBuffer[MatchedNumberOfHandles] =
> HandleBuffer[Index];
>}
>if (MatchedResetRequiredBuffer != NULL) {
> -MatchedResetRequiredBuffer[MatchedNumberOfHandles] =
> (((TempFmpImageInfo->AttributesSupported &
> +MatchedResetRequiredBuffer[MatchedNumberOfHandles] =
> (((TempFmpImageInfo->AttributesSupported &
> 
> IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0) &&
> 
> ((TempFmpImageInfo->AttributesSetting &
> 
> IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0));
> diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> index 63f4724062e9..9e3ea2490928 100644
> --- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> +++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
> @@ -656,7 +656,7 @@ NetGetIpClass (
>except when the originator is one of the endpoints of a point-to-point
> link with a 31-bit
>mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special
> network environment (e.g.
>PPP link).
> -
> +
>@param[in]  IpThe IP to check against.
>@param[in]  NetMask   The mask of the IP.
> 
> @@ -671,7 +671,7 @@ NetIp4IsUnicast (
>)
>  {
>INTN   MaskLength;
> -
> +
>ASSERT (NetMask != 0);
> 
>if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {
> diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
> b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
> index 219059760e97..129e90ca11b4 100644
> --- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
> +++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
> @@ -296,7 +296,7 @@ CreateFmpBasedEsrt (
> 
>Table->FwResourceCount= 0;
>

[edk2] [PATCH] MdeModulePkg: Remove trailing white space

2018-09-04 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1144

Cc: Dandan Bi 
Cc: Liming Gao 
Cc: Jian J Wang 
Cc: Siyuan Fu 
Cc: Jiaxin Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/Ppi/Ppi.c|  4 +--
 MdeModulePkg/Include/Library/NetLib.h  |  2 +-
 .../Library/DxeCapsuleLibFmp/DxeCapsuleLib.c   |  2 +-
 MdeModulePkg/Library/DxeNetLib/DxeNetLib.c |  4 +--
 MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c|  2 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  | 14 +-
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 30 +++---
 7 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Ppi/Ppi.c b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
index d8ba2dd42b59..6f03858b8a94 100644
--- a/MdeModulePkg/Core/Pei/Ppi/Ppi.c
+++ b/MdeModulePkg/Core/Pei/Ppi/Ppi.c
@@ -143,7 +143,7 @@ ConvertPointerInRanges (
 
   Migrate Single PPI Pointer from the temporary memory to PEI installed memory.
 
-  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size 
+  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size
  and location of temporary RAM, the stack location and 
the BFV location.
   @param PrivateData Pointer to PeiCore's private data structure.
   @param PpiPointer  Pointer to Ppi
@@ -179,7 +179,7 @@ ConvertSinglePpiPointer (
 
   Migrate PPI Pointers from the temporary memory to PEI installed memory.
 
-  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size 
+  @param SecCoreData Points to a data structure containing SEC to PEI 
handoff data, such as the size
  and location of temporary RAM, the stack location and 
the BFV location.
   @param PrivateData Pointer to PeiCore's private data structure.
 
diff --git a/MdeModulePkg/Include/Library/NetLib.h 
b/MdeModulePkg/Include/Library/NetLib.h
index b7ef99c7b568..09779739213e 100644
--- a/MdeModulePkg/Include/Library/NetLib.h
+++ b/MdeModulePkg/Include/Library/NetLib.h
@@ -424,7 +424,7 @@ NetGetIpClass (
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
   mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
   PPP link).
-  
+
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
diff --git a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c 
b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
index 91c6849a4658..20fd29a3a87f 100644
--- a/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
+++ b/MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.c
@@ -765,7 +765,7 @@ GetFmpHandleBufferByType (
 MatchedHandleBuffer[MatchedNumberOfHandles] = HandleBuffer[Index];
   }
   if (MatchedResetRequiredBuffer != NULL) {
-MatchedResetRequiredBuffer[MatchedNumberOfHandles] = 
(((TempFmpImageInfo->AttributesSupported & 
+MatchedResetRequiredBuffer[MatchedNumberOfHandles] = 
(((TempFmpImageInfo->AttributesSupported &
  
IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0) &&
  
((TempFmpImageInfo->AttributesSetting &
  
IMAGE_ATTRIBUTE_RESET_REQUIRED) != 0));
diff --git a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c 
b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
index 63f4724062e9..9e3ea2490928 100644
--- a/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
+++ b/MdeModulePkg/Library/DxeNetLib/DxeNetLib.c
@@ -656,7 +656,7 @@ NetGetIpClass (
   except when the originator is one of the endpoints of a point-to-point link 
with a 31-bit
   mask (RFC3021), or a 32bit NetMask (all 0xFF) is used for special network 
environment (e.g.
   PPP link).
-  
+
   @param[in]  IpThe IP to check against.
   @param[in]  NetMask   The mask of the IP.
 
@@ -671,7 +671,7 @@ NetIp4IsUnicast (
   )
 {
   INTN   MaskLength;
-  
+
   ASSERT (NetMask != 0);
 
   if (Ip == 0 || IP4_IS_LOCAL_BROADCAST (Ip)) {
diff --git a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c 
b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
index 219059760e97..129e90ca11b4 100644
--- a/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
+++ b/MdeModulePkg/Universal/EsrtFmpDxe/EsrtFmp.c
@@ -296,7 +296,7 @@ CreateFmpBasedEsrt (
 
   Table->FwResourceCount= 0;
   Table->FwResourceCountMax = GROWTH_STEP;
-  Table->FwResourceVersion  = 
EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION; 
+  Table->FwResourceVersion  = 
EFI_SYSTEM_RESOURCE_TABLE_FIRMWARE_RESOURCE_VERSION;
 
   for (Index = 0; Index < NoProtocols; Index++) {
 Fmp = (EFI_FIRMWARE_MANAGEMENT_PROTOCOL *) 

[edk2] [Patch] MdeModulePkg PeiCore: Remove the copy logic for PeiImageRead function

2018-09-04 Thread Liming Gao
The copy PeiImageRead function doesn't improve the boot performance.
This patch removes this copy logic to simplify the code logic.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Liming Gao 
---
 MdeModulePkg/Core/Pei/Image/Image.c | 65 +
 1 file changed, 1 insertion(+), 64 deletions(-)

diff --git a/MdeModulePkg/Core/Pei/Image/Image.c 
b/MdeModulePkg/Core/Pei/Image/Image.c
index f84f2c7..303acf3 100644
--- a/MdeModulePkg/Core/Pei/Image/Image.c
+++ b/MdeModulePkg/Core/Pei/Image/Image.c
@@ -62,44 +62,6 @@ PeiImageRead (
 
 /**
 
-  Support routine for the PE/COFF Loader that reads a buffer from a PE/COFF 
file.
-  The function is implemented as PIC so as to support shadowing.
-
-  @param FileHandle  - The handle to the PE/COFF file
-  @param FileOffset  - The offset, in bytes, into the file to read
-  @param ReadSize- The number of bytes to read from the file starting 
at FileOffset
-  @param Buffer  - A pointer to the buffer to read the data into.
-
-  @return EFI_SUCCESS - ReadSize bytes of data were read into Buffer from the 
PE/COFF file starting at FileOffset
-
-**/
-EFI_STATUS
-EFIAPI
-PeiImageReadForShadow (
-  IN VOID*FileHandle,
-  IN UINTN   FileOffset,
-  IN UINTN   *ReadSize,
-  OUTVOID*Buffer
-  )
-{
-  volatile CHAR8  *Destination8;
-  CHAR8   *Source8;
-  UINTN   Length;
-
-  Destination8  = Buffer;
-  Source8   = (CHAR8 *) ((UINTN) FileHandle + FileOffset);
-  if (Destination8 != Source8) {
-Length= *ReadSize;
-while ((Length--) > 0) {
-  *(Destination8++) = *(Source8++);
-}
-  }
-
-  return EFI_SUCCESS;
-}
-
-/**
-
   Support routine to get the Image read file function.
 
   @param ImageContext- The context of the image being loaded
@@ -112,35 +74,10 @@ GetImageReadFunction (
   IN  PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext
   )
 {
-#if defined (MDE_CPU_IA32) || defined (MDE_CPU_X64)
-  PEI_CORE_INSTANCE *Private;
-  EFI_PHYSICAL_ADDRESS  MemoryBuffer;
-
-  Private = PEI_CORE_INSTANCE_FROM_PS_THIS (GetPeiServicesTablePointer ());
-  MemoryBuffer = 0;
-
-  if (Private->PeiMemoryInstalled  && 
(((Private->HobList.HandoffInformationTable->BootMode != BOOT_ON_S3_RESUME) && 
PcdGetBool (PcdShadowPeimOnBoot)) ||
-  ((Private->HobList.HandoffInformationTable->BootMode == 
BOOT_ON_S3_RESUME) && PcdGetBool (PcdShadowPeimOnS3Boot {
-//
-// Shadow algorithm makes lots of non ANSI C assumptions and only works 
for IA32 and X64
-//  compilers that have been tested
-//
-if (Private->ShadowedImageRead == NULL) {
-  PeiServicesAllocatePages (EfiBootServicesCode, 0x400 / EFI_PAGE_SIZE + 
1, );
-  ASSERT (MemoryBuffer != 0);
-  CopyMem ((VOID *)(UINTN)MemoryBuffer, (CONST VOID *) (UINTN) 
PeiImageReadForShadow, 0x400);
-  Private->ShadowedImageRead = (PE_COFF_LOADER_READ_FILE) (UINTN) 
MemoryBuffer;
-}
-
-ImageContext->ImageRead = Private->ShadowedImageRead;
-  } else {
-ImageContext->ImageRead = PeiImageRead;
-  }
-#else
   ImageContext->ImageRead = PeiImageRead;
-#endif
   return EFI_SUCCESS;
 }
+
 /**
   To check memory usage bit map array to figure out if the memory range the 
image will be loaded in is available or not. If
   memory range is available, the function will mark the corresponding bits to 
1 which indicates the memory range is used.
-- 
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: 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] MdeModulePkg PeiCore: Fix VS2012 build failure

2018-09-04 Thread Bi, Dandan
Reviewed-by: Dandan Bi 

Thanks,
Dandan
-Original Message-
From: Zeng, Star 
Sent: Tuesday, September 4, 2018 9:18 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star ; Bi, Dandan ; Gao, 
Liming ; Wang, Jian J 
Subject: [PATCH] MdeModulePkg PeiCore: Fix VS2012 build failure

fwvol.c(1572) : warning C4701: potentially uninitialized local variable 
'Status' used

The build failure is caused by
0e042d0ad76157ac9bad17bb4e1ff2919ca0d8f4 for
https://bugzilla.tianocore.org/show_bug.cgi?id=1131

This patch initializes Status to fix the build failure.

Cc: Dandan Bi 
Cc: Liming Gao 
Cc: Jian J Wang 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng 
---
 MdeModulePkg/Core/Pei/FwVol/FwVol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Pei/FwVol/FwVol.c 
b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
index 7ea503a10fb5..5629c9a1ce20 100644
--- a/MdeModulePkg/Core/Pei/FwVol/FwVol.c
+++ b/MdeModulePkg/Core/Pei/FwVol/FwVol.c
@@ -1412,6 +1412,8 @@ ProcessFvFile (
   ParentFvHandle = ParentFvCoreHandle->FvHandle;
   ParentFvPpi= ParentFvCoreHandle->FvPpi;
 
+  Status = EFI_SUCCESS;
+
   //
   // Find FvImage(s) in FvFile
   //
--
2.7.0.windows.1

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


Re: [edk2] [staging/MicroPythonTestFramework][PATCH] MpyTestFrameworkPkg: use minified jquery source

2018-09-04 Thread Long, Qin
Reviewed-by: Long Qin 


Best Regards & Thanks,
LONG, Qin

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Stephano Cetola
> Sent: Tuesday, September 4, 2018 10:51 AM
> To: edk2-devel@lists.01.org
> Cc: Long, Qin 
> Subject: [edk2] [staging/MicroPythonTestFramework][PATCH]
> MpyTestFrameworkPkg: use minified jquery source
> 
> We should be using the compressed "minified" jquery source file rather than 
> the
> uncompressed version, as it will reduce the page load times.
> 
> This updates the relevant FreeMaker templates, the readme, and the setup 
> script.
> It also corrects a small mistake in the error text of the setup script.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1.
> Signed-off-by: Stephano Cetola 
> ---
>  MpyTestFrameworkPkg/README.md   | 2 +-
>  .../ReportGenerator/src/main/resources/templates/index.ftl  | 2 +-
>  .../src/main/resources/templates/iteration.ftl  | 4 ++--
>  .../src/main/resources/templates/recurrentSequence.ftl  | 2 +-
>  MpyTestFrameworkPkg/setup.py| 6 +++---
>  5 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/MpyTestFrameworkPkg/README.md
> b/MpyTestFrameworkPkg/README.md index bd1579dcd3..9bcd22d843 100644
> --- a/MpyTestFrameworkPkg/README.md
> +++ b/MpyTestFrameworkPkg/README.md
> @@ -13,7 +13,7 @@ This test framework is dependent on the MicroPython
> Interpreter for UEFI: [Micro
>   * Install [Python27](https://www.python.org/).
>   * Install Maven, using the official site tutorial: [Installing Apache
> Maven](https://maven.apache.org/install.html). JDK 1.8 is preferred.
>   * Download `Chart.bundle.min.js` from the [ChartJS official
> site](https://github.com/chartjs/Chart.js/releases) and copy it to
> `MpyTestFrameworkPkg\Report\resources\js`
> - * Download `jquery-3.3.1.js` from the [JQuery official
> site](https://jquery.com/download/) and copy it to
> `MpyTestFrameworkPkg\Report\resources\js`
> + * Download `jquery-3.3.1.min.js` from the [JQuery official
> + site](https://jquery.com/download/) and copy it to
> + `MpyTestFrameworkPkg\Report\resources\js`
> 
>  ### Configuration
> 
> diff --git
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/index.ftl
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/index.ftl
> index ed611f3805..d58c002baf 100644
> ---
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/index.ftl
> +++
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templ
> +++ ates/index.ftl
> @@ -3,7 +3,7 @@
>ETS Report
>
>
> -  
> +  
>  
> 
>  
> diff --git
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/iteration.ftl
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/iteration.ftl
> index 82b681c8a4..e3f2490215 100644
> ---
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/iteration.ftl
> +++
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templ
> +++ ates/iteration.ftl
> @@ -3,7 +3,7 @@
>ETS Report
>
>
> -  
> +  
>  
>  
> 
> @@ -170,4 +170,4 @@
>
> 
>  
> -
> \ No newline at end of file
> +
> diff --git
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/recurrentSequence.ftl
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/recurrentSequence.ftl
> index d3c263cf91..1d09752095 100644
> ---
> a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templat
> es/recurrentSequence.ftl
> +++
> b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templ
> +++ ates/recurrentSequence.ftl
> @@ -3,7 +3,7 @@
>ETS Report
>
>
> -  
> +  
>  
> 
>  
> diff --git a/MpyTestFrameworkPkg/setup.py b/MpyTestFrameworkPkg/setup.py
> index 993a4cc598..4eaf43bfed 100644
> --- a/MpyTestFrameworkPkg/setup.py
> +++ b/MpyTestFrameworkPkg/setup.py
> @@ -31,8 +31,8 @@ def check_environment():
>  error_p('Please download Chart.bundle.min.js to
> MpyTestFrameworkPkg/Report/resources/js folder')
>  return False
> 
> -if not os.path.exists(origin + '/Report' + '/resources' + '/js' + 
> '/jquery-3.3.1.js'):
> -error_p('Please download jquery-3.3.1.jsChart.bundle.min.js to
> MpyTestFrameworkPkg/Report/resources/js folder')
> +if not os.path.exists(origin + '/Report' + '/resources' + '/js' + 
> '/jquery-
> 3.3.1.min.js'):
> +error_p('Please download jquery-3.3.1.min.js
> + MpyTestFrameworkPkg/Report/resources/js folder')
>  return False
> 
>  return True
> @@ -111,4 +111,4 @@ def  generate_target():
> 
>  # Main procedure
>  if check_environment() == True:
> -generate_target()
> \ No newline at end of file
> +generate_target()
> --
> 2.17.1
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> 

[edk2] [staging/MicroPythonTestFramework][PATCH] MpyTestFrameworkPkg: use minified jquery source

2018-09-04 Thread Stephano Cetola
We should be using the compressed "minified" jquery source file
rather than the uncompressed version, as it will reduce the page
load times.

This updates the relevant FreeMaker templates, the readme, and
the setup script. It also corrects a small mistake in the error
text of the setup script.

Contributed-under: TianoCore Contribution Agreement 1.1.
Signed-off-by: Stephano Cetola 
---
 MpyTestFrameworkPkg/README.md   | 2 +-
 .../ReportGenerator/src/main/resources/templates/index.ftl  | 2 +-
 .../src/main/resources/templates/iteration.ftl  | 4 ++--
 .../src/main/resources/templates/recurrentSequence.ftl  | 2 +-
 MpyTestFrameworkPkg/setup.py| 6 +++---
 5 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/MpyTestFrameworkPkg/README.md b/MpyTestFrameworkPkg/README.md
index bd1579dcd3..9bcd22d843 100644
--- a/MpyTestFrameworkPkg/README.md
+++ b/MpyTestFrameworkPkg/README.md
@@ -13,7 +13,7 @@ This test framework is dependent on the MicroPython 
Interpreter for UEFI: [Micro
  * Install [Python27](https://www.python.org/).
  * Install Maven, using the official site tutorial: [Installing Apache 
Maven](https://maven.apache.org/install.html). JDK 1.8 is preferred.
  * Download `Chart.bundle.min.js` from the [ChartJS official 
site](https://github.com/chartjs/Chart.js/releases) and copy it to 
`MpyTestFrameworkPkg\Report\resources\js`
- * Download `jquery-3.3.1.js` from the [JQuery official 
site](https://jquery.com/download/) and copy it to 
`MpyTestFrameworkPkg\Report\resources\js`
+ * Download `jquery-3.3.1.min.js` from the [JQuery official 
site](https://jquery.com/download/) and copy it to 
`MpyTestFrameworkPkg\Report\resources\js`
 
 ### Configuration
 
diff --git 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/index.ftl
 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/index.ftl
index ed611f3805..d58c002baf 100644
--- 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/index.ftl
+++ 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/index.ftl
@@ -3,7 +3,7 @@
   ETS Report
   
   
-  
+  
 
 
 
diff --git 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/iteration.ftl
 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/iteration.ftl
index 82b681c8a4..e3f2490215 100644
--- 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/iteration.ftl
+++ 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/iteration.ftl
@@ -3,7 +3,7 @@
   ETS Report
   
   
-  
+  
 
 
 
@@ -170,4 +170,4 @@
   
   
 
-
\ No newline at end of file
+
diff --git 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/recurrentSequence.ftl
 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/recurrentSequence.ftl
index d3c263cf91..1d09752095 100644
--- 
a/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/recurrentSequence.ftl
+++ 
b/MpyTestFrameworkPkg/Tools/ReportGenerator/src/main/resources/templates/recurrentSequence.ftl
@@ -3,7 +3,7 @@
   ETS Report
   
   
-  
+  
 
 
 
diff --git a/MpyTestFrameworkPkg/setup.py b/MpyTestFrameworkPkg/setup.py
index 993a4cc598..4eaf43bfed 100644
--- a/MpyTestFrameworkPkg/setup.py
+++ b/MpyTestFrameworkPkg/setup.py
@@ -31,8 +31,8 @@ def check_environment():
 error_p('Please download Chart.bundle.min.js to 
MpyTestFrameworkPkg/Report/resources/js folder')
 return False
 
-if not os.path.exists(origin + '/Report' + '/resources' + '/js' + 
'/jquery-3.3.1.js'):
-error_p('Please download jquery-3.3.1.jsChart.bundle.min.js to 
MpyTestFrameworkPkg/Report/resources/js folder')
+if not os.path.exists(origin + '/Report' + '/resources' + '/js' + 
'/jquery-3.3.1.min.js'):
+error_p('Please download jquery-3.3.1.min.js 
MpyTestFrameworkPkg/Report/resources/js folder')
 return False
 
 return True
@@ -111,4 +111,4 @@ def  generate_target():
 
 # Main procedure
 if check_environment() == True:
-generate_target()
\ No newline at end of file
+generate_target()
-- 
2.17.1

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


Re: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg

2018-09-04 Thread Kinney, Michael D
Krishna,

I agree this type of information is very useful.

I recommend that the Readme.md in the EmulatorPkg contain
a brief summary and basic instructions to build and run.
It should also provide a pointer to the EmulatorPkg Wiki page
for additional details on the design and implementation.

https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of krishnaLee
> Sent: Monday, September 3, 2018 8:12 PM
> To: edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH v2 00/12] Add WinHost support
> in EmulatorPkg
> 
> Hi,
> It's a good idea,besides the code,I also think it is
> bettter to put out some design note to help
> newbie/user/developer,it may be useful to many
> people,such as:
> Emulator_user_guide.pdf,
> Emulator_developer_guide.pdf,
> the implementation_of_Emulator.pdf
> the implementation_of_Emulator's xxx .pdf
> How does Emulator's something worked.pdf
> 
> 
> thank you,
> by krishna.
> 
> 
> 
> 
> 
> 
> 
> 
> At 2018-09-04 10:32:09, "Ni, Ruiyu" 
> wrote:
> >Shia,
> >This is my personal plan. But I need to:
> >1. make EmulatorPkg/Win be functionality equivalent to
> Nt32Pkg
> >2. All existing Nt32Pkg customers are happy to use
> EmulatorPkg/Win
> >
> >Until then, I may remove Nt32Pkg.
> >Again, this is my personal plan, not an official
> decision.
> >
> >Any comments?
> >
> >> -Original Message-
> >> From: Shia, Cinnamon [mailto:cinnamon.s...@hpe.com]
> >> Sent: Thursday, August 30, 2018 9:58 AM
> >> To: Ni, Ruiyu ; edk2-
> de...@lists.01.org
> >> Subject: RE: [edk2] [PATCH v2 00/12] Add WinHost
> support in EmulatorPkg
> >>
> >> Hi Ray,
> >>
> >> Does this change mean that Nt32Pkg is going to be
> retired?
> >>
> >> Thanks
> >> Cinnamon Shia
> >>
> >> -Original Message-
> >> From: edk2-devel [mailto:edk2-devel-
> boun...@lists.01.org] On Behalf Of Ruiyu
> >> Ni
> >> Sent: Thursday, August 23, 2018 5:56 PM
> >> To: edk2-devel@lists.01.org
> >> Subject: [edk2] [PATCH v2 00/12] Add WinHost support
> in EmulatorPkg
> >>
> >> REF:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1112
> >>
> >> The patch sets add WinHost support (Nt32) in
> EmulatorPkg.
> >> 3 EmulatorPkg common issues were found and fixed.
> >> Other 9 patches are to step-by-step enable the
> WinHost.
> >>
> >> v2 sends to correct mail address.
> >>
> >> Ruiyu Ni (12):
> >>   EmulatorPkg/ThunkProtocolList: Fix VS build failure
> >>   EmulatorPkg/Win: Add Windows host support
> >>   EmulatorPkg/Win: Enable source level debugging
> >>   EmulatorPkg/Win: Enable native OS console as
> firmware console
> >>   EmulatorPkg/Win: Add input/output support
> >>   EmulatorPkg/Win: Add timer and interrupt support
> >>   EmulatorPkg/Win: Add RTC support
> >>   EmulatorPkg/Win: Add SimpleFileSystem support
> >>   EmulatorPkg/Win: Add BlockIo support
> >>   EmulatorPkg/PlatformBds: Signal EndOfDxe in
> platform BDS
> >>   EmulatorPkg/EmuFileSystem: Fix a bug that causes
> Close() assertion
> >>   EmulatorPkg/DSC: Remove FS mapping to EDK Shell bin
> directory
> >>
> >>  .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |
> 33 +-
> >>  EmulatorPkg/EmulatorPkg.dsc|
> 17 +-
> >>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c|
> 4 +-
> >>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h|
> 4 +-
> >>  EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf|
> 5 +-
> >>  .../Library/ThunkProtocolList/ThunkProtocolList.c  |
> 4 +-
> >>  EmulatorPkg/Win/Host/WinBlockIo.c  |
> 563 +
> >>  EmulatorPkg/Win/Host/WinFileSystem.c   |
> 2409
> >> 
> >>  EmulatorPkg/Win/Host/WinGop.h  |
> 204 ++
> >>  EmulatorPkg/Win/Host/WinGopInput.c |
> 417 
> >>  EmulatorPkg/Win/Host/WinGopScreen.c|
> 872 +++
> >>  EmulatorPkg/Win/Host/WinHost.c |
> 947 
> >>  EmulatorPkg/Win/Host/WinHost.h |
> 209 ++
> >>  EmulatorPkg/Win/Host/WinHost.inf   |
> 107 +
> >>  EmulatorPkg/Win/Host/WinInclude.h  |
> 75 +
> >>  EmulatorPkg/Win/Host/WinMemoryAllocationLib.c  |
> 178 ++
> >>  EmulatorPkg/Win/Host/WinThunk.c|
> 577 +
> >>  17 files changed, 6614 insertions(+), 11 deletions(-
> )  create mode 100644
> >> EmulatorPkg/Win/Host/WinBlockIo.c  create mode 100644
> >> EmulatorPkg/Win/Host/WinFileSystem.c
> >>  create mode 100644 EmulatorPkg/Win/Host/WinGop.h
> create mode 100644
> >> EmulatorPkg/Win/Host/WinGopInput.c
> >>  create mode 100644
> EmulatorPkg/Win/Host/WinGopScreen.c
> >>  create mode 100644 EmulatorPkg/Win/Host/WinHost.c
> create mode 100644
> >> EmulatorPkg/Win/Host/WinHost.h  create mode 100644
> >> EmulatorPkg/Win/Host/WinHost.inf  create mode 100644
> >> EmulatorPkg/Win/Host/WinInclude.h  create mode 100644
> >> EmulatorPkg/Win/Host/WinMemoryAllocationLib.c
> >>  create mode 100644 

Re: [edk2] [Patch] BaseTools: Involve Dec default value to calculate Maxsize

2018-09-04 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

> -Original Message-
> From: Feng, Bob C
> Sent: Sunday, September 02, 2018 6:06 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Zhu, Yonghong
> ; Carsey, Jaben ;
> Feng, Bob C 
> Subject: [Patch] BaseTools: Involve Dec default value to calculate Maxsize
> Importance: High
> 
> Involve Dec default value to calculate Maxsize for structure PCD
> 
> Cc: Liming Gao 
> Cc: Yonghong Zhu 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> ---
>  .../Source/Python/Workspace/BuildClassObject.py| 34 +++--
> -
>  1 file changed, 17 insertions(+), 17 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> index 88465c59ea..b2e5309a90 100644
> --- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
> +++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
> @@ -66,35 +66,35 @@ class PcdClassObject(object):
>  self.DscDefaultValue = Value
>  self.PcdValueFromComm = ""
>  self.PcdValueFromFdf = ""
>  self.DefinitionPosition = ("","")
> 
> +@staticmethod
> +def GetPcdMaxSizeWorker(PcdString, MaxSize):
> +if PcdString.startswith("{") and PcdString.endswith("}"):
> +return  max([len(PcdString.split(",")),MaxSize])
> +
> +if PcdString.startswith("\"") or PcdString.startswith("\'"):
> +return  max([len(PcdString)-2+1,MaxSize])
> +
> +if PcdString.startswith("L\""):
> +return  max([2*(len(PcdString)-3+1),MaxSize])
> +
> +return max([len(PcdString),MaxSize])
> +
>  ## Get the maximum number of bytes
>  def GetPcdMaxSize(self):
>  if self.DatumType in TAB_PCD_NUMERIC_TYPES:
>  return MAX_SIZE_TYPE[self.DatumType]
> 
>  MaxSize = int(self.MaxDatumSize, 10) if self.MaxDatumSize else 0
>  if self.PcdValueFromFdf:
> -if self.PcdValueFromFdf.startswith("{") and
> self.PcdValueFromFdf.endswith("}"):
> -MaxSize =  
> max([len(self.PcdValueFromFdf.split(",")),MaxSize])
> -elif self.PcdValueFromFdf.startswith("\"") or
> self.PcdValueFromFdf.startswith("\'"):
> -MaxSize =  max([len(self.PcdValueFromFdf)-2+1,MaxSize])
> -elif self.PcdValueFromFdf.startswith("L\""):
> -MaxSize =  max([2*(len(self.PcdValueFromFdf)-3+1),MaxSize])
> -else:
> -MaxSize = max([len(self.PcdValueFromFdf),MaxSize])
> -
> +MaxSize =
> self.GetPcdMaxSizeWorker(self.PcdValueFromFdf,MaxSize)
>  if self.PcdValueFromComm:
> -if self.PcdValueFromComm.startswith("{") and
> self.PcdValueFromComm.endswith("}"):
> -return max([len(self.PcdValueFromComm.split(",")), MaxSize])
> -elif self.PcdValueFromComm.startswith("\"") or
> self.PcdValueFromComm.startswith("\'"):
> -return max([len(self.PcdValueFromComm)-2+1, MaxSize])
> -elif self.PcdValueFromComm.startswith("L\""):
> -return max([2*(len(self.PcdValueFromComm)-3+1), MaxSize])
> -else:
> -return max([len(self.PcdValueFromComm), MaxSize])
> +MaxSize =
> self.GetPcdMaxSizeWorker(self.PcdValueFromComm,MaxSize)
> +if hasattr(self, "DefaultValueFromDec"):
> +MaxSize =
> self.GetPcdMaxSizeWorker(self.DefaultValueFromDec,MaxSize)
>  return MaxSize
> 
>  ## Get the number of bytes
>  def GetPcdSize(self):
>  if self.DatumType in TAB_PCD_NUMERIC_TYPES:
> --
> 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] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in HTTP header.

2018-09-04 Thread Stephen Benjamin
On Tue, Sep 4, 2018 at 7:02 AM Laszlo Ersek  wrote:
>
> On 09/04/18 09:17, Jiaxin Wu wrote:
> > This patch is to resolve the lock-up issue if the value of HTTP header
> > is blank.  The issue is recorded @
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1102.
> >
> > Cc: Stephen Benjamin 
> > Cc: Laszlo Ersek 
> > Cc: Ye Ting 
> > Cc: Fu Siyuan 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Wu Jiaxin 
> > ---
> >  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 57 +++-
> >  1 file changed, 44 insertions(+), 13 deletions(-)
>
> Thank you, Jiaxin, I'll let Stephen test this :)
>
> Stephen, can you please respond with your Tested-by, if the patch solves
> the problem for you?
>
> Also, would you prefer a remote repo+branch that you could pull (over
> applying this patch with "git-am") for testing? The edk2 project uses
> CRLF source files, so "git-am" is a bit quirky.

No need, the patch applied fine. Thanks for the quick turnaround! It
resolved my issue.

Tested-by: Stephen Benjamin 

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


Re: [edk2] [PATCH] EmulatorPkg: Update package level Readme.md

2018-09-04 Thread Wu, Hao A
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: Ni, Ruiyu
> Sent: Tuesday, September 04, 2018 9:19 AM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D; Wu, Hao A
> Subject: [PATCH] EmulatorPkg: Update package level Readme.md
> 
> Since the emulator under Windows is enabled, the patch changes
> README to include the information of emulator under Windows.
> It also changes README to Readme.md for better looking.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Michael D Kinney 
> Cc: Hao A Wu 
> ---
>  EmulatorPkg/README| 35 --
>  EmulatorPkg/Readme.md | 68
> +++
>  2 files changed, 68 insertions(+), 35 deletions(-)
>  delete mode 100644 EmulatorPkg/README
>  create mode 100644 EmulatorPkg/Readme.md
> 
> diff --git a/EmulatorPkg/README b/EmulatorPkg/README
> deleted file mode 100644
> index fdb26de503..00
> --- a/EmulatorPkg/README
> +++ /dev/null
> @@ -1,35 +0,0 @@
> -
> -=== EmulatorPkg Overview ===
> -
> -EmulatorPkg provides an environment where a UEFI environment can be
> -emulated under an environment where a full UEFI compatible
> -environment is not possible.  (For example, running under an OS
> -where an OS process hosts the UEFI emulation environment.)
> -
> -https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
> -
> -=== Status ===
> -
> -* Builds and runs under a posix-like environment with X windows
> -  - Linux
> -  - OS X
> -
> -=== Future Plans ===
> -
> -* Win32 and Win64 support
> -
> -=== Build Scripts ===
> -
> -On systems with the bash shell you can use EmulatorPkg/build.sh to simplify
> -building and running EmulatorPkg.
> -
> -For example, to build + run:
> -$ EmulatorPkg/build.sh
> -$ EmulatorPkg/build.sh run
> -
> -The build architecture will match your host machine's architecture.
> -
> -On X64 host machines, you can build + run IA32 mode as well:
> -$ EmulatorPkg/build.sh -a IA32
> -$ EmulatorPkg/build.sh -a IA32 run
> -
> diff --git a/EmulatorPkg/Readme.md b/EmulatorPkg/Readme.md
> new file mode 100644
> index 00..461975e859
> --- /dev/null
> +++ b/EmulatorPkg/Readme.md
> @@ -0,0 +1,68 @@
> +## Overview
> +
> +EmulatorPkg provides an environment where a UEFI environment can be
> +emulated under an environment where a full UEFI compatible
> +environment is not possible.  (For example, running under an OS
> +where an OS process hosts the UEFI emulation environment.)
> +
> +https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg
> +
> +## Status
> +
> +* Builds and runs under
> +  *  a posix-like environment with X windows
> +  - Linux
> +  - OS X
> +  *  Windows environment
> +  - Win10 (verified)
> +  - Win8 (not verified)
> +
> +## How to Build & Run
> +**You can use the following command to build.**
> +  * 32bit emulator in Windows:
> +
> +`build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD -a
> IA32`
> +
> +  * 64bit emulator in Windows:
> +
> +`build -p EmulatorPkg\EmulatorPkg.dsc -t VS2017 -D WIN_SEC_BUILD -a
> X64`
> +
> +  * 32bit emulator in Linux:
> +
> +`build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -D UNIX_SEC_BUILD -a
> IA32`
> +
> +  * 64bit emulator in Linux:
> +
> +`build -p EmulatorPkg\EmulatorPkg.dsc -t GCC5 -D UNIX_SEC_BUILD -a X64`
> +
> +**You can start/run the emulator using the following command:**
> +  * 32bit emulator in Windows:
> +
> +`cd Build\EmulatorIA32\DEBUG_VS2017\IA32\ && WinHost.exe`
> +
> +  * 64bit emulator in Windows:
> +
> +`cd Build\EmulatorX64\DEBUG_VS2017\X64\ && WinHost.exe`
> +
> +  * 32bit emulator in Linux:
> +
> +`cd Build/EmulatorIA32/DEBUG_GCC5/IA32/ && ./Host`
> +
> +  * 64bit emulator in Linux:
> +
> +`cd Build/EmulatorX64/DEBUG_GCC5/X64/ && ./Host`
> +
> +**On posix-like environment with the bash shell you can use
> EmulatorPkg/build.sh to simplify building and running
> +emulator.**
> +
> +For example, to build + run:
> +
> +`$ EmulatorPkg/build.sh`
> +`$ EmulatorPkg/build.sh run`
> +
> +The build architecture will match your host machine's architecture.
> +
> +On X64 host machines, you can build + run IA32 mode as well:
> +
> +`$ EmulatorPkg/build.sh -a IA32`
> +`$ EmulatorPkg/build.sh -a IA32 run`
> --
> 2.16.1.windows.1

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


Re: [edk2] [Patch] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in HTTP header.

2018-09-04 Thread Laszlo Ersek
On 09/04/18 09:17, Jiaxin Wu wrote:
> This patch is to resolve the lock-up issue if the value of HTTP header
> is blank.  The issue is recorded @
> https://bugzilla.tianocore.org/show_bug.cgi?id=1102.
> 
> Cc: Stephen Benjamin 
> Cc: Laszlo Ersek 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Wu Jiaxin 
> ---
>  MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 57 +++-
>  1 file changed, 44 insertions(+), 13 deletions(-)

Thank you, Jiaxin, I'll let Stephen test this :)

Stephen, can you please respond with your Tested-by, if the patch solves
the problem for you?

Also, would you prefer a remote repo+branch that you could pull (over
applying this patch with "git-am") for testing? The edk2 project uses
CRLF source files, so "git-am" is a bit quirky.

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


Re: [edk2] [PATCH] MdeModulePkg/EhciDxe: fix host controller reset condition in BindingStart

2018-09-04 Thread Laszlo Ersek
On 09/04/18 03:27, Zeng, Star wrote:
> Oh, yes. Got the point, the patch is correct indeed. :)
> Thanks for the explanation.
>
> Maybe, an abstracted function will make the logic more clear, like
> EhcIsDebugPortInUse().
> What do you think?

Haha, I thought of almost exactly the same name (just
"IsDebugPortInUse()", and making it STATIC) :) Ultimately however, I
didn't propose it, for the following reason:

There is another conditional hunk added by commit 09943f5ecc0f, namely
in the EhcGetRootHubPortStatus() function. In the Bugzilla, I wrote:

>   - in the EhcGetRootHubPortStatus() function, if the status request
> refers to the debug port, and the debug port is in use, then we
> don't actually fetch the status of the port, we just report
> status=0, status_change=0.

and the code goes like this:

>   if ((Ehc->DebugPortNum != 0) && (PortNumber == (Ehc->DebugPortNum - 1))) {
> DbgCtrlStatus = EhcReadDbgRegister(Ehc, 0);
> if ((DbgCtrlStatus & (USB_DEBUG_PORT_IN_USE | USB_DEBUG_PORT_OWNER)) == 
> (USB_DEBUG_PORT_IN_USE | USB_DEBUG_PORT_OWNER)) {
>   goto ON_EXIT;
> }
>   }

In this case, we not only check whether the host controller has a debug
port (*any* port) and that port is in use, we also check whether the
status request refers specifically to that port.

This additional restriction is not easy to express with
EhcIsDebugPortInUse(). If we wrote

  if (EhcIsDebugPortInUse () && (PortNumber == (Ehc->DebugPortNum - 1))) {
goto ON_EXIT;
  }

then that wouldn't be 100% the same, because in this reformulated
condition, we could access the MMIO debug status register *before* we
decided that the root hub port status request refers to *another* port.

How about the following function:

> /**
>   Check whether the host controller has an in-use debug port.
>
>   @param[in] Ehc The Enhanced Host Controller to query.
>
>   @param[in] PortNumber  If PortNumber is in [0, MAX_UINT8], then query 
> whether
>  PortNumber on Ehc is an in-use debug port. Otherwise,
>  query whether Ehc has any in-use debug port.
>
>   @retval TRUE   PortNumber on Ehc is an in-use debug port (if PortNumber is 
> in
>  [0, MAX_UINT8]), or some port on Ehc is an in-use debug port
>  (otherwise).
>
>   @retval FALSE  PortNumber on Ehc is not an in-use debug port (if PortNumber
>  is in [0, MAX_UINT8]), or no port on Ehc is an in-use debug
>  port (otherwise).
> **/
> BOOLEAN
> EhcIsDebugPortInUse (
>   IN CONST USB2_HC_DEV *Ehc,
>   IN INT16 PortNumber
>   )
> {
>   UINT32 State;
>   UINT32 Mask;
>
>   if (Ehc->DebugPortNum == 0) {
> return FALSE;
>   }
>
>   if (PortNumber >= 0 && PortNumber <= MAX_UINT8 &&
>   (UINT8)PortNumber != Ehc->DebugPortNum - 1) {
> return FALSE;
>   }
>
>   State = EhcReadDbgRegister(Ehc, 0);
>   Mask = USB_DEBUG_PORT_IN_USE | USB_DEBUG_PORT_OWNER;
>   return (State & Mask) == Mask;
> }

Then we can call

  EhcIsDebugPortInUse (Ehc, -1)

in EhcReset() and EhcDriverBindingStart(), and we can call

  EhcIsDebugPortInUse (Ehc, PortNumber)

in EhcGetRootHubPortStatus().

What do you think?

... Anyway, I would like to append such a patch separately to the series
-- I'd like to keep the bugfix and the refactoring separate.

Thanks,
Laszlo

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Monday, September 3, 2018 7:46 PM
> To: Zeng, Star ; edk2-devel-01 
> Cc: Gerd Hoffmann ; Wang, Jian J ; 
> Ni, Ruiyu ; Shi, Steven 
> Subject: Re: [PATCH] MdeModulePkg/EhciDxe: fix host controller reset 
> condition in BindingStart
>
> Hi Star,
>
> On 09/03/18 10:35, Zeng, Star wrote:
>> Good finding.
>>
>> There is another place at
>> https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Bus/Pci/Ehc
>> iDxe/Ehci.c#L150 which has similar logic, please update it also.
>
> I audited all the "DebugPortNum" checks that were added by commit 
> 09943f5ecc0f, here:
>
>   https://bugzilla.tianocore.org/show_bug.cgi?id=1129#c16
>
> The location that you mention is in the EhcReset() function. It is covered in 
> my analysis linked above, and it needs no update, because it is correct.
>
> Namely, in EhcReset(), the condition captures when the reset must be 
> *skipped*. For that, the condition is,
>
>   one of the USB ports on the host controller is a debug port, AND
>   the debug port is in use
>
> When this condition holds, we set Status to EFI_SUCCESS, and jump to ON_EXIT 
> (that is, we skip the re-set and return success without doing anything). This 
> is written in C as
>
>> if (Ehc->DebugPortNum != 0) {
>>   DbgCtrlStatus = EhcReadDbgRegister(Ehc, 0);
>>   if ((DbgCtrlStatus & (USB_DEBUG_PORT_IN_USE | USB_DEBUG_PORT_OWNER)) 
>> == (USB_DEBUG_PORT_IN_USE | USB_DEBUG_PORT_OWNER)) {
>> Status = EFI_SUCCESS;
>> goto ON_EXIT;
>>   }
>> }
>
> However, at the location that the patch modifies, 

[edk2] [PATCH] BaseTools: Check the index of array.

2018-09-04 Thread Zhaozh1x
For structure PCD, add the checker for the ARRAY
element assignment and Buffer FieldSize.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
---
 BaseTools/Source/C/Common/PcdValueCommon.h| 7 +++
 BaseTools/Source/Python/Workspace/DscBuildData.py | 8 
 2 files changed, 15 insertions(+)

diff --git a/BaseTools/Source/C/Common/PcdValueCommon.h 
b/BaseTools/Source/C/Common/PcdValueCommon.h
index 3922428ded..255afdfcc3 100644
--- a/BaseTools/Source/C/Common/PcdValueCommon.h
+++ b/BaseTools/Source/C/Common/PcdValueCommon.h
@@ -22,6 +22,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define __ARRAY_ELEMENT_SIZE(TYPE, Field) (sizeof((TYPE *)0)->Field[0])
 #define __OFFSET_OF(TYPE, Field) ((UINT32) &(((TYPE *)0)->Field))
 #define __FLEXIBLE_SIZE(Size, TYPE, Field, MaxIndex)   if (__FIELD_SIZE(TYPE, 
Field) == 0) Size = MAX((__OFFSET_OF(TYPE, Field) + __ARRAY_ELEMENT_SIZE(TYPE, 
Field) * (MaxIndex)), Size)
+#define __ARRAY_SIZE(Array) (sizeof(Array)/sizeof(Array[0]))
+
+#if defined(_MSC_EXTENSIONS)
+#define __STATIC_ASSERT static_assert
+#else
+#define __STATIC_ASSERT _Static_assert
+#endif
 
 VOID
 PcdEntryPoint (
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623f..98055bcb50 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1766,8 +1766,12 @@ class DscBuildData(PlatformBuildClassObject):
 #
 CApp = CApp + '  FieldSize = __FIELD_SIZE(%s, %s);\n' % 
(Pcd.DatumType, FieldName)
 CApp = CApp + '  Value = %s; // From %s Line %d Value 
%s\n' % (DscBuildData.IntToCString(Value, ValueSize), FieldList[FieldName][1], 
FieldList[FieldName][2], FieldList[FieldName][0])
+CApp = CApp + '  __STATIC_ASSERT(__FIELD_SIZE(%s, %s) >= 
%d, "Input buffer exceeds the buffer array");\n' % (Pcd.DatumType, FieldName, 
ValueSize)
 CApp = CApp + '  memcpy (>%s, Value, (FieldSize > 0 
&& FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
 else:
+if '[' in FieldName and ']' in FieldName:
+Index = int(FieldName.split('[')[1].split(']')[0])
+CApp = CApp + '  __STATIC_ASSERT((%d < 
__ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array checker 
error");\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0])
 if ValueSize > 4:
 CApp = CApp + '  Pcd->%s = %dULL; // From %s Line %d 
Value %s\n' % (FieldName, Value, FieldList[FieldName][1], 
FieldList[FieldName][2], FieldList[FieldName][0])
 else:
@@ -1848,8 +1852,12 @@ class DscBuildData(PlatformBuildClassObject):
 #
 CApp = CApp + '  FieldSize = __FIELD_SIZE(%s, %s);\n' 
% (Pcd.DatumType, FieldName)
 CApp = CApp + '  Value = %s; // From %s Line %d 
Value %s\n' % (DscBuildData.IntToCString(Value, ValueSize), 
FieldList[FieldName][1], FieldList[FieldName][2], FieldList[FieldName][0])
+CApp = CApp + '  __STATIC_ASSERT(__FIELD_SIZE(%s, %s) 
>= %d, "Input buffer exceeds the buffer array");\n' % (Pcd.DatumType, 
FieldName, ValueSize)
 CApp = CApp + '  memcpy (>%s, Value, (FieldSize > 
0 && FieldSize < %d) ? FieldSize : %d);\n' % (FieldName, ValueSize, ValueSize)
 else:
+if '[' in FieldName and ']' in FieldName:
+Index = int(FieldName.split('[')[1].split(']')[0])
+CApp = CApp + '  __STATIC_ASSERT((%d < 
__ARRAY_SIZE(Pcd->%s)) || (__ARRAY_SIZE(Pcd->%s) == 0), "array checker 
error");\n' % (Index, FieldName.split('[')[0], FieldName.split('[')[0])
 if ValueSize > 4:
 CApp = CApp + '  Pcd->%s = %dULL; // From %s Line 
%d Value %s\n' % (FieldName, Value, FieldList[FieldName][1], 
FieldList[FieldName][2], FieldList[FieldName][0])
 else:
-- 
2.14.1.windows.1

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


Re: [edk2] [PATCH] Emulator/Win: Fix build failure using VS2015x86

2018-09-04 Thread Wu, Hao A
Reviewed-by: Hao Wu 

Best Regards,
Hao Wu


> -Original Message-
> From: Ni, Ruiyu
> Sent: Tuesday, September 04, 2018 9:19 AM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D; Wu, Hao A
> Subject: [PATCH] Emulator/Win: Fix build failure using VS2015x86
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Michael D Kinney 
> Cc: Hao A Wu 
> ---
>  EmulatorPkg/Win/Host/WinHost.c|  2 +-
>  EmulatorPkg/Win/Host/WinInclude.h | 15 ---
>  2 files changed, 13 insertions(+), 4 deletions(-)
> 
> diff --git a/EmulatorPkg/Win/Host/WinHost.c
> b/EmulatorPkg/Win/Host/WinHost.c
> index 9b98d5330f..65e8960eff 100644
> --- a/EmulatorPkg/Win/Host/WinHost.c
> +++ b/EmulatorPkg/Win/Host/WinHost.c
> @@ -673,7 +673,7 @@ Returns:
>// Transfer control to the SEC Core
>//
>SwitchStack (
> -(SWITCH_STACK_ENTRY_POINT)SecCoreEntryPoint,
> +(SWITCH_STACK_ENTRY_POINT)(UINTN)SecCoreEntryPoint,
>  SecCoreData,
>  GetThunkPpiList (),
>  TopOfStack
> diff --git a/EmulatorPkg/Win/Host/WinInclude.h
> b/EmulatorPkg/Win/Host/WinInclude.h
> index ae90b1ed30..39a5427dae 100644
> --- a/EmulatorPkg/Win/Host/WinInclude.h
> +++ b/EmulatorPkg/Win/Host/WinInclude.h
> @@ -1,7 +1,7 @@
>  /**@file
>Public include file for the WinNt Library
> 
> -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 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
> @@ -11,8 +11,8 @@ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE
> ON AN "AS IS" BASIS,
>  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS
> OR IMPLIED.
>  **/
> 
> -#ifndef __WIN_NT_INCLUDE_H__
> -#define __WIN_NT_INCLUDE_H__
> +#ifndef __WIN_INCLUDE_H__
> +#define __WIN_INCLUDE_H__
> 
>  //
>  // Win32 include files do not compile clean with /W4, so we use the warning
> @@ -72,4 +72,13 @@ typedef UINT32 size_t ;
>  #pragma warning(default : 4201)
> 
> 
> +//
> +// Define the three macros here in-case the WinSDK is too old.
> +//
> +#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT
> +#define ENABLE_VIRTUAL_TERMINAL_INPUT   0x0200
> +#define ENABLE_VIRTUAL_TERMINAL_PROCESSING  0x0004
> +#define DISABLE_NEWLINE_AUTO_RETURN 0x0008
> +#endif
> +
>  #endif
> --
> 2.16.1.windows.1

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


[edk2] [PATCH] BaseTools: SKU inheritance.

2018-09-04 Thread Zhaozh1x
If the SkuB’s parent SkuA is not in SKUID_IDENTIFIER, then
make SkuB inherit from SkuA as if the SKUID_INDENTIFIER
is ALL.

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 | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index aaef404772..ddc4708a99 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1334,8 +1334,7 @@ class DscBuildData(PlatformBuildClassObject):
 
 Pcds = AllPcds
 DefaultStoreMgr = DefaultStore(self.DefaultStores)
-SkuIds = self.SkuIdMgr.AvailableSkuIdSet
-SkuIds.update({TAB_DEFAULT:0})
+SkuIds = self.SkuIds
 DefaultStores = {storename for pcdobj in AllPcds.values() for skuobj 
in pcdobj.SkuInfoList.values() for storename in skuobj.DefaultStoreDict}
 
 S_PcdSet = []
@@ -2137,7 +2136,7 @@ class DscBuildData(PlatformBuildClassObject):
 CApp = CApp + '  Initialize_%s_%s_%s_%s();\n' % 
(self.SkuIdMgr.SystemSkuId, TAB_DEFAULT_STORES_DEFAULT, 
Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
 else:
 for SkuName in self.SkuIdMgr.SkuOverrideOrder():
-if SkuName not in Pcd.SkuOverrideValues:
+if SkuName not in self.SkuIdMgr.AvailableSkuIdSet:
 continue
 for DefaultStoreName in Pcd.SkuOverrideValues[SkuName]:
 CApp = CApp + '  Initialize_%s_%s_%s_%s();\n' % 
(SkuName, DefaultStoreName, Pcd.TokenSpaceGuidCName, Pcd.TokenCName)
-- 
2.14.1.windows.1

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


[edk2] [Patch v2] MdeModulePkg/Ip4Dxe: Sync the direct route entry setting.

2018-09-04 Thread Jiaxin Wu
v2: use "IP & Netmask" directly instead of defining an additional variable.

This patch is to sync the direct route entry setting in both the default
and Instance route table {Subnet, Mask, NextHope} (
https://bugzilla.tianocore.org/show_bug.cgi?id=1143).

Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
Reviewed-by: Ye Ting 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c |  7 ---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c| 10 +++---
 2 files changed, 7 insertions(+), 10 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index c19a72730e..b52542cd84 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -557,17 +557,10 @@ Ip4Config2SetDefaultAddr (
 return Status;
   }
 }
   }
 
-  Ip4AddRoute (
-IpSb->DefaultRouteTable,
-StationAddress,
-SubnetMask,
-IP4_ALLZERO_ADDRESS
-);
-
   //
   // Add a route for the connected network.
   //
   Subnet = StationAddress & SubnetMask;
 
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
index 6a26143e30..13ebeab1be 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Impl.c
@@ -670,14 +670,18 @@ Ip4ConfigProtocol (
 
   InsertTailList (>Interfaces, >Link);
 }
 
 //
-// Add a route to this connected network in the route table
+// Add a route to this connected network in the instance route table.
 //
-Ip4AddRoute (IpInstance->RouteTable, Ip, Netmask, IP4_ALLZERO_ADDRESS);
-
+Ip4AddRoute (
+  IpInstance->RouteTable, 
+  Ip & Netmask, 
+  Netmask, 
+  IP4_ALLZERO_ADDRESS
+  );
   } else {
 //
 // Use the default address. Check the state.
 //
 if (IpSb->State == IP4_SERVICE_UNSTARTED) {
-- 
2.17.1.windows.2

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


[edk2] [Patch] MdeModulePkg/Library/DxeHttpLib: Handle the blank value in HTTP header.

2018-09-04 Thread Jiaxin Wu
This patch is to resolve the lock-up issue if the value of HTTP header
is blank.  The issue is recorded @
https://bugzilla.tianocore.org/show_bug.cgi?id=1102.

Cc: Stephen Benjamin 
Cc: Laszlo Ersek 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Wu Jiaxin 
---
 MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c | 57 +++-
 1 file changed, 44 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c 
b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
index 5fbb50d03a..2fc3da8a2d 100644
--- a/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
+++ b/MdeModulePkg/Library/DxeHttpLib/DxeHttpLib.c
@@ -1595,63 +1595,94 @@ HttpGetFieldNameAndValue (
 return NULL;
   }
 
   //
   // Each header field consists of a name followed by a colon (":") and the 
field value.
+  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
+  //
+  // message-header = field-name ":" [ field-value ]
+  // field-name = token
+  // field-value = *( field-content | LWS )
+  //
+  // Note: "*(element)" allows any number element, including zero; 
"1*(element)" requires at least one element.
+  //   [element] means element is optional.
+  //   LWS  = [CRLF] 1*(SP|HT), it can be ' ' or '\t' or '\r\n ' or 
'\r\n\t'.
+  //   CRLF = '\r\n'.
+  //   SP   = ' '.
+  //   HT   = '\t' (Tab).
   //
   FieldNameStr = String;
   FieldValueStr = AsciiStrGetNextToken (FieldNameStr, ':');
   if (FieldValueStr == NULL) {
 return NULL;
   }
 
   //
-  // Replace ':' with 0
+  // Replace ':' with 0, then FieldName has been retrived from String.
   //
   *(FieldValueStr - 1) = 0;
 
   //
-  // The field value MAY be preceded by any amount of LWS, though a single SP 
is preferred.
-  // Note: LWS  = [CRLF] 1*(SP|HT), it can be '\r\n ' or '\r\n\t' or ' ' or 
'\t'.
-  //   CRLF = '\r\n'.
-  //   SP   = ' '.
-  //   HT   = '\t' (Tab).
+  // Handle FieldValueStr, skip all the preceded LWS.
   //
   while (TRUE) {
 if (*FieldValueStr == ' ' || *FieldValueStr == '\t') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 1) {
+//
+// Wrong String format!
+//
 return NULL;
   }
 
   FieldValueStr ++;
 } else if (*FieldValueStr == '\r') {
   //
   // Boundary condition check.
   //
   if ((UINTN) EndofHeader - (UINTN) FieldValueStr < 3) {
-return NULL;
+//
+// No more preceded LWS, so break here.
+//
+break;
   }
 
-  if (*(FieldValueStr + 1) == '\n' && (*(FieldValueStr + 2) == ' ' || 
*(FieldValueStr + 2) == '\t')) {
-FieldValueStr = FieldValueStr + 3;
+  if (*(FieldValueStr + 1) == '\n' ) {
+if (*(FieldValueStr + 2) == ' ' || *(FieldValueStr + 2) == '\t') {
+  FieldValueStr = FieldValueStr + 3;
+} else {
+  //
+  // No more preceded LWS, so break here.
+  //
+  break;
+}
+  } else {
+//
+// Wrong String format!
+//
+return NULL;
   }
 } else {
+  //
+  // No more preceded LWS, so break here.
+  //
   break;
 }
   }
 
-  //
-  // Header fields can be extended over multiple lines by preceding each extra
-  // line with at least one SP or HT.
-  //
   StrPtr = FieldValueStr;
   do {
+//
+// Handle the LWS within the field value.
+//
 StrPtr = AsciiStrGetNextToken (StrPtr, '\r');
 if (StrPtr == NULL || *StrPtr != '\n') {
+  //
+  // Wrong String format!
+  //
   return NULL;
 }
 
 StrPtr++;
   } while (*StrPtr == ' ' || *StrPtr == '\t');
-- 
2.17.1.windows.2

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


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

2018-09-04 Thread Yonghong Zhu
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] [PATCH] BaseTools: Check PcdNvStoreDefaultValueBuffer.

2018-09-04 Thread Zhaozh1x
Build tool should report warning if a platform
defines [DefaultStores] but forgets to defined
PcdNvStoreDefaultValueBuffer as PcdsDynamicExVpd in dsc file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: ZhiqiangX Zhao 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Cc: Bob Feng 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py| 7 ++-
 BaseTools/Source/Python/Workspace/BuildClassObject.py | 4 +++-
 BaseTools/Source/Python/Workspace/DscBuildData.py | 9 -
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index eb1b283889..61cefae5a5 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1452,7 +1452,10 @@ class PlatformAutoGen(AutoGen):
 for skuname in PcdNvStoreDfBuffer.SkuInfoList:
 PcdNvStoreDfBuffer.SkuInfoList[skuname].DefaultValue = 
vardump
 PcdNvStoreDfBuffer.MaxDatumSize = 
str(len(vardump.split(",")))
-
+else:
+#If the end user define [DefaultStores] and 
[XXX.Menufacturing] in DSC, but forget to configure 
PcdNvStoreDefaultValueBuffer to PcdsDynamicVpd
+if [Pcd for Pcd in self._DynamicPcdList if 
Pcd.UserDefinedDefaultStoresFlag]:
+EdkLogger.warn("build", "PcdNvStoreDefaultValueBuffer 
should be defined as PcdsDynamicExVpd in dsc file since the DefaultStores is 
enabled for this platform.\n%s" %self.Platform.MetaFile.Path)
 PlatformPcds = sorted(self._PlatformPcds.keys())
 #
 # Add VPD type PCD into VpdFile and determine whether the VPD PCD 
need to be fixed up.
@@ -2091,6 +2094,8 @@ class PlatformAutoGen(AutoGen):
 ToPcd.DatumType = FromPcd.DatumType
 if FromPcd.SkuInfoList:
 ToPcd.SkuInfoList = FromPcd.SkuInfoList
+if FromPcd.UserDefinedDefaultStoresFlag:
+ToPcd.UserDefinedDefaultStoresFlag = 
FromPcd.UserDefinedDefaultStoresFlag
 # Add Flexible PCD format parse
 if ToPcd.DefaultValue:
 try:
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index 88465c59ea..a5e0f4122e 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -41,7 +41,7 @@ import collections
 # @var Phase:To store value for Phase, default is "DXE"
 #
 class PcdClassObject(object):
-def __init__(self, Name = None, Guid = None, Type = None, DatumType = 
None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, 
IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], 
expressions = [], IsDsc = False):
+def __init__(self, Name = None, Guid = None, Type = None, DatumType = 
None, Value = None, Token = None, MaxDatumSize = None, SkuInfoList = {}, 
IsOverrided = False, GuidValue = None, validateranges = [], validlists = [], 
expressions = [], IsDsc = False, UserDefinedDefaultStoresFlag = False):
 self.TokenCName = Name
 self.TokenSpaceGuidCName = Guid
 self.TokenSpaceGuidValue = GuidValue
@@ -67,6 +67,7 @@ class PcdClassObject(object):
 self.PcdValueFromComm = ""
 self.PcdValueFromFdf = ""
 self.DefinitionPosition = ("","")
+self.UserDefinedDefaultStoresFlag = UserDefinedDefaultStoresFlag
 
 ## Get the maximum number of bytes
 def GetPcdMaxSize(self):
@@ -225,6 +226,7 @@ class StructurePcd(PcdClassObject):
 self.PcdValueFromComm = PcdObject.PcdValueFromComm if 
PcdObject.PcdValueFromComm else self.PcdValueFromComm
 self.PcdValueFromFdf = PcdObject.PcdValueFromFdf if 
PcdObject.PcdValueFromFdf else self.PcdValueFromFdf
 self.DefinitionPosition = PcdObject.DefinitionPosition if 
PcdObject.DefinitionPosition else self.DefinitionPosition
+self.UserDefinedDefaultStoresFlag = 
PcdObject.UserDefinedDefaultStoresFlag if 
PcdObject.UserDefinedDefaultStoresFlag else self.UserDefinedDefaultStoresFlag
 if isinstance(PcdObject, StructurePcd):
 self.StructuredPcdIncludeFile = PcdObject.StructuredPcdIncludeFile 
if PcdObject.StructuredPcdIncludeFile else self.StructuredPcdIncludeFile
 self.PackageDecs = PcdObject.PackageDecs if PcdObject.PackageDecs 
else self.PackageDecs
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 748452623f..69f6e33ee5 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -2517,6 +2517,7 @@ class DscBuildData(PlatformBuildClassObject):
 VariableAttrs = {}
 
 Pcds = OrderedDict()
+UserDefinedDefaultStores = []
 #
 # tdict is a special dict kind of type, 

Re: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg

2018-09-04 Thread Shia, Cinnamon
Hi Ray,

Thank you for the clarification. Your plan makes sense to me. I also found the 
information about Windows support for EmulatorPkg:
https://github.com/tianocore/tianocore.github.io/wiki/EmulatorPkg

Not sure the status should be changed or not.

UEFI architecture   Operating SystemStatus
IA32UnixFunctional
IA32Windows Not started
X64 UnixFunctional
X64 Windows Not started

Thanks,
Cinnamon Shia

-Original Message-
From: Ni, Ruiyu [mailto:ruiyu...@intel.com] 
Sent: Tuesday, September 4, 2018 10:32 AM
To: Shia, Cinnamon ; edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg

Shia,
This is my personal plan. But I need to:
1. make EmulatorPkg/Win be functionality equivalent to Nt32Pkg 2. All existing 
Nt32Pkg customers are happy to use EmulatorPkg/Win

Until then, I may remove Nt32Pkg.
Again, this is my personal plan, not an official decision.

Any comments?

> -Original Message-
> From: Shia, Cinnamon [mailto:cinnamon.s...@hpe.com]
> Sent: Thursday, August 30, 2018 9:58 AM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org
> Subject: RE: [edk2] [PATCH v2 00/12] Add WinHost support in 
> EmulatorPkg
> 
> Hi Ray,
> 
> Does this change mean that Nt32Pkg is going to be retired?
> 
> Thanks
> Cinnamon Shia
> 
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Ruiyu Ni
> Sent: Thursday, August 23, 2018 5:56 PM
> To: edk2-devel@lists.01.org
> Subject: [edk2] [PATCH v2 00/12] Add WinHost support in EmulatorPkg
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1112
> 
> The patch sets add WinHost support (Nt32) in EmulatorPkg.
> 3 EmulatorPkg common issues were found and fixed.
> Other 9 patches are to step-by-step enable the WinHost.
> 
> v2 sends to correct mail address.
> 
> Ruiyu Ni (12):
>   EmulatorPkg/ThunkProtocolList: Fix VS build failure
>   EmulatorPkg/Win: Add Windows host support
>   EmulatorPkg/Win: Enable source level debugging
>   EmulatorPkg/Win: Enable native OS console as firmware console
>   EmulatorPkg/Win: Add input/output support
>   EmulatorPkg/Win: Add timer and interrupt support
>   EmulatorPkg/Win: Add RTC support
>   EmulatorPkg/Win: Add SimpleFileSystem support
>   EmulatorPkg/Win: Add BlockIo support
>   EmulatorPkg/PlatformBds: Signal EndOfDxe in platform BDS
>   EmulatorPkg/EmuFileSystem: Fix a bug that causes Close() assertion
>   EmulatorPkg/DSC: Remove FS mapping to EDK Shell bin directory
> 
>  .../EmuSimpleFileSystemDxe/EmuSimpleFileSystem.c   |   33 +-
>  EmulatorPkg/EmulatorPkg.dsc|   17 +-
>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.c|4 +-
>  EmulatorPkg/Library/EmuBdsLib/BdsPlatform.h|4 +-
>  EmulatorPkg/Library/EmuBdsLib/EmuBdsLib.inf|5 +-
>  .../Library/ThunkProtocolList/ThunkProtocolList.c  |4 +-
>  EmulatorPkg/Win/Host/WinBlockIo.c  |  563 +
>  EmulatorPkg/Win/Host/WinFileSystem.c   | 2409
> 
>  EmulatorPkg/Win/Host/WinGop.h  |  204 ++
>  EmulatorPkg/Win/Host/WinGopInput.c |  417 
>  EmulatorPkg/Win/Host/WinGopScreen.c|  872 +++
>  EmulatorPkg/Win/Host/WinHost.c |  947 
>  EmulatorPkg/Win/Host/WinHost.h |  209 ++
>  EmulatorPkg/Win/Host/WinHost.inf   |  107 +
>  EmulatorPkg/Win/Host/WinInclude.h  |   75 +
>  EmulatorPkg/Win/Host/WinMemoryAllocationLib.c  |  178 ++
>  EmulatorPkg/Win/Host/WinThunk.c|  577 +
>  17 files changed, 6614 insertions(+), 11 deletions(-)  create mode 
> 100644 EmulatorPkg/Win/Host/WinBlockIo.c  create mode 100644 
> EmulatorPkg/Win/Host/WinFileSystem.c
>  create mode 100644 EmulatorPkg/Win/Host/WinGop.h  create mode 100644 
> EmulatorPkg/Win/Host/WinGopInput.c
>  create mode 100644 EmulatorPkg/Win/Host/WinGopScreen.c
>  create mode 100644 EmulatorPkg/Win/Host/WinHost.c  create mode 100644 
> EmulatorPkg/Win/Host/WinHost.h  create mode 100644 
> EmulatorPkg/Win/Host/WinHost.inf  create mode 100644 
> EmulatorPkg/Win/Host/WinInclude.h  create mode 100644 
> EmulatorPkg/Win/Host/WinMemoryAllocationLib.c
>  create mode 100644 EmulatorPkg/Win/Host/WinThunk.c
> 
> --
> 2.16.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


[edk2] [Patch] BaseTools: Structure Pcd value override incorrect.

2018-09-04 Thread BobCF
This patch is going to fix the issue that
The Pcd field value is override incorrectly when there
is no Pcd overall value assignment in Dsc file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py |  1 +
 .../Source/Python/Workspace/BuildClassObject.py|  2 +-
 BaseTools/Source/Python/Workspace/DscBuildData.py  | 54 --
 3 files changed, 31 insertions(+), 26 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 95370d1821..ac3cf7eef3 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1653,10 +1653,11 @@ class PlatformAutoGen(AutoGen):
 for (SkuName, SkuId) in allskuset:
 if type(SkuId) in (str, unicode) and eval(SkuId) == 0 or 
SkuId == 0:
 continue
 pcd.SkuInfoList[SkuName] = 
copy.deepcopy(pcd.SkuInfoList[TAB_DEFAULT])
 pcd.SkuInfoList[SkuName].SkuId = SkuId
+pcd.SkuInfoList[SkuName].SkuIdName = SkuName
 self.AllPcdList = self._NonDynamicPcdList + self._DynamicPcdList
 
 def FixVpdOffset(self, VpdFile ):
 FvPath = os.path.join(self.BuildDir, TAB_FV_DIRECTORY)
 if not os.path.exists(FvPath):
diff --git a/BaseTools/Source/Python/Workspace/BuildClassObject.py 
b/BaseTools/Source/Python/Workspace/BuildClassObject.py
index b2e5309a90..b0f3cde81a 100644
--- a/BaseTools/Source/Python/Workspace/BuildClassObject.py
+++ b/BaseTools/Source/Python/Workspace/BuildClassObject.py
@@ -59,11 +59,11 @@ class PcdClassObject(object):
 self.IsFromDsc = False
 self.validateranges = validateranges
 self.validlists = validlists
 self.expressions = expressions
 self.DscDefaultValue = None
-self.DscRawValue = None
+self.DscRawValue = {}
 if IsDsc:
 self.DscDefaultValue = Value
 self.PcdValueFromComm = ""
 self.PcdValueFromFdf = ""
 self.DefinitionPosition = ("","")
diff --git a/BaseTools/Source/Python/Workspace/DscBuildData.py 
b/BaseTools/Source/Python/Workspace/DscBuildData.py
index 7d6536c4b6..f2fff4d9fd 100644
--- a/BaseTools/Source/Python/Workspace/DscBuildData.py
+++ b/BaseTools/Source/Python/Workspace/DscBuildData.py
@@ -1403,11 +1403,11 @@ class DscBuildData(PlatformBuildClassObject):
 while nextskuid not in stru_pcd.SkuOverrideValues:
 if nextskuid == TAB_DEFAULT:
 NoDefault = True
 break
 nextskuid = self.SkuIdMgr.GetNextSkuId(nextskuid)
-stru_pcd.SkuOverrideValues[skuid] = 
copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else 
copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in 
DefaultStores} if DefaultStores else 
{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
+stru_pcd.SkuOverrideValues[skuid] = 
copy.deepcopy(stru_pcd.SkuOverrideValues[nextskuid]) if not NoDefault else 
copy.deepcopy({defaultstorename: stru_pcd.DefaultValues for defaultstorename in 
DefaultStores} if DefaultStores else {}) 
#{TAB_DEFAULT_STORES_DEFAULT:stru_pcd.DefaultValues})
 if not NoDefault:
 stru_pcd.ValueChain.add((skuid, ''))
 if stru_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]]:
 for skuid in SkuIds:
 nextskuid = skuid
@@ -1556,11 +1556,13 @@ class DscBuildData(PlatformBuildClassObject):
 {},
 False,
 None,
 IsDsc=True)
 
-
+if self.SkuIdMgr.SystemSkuId not in Pcds[PcdCName, 
TokenSpaceGuid].DscRawValue:
+Pcds[PcdCName, 
TokenSpaceGuid].DscRawValue[self.SkuIdMgr.SystemSkuId] = {}
+Pcds[PcdCName, 
TokenSpaceGuid].DscRawValue[self.SkuIdMgr.SystemSkuId][TAB_DEFAULT_STORES_DEFAULT]
 = PcdValue
 return Pcds
 
 def GetStructurePcdMaxSize(self, str_pcd):
 pcd_default_value = str_pcd.DefaultValue
 sku_values = [skuobj.HiiDefaultValue if str_pcd.Type in 
[self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_HII], 
self._PCD_TYPE_STRING_[MODEL_PCD_DYNAMIC_EX_HII]] else skuobj.DefaultValue for 
skuobj in str_pcd.SkuInfoList.values()]
@@ -1788,15 +1790,12 @@ class DscBuildData(PlatformBuildClassObject):
 CApp = CApp + '  CHAR8   *Value;\n'
 
 CApp = CApp + "// SkuName: %s,  DefaultStoreName: %s \n" % 
(TAB_DEFAULT, TAB_DEFAULT_STORES_DEFAULT)
 inherit_OverrideValues = Pcd.SkuOverrideValues[SkuName]
 if (SkuName,