Re: [edk2] TPM 2.0 ACPI tableTPM2 table event log

2018-06-06 Thread Lin, Derek (HPS UEFI Dev)
Created in Bugzilla.
https://bugzilla.tianocore.org/show_bug.cgi?id=978

Thanks,
Derek

From: Yao, Jiewen [mailto:jiewen@intel.com]
Sent: Tuesday, June 5, 2018 11:14 PM
To: Lin, Derek (HPS UEFI Dev) ; Zhang, Chao B 

Cc: edk2-devel@lists.01.org; Spottswood, Jason 
Subject: RE: TPM 2.0 ACPI tableTPM2 table event log

Yes, if you want this feature, you may file a Bugzilla to track it. 
https://bugzilla.tianocore.org/

Thank you
Yao Jiewen

From: Lin, Derek (HPS UEFI Dev) [mailto:derek.l...@hpe.com]
Sent: Tuesday, June 5, 2018 2:55 AM
To: Zhang, Chao B mailto:chao.b.zh...@intel.com>>; Yao, 
Jiewen mailto:jiewen@intel.com>>
Cc: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Spottswood, Jason 
mailto:jason.spottsw...@hpe.com>>; Lin, Derek (HPS 
UEFI Dev) mailto:derek.l...@hpe.com>>
Subject: TPM 2.0 ACPI tableTPM2 table event log

Hi Chao and Jiewen,

There are new fields in TPM2 ACPI table for getting TCG event log under OS.

https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf
Page 11.
Log Area Minimum Length (LAML)
Log Area Start Address (LASA)

I remember they are not existed in older TCG ACPI spec.

Do you have plan to implement it?

Thanks,
Derek

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


[edk2] TPM 2.0 ACPI tableTPM2 table event log

2018-06-05 Thread Lin, Derek (HPS UEFI Dev)
Hi Chao and Jiewen,

There are new fields in TPM2 ACPI table for getting TCG event log under OS.

https://trustedcomputinggroup.org/wp-content/uploads/TCG_ACPIGeneralSpecification_v1.20_r8.pdf
Page 11.
Log Area Minimum Length (LAML)
Log Area Start Address (LASA)

I remember they are not existed in older TCG ACPI spec.

Do you have plan to implement it?

Thanks,
Derek

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


Re: [edk2] [PATCH] BaseTools: Fix --hash Package and Module hash value.

2018-05-16 Thread Lin, Derek (HPS UEFI Dev)
Jaben,

You're right, Python list is ordered.
So it's because of insertion order, hmm.. but the meta-file parser run in 
single thread, not sure why it generate different order in different 
build...never mind.

However, I like the idea that changing list to set. I should improve 
performance.

Thanks,
Derek

-Original Message-
From: Carsey, Jaben [mailto:jaben.car...@intel.com] 
Sent: Thursday, May 17, 2018 12:20 AM
To: Zhu, Yonghong <yonghong@intel.com>; Lin, Derek (HPS UEFI Dev) 
<derek.l...@hpe.com>; edk2-devel@lists.01.org
Subject: RE: [PATCH] BaseTools: Fix --hash Package and Module hash value.

Derek,

The change is good. I have a comment/question on the message.

Reviewed-by: Jaben Carsey <jaben.car...@intel.com>

Order of list enumeration is not arbitrary, it's based on python lists being 
inherently insertion-ordered objects.

If insertion order is irrelevant, should we consider changing those to a 
different type?  (set?)

-Jaben


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Zhu, Yonghong
> Sent: Wednesday, May 16, 2018 12:12 AM
> To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2- 
> de...@lists.01.org
> Subject: Re: [edk2] [PATCH] BaseTools: Fix --hash Package and Module 
> hash value.
> 
> Reviewed-by: Yonghong Zhu <yonghong@intel.com>
> 
> Best Regards,
> Zhu Yonghong
> 
> 
> -Original Message-
> From: Lin, Derek (HPS UEFI Dev) [mailto:derek.l...@hpe.com]
> Sent: Wednesday, May 09, 2018 5:03 PM
> To: edk2-devel@lists.01.org
> Cc: Zhu, Yonghong <yonghong@intel.com>; Lin, Derek (HPS UEFI Dev) 
> <derek.l...@hpe.com>
> Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value.
> 
> The order of List enumeration is arbitrary.
> Need to be sorted while calculating Package/Module hash, otherwise it 
> generate different hash value even nothing changes.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Derek Lin <derek.l...@hpe.com>
> ---
>  BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++---
>  1 file changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py
> b/BaseTools/Source/Python/AutoGen/AutoGen.py
> index 54f6b1f173..90704dcae4 100644
> --- a/BaseTools/Source/Python/AutoGen/AutoGen.py
> +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
> @@ -2,6 +2,7 @@
>  # Generate AutoGen.h, AutoGen.c and *.depex files  #  # Copyright (c) 
> 2007
> - 2018, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2018, Hewlett Packard Enterprise Development, 
> +L.P.
>  # 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 @@ -670,6 +671,9 @@ class WorkspaceAutoGen(AutoGen):
>  return True
> 
>  def _GenPkgLevelHash(self, Pkg):
> +if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]:
> +return
> +
>  PkgDir = os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName)
>  CreateDirectory(PkgDir)
>  HashFile = os.path.join(PkgDir, Pkg.PackageName + '.hash') @@ 
> -681,17
> +685,16 @@ class WorkspaceAutoGen(AutoGen):
>  m.update(Content)
>  # Get include files hash value
>  if Pkg.Includes:
> -for inc in Pkg.Includes:
> +for inc in sorted(Pkg.Includes, key=lambda x: str(x)):
>  for Root, Dirs, Files in os.walk(str(inc)):
> -for File in Files:
> +for File in sorted(Files):
>  File_Path = os.path.join(Root, File)
>  f = open(File_Path, 'r')
>  Content = f.read()
>  f.close()
>  m.update(Content)
>  SaveFileOnChange(HashFile, m.hexdigest(), True)
> -if Pkg.PackageName not in GlobalData.gPackageHash[Pkg.Arch]:
> -GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =
> m.hexdigest()
> +GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] =
> + m.hexdigest()
> 
>  def _GetMetaFiles(self, Target, Toolchain, Arch):
>  AllWorkSpaceMetaFiles = set() @@ -4432,13 +4435,13 @@ class 
> ModuleAutoGen(AutoGen):
>  m.update(GlobalData.gPlatformHash)
>  # Add Package level hash
>  if self.DependentPackageList:
> -for Pkg in self.DependentPackageList:
> +for Pkg in sorted(self.DependentPackageList, key=lambda x:
> x.PackageName):
>  if Pkg.PackageName in GlobalData.gPackageHas

Re: [edk2] [PATCH] BaseTools: Fix --hash Package and Module hash value.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
Hi Yonghong,

Thanks for notify about this.
I resend the patch.

Thanks,
Derek


-Original Message-
From: Zhu, Yonghong [mailto:yonghong@intel.com] 
Sent: Wednesday, May 9, 2018 4:35 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong@intel.com>
Subject: RE: [PATCH] BaseTools: Fix --hash Package and Module hash value.

Hi Derek,

Please refer below link to add Contributed-under and Signed-off-by info.
We can use BaseTools\Scripts\PatchCheck.py  to check the patch format. Thanks.
https://github.com/tianocore/tianocore.github.io/wiki/Commit-Message-Format 

Best Regards,
Zhu Yonghong


-Original Message-----
From: Lin, Derek (HPS UEFI Dev) [mailto:derek.l...@hpe.com] 
Sent: Wednesday, May 09, 2018 3:49 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong <yonghong....@intel.com>; Lin, Derek (HPS UEFI Dev) 
<derek.l...@hpe.com>
Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value.

From: Lin, Derek (HPS UEFI Dev) 
Sent: Wednesday, May 9, 2018 3:39 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value.

The order of List enumeration is arbitrary.
Need to be sorted while calculating Package/Module hash, otherwise it generate 
different hash value even nothing changes.
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 54f6b1f173..90704dcae4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2,6 +2,7 @@
 # Generate AutoGen.h, AutoGen.c and *.depex files  #  # Copyright (c) 2007 - 
