Re: [edk2] [PATCH v1 13/18] StandaloneMmPkg/Core: Implementation of Standalone MM Core Module.

2018-05-01 Thread Laszlo Ersek
On 04/30/18 21:28, Ard Biesheuvel wrote:
> On 30 April 2018 at 21:19, Achin Gupta  wrote:
>> Hi Supreeth,
>>
>> I think it is worth adding a signed off by Jiewen since he originally
>> contributed the code and it has not changed much since.
> 
> I disagree. A signoff does not assert authorship, it only means that
> the contributor asserts that the license permits him to contribute
> this code under the tianocore contribution agreement. Adding a signoff
> on behalf of someone else should be avoided in my opinion, because it
> suggests that code can only be contributed by the original author.
> Also, even if the author made the code available under a compatible
> license, it does not mean he subscribes to the Tianocore contribution
> agreement, and adding a signoff on behalf of someone else does imply
> that (although this should not be a problem in this particular case)
> 
> Anyone can contribute code that is available under a compatible
> license, and it is not generally possible to decide who should be
> credited as authors for code that originates in other projects.
> 
> If you want to credit the author, you can do that in the commit log.

Right, this is consistent with Ard's earlier explanation of the subject
-- it's something that's proved surprisingly difficult for me to
remember as well. Thankfully Ard keeps us in check :)

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


[edk2] [PATCH edk2-platforms] Platform/Socionext/DeveloperBox: reduce default timeout to 5 seconds

2018-05-01 Thread Ard Biesheuvel
The default timeout value for the delay during which the splash screen
is shown and the BDS menu can be entered is still at 30 seconds, which
is rather long. Reduce it to 5 seconds instead.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
index 1731843e825c..676f3483bfe9 100644
--- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
+++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
@@ -436,7 +436,7 @@ [PcdsDynamicExDefault.common.DEFAULT]
   gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0xe5, 
0x4c, 0xb9, 0x50, 0x63, 0x8b, 0x49, 0x48, 0x8a, 0xf4, 0xea, 0x47, 0x93, 0x56, 
0xf0, 0xe3}
 
 [PcdsDynamicHii]
-  
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|30
+  
gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
 
   
gSynQuacerTokenSpaceGuid.PcdPlatformSettings|L"SynQuacerPlatformSettings"|gSynQuacerPlatformFormSetGuid|0x0|0x0|NV,BS
 
-- 
2.17.0

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


Re: [edk2] [PATCH edk2-platforms v1] Platform/ARM: Map Platform Boot Timeout PCD to global NV variable

2018-05-01 Thread Ard Biesheuvel
On 30 April 2018 at 18:29, Alexei Fedorov  wrote:
> From: Alexei Fedorov 
>
> Table 13 of UEFI Specification 2.7A describes Timeout
> global variable as NV (non-volatile), however
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut
> is defined in [PcdsFixedAtBuild.common] section of
> edk2-platforms\Platform\ARM\VExpressPkg\ArmVExpress.dsc.inc.
> This prevents Timeout value from being persistent across
> resets and power cycles, see BdsEntry() code
> in MdeModulePkg\Universal\BdsDxe\BdsEntry.c:
>   //
>   // Initialize L"Timeout" EFI global variable.
>   //
>   BootTimeOut = PcdGet16 (PcdPlatformBootTimeOut);
>
> This patch fixes the above issue by mapping PcdPlatformBootTimeOut
> to global NV variable "Timeout":
> [PcdsDynamicHii.common.DEFAULT]
>   
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
>
> Change-Id: I8ab8854c0789da206bf821391c67007259e48361
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Alexei Fedorov 
> Reviewed-by:   Evan Lloyd 

Reviewed-by: Ard Biesheuvel 

Pushed as ada17bc975be79620c126ae9a856e45c866f5701

Thanks!

> ---
> All the changes can be reviewed at:
> https://github.com/AlexeiFedorov/edk2-platforms/tree/202_timeout_value_v1
>
> Notes:
> v1:
> - Map PcdPlatformBootTimeOut to global NV Timeout variable [Alexei]
>
>  Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc | 7 ---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc 
> b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> index 
> 7cb47937329efa1944ec4c156e2be995a755ce6f..de201b0c81d020e1e06ee320cf0f14f186723657
>  100644
> --- a/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> +++ b/Platform/ARM/VExpressPkg/ArmVExpress.dsc.inc
> @@ -1,5 +1,5 @@
>  #
> -#  Copyright (c) 2011-2015, ARM Limited. All rights reserved.
> +#  Copyright (c) 2011-2018, ARM Limited. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions of the BSD 
> License
> @@ -353,8 +353,6 @@ [PcdsFixedAtBuild.common]
># List of Device Paths that support BootMonFs
>
> gArmBootMonFsTokenSpaceGuid.PcdBootMonFsSupportedDevicePaths|L"VenHw(E7223039-5836-41E1-B542-D7EC736C5E59);VenHw(1F15DA3C-37FF-4070-B471-BB4AF12A724A)"
>
> -  gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|10
> -
># RunAxf support via Dynamic Shell Command protocol
># We want to use the Shell Libraries but don't want it to initialise
># automatically. We initialise the libraries when the command is called by 
> the
> @@ -399,6 +397,9 @@ [PcdsFixedAtBuild.common]
>#
>gEfiMdeModulePkgTokenSpaceGuid.PcdSetNxForStack|TRUE
>
> +[PcdsDynamicHii.common.DEFAULT]
> +  
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|10
> +
>  [Components.common]
>MdeModulePkg/Universal/PCD/Dxe/Pcd.inf {
>  
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms] Platform/Socionext/DeveloperBox: reduce default timeout to 5 seconds

2018-05-01 Thread Leif Lindholm
On Tue, May 01, 2018 at 01:35:40PM +0200, Ard Biesheuvel wrote:
> The default timeout value for the delay during which the splash screen
> is shown and the BDS menu can be entered is still at 30 seconds, which
> is rather long. Reduce it to 5 seconds instead.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  Platform/Socionext/DeveloperBox/DeveloperBox.dsc | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> index 1731843e825c..676f3483bfe9 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> @@ -436,7 +436,7 @@ [PcdsDynamicExDefault.common.DEFAULT]
>gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{0xe5, 
> 0x4c, 0xb9, 0x50, 0x63, 0x8b, 0x49, 0x48, 0x8a, 0xf4, 0xea, 0x47, 0x93, 0x56, 
> 0xf0, 0xe3}
>  
>  [PcdsDynamicHii]
> -  
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|30
> +  
> gEfiMdePkgTokenSpaceGuid.PcdPlatformBootTimeOut|L"Timeout"|gEfiGlobalVariableGuid|0x0|5
>  
>
> gSynQuacerTokenSpaceGuid.PcdPlatformSettings|L"SynQuacerPlatformSettings"|gSynQuacerPlatformFormSetGuid|0x0|0x0|NV,BS
>  
> -- 
> 2.17.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v2 3/8] MdeModulePkg/DxeCorePerformanceLib:Track FPDT record in DXE phase

