Re: [edk2] [Patch 0/2] BaseTools tools_def.txt: Update GCC ASLPP_FLAGS

2016-11-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 Liming 
Gao
Sent: Monday, November 14, 2016 2:37 PM
To: edk2-devel@lists.01.org
Subject: [edk2] [Patch 0/2] BaseTools tools_def.txt: Update GCC ASLPP_FLAGS

Update GCC ASLPP_FLAGS to align to VS ASLPP_FLAGS so that the same ASL file can 
support GCC and VS tool chains both. 

Liming Gao (2):
  BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGS
  BaseTools tools_def.txt: Include AutoGen.h in GCC ASLPP_FLAGS

 BaseTools/Conf/tools_def.template | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

--
2.8.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 v2] BaseTools/Scripts: Add BinToPcd utility

2016-11-13 Thread Zhu, Yonghong

Reviewed-by: Yonghong Zhu  

Best Regards,
Zhu Yonghong

-Original Message-
From: Kinney, Michael D 
Sent: Monday, November 14, 2016 11:49 AM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong ; Gao, Liming 
Subject: [Patch v2] BaseTools/Scripts: Add BinToPcd utility

Add a utility that converts a binary file into a VOID* PCD value or a full DSC 
file VOID* PCD statement with support for all the DSC supported PCD sections.

usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME]
[-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME]
[-g VARIABLEGUID] [-v] [-q] [--debug [0-9]]

Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
Copyright (c) 2016, Intel Corporation. All rights reserved.

optional arguments:
  -h, --helpshow this help message and exit
  --version show program's version number and exit
  -i INPUTFILE, --input INPUTFILE
Input binary filename
  -o OUTPUTFILE, --output OUTPUTFILE
Output filename for PCD value or PCD statement
  -p PCDNAME, --pcd PCDNAME
Name of the PCD in the form
.
  -t {VPD,HII}, --type {VPD,HII}
PCD statement type (HII or VPD). Default is standard.
  -m MAXSIZE, --max-size MAXSIZE
Maximum size of the PCD. Only used with --type VPD.
  -f OFFSET, --offset OFFSET
VPD offset if --type is VPD. UEFI Variable offset if
--type is HII.
  -n VARIABLENAME, --variable-name VARIABLENAME
UEFI variable name. Only used with --type HII.
  -g VARIABLEGUID, --variable-guid VARIABLEGUID
UEFI variable GUID C name. Only used with --type HII.
  -v, --verbose Increase output messages
  -q, --quiet   Reduce output messages
  --debug [0-9] Set debug level

This utility can be used in PCD value mode to convert a binary file into a 
string that can then be copied into the PCD value field of a VOID* PCD.  The 
following is an example of PCD value mode on an 8 byte test.bin file.

  BinToPcd.py -i test.bin

  {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

The DSC file VOID* PCD statement mode can be used to generate a complete PCD 
statement for the PCD section types that a DSC file
supports:

  [PcdsFixedAtBuild]
  [PcdsPatchableInModule]
  [PcdsDynamicDefault]
  [PcdsDynamicExDefault]
  [PcdsDynamicVpd]
  [PcdsDynamicExVpd]
  [PcdsDynamicHii]
  [PcdsDynamicExHii]

The PCD statement mode is useful when combined with a !include statement in a 
DSC file.  BinToPcd.py can be used to convert a binary file to a PCD statement 
in an output file, and that output file can be included into a DSC file in the 
matching PCD section to set the value of the PCD to the value from the binary 
file without having to copy the value into the DSC file.  Updates can be made 
to the included file without editing the DSC file.  Some example use cases are 
the setting the public key PCDs such as:

  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer
  gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer

The following example converts a public key binary file to a [PcdsFixedAtBuild] 
compatible PCD statement:

  BinToPcd.py -i PublicKey.bin -o PublicKey.pcd
--pcd gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBufferkenSpaceGuid

The PublicKey.pcd output file contains a single line:

  gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x48, ...}

A DSC file can be updated to include the PublicKey.pcd file:

  [PcdsFixedAtBuild]
  !include PublicKey.pcd

Value examples
===
  BinToPcd.py -i test.bin
{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

Normal examples:
=
  BinToPcd.py -i test.bin -p Guid.Token
Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -m 20
Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}|VOID*|20

VPD examples:
=
  BinToPcd.py -i test.bin -p Guid.Token -t VPD
Guid.Name|*|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20
Guid.Name|20|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -m 10
Guid.Name|*|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 -m 10
Guid.Name|20|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

HII examples:
=
  BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName
Guid.Name|L"VarName"|VarGuid|0|{0x48, 0x65, 0x6c, 0x6c}

  BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName -f 8
Guid.Name|L"VarName"|VarGuid|8|{0x48, 0x65, 0x6c, 0x6c}

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0