2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
 # 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 @@ 
-670,6 +671,9 @@ class WorkspaceAutoGen(AutoGen):
 return True
 
 def _GenPkgLevelHash(self, Pkg):
+if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]:
+return
+
 PkgDir = os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName)
 CreateDirectory(PkgDir)
 HashFile = os.path.join(PkgDir, Pkg.PackageName + '.hash') @@ -681,17 
+685,16 @@ class WorkspaceAutoGen(AutoGen):
 m.update(Content)
 # Get include files hash value
 if Pkg.Includes:
-for inc in Pkg.Includes:
+for inc in sorted(Pkg.Includes, key=lambda x: str(x)):
 for Root, Dirs, Files in os.walk(str(inc)):
-for File in Files:
+for File in sorted(Files):
 File_Path = os.path.join(Root, File)
 f = open(File_Path, 'r')
 Content = f.read()
 f.close()
 m.update(Content)
 SaveFileOnChange(HashFile, m.hexdigest(), True)
-if Pkg.PackageName not in GlobalData.gPackageHash[Pkg.Arch]:
-GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = m.hexdigest()
+GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = 
+ m.hexdigest()
 
 def _GetMetaFiles(self, Target, Toolchain, Arch):
 AllWorkSpaceMetaFiles = set()
@@ -4432,13 +4435,13 @@ class ModuleAutoGen(AutoGen):
 m.update(GlobalData.gPlatformHash)
 # Add Package level hash
 if self.DependentPackageList:
-for Pkg in self.DependentPackageList:
+for Pkg in sorted(self.DependentPackageList, key=lambda x: 
x.PackageName):
 if Pkg.PackageName in GlobalData.gPackageHash[self.Arch]:
 
m.update(GlobalData.gPackageHash[self.Arch][Pkg.PackageName])
 
 # Add Library hash
 if self.LibraryAutoGenList:
-for Lib in self.LibraryAutoGenList:
+for Lib in sorted(self.LibraryAutoGenList, key=lambda x: x.Name):
 if Lib.Name not in GlobalData.gModuleHash[self.Arch]:
 Lib.GenModuleHash()
 m.update(GlobalData.gModuleHash[self.Arch][Lib.Name])
@@ -4450,7 +4453,7 @@ class ModuleAutoGen(AutoGen):
 m.update(Content)
 # Add Module's source files
 if self.SourceFileList:
-for File in self.SourceFileList:
+for File in sorted(self.SourceFileList, key=lambda x: str(x)):
 f = open(str(File), 'r')
 Content = f.read()
 f.close()
--
2.15.1.windows.2


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


[edk2] [PATCH] BaseTools: Fix python error with --genfds-multi-thread.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
When self.Alignment is None, it ran into python error since there is no
strip() in None.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Derek Lin 
---
 BaseTools/Source/Python/GenFds/GuidSection.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py 
b/BaseTools/Source/Python/GenFds/GuidSection.py
index 1105689e0d..6cadff0bd2 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -2,7 +2,7 @@
 # process GUIDed section generation
 #
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved. -#
+#  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
 #  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 @@ 
-273,7 +273,7 @@ class GuidSection(GuidSectionClassObject) :
 self.Alignment = None
 self.IncludeFvSection = False
 self.ProcessRequired = "TRUE"
-if IsMakefile and self.Alignment.strip() == '0':
+if IsMakefile and self.Alignment is not None and 
self.Alignment.strip() == '0':
 self.Alignment = '1'
 return OutputFileList, self.Alignment
 
--
2.15.1.windows.2

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


[edk2] [PATCH] BaseTools: Remove dsc nested include checking.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
The dsc nested include checking make unexpected build error when building 
project A and switch to project B.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Derek Lin 
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 36843643ed..e1f4ea995d 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -2,7 +2,7 @@
 # This file is used to parse meta files  #  # Copyright (c) 2008 - 2018, Intel 
Corporation. All rights reserved. -# (C) Copyright 2015-2016 Hewlett 
Packard Enterprise Development LP
+# (C) Copyright 2015-2018 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 @@ 
-1551,10 +1551,21 @@ class DscParser(MetaFileParser):
 
 self.IncludedFiles.add (IncludedFile1)
 
+# todo: rework the nested include checking logic
+# Current nested include checking rely on dsc file order inside 
build.db.
+# It is not reliable and will lead to build fail in some case.
+#
+# When project A and B include a common dsc file C.
+# Build project A. It give dsc file A = ID 1 in build.db, and C ID 
= 2.
+# Build project B. It give dsc file B ID = 3, and C ID still = 2.
+# Then, we build project B fail, unless we clean build.db.
+# In oldder BaseTools, the project B ID will still be 1,
+# that's why it work before.
+
 # Does not allow lower level included file to include upper level 
included file
-if Parser._From != Owner and int(Owner) > int (Parser._From):
-EdkLogger.error('parser', FILE_ALREADY_EXIST, 
File=self._FileWithError,
-Line=self._LineIndex + 1, ExtraData="{0} is already 
included at a higher level.".format(IncludedFile1))
+#if Parser._From != Owner and int(Owner) > int (Parser._From):
+#EdkLogger.error('parser', FILE_ALREADY_EXIST, 
File=self._FileWithError,
+#Line=self._LineIndex + 1, ExtraData="{0} is already 
included at a higher level.".format(IncludedFile1))
 
 
 # set the parser status with current status
--
2.15.1.windows.2

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


[edk2] [PATCH] BaseTools: Fix --hash Package and Module hash value.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
The order of List enumeration is arbitrary.
Need to be sorted while calculating Package/Module hash, otherwise it generate 
different hash value even nothing changes.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Derek Lin 
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 54f6b1f173..90704dcae4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2,6 +2,7 @@
 # Generate AutoGen.h, AutoGen.c and *.depex files  #  # Copyright (c) 2007 - 
2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
 # 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 @@ 
-670,6 +671,9 @@ class WorkspaceAutoGen(AutoGen):
 return True
 
 def _GenPkgLevelHash(self, Pkg):
+if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]:
+return
+
 PkgDir = os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName)
 CreateDirectory(PkgDir)
 HashFile = os.path.join(PkgDir, Pkg.PackageName + '.hash') @@ -681,17 
+685,16 @@ class WorkspaceAutoGen(AutoGen):
 m.update(Content)
 # Get include files hash value
 if Pkg.Includes:
-for inc in Pkg.Includes:
+for inc in sorted(Pkg.Includes, key=lambda x: str(x)):
 for Root, Dirs, Files in os.walk(str(inc)):
-for File in Files:
+for File in sorted(Files):
 File_Path = os.path.join(Root, File)
 f = open(File_Path, 'r')
 Content = f.read()
 f.close()
 m.update(Content)
 SaveFileOnChange(HashFile, m.hexdigest(), True)
-if Pkg.PackageName not in GlobalData.gPackageHash[Pkg.Arch]:
-GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = m.hexdigest()
+GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = 
+ m.hexdigest()
 
 def _GetMetaFiles(self, Target, Toolchain, Arch):
 AllWorkSpaceMetaFiles = set()
@@ -4432,13 +4435,13 @@ class ModuleAutoGen(AutoGen):
 m.update(GlobalData.gPlatformHash)
 # Add Package level hash
 if self.DependentPackageList:
-for Pkg in self.DependentPackageList:
+for Pkg in sorted(self.DependentPackageList, key=lambda x: 
x.PackageName):
 if Pkg.PackageName in GlobalData.gPackageHash[self.Arch]:
 
m.update(GlobalData.gPackageHash[self.Arch][Pkg.PackageName])
 
 # Add Library hash
 if self.LibraryAutoGenList:
-for Lib in self.LibraryAutoGenList:
+for Lib in sorted(self.LibraryAutoGenList, key=lambda x: x.Name):
 if Lib.Name not in GlobalData.gModuleHash[self.Arch]:
 Lib.GenModuleHash()
 m.update(GlobalData.gModuleHash[self.Arch][Lib.Name])