2018-05-01 Thread Ard Biesheuvel
On 30 January 2018 at 14:53, Dandan Bi  wrote:
> V2:
> Update DxecorePerformanceLib to report the boot performance table
> address instead of records contents.
>
> Updated to convert Pref entry to FPDT record in DXE phase and then
> allocate boot performance table to save the record and report
> the address of boot performance table to FirmwarePerformanceDxe.
>
> Cc: Liming Gao 
> Cc: Star Zeng 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Dandan Bi 
> ---
>  .../DxeCorePerformanceLib/DxeCorePerformanceLib.c  | 1389 
> +++-
>  .../DxeCorePerformanceLib.inf  |   20 +-
>  .../DxeCorePerformanceLibInternal.h|   17 +-
>  3 files changed, 1108 insertions(+), 318 deletions(-)
>
> diff --git 
> a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c 
> b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> index 7c0e207..c6f8a16 100644
> --- a/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> +++ b/MdeModulePkg/Library/DxeCorePerformanceLib/DxeCorePerformanceLib.c
> @@ -8,11 +8,11 @@
>which are consumed by DxePerformanceLib to logging performance data in DXE 
> phase.
>
>This library is mainly used by DxeCore to start performance logging to 
> ensure that
>Performance Protocol is installed at the very beginning of DXE phase.
>
> -Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
>  (C) Copyright 2016 Hewlett Packard Enterprise Development LP
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
>  http://opensource.org/licenses/bsd-license.php
> @@ -23,27 +23,65 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  **/
>
>
>  #include "DxeCorePerformanceLibInternal.h"
>
> -
>  //
> -// The data structure to hold global performance data.
> +// Data for FPDT performance records.
>  //
> -GAUGE_DATA_HEADER*mGaugeData;
> +#define SMM_BOOT_RECORD_COMM_SIZE (OFFSET_OF (EFI_SMM_COMMUNICATE_HEADER, 
> Data) + sizeof(SMM_BOOT_RECORD_COMMUNICATE))
> +#define STRING_SIZE (EDKII_STRING_EVENT_RECORD_NAME_LENGTH * 
> sizeof (CHAR8))
> +#define MAX_RECORD_SIZE (sizeof (DYNAMIC_STRING_EVENT_RECORD) + 
> STRING_SIZE)
> +#define FIRMWARE_RECORD_BUFFER  0x1
> +#define CACHE_HANDLE_GUID_COUNT 0x1000
> +
> +BOOT_PERFORMANCE_TABLE  *mAcpiBootPerformanceTable = NULL;
> +BOOT_PERFORMANCE_TABLE  mBootPerformanceTableTemplate = {
> +  {
> +EFI_ACPI_5_0_FPDT_BOOT_PERFORMANCE_TABLE_SIGNATURE,
> +sizeof (BOOT_PERFORMANCE_TABLE)
> +  },
> +  {
> +{
> +  EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_TYPE_FIRMWARE_BASIC_BOOT,// Type
> +  sizeof (EFI_ACPI_5_0_FPDT_FIRMWARE_BASIC_BOOT_RECORD),// Length
> +  EFI_ACPI_5_0_FPDT_RUNTIME_RECORD_REVISION_FIRMWARE_BASIC_BOOT // 
> Revision
> +},
> +0,  // Reserved
> +//
> +// These values will be updated at runtime.
> +//
> +0,  // ResetEnd
> +0,  // OsLoaderLoadImageStart
> +0,  // OsLoaderStartImageStart
> +0,  // ExitBootServicesEntry
> +0   // ExitBootServicesExit
> +  }
> +};
>
> -//
> -// The current maximum number of logging entries. If current number of
> -// entries exceeds this value, it will re-allocate a larger array and
> -// migration the old data to the larger array.
> -//
> -UINT32   mMaxGaugeRecords;
> +typedef struct {
> +  EFI_HANDLEHandle;
> +  CHAR8 NameString[EDKII_STRING_EVENT_RECORD_NAME_LENGTH];
> +  EFI_GUID  ModuleGuid;
> +} HANDLE_GUID_MAP;
>
> -//
> -// The handle to install Performance Protocol instance.
> -//
> -EFI_HANDLE   mHandle = NULL;
> +HANDLE_GUID_MAP mCacheHandleGuidTable[CACHE_HANDLE_GUID_COUNT];
> +UINTN   mCachePairCount = 0;
> +
> +UINT32  mLoadImageCount   = 0;
> +UINT32  mPerformanceLength= 0;
> +UINT32  mMaxPerformanceLength = 0;
> +UINT32  mBootRecordSize   = 0;
> +UINT32  mBootRecordMaxSize= 0;
> +
> +BOOLEAN mFpdtBufferIsReported = FALSE;
> +BOOLEAN mLackSpaceIsReported  = FALSE;
> +CHAR8   *mPlatformLanguage= NULL;
> +UINT8   *mPerformancePointer  = NULL;
> +UINT8   *mBootRecordBuffer= NULL;
> +
> +EFI_DEVICE_PATH_TO_TEXT_PROTOCOL  *mDevicePathToText = NULL;
>
>  //
>  // Interfaces for Performance Protocol.
>  //
>  PERFORMANCE_PROTOCOL mPerformanceInterface = {
> @@ -61,179 +99,1069 @@ PERFORMANCE_EX_PROTOCOL mPerformanceExInterface = {
>GetGaugeEx
>};
>
>  PERFORMANCE_PROPERTY  mPerformanceProperty;
>
> -//
> -//  Gauge record lock to avoid data corruption or even memory overflow
> -//
> -STATIC EFI_LOCK mPerfRecordLock = EFI_INITIALIZE_LOCK_VARIABLE (TPL_NOTIFY);
> +/**
> +Check whether the Token is a known one which is uesed by core.
> +
> +@par

[edk2] [PATCH edk2-platforms] Silicon/AMD/Styx/AcpiTables: fix wrongly copy/pasted variable name

2018-05-01 Thread Ard Biesheuvel
Rename the variable holding the Styx PPTT table to mStyxPpttTable.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Silicon/AMD/Styx/AcpiTables/Pptt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Silicon/AMD/Styx/AcpiTables/Pptt.c 
b/Silicon/AMD/Styx/AcpiTables/Pptt.c
index d9d7c494d86f..1746bbe8b596 100644
--- a/Silicon/AMD/Styx/AcpiTables/Pptt.c
+++ b/Silicon/AMD/Styx/AcpiTables/Pptt.c
@@ -156,7 +156,7 @@ typedef struct {
   }   \
 }
 
-STATIC STYX_PPTT_TABLE mSynQuacerPpttTable = {
+STATIC STYX_PPTT_TABLE mStyxPpttTable = {
   {
 
AMD_ACPI_HEADER(EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
 STYX_PPTT_TABLE,
@@ -221,5 +221,5 @@ PpttHeader (
   VOID
   )
 {
-  return (EFI_ACPI_DESCRIPTION_HEADER *)&mSynQuacerPpttTable.Pptt.Header;
+  return (EFI_ACPI_DESCRIPTION_HEADER *)&mStyxPpttTable.Pptt.Header;
 }
-- 
2.17.0

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


Re: [edk2] [PATCH edk2-platforms] Silicon/AMD/Styx/AcpiTables: fix wrongly copy/pasted variable name

2018-05-01 Thread Leif Lindholm
On Tue, May 01, 2018 at 06:32:44PM +0200, Ard Biesheuvel wrote:
> Rename the variable holding the Styx PPTT table to mStyxPpttTable.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  Silicon/AMD/Styx/AcpiTables/Pptt.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/Silicon/AMD/Styx/AcpiTables/Pptt.c 
> b/Silicon/AMD/Styx/AcpiTables/Pptt.c
> index d9d7c494d86f..1746bbe8b596 100644
> --- a/Silicon/AMD/Styx/AcpiTables/Pptt.c
> +++ b/Silicon/AMD/Styx/AcpiTables/Pptt.c
> @@ -156,7 +156,7 @@ typedef struct {
>}  
>  \
>  }
>  
> -STATIC STYX_PPTT_TABLE mSynQuacerPpttTable = {
> +STATIC STYX_PPTT_TABLE mStyxPpttTable = {
>{
>  
> AMD_ACPI_HEADER(EFI_ACPI_6_2_PROCESSOR_PROPERTIES_TOPOLOGY_TABLE_STRUCTURE_SIGNATURE,
>  STYX_PPTT_TABLE,
> @@ -221,5 +221,5 @@ PpttHeader (
>VOID
>)
>  {
> -  return (EFI_ACPI_DESCRIPTION_HEADER *)&mSynQuacerPpttTable.Pptt.Header;
> +  return (EFI_ACPI_DESCRIPTION_HEADER *)&mStyxPpttTable.Pptt.Header;
>  }
> -- 
> 2.17.0
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] Set "db" variable in secure boot setup mode still requires generating PKCS#7?

2018-05-01 Thread David F.
Hi,

Had a fairly simple task of wanting to install the latest MS .crt
files for KEK, and their two files for the "db" (the Windows CA and
UEFI CA) in a system placed in setup/custom mode.  However, even
though it seemed to take the KEK, it never took the "db", always had a
problem on a DH77KC mobo (dumped data headers looked as expected).
Now when I constructed it, I thought I could leave out any PKCS#7 data
(set the expected CertType but in the Hdr dwLength only included
CertType and not any CertData), but looking at the algo in UEFI Spec
2.6 page 245, it looks like we'd always have to generate the hash,
sign it, create all the PKCS stuff even in setup mode?That would
surely unnecessarily bloat any apps that really only need to update
things in setup mode wouldn't it?   So to confirm, that is a
requirement even in setup mode?If so, why?

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


Re: [edk2] Set "db" variable in secure boot setup mode still requires generating PKCS#7?

2018-05-01 Thread Bill Paul
Of all the gin joints in all the towns in all the world, David F. had to walk 
into mine at 14:13 on Tuesday 01 May 2018 and say:

> Hi,
> 
> Had a fairly simple task of wanting to install the latest MS .crt
> files for KEK, and their two files for the "db" (the Windows CA and
> UEFI CA) in a system placed in setup/custom mode.  However, even
> though it seemed to take the KEK, it never took the "db", always had a
> problem on a DH77KC mobo (dumped data headers looked as expected).
> Now when I constructed it, I thought I could leave out any PKCS#7 data
> (set the expected CertType but in the Hdr dwLength only included
> CertType and not any CertData), but looking at the algo in UEFI Spec
> 2.6 page 245, it looks like we'd always have to generate the hash,
> sign it, create all the PKCS stuff even in setup mode?That would
> surely unnecessarily bloat any apps that really only need to update
> things in setup mode wouldn't it?   So to confirm, that is a
> requirement even in setup mode?If so, why?
>

If I understand correctly, I think the issue is that the PK, KEK, db and dbx 
are always considered to be secure environment variables, which means when you 
try to update them with SetVariable(), you always have to include one of the 
authentication flags and a properly formated authentication header.

The difference between variable updates in secure mode vs. setup/custom mode 
is that in setup/custom mode, the signature is not validated. It still has to 
be there, but the firmware doesn't care what it says. So the db update could 
be signed with a completely different KEK than the one loaded into the KEK 
variable, and it would still be accepted.

-Bill



> TIA!!
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
-- 
=
-Bill Paul(510) 749-2329 | Senior Member of Technical Staff,
 wp...@windriver.com | Master of Unix-Fu - Wind River Systems
=
   "I put a dollar in a change machine. Nothing changed." - George Carlin
=
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] BaseTools: Fix regression bug by 3378782691af

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

Best Regards,
Zhu Yonghong


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Yonghong 
Zhu
Sent: Saturday, April 28, 2018 9:00 AM
To: edk2-devel@lists.01.org
Cc: Feng, YunhuaX ; Gao, Liming 
Subject: [edk2] [PATCH] BaseTools: Fix regression bug by 3378782691af

From: Yunhua Feng 

Fix regression bug by 3378782691af that cause build failure for platforms using 
hierarchical dsc.

Fixes:https://bugzilla.tianocore.org/show_bug.cgi?id=941
Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yunhua Feng 
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 852e80a41e..555f021f9a 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -1541,11 +1541,11 @@ class DscParser(MetaFileParser):
 
 self._FileWithError = IncludedFile1
 
 IncludedFileTable = MetaFileStorage(self._Table.Cur, 
IncludedFile1, MODEL_FILE_DSC, False)
 FromItem = self._Content[self._ContentIndex - 1][0]
-if self._Content[self._ContentIndex - 1][8] != -1.0:
+if self._InSubsection:
 Owner = self._Content[self._ContentIndex - 1][8]
 else:
 Owner = self._Content[self._ContentIndex - 1][0]
 Parser = DscParser(IncludedFile1, self._FileType, self._Arch, 
IncludedFileTable,
Owner=Owner, From=FromItem)
--
2.12.2.windows.2

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


Re: [edk2] Set "db" variable in secure boot setup mode still requires generating PKCS#7?

2018-05-01 Thread David F.
I'm with you, but the question I would have is how much checking does
it end up doing?  In other words, how can a fake PKCS#7 be created in
a small amount of code that would make the guard happy enough to let
it through in setup mode?   I just don't see the point of even having
to create one when it is going to be ignored anyway?

Thanks.

On Tue, May 1, 2018 at 2:25 PM, Bill Paul  wrote:
> Of all the gin joints in all the towns in all the world, David F. had to walk
> into mine at 14:13 on Tuesday 01 May 2018 and say:
>
>> Hi,
>>
>> Had a fairly simple task of wanting to install the latest MS .crt
>> files for KEK, and their two files for the "db" (the Windows CA and
>> UEFI CA) in a system placed in setup/custom mode.  However, even
>> though it seemed to take the KEK, it never took the "db", always had a
>> problem on a DH77KC mobo (dumped data headers looked as expected).
>> Now when I constructed it, I thought I could leave out any PKCS#7 data
>> (set the expected CertType but in the Hdr dwLength only included
>> CertType and not any CertData), but looking at the algo in UEFI Spec
>> 2.6 page 245, it looks like we'd always have to generate the hash,
>> sign it, create all the PKCS stuff even in setup mode?That would
>> surely unnecessarily bloat any apps that really only need to update
>> things in setup mode wouldn't it?   So to confirm, that is a
>> requirement even in setup mode?If so, why?
>>
>
> If I understand correctly, I think the issue is that the PK, KEK, db and dbx
> are always considered to be secure environment variables, which means when you
> try to update them with SetVariable(), you always have to include one of the
> authentication flags and a properly formated authentication header.
>
> The difference between variable updates in secure mode vs. setup/custom mode
> is that in setup/custom mode, the signature is not validated. It still has to
> be there, but the firmware doesn't care what it says. So the db update could
> be signed with a completely different KEK than the one loaded into the KEK
> variable, and it would still be accepted.
>
> -Bill
>
>
>
>> TIA!!
>> ___
>> edk2-devel mailing list
>> edk2-devel@lists.01.org
>> https://lists.01.org/mailman/listinfo/edk2-devel
> --
> =
> -Bill Paul(510) 749-2329 | Senior Member of Technical Staff,
>  wp...@windriver.com | Master of Unix-Fu - Wind River Systems
> =
>"I put a dollar in a change machine. Nothing changed." - George Carlin
> =
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling

2018-05-01 Thread Zeng, Star
Is it more accurate
if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, NULL)) {
->
if (Multiplicand > DivU64x64Remainder (MAX_UINT64, Multiplier, NULL)) {


Thanks,
Star
-Original Message-
From: Ni, Ruiyu 
Sent: Thursday, April 26, 2018 10:24 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star ; Chiu, Chasel 
Subject: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when 
polling

RootBridgeIo.PollMem()/PollIo() originally don't count the IO/MMIO access 
overhead when delaying.
The patch changes the implementation to count the access overhead so that the 
actually delay equals to user required delay.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ruiyu Ni 
Cc: Star Zeng 
Cc: Chasel Chiu 
---
 .../Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
 .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h   |   3 +-
 .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 151 +++--
 3 files changed, 115 insertions(+), 42 deletions(-)

diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
index 42bd8a23cb..2e56959a8f 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
@@ -1,7 +1,7 @@
 ## @file
 #   Generic PCI Host Bridge driver.
 #
-#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2009 - 2018, Intel Corporation. All rights 
+reserved.
 #
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions of the BSD License @@ -43,6 +43,7 @@ 
[LibraryClasses]
   PciSegmentLib
   UefiLib
   PciHostBridgeLib
+  TimerLib
 
 [Protocols]
   gEfiMetronomeArchProtocolGuid   ## CONSUMES
diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
index d3dfb57fc6..e2f651aee4 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
@@ -2,7 +2,7 @@
 
   The PCI Root Bridge header file.
 
-Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -36,6 +36,7 @@ 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 #include "PciHostResource.h"
 
 
diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c 
b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
index 5764c2f49f..459e962fe7 100644
--- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
+++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
@@ -2,7 +2,7 @@
 
   PCI Root Bridge Io Protocol code.
 
-Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
 This program and the accompanying materials  are licensed and made available 
under the terms and conditions of the BSD License  which accompanies this 
distribution.  The full text of the license may be found at @@ -468,6 +468,85 
@@ RootBridgeIoGetMemTranslationByAddress (
   return EFI_SUCCESS;
 }
 
+/**
+  Return the result of (Multiplicand * Multiplier / Divisor).
+
+  @param Multiplicand A 64-bit unsigned value.
+  @param Multiplier   A 64-bit unsigned value.
+  @param Divisor  A 32-bit unsigned value.
+  @param RemainderA pointer to a 32-bit unsigned value. This parameter is
+  optional and may be NULL.
+
+  @return Multiplicand * Multiplier / Divisor.
+**/
+UINT64
+MultThenDivU64x64x32 (
+  IN  UINT64Multiplicand,
+  IN  UINT64Multiplier,
+  IN  UINT32Divisor,
+  OUT UINT32*Remainder  OPTIONAL
+  )
+{
+  UINT64Uint64;
+  UINT32LocalRemainder;
+  UINT32Uint32;
+  if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, NULL)) {
+//
+// Make sure Multiplicand is the bigger one.
+//
+if (Multiplicand < Multiplier) {
+  Uint64   = Multiplicand;
+  Multiplicand = Multiplier;
+  Multiplier   = Uint64;
+}
+//
+// Because Multiplicand * Multiplier overflows,
+//   Multiplicand * Multiplier / Divisor
+// = (2 * Multiplicand' + 1) * Multiplier / Divisor
+// = 2 * (Multiplicand' * Multiplier / Divisor) + Multiplier / Divisor
+//
+Uint64 = MultThenDivU64x64x32 (RShiftU64 (Multiplicand, 1), Multiplier, 
Divisor, &LocalRemainder);
+Uint64 = LShiftU64 (Uint64, 1);
+Uint32 = 0;
+if ((Multiplicand & 0x1) == 1) {
+   

Re: [edk2] [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling

2018-05-01 Thread Ni, Ruiyu
If Multiplicand * Multiplier + Remainder = MAX_UINT64,
Even Multiplicand = MAX_UINT64 / Multiplier,
Overflow still happens.

So ">=" is used here.



Thanks/Ray

> -Original Message-
> From: Zeng, Star
> Sent: Wednesday, May 2, 2018 11:44 AM
> To: Ni, Ruiyu ; edk2-devel@lists.01.org
> Cc: Chiu, Chasel ; Zeng, Star 
> Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> overhead when polling
> 
> Is it more accurate
> if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, NULL)) {
> ->
> if (Multiplicand > DivU64x64Remainder (MAX_UINT64, Multiplier, NULL)) {
> 
> 
> Thanks,
> Star
> -Original Message-
> From: Ni, Ruiyu
> Sent: Thursday, April 26, 2018 10:24 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star ; Chiu, Chasel 
> Subject: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> overhead when polling
> 
> RootBridgeIo.PollMem()/PollIo() originally don't count the IO/MMIO access
> overhead when delaying.
> The patch changes the implementation to count the access overhead so that
> the actually delay equals to user required delay.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ruiyu Ni 
> Cc: Star Zeng 
> Cc: Chasel Chiu 
> ---
>  .../Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
>  .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h   |   3 +-
>  .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 151 +++-
> -
>  3 files changed, 115 insertions(+), 42 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> index 42bd8a23cb..2e56959a8f 100644
> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> @@ -1,7 +1,7 @@
>  ## @file
>  #   Generic PCI Host Bridge driver.
>  #
> -#  Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2009 - 2018, Intel Corporation. All rights
> +reserved.
>  #
>  #  This program and the accompanying materials  #  are licensed and made
> available under the terms and conditions of the BSD License @@ -43,6 +43,7
> @@ [LibraryClasses]
>PciSegmentLib
>UefiLib
>PciHostBridgeLib
> +  TimerLib
> 
>  [Protocols]
>gEfiMetronomeArchProtocolGuid   ## CONSUMES
> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> index d3dfb57fc6..e2f651aee4 100644
> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> @@ -2,7 +2,7 @@
> 
>The PCI Root Bridge header file.
> 
> -Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions of the BSD License  which
> accompanies this distribution.  The full text of the license may be found at
> @@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY
> KIND, EITHER EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
> +#include 
>  #include "PciHostResource.h"
> 
> 
> diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> index 5764c2f49f..459e962fe7 100644
> --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> @@ -2,7 +2,7 @@
> 
>PCI Root Bridge Io Protocol code.
> 
> -Copyright (c) 1999 - 2017, Intel Corporation. All rights reserved.
> +Copyright (c) 1999 - 2018, Intel Corporation. All rights reserved.
>  This program and the accompanying materials  are licensed and made
> available under the terms and conditions of the BSD License  which
> accompanies this distribution.  The full text of the license may be found at
> @@ -468,6 +468,85 @@ RootBridgeIoGetMemTranslationByAddress (
>return EFI_SUCCESS;
>  }
> 
> +/**
> +  Return the result of (Multiplicand * Multiplier / Divisor).
> +
> +  @param Multiplicand A 64-bit unsigned value.
> +  @param Multiplier   A 64-bit unsigned value.
> +  @param Divisor  A 32-bit unsigned value.
> +  @param RemainderA pointer to a 32-bit unsigned value. This parameter
> is
> +  optional and may be NULL.
> +
> +  @return Multiplicand * Multiplier / Divisor.
> +**/
> +UINT64
> +MultThenDivU64x64x32 (
> +  IN  UINT64Multiplicand,
> +  IN  UINT64Multiplier,
> +  IN  UINT32Divisor,
> +  OUT UINT32*Remainder  OPTIONAL
> +  )
> +{
> +  UINT64Uint64;
> +  UINT32LocalRemainder;
> +  UINT32Uint32;
> +  if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, NULL))
> {
> +//
> +// M

[edk2] [Patch][edk2-platforms/devel-IntelAtomProcessorE3900] Add new platform branch devel-IntelAtomProcessorE3900

2018-05-01 Thread Guo, Mang
Create a new branch (devel-IntelAtomProcessorE3900) on edk2-platforms. This 
code base is based on UDK2018 core packages.
Code is ready in https://github.com/mangguo321/edk2-platforms/tree/ 
devel-IntelAtomProcessorE3900

Contributed-under: TianoCore Contribution Agreement 1.1

Signed-off-by: Guo Mang 
---
 ReadMe.MD | 19 +++
 1 file changed, 19 insertions(+)
 create mode 100644 ReadMe.MD

diff --git a/ReadMe.MD b/ReadMe.MD
new file mode 100644
index 000..d509a45
--- /dev/null
+++ b/ReadMe.MD
@@ -0,0 +1,19 @@
+#   MinnowBoard 3 and Leaf Hill CRB Platform
+
+This codebase is designed for the MinnowBoard 3 platform and Leaf Hill 
Customer Reference Board (CRB), using the [Intel Atom(R) Processor E3900 
Series](https://www.intel.com/content/www/us/en/embedded/products/apollo-lake/overview.html)
 (formerly Apollo Lake).
+
+Contributions to MinnowBoard 3 open source project are covered by the
+[TianoCore Contribution Agreement 1.1](Contributions.txt)
+
+The majority of the content in the MinnowBoard3 open source project uses a
+[BSD 2-Clause License](License.txt).
+
+The maintainers are listed in [Maintainers.txt](Maintainers.txt).
+
+# Resources
+
+* [devel-IntelAtomProcessorE3900](Platform/ReadMe.MD) -- Instructions
+
+http://minnowboard.org/ -- Platform Information.
+
+https://firmware.intel.com/projects/minnowboard3 -- Release notes, pre-built 
release/debug binaries, build instructions, and binary objects required to 
compile firmware.
\ No newline at end of file
-- 
2.10.1.windows.1

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


Re: [edk2] [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling

2018-05-01 Thread Ni, Ruiyu
Star,
You are correct.
 ">" is enough here. I will change it when committing the patch.

Thanks/Ray

> -Original Message-
> From: Ni, Ruiyu
> Sent: Wednesday, May 2, 2018 1:12 PM
> To: Zeng, Star ; edk2-devel@lists.01.org
> Cc: Chiu, Chasel 
> Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> overhead when polling
> 
> If Multiplicand * Multiplier + Remainder = MAX_UINT64, Even Multiplicand =
> MAX_UINT64 / Multiplier, Overflow still happens.
> 
> So ">=" is used here.
> 
> 
> 
> Thanks/Ray
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Wednesday, May 2, 2018 11:44 AM
> > To: Ni, Ruiyu ; edk2-devel@lists.01.org
> > Cc: Chiu, Chasel ; Zeng, Star
> > 
> > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> > overhead when polling
> >
> > Is it more accurate
> > if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, NULL))
> > {
> > ->
> > if (Multiplicand > DivU64x64Remainder (MAX_UINT64, Multiplier, NULL))
> > {
> >
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: Ni, Ruiyu
> > Sent: Thursday, April 26, 2018 10:24 AM
> > To: edk2-devel@lists.01.org
> > Cc: Zeng, Star ; Chiu, Chasel
> > 
> > Subject: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> overhead
> > when polling
> >
> > RootBridgeIo.PollMem()/PollIo() originally don't count the IO/MMIO
> > access overhead when delaying.
> > The patch changes the implementation to count the access overhead so
> > that the actually delay equals to user required delay.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ruiyu Ni 
> > Cc: Star Zeng 
> > Cc: Chasel Chiu 
> > ---
> >  .../Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
> >  .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h   |   3 +-
> >  .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 151
> +++-
> > -
> >  3 files changed, 115 insertions(+), 42 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > index 42bd8a23cb..2e56959a8f 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > @@ -1,7 +1,7 @@
> >  ## @file
> >  #   Generic PCI Host Bridge driver.
> >  #
> > -#  Copyright (c) 2009 - 2016, Intel Corporation. All rights
> > reserved.
> > +#  Copyright (c) 2009 - 2018, Intel Corporation. All rights
> > +reserved.
> >  #
> >  #  This program and the accompanying materials  #  are licensed and
> > made available under the terms and conditions of the BSD License @@
> > -43,6 +43,7 @@ [LibraryClasses]
> >PciSegmentLib
> >UefiLib
> >PciHostBridgeLib
> > +  TimerLib
> >
> >  [Protocols]
> >gEfiMetronomeArchProtocolGuid   ## CONSUMES
> > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > index d3dfb57fc6..e2f651aee4 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > @@ -2,7 +2,7 @@
> >
> >The PCI Root Bridge header file.
> >
> > -Copyright (c) 1999 - 2017, Intel Corporation. All rights
> > reserved.
> > +Copyright (c) 1999 - 2018, Intel Corporation. All rights
> > +reserved.
> >  This program and the accompanying materials  are licensed and made
> > available under the terms and conditions of the BSD License  which
> > accompanies this distribution.  The full text of the license may be
> > found at @@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR
> REPRESENTATIONS OF
> > ANY KIND, EITHER EXPRESS OR IMPLIED.
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include "PciHostResource.h"
> >
> >
> > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > index 5764c2f49f..459e962fe7 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > @@ -2,7 +2,7 @@
> >
> >PCI Root Bridge Io Protocol code.
> >
> > -Copyright (c) 1999 - 2017, Intel Corporation. All rights
> > reserved.
> > +Copyright (c) 1999 - 2018, Intel Corporation. All rights
> > +reserved.
> >  This program and the accompanying materials  are licensed and made
> > available under the terms and conditions of the BSD License  which
> > accompanies this distribution.  The full text of the license may be
> > found at @@ -468,6 +468,85 @@
> RootBridgeIoGetMemTranslationByAddress (
> >return EFI_SUCCESS;
> >  }
> >
> > +/**
> > +  Return the result of (Multiplicand * Multiplier / Divisor).
> > +
> > +  @param Multiplicand A 64-bit unsigned value.
> > +  @param Multiplier   A 64-bit unsigned value.
> > +  @param Divisor  A 32-bit unsigned value.
> > +  @param RemainderA pointer to a 32-bit unsigned value. This
> parameter
> > 

Re: [edk2] [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when polling

2018-05-01 Thread Zeng, Star
Reviewed-by: Star Zeng  if it is updated. :)


Thanks,
Star
-Original Message-
From: Ni, Ruiyu 
Sent: Wednesday, May 2, 2018 2:37 PM
To: Zeng, Star ; 'edk2-devel@lists.01.org' 

Cc: Chiu, Chasel 
Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io overhead when 
polling

Star,
You are correct.
 ">" is enough here. I will change it when committing the patch.

Thanks/Ray

> -Original Message-
> From: Ni, Ruiyu
> Sent: Wednesday, May 2, 2018 1:12 PM
> To: Zeng, Star ; edk2-devel@lists.01.org
> Cc: Chiu, Chasel 
> Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io 
> overhead when polling
> 
> If Multiplicand * Multiplier + Remainder = MAX_UINT64, Even 
> Multiplicand =
> MAX_UINT64 / Multiplier, Overflow still happens.
> 
> So ">=" is used here.
> 
> 
> 
> Thanks/Ray
> 
> > -Original Message-
> > From: Zeng, Star
> > Sent: Wednesday, May 2, 2018 11:44 AM
> > To: Ni, Ruiyu ; edk2-devel@lists.01.org
> > Cc: Chiu, Chasel ; Zeng, Star 
> > 
> > Subject: RE: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io 
> > overhead when polling
> >
> > Is it more accurate
> > if (Multiplicand >= DivU64x64Remainder (MAX_UINT64, Multiplier, 
> > NULL)) {
> > ->
> > if (Multiplicand > DivU64x64Remainder (MAX_UINT64, Multiplier, 
> > NULL)) {
> >
> >
> > Thanks,
> > Star
> > -Original Message-
> > From: Ni, Ruiyu
> > Sent: Thursday, April 26, 2018 10:24 AM
> > To: edk2-devel@lists.01.org
> > Cc: Zeng, Star ; Chiu, Chasel 
> > 
> > Subject: [PATCH] MdeModulePkg/PciHostBridge: Count the (mm)io
> overhead
> > when polling
> >
> > RootBridgeIo.PollMem()/PollIo() originally don't count the IO/MMIO 
> > access overhead when delaying.
> > The patch changes the implementation to count the access overhead so 
> > that the actually delay equals to user required delay.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ruiyu Ni 
> > Cc: Star Zeng 
> > Cc: Chasel Chiu 
> > ---
> >  .../Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf  |   3 +-
> >  .../Bus/Pci/PciHostBridgeDxe/PciRootBridge.h   |   3 +-
> >  .../Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c | 151
> +++-
> > -
> >  3 files changed, 115 insertions(+), 42 deletions(-)
> >
> > diff --git
> > a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > index 42bd8a23cb..2e56959a8f 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciHostBridgeDxe.inf
> > @@ -1,7 +1,7 @@
> >  ## @file
> >  #   Generic PCI Host Bridge driver.
> >  #
> > -#  Copyright (c) 2009 - 2016, Intel Corporation. All rights 
> > reserved.
> > +#  Copyright (c) 2009 - 2018, Intel Corporation. All rights 
> > +reserved.
> >  #
> >  #  This program and the accompanying materials  #  are licensed and 
> > made available under the terms and conditions of the BSD License @@
> > -43,6 +43,7 @@ [LibraryClasses]
> >PciSegmentLib
> >UefiLib
> >PciHostBridgeLib
> > +  TimerLib
> >
> >  [Protocols]
> >gEfiMetronomeArchProtocolGuid   ## CONSUMES
> > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > index d3dfb57fc6..e2f651aee4 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridge.h
> > @@ -2,7 +2,7 @@
> >
> >The PCI Root Bridge header file.
> >
> > -Copyright (c) 1999 - 2017, Intel Corporation. All rights 
> > reserved.
> > +Copyright (c) 1999 - 2018, Intel Corporation. All rights 
> > +reserved.
> >  This program and the accompanying materials  are licensed and made 
> > available under the terms and conditions of the BSD License  which 
> > accompanies this distribution.  The full text of the license may be 
> > found at @@ -36,6 +36,7 @@ WITHOUT WARRANTIES OR
> REPRESENTATIONS OF
> > ANY KIND, EITHER EXPRESS OR IMPLIED.
> >  #include 
> >  #include 
> >  #include 
> > +#include 
> >  #include "PciHostResource.h"
> >
> >
> > diff --git a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > index 5764c2f49f..459e962fe7 100644
> > --- a/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > +++ b/MdeModulePkg/Bus/Pci/PciHostBridgeDxe/PciRootBridgeIo.c
> > @@ -2,7 +2,7 @@
> >
> >PCI Root Bridge Io Protocol code.
> >
> > -Copyright (c) 1999 - 2017, Intel Corporation. All rights 
> > reserved.
> > +Copyright (c) 1999 - 2018, Intel Corporation. All rights 
> > +reserved.
> >  This program and the accompanying materials  are licensed and made 
> > available under the terms and conditions of the BSD License  which 
> > accompanies this distribution.  The full text of the license may be 
> > found at @@ -468,6 +468,85 @@
> RootBridgeIoGetMemTranslationByAddress (
> >return EFI_SUCCESS;
> >  }
> >
> > +/

Re: [edk2] [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts

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

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Friday, April 27, 2018 10:04 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v2 11/27] BaseTools: Workspace/MetaFileParser - refactor dicts

make defaultdict to avoid initialize inner items to empty the dict, call clear 
instead of making a new object

v2 - to empty the dict, dont re-run constructor, just call .clear() in post 
process API also.

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

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 550359f9abb2..51126d710b2b 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -31,7 +31,7 @@ from Common.Misc import GuidStructureStringToGuidString, 
CheckPcdDatum, PathClas  from Common.Expression import *  from 
CommonDataClass.Exceptions import *  from Common.LongFilePathSupport import 
OpenLongFilePath as open
-
+from collections import defaultdict
 from MetaFileTable import MetaFileStorage  from MetaFileCommentParser import 
CheckInfComment
 
@@ -163,7 +163,7 @@ class MetaFileParser(object):
 self._FileDir = self.MetaFile.Dir
 self._Defines = {}
 self._FileLocalMacros = {}
-self._SectionsMacroDict = {}
+self._SectionsMacroDict = defaultdict(dict)
 
 # for recursive parsing
 self._Owner = [Owner]
@@ -421,17 +421,16 @@ class MetaFileParser(object):
 def _ConstructSectionMacroDict(self, Name, Value):
 ScopeKey = [(Scope[0], Scope[1],Scope[2]) for Scope in self._Scope]
 ScopeKey = tuple(ScopeKey)
-SectionDictKey = self._SectionType, ScopeKey
 #
 # DecParser SectionType is a list, will contain more than one item 
only in Pcd Section
 # As Pcd section macro usage is not alllowed, so here it is safe
 #
 if type(self) == DecParser:
 SectionDictKey = self._SectionType[0], ScopeKey
-if SectionDictKey not in self._SectionsMacroDict:
-self._SectionsMacroDict[SectionDictKey] = {}
-SectionLocalMacros = self._SectionsMacroDict[SectionDictKey]
-SectionLocalMacros[Name] = Value
+else:
+SectionDictKey = self._SectionType, ScopeKey
+
+self._SectionsMacroDict[SectionDictKey][Name] = Value
 
 ## Get section Macros that are applicable to current line, which may come 
from other sections 
 ## that share the same name while scope is wider @@ -936,7 +935,7 @@ class 
DscParser(MetaFileParser):
 self._SubsectionType = MODEL_UNKNOWN
 self._SubsectionName = ''
 self._Owner[-1] = -1
-OwnerId = {}
+OwnerId.clear()
 continue
 # subsection header
 elif Line[0] == TAB_OPTION_START and Line[-1] == TAB_OPTION_END:
@@ -1296,7 +1295,7 @@ class DscParser(MetaFileParser):
 self._DirectiveEvalStack = []
 self._FileWithError = self.MetaFile
 self._FileLocalMacros = {}
-self._SectionsMacroDict = {}
+self._SectionsMacroDict.clear()
 GlobalData.gPlatformDefines = {}
 
 # Get all macro and PCD which has straitforward value
--
2.16.2.windows.1

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


Re: [edk2] [PATCH v3 16/27] BaseTools: Replace EDK Component strings with predefined constant

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

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Friday, April 27, 2018 10:04 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v3 16/27] BaseTools: Replace EDK Component strings with 
predefined constant

EDK_COMPONENT_TYPE_LIBRARY was 'LIBRARY'
EDK_COMPONENT_TYPE_SECURITY_CORE was 'SECURITY_CORE'
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER was 'COMBINED_PEIM_DRIVER'
EDK_COMPONENT_TYPE_PIC_PEIM was 'PIC_PEIM'
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM was 'RELOCATABLE_PEIM'
EDK_COMPONENT_TYPE_BS_DRIVER was 'BS_DRIVER'
EDK_COMPONENT_TYPE_RT_DRIVER was 'RT_DRIVER'
EDK_COMPONENT_TYPE_SAL_RT_DRIVER was 'SAL_RT_DRIVER'
EDK_COMPONENT_TYPE_APPLICATION was 'APPLICATION'

v2 - revert 2 files.  will update later in own patches.
v3 - fix v2

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/DataType.py| 28 ++--
 BaseTools/Source/Python/GenFds/FdfParser.py   |  6 ++---
 BaseTools/Source/Python/Workspace/InfBuildData.py |  2 +-
 BaseTools/Source/Python/build/build.py|  8 +++---
 4 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/BaseTools/Source/Python/Common/DataType.py 
b/BaseTools/Source/Python/Common/DataType.py
index cac455f9f7cf..ffd73d6852d1 100644
--- a/BaseTools/Source/Python/Common/DataType.py
+++ b/BaseTools/Source/Python/Common/DataType.py
@@ -84,7 +84,7 @@ SUP_MODULE_LIST_STRING = TAB_VALUE_SPLIT.join(SUP_MODULE_LIST)
 SUP_MODULE_SET_PEI = {SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE}
 
 EDK_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
-EDK_COMPONENT_TYPE_SECUARITY_CORE = 'SECUARITY_CORE'
+EDK_COMPONENT_TYPE_SECURITY_CORE = 'SECURITY_CORE'
 EDK_COMPONENT_TYPE_PEI_CORE = SUP_MODULE_PEI_CORE  
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER = 'COMBINED_PEIM_DRIVER'
 EDK_COMPONENT_TYPE_PIC_PEIM = 'PIC_PEIM'
@@ -97,18 +97,18 @@ EDK_NAME = 'EDK'
 EDKII_NAME = 'EDKII'
 
 COMPONENT_TO_MODULE_MAP_DICT = {
-"LIBRARY"   :   SUP_MODULE_BASE,
-"SECURITY_CORE" :   SUP_MODULE_SEC,
-SUP_MODULE_PEI_CORE :   SUP_MODULE_PEI_CORE,
-"COMBINED_PEIM_DRIVER"  :   SUP_MODULE_PEIM,
-"PIC_PEIM"  :   SUP_MODULE_PEIM,
-"RELOCATABLE_PEIM"  :   SUP_MODULE_PEIM,
-"PE32_PEIM" :   SUP_MODULE_PEIM,
-"BS_DRIVER" :   SUP_MODULE_DXE_DRIVER,
-"RT_DRIVER" :   SUP_MODULE_DXE_RUNTIME_DRIVER,
-"SAL_RT_DRIVER" :   SUP_MODULE_DXE_SAL_DRIVER,
-"APPLICATION"   :   SUP_MODULE_UEFI_APPLICATION,
-"LOGO"  :   SUP_MODULE_BASE,
+EDK_COMPONENT_TYPE_LIBRARY   :   SUP_MODULE_BASE,
+EDK_COMPONENT_TYPE_SECURITY_CORE :   SUP_MODULE_SEC,
+EDK_COMPONENT_TYPE_PEI_CORE  :   SUP_MODULE_PEI_CORE,
+EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER  :   SUP_MODULE_PEIM,
+EDK_COMPONENT_TYPE_PIC_PEIM  :   SUP_MODULE_PEIM,
+EDK_COMPONENT_TYPE_RELOCATABLE_PEIM  :   SUP_MODULE_PEIM,
+"PE32_PEIM"  :   SUP_MODULE_PEIM,
+EDK_COMPONENT_TYPE_BS_DRIVER :   SUP_MODULE_DXE_DRIVER,
+EDK_COMPONENT_TYPE_RT_DRIVER :   SUP_MODULE_DXE_RUNTIME_DRIVER,
+EDK_COMPONENT_TYPE_SAL_RT_DRIVER :   SUP_MODULE_DXE_SAL_DRIVER,
+EDK_COMPONENT_TYPE_APPLICATION   :   SUP_MODULE_UEFI_APPLICATION,
+"LOGO"   :   SUP_MODULE_BASE,
 }
 
 BINARY_FILE_TYPE_FW = 'FW'
@@ -129,7 +129,7 @@ BINARY_FILE_TYPE_UI = 'UI'
 BINARY_FILE_TYPE_BIN = 'BIN'
 BINARY_FILE_TYPE_FV = 'FV'
 
-PLATFORM_COMPONENT_TYPE_LIBRARY = 'LIBRARY'
+PLATFORM_COMPONENT_TYPE_LIBRARY = EDK_COMPONENT_TYPE_LIBRARY
 PLATFORM_COMPONENT_TYPE_LIBRARY_CLASS = 'LIBRARY_CLASS'
 PLATFORM_COMPONENT_TYPE_MODULE = 'MODULE'
 
diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py 
b/BaseTools/Source/Python/GenFds/FdfParser.py
index db8947e4b453..d15656c5fc6c 100644
--- a/BaseTools/Source/Python/GenFds/FdfParser.py
+++ b/BaseTools/Source/Python/GenFds/FdfParser.py
@@ -3630,8 +3630,8 @@ class FdfParser:
  SUP_MODULE_DXE_DRIVER, SUP_MODULE_DXE_SAL_DRIVER, 
\
  SUP_MODULE_DXE_SMM_DRIVER, 
SUP_MODULE_DXE_RUNTIME_DRIVER, \
  SUP_MODULE_UEFI_DRIVER, 
SUP_MODULE_UEFI_APPLICATION, SUP_MODULE_USER_DEFINED, "DEFAULT", 
SUP_MODULE_BASE, \
- "SECURITY_CORE", "COMBINED_PEIM_DRIVER", 
"PIC_PEIM", "RELOCATABLE_PEIM", \
-"PE32_PEIM", "BS_DRIVER", "RT_DRIVER", 
"SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", SUP_MODULE_SMM_CORE, 
SUP_MODULE_MM_STANDALONE, SUP_MODULE_MM_CORE_STANDALONE):
+ EDK_COMPONENT_TYPE_SECURITY_CORE, 
EDK_COMPONENT_TYPE_COMBINED_PEIM_DRIVER, EDK_COMPONENT_TYPE_PIC_PEIM, 
EDK_COMPONENT_TYPE_RELOCATABLE_PEIM, \
+ 

Re: [edk2] [PATCH v1 14/27] BaseTools: Define and use a set for common list

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

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Friday, April 20, 2018 11:52 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 14/27] BaseTools: Define and use a set for common list

share a set for both PEI module types

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 4 ++--
 BaseTools/Source/Python/AutoGen/GenC.py| 8 
 BaseTools/Source/Python/Common/DataType.py | 1 +
 3 files changed, 7 insertions(+), 6 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 9c3bf864e360..60088c87a03b 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -1431,7 +1431,7 @@ class PlatformAutoGen(AutoGen):
 # used by DXE module, it should be stored in DXE PCD 
database.
 # The default Phase is DXE
 #
-if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
+if M.ModuleType in SUP_MODULE_SET_PEI:
 PcdFromModule.Phase = "PEI"
 if PcdFromModule not in self._DynaPcdList_:
 self._DynaPcdList_.append(PcdFromModule)
@@ -1473,7 +1473,7 @@ class PlatformAutoGen(AutoGen):
 # make sure that the "VOID*" kind of datum has 
MaxDatumSize set
 if PcdFromModule.DatumType == "VOID*" and 
PcdFromModule.MaxDatumSize in [None, '']:
 NoDatumTypePcdList.add("%s.%s [%s]" % 
(PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
-if M.ModuleType in [SUP_MODULE_PEIM, SUP_MODULE_PEI_CORE]:
+if M.ModuleType in SUP_MODULE_SET_PEI:
 PcdFromModule.Phase = "PEI"
 if PcdFromModule not in self._DynaPcdList_ and 
PcdFromModule.Type in GenC.gDynamicExPcd:
 self._DynaPcdList_.append(PcdFromModule)
diff --git a/BaseTools/Source/Python/AutoGen/GenC.py 
b/BaseTools/Source/Python/AutoGen/GenC.py
index 7bc352274e66..57ff699a968a 100644
--- a/BaseTools/Source/Python/AutoGen/GenC.py
+++ b/BaseTools/Source/Python/AutoGen/GenC.py
@@ -1411,7 +1411,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, 
AutoGenH):
 if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
 
ConstructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
 
ConstructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
-elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
+elif Lib.ModuleType in SUP_MODULE_SET_PEI:
 
ConstructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
 
ConstructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
 elif Lib.ModuleType in 
[SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
@@ -1441,7 +1441,7 @@ def CreateLibraryConstructorCode(Info, AutoGenC, 
AutoGenH):
 else:
 if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
 AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
-elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
+elif Info.ModuleType in SUP_MODULE_SET_PEI:
 AutoGenC.Append(gLibraryString['PEI'].Replace(Dict))
 elif Info.ModuleType in 
[SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
  
SUP_MODULE_DXE_SAL_DRIVER,SUP_MODULE_UEFI_DRIVER,SUP_MODULE_UEFI_APPLICATION,SUP_MODULE_SMM_CORE]:
@@ -1473,7 +1473,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 if Lib.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
 
DestructorPrototypeString.Append(gLibraryStructorPrototype[SUP_MODULE_BASE].Replace(Dict))
 
DestructorCallingString.Append(gLibraryStructorCall[SUP_MODULE_BASE].Replace(Dict))
-elif Lib.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
+elif Lib.ModuleType in SUP_MODULE_SET_PEI:
 
DestructorPrototypeString.Append(gLibraryStructorPrototype['PEI'].Replace(Dict))
 
DestructorCallingString.Append(gLibraryStructorCall['PEI'].Replace(Dict))
 elif Lib.ModuleType in 
[SUP_MODULE_DXE_CORE,SUP_MODULE_DXE_DRIVER,SUP_MODULE_DXE_SMM_DRIVER,SUP_MODULE_DXE_RUNTIME_DRIVER,
@@ -1503,7 +1503,7 @@ def CreateLibraryDestructorCode(Info, AutoGenC, AutoGenH):
 else:
 if Info.ModuleType in [SUP_MODULE_BASE, SUP_MODULE_SEC]:
 AutoGenC.Append(gLibraryString[SUP_MODULE_BASE].Replace(Dict))
-elif Info.ModuleType in [SUP_MODULE_PEI_CORE,SUP_MODULE_PEIM]:
+

Re: [edk2] [PATCH v1 22/27] BaseTools: remove redundant if comparison

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

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Friday, April 20, 2018 11:52 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 22/27] BaseTools: remove redundant if comparison

inherently python will check string and list for None and having data

if  in [None, ''] and similar are superflous.

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 26 
 BaseTools/Source/Python/AutoGen/GenC.py|  2 +-
 BaseTools/Source/Python/GenFds/FfsInfStatement.py  |  4 +--
 BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 32 
++--
 BaseTools/Source/Python/Workspace/DscBuildData.py  |  8 ++---
 BaseTools/Source/Python/Workspace/InfBuildData.py  |  2 +-
 6 files changed, 37 insertions(+), 37 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 534fbe79fad9..871afedcde4b 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -420,14 +420,14 @@ class WorkspaceAutoGen(AutoGen):
 if BuildData.Pcds[key].Pending:
 if key in Platform.Pcds:
 PcdInPlatform = Platform.Pcds[key]
-if PcdInPlatform.Type not in [None, '']:
+if PcdInPlatform.Type:
 BuildData.Pcds[key].Type = 
PcdInPlatform.Type
 
 if BuildData.MetaFile in Platform.Modules:
 PlatformModule = 
Platform.Modules[str(BuildData.MetaFile)]
 if key in PlatformModule.Pcds:
 PcdInPlatform = PlatformModule.Pcds[key]
-if PcdInPlatform.Type not in [None, '']:
+if PcdInPlatform.Type:
 BuildData.Pcds[key].Type = 
PcdInPlatform.Type
 
 if TAB_PCDS_DYNAMIC_EX in BuildData.Pcds[key].Type:
@@ -1394,7 +1394,7 @@ class PlatformAutoGen(AutoGen):
 
 for PcdFromModule in M.ModulePcdList + M.LibraryPcdList:
 # make sure that the "VOID*" kind of datum has MaxDatumSize set
-if PcdFromModule.DatumType == "VOID*" and 
PcdFromModule.MaxDatumSize in [None, '']:
+if PcdFromModule.DatumType == "VOID*" and not 
PcdFromModule.MaxDatumSize:
 NoDatumTypePcdList.add("%s.%s [%s]" % 
(PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, F))
 
 # Check the PCD from Binary INF or Source INF @@ -1471,7 
+1471,7 @@ class PlatformAutoGen(AutoGen):
 ExtraData="\n\tExisted %s PCD %s 
in:\n\t\t%s\n"
 % (PcdFromModule.Type, 
PcdFromModule.TokenCName, InfName))
 # make sure that the "VOID*" kind of datum has 
MaxDatumSize set
-if PcdFromModule.DatumType == "VOID*" and 
PcdFromModule.MaxDatumSize in [None, '']:
+if PcdFromModule.DatumType == "VOID*" and not 
PcdFromModule.MaxDatumSize:
 NoDatumTypePcdList.add("%s.%s [%s]" % 
(PcdFromModule.TokenSpaceGuidCName, PcdFromModule.TokenCName, InfName))
 if M.ModuleType in SUP_MODULE_SET_PEI:
 PcdFromModule.Phase = "PEI"
@@ -1999,7 +1999,7 @@ class PlatformAutoGen(AutoGen):
 BuildRuleFile = None
 if TAB_TAT_DEFINES_BUILD_RULE_CONF in 
self.Workspace.TargetTxt.TargetTxtDictionary:
 BuildRuleFile = 
self.Workspace.TargetTxt.TargetTxtDictionary[TAB_TAT_DEFINES_BUILD_RULE_CONF]
-if BuildRuleFile in [None, '']:
+if not BuildRuleFile:
 BuildRuleFile = gDefaultBuildRuleFile
 self._BuildRule = BuildRule(BuildRuleFile)
 if self._BuildRule._FileVersion == "":
@@ -2327,13 +2327,13 @@ class PlatformAutoGen(AutoGen):
 TokenCName = PcdItem[0]
 break
 if FromPcd is not None:
-if ToPcd.Pending and FromPcd.Type not in [None, '']:
+if ToPcd.Pending and FromPcd.Type:
 ToPcd.Type = FromPcd.Type
-elif (ToPcd.Type not in [None, '']) and (FromPcd.Type not in 
[None, ''])\
+elif (ToPcd.Type) and (FromPcd.Type)\
 and (ToPcd.Type != FromPcd.Type) and (ToPcd.Type in 
FromPcd.Type):
 if ToPcd.Type.strip() == TAB_PCDS_DYNAMIC_EX:
 ToPcd.Type = FromPcd.Type
-elif ToPcd.Type not in [None, ''] and FromPcd.Type not in [None, 
''] \
+elif ToPcd.Type and FromPcd.Type \
   

Re: [edk2] [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py

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

Best Regards,
Zhu Yonghong


-Original Message-
From: Carsey, Jaben 
Sent: Friday, April 20, 2018 11:52 PM
To: edk2-devel@lists.01.org
Cc: Gao, Liming ; Zhu, Yonghong 
Subject: [PATCH v1 26/27] BaseTools: remove unused MigrationUtilities.py

Cc: Liming Gao 
Cc: Yonghong Zhu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jaben Carsey 
---
 BaseTools/Source/Python/Common/MigrationUtilities.py | 568 
 BaseTools/Source/Python/Makefile |   1 -
 2 files changed, 569 deletions(-)

diff --git a/BaseTools/Source/Python/Common/MigrationUtilities.py 
b/BaseTools/Source/Python/Common/MigrationUtilities.py
deleted file mode 100644
index 0c93c72a60f6..
--- a/BaseTools/Source/Python/Common/MigrationUtilities.py
+++ /dev/null
@@ -1,568 +0,0 @@
-## @file
-# Contains several utilitities shared by migration tools.
-#
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved. -# 
This program and the accompanying materials -# are licensed and made available 
under the terms and conditions of the BSD License -# which accompanies this 
distribution.  The full text of the license may be found at -# 
http://opensource.org/licenses/bsd-license.php
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, -# 
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##
-# Import Modules
-#
-import Common.LongFilePathOs as os
-import re
-import EdkLogger
-from optparse import OptionParser
-from Common.BuildToolError import *
-from XmlRoutines import *
-from CommonDataClass.CommonClass import * -from Common.LongFilePathSupport 
import OpenLongFilePath as open
-
-## Set all fields of CommonClass object.
-#
-# Set all attributes of CommonClass object from XML Dom object of XmlCommon.
-#
-# @param  Common The destine CommonClass object.
-# @param  XmlCommon  The source XML Dom object.
-#
-def SetCommon(Common, XmlCommon):
-XmlTag = "Usage"
-Common.Usage = XmlAttribute(XmlCommon, XmlTag).split()
-
-XmlTag = TAB_PCDS_FEATURE_FLAG
-Common.FeatureFlag = XmlAttribute(XmlCommon, XmlTag)
-
-XmlTag = "SupArchList"
-Common.SupArchList = XmlAttribute(XmlCommon, XmlTag).split()
-
-XmlTag = XmlNodeName(XmlCommon) + "/" + "HelpText"
-Common.HelpText = XmlElement(XmlCommon, XmlTag)
-
-
-## Set some fields of CommonHeaderClass object.
-#
-# Set Name, Guid, FileName and FullPath fields of CommonHeaderClass object 
from -# XML Dom object of XmlCommonHeader, NameTag and FileName.
-#
-# @param  CommonHeader   The destine CommonClass object.
-# @param  XmlCommonHeaderThe source XML Dom object.
-# @param  NameTagThe name tag in XML Dom object.
-# @param  FileName   The file name of the XML file.
-#
-def SetIdentification(CommonHeader, XmlCommonHeader, NameTag, FileName):
-XmlParentTag = XmlNodeName(XmlCommonHeader)
-
-XmlTag = XmlParentTag + "/" + NameTag
-CommonHeader.Name = XmlElement(XmlCommonHeader, XmlTag)
-
-XmlTag = XmlParentTag + "/" + "GuidValue"
-CommonHeader.Guid = XmlElement(XmlCommonHeader, XmlTag)
-
-XmlTag = XmlParentTag + "/" + "Version"
-CommonHeader.Version = XmlElement(XmlCommonHeader, XmlTag)
-
-CommonHeader.FileName = os.path.basename(FileName)
-CommonHeader.FullPath = os.path.abspath(FileName)
-
-
-## Regular expression to match specification and value.
-mReSpecification = re.compile(r"(?P\w+)\s+(?P\w*)")
-
-## Add specification to specification dictionary.
-#
-# Abstract specification name, value pair from Specification String and add 
them -# to specification dictionary.
-#
-# @param  SpecificationDict   The destine Specification dictionary.
-# @param  SpecificationString The source Specification String from which the
-# specification name and value pair is abstracted.
-#
-def AddToSpecificationDict(SpecificationDict, SpecificationString):
-"""Abstract specification name, value pair from Specification String"""
-for SpecificationMatch in mReSpecification.finditer(SpecificationString):
-Specification = SpecificationMatch.group("Specification")
-Value = SpecificationMatch.group("Value")
-SpecificationDict[Specification] = Value
-
-## Set all fields of CommonHeaderClass object.
-#
-# Set all attributes of CommonHeaderClass object from XML Dom object of -# 
XmlCommonHeader, NameTag and FileName.
-#
-# @param  CommonHeader   The destine CommonClass object.
-# @param  XmlCommonHeaderThe source XML Dom object.
-# @param  NameTagThe name tag in XML Dom object.
-# @param  FileName   The file name of the XML file.
-#
-def SetCommonHeader(CommonHeader, XmlCommonHeader):
-"""Set all attributes of CommonHeaderClass object from XmlCommonHeader"""
-XmlParent = XmlNodeName(XmlCommonHeader)
-
-XmlTag = XmlParent + "/" + "Abstract"
-CommonHeader.Abstract = XmlElement(Xm