Re: [edk2] [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet check

2016-11-13 Thread Ye, Ting
Sounds good. 
Reviewed-by: Ye Ting  

Thanks,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Monday, November 14, 2016 3:01 PM
To: Ye, Ting ; edk2-devel@lists.01.org
Cc: Santhapur Naveen ; Laszlo Ersek 
; Fu, Siyuan 
Subject: RE: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet check

Hi Ting,

Thanks for catch.  Item 2 should be: * Replace IP4_MASK_MAX with IP4_MASK_NUM.
Item 3 is part of patch 2/2.

I will correct it when I commit the patch.

Thanks
Jiaxin.

> -Original Message-
> From: Ye, Ting
> Sent: Monday, November 14, 2016 2:52 PM
> To: Wu, Jiaxin ; edk2-devel@lists.01.org
> Cc: Santhapur Naveen ; Laszlo Ersek 
> ; Fu, Siyuan 
> Subject: RE: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid 
> subnet check
> 
> Hi Jiaxin,
> 
> It looks the check-in log is incorrect.
>  -- Any typo in item 2?
> -- Is item 3 part of  patch 2/2?
> 
> Please double check, thanks.
> 
> Best Regards,
> Ting
> 
> -Original Message-
> From: Wu, Jiaxin
> Sent: Friday, November 11, 2016 1:19 PM
> To: edk2-devel@lists.01.org
> Cc: Santhapur Naveen ; Laszlo Ersek 
> ; Ye, Ting ; Fu, Siyuan 
> 
> Subject: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet 
> check
> 
> v2:
> * Separate out the return status fix.
> * Replace IP4_MASK_MAX with IP4_MASK_MAX.
> * Remove the ON_EXIT label.
> 
> This patch is used to add the wrong/invalid subnet check.
> 
> Cc: Santhapur Naveen 
> Cc: Laszlo Ersek 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 
> ---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 10 +++---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  |  8 +---
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> index a931bb3..5b01b35 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> @@ -1253,10 +1253,17 @@ Ip4Config2SetMaunualAddress (
>  return EFI_WRITE_PROTECTED;
>}
> 
>NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *) Data);
> 
> +  StationAddress = EFI_NTOHL (NewAddress.Address);  SubnetMask = 
> + EFI_NTOHL (NewAddress.SubnetMask);
> +
> +  if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
>//
>// Store the new data, and init the DataItem status to 
> EFI_NOT_READY because
>// we may have an asynchronous configuration process.
>//
>Ptr = AllocateCopyPool (DataSize, Data); @@ -1271,13 +1278,10 @@ 
> Ip4Config2SetMaunualAddress (
> 
>DataItem->Data.Ptr = Ptr;
>DataItem->DataSize = DataSize;
>DataItem->Status   = EFI_NOT_READY;
> 
> -  StationAddress = EFI_NTOHL (NewAddress.Address);
> -  SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);
> -
>IpSb->Reconfig = TRUE;
>Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);
>if (EFI_ERROR (Status)) {
>  goto ON_EXIT;
>}
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> index 9cd5dd5..b0cc6a3 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> @@ -562,10 +562,15 @@ Ip4SetAddress (
>EFI_STATUSStatus;
>INTN  Len;
> 
>NET_CHECK_SIGNATURE (Interface, IP4_INTERFACE_SIGNATURE);
> 
> +  Len = NetGetMaskLength (SubnetMask);  if (Len == IP4_MASK_NUM) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
>//
>// Set the ip/netmask, then compute the subnet broadcast
>// and network broadcast for easy access. When computing
>// nework broadcast, the subnet mask is most like longer
>// than the default netmask (not subneted) as defined in @@ -573,13 
> +578,10 @@ Ip4SetAddress (
>// networks, use the subnet's mask instead.
>//
>Interface->Ip = IpAddr;
>Interface->SubnetMask = SubnetMask;
>Interface->SubnetBrdcast  = (IpAddr | ~SubnetMask);
> -
> -  Len   = NetGetMaskLength (SubnetMask);
> -  ASSERT (Len <= IP4_MASK_MAX);
>Interface->NetBrdcast = (IpAddr | ~SubnetMask);
> 
>//
>// Do clean up for Arp child
>//
> --
> 1.9.5.msysgit.1

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


Re: [edk2] [PATCH V2] IntelSiliconPkg: Add PCD for Graphics VBT FFS GUID

2016-11-13 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> -Original Message-
> From: Mudusuru, Giri P
> Sent: Monday, November 14, 2016 2:33 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Zeng, Star 
> Subject: [edk2][PATCH V2] IntelSiliconPkg: Add PCD for Graphics VBT FFS
> GUID
> 
> Added PCD PcdIntelGraphicsVbtFileGuid to store raw format
> Graphics Video BIOS Table (VBT) in FFS.
> 
> Cc: Jiewen Yao 
> Cc: Star Zeng 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Giri P Mudusuru 
> ---
>  IntelSiliconPkg/IntelSiliconPkg.dec | 12 
>  1 file changed, 12 insertions(+)
> 
> diff --git a/IntelSiliconPkg/IntelSiliconPkg.dec
> b/IntelSiliconPkg/IntelSiliconPkg.dec
> index 84b0764..4a51d0a 100644
> --- a/IntelSiliconPkg/IntelSiliconPkg.dec
> +++ b/IntelSiliconPkg/IntelSiliconPkg.dec
> @@ -24,8 +24,20 @@
>Include
> 
>  [Guids]
> +  ## GUID for Package token space
> +  # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
> +  gIntelSiliconPkgTokenSpaceGuid  = { 0xa9f8d54e, 0x1107, 0x4f0a,
> { 0xad, 0xd0, 0x45, 0x87, 0xe7, 0xa4, 0xa7, 0x35 } };
> +
>## HOB GUID to publish SMBIOS data records from PEI phase
># HOB data format is same as SMBIOS records defined in SMBIOS spec or
> OEM defined types
># Generic DXE Library / Driver can locate HOB(s) and add SMBIOS records
> into SMBIOS table
>gIntelSmbiosDataHobGuid = { 0x798e722e, 0x15b2, 0x4e13,
> { 0x8a, 0xe9, 0x6b, 0xa3, 0x0f, 0xf7, 0xf1, 0x67 }}
> 
> +[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
> +  ## This is the GUID of the FFS which contains the Graphics Video BIOS
> Table (VBT)
> +  # The VBT content is stored as a RAW section which is consumed by GOP
> PEI/UEFI driver.
> +  # The default GUID can be updated by patching or runtime if platform
> support multiple VBT configurations.
> +  # @Prompt GUID of the FFS which contains the Graphics Video BIOS
> Table (VBT)
> +  # { 0x56752da9, 0xde6b, 0x4895, 0x88, 0x19, 0x19, 0x45, 0xb6, 0xb7,
> 0x6c, 0x22 }
> +  gIntelSiliconPkgTokenSpaceGuid.PcdIntelGraphicsVbtFileGuid|{ 0xa9,
> 0x2d, 0x75, 0x56, 0x6b, 0xde, 0x95, 0x48, 0x88, 0x19, 0x19, 0x45, 0xb6,
> 0xb7, 0x6c, 0x22 }|VOID*|0x0001
> +
> --
> 2.9.0.windows.1

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


Re: [edk2] [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet check

2016-11-13 Thread Wu, Jiaxin
Hi Ting,

Thanks for catch.  Item 2 should be: * Replace IP4_MASK_MAX with IP4_MASK_NUM.
Item 3 is part of patch 2/2.

I will correct it when I commit the patch.

Thanks
Jiaxin.

> -Original Message-
> From: Ye, Ting
> Sent: Monday, November 14, 2016 2:52 PM
> To: Wu, Jiaxin ; edk2-devel@lists.01.org
> Cc: Santhapur Naveen ; Laszlo Ersek
> ; Fu, Siyuan 
> Subject: RE: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet
> check
> 
> Hi Jiaxin,
> 
> It looks the check-in log is incorrect.
>  -- Any typo in item 2?
> -- Is item 3 part of  patch 2/2?
> 
> Please double check, thanks.
> 
> Best Regards,
> Ting
> 
> -Original Message-
> From: Wu, Jiaxin
> Sent: Friday, November 11, 2016 1:19 PM
> To: edk2-devel@lists.01.org
> Cc: Santhapur Naveen ; Laszlo Ersek
> ; Ye, Ting ; Fu, Siyuan
> 
> Subject: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet
> check
> 
> v2:
> * Separate out the return status fix.
> * Replace IP4_MASK_MAX with IP4_MASK_MAX.
> * Remove the ON_EXIT label.
> 
> This patch is used to add the wrong/invalid subnet check.
> 
> Cc: Santhapur Naveen 
> Cc: Laszlo Ersek 
> Cc: Ye Ting 
> Cc: Fu Siyuan 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Jiaxin Wu 
> ---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 10 +++---
>  MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  |  8 +---
>  2 files changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> index a931bb3..5b01b35 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
> @@ -1253,10 +1253,17 @@ Ip4Config2SetMaunualAddress (
>  return EFI_WRITE_PROTECTED;
>}
> 
>NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *) Data);
> 
> +  StationAddress = EFI_NTOHL (NewAddress.Address);  SubnetMask =
> + EFI_NTOHL (NewAddress.SubnetMask);
> +
> +  if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
>//
>// Store the new data, and init the DataItem status to EFI_NOT_READY
> because
>// we may have an asynchronous configuration process.
>//
>Ptr = AllocateCopyPool (DataSize, Data); @@ -1271,13 +1278,10 @@
> Ip4Config2SetMaunualAddress (
> 
>DataItem->Data.Ptr = Ptr;
>DataItem->DataSize = DataSize;
>DataItem->Status   = EFI_NOT_READY;
> 
> -  StationAddress = EFI_NTOHL (NewAddress.Address);
> -  SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);
> -
>IpSb->Reconfig = TRUE;
>Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);
>if (EFI_ERROR (Status)) {
>  goto ON_EXIT;
>}
> diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> index 9cd5dd5..b0cc6a3 100644
> --- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> +++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
> @@ -562,10 +562,15 @@ Ip4SetAddress (
>EFI_STATUSStatus;
>INTN  Len;
> 
>NET_CHECK_SIGNATURE (Interface, IP4_INTERFACE_SIGNATURE);
> 
> +  Len = NetGetMaskLength (SubnetMask);
> +  if (Len == IP4_MASK_NUM) {
> +return EFI_INVALID_PARAMETER;
> +  }
> +
>//
>// Set the ip/netmask, then compute the subnet broadcast
>// and network broadcast for easy access. When computing
>// nework broadcast, the subnet mask is most like longer
>// than the default netmask (not subneted) as defined in @@ -573,13 +578,10
> @@ Ip4SetAddress (
>// networks, use the subnet's mask instead.
>//
>Interface->Ip = IpAddr;
>Interface->SubnetMask = SubnetMask;
>Interface->SubnetBrdcast  = (IpAddr | ~SubnetMask);
> -
> -  Len   = NetGetMaskLength (SubnetMask);
> -  ASSERT (Len <= IP4_MASK_MAX);
>Interface->NetBrdcast = (IpAddr | ~SubnetMask);
> 
>//
>// Do clean up for Arp child
>//
> --
> 1.9.5.msysgit.1

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


Re: [edk2] [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet check

2016-11-13 Thread Ye, Ting
Hi Jiaxin,

It looks the check-in log is incorrect. 
 -- Any typo in item 2?
-- Is item 3 part of  patch 2/2? 

Please double check, thanks.

Best Regards,
Ting

-Original Message-
From: Wu, Jiaxin 
Sent: Friday, November 11, 2016 1:19 PM
To: edk2-devel@lists.01.org
Cc: Santhapur Naveen ; Laszlo Ersek 
; Ye, Ting ; Fu, Siyuan 

Subject: [PATCH v2 1/2] MdeModulePkg/Ip4Dxe: Add wrong/invalid subnet check

v2:
* Separate out the return status fix.
* Replace IP4_MASK_MAX with IP4_MASK_MAX.
* Remove the ON_EXIT label.

This patch is used to add the wrong/invalid subnet check.

Cc: Santhapur Naveen 
Cc: Laszlo Ersek 
Cc: Ye Ting 
Cc: Fu Siyuan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiaxin Wu 
---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c | 10 +++---
 MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c  |  8 +---
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
index a931bb3..5b01b35 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4Config2Impl.c
@@ -1253,10 +1253,17 @@ Ip4Config2SetMaunualAddress (
 return EFI_WRITE_PROTECTED;
   }
 
   NewAddress = *((EFI_IP4_CONFIG2_MANUAL_ADDRESS *) Data);
 
+  StationAddress = EFI_NTOHL (NewAddress.Address);  SubnetMask = 
+ EFI_NTOHL (NewAddress.SubnetMask);
+
+  if (NetGetMaskLength (SubnetMask) == IP4_MASK_NUM) {
+return EFI_INVALID_PARAMETER;
+  }
+
   //
   // Store the new data, and init the DataItem status to EFI_NOT_READY because
   // we may have an asynchronous configuration process.
   //
   Ptr = AllocateCopyPool (DataSize, Data); @@ -1271,13 +1278,10 @@ 
Ip4Config2SetMaunualAddress (
   
   DataItem->Data.Ptr = Ptr;
   DataItem->DataSize = DataSize;
   DataItem->Status   = EFI_NOT_READY;
 
-  StationAddress = EFI_NTOHL (NewAddress.Address);
-  SubnetMask = EFI_NTOHL (NewAddress.SubnetMask);
-
   IpSb->Reconfig = TRUE;
   Status = Ip4Config2SetDefaultAddr (IpSb, StationAddress, SubnetMask);
   if (EFI_ERROR (Status)) {
 goto ON_EXIT;
   }
diff --git a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c 
b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
index 9cd5dd5..b0cc6a3 100644
--- a/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
+++ b/MdeModulePkg/Universal/Network/Ip4Dxe/Ip4If.c
@@ -562,10 +562,15 @@ Ip4SetAddress (
   EFI_STATUSStatus;
   INTN  Len;
 
   NET_CHECK_SIGNATURE (Interface, IP4_INTERFACE_SIGNATURE);
 
+  Len = NetGetMaskLength (SubnetMask);
+  if (Len == IP4_MASK_NUM) {
+return EFI_INVALID_PARAMETER;
+  }
+
   //
   // Set the ip/netmask, then compute the subnet broadcast
   // and network broadcast for easy access. When computing
   // nework broadcast, the subnet mask is most like longer
   // than the default netmask (not subneted) as defined in @@ -573,13 +578,10 
@@ Ip4SetAddress (
   // networks, use the subnet's mask instead.
   //
   Interface->Ip = IpAddr;
   Interface->SubnetMask = SubnetMask;
   Interface->SubnetBrdcast  = (IpAddr | ~SubnetMask);
-
-  Len   = NetGetMaskLength (SubnetMask);
-  ASSERT (Len <= IP4_MASK_MAX);
   Interface->NetBrdcast = (IpAddr | ~SubnetMask);
 
   //
   // Do clean up for Arp child
   //
--
1.9.5.msysgit.1

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


[edk2] [Patch 0/2] BaseTools tools_def.txt: Update GCC ASLPP_FLAGS

2016-11-13 Thread Liming Gao
Update GCC ASLPP_FLAGS to align to VS ASLPP_FLAGS so that the same ASL file
can support GCC and VS tool chains both. 

Liming Gao (2):
  BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGS
  BaseTools tools_def.txt: Include AutoGen.h in GCC ASLPP_FLAGS

 BaseTools/Conf/tools_def.template | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

-- 
2.8.0.windows.1

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


[edk2] [Patch 2/2] BaseTools tools_def.txt: Include AutoGen.h in GCC ASLPP_FLAGS

2016-11-13 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=227
Refer to VS ASLPP_FLAGS, force include AutoGen.h so that ASL code
can use FixedPcdGetXX to get FixedPcd value.

Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 BaseTools/Conf/tools_def.template | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index fd56ff3..aaae4fc 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4359,7 +4359,7 @@ DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym 
memcpy=CopyMem
 DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
 DEFINE GCC_PP_FLAGS= -E -x assembler-with-cpp -include 
$(DEST_DIR_DEBUG)/AutoGen.h
 DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
-DEFINE GCC_ASLPP_FLAGS = -x c -E
+DEFINE GCC_ASLPP_FLAGS = -x c -E -include AutoGen.h
 DEFINE GCC_ASLCC_FLAGS = -x c
 DEFINE GCC_WINDRES_FLAGS   = -J rc -O coff
 DEFINE GCC_IA32_RC_FLAGS   = -I binary -O elf32-i386  -B i386  
  --rename-section .data=.hii
@@ -5804,7 +5804,7 @@ RELEASE_CLANG38_X64_CC_FLAGS   = 
DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__
 *_ELFGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
 *_ELFGCC_*_ASL_FLAGS= DEF(IASL_FLAGS)
 *_ELFGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-*_ELFGCC_*_ASLPP_FLAGS  = -x c -E
+*_ELFGCC_*_ASLPP_FLAGS  = -x c -E -include AutoGen.h
 *_ELFGCC_*_ASLCC_FLAGS  = -x c
 *_ELFGCC_*_ASLDLINK_FLAGS   = DEF(GCC_DLINK_FLAGS_COMMON) --entry 
_ReferenceAcpiTable
 
@@ -7285,7 +7285,7 @@ RELEASE_XCODE32_IA32_CC_FLAGS   = -arch i386 -Oz -combine 
-mms-bitfields  -fshor
 
 *_XCODE32_IA32_ASLCC_FLAGS  = -arch i386 -x c -save-temps -g -O0 
-mms-bitfields -fshort-wchar -fno-strict-aliasing -Wall -Werror 
-Wno-missing-braces -c -include AutoGen.h -mdynamic-no-pic
 *_XCODE32_IA32_ASLDLINK_FLAGS   = -arch i386 -e _main -preload -segalign 0x20  
-pie -seg1addr 0x220 -read_only_relocs suppress -map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-*_XCODE32_IA32_ASLPP_FLAGS  = -arch i386 -x c -E
+*_XCODE32_IA32_ASLPP_FLAGS  = -arch i386 -x c -E -include AutoGen.h
 *_XCODE32_IA32_ASL_FLAGS=
 
 ##
@@ -7408,7 +7408,7 @@ RELEASE_XCLANG_X64_ASM_FLAGS  = -arch x86_64
 RELEASE_XCLANG_X64_CC_FLAGS   = -ccc-host-triple x86_64-pc-win32-macho -c
-Os  -Wall -Werror -include AutoGen.h -fno-stack-protector -fno-builtin 
-fshort-wchar -mdynamic-no-pic -Wno-empty-body -Wno-pointer-sign 
-Wno-unused-function -Wno-unused-value -Wno-missing-braces 
-Wno-tautological-compare -Wreturn-type -Wno-unused-variable 
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang
 *_XCLANG_*_ASLCC_FLAGS  = -x c -save-temps -g -O0 -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h 
-mdynamic-no-pic
 *_XCLANG_*_ASLDLINK_FLAGS   = -e _main -preload -segalign 0x20  -pie -seg1addr 
0x240 -read_only_relocs suppress -map $(DEST_DIR_DEBUG)/$(BASE_NAME).map
-*_XCLANG_*_ASLPP_FLAGS  = -x c -E 
+*_XCLANG_*_ASLPP_FLAGS  = -x c -E -include AutoGen.h
 *_XCLANG_*_ASL_FLAGS=
 
 #
@@ -7484,7 +7484,7 @@ RELEASE_XCODE5_X64_CC_FLAGS   = -target 
x86_64-pc-win32-macho -c-Os   -W
 
 *_XCODE5_*_ASLCC_FLAGS  = -x c -save-temps -g -O0 -fshort-wchar 
-fno-strict-aliasing -Wall -Werror -Wno-missing-braces -c -include AutoGen.h 
 *_XCODE5_*_ASLDLINK_FLAGS   = -e _ReferenceAcpiTable -preload -segalign 0x20  
-pie -seg1addr 0x240 -read_only_relocs suppress -map 
$(DEST_DIR_DEBUG)/$(BASE_NAME).map
-*_XCODE5_*_ASLPP_FLAGS  = -x c -E 
+*_XCODE5_*_ASLPP_FLAGS  = -x c -E -include AutoGen.h
 *_XCODE5_*_ASL_FLAGS=
 *_XCODE5_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
 
-- 
2.8.0.windows.1

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


[edk2] [Patch 1/2] BaseTools tools_def.txt: Remove -P option in GCC ASLPP_FLAGS

2016-11-13 Thread Liming Gao
https://bugzilla.tianocore.org/show_bug.cgi?id=227

After -P option is removed, the generated preprocessed ASL file will have
line markers. The extra information can be removed by Trim script. ASL code
can refer to the definition in C source file. This has been supported in
VS and XCODE tool chains.

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

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 39fda78..fd56ff3 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4359,7 +4359,7 @@ DEFINE GCC_IPF_SYMRENAME_FLAGS = --redefine-sym 
memcpy=CopyMem
 DEFINE GCC_ASM_FLAGS   = -c -x assembler -imacros 
$(DEST_DIR_DEBUG)/AutoGen.h
 DEFINE GCC_PP_FLAGS= -E -x assembler-with-cpp -include 
$(DEST_DIR_DEBUG)/AutoGen.h
 DEFINE GCC_VFRPP_FLAGS = -x c -E -P -DVFRCOMPILE --include 
$(DEST_DIR_DEBUG)/$(MODULE_NAME)StrDefs.h
-DEFINE GCC_ASLPP_FLAGS = -x c -E -P
+DEFINE GCC_ASLPP_FLAGS = -x c -E
 DEFINE GCC_ASLCC_FLAGS = -x c
 DEFINE GCC_WINDRES_FLAGS   = -J rc -O coff
 DEFINE GCC_IA32_RC_FLAGS   = -I binary -O elf32-i386  -B i386  
  --rename-section .data=.hii
@@ -5804,7 +5804,7 @@ RELEASE_CLANG38_X64_CC_FLAGS   = 
DEF(CLANG38_ALL_CC_FLAGS) -m64 "-DEFIAPI=__
 *_ELFGCC_*_ASL_PATH = DEF(UNIX_IASL_BIN)
 *_ELFGCC_*_ASL_FLAGS= DEF(IASL_FLAGS)
 *_ELFGCC_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-*_ELFGCC_*_ASLPP_FLAGS  = -x c -E -P
+*_ELFGCC_*_ASLPP_FLAGS  = -x c -E
 *_ELFGCC_*_ASLCC_FLAGS  = -x c
 *_ELFGCC_*_ASLDLINK_FLAGS   = DEF(GCC_DLINK_FLAGS_COMMON) --entry 
_ReferenceAcpiTable
 
-- 
2.8.0.windows.1

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


[edk2] [PATCH V2] IntelSiliconPkg: Add PCD for Graphics VBT FFS GUID

2016-11-13 Thread Giri P Mudusuru
Added PCD PcdIntelGraphicsVbtFileGuid to store raw format
Graphics Video BIOS Table (VBT) in FFS.

Cc: Jiewen Yao 
Cc: Star Zeng 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Giri P Mudusuru 
---
 IntelSiliconPkg/IntelSiliconPkg.dec | 12 
 1 file changed, 12 insertions(+)

diff --git a/IntelSiliconPkg/IntelSiliconPkg.dec 
b/IntelSiliconPkg/IntelSiliconPkg.dec
index 84b0764..4a51d0a 100644
--- a/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -24,8 +24,20 @@
   Include
 
 [Guids]
+  ## GUID for Package token space
+  # {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
+  gIntelSiliconPkgTokenSpaceGuid  = { 0xa9f8d54e, 0x1107, 0x4f0a, { 0xad, 
0xd0, 0x45, 0x87, 0xe7, 0xa4, 0xa7, 0x35 } };
+
   ## HOB GUID to publish SMBIOS data records from PEI phase
   # HOB data format is same as SMBIOS records defined in SMBIOS spec or OEM 
defined types
   # Generic DXE Library / Driver can locate HOB(s) and add SMBIOS records into 
SMBIOS table
   gIntelSmbiosDataHobGuid = { 0x798e722e, 0x15b2, 0x4e13, { 0x8a, 
0xe9, 0x6b, 0xa3, 0x0f, 0xf7, 0xf1, 0x67 }}
 
+[PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx]
+  ## This is the GUID of the FFS which contains the Graphics Video BIOS Table 
(VBT)
+  # The VBT content is stored as a RAW section which is consumed by GOP 
PEI/UEFI driver.
+  # The default GUID can be updated by patching or runtime if platform support 
multiple VBT configurations.
+  # @Prompt GUID of the FFS which contains the Graphics Video BIOS Table (VBT)
+  # { 0x56752da9, 0xde6b, 0x4895, 0x88, 0x19, 0x19, 0x45, 0xb6, 0xb7, 0x6c, 
0x22 }
+  gIntelSiliconPkgTokenSpaceGuid.PcdIntelGraphicsVbtFileGuid|{ 0xa9, 0x2d, 
0x75, 0x56, 0x6b, 0xde, 0x95, 0x48, 0x88, 0x19, 0x19, 0x45, 0xb6, 0xb7, 0x6c, 
0x22 }|VOID*|0x0001
+
-- 
2.9.0.windows.1

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


Re: [edk2] [PATCH 29/33] SecurityPkg: Fix typos in comments

2016-11-13 Thread Gao, Liming
Lin:
  We don't plan to clean up all existing codes with EDKII DEBUG_ macros. We 
expect DEBUG_ macro will be applied with other change together. So, I propose 
to add this check in PatchCheck.py script. You only need to update your changed 
lines.  

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Gary Lin
> Sent: Monday, November 14, 2016 12:04 PM
> To: Zhang, Chao B 
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH 29/33] SecurityPkg: Fix typos in comments
> 
> On Mon, Nov 14, 2016 at 03:12:16AM +, Zhang, Chao B wrote:
> > Hi Gary:
> >   I see some warnings while running PatchChecy.py with this patch.
> > Please help to update the patch, run PatchCheck.py(BaseTools/Scripts) &
> re-send the patch.
> >
> 
> Hi Chao,
> 
> PatchCheck.py showed this:
> 
> The commit message format passed all checks.
> Code format is not valid:
>  * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
>File: SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
>Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured.
> Error!\n"));
>  * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
>File: SecurityPkg/Tcg/TcgDxe/TcgDxe.c
>Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured.
> Error!\n"));
>  * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
>File: SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
>Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured.
> Error!\n"));
> 
> My patch only fixes typos (Seperator -> Separator) and I tried to avoid any
> functional change. I found that EFI_D_ERROR is widely used in SecurityPkg
> and
> it'd be better to convert all EFI_D_ERROR into DEBUG_ERROR in another
> patch.
> What do you think?
> 
> Cheers,
> 
> Gary Lin
> 
> >
> >
> >
> >
> > Thanks & Best regards
> > Chao Zhang
> >
> >
> > -Original Message-
> > From: Gary Lin [mailto:g...@suse.com]
> > Sent: Wednesday, October 19, 2016 3:02 PM
> > To: edk2-devel@lists.01.org
> > Cc: Zhang, Chao B
> > Subject: [PATCH 29/33] SecurityPkg: Fix typos in comments
> >
> > - intialized -> initialized
> > - TURE -> TRUE
> > - successull -> successfully
> > - hanlder -> handler
> > - funciton -> function
> > - Seperator -> Separator
> > - Sumbit -> Submit
> >
> > Cc: Chao Zhang 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Gary Lin 
> > ---
> >  SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> | 2 +-
> >  SecurityPkg/Include/Library/TcgPpVendorLib.h
> | 4 ++--
> >  SecurityPkg/Include/Library/TcgStorageOpalLib.h
> | 2 +-
> >  SecurityPkg/Include/Library/TrEEPpVendorLib.h
> | 4 ++--
> >  SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c
> | 6 +++---
> >
> SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048
> Sha256GuidedSectionExtractLib.c | 2 +-
> >
> SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048S
> ha256GuidedSectionExtractLib.c | 2 +-
> >  SecurityPkg/Library/TcgStorageCoreLib/TcgStorageUtil.c
> | 2 +-
> >  SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c
> | 2 +-
> >  SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
> | 2 +-
> >  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c  
> >| 2
> +-
> >  SecurityPkg/Tcg/TcgDxe/TcgDxe.c
> >| 2 +-
> >  SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c  
> >| 2
> +-
> >
> SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolic
> y.c   | 2 +-
> >
> SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManage
> r.h | 2 +-
> >  15 files changed, 19 insertions(+), 19 deletions(-)
> >
> > diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> > index ab34de7..93e3273 100644
> > --- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> > +++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> > @@ -64,7 +64,7 @@ BOOLEAN
> >
> >This function performs Hash digest on a data buffer of the specified 
> > size.
> >It can be called multiple times to compute the digest of long or
> discontinuous data streams.
> > -  Hash context should be already correctly intialized by HashInit(), and
> should not be finalized
> > +  Hash context should be already correctly initialized by HashInit(), and
> should not be finalized
> >by HashFinal(). Behavior with invalid context is undefined.
> >
> >If HashContext is NULL, then return FALSE.
> > diff --git a/SecurityPkg/Include/Library/TcgPpVendorLib.h
> b/SecurityPkg/Include/Library/TcgPpVendorLib.h
> > index 08b3690..284aa9e 100644
> > --- a/SecurityPkg/Include/Library/TcgPpVendorLib.h
> > +++ b/SecurityPkg/Include/Library/TcgPpVendorLib.h
> > @@ -42,8 +42,8 @@ WITHOUT WARRANTIES OR 

Re: [edk2] [Patch v2] BaseTools/Scripts: Add BinToPcd utility

2016-11-13 Thread Gao, Liming
Mike:
  There is one minor issue in help message.  -m is not only used with --type 
VPD. 
-m MAXSIZE, --max-size MAXSIZE
   Maximum size of the PCD. Only used with --type VPD.

   Other are good to me. Reviewed-by: Liming Gao 

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Michael Kinney
> Sent: Monday, November 14, 2016 11:49 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch v2] BaseTools/Scripts: Add BinToPcd utility
> 
> Add a utility that converts a binary file into a VOID* PCD value
> or a full DSC file VOID* PCD statement with support for all the
> DSC supported PCD sections.
> 
> usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME]
> [-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME]
> [-g VARIABLEGUID] [-v] [-q] [--debug [0-9]]
> 
> Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
> Copyright (c) 2016, Intel Corporation. All rights reserved.
> 
> optional arguments:
>   -h, --helpshow this help message and exit
>   --version show program's version number and exit
>   -i INPUTFILE, --input INPUTFILE
> Input binary filename
>   -o OUTPUTFILE, --output OUTPUTFILE
> Output filename for PCD value or PCD statement
>   -p PCDNAME, --pcd PCDNAME
> Name of the PCD in the form
> .
>   -t {VPD,HII}, --type {VPD,HII}
> PCD statement type (HII or VPD). Default is standard.
>   -m MAXSIZE, --max-size MAXSIZE
> Maximum size of the PCD. Only used with --type VPD.
>   -f OFFSET, --offset OFFSET
> VPD offset if --type is VPD. UEFI Variable offset if
> --type is HII.
>   -n VARIABLENAME, --variable-name VARIABLENAME
> UEFI variable name. Only used with --type HII.
>   -g VARIABLEGUID, --variable-guid VARIABLEGUID
> UEFI variable GUID C name. Only used with --type HII.
>   -v, --verbose Increase output messages
>   -q, --quiet   Reduce output messages
>   --debug [0-9] Set debug level
> 
> This utility can be used in PCD value mode to convert a binary
> file into a string that can then be copied into the PCD value field
> of a VOID* PCD.  The following is an example of PCD value mode on
> an 8 byte test.bin file.
> 
>   BinToPcd.py -i test.bin
> 
>   {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
> The DSC file VOID* PCD statement mode can be used to generate a
> complete PCD statement for the PCD section types that a DSC file
> supports:
> 
>   [PcdsFixedAtBuild]
>   [PcdsPatchableInModule]
>   [PcdsDynamicDefault]
>   [PcdsDynamicExDefault]
>   [PcdsDynamicVpd]
>   [PcdsDynamicExVpd]
>   [PcdsDynamicHii]
>   [PcdsDynamicExHii]
> 
> The PCD statement mode is useful when combined with a !include
> statement in a DSC file.  BinToPcd.py can be used to convert a
> binary file to a PCD statement in an output file, and that output
> file can be included into a DSC file in the matching PCD section
> to set the value of the PCD to the value from the binary file
> without having to copy the value into the DSC file.  Updates can be
> made to the included file without editing the DSC file.  Some
> example use cases are the setting the public key PCDs such as:
> 
>   gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer
>   gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer
> 
> The following example converts a public key binary file to a
> [PcdsFixedAtBuild] compatible PCD statement:
> 
>   BinToPcd.py -i PublicKey.bin -o PublicKey.pcd
> --pcd gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBufferkenSpaceGuid
> 
> The PublicKey.pcd output file contains a single line:
> 
>   gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x48, ...}
> 
> A DSC file can be updated to include the PublicKey.pcd file:
> 
>   [PcdsFixedAtBuild]
>   !include PublicKey.pcd
> 
> Value examples
> ===
>   BinToPcd.py -i test.bin
> {0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
> Normal examples:
> =
>   BinToPcd.py -i test.bin -p Guid.Token
> Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
>   BinToPcd.py -i test.bin -p Guid.Token -m 20
> Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}|VOID*|20
> 
> VPD examples:
> =
>   BinToPcd.py -i test.bin -p Guid.Token -t VPD
> Guid.Name|*|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
>   BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20
> Guid.Name|20|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
>   BinToPcd.py -i test.bin -p Guid.Token -t VPD -m 10
> Guid.Name|*|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
> 
>   BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 -m 10
> Guid.Name|20|10|{0x48, 0x65, 0x6c, 

[edk2] [PATCH] PcAtChipsetPkg/PcRtc: Handle NULL table entry in RSDT/XSDT

2016-11-13 Thread Ruiyu Ni
The ACPI code may reserve the first entry for a certain table
(might be FACS) to help with OS compatible issues.
We need to skip the NULL table entry in RSDT/XSDT.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni 
Cc: Sean Brogan 
---
 PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c 
b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
index 2bb41e7..35e34b7 100644
--- a/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
+++ b/PcAtChipsetPkg/PcatRealTimeClockRuntimeDxe/PcRtc.c
@@ -1230,6 +1230,11 @@ ScanTableInSDT (
 //
 Table = 0;
 CopyMem (, (VOID *) (EntryBase + Index * TablePointerSize), 
TablePointerSize);
+
+if (Table == NULL) {
+  continue;
+}

+
 if (Table->Signature == Signature) {
   return Table;
 }
-- 
2.9.0.windows.1

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


Re: [edk2] USB hub port reset

2016-11-13 Thread Tian, Feng
I don't catch what you mean. We have had 10ms delay for port reset. Which line 
of UsbHub.c do you think there is problem? 

Quote from USB2.0 spec:
"Hubs must be able to accept all hub requests and devices must be able to 
accept a SetAddress() request (refer to
Section 11.24.2 and Section 9.4 respectively) after the reset recovery time 10 
ms (TRSTRCY) after the reset is
removed."

Thanks
Feng

-Original Message-
From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com] 
Sent: Monday, November 14, 2016 11:33 AM
To: Tian, Feng ; edk2-devel@lists.01.org
Subject: RE: USB hub port reset

I didn't mean to have extra delays. Am asking whether EDKII have to be updated 
for 10ms reset recovery time regardless of port status to align with spec?


>From: Tian, Feng [mailto:feng.t...@intel.com] 
>Sent: Sunday, November 13, 2016 7:46 PM
>To: Anbazhagan, Baraneedharan ; edk2-devel@lists.01.org
>Cc: Tian, Feng 
>Subject: RE: USB hub port reset
>
>Hi, Baranee
>
>Linux wait 10 + 40 ms (TRSTRCY = 10 ms, plus extra 40 ms). Do you mean EDKII 
>should be same with linux to wait more time?
>
>Thanks
>Feng
>
>From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com] 
>Sent: Sunday, November 13, 2016 11:53 AM
>To: mailto:edk2-devel@lists.01.org; Tian, Feng 
>Subject: USB hub port reset
>
>EDK2 have reset recovery time of 10ms for hub port based on port status reset 
>bit but USB spec doesn't mention that port status can be used for t6/reset 
>recovery time. Could you please clarify?
>
>USB vendor mentions EDK2 doesn't have reset recovery time on hub port reset 
>and also highlighting EDK2 hub port reset differs from 
>https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c#L2789
>
>-Baranee
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 29/33] SecurityPkg: Fix typos in comments

2016-11-13 Thread Gary Lin
On Mon, Nov 14, 2016 at 03:12:16AM +, Zhang, Chao B wrote:
> Hi Gary:
>   I see some warnings while running PatchChecy.py with this patch. 
> Please help to update the patch, run PatchCheck.py(BaseTools/Scripts) & 
> re-send the patch.
> 

Hi Chao,

PatchCheck.py showed this:

The commit message format passed all checks.
Code format is not valid:
 * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
   File: SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
   Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured. 
Error!\n"));
 * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
   File: SecurityPkg/Tcg/TcgDxe/TcgDxe.c
   Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured. 
Error!\n"));
 * EFI_D_ERROR was used, but DEBUG_ERROR is now recommended
   File: SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
   Line: DEBUG ((EFI_D_ERROR, "Separator Event not Measured. 
Error!\n"));

My patch only fixes typos (Seperator -> Separator) and I tried to avoid any
functional change. I found that EFI_D_ERROR is widely used in SecurityPkg and
it'd be better to convert all EFI_D_ERROR into DEBUG_ERROR in another patch.
What do you think?

Cheers,

Gary Lin

> 
> 
> 
> 
> Thanks & Best regards
> Chao Zhang
> 
> 
> -Original Message-
> From: Gary Lin [mailto:g...@suse.com] 
> Sent: Wednesday, October 19, 2016 3:02 PM
> To: edk2-devel@lists.01.org
> Cc: Zhang, Chao B
> Subject: [PATCH 29/33] SecurityPkg: Fix typos in comments
> 
> - intialized -> initialized
> - TURE -> TRUE
> - successull -> successfully
> - hanlder -> handler
> - funciton -> function
> - Seperator -> Separator
> - Sumbit -> Submit
> 
> Cc: Chao Zhang 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Gary Lin 
> ---
>  SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c  
>  | 2 +-
>  SecurityPkg/Include/Library/TcgPpVendorLib.h 
>  | 4 ++--
>  SecurityPkg/Include/Library/TcgStorageOpalLib.h  
>  | 2 +-
>  SecurityPkg/Include/Library/TrEEPpVendorLib.h
>  | 4 ++--
>  SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c  
>  | 6 +++---
>  
> SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
>  | 2 +-
>  
> SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
>  | 2 +-
>  SecurityPkg/Library/TcgStorageCoreLib/TcgStorageUtil.c   
>  | 2 +-
>  SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c   
>  | 2 +-
>  SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c
>  | 2 +-
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
>  | 2 +-
>  SecurityPkg/Tcg/TcgDxe/TcgDxe.c  
>  | 2 +-
>  SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c
>  | 2 +-
>  SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c  
>  | 2 +-
>  SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h
>  | 2 +-
>  15 files changed, 19 insertions(+), 19 deletions(-)
> 
> diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 
> b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> index ab34de7..93e3273 100644
> --- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> +++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
> @@ -64,7 +64,7 @@ BOOLEAN
>  
>This function performs Hash digest on a data buffer of the specified size.
>It can be called multiple times to compute the digest of long or 
> discontinuous data streams.
> -  Hash context should be already correctly intialized by HashInit(), and 
> should not be finalized
> +  Hash context should be already correctly initialized by HashInit(), and 
> should not be finalized
>by HashFinal(). Behavior with invalid context is undefined.
>  
>If HashContext is NULL, then return FALSE.
> diff --git a/SecurityPkg/Include/Library/TcgPpVendorLib.h 
> b/SecurityPkg/Include/Library/TcgPpVendorLib.h
> index 08b3690..284aa9e 100644
> --- a/SecurityPkg/Include/Library/TcgPpVendorLib.h
> +++ b/SecurityPkg/Include/Library/TcgPpVendorLib.h
> @@ -42,8 +42,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #define TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE 0xFFF1
>  
>  //
> -// The return code for Sumbit TPM Request to Pre-OS Environment
> -// and Sumbit TPM Request to Pre-OS Environment 2
> +// The return code for Submit TPM Request to Pre-OS Environment
> +// and Submit 

[edk2] ShellLibConstructor is failing in Linuxloader application

2016-11-13 Thread Kalyan Nagabhirava
HI,

i am running linuxloader (ArmPkg/Application/LinuxLoader) application in
armQemu ( QEMU_EFI.fd on qemu-system-aarch64)
 but linuxloader is failing while initializing
shellLibs(ShellLibConstructor).
i included Shell lib(ShellLib|ShellPkg/Library/UefiShellLib/UefiShellLib.inf)
in armVirtQemu.dsc, but still it is failing, any idea what is the issue?

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


[edk2] [Patch v2] BaseTools/Scripts: Add BinToPcd utility

2016-11-13 Thread Michael Kinney
Add a utility that converts a binary file into a VOID* PCD value
or a full DSC file VOID* PCD statement with support for all the
DSC supported PCD sections.

usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME]
[-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME]
[-g VARIABLEGUID] [-v] [-q] [--debug [0-9]]

Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
Copyright (c) 2016, Intel Corporation. All rights reserved.

optional arguments:
  -h, --helpshow this help message and exit
  --version show program's version number and exit
  -i INPUTFILE, --input INPUTFILE
Input binary filename
  -o OUTPUTFILE, --output OUTPUTFILE
Output filename for PCD value or PCD statement
  -p PCDNAME, --pcd PCDNAME
Name of the PCD in the form
.
  -t {VPD,HII}, --type {VPD,HII}
PCD statement type (HII or VPD). Default is standard.
  -m MAXSIZE, --max-size MAXSIZE
Maximum size of the PCD. Only used with --type VPD.
  -f OFFSET, --offset OFFSET
VPD offset if --type is VPD. UEFI Variable offset if
--type is HII.
  -n VARIABLENAME, --variable-name VARIABLENAME
UEFI variable name. Only used with --type HII.
  -g VARIABLEGUID, --variable-guid VARIABLEGUID
UEFI variable GUID C name. Only used with --type HII.
  -v, --verbose Increase output messages
  -q, --quiet   Reduce output messages
  --debug [0-9] Set debug level

This utility can be used in PCD value mode to convert a binary
file into a string that can then be copied into the PCD value field
of a VOID* PCD.  The following is an example of PCD value mode on
an 8 byte test.bin file.

  BinToPcd.py -i test.bin

  {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

The DSC file VOID* PCD statement mode can be used to generate a
complete PCD statement for the PCD section types that a DSC file
supports:

  [PcdsFixedAtBuild]
  [PcdsPatchableInModule]
  [PcdsDynamicDefault]
  [PcdsDynamicExDefault]
  [PcdsDynamicVpd]
  [PcdsDynamicExVpd]
  [PcdsDynamicHii]
  [PcdsDynamicExHii]

The PCD statement mode is useful when combined with a !include
statement in a DSC file.  BinToPcd.py can be used to convert a
binary file to a PCD statement in an output file, and that output
file can be included into a DSC file in the matching PCD section
to set the value of the PCD to the value from the binary file
without having to copy the value into the DSC file.  Updates can be
made to the included file without editing the DSC file.  Some
example use cases are the setting the public key PCDs such as:

  gEfiSecurityPkgTokenSpaceGuid.PcdRsa2048Sha256PublicKeyBuffer
  gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer

The following example converts a public key binary file to a
[PcdsFixedAtBuild] compatible PCD statement:

  BinToPcd.py -i PublicKey.bin -o PublicKey.pcd
--pcd gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBufferkenSpaceGuid

The PublicKey.pcd output file contains a single line:

  gEfiSecurityPkgTokenSpaceGuid.PcdPkcs7CertBuffer|{0x48, ...}

A DSC file can be updated to include the PublicKey.pcd file:

  [PcdsFixedAtBuild]
  !include PublicKey.pcd

Value examples
===
  BinToPcd.py -i test.bin
{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

Normal examples:
=
  BinToPcd.py -i test.bin -p Guid.Token
Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -m 20
Guid.Token|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}|VOID*|20

VPD examples:
=
  BinToPcd.py -i test.bin -p Guid.Token -t VPD
Guid.Name|*|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20
Guid.Name|20|8|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -m 10
Guid.Name|*|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

  BinToPcd.py -i test.bin -p Guid.Token -t VPD -f 20 -m 10
Guid.Name|20|10|{0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}

HII examples:
=
  BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName
Guid.Name|L"VarName"|VarGuid|0|{0x48, 0x65, 0x6c, 0x6c}

  BinToPcd.py -i test.bin -p Guid.Token -t HII -g VarGuid -n VarName -f 8
Guid.Name|L"VarName"|VarGuid|8|{0x48, 0x65, 0x6c, 0x6c}

Cc: Yonghong Zhu 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney 
---
 BaseTools/Scripts/BinToPcd.py | 192 ++
 1 file changed, 192 insertions(+)
 create mode 100644 BaseTools/Scripts/BinToPcd.py

diff --git a/BaseTools/Scripts/BinToPcd.py b/BaseTools/Scripts/BinToPcd.py
new file mode 100644
index 000..c08f73d
--- 

Re: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

2016-11-13 Thread Kinney, Michael D
Liming,

Thanks for catching this case.  I will send a V2 patch

Mike

From: Gao, Liming
Sent: Sunday, November 13, 2016 6:58 PM
To: Gao, Liming ; Kinney, Michael D 
; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Mike:
Per DSC spec,  MaxSize supports all type PCDs. Here is one example in NT32Pkg 
DSC file. Could you help update BinToPcd utility to remove MaxSize limitation 
for VPD only?

[PcdsDynamicDefault.common.DEFAULT]
  gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|20
  gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|52

Thanks
Liming
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gao, 
Liming
Sent: Friday, November 11, 2016 8:14 AM
To: Kinney, Michael D 
>; 
edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Mike:
Thanks for your clarification. This way works for me.

Thanks
Liming
From: Kinney, Michael D
Sent: Friday, November 11, 2016 12:46 AM
To: Gao, Liming ; edk2-devel@lists.01.org; 
Kinney, Michael D
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Liming,

There are several ways that BinPcd can produce output files.

* Use -o, --output flag (e.g. -o test.pcd)
* Use output redirection > (e.g. > test.pcd)
* Use output redirection with append >> (e.g. >> test.pcd)

Here is an example using append with current patch:

BinToPcd.py -i test1.bin -p MyTokenSpaceGuid.MyToken1 > test.pcd
BinToPcd.py -i test2.bin -p MyTokenSpaceGuid.MyToken2 >> test.pcd

Here is sample output:

MyTokenSpaceGuid.MyToken1|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
MyTokenSpaceGuid.MyToken2|{0x57, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x0d, 0x0a}

Same with -t VPD flag added

MyTokenSpaceGuid.MyToken1|*|8|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
MyTokenSpaceGuid.MyToken2|*|8|{0x57, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x0d, 0x0a}

Best regards,

Mike


From: Gao, Liming
Sent: Thursday, November 10, 2016 8:23 AM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Yes. Wiki is good enough.

For second one, I understand its complexity. Append is optional option. Users 
will decide to use it or not. I don't expect to add every file for every PCD.

From: Kinney, Michael D
Sent: Friday, November 11, 2016 12:11 AM
To: Gao, Liming ; edk2-devel@lists.01.org; 
Kinney, Michael D
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Liming,

This utility would not used as part of a build.

I put it in BaseTools/Scripts because it is intended to be a helper
tool for developers. I have been writing the Wiki on the Capsule
Based System Firmware Update and there are development steps in that
Wiki that will be simpler if this utility was available, so I plan on
demonstrating real use of this utility in that Wiki. Will that address
your feedback?

The append concept is very complex because this utility can generate
PCD statements for all the supported DSC PCD section types. So we
can not append 2 PCDs with different types. I prefer to do one PCD
at a time and developer can choose to combine or not into one file.

Thanks,

Mike

> -Original Message-
> From: Gao, Liming
> Sent: Thursday, November 10, 2016 6:37 AM
> To: Kinney, Michael D ; 
> edk2-devel@lists.01.org
> Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility
>
> Mike:
> I have two comments.
> 1) Could you also provide the patch to use this utility in edk2 platform, 
> such as
> quark platform?
> 2) Suggest to support append mode as one option. If so, we can use this 
> utility
> to dump more one PCD values into one file.
>
> Thanks
> Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael
> Kinney
> Sent: Wednesday, November 9, 2016 7:45 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming
> Subject: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility
>
> Add a utility that converts a binary file into a VOID* PCD value
> or a full DSC file VOID* PCD statement with support for all the
> DSC supported PCD sections.
>
> usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME]
> [-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME]
> [-g VARIABLEGUID] [-v] [-q] [--debug [0-9]]
>
> Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
> Copyright (c) 2016, Intel Corporation. All rights reserved.
>
> optional arguments:
> -h, --help show this help message and exit
> --version show program's version number and exit
> -i INPUTFILE, --input INPUTFILE
> Input binary filename
> -o OUTPUTFILE, --output OUTPUTFILE
> 