@@ -4450,7 +4453,7 @@ class ModuleAutoGen(AutoGen):
 m.update(Content)
 # Add Module's source files
 if self.SourceFileList:
-for File in self.SourceFileList:
+for File in sorted(self.SourceFileList, key=lambda x: str(x)):
 f = open(str(File), 'r')
 Content = f.read()
 f.close()
--
2.15.1.windows.2

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


[edk2] [PATCH] BaseTools: Remove dsc nested include checking.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
From: Lin, Derek (HPS UEFI Dev) 
Sent: Wednesday, May 9, 2018 3:39 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Subject: [PATCH] BaseTools: Remove dsc nested include checking.

The dsc nested include checking make unexpected build error when building 
project A and switch to project B.
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 36843643ed..092253530f 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -2,7 +2,7 @@
 # This file is used to parse meta files  #  # Copyright (c) 2008 - 2018, Intel 
Corporation. All rights reserved. -# (C) Copyright 2015-2016 Hewlett 
Packard Enterprise Development LP
+# (C) Copyright 2015-2018 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 @@ 
-1551,10 +1551,21 @@ class DscParser(MetaFileParser):
 
 self.IncludedFiles.add (IncludedFile1)
 
+# todo: rework the nested include checking logic
+# Current nested include checking rely on dsc file order inside 
build.db.
+# It is not reliable and will lead to build fail in some case.
+#
+# When project A and B include a common dsc file C.
+# Build project A. It give dsc file A = ID 1 in build.db, and C ID 
= 2.
+# Build project B. It give dsc file B ID = 3, and C ID still = 2.
+# Then, we build project B fail, unless we clean build.db.
+# In oldder BaseTools, the project B ID will still be 1, 
+# that's why it work before.
+
 # Does not allow lower level included file to include upper level 
included file
-if Parser._From != Owner and int(Owner) > int (Parser._From):
-EdkLogger.error('parser', FILE_ALREADY_EXIST, 
File=self._FileWithError,
-Line=self._LineIndex + 1, ExtraData="{0} is already 
included at a higher level.".format(IncludedFile1))
+#if Parser._From != Owner and int(Owner) > int (Parser._From):
+#EdkLogger.error('parser', FILE_ALREADY_EXIST, 
File=self._FileWithError,
+#Line=self._LineIndex + 1, ExtraData="{0} is already 
included at a higher level.".format(IncludedFile1))
 
 
 # set the parser status with current status
--
2.15.1.windows.2

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


[edk2] [PATCH] BaseTools: Fix --hash Package and Module hash value.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
From: Lin, Derek (HPS UEFI Dev) 
Sent: Wednesday, May 9, 2018 3:39 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Subject: [PATCH] BaseTools: Fix --hash Package and Module hash value.

The order of List enumeration is arbitrary.
Need to be sorted while calculating Package/Module hash, otherwise it generate 
different hash value even nothing changes.
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 17 ++---
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index 54f6b1f173..90704dcae4 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -2,6 +2,7 @@
 # Generate AutoGen.h, AutoGen.c and *.depex files  #  # Copyright (c) 2007 - 
2018, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
 # 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 @@ 
-670,6 +671,9 @@ class WorkspaceAutoGen(AutoGen):
 return True
 
 def _GenPkgLevelHash(self, Pkg):
+if Pkg.PackageName in GlobalData.gPackageHash[Pkg.Arch]:
+return
+
 PkgDir = os.path.join(self.BuildDir, Pkg.Arch, Pkg.PackageName)
 CreateDirectory(PkgDir)
 HashFile = os.path.join(PkgDir, Pkg.PackageName + '.hash') @@ -681,17 
+685,16 @@ class WorkspaceAutoGen(AutoGen):
 m.update(Content)
 # Get include files hash value
 if Pkg.Includes:
-for inc in Pkg.Includes:
+for inc in sorted(Pkg.Includes, key=lambda x: str(x)):
 for Root, Dirs, Files in os.walk(str(inc)):
-for File in Files:
+for File in sorted(Files):
 File_Path = os.path.join(Root, File)
 f = open(File_Path, 'r')
 Content = f.read()
 f.close()
 m.update(Content)
 SaveFileOnChange(HashFile, m.hexdigest(), True)
-if Pkg.PackageName not in GlobalData.gPackageHash[Pkg.Arch]:
-GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = m.hexdigest()
+GlobalData.gPackageHash[Pkg.Arch][Pkg.PackageName] = 
+ m.hexdigest()
 
 def _GetMetaFiles(self, Target, Toolchain, Arch):
 AllWorkSpaceMetaFiles = set()
@@ -4432,13 +4435,13 @@ class ModuleAutoGen(AutoGen):
 m.update(GlobalData.gPlatformHash)
 # Add Package level hash
 if self.DependentPackageList:
-for Pkg in self.DependentPackageList:
+for Pkg in sorted(self.DependentPackageList, key=lambda x: 
x.PackageName):
 if Pkg.PackageName in GlobalData.gPackageHash[self.Arch]:
 
m.update(GlobalData.gPackageHash[self.Arch][Pkg.PackageName])
 
 # Add Library hash
 if self.LibraryAutoGenList:
-for Lib in self.LibraryAutoGenList:
+for Lib in sorted(self.LibraryAutoGenList, key=lambda x: x.Name):
 if Lib.Name not in GlobalData.gModuleHash[self.Arch]:
 Lib.GenModuleHash()
 m.update(GlobalData.gModuleHash[self.Arch][Lib.Name])
@@ -4450,7 +4453,7 @@ class ModuleAutoGen(AutoGen):
 m.update(Content)
 # Add Module's source files
 if self.SourceFileList:
-for File in self.SourceFileList:
+for File in sorted(self.SourceFileList, key=lambda x: str(x)):
 f = open(str(File), 'r')
 Content = f.read()
 f.close()
--
2.15.1.windows.2

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


[edk2] [PATCH] BaseTools: Fix python error with --genfds-multi-thread.

2018-05-09 Thread Lin, Derek (HPS UEFI Dev)
From: Lin, Derek (HPS UEFI Dev) 
Sent: Wednesday, May 9, 2018 3:39 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Subject: [PATCH] BaseTools: Fix python error with --genfds-multi-thread.

When self.Alignment is None, it ran into python error since there is no strip() 
in None.
---
 BaseTools/Source/Python/GenFds/GuidSection.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/BaseTools/Source/Python/GenFds/GuidSection.py 
b/BaseTools/Source/Python/GenFds/GuidSection.py
index 1105689e0d..6cadff0bd2 100644
--- a/BaseTools/Source/Python/GenFds/GuidSection.py
+++ b/BaseTools/Source/Python/GenFds/GuidSection.py
@@ -2,7 +2,7 @@
 # process GUIDed section generation
 #
 #  Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved. -#
+#  Copyright (c) 2018, Hewlett Packard Enterprise Development, L.P.
 #  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 @@ 
-273,7 +273,7 @@ class GuidSection(GuidSectionClassObject) :
 self.Alignment = None
 self.IncludeFvSection = False
 self.ProcessRequired = "TRUE"
-if IsMakefile and self.Alignment.strip() == '0':
+if IsMakefile and self.Alignment is not None and 
self.Alignment.strip() == '0':
 self.Alignment = '1'
 return OutputFileList, self.Alignment
 
--
2.15.1.windows.2

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


[edk2] MdePkg: UefiTcgPlatform.h: Fix Startup Locality Indicator Definitions

2018-04-09 Thread Lin, Derek (HPS UEFI Dev)
Fix Locality Indicator Definitions according to Table 8 of PC Client PTP 00.43.
https://www.trustedcomputinggroup.org/wp-content/uploads/PC-Client-Specific-Platform-TPM-Profile-for-TPM-2-0-v43-150126.pdf

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Chris Phillips 
---
 MdePkg/Include/IndustryStandard/UefiTcgPlatform.h | 7 ---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h 
b/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
index adbc956f63..93ce34121f 100644
--- a/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
+++ b/MdePkg/Include/IndustryStandard/UefiTcgPlatform.h
@@ -2,6 +2,7 @@
   TCG EFI Platform Definition in TCG_EFI_Platform_1_20_Final
 
   Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
+  (C) Copyright 2018 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 @@ -306,9 +307,9 @@ typedef struct {  //
 #define LOCALITY_0_INDICATOR0x01
 #define LOCALITY_1_INDICATOR0x02
-#define LOCALITY_2_INDICATOR0x03
-#define LOCALITY_3_INDICATOR0x04
-#define LOCALITY_4_INDICATOR0x05
+#define LOCALITY_2_INDICATOR0x04
+#define LOCALITY_3_INDICATOR0x08
+#define LOCALITY_4_INDICATOR0x10
 
 
 //
--
2.15.1.windows.2

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


Re: [edk2] TPM 2.0 Manufacutre ID wrong byte order

2018-02-25 Thread Lin, Derek (HPS UEFI Dev)
I agree. Add comments to make this clear seems good.
It's good enough for me.

Thanks,
Derek

-Original Message-
From: Zhang, Chao B [mailto:chao.b.zh...@intel.com] 
Sent: Saturday, February 24, 2018 2:26 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen@intel.com>; Zeng, Star <star.z...@intel.com>
Subject: RE: TPM 2.0 Manufacutre ID wrong byte order

Derek:
   Thank you for the info. TPM Library spec 1.38. Page 342 defines each 
property to be a 32-bit value. Endian conversion only applies to those 32-bit 
value that are interpreted as 16-bit, 32-bit data outside. 
It doesn't apply to the PT_MANFACTURER case. We can add comments to make this 
interface clearer. But I think current implementation is good from spec point 
of view.   


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Lin, 
Derek (HPS UEFI Dev)
Sent: Friday, February 23, 2018 4:08 PM
To: Zhang, Chao B <chao.b.zh...@intel.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen@intel.com>; Zeng, Star <star.z...@intel.com>
Subject: Re: [edk2] TPM 2.0 Manufacutre ID wrong byte order

Hi Chao B,

I think you are right, the Manufacture ID is a byte array. The order in ACPI 
HID is correct.

But Tpm2GetCapabilityManufactureID return a UINT32 value.
EFI_STATUS
EFIAPI
Tpm2GetCapabilityManufactureID (
  OUT UINT32*ManufactureId
  )


This is confused . When the caller use ManufactureId as UINT32, the byte order 
is confused.
For example in Tcg2Dxe.c, it print:
Tpm2GetCapabilityManufactureID - 204D5453

Which should be "53544D20" in the case.

  Status = Tpm2GetCapabilityManufactureID ();
  if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tpm2GetCapabilityManufactureID fail!\n"));
  } else {
DEBUG ((EFI_D_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", 
mTcgDxeData.BsCap.ManufacturerID));
  }

How about changing the returning value to a 4 bytes array?

Thanks,
Derek

From: Zhang, Chao B [mailto:chao.b.zh...@intel.com]
Sent: Friday, February 23, 2018 11:03 AM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen@intel.com>; Zeng, Star <star.z...@intel.com>
Subject: RE: TPM 2.0 Manufacutre ID wrong byte order

Hi Derek:
Can you specify the "reversed" ManufactureId issue?  What did you get from 
this interface?
The implementation follows Vendor ID registry spec. The vendor ID is octet 
array. There is no endian issue here.
We haven't seen any disorder before.


From: Lin, Derek (HPS UEFI Dev) [mailto:derek.l...@hpe.com]
Sent: Thursday, February 22, 2018 7:25 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Zhang, Chao B 
<chao.b.zh...@intel.com<mailto:chao.b.zh...@intel.com>>
Cc: Yao, Jiewen <jiewen@intel.com<mailto:jiewen@intel.com>>; Zeng, Star 
<star.z...@intel.com<mailto:star.z...@intel.com>>
Subject: TPM 2.0 Manufacutre ID wrong byte order

Hi TPM expert,

The line in 
https://github.com/tianocore/edk2/commit/73126ac2bd9804632255b2fddd4d7633537c9620#diff-76abe1c1ebf05982ed72eaf56f489029R192
 change the byte order of Manufacture ID in Tpm2GetCapabilityManufactureID ().

I see it return "reversed" ManufactureId for two TPM vendor's module.
Also, all other Capability data in Tpm2Capability.c use SwapBytes32 since TPM 
is big-endian, which seems correct.

Can you check this and confirm?

Thanks,
Derek

___
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] TPM 2.0 Manufacutre ID wrong byte order

2018-02-23 Thread Lin, Derek (HPS UEFI Dev)
Hi Chao B,

I think you are right, the Manufacture ID is a byte array. The order in ACPI 
HID is correct.

But Tpm2GetCapabilityManufactureID return a UINT32 value.
EFI_STATUS
EFIAPI
Tpm2GetCapabilityManufactureID (
  OUT UINT32*ManufactureId
  )


This is confused . When the caller use ManufactureId as UINT32, the byte order 
is confused.
For example in Tcg2Dxe.c, it print:
Tpm2GetCapabilityManufactureID - 204D5453

Which should be "53544D20" in the case.

  Status = Tpm2GetCapabilityManufactureID ();
  if (EFI_ERROR (Status)) {
DEBUG ((EFI_D_ERROR, "Tpm2GetCapabilityManufactureID fail!\n"));
  } else {
DEBUG ((EFI_D_INFO, "Tpm2GetCapabilityManufactureID - %08x\n", 
mTcgDxeData.BsCap.ManufacturerID));
  }

How about changing the returning value to a 4 bytes array?

Thanks,
Derek

From: Zhang, Chao B [mailto:chao.b.zh...@intel.com]
Sent: Friday, February 23, 2018 11:03 AM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org
Cc: Yao, Jiewen <jiewen@intel.com>; Zeng, Star <star.z...@intel.com>
Subject: RE: TPM 2.0 Manufacutre ID wrong byte order

Hi Derek:
Can you specify the "reversed" ManufactureId issue?  What did you get from 
this interface?
The implementation follows Vendor ID registry spec. The vendor ID is octet 
array. There is no endian issue here.
We haven't seen any disorder before.


From: Lin, Derek (HPS UEFI Dev) [mailto:derek.l...@hpe.com]
Sent: Thursday, February 22, 2018 7:25 PM
To: edk2-devel@lists.01.org<mailto:edk2-devel@lists.01.org>; Zhang, Chao B 
<chao.b.zh...@intel.com<mailto:chao.b.zh...@intel.com>>
Cc: Yao, Jiewen <jiewen@intel.com<mailto:jiewen@intel.com>>; Zeng, Star 
<star.z...@intel.com<mailto:star.z...@intel.com>>
Subject: TPM 2.0 Manufacutre ID wrong byte order

Hi TPM expert,

The line in 
https://github.com/tianocore/edk2/commit/73126ac2bd9804632255b2fddd4d7633537c9620#diff-76abe1c1ebf05982ed72eaf56f489029R192
 change the byte order of Manufacture ID in Tpm2GetCapabilityManufactureID ().

I see it return "reversed" ManufactureId for two TPM vendor's module.
Also, all other Capability data in Tpm2Capability.c use SwapBytes32 since TPM 
is big-endian, which seems correct.

Can you check this and confirm?

Thanks,
Derek

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


[edk2] TPM 2.0 Manufacutre ID wrong byte order

2018-02-22 Thread Lin, Derek (HPS UEFI Dev)
Hi TPM expert,

The line in 
https://github.com/tianocore/edk2/commit/73126ac2bd9804632255b2fddd4d7633537c9620#diff-76abe1c1ebf05982ed72eaf56f489029R192
 change the byte order of Manufacture ID in Tpm2GetCapabilityManufactureID ().

I see it return "reversed" ManufactureId for two TPM vendor's module.
Also, all other Capability data in Tpm2Capability.c use SwapBytes32 since TPM 
is big-endian, which seems correct.

Can you check this and confirm?

Thanks,
Derek

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


Re: [edk2] [PATCH] BaseTools: Skip module AutoGen by comparing timestamp.

2016-11-20 Thread Lin, Derek (HPS UEFI Dev)
Hi Yonghong,