[edk2] [PATCH 3/6] UefiCpuPkg/MpInitLib: Remove CPU information from CPU_AP_DATA

2016-11-13 Thread Jeff Fan
Some CPU information (InitialApicId/ApicId/Health) are duplicated in CPU_AP_DATA
and CPU_INFO_IN_HOB.

This update is to remove the ones from CPU_AP_DATA and update MpInitLib to
consume the ones from CPU_INFO_IN_HOB.

Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 73 +++-
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  3 --
 2 files changed, 39 insertions(+), 37 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 9641e5e..dc4216c 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -253,7 +253,7 @@ SortApicId (
   UINTN Index2;
   UINTN Index3;
   UINT32ApicId;
-  CPU_AP_DATA   CpuData;
+  CPU_INFO_IN_HOB   CpuInfo;
   UINT32ApCount;
   CPU_INFO_IN_HOB   *CpuInfoInHob;
 
@@ -265,21 +265,22 @@ SortApicId (
   //
   // Sort key is the hardware default APIC ID
   //
-  ApicId = CpuMpData->CpuData[Index1].ApicId;
+  CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
+  ApicId = CpuInfoInHob[Index1].ApicId;
   for (Index2 = Index1 + 1; Index2 <= ApCount; Index2++) {
-if (ApicId > CpuMpData->CpuData[Index2].ApicId) {
+if (ApicId > CpuInfoInHob[Index2].ApicId) {
   Index3 = Index2;
-  ApicId = CpuMpData->CpuData[Index2].ApicId;
+  ApicId = CpuInfoInHob[Index2].ApicId;
 }
   }
   if (Index3 != Index1) {
-CopyMem (, >CpuData[Index3], sizeof (CPU_AP_DATA));
+CopyMem (, [Index3], sizeof (CPU_INFO_IN_HOB));
 CopyMem (
-  >CpuData[Index3],
-  >CpuData[Index1],
-  sizeof (CPU_AP_DATA)
+  [Index3],
+  [Index1],
+  sizeof (CPU_INFO_IN_HOB)
   );
-CopyMem (>CpuData[Index1], , sizeof (CPU_AP_DATA));
+CopyMem ([Index1], , sizeof (CPU_INFO_IN_HOB));
   }
 }
 
@@ -288,18 +289,11 @@ SortApicId (
 //
 ApicId = GetInitialApicId ();
 for (Index1 = 0; Index1 < CpuMpData->CpuCount; Index1++) {
-  if (CpuMpData->CpuData[Index1].ApicId == ApicId) {
+  if (CpuInfoInHob[Index1].ApicId == ApicId) {
 CpuMpData->BspNumber = (UINT32) Index1;
 break;
   }
 }
-
-CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
-for (Index1 = 0; Index1 < CpuMpData->CpuCount; Index1++) {
-  CpuInfoInHob[Index1].InitialApicId = 
CpuMpData->CpuData[Index1].InitialApicId;
-  CpuInfoInHob[Index1].ApicId= CpuMpData->CpuData[Index1].ApicId;
-  CpuInfoInHob[Index1].Health= CpuMpData->CpuData[Index1].Health;
-}
   }
 }
 
@@ -358,10 +352,13 @@ GetProcessorNumber (
 {
   UINTN   TotalProcessorNumber;
   UINTN   Index;
+  CPU_INFO_IN_HOB *CpuInfoInHob;
+
+  CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
 
   TotalProcessorNumber = CpuMpData->CpuCount;
   for (Index = 0; Index < TotalProcessorNumber; Index ++) {
-if (CpuMpData->CpuData[Index].ApicId == GetApicId ()) {
+if (CpuInfoInHob[Index].ApicId == GetApicId ()) {
   *ProcessorNumber = Index;
   return EFI_SUCCESS;
 }
@@ -439,12 +436,16 @@ InitializeApData (
   IN UINT32   BistData
   )
 {
+  CPU_INFO_IN_HOB  *CpuInfoInHob;
+
+  CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
+  CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();
+  CpuInfoInHob[ProcessorNumber].ApicId= GetApicId ();
+  CpuInfoInHob[ProcessorNumber].Health= BistData;
+
   CpuMpData->CpuData[ProcessorNumber].Waiting= FALSE;
-  CpuMpData->CpuData[ProcessorNumber].Health = BistData;
   CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : 
FALSE;
-  CpuMpData->CpuData[ProcessorNumber].ApicId = GetApicId ();
-  CpuMpData->CpuData[ProcessorNumber].InitialApicId = GetInitialApicId ();
-  if (CpuMpData->CpuData[ProcessorNumber].InitialApicId >= 0xFF) {
+  if (CpuInfoInHob[ProcessorNumber].InitialApicId >= 0xFF) {
 //
 // Set x2APIC mode if there are any logical processor reporting
 // an Initial APIC ID of 255 or greater.
@@ -477,6 +478,7 @@ ApWakeupFunction (
   VOID   *Parameter;
   UINT32 BistData;
   volatile UINT32*ApStartupSignalBuffer;
+  CPU_INFO_IN_HOB*CpuInfoInHob;
 
   //
   // AP finished assembly code and begin to execute C code
@@ -547,8 +549,9 @@ ApWakeupFunction (
 //
 // Re-get the CPU APICID and Initial APICID
 //
-CpuMpData->CpuData[ProcessorNumber].ApicId= GetApicId ();
-CpuMpData->CpuData[ProcessorNumber].InitialApicId = 
GetInitialApicId ();
+

[edk2] [PATCH 2/6] UefiCpuPkg/MpInitLib: Force sending INIT-SIPI-SIPI to reset APs

2016-11-13 Thread Jeff Fan
If BSP found APs timeout happened when AP executing AP task, BSP will reset APs
by WakeUpAP(). However, if ApLoopMode is ApMwaitLoop or ApRunLoop, WakeUpAp()
will try to write semaphore in memory to wake up AP. It cannot wake up APs
actually if APs still executing AP task.

This fix is to set ApInitReconfig flag to force BSP to send INIT-SIPI-SIPI to
wake up APs.

Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index a0edc55..9641e5e 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -899,7 +899,12 @@ ResetProcessorToIdleState (
 
   CpuMpData = GetCpuMpData ();
 
+  CpuMpData->InitFlag = ApInitReconfig;
   WakeUpAP (CpuMpData, FALSE, ProcessorNumber, NULL, NULL);
+  while (CpuMpData->FinishedCount < 1) {
+CpuPause ();
+  }
+  CpuMpData->InitFlag = ApInitDone;
 
   SetApState (>CpuData[ProcessorNumber], CpuStateIdle);
 }
-- 
2.9.3.windows.2

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


[edk2] [PATCH 5/6] UefiCpuPkg/MpInitLib: Program AP stack in fixed address

2016-11-13 Thread Jeff Fan
Currently, MpInitLib will program AP stack in dynamic address. Each processor
will calculate its stack address by adding stack size based on the last stack
address. That means AP may have the different stack address everytime it is
wakeup by INIT-SIPI-SIPI.

When all APs have wakeup to execute AP task, each each has been assigned one
stack address. Once the timeout happened on some of APs, BSP will send INIT-
SIPI-SIPI to wake up APs. We need to re-assign stack for APs. Based on the
current implementation, we might assign one stack address used by other APs.
It will cause the unexpected stack overlapped issue.

This fix changed the stack assignment policy. We will record the stack address
assigned to AP at first time AP wakeup. When AP failed on AP task, BSP could
reassigned the same stack for it.

Getting initial APIC ID in assembly code could help AP to get saved its stack
address.

Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 65 +++-
 UefiCpuPkg/Library/MpInitLib/MpLib.c   | 12 +++--
 UefiCpuPkg/Library/MpInitLib/MpLib.h   |  1 +
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm  | 68 +-
 4 files changed, 119 insertions(+), 27 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm 
b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
index 8f6f0bf..4bfa084 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm
@@ -114,7 +114,12 @@ Flat32Start:   ; protected 
mode entry point
 mov cr0, eax
 
 SkipEnableExecuteDisable:
+movedi, esi
+addedi, InitFlagLocation
+cmpdword [edi], 1   ; 1 == ApInitConfig
+jnzGetApicId
 
+; AP init
 movedi, esi
 addedi, LockLocation
 moveax, NotVacantFlag
@@ -124,27 +129,65 @@ TestLock:
 cmpeax, NotVacantFlag
 jz TestLock
 
-movedi, esi
-addedi, NumApsExecutingLocation
-incdword [edi]
-movebx, [edi]
+movecx, esi
+addecx, NumApsExecutingLocation
+incdword [ecx]
+movebx, [ecx]
+
+Releaselock:
+moveax, VacantFlag
+xchg   [edi], eax
 
-ProgramStack:
 movedi, esi
 addedi, StackSizeLocation
 moveax, [edi]
+movecx, ebx
+incecx
+mulecx   ; EAX = StackSize * 
(CpuNumber + 1)
 movedi, esi
 addedi, StackStartAddressLocation
 addeax, [edi]
 movesp, eax
-mov[edi], eax
+jmpCProcedureInvoke
+
+GetApicId:
+moveax, 0
+cpuid
+cmpeax, 0bh
+jnbX2Apic
+; Processor is not x2APIC capable, so get 8-bit APIC ID
+moveax, 1
+cpuid
+shrebx, 24
+movedx, ebx
+jmpGetProcessorNumber
+
+X2Apic:
+; Processor is x2APIC capable, so get 32-bit x2APIC ID
+moveax, 0bh
+xorecx, ecx
+cpuid   
+; edx save x2APIC ID
+
+GetProcessorNumber:
+;
+; Get processor number for this AP
+; Note that BSP may become an AP due to SwitchBsp()
+;
+xor ebx, ebx
+lea eax, [esi + CpuInfoLocation]
+mov edi, [eax]
 
-Releaselock:
-moveax, VacantFlag
-movedi, esi
-addedi, LockLocation
-xchg   [edi], eax
+GetNextProcNumber:
+cmp [edi], edx   ; APIC ID match?
+jz  ProgramStack
+add edi, 16
+inc ebx
+jmp GetNextProcNumber
 
+ProgramStack:
+mov esp, [edi + 12]
+   
 CProcedureInvoke:
 push   ebp   ; push BIST data at top of AP stack
 xorebp, ebp  ; clear ebp for call stack trace
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index da814c6..748c8e7 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -433,7 +433,8 @@ VOID
 InitializeApData (
   IN OUT CPU_MP_DATA  *CpuMpData,
   IN UINTNProcessorNumber,
-  IN UINT32   BistData
+  IN UINT32   BistData,
+  IN UINTNApTopOfStack
   )
 {
   CPU_INFO_IN_HOB  *CpuInfoInHob;
@@ -442,6 +443,7 @@ InitializeApData (
   CpuInfoInHob[ProcessorNumber].InitialApicId = GetInitialApicId ();
   CpuInfoInHob[ProcessorNumber].ApicId= GetApicId ();
   CpuInfoInHob[ProcessorNumber].Health= BistData;
+  CpuInfoInHob[ProcessorNumber].ApTopOfStack  = (UINT32) ApTopOfStack;
 
   

[edk2] [PATCH 6/6] UefiCpuPkg/MpInitLib: Update AP information when BSP switched

2016-11-13 Thread Jeff Fan
When BSP switched, we need to update some AP information. For example,
ApStartupSignalBuffer and ApTopOfStack.

Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 3 +++
 UefiCpuPkg/Library/MpInitLib/MpLib.h | 1 +
 2 files changed, 4 insertions(+)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 748c8e7..c74efb0 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -549,6 +549,8 @@ ApWakeupFunction (
 GetProcessorNumber (CpuMpData, );
 CpuMpData->CpuData[ProcessorNumber].ApFunction = 0;
 CpuMpData->CpuData[ProcessorNumber].ApFunctionArgument = 0;
+ApStartupSignalBuffer = 
CpuMpData->CpuData[ProcessorNumber].StartupApSignal;
+CpuInfoInHob[ProcessorNumber].ApTopOfStack = 
CpuInfoInHob[CpuMpData->NewBspNumber].ApTopOfStack;
   } else {
 //
 // Re-get the CPU APICID and Initial APICID
@@ -1421,6 +1423,7 @@ SwitchBSPWorker (
   CpuMpData->BSPInfo.State = CPU_SWITCH_STATE_IDLE;
   CpuMpData->APInfo.State  = CPU_SWITCH_STATE_IDLE;
   CpuMpData->SwitchBspFlag = TRUE;
+  CpuMpData->NewBspNumber  = ProcessorNumber;
 
   //
   // Clear the BSP bit of MSR_IA32_APIC_BASE
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index f81c819..0ac777a 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -216,6 +216,7 @@ struct _CPU_MP_DATA {
   AP_INIT_STATE  InitFlag;
   BOOLEANX2ApicEnable;
   BOOLEANSwitchBspFlag;
+  UINTN  NewBspNumber;
   CPU_EXCHANGE_ROLE_INFO BSPInfo;
   CPU_EXCHANGE_ROLE_INFO APInfo;
   MTRR_SETTINGS  MtrrTable;
-- 
2.9.3.windows.2

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


[edk2] [PATCH 1/6] UefiCpuPkg/MpInitLib: Fixed offset error on Cr3Location

2016-11-13 Thread Jeff Fan
Cr3Location offset value should be 0x34 not 0x3C.

Cc: Feng Tian 
Cc: Hao Wu 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc 
b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
index 60add86..5c6d4ef 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
@@ -37,5 +37,5 @@ NumApsExecutingLocation   equLockLocation + 24h
 CodeSegmentLocation   equLockLocation + 28h
 DataSegmentLocation   equLockLocation + 2Ch
 EnableExecuteDisableLocation  equLockLocation + 30h
-Cr3Location   equLockLocation + 3Ch
+Cr3Location   equLockLocation + 34h
 
-- 
2.9.3.windows.2

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


[edk2] [PATCH 0/6] UefiCpuPkg/MpInitLib: Program AP stack in fixed address

2016-11-13 Thread Jeff Fan
Currently, MpInitLib will program AP stack in dynamic address. Each processor
will calculate its stack address by adding stack size based on the last stack
address. That means AP may have the different stack address everytime it is
wakeup by INIT-SIPI-SIPI.

When all APs have wakeup to execute AP task, each each has been assigned one
stack address. Once the timeout happened on some of APs, BSP will send INIT-
SIPI-SIPI to wake up APs. We need to re-assign stack for APs. Based on the
current implementation, we might assign one stack address used by other APs.
It will cause the unexpected stack overlapped issue.

This fix changed the stack assignment policy. We will record the stack address
assigned to AP at first time AP wakeup. When AP failed on AP task, BSP could
reassigned the same stack for it.

Cc: Feng Tian 
Cc: Hao Wu 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 

Jeff Fan (6):
  UefiCpuPkg/MpInitLib: Fixed offset error on Cr3Location
  UefiCpuPkg/MpInitLib: Force sending INIT-SIPI-SIPI to reset APs
  UefiCpuPkg/MpInitLib: Remove CPU information from CPU_AP_DATA
  UefiCpuPkg/MpInitLib: Add InitFlag and CpuInfo in MP_CPU_EXCHANGE_INFO
  UefiCpuPkg/MpInitLib: Program AP stack in fixed address
  UefiCpuPkg/MpInitLib: Update AP information when BSP switched

 UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc|  4 +-
 UefiCpuPkg/Library/MpInitLib/Ia32/MpFuncs.nasm | 65 +++---
 UefiCpuPkg/Library/MpInitLib/MpLib.c   | 95 +++---
 UefiCpuPkg/Library/MpInitLib/MpLib.h   |  7 +-
 UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc |  4 +-
 UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm  | 68 ++
 6 files changed, 176 insertions(+), 67 deletions(-)

-- 
2.9.3.windows.2

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


[edk2] [PATCH 4/6] UefiCpuPkg/MpInitLib: Add InitFlag and CpuInfo in MP_CPU_EXCHANGE_INFO

2016-11-13 Thread Jeff Fan
Cc: Feng Tian 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan 
---
 UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc | 2 ++
 UefiCpuPkg/Library/MpInitLib/MpLib.c| 2 ++
 UefiCpuPkg/Library/MpInitLib/MpLib.h| 2 ++
 UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc  | 4 ++--
 4 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc 
b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
index 5c6d4ef..6276230 100644
--- a/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/Ia32/MpEqu.inc
@@ -38,4 +38,6 @@ CodeSegmentLocation   equLockLocation + 28h
 DataSegmentLocation   equLockLocation + 2Ch
 EnableExecuteDisableLocation  equLockLocation + 30h
 Cr3Location   equLockLocation + 34h
+InitFlagLocation  equLockLocation + 38h
+CpuInfoLocation   equLockLocation + 3Ch
 
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index dc4216c..da814c6 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -665,6 +665,8 @@ FillExchangeInfoData (
 
   ExchangeInfo->CFunction   = (UINTN) ApWakeupFunction;
   ExchangeInfo->NumApsExecuting = 0;
+  ExchangeInfo->InitFlag= (UINTN) CpuMpData->InitFlag;
+  ExchangeInfo->CpuInfo = (CPU_INFO_IN_HOB *) (UINTN) 
CpuMpData->CpuInfoInHob;
   ExchangeInfo->CpuMpData   = CpuMpData;
 
   ExchangeInfo->EnableExecuteDisable = IsBspExecuteDisableEnabled ();
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index f107b6d..a58c855 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -171,6 +171,8 @@ typedef struct {
   UINTN DataSegment;
   UINTN EnableExecuteDisable;
   UINTN Cr3;
+  UINTN InitFlag;
+  CPU_INFO_IN_HOB   *CpuInfo;
   CPU_MP_DATA   *CpuMpData;
 } MP_CPU_EXCHANGE_INFO;
 
diff --git a/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc 
b/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
index d533741..a63cd23 100644
--- a/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
+++ b/UefiCpuPkg/Library/MpInitLib/X64/MpEqu.inc
@@ -38,6 +38,6 @@ CodeSegmentLocation   equLockLocation + 4Ch
 DataSegmentLocation   equLockLocation + 54h
 EnableExecuteDisableLocation  equLockLocation + 5Ch
 Cr3Location   equLockLocation + 64h
+InitFlagLocation  equLockLocation + 6Ch
+CpuInfoLocation   equLockLocation + 74h
 
-
-;---
-- 
2.9.3.windows.2

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


Re: [edk2] USB hub port reset

2016-11-13 Thread Anbazhagan, Baraneedharan
I didn't mean to have extra delays. Am asking whether EDKII have to be updated 
for 10ms reset recovery time regardless of port status to align with spec?


>From: Tian, Feng [mailto:feng.t...@intel.com] 
>Sent: Sunday, November 13, 2016 7:46 PM
>To: Anbazhagan, Baraneedharan ; edk2-devel@lists.01.org
>Cc: Tian, Feng 
>Subject: RE: USB hub port reset
>
>Hi, Baranee
>
>Linux wait 10 + 40 ms (TRSTRCY = 10 ms, plus extra 40 ms). Do you mean EDKII 
>should be same with linux to wait more time?
>
>Thanks
>Feng
>
>From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com] 
>Sent: Sunday, November 13, 2016 11:53 AM
>To: mailto:edk2-devel@lists.01.org; Tian, Feng 
>Subject: USB hub port reset
>
>EDK2 have reset recovery time of 10ms for hub port based on port status reset 
>bit but USB spec doesn't mention that port status can be used for t6/reset 
>recovery time. Could you please clarify?
>
>USB vendor mentions EDK2 doesn't have reset recovery time on hub port reset 
>and also highlighting EDK2 hub port reset differs from 
>https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c#L2789
>
>-Baranee
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on unaligned FvImage issue

2016-11-13 Thread Zeng, Star
Jiewen & Mike,

I just supplemented a patch to update PeiHobLib according to your suggestion.

Thanks,
Star
From: Yao, Jiewen
Sent: Monday, November 14, 2016 9:43 AM
To: Kinney, Michael D ; Zeng, Star 
; edk2-devel@lists.01.org
Cc: Gao, Liming ; Zeng, Star 
Subject: RE: [PATCH] MdeModulePkg DxeCore: Show error message on unaligned 
FvImage issue

Ah, yes. Definitely.

I think it is a good idea to catch such issue as early as possible.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Monday, November 14, 2016 9:41 AM
To: Yao, Jiewen >; Zeng, Star 
>; 
edk2-devel@lists.01.org; Kinney, Michael D 
>
Cc: Yao, Jiewen >; Gao, 
Liming >; Zeng, Star 
>
Subject: RE: [PATCH] MdeModulePkg DxeCore: Show error message on unaligned 
FvImage issue

Jiewen,

Do you think it would be a good idea to add a similar DEBUG()
message in the HobLib when an FV HOBs are created?  There are
other ways FV HOBs can be created, so I think the DEBUG() message
in this patch is very important, but getting a message when
the an FV HOB is created will make fixing the issue easier.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yao,
> Jiewen
> Sent: Sunday, November 13, 2016 5:28 PM
> To: Zeng, Star >; 
> edk2-devel@lists.01.org
> Cc: Yao, Jiewen >; Gao, 
> Liming >; Zeng,
> Star >
> Subject: Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on 
> unaligned
> FvImage issue
>
> Reviewed-by: jiewen@intel.com
>
> >
> >
> > -Original Message-
> > From: Zeng, Star
> > Sent: Friday, November 11, 2016 1:59 PM
> > To: edk2-devel@lists.01.org
> > Cc: Zeng, Star >; Yao, 
> > Jiewen >;
> > Gao, Liming >
> > Subject: [PATCH] MdeModulePkg DxeCore: Show error message on
> > unaligned FvImage issue
> >
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> >
> > Cc: Jiewen Yao >
> > Cc: Liming Gao >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Star Zeng >
> > ---
> >  MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > index f031ef110c19..bc7b34140f84 100644
> > --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > @@ -4,7 +4,7 @@
> >It consumes FV HOBs and creates read-only Firmare Volume Block
> > protocol
> >instances for each of them.
> >
> > -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> > +Copyright (c) 2006 - 2016, 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
> > @@ -495,6 +495,13 @@ ProduceFVBProtocolOnBuffer (
> >//
> >// FvImage buffer is not at its required alignment.
> >//
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"Unaligned FvImage found at 0x%lx:0x%lx, the required
> > alignment is 0x%x\n",
> > +BaseAddress,
> > +Length,
> > +FvAlignment
> > +));
> >return EFI_VOLUME_CORRUPTED;
> >  }
> >}
> > --
> > 2.7.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


[edk2] [PATCH] MdePkg PeiHobLib: Check FV alignment when building FV HOB

2016-11-13 Thread Star Zeng
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205

Cc: Jiewen Yao 
Cc: Liming Gao 
Cc: Michael D Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 MdePkg/Library/PeiHobLib/HobLib.c | 66 ++-
 1 file changed, 65 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Library/PeiHobLib/HobLib.c 
b/MdePkg/Library/PeiHobLib/HobLib.c
index f3ce93afc63e..f2e44016e71c 100644
--- a/MdePkg/Library/PeiHobLib/HobLib.c
+++ b/MdePkg/Library/PeiHobLib/HobLib.c
@@ -1,7 +1,7 @@
 /** @file
   Provide Hob Library functions for Pei phase.
 
-Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2007 - 2016, 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
@@ -474,6 +474,62 @@ BuildGuidDataHob (
 }
 
 /**
+  Check FV alignment.
+
+  @param  BaseAddress   The base address of the Firmware Volume.
+  @param  LengthThe size of the Firmware Volume in bytes.
+
+  @retval TRUE  FvImage buffer is at its required alignment.
+  @retval FALSE FvImage buffer is not at its required alignment.
+
+**/
+BOOLEAN
+InternalCheckFvAlignment (
+  IN EFI_PHYSICAL_ADDRESS   BaseAddress,
+  IN UINT64 Length
+  )
+{
+  EFI_FIRMWARE_VOLUME_HEADER*FwVolHeader;
+  UINT32FvAlignment;
+
+  FvAlignment = 0;
+  FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *) (UINTN) BaseAddress;
+
+  //
+  // If EFI_FVB2_WEAK_ALIGNMENT is set in the volume header then the first 
byte of the volume
+  // can be aligned on any power-of-two boundary. A weakly aligned volume can 
not be moved from
+  // its initial linked location and maintain its alignment.
+  //
+  if ((FwVolHeader->Attributes & EFI_FVB2_WEAK_ALIGNMENT) != 
EFI_FVB2_WEAK_ALIGNMENT) {
+//
+// Get FvHeader alignment
+//
+FvAlignment = 1 << ((FwVolHeader->Attributes & EFI_FVB2_ALIGNMENT) >> 16);
+//
+// FvAlignment must be greater than or equal to 8 bytes of the minimum FFS 
alignment value.
+//
+if (FvAlignment < 8) {
+  FvAlignment = 8;
+}
+if ((UINTN)BaseAddress % FvAlignment != 0) {
+  //
+  // FvImage buffer is not at its required alignment.
+  //
+  DEBUG ((
+DEBUG_ERROR,
+"Unaligned FvImage found at 0x%lx:0x%lx, the required alignment is 
0x%x\n",
+BaseAddress,
+Length,
+FvAlignment
+));
+  return FALSE;
+}
+  }
+
+  return TRUE;
+}
+
+/**
   Builds a Firmware Volume HOB.
 
   This function builds a Firmware Volume HOB.
@@ -495,6 +551,10 @@ BuildFvHob (
 {
   EFI_HOB_FIRMWARE_VOLUME  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV, (UINT16) sizeof 
(EFI_HOB_FIRMWARE_VOLUME));
   if (Hob == NULL) {
 return;
@@ -530,6 +590,10 @@ BuildFv2Hob (
 {
   EFI_HOB_FIRMWARE_VOLUME2  *Hob;
 
+  if (!InternalCheckFvAlignment (BaseAddress, Length)) {
+return;
+  }
+
   Hob = InternalPeiCreateHob (EFI_HOB_TYPE_FV2, (UINT16) sizeof 
(EFI_HOB_FIRMWARE_VOLUME2));
   if (Hob == NULL) {
 return;
-- 
2.7.0.windows.1

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


Re: [edk2] [PATCH 29/33] SecurityPkg: Fix typos in comments

2016-11-13 Thread Zhang, Chao B
Hi Gary:
  I see some warnings while running PatchChecy.py with this patch. 
Please help to update the patch, run PatchCheck.py(BaseTools/Scripts) & re-send 
the patch.





Thanks & Best regards
Chao Zhang


-Original Message-
From: Gary Lin [mailto:g...@suse.com] 
Sent: Wednesday, October 19, 2016 3:02 PM
To: edk2-devel@lists.01.org
Cc: Zhang, Chao B
Subject: [PATCH 29/33] SecurityPkg: Fix typos in comments

- intialized -> initialized
- TURE -> TRUE
- successull -> successfully
- hanlder -> handler
- funciton -> function
- Seperator -> Separator
- Sumbit -> Submit

Cc: Chao Zhang 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin 
---
 SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
   | 2 +-
 SecurityPkg/Include/Library/TcgPpVendorLib.h   
   | 4 ++--
 SecurityPkg/Include/Library/TcgStorageOpalLib.h
   | 2 +-
 SecurityPkg/Include/Library/TrEEPpVendorLib.h  
   | 4 ++--
 SecurityPkg/Library/DxeDeferImageLoadLib/DxeDeferImageLoadLib.c
   | 6 +++---
 
SecurityPkg/Library/DxeRsa2048Sha256GuidedSectionExtractLib/DxeRsa2048Sha256GuidedSectionExtractLib.c
 | 2 +-
 
SecurityPkg/Library/PeiRsa2048Sha256GuidedSectionExtractLib/PeiRsa2048Sha256GuidedSectionExtractLib.c
 | 2 +-
 SecurityPkg/Library/TcgStorageCoreLib/TcgStorageUtil.c 
   | 2 +-
 SecurityPkg/Library/TcgStorageOpalLib/TcgStorageOpalCore.c 
   | 2 +-
 SecurityPkg/Tcg/Opal/OpalPasswordDxe/OpalDriver.c  
   | 2 +-
 SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c  
   | 2 +-
 SecurityPkg/Tcg/TcgDxe/TcgDxe.c
   | 2 +-
 SecurityPkg/Tcg/TrEEDxe/TrEEDxe.c  
   | 2 +-
 SecurityPkg/UserIdentification/UserProfileManagerDxe/ModifyIdentityPolicy.c
   | 2 +-
 SecurityPkg/UserIdentification/UserProfileManagerDxe/UserProfileManager.h  
   | 2 +-
 15 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c 
b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
index ab34de7..93e3273 100644
--- a/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
+++ b/SecurityPkg/Hash2DxeCrypto/Hash2DxeCrypto.c
@@ -64,7 +64,7 @@ BOOLEAN
 
   This function performs Hash digest on a data buffer of the specified size.
   It can be called multiple times to compute the digest of long or 
discontinuous data streams.
-  Hash context should be already correctly intialized by HashInit(), and 
should not be finalized
+  Hash context should be already correctly initialized by HashInit(), and 
should not be finalized
   by HashFinal(). Behavior with invalid context is undefined.
 
   If HashContext is NULL, then return FALSE.
diff --git a/SecurityPkg/Include/Library/TcgPpVendorLib.h 
b/SecurityPkg/Include/Library/TcgPpVendorLib.h
index 08b3690..284aa9e 100644
--- a/SecurityPkg/Include/Library/TcgPpVendorLib.h
+++ b/SecurityPkg/Include/Library/TcgPpVendorLib.h
@@ -42,8 +42,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #define TCG_PP_OPERATION_RESPONSE_BIOS_FAILURE 0xFFF1
 
 //
-// The return code for Sumbit TPM Request to Pre-OS Environment
-// and Sumbit TPM Request to Pre-OS Environment 2
+// The return code for Submit TPM Request to Pre-OS Environment
+// and Submit TPM Request to Pre-OS Environment 2
 //
 #define TCG_PP_SUBMIT_REQUEST_TO_PREOS_SUCCESS 
 0
 #define TCG_PP_SUBMIT_REQUEST_TO_PREOS_NOT_IMPLEMENTED 
 1
diff --git a/SecurityPkg/Include/Library/TcgStorageOpalLib.h 
b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
index 108affc..9b64a8e 100644
--- a/SecurityPkg/Include/Library/TcgStorageOpalLib.h
+++ b/SecurityPkg/Include/Library/TcgStorageOpalLib.h
@@ -290,7 +290,7 @@ OpalGlobalLockingRangeGenKey(
 /**
 
   The function updates the ReadLocked and WriteLocked columns of the Global 
Locking Range.
-  This funciton is required for a user1 authority, since a user1 authority 
shall only have access to ReadLocked and WriteLocked columns
+  This function is required for a user1 authority, since a user1 authority 
shall only have access to ReadLocked and WriteLocked columns
   (not ReadLockEnabled and WriteLockEnabled columns).
 
   @param[in]  LockingSpSessionOPAL_SESSION with OPAL_UID_LOCKING_SP to 
generate key
diff --git a/SecurityPkg/Include/Library/TrEEPpVendorLib.h 
b/SecurityPkg/Include/Library/TrEEPpVendorLib.h
index d3a0767..f0dcfd9 100644
--- 

Re: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

2016-11-13 Thread Gao, Liming
Mike:
Per DSC spec,  MaxSize supports all type PCDs. Here is one example in NT32Pkg 
DSC file. Could you help update BinToPcd utility to remove MaxSize limitation 
for VPD only?

[PcdsDynamicDefault.common.DEFAULT]
  gEfiNt32PkgTokenSpaceGuid.PcdWinNtSerialPort|L"COM1!COM2"|VOID*|20
  gEfiNt32PkgTokenSpaceGuid.PcdWinNtGop|L"UGA Window 1!UGA Window 2"|VOID*|52

Thanks
Liming
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Gao, 
Liming
Sent: Friday, November 11, 2016 8:14 AM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Subject: Re: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Mike:
Thanks for your clarification. This way works for me.

Thanks
Liming
From: Kinney, Michael D
Sent: Friday, November 11, 2016 12:46 AM
To: Gao, Liming ; edk2-devel@lists.01.org; 
Kinney, Michael D
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Liming,

There are several ways that BinPcd can produce output files.

* Use -o, --output flag (e.g. -o test.pcd)
* Use output redirection > (e.g. > test.pcd)
* Use output redirection with append >> (e.g. >> test.pcd)

Here is an example using append with current patch:

BinToPcd.py -i test1.bin -p MyTokenSpaceGuid.MyToken1 > test.pcd
BinToPcd.py -i test2.bin -p MyTokenSpaceGuid.MyToken2 >> test.pcd

Here is sample output:

MyTokenSpaceGuid.MyToken1|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
MyTokenSpaceGuid.MyToken2|{0x57, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x0d, 0x0a}

Same with -t VPD flag added

MyTokenSpaceGuid.MyToken1|*|8|{0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x0d, 0x0a}
MyTokenSpaceGuid.MyToken2|*|8|{0x57, 0x6f, 0x72, 0x6c, 0x64, 0x20, 0x0d, 0x0a}

Best regards,

Mike


From: Gao, Liming
Sent: Thursday, November 10, 2016 8:23 AM
To: Kinney, Michael D ; edk2-devel@lists.01.org
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Yes. Wiki is good enough.

For second one, I understand its complexity. Append is optional option. Users 
will decide to use it or not. I don't expect to add every file for every PCD.

From: Kinney, Michael D
Sent: Friday, November 11, 2016 12:11 AM
To: Gao, Liming ; edk2-devel@lists.01.org; 
Kinney, Michael D
Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility

Liming,

This utility would not used as part of a build.

I put it in BaseTools/Scripts because it is intended to be a helper
tool for developers. I have been writing the Wiki on the Capsule
Based System Firmware Update and there are development steps in that
Wiki that will be simpler if this utility was available, so I plan on
demonstrating real use of this utility in that Wiki. Will that address
your feedback?

The append concept is very complex because this utility can generate
PCD statements for all the supported DSC PCD section types. So we
can not append 2 PCDs with different types. I prefer to do one PCD
at a time and developer can choose to combine or not into one file.

Thanks,

Mike

> -Original Message-
> From: Gao, Liming
> Sent: Thursday, November 10, 2016 6:37 AM
> To: Kinney, Michael D ; 
> edk2-devel@lists.01.org
> Subject: RE: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility
>
> Mike:
> I have two comments.
> 1) Could you also provide the patch to use this utility in edk2 platform, 
> such as
> quark platform?
> 2) Suggest to support append mode as one option. If so, we can use this 
> utility
> to dump more one PCD values into one file.
>
> Thanks
> Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Michael
> Kinney
> Sent: Wednesday, November 9, 2016 7:45 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming
> Subject: [edk2] [Patch] BaseTools/Scripts: Add BinToPcd utility
>
> Add a utility that converts a binary file into a VOID* PCD value
> or a full DSC file VOID* PCD statement with support for all the
> DSC supported PCD sections.
>
> usage: BinToPcd [-h] [--version] -i INPUTFILE [-o OUTPUTFILE] [-p PCDNAME]
> [-t {VPD,HII}] [-m MAXSIZE] [-f OFFSET] [-n VARIABLENAME]
> [-g VARIABLEGUID] [-v] [-q] [--debug [0-9]]
>
> Convert a binary file to a VOID* PCD value or DSC file VOID* PCD statement.
> Copyright (c) 2016, Intel Corporation. All rights reserved.
>
> optional arguments:
> -h, --help show this help message and exit
> --version show program's version number and exit
> -i INPUTFILE, --input INPUTFILE
> Input binary filename
> -o OUTPUTFILE, --output OUTPUTFILE
> Output filename for PCD value or PCD statement
> -p PCDNAME, --pcd PCDNAME
> Name of the PCD in the form
> .
> -t {VPD,HII}, --type {VPD,HII}
> PCD statement type (HII or VPD). Default is standard.
> -m MAXSIZE, --max-size MAXSIZE
> Maximum size of the PCD. Only used with --type VPD.
> -f OFFSET, --offset OFFSET
> VPD offset if --type is VPD. UEFI Variable offset if
> --type is 

Re: [edk2] [PATCH] ShellPkg/dmpstore: Support "-sfo"

2016-11-13 Thread Ni, Ruiyu
Yes I just saw that difference in Spec.
I agree to remove the sfo support for -s and -l.
But I do not think we need to define new SFO table.

I think the V1 patch's implementation can satisfy caller's information needs.
For -s, displaying the variable content in SFO is to tell caller that the 
exactly same
content is saved to file.
For -l, only displaying the variable content in SFO is to tell caller that the 
variable
listed in SFO is updated to the content shown in SFO.

Thanks/Ray

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Shah, Tapan
> Sent: Saturday, November 12, 2016 4:43 AM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org; Phillips, Chris J
> (Plano, TX) 
> Cc: Carsey, Jaben ; Chen, Chen A
> 
> Subject: Re: [edk2] [PATCH] ShellPkg/dmpstore: Support "-sfo"
> 
> Ray,
>Chris and I looked at the patch closely again and saw that your change also
> includes -sfo support for -l and -s flags which is not supported according to
> the latest spec. See below syntax from spec:
> 
> dmpstore [-b] [-d] [-all | (-guid guid)] [variable] [-sfo] dmpstore [-all | 
> (-guid
> guid)] [variable] [-s file] dmpstore [-all | (-guid guid)] [variable] [-l 
> file]
> 
> If we want to include -l and -s support with -sfo flag, then we need to define
> new SFO tables and it requires UEFI Shell spec. update. Currently non-sfo
> mode for -l and -s flags do not display variable data and current -sfo table 
> has
> variable data column defined.
> 
> We also saw that -l/-s -sfo mode suppresses error and that's confusing from
> user prospective as suppressing error does not provide enough information
> to user about what happened for an individual variable. This should be
> handled with new SFO tables for -l/-s flags and do it later after Shell spec.
> update.
> 
> Thanks,
> Tapan
> 
> -Original Message-
> From: Shah, Tapan
> Sent: Friday, November 11, 2016 11:21 AM
> To: 'Ruiyu Ni' ; edk2-devel@lists.01.org
> Cc: Chen A Chen ; Jaben Carsey
> 
> Subject: RE: [PATCH] ShellPkg/dmpstore: Support "-sfo"
> 
> Two comments:
> 1. Missing help output update for -sfo support in dmpstore command.
> 2. BinaryToHexString() is missing input parameter NULL and out of bound size
> check before access.
> 
> -Original Message-
> From: Ruiyu Ni [mailto:ruiyu...@intel.com]
> Sent: Friday, November 11, 2016 4:14 AM
> To: edk2-devel@lists.01.org
> Cc: Chen A Chen ; Jaben Carsey
> ; Shah, Tapan 
> Subject: [PATCH] ShellPkg/dmpstore: Support "-sfo"
> 
> The patch adds the "-sfo" support to "dmpstore" command.
> 
> 1. For "-l" (load variable from file), when the variable content can be 
> updated,
> the new variable data is displayed in SFO format, otherwise, the new variable
> data is not displayed. So that the SFO consumer can know which variables are
> updated by parsing the SFO.
> 
> 2. For "-d" (delete variable), when the variable can be deleted successfully,
> only the variable name and GUID are displayed in SFO but the
> attribute/data/data size are displayed as empty to indicate the deletion
> happened; otherwise, the variable is not displayed.
> 
> 3. For displaying variable, when the variable specified by name and GUID
> cannot be found, an error message is displayed; Otherwise, the SFO is
> displayed.
> E.g.: "dmpstore -guid GuidThatDoesntExist -sfo" produces output
> as:
> ShellCommand,"dmpstore"
> VariableInfo,"","GuidThatDoesntExist","","",""
> 
> "dmpstore NameThatDoesntExist -guid GuidThatDoesntExist -sfo"
> produces output as:
> ShellCommand,"dmpstore"
> dmpstore: No matching variables found. Guid GuidThatDoesntExist, Name
> NameThatDoesntExist
> 
> The difference between the above 2 cases is that former one only specifies
> the GUID, but the latter one specifies both name and GUID.
> Since not specifying GUID means to use GlobalVariableGuid, "dmpstore
> NameThatDoesntExist -sfo" produces the similar output as latter one.
> I personally prefer to always produce SFO output for both cases.
> But the above behavior is the discussion result between HPE engineers.
> 
> Signed-off-by: Ruiyu Ni 
> Signed-off-by: Chen A Chen 
> Cc: Jaben Carsey 
> Cc: Tapan Shah 
> ---
>  .../Library/UefiShellDebug1CommandsLib/DmpStore.c  | 269
> +++--
>  .../UefiShellDebug1CommandsLib.uni |   5 +
>  2 files changed, 202 insertions(+), 72 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> index 3427c99..aa8ad09 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> @@ -2,7 +2,7 @@
>Main 

[edk2] [PATCH v2] MdePkg Base.h: Update field name in VERIFY_UINTXX_ENUM_SIZE to follow style

2016-11-13 Thread Liming Gao
In V2, add comments on why uses __ prefix in enum type name.

For field name in structure, its first character should be upper case.

Cc: Michael Kinney 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao 
---
 MdePkg/Include/Base.h | 11 ---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index 5e24b5d..ce6cb07 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -63,16 +63,21 @@ VERIFY_SIZE_OF (UINT64, 8);
 VERIFY_SIZE_OF (CHAR8, 1);
 VERIFY_SIZE_OF (CHAR16, 2);
 
+//
+// Those three enum types are only used to verify compiler config is right. 
+// They are not used by any source code. So, __ prefix is added for them to 
+// avoid their name conflict with other types. 
+//
 typedef enum {
-  __VerifyUint8EnumValue = 0xff
+  VerifyUint8EnumValue = 0xff
 } __VERIFY_UINT8_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint16EnumValue = 0x
+  VerifyUint16EnumValue = 0x
 } __VERIFY_UINT16_ENUM_SIZE;
 
 typedef enum {
-  __VerifyUint32EnumValue = 0x
+  VerifyUint32EnumValue = 0x
 } __VERIFY_UINT32_ENUM_SIZE;
 
 VERIFY_SIZE_OF (__VERIFY_UINT8_ENUM_SIZE, 4);
-- 
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] ShellPkg/dmpstore: Support "-sfo"

2016-11-13 Thread Ni, Ruiyu
Comments below.

Thanks/Ray

> -Original Message-
> From: Shah, Tapan [mailto:tapands...@hpe.com]
> Sent: Saturday, November 12, 2016 1:21 AM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org
> Cc: Chen, Chen A ; Carsey, Jaben
> 
> Subject: RE: [PATCH] ShellPkg/dmpstore: Support "-sfo"
> 
> Two comments:
> 1. Missing help output update for -sfo support in dmpstore command.
Thanks for catching that. Will do that in V2 patch.
> 2. BinaryToHexString() is missing input parameter NULL and out of bound size
> check before access.
Will add assertion in V2 patch. Assertion is enough since it's internal 
function.
> 
> -Original Message-
> From: Ruiyu Ni [mailto:ruiyu...@intel.com]
> Sent: Friday, November 11, 2016 4:14 AM
> To: edk2-devel@lists.01.org
> Cc: Chen A Chen ; Jaben Carsey
> ; Shah, Tapan 
> Subject: [PATCH] ShellPkg/dmpstore: Support "-sfo"
> 
> The patch adds the "-sfo" support to "dmpstore" command.
> 
> 1. For "-l" (load variable from file), when the variable content can be 
> updated,
> the new variable data is displayed in SFO format, otherwise, the new variable
> data is not displayed. So that the SFO consumer can know which variables are
> updated by parsing the SFO.
> 
> 2. For "-d" (delete variable), when the variable can be deleted successfully,
> only the variable name and GUID are displayed in SFO but the
> attribute/data/data size are displayed as empty to indicate the deletion
> happened; otherwise, the variable is not displayed.
> 
> 3. For displaying variable, when the variable specified by name and GUID
> cannot be found, an error message is displayed; Otherwise, the SFO is
> displayed.
> E.g.: "dmpstore -guid GuidThatDoesntExist -sfo" produces output
> as:
> ShellCommand,"dmpstore"
> VariableInfo,"","GuidThatDoesntExist","","",""
> 
> "dmpstore NameThatDoesntExist -guid GuidThatDoesntExist -sfo"
> produces output as:
> ShellCommand,"dmpstore"
> dmpstore: No matching variables found. Guid GuidThatDoesntExist, Name
> NameThatDoesntExist
> 
> The difference between the above 2 cases is that former one only specifies
> the GUID, but the latter one specifies both name and GUID.
> Since not specifying GUID means to use GlobalVariableGuid, "dmpstore
> NameThatDoesntExist -sfo" produces the similar output as latter one.
> I personally prefer to always produce SFO output for both cases.
> But the above behavior is the discussion result between HPE engineers.
> 
> Signed-off-by: Ruiyu Ni 
> Signed-off-by: Chen A Chen 
> Cc: Jaben Carsey 
> Cc: Tapan Shah 
> ---
>  .../Library/UefiShellDebug1CommandsLib/DmpStore.c  | 269
> +++--
>  .../UefiShellDebug1CommandsLib.uni |   5 +
>  2 files changed, 202 insertions(+), 72 deletions(-)
> 
> diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> index 3427c99..aa8ad09 100644
> --- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> +++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
> @@ -2,7 +2,7 @@
>Main file for DmpStore shell Debug1 function.
> 
>(C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
> -  Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
> +  Copyright (c) 2005 - 2016, 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 @@ -82,12 +82,46 @@ GetAttrType (  }
> 
>  /**
> +  Convert binary to hex format string.
> +
> +  @param[in]  BufferSizeThe size in bytes of the binary data.
> +  @param[in]  BufferThe binary data.
> +  @param[in, out] HexString Hex format string.
> +  @param[in]  HexStringSize The size in bytes of the string.
> +
> +  @return The hex format string.
> +**/
> +CHAR16*
> +BinaryToHexString (
> +  IN VOID*Buffer,
> +  IN UINTN   BufferSize,
> +  IN OUT CHAR16  *HexString,
> +  IN UINTN   HexStringSize
> +  )
> +{
> +  UINTN Index;
> +  UINTN StringIndex;
> +
> +  for (Index = 0, StringIndex = 0; Index < BufferSize; Index += 1) {
> +StringIndex +=
> +  UnicodeSPrint (
> +[StringIndex],
> +HexStringSize - StringIndex * sizeof (CHAR16),
> +L"%02x",
> +((UINT8 *) Buffer)[Index]
> +);
> +  }
> +  return HexString;
> +}
> +
> +/**
>Load the variable data from file and set to variable data base.
> 
> -  @param[in]  FileHandle The file to be read.
> -  @param[in]  Name   The name of the variables to be loaded.
> -  @param[in]  Guid   The guid of the variables to be loaded.
> -  @param[out] Found  TRUE when at 

[edk2] [PATCH v2] ShellPkg/dmpstore: Support "-sfo"

2016-11-13 Thread Ruiyu Ni
The patch adds the "-sfo" support to "dmpstore" command.

When -l or -d is specified, -sfo is not supported.

When the variable specified by name and GUID cannot be found,
an error message is displayed; Otherwise, the SFO is displayed.
E.g.: "dmpstore -guid GuidThatDoesntExist -sfo" produces output
as:
ShellCommand,"dmpstore"
VariableInfo,"","GuidThatDoesntExist","","",""

"dmpstore NameThatDoesntExist -guid GuidThatDoesntExist -sfo"
produces output as:
ShellCommand,"dmpstore"
dmpstore: No matching variables found. Guid GuidThatDoesntExist, Name
NameThatDoesntExist

The difference between the above 2 cases is that former one only
specifies the GUID, but the latter one specifies both name and GUID.
Since not specifying GUID means to use GlobalVariableGuid,
"dmpstore NameThatDoesntExist -sfo" produces the similar output as
latter one.
I personally prefer to always produce SFO output for both cases.
But the above behavior is the discussion result between HPE engineers.

Signed-off-by: Ruiyu Ni 
Signed-off-by: Chen A Chen 
Cc: Jaben Carsey 
Cc: Tapan Shah 
---
 .../Library/UefiShellDebug1CommandsLib/DmpStore.c  | 207 +++--
 .../UefiShellDebug1CommandsLib.uni |   8 +-
 2 files changed, 154 insertions(+), 61 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c 
b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
index 3427c99..7133881 100644
--- a/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
+++ b/ShellPkg/Library/UefiShellDebug1CommandsLib/DmpStore.c
@@ -2,7 +2,7 @@
   Main file for DmpStore shell Debug1 function.

   (C) Copyright 2013-2015 Hewlett-Packard Development Company, L.P.
-  Copyright (c) 2005 - 2015, Intel Corporation. All rights reserved.
+  Copyright (c) 2005 - 2016, 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
@@ -82,6 +82,42 @@ GetAttrType (
 }
 
 /**
+  Convert binary to hex format string.
+
+  @param[in]  BufferSizeThe size in bytes of the binary data.
+  @param[in]  BufferThe binary data.
+  @param[in, out] HexString Hex format string.
+  @param[in]  HexStringSize The size in bytes of the string.
+
+  @return The hex format string.
+**/
+CHAR16*
+BinaryToHexString (
+  IN VOID*Buffer,
+  IN UINTN   BufferSize,
+  IN OUT CHAR16  *HexString,
+  IN UINTN   HexStringSize
+  )
+{
+  UINTN Index;
+  UINTN StringIndex;
+
+  ASSERT (Buffer != NULL);
+  ASSERT ((BufferSize * 2 + 1) * sizeof (CHAR16) <= HexStringSize);
+
+  for (Index = 0, StringIndex = 0; Index < BufferSize; Index += 1) {
+StringIndex +=
+  UnicodeSPrint (
+[StringIndex],
+HexStringSize - StringIndex * sizeof (CHAR16),
+L"%02x",
+((UINT8 *) Buffer)[Index]
+);
+  }
+  return HexString;
+}
+
+/**
   Load the variable data from file and set to variable data base.
 
   @param[in]  FileHandle The file to be read.
@@ -350,14 +386,15 @@ AppendSingleVariableToFile (
 
   This is necessary since once a delete happens GetNextVariableName() will 
work.
 
-  @param[in] Name   The variable name of the EFI variable (or NULL).
-  @param[in] Guid   The GUID of the variable set (or NULL).
-  @param[in] Type   The operation type.
-  @param[in] FileHandle The file to operate on (or NULL).
-  @param[in] PrevName   The previous variable name from 
GetNextVariableName. L"" to start.
-  @param[in] FoundVarGuid   The previous GUID from GetNextVariableName. 
ignored at start.
-  @param[in] FoundOne   If a VariableName or Guid was specified and one 
was printed or
-deleted, then set this to TRUE, otherwise ignored.
+  @param[in] Name The variable name of the EFI variable (or 
NULL).
+  @param[in] Guid The GUID of the variable set (or NULL).
+  @param[in] Type The operation type.
+  @param[in] FileHandle   The file to operate on (or NULL).
+  @param[in] PrevName The previous variable name from 
GetNextVariableName. L"" to start.
+  @param[in] FoundVarGuid The previous GUID from GetNextVariableName. 
ignored at start.
+  @param[in] FoundOne If a VariableName or Guid was specified and 
one was printed or
+  deleted, then set this to TRUE, otherwise 
ignored.
+  @param[in] StandardFormatOutput TRUE indicates Standard-Format Output.
 
   @retval SHELL_SUCCESS   The operation was successful.
   @retval SHELL_OUT_OF_RESOURCES  A memorty allocation failed.
@@ -373,7 +410,8 @@ CascadeProcessVariables (
   IN EFI_FILE_PROTOCOL *FileHandle  OPTIONAL,
   IN CONST CHAR16  * CONST PrevName,
   IN EFI_GUID

Re: [edk2] USB hub port reset

2016-11-13 Thread Tian, Feng
Hi, Baranee

Linux wait 10 + 40 ms (TRSTRCY = 10 ms, plus extra 40 ms). Do you mean EDKII 
should be same with linux to wait more time?

Thanks
Feng

From: Anbazhagan, Baraneedharan [mailto:anbazha...@hp.com]
Sent: Sunday, November 13, 2016 11:53 AM
To: edk2-devel@lists.01.org; Tian, Feng 
Subject: USB hub port reset

EDK2 have reset recovery time of 10ms for hub port based on port status reset 
bit but USB spec doesn't mention that port status can be used for t6/reset 
recovery time. Could you please clarify?

USB vendor mentions EDK2 doesn't have reset recovery time on hub port reset and 
also highlighting EDK2 hub port reset differs from 
https://github.com/torvalds/linux/blob/master/drivers/usb/core/hub.c#L2789

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


Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on unaligned FvImage issue

2016-11-13 Thread Yao, Jiewen
Ah, yes. Definitely.

I think it is a good idea to catch such issue as early as possible.

Thank you
Yao Jiewen

From: Kinney, Michael D
Sent: Monday, November 14, 2016 9:41 AM
To: Yao, Jiewen ; Zeng, Star ; 
edk2-devel@lists.01.org; Kinney, Michael D 
Cc: Yao, Jiewen ; Gao, Liming ; 
Zeng, Star 
Subject: RE: [PATCH] MdeModulePkg DxeCore: Show error message on unaligned 
FvImage issue

Jiewen,

Do you think it would be a good idea to add a similar DEBUG()
message in the HobLib when an FV HOBs are created?  There are
other ways FV HOBs can be created, so I think the DEBUG() message
in this patch is very important, but getting a message when
the an FV HOB is created will make fixing the issue easier.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yao,
> Jiewen
> Sent: Sunday, November 13, 2016 5:28 PM
> To: Zeng, Star >; 
> edk2-devel@lists.01.org
> Cc: Yao, Jiewen >; Gao, 
> Liming >; Zeng,
> Star >
> Subject: Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on 
> unaligned
> FvImage issue
>
> Reviewed-by: jiewen@intel.com
>
> >
> >
> > -Original Message-
> > From: Zeng, Star
> > Sent: Friday, November 11, 2016 1:59 PM
> > To: edk2-devel@lists.01.org
> > Cc: Zeng, Star >; Yao, 
> > Jiewen >;
> > Gao, Liming >
> > Subject: [PATCH] MdeModulePkg DxeCore: Show error message on
> > unaligned FvImage issue
> >
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> >
> > Cc: Jiewen Yao >
> > Cc: Liming Gao >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Star Zeng >
> > ---
> >  MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > index f031ef110c19..bc7b34140f84 100644
> > --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > @@ -4,7 +4,7 @@
> >It consumes FV HOBs and creates read-only Firmare Volume Block
> > protocol
> >instances for each of them.
> >
> > -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> > +Copyright (c) 2006 - 2016, 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
> > @@ -495,6 +495,13 @@ ProduceFVBProtocolOnBuffer (
> >//
> >// FvImage buffer is not at its required alignment.
> >//
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"Unaligned FvImage found at 0x%lx:0x%lx, the required
> > alignment is 0x%x\n",
> > +BaseAddress,
> > +Length,
> > +FvAlignment
> > +));
> >return EFI_VOLUME_CORRUPTED;
> >  }
> >}
> > --
> > 2.7.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 v2 0/3] Put AP into safe hlt-loop code on S3 path

2016-11-13 Thread Yao, Jiewen
Yes. I think it is good to check in because it did fix an existing issue.
I suggest we describe the remaining issue honestly in our checkin log.

Thank you
Yao Jiewen

From: Fan, Jeff
Sent: Sunday, November 13, 2016 8:52 PM
To: Laszlo Ersek 
Cc: edk2-de...@ml01.01.org; Yao, Jiewen ; Paolo Bonzini 

Subject: RE: [edk2] [PATCH v2 0/3] Put AP into safe hlt-loop code on S3 path

Laszlo,

Thanks your testing. It seems that there is still some unknown issue existing.

I suggest to push this serial of patches firstly, because they have big 
progress to solve the AP crashed issue in 
https://bugzilla.tianocore.org/show_bug.cgi?id=216.

I could submit another bug to handle "AP lost" issue.  Thus, JIewen's  or 
others' patches could be push as long as they have no additional issue except 
for "AP Lost:".

I could follow up to fix "AP Lost" issue.

Thanks!
Jeff


-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com]
Sent: Saturday, November 12, 2016 3:49 AM
To: Fan, Jeff
Cc: edk2-de...@ml01.01.org; Yao, Jiewen; Paolo 
Bonzini
Subject: Re: [edk2] [PATCH v2 0/3] Put AP into safe hlt-loop code on S3 path

On 11/11/16 06:45, Jeff Fan wrote:
> On S3 path, we will wake up APs to restore CPU context in
> PiSmmCpuDxeSmm driver. In case, one NMI or SMI happens, APs may exit
> from hlt state and execute the instruction after HLT instruction.
>
> But APs are not running on safe code, it leads OVMF S3 boot unstable.
>
> https://bugzilla.tianocore.org/show_bug.cgi?id=216
>
> I tested real platform with 64bit DXE.
>
> v2:
>   1. Make stack alignment per Laszlo's comment.
>   2. Trim whitespace at end of end per Laszlo's comment.
>   3. Update year mark in file header.
>   4. Enhancement on InterlockedDecrement() per Paolo's comment.
>
> Jeff Fan (3):
>   UefiCpuPkg/PiSmmCpuDxeSmm: Put AP into safe hlt-loop code on S3 path
>   UefiCpuPkg/PiSmmCpuDxeSmm: Place AP to 32bit protected mode on S3 path
>   UefiCpuPkg/PiSmmCpuDxeSmm: Decrease mNumberToFinish in AP safe code
>
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 33 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 29 +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h| 15 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c  | 63
> ++-
>  4 files changed, 136 insertions(+), 4 deletions(-)
>

Applied this locally to master (ffd6b0b1b65e) for testing. I tested the series 
with a suspend-resume loop -- not a busy loop, just manually. (So there was 
always one second or so between adjacent steps.)

No crashes or emulation failures, but the "AP going lost" issue remains present 
-- sometimes Linux cannot bring up one of the four VCPUs after resume.

In the Ia32 case, this "AP lost" symptom surfaced after the 6th resume.

In the Ia32X64 case, I experienced the symptom after the 89th resume.

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


Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on unaligned FvImage issue

2016-11-13 Thread Kinney, Michael D
Jiewen,

Do you think it would be a good idea to add a similar DEBUG()
message in the HobLib when an FV HOBs are created?  There are 
other ways FV HOBs can be created, so I think the DEBUG() message
in this patch is very important, but getting a message when
the an FV HOB is created will make fixing the issue easier.

Thanks,

Mike

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yao,
> Jiewen
> Sent: Sunday, November 13, 2016 5:28 PM
> To: Zeng, Star ; edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Gao, Liming ; 
> Zeng,
> Star 
> Subject: Re: [edk2] [PATCH] MdeModulePkg DxeCore: Show error message on 
> unaligned
> FvImage issue
> 
> Reviewed-by: jiewen@intel.com
> 
> >
> >
> > -Original Message-
> > From: Zeng, Star
> > Sent: Friday, November 11, 2016 1:59 PM
> > To: edk2-devel@lists.01.org
> > Cc: Zeng, Star ; Yao, Jiewen ;
> > Gao, Liming 
> > Subject: [PATCH] MdeModulePkg DxeCore: Show error message on
> > unaligned FvImage issue
> >
> > Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> >
> > Cc: Jiewen Yao 
> > Cc: Liming Gao 
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Star Zeng 
> > ---
> >  MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 9 -
> >  1 file changed, 8 insertions(+), 1 deletion(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > index f031ef110c19..bc7b34140f84 100644
> > --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> > @@ -4,7 +4,7 @@
> >It consumes FV HOBs and creates read-only Firmare Volume Block
> > protocol
> >instances for each of them.
> >
> > -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> > +Copyright (c) 2006 - 2016, 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
> > @@ -495,6 +495,13 @@ ProduceFVBProtocolOnBuffer (
> >//
> >// FvImage buffer is not at its required alignment.
> >//
> > +  DEBUG ((
> > +DEBUG_ERROR,
> > +"Unaligned FvImage found at 0x%lx:0x%lx, the required
> > alignment is 0x%x\n",
> > +BaseAddress,
> > +Length,
> > +FvAlignment
> > +));
> >return EFI_VOLUME_CORRUPTED;
> >  }
> >}
> > --
> > 2.7.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 0/2] Place APs to suitable state on Legacy OS boot

2016-11-13 Thread Tian, Feng
Reviewed-by: Feng Tian 

Thanks
Feng

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Jeff Fan
Sent: Friday, November 11, 2016 7:58 PM
To: edk2-de...@ml01.01.org
Subject: [edk2] [PATCH 0/2] Place APs to suitable state on Legacy OS boot

Currently, DxeMpLib only places APs into specified c-state in Exit Boot Service 
callback function for UEFI OS boot. We need to put APs into specified c-state 
for legacy OS boot also.

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

Jeff Fan (2):
  UefiCpuPkg/DxeMpLib: Rename MpInitExitBootServicesCallback()
  UefiCpuPkg/DxeMpLib: Place APs to suitable state on Legacy OS boot

 UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf |  1 +
 UefiCpuPkg/Library/MpInitLib/DxeMpLib.c   | 18 +++---
 2 files changed, 16 insertions(+), 3 deletions(-)

--
2.9.3.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] MdeModulePkg DxeCore: Show error message on unaligned FvImage issue

2016-11-13 Thread Yao, Jiewen
Reviewed-by: jiewen@intel.com

> 
> 
> -Original Message-
> From: Zeng, Star
> Sent: Friday, November 11, 2016 1:59 PM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Yao, Jiewen ;
> Gao, Liming 
> Subject: [PATCH] MdeModulePkg DxeCore: Show error message on
> unaligned FvImage issue
> 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=205
> 
> Cc: Jiewen Yao 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Star Zeng 
> ---
>  MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c | 9 -
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> index f031ef110c19..bc7b34140f84 100644
> --- a/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> +++ b/MdeModulePkg/Core/Dxe/FwVolBlock/FwVolBlock.c
> @@ -4,7 +4,7 @@
>It consumes FV HOBs and creates read-only Firmare Volume Block
> protocol
>instances for each of them.
> 
> -Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2016, 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
> @@ -495,6 +495,13 @@ ProduceFVBProtocolOnBuffer (
>//
>// FvImage buffer is not at its required alignment.
>//
> +  DEBUG ((
> +DEBUG_ERROR,
> +"Unaligned FvImage found at 0x%lx:0x%lx, the required
> alignment is 0x%x\n",
> +BaseAddress,
> +Length,
> +FvAlignment
> +));
>return EFI_VOLUME_CORRUPTED;
>  }
>}
> --
> 2.7.0.windows.1

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


Re: [edk2] [PATCH v2 0/3] Put AP into safe hlt-loop code on S3 path

2016-11-13 Thread Fan, Jeff
Laszlo,

Thanks your testing. It seems that there is still some unknown issue existing.

I suggest to push this serial of patches firstly, because they have big 
progress to solve the AP crashed issue in 
https://bugzilla.tianocore.org/show_bug.cgi?id=216.

I could submit another bug to handle "AP lost" issue.  Thus, JIewen's  or 
others' patches could be push as long as they have no additional issue except 
for "AP Lost:".

I could follow up to fix "AP Lost" issue.

Thanks!
Jeff


-Original Message-
From: Laszlo Ersek [mailto:ler...@redhat.com] 
Sent: Saturday, November 12, 2016 3:49 AM
To: Fan, Jeff
Cc: edk2-de...@ml01.01.org; Yao, Jiewen; Paolo Bonzini
Subject: Re: [edk2] [PATCH v2 0/3] Put AP into safe hlt-loop code on S3 path

On 11/11/16 06:45, Jeff Fan wrote:
> On S3 path, we will wake up APs to restore CPU context in 
> PiSmmCpuDxeSmm driver. In case, one NMI or SMI happens, APs may exit 
> from hlt state and execute the instruction after HLT instruction.
> 
> But APs are not running on safe code, it leads OVMF S3 boot unstable.
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=216
> 
> I tested real platform with 64bit DXE.
> 
> v2:
>   1. Make stack alignment per Laszlo's comment.
>   2. Trim whitespace at end of end per Laszlo's comment.
>   3. Update year mark in file header.
>   4. Enhancement on InterlockedDecrement() per Paolo's comment.
> 
> Jeff Fan (3):
>   UefiCpuPkg/PiSmmCpuDxeSmm: Put AP into safe hlt-loop code on S3 path
>   UefiCpuPkg/PiSmmCpuDxeSmm: Place AP to 32bit protected mode on S3 path
>   UefiCpuPkg/PiSmmCpuDxeSmm: Decrease mNumberToFinish in AP safe code
> 
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 33 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/SmmFuncsArch.c | 29 +++-
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h| 15 +++
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmmFuncsArch.c  | 63 
> ++-
>  4 files changed, 136 insertions(+), 4 deletions(-)
> 

Applied this locally to master (ffd6b0b1b65e) for testing. I tested the series 
with a suspend-resume loop -- not a busy loop, just manually. (So there was 
always one second or so between adjacent steps.)

No crashes or emulation failures, but the "AP going lost" issue remains present 
-- sometimes Linux cannot bring up one of the four VCPUs after resume.

In the Ia32 case, this "AP lost" symptom surfaced after the 6th resume.

In the Ia32X64 case, I experienced the symptom after the 89th resume.

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