Thanks for review.
I just sent a patch v2 to fix them.

Thanks,
Derek

-Original Message-
From: Zhu, Yonghong [mailto:yonghong@intel.com] 
Sent: Saturday, November 19, 2016 9:43 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; 'edk2-devel@lists.01.org' 
<edk2-devel@lists.01.org>
Cc: Gao, Liming <liming@intel.com>; Zhu, Yonghong <yonghong@intel.com>
Subject: RE: [PATCH] BaseTools: Skip module AutoGen by comparing timestamp.

Hi Derek Lin,

Thanks for your contribution. I tried this patch and have few comments.
1.  build MdeModulePkg failure. Please help to fix. Thanks.

File "D:\Git_Latest\edk2\BaseTools\Source\Python\AutoGen\AutoGen.py", line 702, 
in _CreateMetaFileList
AllWorkSpaceMetaFiles.append (self.FdfFile.Path)
AttributeError: 'str' object has no attribute 'Path'

2. Please help to use the PatchCheck.py under BaseTools\Scripts to fix some 
coding style issues. Thanks.

Best Regards,
Zhu Yonghong


-Original Message-
From: Zhu, Yonghong 
Sent: Friday, November 18, 2016 1:18 PM
To: Derek Lin <derek.l...@hpe.com>; edk2-devel@lists.01.org
Cc: Gao, Liming <liming@intel.com>; Zhu, Yonghong <yonghong@intel.com>
Subject: RE: [PATCH] BaseTools: Skip module AutoGen by comparing timestamp.

Thanks for your contribution. I will review it and do some verification. May 
give comment later.

Best Regards,
Zhu Yonghong

-Original Message-
From: Derek Lin [mailto:derek.l...@hpe.com] 
Sent: Friday, November 18, 2016 10:30 AM
To: edk2-devel@lists.01.org
Cc: derek.l...@hpe.com; Zhu, Yonghong <yonghong@intel.com>; Gao, Liming 
<liming@intel.com>
Subject: [PATCH] BaseTools: Skip module AutoGen by comparing timestamp.

[Introduction]

The BaseTool Build.py AutoGen parse INF meta-file and generate 
AutoGen.c/AutoGen.h/makefile. When we only change .c .h code, the AutoGen might 
be not necessary, but Build.py spend a lot of time on it.
There's a -u flag to skip all module's AutoGen. In my environment, it save 
35%~50% of time in rebuild a ROM.
However, if user change one .INF meta-file, then -u flag is not available.

[Idea]

AutoGen can compare meta-file's timestamp and decide if the module's AutoGen 
can be skipped. With this, when a module's INF is changed, we only run this 
module's AutoGen, we don't need to run other module's.

[Implementation]

In the end of a module's AutoGen, we create a AutoGenTimeStamp.
The file save a file list that related to this module's AutoGen.
In other word, the file list in AutoGenTimeStamp is INPUT files of module 
AutoGen, AutoGenTimeStamp file is OUTPUT.
During rebuild, we compare time stamp between INPUT and OUTPUT, and decide if 
we can skip it.

Below is the Input/Output of a module's AutoGen.

[Input]
  1. All the DSC/DEC/FDF used by the platform.
  2. INF file of a module.
  3. Source files of a module, list in [Sources] section of INF.
  4. All the library link by the module.
  5. All the .h files included by the module's sources.
[Output]
  AutoGen.c/AutoGen.h/makefile/AutoGenTimeStamp

[Testing]

This patch save my build time. When I make a change without touching 
DSC/DEC/FDF, it is absolutely much faster than original rebuild, 35%~50% time 
saving in my environment (compare to original tool rebuild time).
If I change any DSC/DEC/FDF, there's no performance improve, because it can't 
skip any module's AutoGen.

Please note that if your environment will generate DSC/FDF during prebuild, it 
will not skip any AutoGen because of DSC timestamp is changed. This will 
require prebuild script not to update meta file when content is not changed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Derek Lin <derek.l...@hpe.com>
---
 BaseTools/Source/Python/AutoGen/AutoGen.py | 110 +
 BaseTools/Source/Python/AutoGen/GenMake.py |   3 +
 BaseTools/Source/Python/GenFds/FdfParser.py|   4 +
 .../Source/Python/Workspace/MetaFileParser.py  |   4 +
 4 files changed, 121 insertions(+)

diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py 
b/BaseTools/Source/Python/AutoGen/AutoGen.py
index f35ae25..daa5b35 100644
--- a/BaseTools/Source/Python/AutoGen/AutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/AutoGen.py
@@ -42,6 +42,7 @@ from GenPcdDb import CreatePcdDatabaseCode  from 
Workspace.MetaFileCommentParser import UsageList  from Common.MultipleWorkspace 
import MultipleWorkspace as mws  import InfSectionParser
+import datetime
 
 ## Regular expression for splitting Dependency Expression string into tokens  
gDepexTokenPattern = re.compile("(\(|\)|\w+| \S+\.inf)") @@ -640,6 +641,31 @@ 
class WorkspaceAutoGen(AutoGen):
 self._MakeFileDir = None
 self._BuildCommand = None
 
+#
+# Create list of metafiles of the workspace
+#
+AllWorkSpaceMetaFiles = self._CreateMetaFileList()
+  
+#
+# Retrieve latest mo

Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-27 Thread Lin, Derek (HPS UEFI Dev)
That make sense to me, I will update patch to remove it, and not change order.

Thanks,
Derek

-Original Message-
From: Gao, Liming [mailto:liming@intel.com] 
Sent: Thursday, October 27, 2016 1:53 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; af...@apple.com
Cc: edk2-devel@lists.01.org
Subject: RE: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

I agree with Andrew to only add the missing Ppi/Protocol/Guid used in Library 
INF file. 

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Lin, Derek (HPS UEFI Dev)
> Sent: Thursday, October 27, 2016 1:50 PM
> To: af...@apple.com
> Cc: edk2-devel@lists.01.org
> Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> Andrew,
> 
> The ModuleGuidDict was not for performance, it's because Arch IA32 X64 
> have same library name/FILE_GUID pair, for not duplicate it.
> You are right the patch add library FILE_GUID but they are not end up 
> in the ROM, I'm ok remove it or not.
> 
> Feel free to update the patch.
> 
> Thanks,
> Derek
> 
> -Original Message-
> From: af...@apple.com [mailto:af...@apple.com]
> Sent: Thursday, October 27, 2016 1:25 PM
> To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
> Cc: edk2-devel@lists.01.org; Shia, Cinnamon <cinnamon.s...@hpe.com>
> Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> 
> > On Oct 26, 2016, at 9:09 PM, Lin, Derek (HPS UEFI Dev)
> <derek.l...@hpe.com> wrote:
> >
> > Hi Andrew,
> >
> > We also see this issue recently. And we have a fix. I've send email 
> > patch
> minutes ago.
> >
> 
> Derek,
> 
> Thanks for sharing the fix.
> 
> I noticed it introduced a build failure for a badly formed library INF 
> file. I assume that means this fix is pulling in libraries that are in 
> the DSC file, but not currently being built? That is not really a 
> problem as it means you have too many GUID vs. not enough.
> 
> I also noticed that your fix adds the FILE_GUID values for all the 
> libraries. The FILE_GUID values for the any PEIM, DXE/UEFI driver that 
> end up in an FV will be present in the ROM, but the library values do 
> not end up in the ROM. Also by changing the code to use a Python 
> dictionary the order of everything changed. I had a debugger command 
> that would just dump out the FILE_GUDs, so it would be good to maintain the 
> old behavior.
> 
>  GuidDict = {}
>  for Arch in ArchList:
>  PlatformDataBase =
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> -for ModuleFile in PlatformDataBase.Modules:
> +for ModuleFile in [x for x in PlatformDataBase.Modules] + 
> + [x for x in
> PlatformDataBase.LibraryInstances]:
>  Module = BuildDb.BuildObject[ModuleFile, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> -GuidXRefFile.write("%s %s\n" % (Module.Guid, 
> Module.BaseName))
> +if ModuleFile in PlatformDataBase.Modules:
> +GuidXRefFile.write("%s %s\n" % (Module.Guid,
> Module.BaseName))
>  for key, item in Module.Protocols.items():
>  GuidDict[key] = item
>  for key, item in Module.Guids.items():
> 
> If your adding ModuleGuidDict was a performance fix, I guess I could 
> just make it a list to keep order.
> 
> Thanks,
> 
> Andrew Fish
> 
> > Thanks,
> > Derek
> >
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of
> Andrew Fish
> > Sent: Thursday, October 27, 2016 9:08 AM
> > To: edk2-devel <edk2-devel@lists.01.org>
> > Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> >
> > I noticed if a GUID (PPI & Protocol) was only used via a library it 
> > does not
> end up in the Guid.xref file.
> >
> > It looks to me like this code is only extracting the GUIDs from the 
> > Drivers
> INF file and the GUIDs defined in dependent libraries are skipped?
> >
> >
> >
> https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/
> GenFds/GenFds.py#L701
> <https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Pytho
> n/GenFds/GenFds.py#L701>
> >
> >for Arch in ArchList:
> >PlatformDataBase =
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
> >   

Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Lin, Derek (HPS UEFI Dev)
Andrew,

The ModuleGuidDict was not for performance, it's because Arch IA32 X64 have 
same library name/FILE_GUID pair, for not duplicate it.
You are right the patch add library FILE_GUID but they are not end up in the 
ROM, I'm ok remove it or not.

Feel free to update the patch.

Thanks,
Derek

-Original Message-
From: af...@apple.com [mailto:af...@apple.com] 
Sent: Thursday, October 27, 2016 1:25 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Cc: edk2-devel@lists.01.org; Shia, Cinnamon <cinnamon.s...@hpe.com>
Subject: Re: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.


> On Oct 26, 2016, at 9:09 PM, Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com> 
> wrote:
> 
> Hi Andrew,
> 
> We also see this issue recently. And we have a fix. I've send email patch 
> minutes ago.
> 

Derek,

Thanks for sharing the fix. 

I noticed it introduced a build failure for a badly formed library INF file. I 
assume that means this fix is pulling in libraries that are in the DSC file, 
but not currently being built? That is not really a problem as it means you 
have too many GUID vs. not enough. 

I also noticed that your fix adds the FILE_GUID values for all the libraries. 
The FILE_GUID values for the any PEIM, DXE/UEFI driver that end up in an FV 
will be present in the ROM, but the library values do not end up in the ROM. 
Also by changing the code to use a Python dictionary the order of everything 
changed. I had a debugger command that would just dump out the FILE_GUDs, so it 
would be good to maintain the old behavior. 

 GuidDict = {}
 for Arch in ArchList:
 PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-for ModuleFile in PlatformDataBase.Modules:
+for ModuleFile in [x for x in PlatformDataBase.Modules] + [x for x 
in PlatformDataBase.LibraryInstances]:
 Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
-GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
+if ModuleFile in PlatformDataBase.Modules:
+GuidXRefFile.write("%s %s\n" % (Module.Guid, 
Module.BaseName))
 for key, item in Module.Protocols.items():
 GuidDict[key] = item
 for key, item in Module.Guids.items():

If your adding ModuleGuidDict was a performance fix, I guess I could just make 
it a list to keep order. 

Thanks,

Andrew Fish

> Thanks,
> Derek
> 
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
> Fish
> Sent: Thursday, October 27, 2016 9:08 AM
> To: edk2-devel <edk2-devel@lists.01.org>
> Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.
> 
> I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
> end up in the Guid.xref file. 
> 
> It looks to me like this code is only extracting the GUIDs from the Drivers 
> INF file and the GUIDs defined in dependent libraries are skipped?  
> 
> 
> https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
>  
> <https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701>
> 
>for Arch in ArchList:
>PlatformDataBase = 
> BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>for ModuleFile in PlatformDataBase.Modules:
>Module = BuildDb.BuildObject[ModuleFile, Arch, 
> GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
>GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
>for key, item in Module.Protocols.items():
>GuidDict[key] = item
>for key, item in Module.Guids.items():
>GuidDict[key] = item
>for key, item in Module.Ppis.items():
>GuidDict[key] = item
> 
> 
> Does anyone know how to extract the info from the dependent libs? 
> 
> I have an lldb type formatter for EFI_GUID that will print out the GUID C 
> name so I noticed when some of them went missing. 
> 
> Thanks,
> 
> Andrew Fish
> ___
> 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] [BaseTools] Library GUIDs missing from Guid.xref file.

2016-10-26 Thread Lin, Derek (HPS UEFI Dev)
Hi Andrew,

We also see this issue recently. And we have a fix. I've send email patch 
minutes ago.

Thanks,
Derek

From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Andrew 
Fish
Sent: Thursday, October 27, 2016 9:08 AM
To: edk2-devel 
Subject: [edk2] [BaseTools] Library GUIDs missing from Guid.xref file.

I noticed if a GUID (PPI & Protocol) was only used via a library it does not 
end up in the Guid.xref file. 

It looks to me like this code is only extracting the GUIDs from the Drivers INF 
file and the GUIDs defined in dependent libraries are skipped?  


https://github.com/tianocore/edk2/blob/master/BaseTools/Source/Python/GenFds/GenFds.py#L701
 


for Arch in ArchList:
PlatformDataBase = 
BuildDb.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
for ModuleFile in PlatformDataBase.Modules:
Module = BuildDb.BuildObject[ModuleFile, Arch, 
GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]
GuidXRefFile.write("%s %s\n" % (Module.Guid, Module.BaseName))
for key, item in Module.Protocols.items():
GuidDict[key] = item
for key, item in Module.Guids.items():
GuidDict[key] = item
for key, item in Module.Ppis.items():
GuidDict[key] = item


Does anyone know how to extract the info from the dependent libs? 

I have an lldb type formatter for EFI_GUID that will print out the GUID C name 
so I noticed when some of them went missing. 

Thanks,

Andrew Fish
___
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] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Lin, Derek (HPS UEFI Dev)
Thanks.
I agree, will send a patch soon.

Derek

-Original Message-
From: Yao, Jiewen [mailto:jiewen@intel.com] 
Sent: Friday, April 29, 2016 6:29 PM
To: Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>; Zhang, Chao B 
<chao.b.zh...@intel.com>; El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; 
edk2-devel@lists.01.org
Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

Thanks. That makes sense now. Would you please update commit message?

I agree to reduce debug message. I think below message is of much importance to 
show TPM capability and narrow BitLock failure, per my experience.

I suggest we keep those as INFO. For others, I am OK to change to VERBOSE.

 DEBUG ((EFI_D_INFO, "Tcg2.SupportedEventLogs - 0x%08x\n", 
mTcgDxeData.BsCap.SupportedEventLogs));
 DEBUG ((EFI_D_INFO, "Tcg2.HashAlgorithmBitmap - 0x%08x\n", 
mTcgDxeData.BsCap.HashAlgorithmBitmap));
 DEBUG ((EFI_D_INFO, "Tcg2.NumberOfPCRBanks  - 0x%08x\n", 
mTcgDxeData.BsCap.NumberOfPCRBanks));
 DEBUG ((EFI_D_INFO, "Tcg2.ActivePcrBanks- 0x%08x\n", 
mTcgDxeData.BsCap.ActivePcrBanks));



> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Lin, Derek (HPS UEFI Dev)
> Sent: Friday, April 29, 2016 5:59 PM
> To: Yao, Jiewen <jiewen@intel.com>; Zhang, Chao B 
> <chao.b.zh...@intel.com>; El-Haj-Mahmoud, Samer 
> <samer.el-haj-mahm...@hpe.com>; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> Tcg2Dxe
> 
> Hi Jiewen,
> 
> It is test with TPM 2.0 part present. There is debug message around 
> each driver loading, which we think should be verbose.
> The commit description is wrong.
> 
> Thanks,
> Derek
> 
> -Original Message-
> From: Yao, Jiewen [mailto:jiewen@intel.com]
> Sent: Friday, April 29, 2016 10:38 AM
> To: Zhang, Chao B <chao.b.zh...@intel.com>; El-Haj-Mahmoud, Samer 
> <samer.el-haj-mahm...@hpe.com>; edk2-devel@lists.01.org
> Cc: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; Lin, Derek 
> (HPS UEFI Dev) <derek.l...@hpe.com>; Yao, Jiewen 
> <jiewen@intel.com>
> Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Chao
> I have question on this patch. I asked in another mail.
> 
> If there is no TPM 2.0 part present, this code should not run, by design.
> 
> Would you please clarify how you trigger this situation?
> 
> Thank you
> Yao Jiewen
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of Zhang, Chao B
> > Sent: Friday, April 29, 2016 10:31 AM
> > To: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@hpe.com>; 
> > edk2-devel@lists.01.org
> > Cc: Samer El-Haj-Mahmoud <el...@hpe.com>; Derek Lin 
> > <derek.l...@hpe.com>
> > Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> > Tcg2Dxe
> >
> > Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
> >
> >
> >
> >
> >
> >
> > Thanks & Best regards
> > Chao Zhang
> >
> >
> > -Original Message-
> > From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hpe.com]
> > Sent: Friday, April 29, 2016 4:47 AM
> > To: edk2-devel@lists.01.org
> > Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud;
> Derek
> > Lin
> > Subject: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> >
> > Reduce several DEBUG messages verbosity from INFO to VERBOSE to
> reduce
> > debug spam when there is no TPM 2.0 part present
> >
> > Contributed-under: TianoCore Contribution Agreement 1.0
> > Signed-off-by: Samer El-Haj-Mahmoud <el...@hpe.com>
> > Signed-off-by: Derek Lin <derek.l...@hpe.com>
> > ---
> >  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 21 +++--
> >  1 file changed, 11 insertions(+), 10 deletions(-)
> >
> > diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > index 07f76af..6555df5 100644
> > --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> > @@ -2,6 +2,7 @@
> >This module implements Tcg2 Protocol.
> >
> >  Copyright (c) 2015 - 2016, 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 
> > fo

Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

2016-04-29 Thread Lin, Derek (HPS UEFI Dev)
Hi Jiewen,

It is test with TPM 2.0 part present. There is debug message around each driver 
loading, which we think should be verbose.
The commit description is wrong.

Thanks,
Derek

-Original Message-
From: Yao, Jiewen [mailto:jiewen@intel.com] 
Sent: Friday, April 29, 2016 10:38 AM
To: Zhang, Chao B <chao.b.zh...@intel.com>; El-Haj-Mahmoud, Samer 
<samer.el-haj-mahm...@hpe.com>; edk2-devel@lists.01.org
Cc: El-Haj-Mahmoud, Samer <samer.el-haj-mahm...@hpe.com>; Lin, Derek (HPS UEFI 
Dev) <derek.l...@hpe.com>; Yao, Jiewen <jiewen@intel.com>
Subject: RE: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe

Chao
I have question on this patch. I asked in another mail.

If there is no TPM 2.0 part present, this code should not run, by design.

Would you please clarify how you trigger this situation?

Thank you
Yao Jiewen

> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Zhang, Chao B
> Sent: Friday, April 29, 2016 10:31 AM
> To: Samer El-Haj-Mahmoud <samer.el-haj-mahm...@hpe.com>; 
> edk2-devel@lists.01.org
> Cc: Samer El-Haj-Mahmoud <el...@hpe.com>; Derek Lin 
> <derek.l...@hpe.com>
> Subject: Re: [edk2] [PATCH] SecurityPkg: Reduce DEBUG verbosity in 
> Tcg2Dxe
> 
> Reviewed-by: Chao Zhang <chao.b.zh...@intel.com>
> 
> 
> 
> 
> 
> 
> Thanks & Best regards
> Chao Zhang
> 
> 
> -Original Message-
> From: Samer El-Haj-Mahmoud [mailto:samer.el-haj-mahm...@hpe.com]
> Sent: Friday, April 29, 2016 4:47 AM
> To: edk2-devel@lists.01.org
> Cc: Zhang, Chao B; Samer El-Haj-Mahmoud; Samer El-Haj-Mahmoud; Derek 
> Lin
> Subject: [PATCH] SecurityPkg: Reduce DEBUG verbosity in Tcg2Dxe
> 
> Reduce several DEBUG messages verbosity from INFO to VERBOSE to reduce 
> debug spam when there is no TPM 2.0 part present
> 
> Contributed-under: TianoCore Contribution Agreement 1.0
> Signed-off-by: Samer El-Haj-Mahmoud <el...@hpe.com>
> Signed-off-by: Derek Lin <derek.l...@hpe.com>
> ---
>  SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c | 21 +++--
>  1 file changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> index 07f76af..6555df5 100644
> --- a/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> +++ b/SecurityPkg/Tcg/Tcg2Dxe/Tcg2Dxe.c
> @@ -2,6 +2,7 @@
>This module implements Tcg2 Protocol.
> 
>  Copyright (c) 2015 - 2016, 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 @@ -332,14 +333,14 @@ Tcg2GetCapability (
>IN OUT EFI_TCG2_BOOT_SERVICE_CAPABILITY *ProtocolCapability
>)
>  {
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability ...\n"));
> 
>if ((This == NULL) || (ProtocolCapability == NULL)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> -  DEBUG ((EFI_D_INFO, "Size - 0x%x\n", ProtocolCapability->Size));
> -  DEBUG ((EFI_D_INFO, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> +  DEBUG ((DEBUG_VERBOSE, "Size - 0x%x\n", ProtocolCapability->Size)); 
> + DEBUG ((DEBUG_VERBOSE, " 1.1 - 0x%x, 1.0 - 0x%x\n", 
> + sizeof(EFI_TCG2_BOOT_SERVICE_CAPABILITY),
> + sizeof(TREE_BOOT_SERVICE_CAPABILITY_1_0)));
> 
>if (ProtocolCapability->Size < mTcgDxeData.BsCap.Size) {
>  //
> @@ -363,7 +364,7 @@ Tcg2GetCapability (
>}
> 
>CopyMem (ProtocolCapability, , 
> mTcgDxeData.BsCap.Size);
> -  DEBUG ((EFI_D_INFO, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2GetCapability - %r\n", EFI_SUCCESS));
>return EFI_SUCCESS;
>  }
> 
> @@ -1237,7 +1238,7 @@ Tcg2HashLogExtendEvent (
>TCG_PCR_EVENT_HDR  NewEventHdr;
>TPML_DIGEST_VALUES DigestList;
> 
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent ...\n"));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent ...\n"));
> 
>if ((This == NULL) || (DataToHash == 0) || (Event == NULL)) {
>  return EFI_INVALID_PARAMETER;
> @@ -1287,7 +1288,7 @@ Tcg2HashLogExtendEvent (
> Event->Event
> );
>}
> -  DEBUG ((EFI_D_INFO, "Tcg2HashLogExtendEvent - %r\n", Status));
> +  DEBUG ((DEBUG_VERBOSE, "Tcg2HashLogExtendEvent - %r\n", Status));
>return Status

Re: [edk2] [PATCH] SecurityPkg: Fix bug in TPM 1.2 SelfTest

2016-04-28 Thread Lin, Derek (HPS UEFI Dev)

This has been sent and reviewed, but not committed yet.

From: El-Haj-Mahmoud, Samer
Sent: Friday, April 29, 2016 4:29:27 AM
To: edk2-devel@lists.01.org
Cc: chao.b.zh...@intel.com; El-Haj-Mahmoud, Samer; El-Haj-Mahmoud, Samer; Lin, 
Derek (HPS UEFI Dev)
Subject: [PATCH] SecurityPkg: Fix bug in TPM 1.2 SelfTest

Fix uninitialized command Length variable in TPM1.2 Self Test command

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <el...@hpe.com>
Signed-off-by: Derek Lin <derek.l...@hpe.com>
---
 SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c 
b/SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c
index cd08d19..8e232ee 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12SelfTest.c
@@ -2,6 +2,7 @@
   Implement TPM1.2 NV Self Test related commands.

 Copyright (c) 2016, 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
@@ -42,5 +43,6 @@ Tpm12ContinueSelfTest (
   Command.tag   = SwapBytes16 (TPM_TAG_RQU_COMMAND);
   Command.paramSize = SwapBytes32 (sizeof (Command));
   Command.ordinal   = SwapBytes32 (TPM_ORD_ContinueSelfTest);
+  Length = sizeof (Response);
   return Tpm12SubmitCommand (sizeof (Command), (UINT8 *), , 
(UINT8 *));
 }
--
2.6.3.windows.1

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


Re: [edk2] [PATCH] SecurityPkg: Fix TPM 1.2 NV Storage Command Size byte order

2016-04-28 Thread Lin, Derek (HPS UEFI Dev)
This patch has been sent and reviewed month ago, but not committed.

-Original Message-
From: El-Haj-Mahmoud, Samer 
Sent: Friday, April 29, 2016 4:24 AM
To: edk2-devel@lists.01.org
Cc: chao.b.zh...@intel.com; El-Haj-Mahmoud, Samer 
<samer.el-haj-mahm...@hpe.com>; El-Haj-Mahmoud, Samer 
<samer.el-haj-mahm...@hpe.com>; Lin, Derek (HPS UEFI Dev) <derek.l...@hpe.com>
Subject: [PATCH] SecurityPkg: Fix TPM 1.2 NV Storage Command Size byte order

Fix Tpm12NvWriteValue() command/response length byte order.
Tpm12SubmitCommand() was using the value from Command.Hdr.paramSize which was 
swapped to be Big Endian, but the function was expecting it in UINT32 Little 
Endian

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Samer El-Haj-Mahmoud <el...@hpe.com>
Signed-off-by: Derek Lin <derek.l...@hpe.com>
---
 SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c | 11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c 
b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
index 7baafa8..e176b00 100644
--- a/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
+++ b/SecurityPkg/Library/Tpm12CommandLib/Tpm12NvStorage.c
@@ -2,6 +2,7 @@
   Implement TPM1.2 NV storage related command.
 
 Copyright (c) 2015 - 2016, 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 @@ -199,8 +200,9 @@ 
Tpm12NvWriteValue (  {
   EFI_STATUS  Status;
   TPM_CMD_NV_WRITE_VALUE  Command;
+  UINT32  CommandLength;
   TPM_RSP_COMMAND_HDR Response;
-  UINT32  Length;
+  UINT32  ResponseLength;
 
   if (DataSize > sizeof (Command.Data)) {
 return EFI_UNSUPPORTED;
@@ -210,14 +212,15 @@ Tpm12NvWriteValue (
   // send Tpm command TPM_ORD_NV_WriteValue
   //
   Command.Hdr.tag   = SwapBytes16 (TPM_TAG_RQU_COMMAND);
-  Command.Hdr.paramSize = SwapBytes32 (sizeof (Command) - sizeof(Command.Data) 
+ DataSize);
+  CommandLength = sizeof (Command) - sizeof(Command.Data) + DataSize;  
+ Command.Hdr.paramSize = SwapBytes32 (CommandLength);
   Command.Hdr.ordinal   = SwapBytes32 (TPM_ORD_NV_WriteValue);
   Command.NvIndex   = SwapBytes32 (NvIndex);
   Command.Offset= SwapBytes32 (Offset);
   Command.DataSize  = SwapBytes32 (DataSize);
   CopyMem (Command.Data, Data, DataSize);
-  Length = sizeof (Response);
-  Status = Tpm12SubmitCommand (Command.Hdr.paramSize, (UINT8 *), 
, (UINT8 *));
+  ResponseLength = sizeof (Response);
+  Status = Tpm12SubmitCommand (CommandLength, (UINT8 *), 
+ , (UINT8 *));
   if (EFI_ERROR (Status)) {
 return Status;
   }
--
2.6.3.windows.1

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


Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

2016-03-19 Thread Lin, Derek (HPS UEFI Dev)
The U64 mult/div fix seems good. Thanks for fixing it!

Thanks,
Derek

-Original Message-
From: Zeng, Star [mailto:star.z...@intel.com] 
Sent: Thursday, March 17, 2016 9:13 AM
To: Laszlo Ersek <ler...@redhat.com>
Cc: Ni, Ruiyu <ruiyu...@intel.com>; Tian, Feng <feng.t...@intel.com>; Lin, 
Derek (HPS UEFI Dev) <derek.l...@hpe.com>; edk2-devel@lists.01.org 
<edk2-de...@ml01.01.org>
Subject: Re: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute Pointer.

On 2016/3/16 19:53, Laszlo Ersek wrote:
> On 03/16/16 09:22, Zeng, Star wrote:
>> Pushed at 30ed3422ab2de03abf7c1433ebb482f6e5e16f45.
>>
>> Thanks,
>> Star
>
> This patch breaks the Ia32 build of OVMF (found by Gerd's Jenkins 
> auto-builder):
>
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitterDxe/OUTPUT/ConSplitterDxe.lib(ConSplitter.obj):
>  In function `ConSplitterAbsolutePointerGetState':
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4159: undefined 
> reference to `__udivdi3'
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4162: undefined 
> reference to `__udivdi3'
> MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c:4165: undefined 
> reference to `__udivdi3'

First saw this email, then I was going to update the code.
When I was trying to send patch for this, I saw the email that has 
pushed the fix and I am glad to see it.


Thanks,
Star

>
> Namely,
>
>> On 2016/3/15 10:11, Ni, Ruiyu wrote:
>>>
>>>
>>> Reviewed-by: Ruiyu Ni <ruiyu...@intel.com>
>>>> -Original Message-
>>>> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf
>>>> Of Derek Lin
>>>> Sent: Wednesday, March 9, 2016 4:35 PM
>>>> To: edk2-devel@lists.01.org
>>>> Cc: Derek Lin <derek.l...@hpe.com>
>>>> Subject: [edk2] [PATCH] MdeModulePkg: Rescale ConSplitter Absolute
>>>> Pointer.
>>>>
>>>> ConSplitter's Absolute Pointer should scale virtual device's
>>>> resolution like what Simple Pointer do.
>>>> Before this change, caller will get Virtual device's resolution but
>>>> physical device's current point.
>>>> This change let caller get Virtual device's resolution with virtual
>>>> device's current point.
>>>>
>>>> Contributed-under: TianoCore Contribution Agreement 1.0
>>>> Signed-off-by: Derek Lin <derek.l...@hpe.com>
>>>> ---
>>>> .../Universal/Console/ConSplitterDxe/ConSplitter.c | 43
>>>> ++
>>>> 1 file changed, 36 insertions(+), 7 deletions(-)
>>>>
>>>> diff --git a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> index dae97b0..af90d5e 100644
>>>> --- a/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> +++ b/MdeModulePkg/Universal/Console/ConSplitterDxe/ConSplitter.c
>>>> @@ -17,6 +17,7 @@
>>>> device situation.
>>>>
>>>> Copyright (c) 2006 - 2015, 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
>>>> @@ -4096,7 +4097,18 @@ ConSplitterAbsolutePointerGetState (
>>>> EFI_STATUSReturnStatus;
>>>> UINTN Index;
>>>> EFI_ABSOLUTE_POINTER_STATECurrentState;
>>>> -
>>>> +  UINT64MinX;
>>>> +  UINT64MinY;
>>>> +  UINT64MinZ;
>>>> +  UINT64MaxX;
>>>> +  UINT64MaxY;
>>>> +  UINT64MaxZ;
>>>> +  UINT64VirtualMinX;
>>>> +  UINT64VirtualMinY;
>>>> +  UINT64VirtualMinZ;
>>>> +  UINT64VirtualMaxX;
>>>> +  UINT64VirtualMaxY;
>>>> +  UINT64VirtualMaxZ;
>>>>
>>>> Private = TEXT_IN_SPLITTER_PRIVATE_DATA_FROM_ABSOLUTE_POINTER_THIS
>>>> (This);
>>>>
>>>> @@ -4107,6 +4119,13 @@ ConSplitterAbsolutePo