Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-03-29 Thread Ni, Ray
https://devblogs.microsoft.com/cppblog/recommendations-to-speed-c-builds-in-visual-studio/#_PCH
Bob,
Per above article, It seems /Gm needs to be removed when /MP is used.


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Feng,
> Bob C
> Sent: Friday, March 29, 2019 8:30 PM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming 
> Subject: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler
> 
> From: Zhiju Fan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1672
> The /MP option of MSVC compiler can reduce the total time to compile the
> source files on the command line.
> 
> This patch is going to enable this MSVC option in BaseTools.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Conf/build_rule.template |  2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py | 81 -
> -
>  2 files changed, 75 insertions(+), 8 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..e7d736740f 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -127,11 +127,11 @@
> 
>  
>  $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
> 
>  
> -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
> +"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
> 
>  
>  # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
>  "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index b441817b52..04951346ad 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -433,11 +433,11 @@ cleanlib:
>  self.BuildTargetList = []   # [target string]
>  self.PendingBuildTargetList = []# [FileBuildRule objects]
>  self.CommonFileDependency = []
>  self.FileListMacros = {}
>  self.ListFileMacros = {}
> -
> +self.ObjTargetDict = {}
>  self.FileCache = {}
>  self.LibraryBuildCommandList = []
>  self.LibraryFileList = []
>  self.LibraryMakefileList = []
>  self.LibraryBuildDirectoryList = [] @@ -616,10 +616,15 @@ cleanlib:
>  ListFileName,
>  "\n".join(self.ListFileMacros[ListFileMacro]),
>  False
>  )
> 
> +# Generate objlist used to create .obj file
> +for Type in self.ObjTargetDict:
> +NewLine = ' '.join(list(self.ObjTargetDict[Type]))
> +FileMacroList.append("OBJLIST_%s = %s" %
> + (list(self.ObjTargetDict.keys()).index(Type), NewLine))
> +
>  BcTargetList = []
> 
>  MakefileName = self._FILE_NAME_[self._FileType]
>  LibraryMakeCommandList = []
>  for D in self.LibraryBuildDirectoryList:
> @@ -925,17 +930,22 @@ cleanlib:
>  # Extract common files list in the dependency files
>  #
>  for File in DepSet:
>  self.CommonFileDependency.append(self.PlaceMacro(File.Path,
> self.Macros))
> 
> +CmdSumDict = {}
> +CmdTargetDict = {}
> +CmdCppDict = {}
> +DependencyDict = FileDependencyDict.copy()
>  for File in FileDependencyDict:
>  # skip non-C files
>  if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
>  continue
>  NewDepSet = set(FileDependencyDict[File])
>  NewDepSet -= DepSet
>  FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet)
> +DependencyDict[File] = list(NewDepSet)
> 
>  # Convert target description object to target string in makefile
>  for Type in self._AutoGenObject.Targets:
>  for T in self._AutoGenObject.Targets[Type]:
>  # Generate related macros if needed @@ -943,15 +953,25 @@
> cleanlib:
>  self.FileListMacros[T.FileListMacro] = []
>  if T.GenListFile and T.ListFileMacro not in 
> self.ListFileMacros:
>  self.ListFileMacros[T.ListFileMacro] = []
>  if T.GenIncListFile and T.IncListFileMacro not in 
> self.ListFileMacros:
>  self.ListFileMacros[T.IncListFileMacro] = []
> +if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT 
> and
> Type == TAB_C_CODE_FILE:
> +NewFile = self.PlaceMacro(str(T), self.Macros)
> +if self.ObjTargetDict.get(T.Target.SubDir):
> +self.ObjTargetDict[T.Target.SubDir].add(NewFile)
> +else:
> +self.ObjTargetDict[T.Target.SubDir] = set()
> +
> + self.ObjTargetDict[T.Target.SubDir].add(NewFile)
> 
>  Deps = []
> +

Re: [edk2] [PATCH v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Ni, Ray
Reviewed-by: Ray Ni 

Sent from small device

> 在 2019年3月29日,下午11:45,Vanguput, Narendra K  写道:
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593
> 
> For every SMI occurrence, save and restore CR2 register only when SMM
> on-demand paging support is enabled in 64 bit operation mode.
> This is not a bug but to have better improvement of code.
> 
> Patch5 is updated with separate functions for Save and Restore of CR2
> based on review feedback.
> 
> Patch6 - Removed Global Cr2 instead used function parameter
> 
> Patch7 - Removed checking Cr2 with 0 as per feedback
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Vanguput Narendra K 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Yao Jiewen 
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
> UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
> 4 files changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index b734a1ea8c..d3f62ed806 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -316,3 +316,29 @@ SetPageTableAttributes (
> 
>   return ;
> }
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
> +**/
> +VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  )
> +{
> +  return ;
> +}
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register
> +**/
> +VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  )
> +{
> +  return ;
> +}
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 3b0b3b52ac..ce70f77709 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1112,9 +1112,11 @@ SmiRendezvous (
>   ASSERT(CpuIndex < mMaxNumberOfCpus);
> 
>   //
> -  // Save Cr2 because Page Fault exception in SMM may override its value
> +  // Save Cr2 because Page Fault exception in SMM may override its value,
> +  // when using on-demand paging for above 4G memory.
>   //
> -  Cr2 = AsmReadCr2 ();
> +  Cr2 = 0;
> +  SaveCr2 ();
> 
>   //
>   // Perform CPU specific entry hooks
> @@ -1253,10 +1255,11 @@ SmiRendezvous (
> 
> Exit:
>   SmmCpuFeaturesRendezvousExit (CpuIndex);
> +
>   //
>   // Restore Cr2
>   //
> -  AsmWriteCr2 (Cr2);
> +  RestoreCr2 (Cr2);
> }
> 
> /**
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> index 84efb22981..05e1b54ed2 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> @@ -1243,4 +1243,26 @@ EFIAPI
> PiSmmCpuSmiEntryFixupAddress (
>  );
> 
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
> +**/
> +VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  );
> +
> +/**
> +  This function writes into CR2 register when on-demand paging is enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register
> +**/
> +VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  );
> +
> #endif
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 2c77cb47a4..e60628c080 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -1053,3 +1053,33 @@ SetPageTableAttributes (
> 
>   return ;
> }
> +
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +
> +  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
> +**/
> +VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  )
> +{
> +  if (!mCpuSmmStaticPageTable) {
> +*Cr2 = AsmReadCr2 ();
> +  }
> +}
> +
> +/**
> +  This function restores CR2 register when on-demand paging is enabled
> +
> +  @param[in]  Cr2  Value to write into CR2 register
> +**/
> +VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  )
> +{
> +  if (!mCpuSmmStaticPageTable) {
> +AsmWriteCr2 (Cr2);
> +  }
> +}
> -- 
> 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 v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Andrew Fish via edk2-devel



> On Mar 29, 2019, at 2:22 PM, Desimone, Nathaniel L 
>  wrote:
> 
> 1. Why would you do this for 64 bit but not 32 bit?

Is paging enabled on 32-bit, it is required for Long mode?

Also I'm not clear why it is an enhancement given you could take a periodic SMM 
in the kernels page fault handler and trashing CR2 seems bad.  Maybe there is 
some behavior I'm missing?

I'm not sure how big an issue this is but if SMM is modifying CR2 it is leaking 
information about SMM operations outside of SMM. 

Thanks,

Andrew Fish

> 2. Why don't you add the if statement to MpService.c instead of spreading it 
> to PageTbl.c?
> 3. What is the reason for this anyway? Adding the conditional is probably 
> more execution time than just reading CR2 always.
> 
> Thanks,
> Nate
> 
> -Original Message-
> From: edk2-devel  On Behalf Of nkvangup
> Sent: Friday, March 29, 2019 8:45 AM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Dong, Eric ; 
> Laszlo Ersek 
> Subject: [edk2] [PATCH v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand 
> paging in SMM
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593
> 
> For every SMI occurrence, save and restore CR2 register only when SMM 
> on-demand paging support is enabled in 64 bit operation mode.
> This is not a bug but to have better improvement of code.
> 
> Patch5 is updated with separate functions for Save and Restore of CR2 based 
> on review feedback.
> 
> Patch6 - Removed Global Cr2 instead used function parameter
> 
> Patch7 - Removed checking Cr2 with 0 as per feedback
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Vanguput Narendra K 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Yao Jiewen 
> ---
> UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
> UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
> 4 files changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index b734a1ea8c..d3f62ed806 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -316,3 +316,29 @@ SetPageTableAttributes (
> 
>   return ;
> }
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[out]  *Cr2  Pointer to variable to hold CR2 register value **/ 
> +VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  )
> +{
> +  return ;
> +}
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register **/ VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  )
> +{
> +  return ;
> +}
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 3b0b3b52ac..ce70f77709 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1112,9 +1112,11 @@ SmiRendezvous (
>   ASSERT(CpuIndex < mMaxNumberOfCpus);
> 
>   //
> -  // Save Cr2 because Page Fault exception in SMM may override its value
> +  // Save Cr2 because Page Fault exception in SMM may override its 
> + value,  // when using on-demand paging for above 4G memory.
>   //
> -  Cr2 = AsmReadCr2 ();
> +  Cr2 = 0;
> +  SaveCr2 ();
> 
>   //
>   // Perform CPU specific entry hooks
> @@ -1253,10 +1255,11 @@ SmiRendezvous (
> 
> Exit:
>   SmmCpuFeaturesRendezvousExit (CpuIndex);
> +
>   //
>   // Restore Cr2
>   //
> -  AsmWriteCr2 (Cr2);
> +  RestoreCr2 (Cr2);
> }
> 
> /**
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> index 84efb22981..05e1b54ed2 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> @@ -1243,4 +1243,26 @@ EFIAPI
> PiSmmCpuSmiEntryFixupAddress (
>  );
> 
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[out]  *Cr2  Pointer to variable to hold CR2 register value **/ 
> +VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  );
> +
> +/**
> +  This function writes into CR2 register when on-demand paging is 
> +enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register **/ VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  );
> +
> #endif
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 2c77cb47a4..e60628c080 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -1053,3 +1053,33 @@ SetPageTableAttributes (
> 
>   return ;
> }
> +
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +
> +  @param[out]  

Re: [edk2] [PATCH v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Desimone, Nathaniel L
1. Why would you do this for 64 bit but not 32 bit?
2. Why don't you add the if statement to MpService.c instead of spreading it to 
PageTbl.c?
3. What is the reason for this anyway? Adding the conditional is probably more 
execution time than just reading CR2 always.

Thanks,
Nate

-Original Message-
From: edk2-devel  On Behalf Of nkvangup
Sent: Friday, March 29, 2019 8:45 AM
To: edk2-devel@lists.01.org
Cc: Yao, Jiewen ; Dong, Eric ; 
Laszlo Ersek 
Subject: [edk2] [PATCH v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand 
paging in SMM

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

For every SMI occurrence, save and restore CR2 register only when SMM on-demand 
paging support is enabled in 64 bit operation mode.
This is not a bug but to have better improvement of code.

Patch5 is updated with separate functions for Save and Restore of CR2 based on 
review feedback.

Patch6 - Removed Global Cr2 instead used function parameter

Patch7 - Removed checking Cr2 with 0 as per feedback

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vanguput Narendra K 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Yao Jiewen 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
 4 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index b734a1ea8c..d3f62ed806 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -316,3 +316,29 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value **/ 
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  return ;
+}
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register **/ VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  return ;
+}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 3b0b3b52ac..ce70f77709 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1112,9 +1112,11 @@ SmiRendezvous (
   ASSERT(CpuIndex < mMaxNumberOfCpus);
 
   //
-  // Save Cr2 because Page Fault exception in SMM may override its value
+  // Save Cr2 because Page Fault exception in SMM may override its 
+ value,  // when using on-demand paging for above 4G memory.
   //
-  Cr2 = AsmReadCr2 ();
+  Cr2 = 0;
+  SaveCr2 ();
 
   //
   // Perform CPU specific entry hooks
@@ -1253,10 +1255,11 @@ SmiRendezvous (
 
 Exit:
   SmmCpuFeaturesRendezvousExit (CpuIndex);
+
   //
   // Restore Cr2
   //
-  AsmWriteCr2 (Cr2);
+  RestoreCr2 (Cr2);
 }
 
 /**
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 84efb22981..05e1b54ed2 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -1243,4 +1243,26 @@ EFIAPI
 PiSmmCpuSmiEntryFixupAddress (
  );
 
+/**
+  This function reads CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value **/ 
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  );
+
+/**
+  This function writes into CR2 register when on-demand paging is 
+enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register **/ VOID
+RestoreCr2 (
+  UINTN  Cr2
+  );
+
 #endif
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 2c77cb47a4..e60628c080 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1053,3 +1053,33 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function reads CR2 register when on-demand paging is enabled
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value **/ 
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+*Cr2 = AsmReadCr2 ();
+  }
+}
+
+/**
+  This function restores CR2 register when on-demand paging is enabled
+
+  @param[in]  Cr2  Value to write into CR2 register **/ VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+AsmWriteCr2 (Cr2);
+  }
+}
--
2.16.2.windows.1

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


[edk2] [PATCH v8] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread nkvangup
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593

For every SMI occurrence, save and restore CR2 register only when SMM
on-demand paging support is enabled in 64 bit operation mode.
This is not a bug but to have better improvement of code.

Patch5 is updated with separate functions for Save and Restore of CR2
based on review feedback.

Patch6 - Removed Global Cr2 instead used function parameter

Patch7 - Removed checking Cr2 with 0 as per feedback

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vanguput Narendra K 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Yao Jiewen 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
 4 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index b734a1ea8c..d3f62ed806 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -316,3 +316,29 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  return ;
+}
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  return ;
+}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 3b0b3b52ac..ce70f77709 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1112,9 +1112,11 @@ SmiRendezvous (
   ASSERT(CpuIndex < mMaxNumberOfCpus);
 
   //
-  // Save Cr2 because Page Fault exception in SMM may override its value
+  // Save Cr2 because Page Fault exception in SMM may override its value,
+  // when using on-demand paging for above 4G memory.
   //
-  Cr2 = AsmReadCr2 ();
+  Cr2 = 0;
+  SaveCr2 ();
 
   //
   // Perform CPU specific entry hooks
@@ -1253,10 +1255,11 @@ SmiRendezvous (
 
 Exit:
   SmmCpuFeaturesRendezvousExit (CpuIndex);
+
   //
   // Restore Cr2
   //
-  AsmWriteCr2 (Cr2);
+  RestoreCr2 (Cr2);
 }
 
 /**
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 84efb22981..05e1b54ed2 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -1243,4 +1243,26 @@ EFIAPI
 PiSmmCpuSmiEntryFixupAddress (
  );
 
+/**
+  This function reads CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  );
+
+/**
+  This function writes into CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  );
+
 #endif
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 2c77cb47a4..e60628c080 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1053,3 +1053,33 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function reads CR2 register when on-demand paging is enabled
+
+  @param[out]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+*Cr2 = AsmReadCr2 ();
+  }
+}
+
+/**
+  This function restores CR2 register when on-demand paging is enabled
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+AsmWriteCr2 (Cr2);
+  }
+}
-- 
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] UefiPayloadPkg: Enhance UEFI payload for coreboot and Slim Bootloader

2019-03-29 Thread Dong, Guo


Hi Ray,

Yes, the new UefiPayload will not require legacy 8254 timer.
And we could remove Coreboot packages after UefiPayloadPkg check in.

Thanks,
Guo

> -Original Message-
> From: Ni, Ray
> Sent: Thursday, March 28, 2019 10:15 PM
> To: Dong, Guo ; edk2-devel@lists.01.org; Laszlo Ersek
> 
> Cc: Wu, Hao A ; Kinney, Michael D
> ; Ma, Maurice 
> Subject: RE: [edk2] [PATCH] UefiPayloadPkg: Enhance UEFI payload for
> coreboot and Slim Bootloader
> 
> 
> Guo,
> Just to double confirm: UefiPayloadPkg will not require Legacy8254 timer
> support.
> The old packages Coreboot*Pkgs will be removed.
> Which means now only QEMU/OVMF needs the Legacy8254 support.
> 
> Laszlo,
> Now since QEMU/OVMF is the only consumer of the Legacy8254 driver, do
> you agree that the Legacy8254 is moved to OvmfPkg?
> Note: We agreed that Legacy8259 will be moved to OvmfPkg/Csm directory
> and that decision is not going to be changed by this new situation.
> 
> Thanks,
> Ray
> 
> > -Original Message-
> > From: edk2-devel  On Behalf Of Guo
> > Dong
> > Sent: Friday, March 29, 2019 8:34 AM
> > To: edk2-devel@lists.01.org
> > Subject: [edk2] [PATCH] UefiPayloadPkg: Enhance UEFI payload for
> > coreboot and Slim Bootloader
> >
> > CorebootModulePkg and CorebootPayloadPkg originally supports coreboot
> > only.
> > In order to support other bootloaders, such as Slim Bootloader, they
> > need be updated to be more generic.
> > UEFI Payload (UefiPayloadPkg) a converged package from
> > CorebootModulePkg and CorebootPayloadPkg with following updates:
> > a. Support both coreboot and Slim Bootloader b. Removed
> > SataControllerDxe and BaseSerialPortLib16550 to use EDK2 modules c.
> > Support passing bootloader parameter to UEFI payload, e.g. coreboot
> >table from coreboot or HOB list from Slim Bootloader d. Using
> > GraphicsOutputDxe from EDK2 with minor change instead of FbGop e.
> > Remove the dependency to IntelFrameworkPkg and
> IntelFrameworkModulePkg
> >and QuarkSocPkg
> > f. Use BaseDebugLibSerialPort library as DebugLib g. Use HPET timer,
> > drop legacy 8254 timer support h. Use BaseXApicX2ApicLib instead of
> > BaseXApicLib i. Other clean ups
> >
> > On how UefiPayloadPkg could work with coreboot/Slim Bootloader, please
> > refer UefiPayloadPkg/BuildAndIntegrationInstructions.txt
> >
> > Once UefiPayloadPkg is checked-in, CorebootModulePkg and
> > CorebootPayloadPkg could be retired.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Guo Dong 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool

2019-03-29 Thread Supreeth Venkatesh
Thanks Kilian.
There was no issue. This patch was sent in error.
However, I will look into this feedback - "The GenBin.c should be extended by a 
manual BIN2TXT translation."

Supreeth


From: Minnow Ware 
Sent: Friday, March 29, 2019 9:29 AM
To: Jin, Eric ; Supreeth Venkatesh 
; edk2-devel@lists.01.org
Cc: Jin, Eric 
Subject: RE: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line 
ending detection by GenBin tool

Hi Supreeth,

theoretically the standard C implementation of fopen(char *filename, char *mode)
"can" support BINARY and TEXT mode. This is specified here 
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, "7.19.2 Streams"

In praxis only Windows-/DOS platforms supports a BINARY ( w/ "b") and a TEXT 
mode (w/o "b").
This is valid for all C-library implementations on that platforms.

In textmode all "\r\n"-sequences in the file are automatically (by the C 
Library) translated to "\n" only,
when reading the file to the buffer.
And on write operations each "\n" is transformed to "\r\n".

On UNIX-systems with or without "b"-inary flag do not affect the data 
read/written.

Since the profile file is opened correctly in text mode (Line 107 
https://github.com/tianocore/edk2-test/blob/master/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c),
the issue tells me, you are running on a UNIX system, dealing with Windows text 
files.

The GenBin.c should be extended by a manual BIN2TXT translation.

Best Regrads,
Kilian

https://github.com/MinnowWare


From: Jin, Eric
Sent: Friday, March 29, 2019 09:31 AM
To: Supreeth Venkatesh; 
edk2-devel@lists.01.org
Cc: Jin, Eric
Subject: Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line 
ending detection by GenBin tool

Hi Supreeth,

This patch can't be applied to the lasted code base SHA-1: 33022e.
One patch from  may already fix the issue. Please check again.

Best Regards
Eric

-Original Message-
From: edk2-devel 
mailto:edk2-devel-boun...@lists.01.org>> On 
Behalf Of Supreeth Venkatesh
Sent: Friday, March 29, 2019 7:08 AM
To: supreeth.venkat...@arm.com; 
edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending 
detection by GenBin tool

From: Lokesh B V mailto:lokesh...@arm.com>>

Some windows editors uses "\r\n" for line feed. While processing uefi sct 
testcase info file, the GenBin tool logic to skip line feed doesn't consider 
the presence of carraige return(\r) in line feed. So this results in incorrect 
format error.

Fixed this issue by changing logic of Trim and Getline functions used in GenBin 
source code.

Cc: Supreeth Venkatesh 
mailto:supreeth.venkat...@arm.com>>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Lokesh B V mailto:lokesh...@arm.com>>
---
Changes since v1:
* Adopted changes suggested by Supreeth.
* modified Copyright content

 uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +---
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c 
b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
index 61bb35b..6d8e844 100644
--- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
+++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
@@ -2,6 +2,7 @@

   Copyright 2006 - 2010 Unified EFI, Inc.
   Copyright (c) 2010 Intel Corporation. All rights reserved.
+  Copyright (c) 2018 ARM Ltd. All rights reserved.

   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -32,6 +33,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 

 //
 // Definitions
@@ -49,7 +51,7 @@ PrintUsage (
   void
   );

-void
+char *
 Trim (
   char*String
   );
@@ -159,50 +161,42 @@ PrintUsage (
 }


-void
+char *
 Trim (
   char*String
   )
 {
-  int   Index1;
-  int   Index2;
   int   Length;
+  char  *end;

   Length = strlen (String);

-  //
-  // Remove the space characters from the beginning of this string
-  //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Index1] != ' ' ) &&
-(String[Index1] != '\t') &&
-(String[Index1] != '\n')) {
-  break;
-}
-  }
-
-  for (Index2 = Index1; Index2 < Length; Index2++) {
-String[Index2 - Index1] = String[Index2];
+  if (!Length) {
+return String;
   }

-  Length = Length - Index1;
+  end = String + Length - 1;

   //
   // Remove the space characters from the end of this string
   //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Length - 1 - Index1] != ' ' ) &&
-(String[Length - 1 - Index1] != '\t') &&
-(String[Length - 1 - Index1] != '\n')) {
-  break;
-}
+  while (end >= String && isspace (*end)) {
+end--;
   }

-  String[Length - Index1] = '\0';
+  *(end + 1) = '\0';
+
+  //
+  // 

Re: [edk2] [PATCH v7] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Fan Jeff
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/

the indicator in should be out。



发自我的小米手机
在 2019年3月29日 下午9:56,nkvangup 写道:
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593

For every SMI occurrence, save and restore CR2 register only when SMM
on-demand paging support is enabled in 64 bit operation mode.
This is not a bug but to have better improvement of code.

Patch5 is updated with separate functions for Save and Restore of CR2
based on review feedback.

Patch6 - Removed Global Cr2 instead used function parameter

Patch7 - Removed checking Cr2 with 0 as per feedback

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vanguput Narendra K 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Yao Jiewen 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
 4 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index b734a1ea8c..af96e42982 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -316,3 +316,29 @@ SetPageTableAttributes (

   return ;
 }
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  return ;
+}
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  return ;
+}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 3b0b3b52ac..ce70f77709 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1112,9 +1112,11 @@ SmiRendezvous (
   ASSERT(CpuIndex < mMaxNumberOfCpus);

   //
-  // Save Cr2 because Page Fault exception in SMM may override its value
+  // Save Cr2 because Page Fault exception in SMM may override its value,
+  // when using on-demand paging for above 4G memory.
   //
-  Cr2 = AsmReadCr2 ();
+  Cr2 = 0;
+  SaveCr2 ();

   //
   // Perform CPU specific entry hooks
@@ -1253,10 +1255,11 @@ SmiRendezvous (

 Exit:
   SmmCpuFeaturesRendezvousExit (CpuIndex);
+
   //
   // Restore Cr2
   //
-  AsmWriteCr2 (Cr2);
+  RestoreCr2 (Cr2);
 }

 /**
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 84efb22981..c9d147c8a1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -1243,4 +1243,26 @@ EFIAPI
 PiSmmCpuSmiEntryFixupAddress (
  );

+/**
+  This function reads CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  );
+
+/**
+  This function writes into CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  );
+
 #endif
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 2c77cb47a4..b30e8e1f82 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1053,3 +1053,33 @@ SetPageTableAttributes (

   return ;
 }
+
+/**
+  This function reads CR2 register when on-demand paging is enabled
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+*Cr2 = AsmReadCr2 ();
+  }
+}
+
+/**
+  This function restores CR2 register when on-demand paging is enabled
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+AsmWriteCr2 (Cr2);
+  }
+}
--
2.16.2.windows.1

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


Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool

2019-03-29 Thread Minnow Ware
Hi Supreeth,

theoretically the standard C implementation of fopen(char *filename, char *mode)
“can” support BINARY and TEXT mode. This is specified here 
http://www.open-std.org/jtc1/sc22/wg14/www/docs/n1256.pdf, “7.19.2 Streams”

In praxis only Windows-/DOS platforms supports a BINARY ( w/ “b”) and a TEXT 
mode (w/o “b”).
This is valid for all C-library implementations on that platforms.

In textmode all "\r\n"-sequences in the file are automatically (by the C 
Library) translated to “\n” only,
when reading the file to the buffer.
And on write operations each “\n” is transformed to “\r\n”.

On UNIX-systems with or without “b”-inary flag do not affect the data 
read/written.

Since the profile file is opened correctly in text mode (Line 107 
https://github.com/tianocore/edk2-test/blob/master/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c),
the issue tells me, you are running on a UNIX system, dealing with Windows text 
files.

The GenBin.c should be extended by a manual BIN2TXT translation.

Best Regrads,
Kilian

https://github.com/MinnowWare


From: Jin, Eric
Sent: Friday, March 29, 2019 09:31 AM
To: Supreeth Venkatesh; 
edk2-devel@lists.01.org
Cc: Jin, Eric
Subject: Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line 
ending detection by GenBin tool

Hi Supreeth,

This patch can't be applied to the lasted code base SHA-1: 33022e.
One patch from  may already fix the issue. Please check again.

Best Regards
Eric

-Original Message-
From: edk2-devel  On Behalf Of Supreeth 
Venkatesh
Sent: Friday, March 29, 2019 7:08 AM
To: supreeth.venkat...@arm.com; edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending 
detection by GenBin tool

From: Lokesh B V 

Some windows editors uses "\r\n" for line feed. While processing uefi sct 
testcase info file, the GenBin tool logic to skip line feed doesn't consider 
the presence of carraige return(\r) in line feed. So this results in incorrect 
format error.

Fixed this issue by changing logic of Trim and Getline functions used in GenBin 
source code.

Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Lokesh B V 
---
Changes since v1:
* Adopted changes suggested by Supreeth.
* modified Copyright content

 uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +---
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c 
b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
index 61bb35b..6d8e844 100644
--- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
+++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
@@ -2,6 +2,7 @@

   Copyright 2006 - 2010 Unified EFI, Inc.
   Copyright (c) 2010 Intel Corporation. All rights reserved.
+  Copyright (c) 2018 ARM Ltd. All rights reserved.

   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -32,6 +33,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 

 //
 // Definitions
@@ -49,7 +51,7 @@ PrintUsage (
   void
   );

-void
+char *
 Trim (
   char*String
   );
@@ -159,50 +161,42 @@ PrintUsage (
 }


-void
+char *
 Trim (
   char*String
   )
 {
-  int   Index1;
-  int   Index2;
   int   Length;
+  char  *end;

   Length = strlen (String);

-  //
-  // Remove the space characters from the beginning of this string
-  //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Index1] != ' ' ) &&
-(String[Index1] != '\t') &&
-(String[Index1] != '\n')) {
-  break;
-}
-  }
-
-  for (Index2 = Index1; Index2 < Length; Index2++) {
-String[Index2 - Index1] = String[Index2];
+  if (!Length) {
+return String;
   }

-  Length = Length - Index1;
+  end = String + Length - 1;

   //
   // Remove the space characters from the end of this string
   //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Length - 1 - Index1] != ' ' ) &&
-(String[Length - 1 - Index1] != '\t') &&
-(String[Length - 1 - Index1] != '\n')) {
-  break;
-}
+  while (end >= String && isspace (*end)) {
+end--;
   }

-  String[Length - Index1] = '\0';
+  *(end + 1) = '\0';
+
+  //
+  // Remove the space characters from the beginning of this string  //
+ while (*String && isspace (*String)) {
+String++;
+  }

   //
   // Done
   //
+  return String;
 }


@@ -227,20 +221,20 @@ GetLine (
   return -1;
 }

-(*LineNo)++;
-
 //
 // Remove the beginning and ending space characters
 //
-Trim (String);
+String = Trim (Result);

 //
-// Ignore the empty line and comment line
+// Skip the empty line and comment line
 //
-if ((String[0] != '\0') &&
-(String[0] != '#' )) {
-  break;
+if ((String[0] == '\0') ||
+(String[0] == '#' )) {
+ 

Re: [edk2] [edk2-test][PATCH v1 30/30] UEFI/UEFI.dec: Add missing protocol GUIDs in declaration file.

2019-03-29 Thread Supreeth Venkatesh
Thank you very much for the comments/feedback.
I will check this in after taking care of your feedback.

Supreeth

-Original Message-
From: Jin, Eric 
Sent: Friday, March 29, 2019 4:04 AM
To: Supreeth Venkatesh ; edk2-devel@lists.01.org
Cc: Jin, Eric 
Subject: RE: [edk2-test][PATCH v1 30/30] UEFI/UEFI.dec: Add missing protocol 
GUIDs in declaration file.

Hi Supreeth,

Thanks a lot to fix this build issue at first.
Comments for this series of patches are replied below.

Patch 1/2 :
1. Could the two patches can be re-organized? For example, merge the change of 
*.dsc in patch 2 to patch 1 to make it clear.
2. The change of CommonGenFramework.sh in patch 2 will remove the ebc from 
binary package.

Patch 24 :
1. Please don't forget change the copyright part 2. Do you meet the similar 
issue that "UEFI_CONFIG_LANG" : macro redefinition while build?

Other Patches :
1. Please remove "COMPONENT_TYPE   = BS_DRIVER"

With that
Reviewed-by: Eric Jin 

Best Regards
Eric

-Original Message-
From: Supreeth Venkatesh 
Sent: Friday, March 29, 2019 7:12 AM
To: edk2-devel@lists.01.org
Cc: Supreeth Venkatesh ; Jin, Eric 

Subject: [edk2-test][PATCH v1 30/30] UEFI/UEFI.dec: Add missing protocol GUIDs 
in declaration file.

Fix compilation issues in inf files when compiled against edk2 stable tag 
edk2-stable201903.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh 
---
 uefi-sct/SctPkg/UEFI/UEFI.dec | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec 
index 8495a4e1..bdf3323f 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI.dec
+++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
@@ -1,7 +1,7 @@
 ## @file
 #
 #  Copyright 2004 - 2017 Unified EFI, Inc. -#  Copyright (c) 2014 - 2018, 
ARM Limited. All rights reserved.
+#  Copyright (c) 2014 - 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.  #  
(C) Copyright 2017 Hewlett Packard Enterprise Development LP  # @@ -119,14 
+119,22 @@
   gBlackBoxEfiHIIStringProtocolGuid = {0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 
0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a }}
   gBlackBoxEfiHIIImageProtocolGuid = { 0x31a6406a, 0x6bdf, 0x4e46, {0xb2, 
0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 }}
   gBlackBoxEfiHIIImageExProtocolGuid = { 0x1a1241e6, 0x8f19, 0x41a9, { 0xbc, 
0xe, 0xe8, 0xef,0x39, 0xe0, 0x65, 0x46 }}
+  gBlackBoxEfiHIIDatabaseProtocolGuid = { 0xef9fc172, 0xa1b2, 0x4693, {
+ 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 }}
+ gBlackBoxEfiHIIPackageListProtocolGuid = { 0x6a1ee763, 0xd47a, 0x43b4,
+ { 0xaa, 0xbe, 0xef, 0x1d, 0xe2, 0xab, 0x56, 0xfc }}
+ gBlackBoxEfiHIIStringProtocolGuid = {0xfd96974, 0x23aa, 0x4cdc, {
+ 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a }}
+ gBlackBoxEfiHIIConfigAccessProtocolGuid = { 0x330d4706, 0xf2a0,
+ 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 }}
+ gBlackBoxEfiHIIConfigRoutingProtocolGuid = { 0x587e72d7, 0xcc50,
+ 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f }}
   gBlackBoxEfiHIIFontProtocolGuid = { 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 
0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 }}
   gBlackBoxEfiHIIFontExProtocolGuid = { 0x849e6875, 0xdb35, 0x4df8, { 0xb4, 
0x1e, 0xc8, 0xf3, 0x37, 0x18, 0x7, 0x3f }}
   gBlackBoxEfiHttpProtocolGuid = { 0x7A59B29B, 0x910B, 0x4171, { 0x82, 0x42, 
0xA8, 0x5A, 0x0D, 0xF2, 0x5B, 0x5B }}
   gBlackBoxEfiHttpServiceBindingProtocolGuid = { 0xbdc8e6af, 0xd9bc, 0x4379, { 
0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c }}
   gBlackBoxEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, 
{0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } }
   gBlackBoxEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 
0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } }
+  gBlackBoxEfiIp4ConfigProtocolGuid = { 0x3B95AA31, 0x3793, 0x434B,
+ {0x86, 0x67, 0xC8, 0x07, 0x08, 0x92, 0xE0, 0x5E } }
+ gBlackBoxEfiIp4Config2ProtocolGuid = { 0x5b446ed1, 0xe30b, 0x4faa,
+ {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } }
   gBlackBoxEfiIp6ServiceBindingProtocolGuid = { 0xec835dd3, 0xfe0f, 0x617b, 
{0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 } }
   gBlackBoxEfiIp6ProtocolGuid = { 0xec835dd3, 0xfe0f, 0x617b, {0xa6, 0x21, 
0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 } }
+  gBlackBoxEfiIp6ConfigProtocolGuid = { 0x937fe521, 0x95ae, 0x4d1a,
+ {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } }
   gBlackBoxEfiIPsec2ProtocolGuid = {0xa3979e64, 0xace8, 0x4ddc, { 0xbc, 0x7, 
0x4d, 0x66, 0xb8, 0xfd, 0x9, 0x77 }}
   gBlackBoxEfiIPsecConfigProtocolGuid = { 0xce5e5929, 0xc7a3, 0x4602, { 0xad, 
0x9e, 0xc9, 0xda, 0xf9, 0x4e, 0xbf, 0xcf }}
   gBlackBoxEfiIScsiInitiatorNameProtocolGuid = { 0x59324945, 0xec44, 0x4c0d, 
{0xb1, 0xcd, 0x9d, 0xb1, 0x39, 0xdf, 0x7, 0xc }}
--
2.17.1

IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not 

Re: [edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-03-29 Thread Gao, Liming
Bob:
  How about use /MP option without process number? The compiler will retrieves 
the number of effective processors on your computer. 
  And, move this option into CC_FLAGS in tools_def.txt. If so, platform can 
override it in platform DSC file. 

  Last, please provide the performance data with this option. 

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:30 PM
> To: edk2-devel@lists.01.org
> Cc: Fan, ZhijuX ; Feng, Bob C ; 
> Gao, Liming 
> Subject: [Patch] BaseTools:Enable the /MP option of MSVC compiler
> 
> From: Zhiju Fan 
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1672
> The /MP option of MSVC compiler can reduce the total
> time to compile the source files on the command line.
> 
> This patch is going to enable this MSVC option in BaseTools.
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Conf/build_rule.template |  2 +-
>  BaseTools/Source/Python/AutoGen/GenMake.py | 81 --
>  2 files changed, 75 insertions(+), 8 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..e7d736740f 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -127,11 +127,11 @@
> 
>  
>  $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
> 
>  
> -"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
> +"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
> 
>  
>  # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
>  "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
> 
> diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
> b/BaseTools/Source/Python/AutoGen/GenMake.py
> index b441817b52..04951346ad 100644
> --- a/BaseTools/Source/Python/AutoGen/GenMake.py
> +++ b/BaseTools/Source/Python/AutoGen/GenMake.py
> @@ -433,11 +433,11 @@ cleanlib:
>  self.BuildTargetList = []   # [target string]
>  self.PendingBuildTargetList = []# [FileBuildRule objects]
>  self.CommonFileDependency = []
>  self.FileListMacros = {}
>  self.ListFileMacros = {}
> -
> +self.ObjTargetDict = {}
>  self.FileCache = {}
>  self.LibraryBuildCommandList = []
>  self.LibraryFileList = []
>  self.LibraryMakefileList = []
>  self.LibraryBuildDirectoryList = []
> @@ -616,10 +616,15 @@ cleanlib:
>  ListFileName,
>  "\n".join(self.ListFileMacros[ListFileMacro]),
>  False
>  )
> 
> +# Generate objlist used to create .obj file
> +for Type in self.ObjTargetDict:
> +NewLine = ' '.join(list(self.ObjTargetDict[Type]))
> +FileMacroList.append("OBJLIST_%s = %s" % 
> (list(self.ObjTargetDict.keys()).index(Type), NewLine))
> +
>  BcTargetList = []
> 
>  MakefileName = self._FILE_NAME_[self._FileType]
>  LibraryMakeCommandList = []
>  for D in self.LibraryBuildDirectoryList:
> @@ -925,17 +930,22 @@ cleanlib:
>  # Extract common files list in the dependency files
>  #
>  for File in DepSet:
>  self.CommonFileDependency.append(self.PlaceMacro(File.Path, 
> self.Macros))
> 
> +CmdSumDict = {}
> +CmdTargetDict = {}
> +CmdCppDict = {}
> +DependencyDict = FileDependencyDict.copy()
>  for File in FileDependencyDict:
>  # skip non-C files
>  if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
>  continue
>  NewDepSet = set(FileDependencyDict[File])
>  NewDepSet -= DepSet
>  FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet)
> +DependencyDict[File] = list(NewDepSet)
> 
>  # Convert target description object to target string in makefile
>  for Type in self._AutoGenObject.Targets:
>  for T in self._AutoGenObject.Targets[Type]:
>  # Generate related macros if needed
> @@ -943,15 +953,25 @@ cleanlib:
>  self.FileListMacros[T.FileListMacro] = []
>  if T.GenListFile and T.ListFileMacro not in 
> self.ListFileMacros:
>  self.ListFileMacros[T.ListFileMacro] = []
>  if T.GenIncListFile and T.IncListFileMacro not in 
> self.ListFileMacros:
>  self.ListFileMacros[T.IncListFileMacro] = []
> +if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT 
> and Type == TAB_C_CODE_FILE:
> +NewFile = self.PlaceMacro(str(T), self.Macros)
> +if self.ObjTargetDict.get(T.Target.SubDir):
> +self.ObjTargetDict[T.Target.SubDir].add(NewFile)
> +else:
> +self.ObjTargetDict[T.Target.SubDir] = set()

Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool

2019-03-29 Thread Supreeth Venkatesh
Sorry. This was sent in error. I was testing my new Desktop with git send-email.
Please ignore.

Supreeth


-Original Message-
From: Jin, Eric 
Sent: Friday, March 29, 2019 3:32 AM
To: Supreeth Venkatesh ; edk2-devel@lists.01.org
Cc: Jin, Eric 
Subject: RE: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line 
ending detection by GenBin tool

Hi Supreeth,

This patch can't be applied to the lasted code base SHA-1: 33022e.
One patch from  may already fix the issue. Please check again.

Best Regards
Eric

-Original Message-
From: edk2-devel  On Behalf Of Supreeth 
Venkatesh
Sent: Friday, March 29, 2019 7:08 AM
To: supreeth.venkat...@arm.com; edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending 
detection by GenBin tool

From: Lokesh B V 

Some windows editors uses "\r\n" for line feed. While processing uefi sct 
testcase info file, the GenBin tool logic to skip line feed doesn't consider 
the presence of carraige return(\r) in line feed. So this results in incorrect 
format error.

Fixed this issue by changing logic of Trim and Getline functions used in GenBin 
source code.

Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Lokesh B V 
---
Changes since v1:
* Adopted changes suggested by Supreeth.
* modified Copyright content

 uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +---
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c 
b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
index 61bb35b..6d8e844 100644
--- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
+++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
@@ -2,6 +2,7 @@

   Copyright 2006 - 2010 Unified EFI, Inc.
   Copyright (c) 2010 Intel Corporation. All rights reserved.
+  Copyright (c) 2018 ARM Ltd. All rights reserved.

   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -32,6 +33,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 

 //
 // Definitions
@@ -49,7 +51,7 @@ PrintUsage (
   void
   );

-void
+char *
 Trim (
   char*String
   );
@@ -159,50 +161,42 @@ PrintUsage (
 }


-void
+char *
 Trim (
   char*String
   )
 {
-  int   Index1;
-  int   Index2;
   int   Length;
+  char  *end;

   Length = strlen (String);

-  //
-  // Remove the space characters from the beginning of this string
-  //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Index1] != ' ' ) &&
-(String[Index1] != '\t') &&
-(String[Index1] != '\n')) {
-  break;
-}
-  }
-
-  for (Index2 = Index1; Index2 < Length; Index2++) {
-String[Index2 - Index1] = String[Index2];
+  if (!Length) {
+return String;
   }

-  Length = Length - Index1;
+  end = String + Length - 1;

   //
   // Remove the space characters from the end of this string
   //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Length - 1 - Index1] != ' ' ) &&
-(String[Length - 1 - Index1] != '\t') &&
-(String[Length - 1 - Index1] != '\n')) {
-  break;
-}
+  while (end >= String && isspace (*end)) {
+end--;
   }

-  String[Length - Index1] = '\0';
+  *(end + 1) = '\0';
+
+  //
+  // Remove the space characters from the beginning of this string  //
+ while (*String && isspace (*String)) {
+String++;
+  }

   //
   // Done
   //
+  return String;
 }


@@ -227,20 +221,20 @@ GetLine (
   return -1;
 }

-(*LineNo)++;
-
 //
 // Remove the beginning and ending space characters
 //
-Trim (String);
+String = Trim (Result);

 //
-// Ignore the empty line and comment line
+// Skip the empty line and comment line
 //
-if ((String[0] != '\0') &&
-(String[0] != '#' )) {
-  break;
+if ((String[0] == '\0') ||
+(String[0] == '#' )) {
+  continue;
 }
+
+(*LineNo)++;
   }

   //
--
2.7.4


___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium. Thank you.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Gao, Liming
Yes. Please submit one BZ for it. 

> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:40 PM
> To: Gao, Liming ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> That will impact the original GenFds since the command is generate by reusing 
> the GenFds functions. What about enter a new BZ to do
> that change?
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Friday, March 29, 2019 8:33 PM
> To: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> Bob:
>   Could you update the rule to depend on EFI image from DEBUG_DIR? I would 
> like to remove the additional copy from DEBUG dir to
> OUTPUT dir and save the disk and performance.
> 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(DEBUG_DIR)\LogoDxe.efi
>   GenSec -s EFI_SECTION_PE32 -o 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(DEBUG_DIR)\LogoDxe.efi
> 
> Thanks
> Liming
> > -Original Message-
> > From: Feng, Bob C
> > Sent: Friday, March 29, 2019 8:00 PM
> > To: Gao, Liming ; edk2-devel@lists.01.org
> > Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds
> > function
> >
> > That's to fix the issue that make will fail if enable multiple thread 
> > genfds.
> >
> > For example, If enable Multiple thread Genfds, there will be GenSec command 
> > in the Makefile like below.
> >
> > $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
> > GenSec -s EFI_SECTION_PE32 -o
> > $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32
> > $(OUTPUT_DIR)\LogoDxe.efi
> >
> >
> > The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule 
> > for $(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile.
> > Make program does not know how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make 
> > fails for this case.
> >
> > In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is 
> > generated by the command $(CP)
> > $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under
> > Dynamic-Library-File section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi
> > should also be a output for Dynamic-Library-File
> >
> > Thanks,
> > Bob
> >
> > -Original Message-
> > From: Gao, Liming
> > Sent: Friday, March 29, 2019 7:42 PM
> > To: Feng, Bob C ; edk2-devel@lists.01.org
> > Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds
> > function
> >
> > Bob:
> >   Could you list the more information on why update build_rule.txt?
> >
> > > -Original Message-
> > > From: Feng, Bob C
> > > Sent: Friday, March 29, 2019 7:07 PM
> > > To: edk2-devel@lists.01.org
> > > Cc: Feng, Bob C ; Gao, Liming
> > > 
> > > Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds
> > > function
> > >
> > > https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> > > In the Multiple thread Genfds feature, build tool generates GenSec,
> > > GenFFS command in Makefile.
> > >
> > > The Non-Hii Driver does not generate .offset file for uni string
> > > offset, but the build tool has not knowledge about this in autogen
> > > phase. So in this patch, I add a check in Makefile for GenSec command.
> > > If the GenSec input file does not exist, the GenSec will not be
> > > called. And if GenSec command is not called, its output file, which
> > > is also the input file of GenFfs command, will also not exist.So for
> > > GenFfs command, I add a new command parameter -oi which means the
> > > input file is an optional input file which would not exist. so that
> > > I can generate GenFfs command with "-oi" parameter in Makefile.
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Bob Feng 
> > > Cc: Liming Gao 
> > > ---
> > >  BaseTools/Conf/build_rule.template  | 14 +++---
> > >  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
> > >  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
> > >  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
> > >  .../Source/Python/Workspace/DscBuildData.py |  3 +++
> > >  BaseTools/Source/Python/build/build.py  | 10 +-
> > >  6 files changed, 40 insertions(+), 16 deletions(-)
> > >
> > > diff --git a/BaseTools/Conf/build_rule.template
> > > b/BaseTools/Conf/build_rule.template
> > > index e56b1d9c59..8cd7d0e445 100755
> > > --- a/BaseTools/Conf/build_rule.template
> > > +++ b/BaseTools/Conf/build_rule.template
> > > @@ -357,16 +357,16 @@
> > >  [Dynamic-Library-File]
> > >  
> > >  ?.dll
> > >
> > >  
> > > -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > > +$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > > + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> > >
> > >  
> > >  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> > > -$(CP) ${dst} $(OUTPUT_DIR)
> > > -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> > > +$(CP) 

[edk2] [PATCH v7] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread nkvangup
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593

For every SMI occurrence, save and restore CR2 register only when SMM
on-demand paging support is enabled in 64 bit operation mode.
This is not a bug but to have better improvement of code.

Patch5 is updated with separate functions for Save and Restore of CR2
based on review feedback.

Patch6 - Removed Global Cr2 instead used function parameter

Patch7 - Removed checking Cr2 with 0 as per feedback

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Vanguput Narendra K 
Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Yao Jiewen 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
 UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22 ++
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30 ++
 4 files changed, 84 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index b734a1ea8c..af96e42982 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -316,3 +316,29 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  return ;
+}
+
+/**
+  This function returns with no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  return ;
+}
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 3b0b3b52ac..ce70f77709 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1112,9 +1112,11 @@ SmiRendezvous (
   ASSERT(CpuIndex < mMaxNumberOfCpus);
 
   //
-  // Save Cr2 because Page Fault exception in SMM may override its value
+  // Save Cr2 because Page Fault exception in SMM may override its value,
+  // when using on-demand paging for above 4G memory.
   //
-  Cr2 = AsmReadCr2 ();
+  Cr2 = 0;
+  SaveCr2 ();
 
   //
   // Perform CPU specific entry hooks
@@ -1253,10 +1255,11 @@ SmiRendezvous (
 
 Exit:
   SmmCpuFeaturesRendezvousExit (CpuIndex);
+
   //
   // Restore Cr2
   //
-  AsmWriteCr2 (Cr2);
+  RestoreCr2 (Cr2);
 }
 
 /**
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h 
b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
index 84efb22981..c9d147c8a1 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
@@ -1243,4 +1243,26 @@ EFIAPI
 PiSmmCpuSmiEntryFixupAddress (
  );
 
+/**
+  This function reads CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  );
+
+/**
+  This function writes into CR2 register when on-demand paging is enabled
+  for 64 bit and no action for 32 bit.
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  );
+
 #endif
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 2c77cb47a4..b30e8e1f82 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -1053,3 +1053,33 @@ SetPageTableAttributes (
 
   return ;
 }
+
+/**
+  This function reads CR2 register when on-demand paging is enabled
+
+  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
+**/
+VOID
+SaveCr2 (
+  UINTN  *Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+*Cr2 = AsmReadCr2 ();
+  }
+}
+
+/**
+  This function restores CR2 register when on-demand paging is enabled
+
+  @param[in]  Cr2  Value to write into CR2 register
+**/
+VOID
+RestoreCr2 (
+  UINTN  Cr2
+  )
+{
+  if (!mCpuSmmStaticPageTable) {
+AsmWriteCr2 (Cr2);
+  }
+}
-- 
2.16.2.windows.1

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


Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
That will impact the original GenFds since the command is generate by reusing 
the GenFds functions. What about enter a new BZ to do that change?

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 8:33 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function

Bob:
  Could you update the rule to depend on EFI image from DEBUG_DIR? I would like 
to remove the additional copy from DEBUG dir to OUTPUT dir and save the disk 
and performance. 

$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(DEBUG_DIR)\LogoDxe.efi
GenSec -s EFI_SECTION_PE32 -o 
$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(DEBUG_DIR)\LogoDxe.efi

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:00 PM
> To: Gao, Liming ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> That's to fix the issue that make will fail if enable multiple thread genfds.
> 
> For example, If enable Multiple thread Genfds, there will be GenSec command 
> in the Makefile like below.
> 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
>   GenSec -s EFI_SECTION_PE32 -o 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 
> $(OUTPUT_DIR)\LogoDxe.efi
> 
> 
> The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule 
> for $(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile.
> Make program does not know how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make fails 
> for this case.
> 
> In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is 
> generated by the command $(CP)
> $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under 
> Dynamic-Library-File section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi 
> should also be a output for Dynamic-Library-File
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Friday, March 29, 2019 7:42 PM
> To: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> function
> 
> Bob:
>   Could you list the more information on why update build_rule.txt?
> 
> > -Original Message-
> > From: Feng, Bob C
> > Sent: Friday, March 29, 2019 7:07 PM
> > To: edk2-devel@lists.01.org
> > Cc: Feng, Bob C ; Gao, Liming 
> > 
> > Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds 
> > function
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> > In the Multiple thread Genfds feature, build tool generates GenSec, 
> > GenFFS command in Makefile.
> >
> > The Non-Hii Driver does not generate .offset file for uni string 
> > offset, but the build tool has not knowledge about this in autogen 
> > phase. So in this patch, I add a check in Makefile for GenSec command.
> > If the GenSec input file does not exist, the GenSec will not be 
> > called. And if GenSec command is not called, its output file, which 
> > is also the input file of GenFfs command, will also not exist.So for 
> > GenFfs command, I add a new command parameter -oi which means the 
> > input file is an optional input file which would not exist. so that 
> > I can generate GenFfs command with "-oi" parameter in Makefile.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Bob Feng 
> > Cc: Liming Gao 
> > ---
> >  BaseTools/Conf/build_rule.template  | 14 +++---
> >  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
> >  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
> >  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
> >  .../Source/Python/Workspace/DscBuildData.py |  3 +++
> >  BaseTools/Source/Python/build/build.py  | 10 +-
> >  6 files changed, 40 insertions(+), 16 deletions(-)
> >
> > diff --git a/BaseTools/Conf/build_rule.template
> > b/BaseTools/Conf/build_rule.template
> > index e56b1d9c59..8cd7d0e445 100755
> > --- a/BaseTools/Conf/build_rule.template
> > +++ b/BaseTools/Conf/build_rule.template
> > @@ -357,16 +357,16 @@
> >  [Dynamic-Library-File]
> >  
> >  ?.dll
> >
> >  
> > -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > +$(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> > + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> >
> >  
> >  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> > -$(CP) ${dst} $(OUTPUT_DIR)
> > -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> > +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> > +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> > + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> >  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> >  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
> >  
> >  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
> >  $(OBJCOPY) --strip-unneeded -R .eh_frame ${src} @@ -376,22
> > +376,22 @@
> >  #
> >  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) 

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Gao, Liming
Bob:
  Could you update the rule to depend on EFI image from DEBUG_DIR? I would like 
to remove the additional copy from DEBUG dir to OUTPUT dir and save the disk 
and performance. 

$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(DEBUG_DIR)\LogoDxe.efi
GenSec -s EFI_SECTION_PE32 -o 
$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(DEBUG_DIR)\LogoDxe.efi

Thanks
Liming
> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 8:00 PM
> To: Gao, Liming ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> That's to fix the issue that make will fail if enable multiple thread genfds.
> 
> For example, If enable Multiple thread Genfds, there will be GenSec command 
> in the Makefile like below.
> 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
>   GenSec -s EFI_SECTION_PE32 -o 
> $(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(OUTPUT_DIR)\LogoDxe.efi
> 
> 
> The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule 
> for $(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile.
> Make program does not know how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make fails 
> for this case.
> 
> In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is 
> generated by the command $(CP)
> $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under Dynamic-Library-File 
> section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi
> should also be a output for Dynamic-Library-File
> 
> Thanks,
> Bob
> 
> -Original Message-
> From: Gao, Liming
> Sent: Friday, March 29, 2019 7:42 PM
> To: Feng, Bob C ; edk2-devel@lists.01.org
> Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> Bob:
>   Could you list the more information on why update build_rule.txt?
> 
> > -Original Message-
> > From: Feng, Bob C
> > Sent: Friday, March 29, 2019 7:07 PM
> > To: edk2-devel@lists.01.org
> > Cc: Feng, Bob C ; Gao, Liming
> > 
> > Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> > In the Multiple thread Genfds feature, build tool generates GenSec,
> > GenFFS command in Makefile.
> >
> > The Non-Hii Driver does not generate .offset file for uni string
> > offset, but the build tool has not knowledge about this in autogen
> > phase. So in this patch, I add a check in Makefile for GenSec command.
> > If the GenSec input file does not exist, the GenSec will not be
> > called. And if GenSec command is not called, its output file, which is
> > also the input file of GenFfs command, will also not exist.So for
> > GenFfs command, I add a new command parameter -oi which means the
> > input file is an optional input file which would not exist. so that I
> > can generate GenFfs command with "-oi" parameter in Makefile.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Bob Feng 
> > Cc: Liming Gao 
> > ---
> >  BaseTools/Conf/build_rule.template  | 14 +++---
> >  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
> >  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
> >  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
> >  .../Source/Python/Workspace/DscBuildData.py |  3 +++
> >  BaseTools/Source/Python/build/build.py  | 10 +-
> >  6 files changed, 40 insertions(+), 16 deletions(-)
> >
> > diff --git a/BaseTools/Conf/build_rule.template
> > b/BaseTools/Conf/build_rule.template
> > index e56b1d9c59..8cd7d0e445 100755
> > --- a/BaseTools/Conf/build_rule.template
> > +++ b/BaseTools/Conf/build_rule.template
> > @@ -357,16 +357,16 @@
> >  [Dynamic-Library-File]
> >  
> >  ?.dll
> >
> >  
> > -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > +$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> >
> >  
> >  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> > -$(CP) ${dst} $(OUTPUT_DIR)
> > -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> > +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> > +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi
> > + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> >  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> >  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
> >  
> >  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
> >  $(OBJCOPY) --strip-unneeded -R .eh_frame ${src} @@ -376,22
> > +376,22 @@
> >  #
> >  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
> >  -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug
> > $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
> >
> >  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> > -$(CP) ${dst} $(OUTPUT_DIR)
> > -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> > +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> > +$(CP) 

[edk2] [Patch] BaseTools:Enable the /MP option of MSVC compiler

2019-03-29 Thread Feng, Bob C
From: Zhiju Fan 

https://bugzilla.tianocore.org/show_bug.cgi?id=1672
The /MP option of MSVC compiler can reduce the total
time to compile the source files on the command line.

This patch is going to enable this MSVC option in BaseTools.

Cc: Bob Feng 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zhiju.Fan 
---
 BaseTools/Conf/build_rule.template |  2 +-
 BaseTools/Source/Python/AutoGen/GenMake.py | 81 --
 2 files changed, 75 insertions(+), 8 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index e56b1d9c59..e7d736740f 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -127,11 +127,11 @@
 
 
 $(OUTPUT_DIR)(+)${s_dir}(+)${s_base}.obj
 
 
-"$(CC)" /Fo${dst} $(CC_FLAGS) $(INC) ${src}
+"$(CC)" /MP7 /Fo${d_path}\ $(CC_FLAGS) $(INC) ${src}
 
 
 # For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues
 "$(CC)" $(CC_FLAGS) -c -o ${dst} $(INC) ${src}
 
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py 
b/BaseTools/Source/Python/AutoGen/GenMake.py
index b441817b52..04951346ad 100644
--- a/BaseTools/Source/Python/AutoGen/GenMake.py
+++ b/BaseTools/Source/Python/AutoGen/GenMake.py
@@ -433,11 +433,11 @@ cleanlib:
 self.BuildTargetList = []   # [target string]
 self.PendingBuildTargetList = []# [FileBuildRule objects]
 self.CommonFileDependency = []
 self.FileListMacros = {}
 self.ListFileMacros = {}
-
+self.ObjTargetDict = {}
 self.FileCache = {}
 self.LibraryBuildCommandList = []
 self.LibraryFileList = []
 self.LibraryMakefileList = []
 self.LibraryBuildDirectoryList = []
@@ -616,10 +616,15 @@ cleanlib:
 ListFileName,
 "\n".join(self.ListFileMacros[ListFileMacro]),
 False
 )
 
+# Generate objlist used to create .obj file
+for Type in self.ObjTargetDict:
+NewLine = ' '.join(list(self.ObjTargetDict[Type]))
+FileMacroList.append("OBJLIST_%s = %s" % 
(list(self.ObjTargetDict.keys()).index(Type), NewLine))
+
 BcTargetList = []
 
 MakefileName = self._FILE_NAME_[self._FileType]
 LibraryMakeCommandList = []
 for D in self.LibraryBuildDirectoryList:
@@ -925,17 +930,22 @@ cleanlib:
 # Extract common files list in the dependency files
 #
 for File in DepSet:
 self.CommonFileDependency.append(self.PlaceMacro(File.Path, 
self.Macros))
 
+CmdSumDict = {}
+CmdTargetDict = {}
+CmdCppDict = {}
+DependencyDict = FileDependencyDict.copy()
 for File in FileDependencyDict:
 # skip non-C files
 if File.Ext not in [".c", ".C"] or File.Name == "AutoGen.c":
 continue
 NewDepSet = set(FileDependencyDict[File])
 NewDepSet -= DepSet
 FileDependencyDict[File] = ["$(COMMON_DEPS)"] + list(NewDepSet)
+DependencyDict[File] = list(NewDepSet)
 
 # Convert target description object to target string in makefile
 for Type in self._AutoGenObject.Targets:
 for T in self._AutoGenObject.Targets[Type]:
 # Generate related macros if needed
@@ -943,15 +953,25 @@ cleanlib:
 self.FileListMacros[T.FileListMacro] = []
 if T.GenListFile and T.ListFileMacro not in 
self.ListFileMacros:
 self.ListFileMacros[T.ListFileMacro] = []
 if T.GenIncListFile and T.IncListFileMacro not in 
self.ListFileMacros:
 self.ListFileMacros[T.IncListFileMacro] = []
+if self._AutoGenObject.BuildRuleFamily == TAB_COMPILER_MSFT 
and Type == TAB_C_CODE_FILE:
+NewFile = self.PlaceMacro(str(T), self.Macros)
+if self.ObjTargetDict.get(T.Target.SubDir):
+self.ObjTargetDict[T.Target.SubDir].add(NewFile)
+else:
+self.ObjTargetDict[T.Target.SubDir] = set()
+self.ObjTargetDict[T.Target.SubDir].add(NewFile)
 
 Deps = []
+CCodeDeps = []
 # Add force-dependencies
 for Dep in T.Dependencies:
 Deps.append(self.PlaceMacro(str(Dep), self.Macros))
+if Dep != '$(MAKE_FILE)':
+CCodeDeps.append(self.PlaceMacro(str(Dep), 
self.Macros))
 # Add inclusion-dependencies
 if len(T.Inputs) == 1 and T.Inputs[0] in FileDependencyDict:
 for F in FileDependencyDict[T.Inputs[0]]:
 Deps.append(self.PlaceMacro(str(F), self.Macros))
 # Add source-dependencies
@@ -971,16 +991,63 @@ cleanlib:
 

Re: [edk2] [PATCH V3] BaseTools:Trim will trig exception when input asl UTF8 format file

2019-03-29 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Fan, ZhijuX
> Sent: Thursday, March 28, 2019 11:21 AM
> To: edk2-devel@lists.01.org
> Cc: Gao, Liming ; Feng, Bob C 
> Subject: [edk2][PATCH V3] BaseTools:Trim will trig exception when input asl 
> UTF8 format file
> 
> BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1641
> 
> The command trim --asl-file -o test.i UTF8.asl will trig the exception.
> There's a problem with the encoding of the file,it only appears in python3.
> I changed the way I opened it to support reading this file
> 
> Cc: Bob Feng 
> Cc: Liming Gao 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhiju.Fan 
> ---
>  BaseTools/Source/Python/Trim/Trim.py | 44 
> +---
>  1 file changed, 21 insertions(+), 23 deletions(-)
> 
> diff --git a/BaseTools/Source/Python/Trim/Trim.py 
> b/BaseTools/Source/Python/Trim/Trim.py
> index 228779b5a9..05feab6abe 100644
> --- a/BaseTools/Source/Python/Trim/Trim.py
> +++ b/BaseTools/Source/Python/Trim/Trim.py
> @@ -18,7 +18,7 @@ import Common.LongFilePathOs as os
>  import sys
>  import re
>  from io import BytesIO
> -
> +import codecs
>  from optparse import OptionParser
>  from optparse import make_option
>  from Common.BuildToolError import *
> @@ -77,14 +77,11 @@ gIncludedAslFile = []
>  def TrimPreprocessedFile(Source, Target, ConvertHex, TrimLong):
>  CreateDirectory(os.path.dirname(Target))
>  try:
> -f = open (Source, 'r')
> +with open(Source, "r") as File:
> +Lines = File.readlines()
>  except:
>  EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
> 
> -# read whole file
> -Lines = f.readlines()
> -f.close()
> -
>  PreprocessedFile = ""
>  InjectedFile = ""
>  LineIndexOfOriginalFile = None
> @@ -181,11 +178,10 @@ def TrimPreprocessedFile(Source, Target, ConvertHex, 
> TrimLong):
> 
>  # save to file
>  try:
> -f = open (Target, 'w')
> +with open(Target, 'w') as File:
> +File.writelines(NewLines)
>  except:
>  EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
> -f.writelines(NewLines)
> -f.close()
> 
>  ## Trim preprocessed VFR file
>  #
> @@ -199,12 +195,11 @@ def TrimPreprocessedVfr(Source, Target):
>  CreateDirectory(os.path.dirname(Target))
> 
>  try:
> -f = open (Source, 'r')
> +with open(Source, "r") as File:
> +Lines = File.readlines()
>  except:
>  EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Source)
>  # read whole file
> -Lines = f.readlines()
> -f.close()
> 
>  FoundTypedef = False
>  Brace = 0
> @@ -248,11 +243,10 @@ def TrimPreprocessedVfr(Source, Target):
> 
>  # save all lines trimmed
>  try:
> -f = open (Target, 'w')
> +with open(Target, 'w') as File:
> +File.writelines(Lines)
>  except:
>  EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
> -f.writelines(Lines)
> -f.close()
> 
>  ## Read the content  ASL file, including ASL included, recursively
>  #
> @@ -278,7 +272,12 @@ def DoInclude(Source, Indent='', IncludePathList=[], 
> LocalSearchPath=None):
>  for IncludePath in SearchPathList:
>  IncludeFile = os.path.join(IncludePath, Source)
>  if os.path.isfile(IncludeFile):
> -F = open(IncludeFile, "r")
> +try:
> +with open(IncludeFile, "r") as File:
> +F = File.readlines()
> +except:
> +with codecs.open(IncludeFile, "r", encoding='utf-8') as 
> File:
> +F = File.readlines()
>  break
>  else:
>  EdkLogger.error("Trim", "Failed to find include file %s" % 
> Source)
> @@ -313,7 +312,6 @@ def DoInclude(Source, Indent='', IncludePathList=[], 
> LocalSearchPath=None):
>  NewFileContent.append("\n")
> 
>  gIncludedAslFile.pop()
> -F.close()
> 
>  return NewFileContent
> 
> @@ -345,7 +343,9 @@ def TrimAslFile(Source, Target, IncludePathFile):
>  if IncludePathFile:
>  try:
>  LineNum = 0
> -for Line in open(IncludePathFile, 'r'):
> +with open(IncludePathFile, 'r') as File:
> +FileLines = File.readlines()
> +for Line in FileLines:
>  LineNum += 1
>  if Line.startswith("/I") or Line.startswith ("-I"):
>  IncludePathList.append(Line[2:].strip())
> @@ -363,13 +363,11 @@ def TrimAslFile(Source, Target, IncludePathFile):
> 
>  # save all lines trimmed
>  try:
> -f = open (Target, 'w')
> +with open(Target, 'w') as File:
> +File.writelines(Lines)
>  except:
>  EdkLogger.error("Trim", FILE_OPEN_FAILURE, ExtraData=Target)
> 
> -f.writelines(Lines)
> -f.close()
> -
>  def 

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
That's to fix the issue that make will fail if enable multiple thread genfds.

For example, If enable Multiple thread Genfds, there will be GenSec command in 
the Makefile like below. 

$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 : $(OUTPUT_DIR)\LogoDxe.efi
GenSec -s EFI_SECTION_PE32 -o 
$(FFS_OUTPUT_DIR)\$(MODULE_GUID)SEC2.1.1.1.pe32 $(OUTPUT_DIR)\LogoDxe.efi


The $(OUTPUT_DIR)\LogoDxe.efi is the dependency, but there is no make rule for 
$(OUTPUT_DIR)\LogoDxe.efi generated in the Makefile. Make program does not know 
how to make $(OUTPUT_DIR)\LogoDxe.efi.  Make fails for this case.

In the build_rule.txt, the $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi   is generated 
by the command $(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR) under 
Dynamic-Library-File section, so $(OUTPUT_DIR)\ )(+)$(MODULE_NAME).efi  should 
also be a output for Dynamic-Library-File

Thanks,
Bob

-Original Message-
From: Gao, Liming 
Sent: Friday, March 29, 2019 7:42 PM
To: Feng, Bob C ; edk2-devel@lists.01.org
Subject: RE: [Patch] BaseTools: Fixed issue in MultiThread Genfds function

Bob:
  Could you list the more information on why update build_rule.txt?

> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 7:07 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> 
> Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> In the Multiple thread Genfds feature, build tool generates GenSec, 
> GenFFS command in Makefile.
> 
> The Non-Hii Driver does not generate .offset file for uni string 
> offset, but the build tool has not knowledge about this in autogen 
> phase. So in this patch, I add a check in Makefile for GenSec command. 
> If the GenSec input file does not exist, the GenSec will not be 
> called. And if GenSec command is not called, its output file, which is 
> also the input file of GenFfs command, will also not exist.So for 
> GenFfs command, I add a new command parameter -oi which means the 
> input file is an optional input file which would not exist. so that I 
> can generate GenFfs command with "-oi" parameter in Makefile.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Conf/build_rule.template  | 14 +++---
>  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
>  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
>  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
>  .../Source/Python/Workspace/DscBuildData.py |  3 +++
>  BaseTools/Source/Python/build/build.py  | 10 +-
>  6 files changed, 40 insertions(+), 16 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..8cd7d0e445 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -357,16 +357,16 @@
>  [Dynamic-Library-File]
>  
>  ?.dll
> 
>  
> -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> +$(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> 
>  
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
>  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
>  
>  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
>  $(OBJCOPY) --strip-unneeded -R .eh_frame ${src} @@ -376,22 
> +376,22 @@
>  #
>  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
>  -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
> 
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  
>  # tool to convert Mach-O to PE/COFF
>  "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
>  # create symbol file for GDB debug
>  -$(DSYMUTIL) ${src}
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> + $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  

Re: [edk2] [PATCH V2 0/2] Change reset logic related on capsule

2019-03-29 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Gao, Zhichao
> Sent: Friday, March 22, 2019 11:07 AM
> To: edk2-devel@lists.01.org
> Cc: Wang, Jian J ; Wu, Hao A ; Ni, 
> Ray ; Zeng, Star
> ; Gao, Liming ; Ard Biesheuvel 
> 
> Subject: [PATCH V2 0/2] Change reset logic related on capsule
> 
> Add CapsuleCacheWriteBack for IA ARCH before runtime.
> Remove DoS3 in ResetSystemRuntimeDxe.
> 
> V2:
> Adjust the code that would not change the logic of arm ARCH.
> Fix some build errors because of type convertion.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zhichao Gao 
> Cc: Jian J Wang 
> Cc: Hao Wu 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming Gao 
> Cc: Ard Biesheuvel 
> 
> Zhichao Gao (2):
>   MdeModulePkg/CapsuleRuntimeDxe: IA32 add cache flush function
>   MdeModulePkg/ResetSystemRuntimeDxe: Remove DoS3 in warm reset
> 
>  .../Universal/CapsuleRuntimeDxe/Arm/CapsuleReset.c | 35 +---
>  .../Universal/CapsuleRuntimeDxe/CapsuleCache.c | 63 
> ++
>  .../Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c | 38 +
>  .../Universal/CapsuleRuntimeDxe/CapsuleReset.c | 16 +-
>  .../CapsuleRuntimeDxe/CapsuleRuntimeDxe.inf| 20 ---
>  .../Universal/ResetSystemRuntimeDxe/ResetSystem.c  | 38 -
>  6 files changed, 115 insertions(+), 95 deletions(-)
>  create mode 100644 MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCache.c
>  create mode 100644 
> MdeModulePkg/Universal/CapsuleRuntimeDxe/CapsuleCacheNull.c
> 
> --
> 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 00/12] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg

2019-03-29 Thread Gao, Liming
Reviewed-by: Liming Gao 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Friday, March 29, 2019 3:28 PM
> To: edk2-devel@lists.01.org
> Cc: Kinney, Michael D ; Gao, Liming 
> ; Dong, Eric ; Ni, Ray
> 
> Subject: [PATCH v3 00/12] Remove .S files for IA32 and X64 arch in MdePkg and 
> UefiCpuPkg
> 
> .nasm file has been added for X86 arch. .S assembly code
> is not required any more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
> 
> v2: Remove some description in 04/10.
> 
> v3: Add 11/12 and 12/12.
> 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Shenglei Zhang (12):
>   UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch
>   UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch
>   UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch
>   MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseLib: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch
>   MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch
>   CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch
>   SourceLevelDebugPkg/DebugAgentCommon: Remove .S files
> 
>  .../Library/IntrinsicLib/Ia32/MathLShiftS64.S |  62 --
>  .../Library/IntrinsicLib/Ia32/MathRShiftU64.S |  66 --
>  .../Library/IntrinsicLib/IntrinsicLib.inf |   2 -
>  MdePkg/Library/BaseCpuLib/BaseCpuLib.inf  |   4 -
>  MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S   |  35 -
>  MdePkg/Library/BaseCpuLib/X64/CpuSleep.S  |  34 -
>  MdePkg/Library/BaseLib/BaseLib.inf|  38 -
>  MdePkg/Library/BaseLib/Ia32/ARShiftU64.S  |  43 --
>  MdePkg/Library/BaseLib/Ia32/CpuId.S   |  63 --
>  MdePkg/Library/BaseLib/Ia32/CpuIdEx.S |  67 --
>  MdePkg/Library/BaseLib/Ia32/DisableCache.S|  39 -
>  MdePkg/Library/BaseLib/Ia32/DisablePaging32.S |  52 --
>  MdePkg/Library/BaseLib/Ia32/DivU64x32.S   |  41 --
>  .../Library/BaseLib/Ia32/DivU64x32Remainder.S |  46 --
>  .../Library/BaseLib/Ia32/DivU64x64Remainder.S |  89 ---
>  MdePkg/Library/BaseLib/Ia32/EnableCache.S |  39 -
>  .../BaseLib/Ia32/EnableDisableInterrupts.S|  36 -
>  MdePkg/Library/BaseLib/Ia32/EnablePaging32.S  |  52 --
>  MdePkg/Library/BaseLib/Ia32/EnablePaging64.S  |  63 --
>  .../BaseLib/Ia32/InternalSwitchStack.S|  48 --
>  MdePkg/Library/BaseLib/Ia32/LRotU64.S |  48 --
>  MdePkg/Library/BaseLib/Ia32/LShiftU64.S   |  43 --
>  MdePkg/Library/BaseLib/Ia32/LongJump.S|  41 --
>  MdePkg/Library/BaseLib/Ia32/ModU64x32.S   |  40 --
>  MdePkg/Library/BaseLib/Ia32/Monitor.S |  40 --
>  MdePkg/Library/BaseLib/Ia32/MultU64x32.S  |  41 --
>  MdePkg/Library/BaseLib/Ia32/MultU64x64.S  |  44 --
>  MdePkg/Library/BaseLib/Ia32/Mwait.S   |  38 -
>  MdePkg/Library/BaseLib/Ia32/RRotU64.S |  48 --
>  MdePkg/Library/BaseLib/Ia32/RShiftU64.S   |  46 --
>  MdePkg/Library/BaseLib/Ia32/RdRand.S  |  80 ---
>  MdePkg/Library/BaseLib/Ia32/SetJump.S |  44 --
>  MdePkg/Library/BaseLib/Ia32/SwapBytes64.S |  38 -
>  MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 --
>  MdePkg/Library/BaseLib/X64/CpuId.S|  60 --
>  MdePkg/Library/BaseLib/X64/CpuIdEx.S  |  62 --
>  MdePkg/Library/BaseLib/X64/DisableCache.S |  39 -
>  MdePkg/Library/BaseLib/X64/DisablePaging64.S  |  82 ---
>  MdePkg/Library/BaseLib/X64/EnableCache.S  |  39 -
>  .../BaseLib/X64/EnableDisableInterrupts.S |  36 -
>  MdePkg/Library/BaseLib/X64/LongJump.S |  54 --
>  MdePkg/Library/BaseLib/X64/RdRand.S   |  72 --
>  MdePkg/Library/BaseLib/X64/SetJump.S  |  53 --
>  MdePkg/Library/BaseLib/X64/SwitchStack.S  |  52 --
>  MdePkg/Library/BaseLib/X64/Thunk16.S  | 334 -
>  .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf |  22 -
>  .../BaseMemoryLibMmx/Ia32/CompareMem.S|  55 --
>  .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S   |  86 ---
>  .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S |  52 --
>  .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S |  52 --
>  .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S |  61 --
>  .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S  |  52 --
>  MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S |  66 --
>  .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S  |  59 --
>  .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S  |  52 --
>  .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S  |  43 --
>  .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S   |  54 --
>  .../Library/BaseMemoryLibMmx/X64/CompareMem.S |  59 --
>  MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S |  74 --
>  .../Library/BaseMemoryLibMmx/X64/ScanMem16.S  |  56 --
>  .../Library/BaseMemoryLibMmx/X64/ScanMem32.S  |  56 --
>  

Re: [edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Gao, Liming
Bob:
  Could you list the more information on why update build_rule.txt?

> -Original Message-
> From: Feng, Bob C
> Sent: Friday, March 29, 2019 7:07 PM
> To: edk2-devel@lists.01.org
> Cc: Feng, Bob C ; Gao, Liming 
> Subject: [Patch] BaseTools: Fixed issue in MultiThread Genfds function
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1450
> In the Multiple thread Genfds feature, build tool generates
> GenSec, GenFFS command in Makefile.
> 
> The Non-Hii Driver does not generate .offset file for uni string offset,
> but the build tool has not knowledge about this in autogen phase. So
> in this patch, I add a check in Makefile for GenSec command. If the GenSec
> input file does not exist, the GenSec will not be called. And if GenSec
> command is not called, its output file, which is also the input file of
> GenFfs command, will also not exist.So for GenFfs command,
> I add a new command parameter -oi which means
> the input file is an optional input file which would not exist. so
> that I can generate GenFfs command with "-oi" parameter in Makefile.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Bob Feng 
> Cc: Liming Gao 
> ---
>  BaseTools/Conf/build_rule.template  | 14 +++---
>  BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
>  BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
>  .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
>  .../Source/Python/Workspace/DscBuildData.py |  3 +++
>  BaseTools/Source/Python/build/build.py  | 10 +-
>  6 files changed, 40 insertions(+), 16 deletions(-)
> 
> diff --git a/BaseTools/Conf/build_rule.template 
> b/BaseTools/Conf/build_rule.template
> index e56b1d9c59..8cd7d0e445 100755
> --- a/BaseTools/Conf/build_rule.template
> +++ b/BaseTools/Conf/build_rule.template
> @@ -357,16 +357,16 @@
>  [Dynamic-Library-File]
>  
>  ?.dll
> 
>  
> -$(DEBUG_DIR)(+)$(MODULE_NAME).efi
> +$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
> 
>  
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
>  -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR)
>  
>  $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
>  $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
> @@ -376,22 +376,22 @@
>  #
>  -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
>  -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
> 
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  
>  # tool to convert Mach-O to PE/COFF
>  "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
>  # create symbol file for GDB debug
>  -$(DSYMUTIL) ${src}
>  "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
> $(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
> -$(CP) ${dst} $(OUTPUT_DIR)
> -$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
> +$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
> $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
>  -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
> 
>  [Dependency-Expression-File]
>  
>  ?.dxs, ?.Dxs, ?.DXS
> diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c 
> b/BaseTools/Source/C/GenFfs/GenFfs.c
> index 02c7ac30f0..ea36b22bef 100644
> --- a/BaseTools/Source/C/GenFfs/GenFfs.c
> +++ b/BaseTools/Source/C/GenFfs/GenFfs.c
> @@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  #include 
>  #include 
>  #include 
>  #endif
> 
> +#ifdef __GNUC__
> +#include 
> +#endif
> +
>  #include 
>  #include 
>  #include 
> 
>  #include 
> @@ -158,10 +162,12 @@ Returns:
>  FileAlign points to file alignment, which only 
> support\n\
>  the following align: 
> 1,2,4,8,16,128,512,1K,4K,32K,64K\n\
>  128K,256K,512K,1M,2M,4M,8M,16M\n");
>fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\
>  Section file will be contained in this FFS file.\n");
> +  fprintf (stdout, "  -oi SectionFile, --optionalsectionfile SectionFile\n\
> +If the Section file exists, it will be contained in 
> 

[edk2] [Patch] BaseTools: Fixed issue in MultiThread Genfds function

2019-03-29 Thread Feng, Bob C
https://bugzilla.tianocore.org/show_bug.cgi?id=1450
In the Multiple thread Genfds feature, build tool generates
GenSec, GenFFS command in Makefile.

The Non-Hii Driver does not generate .offset file for uni string offset,
but the build tool has not knowledge about this in autogen phase. So
in this patch, I add a check in Makefile for GenSec command. If the GenSec
input file does not exist, the GenSec will not be called. And if GenSec
command is not called, its output file, which is also the input file of 
GenFfs command, will also not exist.So for GenFfs command, 
I add a new command parameter -oi which means
the input file is an optional input file which would not exist. so
that I can generate GenFfs command with "-oi" parameter in Makefile.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Conf/build_rule.template  | 14 +++---
 BaseTools/Source/C/GenFfs/GenFfs.c  | 17 +++--
 BaseTools/Source/Python/AutoGen/GenMake.py  |  2 +-
 .../Python/GenFds/GenFdsGlobalVariable.py   | 10 +-
 .../Source/Python/Workspace/DscBuildData.py |  3 +++
 BaseTools/Source/Python/build/build.py  | 10 +-
 6 files changed, 40 insertions(+), 16 deletions(-)

diff --git a/BaseTools/Conf/build_rule.template 
b/BaseTools/Conf/build_rule.template
index e56b1d9c59..8cd7d0e445 100755
--- a/BaseTools/Conf/build_rule.template
+++ b/BaseTools/Conf/build_rule.template
@@ -357,16 +357,16 @@
 [Dynamic-Library-File]
 
 ?.dll
 
 
-$(DEBUG_DIR)(+)$(MODULE_NAME).efi
+$(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)(+)$(MODULE_NAME).efi
 
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 -$(CP) $(DEBUG_DIR)(+)*.pdb $(OUTPUT_DIR) 
 
 $(CP) ${src} $(DEBUG_DIR)(+)$(MODULE_NAME).debug
 $(OBJCOPY) --strip-unneeded -R .eh_frame ${src}
@@ -376,22 +376,22 @@
 #
 -$(OBJCOPY) $(OBJCOPY_ADDDEBUGFLAG) ${src}
 -$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).debug 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).debug
 
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} ${src} $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 
 # tool to convert Mach-O to PE/COFF
 "$(MTOC)" -subsystem $(MODULE_TYPE)  $(MTOC_FLAGS)  ${src}  
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff
 # create symbol file for GDB debug
 -$(DSYMUTIL) ${src}
 "$(GENFW)" -e $(MODULE_TYPE) -o ${dst} 
$(DEBUG_DIR)(+)$(MODULE_NAME).pecoff $(GENFW_FLAGS)
-$(CP) ${dst} $(OUTPUT_DIR)
-$(CP) ${dst} $(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi $(OUTPUT_DIR)
+$(CP) $(DEBUG_DIR)(+)$(MODULE_NAME).efi 
$(BIN_DIR)(+)$(MODULE_NAME_GUID).efi
 -$(CP) $(DEBUG_DIR)(+)*.map $(OUTPUT_DIR)
 
 [Dependency-Expression-File]
 
 ?.dxs, ?.Dxs, ?.DXS
diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c 
b/BaseTools/Source/C/GenFfs/GenFfs.c
index 02c7ac30f0..ea36b22bef 100644
--- a/BaseTools/Source/C/GenFfs/GenFfs.c
+++ b/BaseTools/Source/C/GenFfs/GenFfs.c
@@ -17,10 +17,14 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #endif
 
+#ifdef __GNUC__
+#include 
+#endif
+
 #include 
 #include 
 #include 
 
 #include 
@@ -158,10 +162,12 @@ Returns:
 FileAlign points to file alignment, which only 
support\n\
 the following align: 
1,2,4,8,16,128,512,1K,4K,32K,64K\n\
 128K,256K,512K,1M,2M,4M,8M,16M\n");
   fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\
 Section file will be contained in this FFS file.\n");
+  fprintf (stdout, "  -oi SectionFile, --optionalsectionfile SectionFile\n\
+If the Section file exists, it will be contained in 
this FFS file, otherwise, it will be ignored.\n");
   fprintf (stdout, "  -n SectionAlign, --sectionalign SectionAlign\n\
 SectionAlign points to section alignment, which 
support\n\
 the alignment scope 0~16M. If SectionAlign is 
specified\n\
 as 0, tool get alignment value from SectionFile. It 
is\n\
 specified together with sectionfile to point its\n\
@@ -734,19 +740,26 @@ Returns:
   argc -= 2;
   argv += 

Re: [edk2] [PATCH edk2-non-osi] Platform/DeveloperBox: add binary build of TF-A + standalone MM varstore

2019-03-29 Thread Ard Biesheuvel
On Fri, 29 Mar 2019 at 11:06, Leif Lindholm  wrote:
>
> On Fri, Mar 29, 2019 at 10:52:41AM +0100, Ard Biesheuvel wrote:
> > On Fri, 29 Mar 2019 at 09:57, Leif Lindholm  
> > wrote:
> > >
> > > On Fri, Mar 29, 2019 at 08:46:12AM +0100, Ard Biesheuvel wrote:
> > > > Provide a prebuilt binary of the standalone MM payload containing the
> > > > UEFI authenticated variable store drivers. These are built from EDK2
> > > > components, but the resulting image needs to be wrapped in a FIP
> > > > container and built into the secure world TF-A image.
> > > >
> > > > TF-A commit:   e86e202c2e4e
> > > > edk2 commit:   8028f0303218
> > > > edk2-platforms commit: 05fdad573966
> > > >
> > > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > > Signed-off-by: Ard Biesheuvel 
> > >
> > > Reviewed-by: Leif Lindholm 
> > >
> >
> > Turns out I need to respin this based on 0a32c15d2172 (just pushed
> > into edk2-platforms).
>
> Right. Well, the reviewed-by stands, as long as the hash gets updated.
>

Cheers. Pushed as 99907896565e..d04196e99696
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-non-osi] Platform/DeveloperBox: add binary build of TF-A + standalone MM varstore

2019-03-29 Thread Leif Lindholm
On Fri, Mar 29, 2019 at 10:52:41AM +0100, Ard Biesheuvel wrote:
> On Fri, 29 Mar 2019 at 09:57, Leif Lindholm  wrote:
> >
> > On Fri, Mar 29, 2019 at 08:46:12AM +0100, Ard Biesheuvel wrote:
> > > Provide a prebuilt binary of the standalone MM payload containing the
> > > UEFI authenticated variable store drivers. These are built from EDK2
> > > components, but the resulting image needs to be wrapped in a FIP
> > > container and built into the secure world TF-A image.
> > >
> > > TF-A commit:   e86e202c2e4e
> > > edk2 commit:   8028f0303218
> > > edk2-platforms commit: 05fdad573966
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> >
> > Reviewed-by: Leif Lindholm 
> >
> 
> Turns out I need to respin this based on 0a32c15d2172 (just pushed
> into edk2-platforms).

Right. Well, the reviewed-by stands, as long as the hash gets updated.

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


Re: [edk2] [PATCH edk2-non-osi] Platform/DeveloperBox: add binary build of TF-A + standalone MM varstore

2019-03-29 Thread Ard Biesheuvel
On Fri, 29 Mar 2019 at 09:57, Leif Lindholm  wrote:
>
> On Fri, Mar 29, 2019 at 08:46:12AM +0100, Ard Biesheuvel wrote:
> > Provide a prebuilt binary of the standalone MM payload containing the
> > UEFI authenticated variable store drivers. These are built from EDK2
> > components, but the resulting image needs to be wrapped in a FIP
> > container and built into the secure world TF-A image.
> >
> > TF-A commit:   e86e202c2e4e
> > edk2 commit:   8028f0303218
> > edk2-platforms commit: 05fdad573966
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
>
> Reviewed-by: Leif Lindholm 
>

Turns out I need to respin this based on 0a32c15d2172 (just pushed
into edk2-platforms).
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Socionext/DeveloperBox: align with upstream StandaloneMmPkg changes

2019-03-29 Thread Ard Biesheuvel
On Fri, 29 Mar 2019 at 09:56, Leif Lindholm  wrote:
>
> On Fri, Mar 29, 2019 at 08:32:31AM +0100, Ard Biesheuvel wrote:
> > On Fri, 8 Mar 2019 at 16:31, Ard Biesheuvel  
> > wrote:
> > >
> > > Bring DeveloperBox in line with EDK2 core changes to StandaloneMmPkg:
> > > - switch from BaseExtractGuidedSectionLib to PrePiExtractGuidedSectionLib
> > > - include a NULL library class resolution for VariableMmDependency
> > >
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Ard Biesheuvel 
> >
> > Leif,
> >
> > I'd like to merge this today if you don't have any objections.
>
> None - that was implied in
> https://lists.01.org/pipermail/edk2-devel/2019-March/038167.html
>
> (There wasn't a 0/2 to put a "for series" on.)
>

Ah, my bad

Pushed as 05fdad573966..0a32c15d2172
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Ni, Ray
Yes. With below "Cr2 !=0" removed from final commit, Reviewed-by: Ray Ni 

> > +RestoreCr2 (
> > +  UINTN  Cr2
> > +  )
> > +{
> > +  if ((!mCpuSmmStaticPageTable) && (Cr2 != 0)) {
> > +AsmWriteCr2 (Cr2);
> > +  }
> > +}

> -Original Message-
> From: Vanguput, Narendra K 
> Sent: Friday, March 29, 2019 5:32 PM
> To: Ni, Ray ; edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Dong, Eric ;
> Laszlo Ersek 
> Subject: RE: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-
> demand paging in SMM
> 
> Hi Ray,
> 
> While programming, I thought this cannot be 0 as in SDM, it says page-fault
> linear address.
> >> CR2 - Contains the page-fault linear address (the linear address that
> caused a page fault).
> 
> So added a check for 0.
> 
> Now as the function is changed like program into CR2 register based on input
> parameter and checking for 0 is up to caller of this function. And also we
> don't need to require for checking 0 means, will remove it. Please confirm.
> 
> Thanks,
> Naren
> 
> -Original Message-
> From: Ni, Ray
> Sent: Friday, March 29, 2019 10:40 AM
> To: Vanguput, Narendra K ; edk2-
> de...@lists.01.org
> Cc: Yao, Jiewen ; Dong, Eric ;
> Laszlo Ersek 
> Subject: RE: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-
> demand paging in SMM
> 
> > +  if ((!mCpuSmmStaticPageTable) && (Cr2 != 0)) {
> 
> Can the "Cr2 != 0" be removed?
> 
> > -Original Message-
> > From: edk2-devel  On Behalf Of
> > nkvangup
> > Sent: Friday, March 29, 2019 12:58 PM
> > To: edk2-devel@lists.01.org
> > Cc: Yao, Jiewen ; Dong, Eric
> > ; Laszlo Ersek 
> > Subject: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-
> > demand paging in SMM
> >
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593
> >
> > For every SMI occurrence, save and restore CR2 register only when SMM
> > on- demand paging support is enabled in 64 bit operation mode.
> > This is not a bug but to have better improvement of code.
> >
> > Patch5 is updated with separate functions for Save and Restore of CR2
> > based on review feedback.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Vanguput Narendra K 
> > Cc: Eric Dong 
> > Cc: Ray Ni 
> > Cc: Laszlo Ersek 
> > Cc: Yao Jiewen 
> > ---
> >  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26
> > ++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
> >  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22
> > ++
> >  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30
> > ++
> >  4 files changed, 84 insertions(+), 3 deletions(-)
> >
> > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> > b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> > index b734a1ea8c..af96e42982 100644
> > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> > @@ -316,3 +316,29 @@ SetPageTableAttributes (
> >
> >return ;
> >  }
> > +
> > +/**
> > +  This function returns with no action for 32 bit.
> > +
> > +  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
> > +**/ VOID
> > +SaveCr2 (
> > +  UINTN  *Cr2
> > +  )
> > +{
> > +  return ;
> > +}
> > +
> > +/**
> > +  This function returns with no action for 32 bit.
> > +
> > +  @param[in]  Cr2  Value to write into CR2 register **/ VOID
> > +RestoreCr2 (
> > +  UINTN  Cr2
> > +  )
> > +{
> > +  return ;
> > +}
> > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > index 3b0b3b52ac..ce70f77709 100644
> > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > @@ -1112,9 +1112,11 @@ SmiRendezvous (
> >ASSERT(CpuIndex < mMaxNumberOfCpus);
> >
> >//
> > -  // Save Cr2 because Page Fault exception in SMM may override its
> > value
> > +  // Save Cr2 because Page Fault exception in SMM may override its
> > + value,  // when using on-demand paging for above 4G memory.
> >//
> > -  Cr2 = AsmReadCr2 ();
> > +  Cr2 = 0;
> > +  SaveCr2 ();
> >
> >//
> >// Perform CPU specific entry hooks @@ -1253,10 +1255,11 @@
> > SmiRendezvous (
> >
> >  Exit:
> >SmmCpuFeaturesRendezvousExit (CpuIndex);
> > +
> >//
> >// Restore Cr2
> >//
> > -  AsmWriteCr2 (Cr2);
> > +  RestoreCr2 (Cr2);
> >  }
> >
> >  /**
> > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> > b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> > index 84efb22981..c9d147c8a1 100644
> > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> > @@ -1243,4 +1243,26 @@ EFIAPI
> >  PiSmmCpuSmiEntryFixupAddress (
> >   );
> >
> > +/**
> > +  This function reads CR2 register when on-demand paging is enabled
> > +  for 64 bit and no action for 32 bit.
> > +
> > +  @param[in]  *Cr2  Pointer to variable to hold CR2 register value
> > +**/ VOID
> > +SaveCr2 (
> > +  UINTN  *Cr2
> > +  );
> > +
> > +/**
> > +  This function writes into CR2 register when 

Re: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand paging in SMM

2019-03-29 Thread Vanguput, Narendra K
Hi Ray,

While programming, I thought this cannot be 0 as in SDM, it says page-fault 
linear address.
>> CR2 - Contains the page-fault linear address (the linear address that caused 
>> a page fault).

So added a check for 0.

Now as the function is changed like program into CR2 register based on input 
parameter and checking for 0 is up to caller of this function. And also we 
don't need to require for checking 0 means, will remove it. Please confirm.

Thanks,
Naren

-Original Message-
From: Ni, Ray 
Sent: Friday, March 29, 2019 10:40 AM
To: Vanguput, Narendra K ; 
edk2-devel@lists.01.org
Cc: Yao, Jiewen ; Dong, Eric ; 
Laszlo Ersek 
Subject: RE: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on-demand 
paging in SMM

> +  if ((!mCpuSmmStaticPageTable) && (Cr2 != 0)) {

Can the "Cr2 != 0" be removed? 

> -Original Message-
> From: edk2-devel  On Behalf Of 
> nkvangup
> Sent: Friday, March 29, 2019 12:58 PM
> To: edk2-devel@lists.01.org
> Cc: Yao, Jiewen ; Dong, Eric 
> ; Laszlo Ersek 
> Subject: [edk2] [PATCH v6] UefiCpuPkg\CpuSmm: Save & restore CR2 on- 
> demand paging in SMM
> 
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1593
> 
> For every SMI occurrence, save and restore CR2 register only when SMM 
> on- demand paging support is enabled in 64 bit operation mode.
> This is not a bug but to have better improvement of code.
> 
> Patch5 is updated with separate functions for Save and Restore of CR2 
> based on review feedback.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Vanguput Narendra K 
> Cc: Eric Dong 
> Cc: Ray Ni 
> Cc: Laszlo Ersek 
> Cc: Yao Jiewen 
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c   | 26
> ++
>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c  |  9 ++---
>  UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h | 22
> ++
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c| 30
> ++
>  4 files changed, 84 insertions(+), 3 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index b734a1ea8c..af96e42982 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -316,3 +316,29 @@ SetPageTableAttributes (
> 
>return ;
>  }
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[in]  *Cr2  Pointer to variable to hold CR2 register value 
> +**/ VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  )
> +{
> +  return ;
> +}
> +
> +/**
> +  This function returns with no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register **/ VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  )
> +{
> +  return ;
> +}
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 3b0b3b52ac..ce70f77709 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1112,9 +1112,11 @@ SmiRendezvous (
>ASSERT(CpuIndex < mMaxNumberOfCpus);
> 
>//
> -  // Save Cr2 because Page Fault exception in SMM may override its 
> value
> +  // Save Cr2 because Page Fault exception in SMM may override its 
> + value,  // when using on-demand paging for above 4G memory.
>//
> -  Cr2 = AsmReadCr2 ();
> +  Cr2 = 0;
> +  SaveCr2 ();
> 
>//
>// Perform CPU specific entry hooks @@ -1253,10 +1255,11 @@ 
> SmiRendezvous (
> 
>  Exit:
>SmmCpuFeaturesRendezvousExit (CpuIndex);
> +
>//
>// Restore Cr2
>//
> -  AsmWriteCr2 (Cr2);
> +  RestoreCr2 (Cr2);
>  }
> 
>  /**
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> index 84efb22981..c9d147c8a1 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.h
> @@ -1243,4 +1243,26 @@ EFIAPI
>  PiSmmCpuSmiEntryFixupAddress (
>   );
> 
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[in]  *Cr2  Pointer to variable to hold CR2 register value 
> +**/ VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  );
> +
> +/**
> +  This function writes into CR2 register when on-demand paging is 
> +enabled
> +  for 64 bit and no action for 32 bit.
> +
> +  @param[in]  Cr2  Value to write into CR2 register **/ VOID
> +RestoreCr2 (
> +  UINTN  Cr2
> +  );
> +
>  #endif
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 2c77cb47a4..6cb44fbbe5 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -1053,3 +1053,33 @@ SetPageTableAttributes (
> 
>return ;
>  }
> +
> +/**
> +  This function reads CR2 register when on-demand paging is enabled
> +
> +  @param[in]  *Cr2  Pointer to variable to hold CR2 register value 
> +**/ VOID
> +SaveCr2 (
> +  UINTN  *Cr2
> +  )
> +{
> +  if (!mCpuSmmStaticPageTable) {
> +*Cr2 = AsmReadCr2 ();
> +  }
> 

Re: [edk2] [edk2-test][PATCH v1 30/30] UEFI/UEFI.dec: Add missing protocol GUIDs in declaration file.

2019-03-29 Thread Jin, Eric
Hi Supreeth,

Thanks a lot to fix this build issue at first.
Comments for this series of patches are replied below.

Patch 1/2 : 
1. Could the two patches can be re-organized? For example, merge the change of 
*.dsc in patch 2 to patch 1 to make it clear.
2. The change of CommonGenFramework.sh in patch 2 will remove the ebc from 
binary package. 
 
Patch 24 : 
1. Please don't forget change the copyright part
2. Do you meet the similar issue that "UEFI_CONFIG_LANG" : macro redefinition 
while build?

Other Patches :
1. Please remove "COMPONENT_TYPE   = BS_DRIVER"

With that
Reviewed-by: Eric Jin 

Best Regards
Eric

-Original Message-
From: Supreeth Venkatesh  
Sent: Friday, March 29, 2019 7:12 AM
To: edk2-devel@lists.01.org
Cc: Supreeth Venkatesh ; Jin, Eric 

Subject: [edk2-test][PATCH v1 30/30] UEFI/UEFI.dec: Add missing protocol GUIDs 
in declaration file.

Fix compilation issues in inf files when compiled against edk2 stable tag 
edk2-stable201903.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Supreeth Venkatesh 
---
 uefi-sct/SctPkg/UEFI/UEFI.dec | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/uefi-sct/SctPkg/UEFI/UEFI.dec b/uefi-sct/SctPkg/UEFI/UEFI.dec 
index 8495a4e1..bdf3323f 100644
--- a/uefi-sct/SctPkg/UEFI/UEFI.dec
+++ b/uefi-sct/SctPkg/UEFI/UEFI.dec
@@ -1,7 +1,7 @@
 ## @file
 #
 #  Copyright 2004 - 2017 Unified EFI, Inc. -#  Copyright (c) 2014 - 2018, 
ARM Limited. All rights reserved.
+#  Copyright (c) 2014 - 2019, ARM Limited. All rights reserved.
 #  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.  #  
(C) Copyright 2017 Hewlett Packard Enterprise Development LP  # @@ -119,14 
+119,22 @@
   gBlackBoxEfiHIIStringProtocolGuid = {0xfd96974, 0x23aa, 0x4cdc, { 0xb9, 
0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a }}
   gBlackBoxEfiHIIImageProtocolGuid = { 0x31a6406a, 0x6bdf, 0x4e46, {0xb2, 
0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 }}
   gBlackBoxEfiHIIImageExProtocolGuid = { 0x1a1241e6, 0x8f19, 0x41a9, { 0xbc, 
0xe, 0xe8, 0xef,0x39, 0xe0, 0x65, 0x46 }}
+  gBlackBoxEfiHIIDatabaseProtocolGuid = { 0xef9fc172, 0xa1b2, 0x4693, { 
+ 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 }}  
+ gBlackBoxEfiHIIPackageListProtocolGuid = { 0x6a1ee763, 0xd47a, 0x43b4, 
+ { 0xaa, 0xbe, 0xef, 0x1d, 0xe2, 0xab, 0x56, 0xfc }}  
+ gBlackBoxEfiHIIStringProtocolGuid = {0xfd96974, 0x23aa, 0x4cdc, { 
+ 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a }}  
+ gBlackBoxEfiHIIConfigAccessProtocolGuid = { 0x330d4706, 0xf2a0, 
+ 0x4e4f, { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 }}  
+ gBlackBoxEfiHIIConfigRoutingProtocolGuid = { 0x587e72d7, 0xcc50, 
+ 0x4f79, { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f }}
   gBlackBoxEfiHIIFontProtocolGuid = { 0xe9ca4775, 0x8657, 0x47fc, { 0x97, 
0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 }}
   gBlackBoxEfiHIIFontExProtocolGuid = { 0x849e6875, 0xdb35, 0x4df8, { 0xb4, 
0x1e, 0xc8, 0xf3, 0x37, 0x18, 0x7, 0x3f }}
   gBlackBoxEfiHttpProtocolGuid = { 0x7A59B29B, 0x910B, 0x4171, { 0x82, 0x42, 
0xA8, 0x5A, 0x0D, 0xF2, 0x5B, 0x5B }}
   gBlackBoxEfiHttpServiceBindingProtocolGuid = { 0xbdc8e6af, 0xd9bc, 0x4379, { 
0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c }}
   gBlackBoxEfiIp4ServiceBindingProtocolGuid = { 0xc51711e7, 0xb4bf, 0x404a, 
{0xbf, 0xb8, 0x0a, 0x04, 0x8e, 0xf1, 0xff, 0xe4 } }
   gBlackBoxEfiIp4ProtocolGuid = { 0x41d94cd2, 0x35b6, 0x455a, {0x82, 0x58, 
0xd4, 0xe5, 0x13, 0x34, 0xaa, 0xdd } }
+  gBlackBoxEfiIp4ConfigProtocolGuid = { 0x3B95AA31, 0x3793, 0x434B, 
+ {0x86, 0x67, 0xC8, 0x07, 0x08, 0x92, 0xE0, 0x5E } }  
+ gBlackBoxEfiIp4Config2ProtocolGuid = { 0x5b446ed1, 0xe30b, 0x4faa, 
+ {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } }
   gBlackBoxEfiIp6ServiceBindingProtocolGuid = { 0xec835dd3, 0xfe0f, 0x617b, 
{0xa6, 0x21, 0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 } }
   gBlackBoxEfiIp6ProtocolGuid = { 0xec835dd3, 0xfe0f, 0x617b, {0xa6, 0x21, 
0xb3, 0x50, 0xc3, 0xe1, 0x33, 0x88 } }
+  gBlackBoxEfiIp6ConfigProtocolGuid = { 0x937fe521, 0x95ae, 0x4d1a, 
+ {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a } }
   gBlackBoxEfiIPsec2ProtocolGuid = {0xa3979e64, 0xace8, 0x4ddc, { 0xbc, 0x7, 
0x4d, 0x66, 0xb8, 0xfd, 0x9, 0x77 }}
   gBlackBoxEfiIPsecConfigProtocolGuid = { 0xce5e5929, 0xc7a3, 0x4602, { 0xad, 
0x9e, 0xc9, 0xda, 0xf9, 0x4e, 0xbf, 0xcf }}
   gBlackBoxEfiIScsiInitiatorNameProtocolGuid = { 0x59324945, 0xec44, 0x4c0d, 
{0xb1, 0xcd, 0x9d, 0xb1, 0x39, 0xdf, 0x7, 0xc }}
--
2.17.1

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


Re: [edk2] [PATCH edk2-non-osi] Platform/DeveloperBox: add binary build of TF-A + standalone MM varstore

2019-03-29 Thread Leif Lindholm
On Fri, Mar 29, 2019 at 08:46:12AM +0100, Ard Biesheuvel wrote:
> Provide a prebuilt binary of the standalone MM payload containing the
> UEFI authenticated variable store drivers. These are built from EDK2
> components, but the resulting image needs to be wrapped in a FIP
> container and built into the secure world TF-A image.
> 
> TF-A commit:   e86e202c2e4e
> edk2 commit:   8028f0303218
> edk2-platforms commit: 05fdad573966
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Reviewed-by: Leif Lindholm 

> ---
>  Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin | Bin 0 -> 374776 bytes
>  1 file changed, 0 insertions(+), 0 deletions(-)
> 
> diff --git a/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin 
> b/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin
> new file mode 100644
> index ..eaae94874d4d
> Binary files /dev/null and 
> b/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin differ
> -- 
> 2.20.1
> 
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Socionext/DeveloperBox: align with upstream StandaloneMmPkg changes

2019-03-29 Thread Leif Lindholm
On Fri, Mar 29, 2019 at 08:32:31AM +0100, Ard Biesheuvel wrote:
> On Fri, 8 Mar 2019 at 16:31, Ard Biesheuvel  wrote:
> >
> > Bring DeveloperBox in line with EDK2 core changes to StandaloneMmPkg:
> > - switch from BaseExtractGuidedSectionLib to PrePiExtractGuidedSectionLib
> > - include a NULL library class resolution for VariableMmDependency
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ard Biesheuvel 
> 
> Leif,
> 
> I'd like to merge this today if you don't have any objections.

None - that was implied in
https://lists.01.org/pipermail/edk2-devel/2019-March/038167.html

(There wasn't a 0/2 to put a "for series" on.)

/
Leif

> > ---
> >  Platform/Socionext/DeveloperBox/DeveloperBox.dsc   | 5 -
> >  Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc | 7 +++
> >  2 files changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> > b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > index 31afc4aac3c4..39077ab5ee79 100644
> > --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> > @@ -293,7 +293,10 @@
> >VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> >}
> >  !else
> > -  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
> > +  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf {
> > +
> > +  
> > NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
> > +  }
> >MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
> >
> > SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
> >  !endif
> > diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc 
> > b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> > index 55c5fbb7350d..141b175047b2 100644
> > --- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> > +++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> > @@ -68,9 +68,6 @@
> >  [PcdsFixedAtBuild]
> >gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x5104
> >
> > -[PcdsPatchableInModule]
> > -  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x0
> > -
> >  
> > 
> >  #
> >  # Components Section - list of all EDK II Modules needed by this Platform
> > @@ -82,8 +79,10 @@
> >#
> >StandaloneMmPkg/Core/StandaloneMmCore.inf {
> >  
> > -  
> > ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
> > +  
> > ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
> >
> > NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> > +
> > +  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2
> >}
> >
> >StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> > --
> > 2.20.1
> >
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] UefiCpuPkg/Cpuid: Dump leaf 1FH information correctly

2019-03-29 Thread Ray Ni
Leaf 1FH is very similar to leaf 0BH. Both return the CPU topology
information.
Leaf 0BH returns 3-level (Package/Core/Thread) CPU topology info.
Leaf 1FH returns 6-level (Package/Die/Tile/Module/Core/Thread) CPU
topology info.
The logic to enumerate the topology info is the same.

But today's logic to handle 1FH is completely wrong.
The patch combines them together to fix the 1FH issue.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ray Ni 
Cc: Eric Dong 
---
 UefiCpuPkg/Application/Cpuid/Cpuid.c | 83 ++--
 1 file changed, 28 insertions(+), 55 deletions(-)

diff --git a/UefiCpuPkg/Application/Cpuid/Cpuid.c 
b/UefiCpuPkg/Application/Cpuid/Cpuid.c
index 67cacf2714..3d242a0cbf 100644
--- a/UefiCpuPkg/Application/Cpuid/Cpuid.c
+++ b/UefiCpuPkg/Application/Cpuid/Cpuid.c
@@ -1,7 +1,7 @@
 /** @file
   UEFI Application to display CPUID leaf information.
 
-  Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2016 - 2019, 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
@@ -717,36 +717,42 @@ CpuidArchitecturalPerformanceMonitoring (
 **/
 VOID
 CpuidExtendedTopology (
-  VOID
+  UINT32   LeafFunction
   )
 {
-  CPUID_EXTENDED_TOPOLOGY_EAX  Eax;
-  CPUID_EXTENDED_TOPOLOGY_EBX  Ebx;
-  CPUID_EXTENDED_TOPOLOGY_ECX  Ecx;
-  UINT32   Edx;
-  UINT32   LevelNumber;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX  Eax;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX  Ebx;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX  Ecx;
+  UINT32  Edx;
+  UINT32  LevelNumber;
 
-  if (CPUID_EXTENDED_TOPOLOGY > gMaximumBasicFunction) {
+  if (LeafFunction > gMaximumBasicFunction) {
+return;
+  }
+  if ((LeafFunction != CPUID_EXTENDED_TOPOLOGY) && (LeafFunction != 
CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION)) {
 return;
   }
 
   LevelNumber = 0;
-  do {
+  for (LevelNumber = 0; ; LevelNumber++) {
 AsmCpuidEx (
-  CPUID_EXTENDED_TOPOLOGY, LevelNumber,
+  LeafFunction, LevelNumber,
   , , , 
   );
-if (Eax.Bits.ApicIdShift != 0) {
-  Print (L"CPUID_EXTENDED_TOPOLOGY (Leaf %08x, Sub-Leaf %08x)\n", 
CPUID_EXTENDED_TOPOLOGY, LevelNumber);
-  Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, 
Ebx.Uint32, Ecx.Uint32, Edx);
-  PRINT_BIT_FIELD (Eax, ApicIdShift);
-  PRINT_BIT_FIELD (Ebx, LogicalProcessors);
-  PRINT_BIT_FIELD (Ecx, LevelNumber);
-  PRINT_BIT_FIELD (Ecx, LevelType);
-  PRINT_VALUE (Edx, x2APIC_ID);
+if (Ecx.Bits.LevelType == 
CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_INVALID) {
+  break;
 }
-LevelNumber++;
-  } while (Eax.Bits.ApicIdShift != 0);
+Print (
+  L"%a (Leaf %08x, Sub-Leaf %08x)\n",
+  LeafFunction == CPUID_EXTENDED_TOPOLOGY ? "CPUID_EXTENDED_TOPOLOGY" : 
"CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION-2",
+  LeafFunction, LevelNumber);
+Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, 
Ebx.Uint32, Ecx.Uint32, Edx);
+PRINT_BIT_FIELD (Eax, BitsNum);
+PRINT_BIT_FIELD (Ebx, ProcessorsNum);
+PRINT_BIT_FIELD (Ecx, LevelNum);
+PRINT_BIT_FIELD (Ecx, LevelType);
+PRINT_VALUE (Edx, x2APIC_ID);
+  }
 }
 
 /**
@@ -1385,39 +1391,6 @@ CpuidDeterministicAddressTranslationParameters (
   PRINT_BIT_FIELD (Edx, MaximumNum);
 }
 
-/**
-  Display CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION main leaf and sub-leafs.
-
-**/
-VOID
-CpuidV2ExtendedTopologyEnumeration (
-  VOID
-  )
-{
-  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX  Eax;
-  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EBX  Ebx;
-  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX  Ecx;
-  UINT32  Edx;
-
-  if (CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION > gMaximumBasicFunction) {
-return;
-  }
-
-  AsmCpuidEx (
-CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION,
-CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF,
-, , , 
-);
-  Print (L"CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION (Leaf %08x, Sub-Leaf 
%08x)\n", CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION, 
CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_MAIN_LEAF);
-  Print (L"  EAX:%08x  EBX:%08x  ECX:%08x  EDX:%08x\n", Eax.Uint32, 
Ebx.Uint32, Ecx.Uint32, Edx);
-
-  PRINT_BIT_FIELD (Eax, BitsNum);
-  PRINT_BIT_FIELD (Ebx, ProcessorsNum);
-  PRINT_BIT_FIELD (Ecx, LevelNum);
-  PRINT_BIT_FIELD (Ecx, LevelType);
-  PRINT_VALUE (Edx, x2APICID);
-}
-
 /**
   Display CPUID_EXTENDED_FUNCTION leaf.
 
@@ -1619,7 +1592,7 @@ UefiMain (
   CpuidStructuredExtendedFeatureFlags ();
   CpuidDirectCacheAccessInfo();
   CpuidArchitecturalPerformanceMonitoring ();
-  CpuidExtendedTopology ();
+  CpuidExtendedTopology (CPUID_EXTENDED_TOPOLOGY);
   CpuidExtendedStateMainLeaf 

Re: [edk2] [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch

2019-03-29 Thread Wang, Jian J



Reviewed-by: Jian J Wang 


> -Original Message-
> From: Zhang, Shenglei
> Sent: Friday, March 29, 2019 3:31 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Gang Wei ; Wang, Jian
> J 
> Subject: [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 
> arch
> 
> .nasm file has been added for X86 arch. .S assembly code
> is not required any more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
> 
> Cc: Ting Ye 
> Cc: Gang Wei 
> Cc: Jian Wang 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -
>  .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 ---
>  .../Library/IntrinsicLib/IntrinsicLib.inf |  2 -
>  3 files changed, 130 deletions(-)
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> 
> diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> deleted file mode 100644
> index 7031a59a71..00
> --- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -#--
> -#
> -# Copyright (c) 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.
> -#
> -# Module Name:
> -#
> -#   MathLShiftS64.S
> -#
> -# Abstract:
> -#
> -#   64-bit Math Worker Function.
> -#   Shifts a 64-bit signed value left by a certain number of bits.
> -#
> -#--
> -
> -.686:
> -.code:
> -
> -ASM_GLOBAL ASM_PFX(__ashldi3)
> -
> -#--
> -#
> -# void __cdecl __ashldi3 (void)
> -#
> -#--
> -ASM_PFX(__ashldi3):
> -#
> -# Handle shifting of 64 or more bits (return 0)
> -#
> -cmpb$64, %cl
> -jae ReturnZero
> -
> -#
> -# Handle shifting of between 0 and 31 bits
> -#
> -cmpb$32, %cl
> -jae More32
> -shld%cl, %eax, %edx
> -shl %cl, %eax
> -ret
> -
> -#
> -# Handle shifting of between 32 and 63 bits
> -#
> -More32:
> -movl%eax, %edx
> -xor %eax, %eax
> -and $31, %cl
> -shl %cl, %edx
> -ret
> -
> -ReturnZero:
> -xor %eax, %eax
> -xor %edx, %edx
> -ret
> diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> deleted file mode 100644
> index 24142b088e..00
> --- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -#--
> -#
> -# Copyright (c) 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.
> -#
> -# Module Name:
> -#
> -#   MathRShiftU64.S
> -#
> -# Abstract:
> -#
> -#   64-bit Math Worker Function.
> -#   Shifts a 64-bit unsigned value right by a certain number of bits.
> -#
> -#--
> -
> -
> -.686:
> -.code:
> -
> -ASM_GLOBAL ASM_PFX(__ashrdi3)
> -
> -#--
> -#
> -# void __cdecl __ashrdi3 (void)
> -#
> -#--
> -ASM_PFX(__ashrdi3):
> -#
> -# Checking: Only handle 64bit shifting or more
> -#
> -cmpb$64, %cl
> -jae _Exit
> -
> -#
> -# Handle shifting between 0 and 31 bits
> -#
> -cmpb$32, %cl
> -jae More32
> -shrd%cl, %edx, %eax
> -shr %cl, %edx
> -ret
> -
> -#
> -# Handle shifting of 32-63 bits
> -#
> -More32:
> -movl%edx, %eax
> -xor %edx, %edx
> -and $31, %cl
> -shr %cl, %eax
> -ret
> -
> -#
> -# Invalid number (less 

Re: [edk2] [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch

2019-03-29 Thread Wang, Jian J
Reviewed-by: Jian J Wang 

> -Original Message-
> From: Zhang, Shenglei
> Sent: Friday, March 29, 2019 3:32 PM
> To: edk2-devel@lists.01.org
> Cc: Ye, Ting ; Wang, Jian J 
> Subject: [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 
> arch
> 
> .nasm file has been added for X86 arch. .S assembly code
> is not required any more.
> https://bugzilla.tianocore.org/show_bug.cgi?id=1594
> 
> Cc: Ting Ye 
> Cc: Jian Wang 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -
>  .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 ---
>  .../Library/IntrinsicLib/IntrinsicLib.inf |  2 -
>  3 files changed, 130 deletions(-)
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
>  delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> 
> diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> deleted file mode 100644
> index 7031a59a71..00
> --- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
> +++ /dev/null
> @@ -1,62 +0,0 @@
> -#--
> -#
> -# Copyright (c) 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.
> -#
> -# Module Name:
> -#
> -#   MathLShiftS64.S
> -#
> -# Abstract:
> -#
> -#   64-bit Math Worker Function.
> -#   Shifts a 64-bit signed value left by a certain number of bits.
> -#
> -#--
> -
> -.686:
> -.code:
> -
> -ASM_GLOBAL ASM_PFX(__ashldi3)
> -
> -#--
> -#
> -# void __cdecl __ashldi3 (void)
> -#
> -#--
> -ASM_PFX(__ashldi3):
> -#
> -# Handle shifting of 64 or more bits (return 0)
> -#
> -cmpb$64, %cl
> -jae ReturnZero
> -
> -#
> -# Handle shifting of between 0 and 31 bits
> -#
> -cmpb$32, %cl
> -jae More32
> -shld%cl, %eax, %edx
> -shl %cl, %eax
> -ret
> -
> -#
> -# Handle shifting of between 32 and 63 bits
> -#
> -More32:
> -movl%eax, %edx
> -xor %eax, %eax
> -and $31, %cl
> -shl %cl, %edx
> -ret
> -
> -ReturnZero:
> -xor %eax, %eax
> -xor %edx, %edx
> -ret
> diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> deleted file mode 100644
> index 24142b088e..00
> --- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -#--
> -#
> -# Copyright (c) 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.
> -#
> -# Module Name:
> -#
> -#   MathRShiftU64.S
> -#
> -# Abstract:
> -#
> -#   64-bit Math Worker Function.
> -#   Shifts a 64-bit unsigned value right by a certain number of bits.
> -#
> -#--
> -
> -
> -.686:
> -.code:
> -
> -ASM_GLOBAL ASM_PFX(__ashrdi3)
> -
> -#--
> -#
> -# void __cdecl __ashrdi3 (void)
> -#
> -#--
> -ASM_PFX(__ashrdi3):
> -#
> -# Checking: Only handle 64bit shifting or more
> -#
> -cmpb$64, %cl
> -jae _Exit
> -
> -#
> -# Handle shifting between 0 and 31 bits
> -#
> -cmpb$32, %cl
> -jae More32
> -shrd%cl, %edx, %eax
> -shr %cl, %edx
> -ret
> -
> -#
> -# Handle shifting of 32-63 bits
> -#
> -More32:
> -movl%edx, %eax
> -xor %edx, %edx
> -and $31, %cl
> -shr %cl, %eax
> -ret
> -
> -#
> -# Invalid number (less then 32bits), return 0
> -#
> 

[edk2] [PATCH] UefiCpuPkg/LocalApicLib: Add GetProcessorLocation2ByApicId() API

2019-03-29 Thread Ray Ni
GetProcessorLocation2ByApicId() extracts the
package/die/tile/module/core/thread ID from the initial APIC ID.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ray Ni 
Cc: Eric Dong 
---
 UefiCpuPkg/Include/Library/LocalApicLib.h |  29 +++-
 .../Library/BaseXApicLib/BaseXApicLib.c   | 125 +-
 .../BaseXApicX2ApicLib/BaseXApicX2ApicLib.c   | 125 +-
 3 files changed, 276 insertions(+), 3 deletions(-)

diff --git a/UefiCpuPkg/Include/Library/LocalApicLib.h 
b/UefiCpuPkg/Include/Library/LocalApicLib.h
index ad1c26df60..ffe60c56fc 100644
--- a/UefiCpuPkg/Include/Library/LocalApicLib.h
+++ b/UefiCpuPkg/Include/Library/LocalApicLib.h
@@ -4,7 +4,7 @@
   Local APIC library assumes local APIC is enabled. It does not
   handles cases where local APIC is disabled.
 
-  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2019, 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
@@ -432,5 +432,32 @@ GetProcessorLocationByApicId (
   OUT UINT32  *Thread  OPTIONAL
   );
 
+/**
+  Get Package ID/Module ID/Tile ID/Die ID/Core ID/Thread ID of a processor.
+
+  The algorithm assumes the target system has symmetry across physical
+  package boundaries with respect to the number of threads per core, number of
+  cores per module, number of modules per tile, number of tiles per die, number
+  of dies per package.
+
+  @param[in]   InitialApicId Initial APIC ID of the target logical processor.
+  @param[out]  Package   Returns the processor package ID.
+  @param[out]  Die   Returns the processor die ID.
+  @param[out]  Tile  Returns the processor tile ID.
+  @param[out]  ModuleReturns the processor module ID.
+  @param[out]  Core  Returns the processor core ID.
+  @param[out]  ThreadReturns the processor thread ID.
+**/
+VOID
+EFIAPI
+GetProcessorLocation2ByApicId (
+  IN  UINT32  InitialApicId,
+  OUT UINT32  *Package  OPTIONAL,
+  OUT UINT32  *Die  OPTIONAL,
+  OUT UINT32  *Tile OPTIONAL,
+  OUT UINT32  *Module   OPTIONAL,
+  OUT UINT32  *Core OPTIONAL,
+  OUT UINT32  *Thread   OPTIONAL
+  );
 #endif
 
diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index 7d66d89dfd..1f994c81cf 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -3,7 +3,7 @@
 
   This local APIC library instance supports xAPIC mode only.
 
-  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials
@@ -1156,3 +1156,126 @@ GetProcessorLocationByApicId (
 *Package = (InitialApicId >> (ThreadBits + CoreBits));
   }
 }
+
+/**
+  Get Package ID/Die ID/Tile ID/Module ID/Core ID/Thread ID of a processor.
+
+  The algorithm assumes the target system has symmetry across physical
+  package boundaries with respect to the number of threads per core, number of
+  cores per module, number of modules per tile, number of tiles per die, number
+  of dies per package.
+
+  @param[in]   InitialApicId Initial APIC ID of the target logical processor.
+  @param[out]  Package   Returns the processor package ID.
+  @param[out]  Die   Returns the processor die ID.
+  @param[out]  Tile  Returns the processor tile ID.
+  @param[out]  ModuleReturns the processor module ID.
+  @param[out]  Core  Returns the processor core ID.
+  @param[out]  ThreadReturns the processor thread ID.
+**/
+VOID
+EFIAPI
+GetProcessorLocation2ByApicId (
+  IN  UINT32  InitialApicId,
+  OUT UINT32  *Package  OPTIONAL,
+  OUT UINT32  *Die  OPTIONAL,
+  OUT UINT32  *Tile OPTIONAL,
+  OUT UINT32  *Module   OPTIONAL,
+  OUT UINT32  *Core OPTIONAL,
+  OUT UINT32  *Thread   OPTIONAL
+  )
+{
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_EAX V2ExtendedTopologyEax;
+  CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_ECX V2ExtendedTopologyEcx;
+  UINT32 MaxStandardCpuIdIndex;
+  UINT32 Index;
+  UINTN  LevelType;
+  UINT32 
Bits[CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_DIE + 2];
+  UINT32 
*Location[CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION_LEVEL_TYPE_DIE + 2];
+
+  for (LevelType = 0; LevelType < ARRAY_SIZE (Bits); LevelType++) {
+Bits[LevelType] = 0;
+  }
+
+  //
+  // Get max index of CPUID
+  //
+  AsmCpuid (CPUID_SIGNATURE, , NULL, NULL, NULL);
+  if (MaxStandardCpuIdIndex < CPUID_V2_EXTENDED_TOPOLOGY_ENUMERATION) {
+if 

Re: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending detection by GenBin tool

2019-03-29 Thread Jin, Eric
Hi Supreeth,

This patch can't be applied to the lasted code base SHA-1: 33022e. 
One patch from  may already fix the issue. Please check again.

Best Regards
Eric

-Original Message-
From: edk2-devel  On Behalf Of Supreeth 
Venkatesh
Sent: Friday, March 29, 2019 7:08 AM
To: supreeth.venkat...@arm.com; edk2-devel@lists.01.org
Subject: [edk2] [edk2-test][PATCH v2] SctPkg/Tools: Fix incorrect line ending 
detection by GenBin tool

From: Lokesh B V 

Some windows editors uses "\r\n" for line feed. While processing uefi sct 
testcase info file, the GenBin tool logic to skip line feed doesn't consider 
the presence of carraige return(\r) in line feed. So this results in incorrect 
format error.

Fixed this issue by changing logic of Trim and Getline functions used in GenBin 
source code.

Cc: Supreeth Venkatesh 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Lokesh B V 
---
Changes since v1:
* Adopted changes suggested by Supreeth.
* modified Copyright content

 uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c | 58 +---
 1 file changed, 26 insertions(+), 32 deletions(-)

diff --git a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c 
b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
index 61bb35b..6d8e844 100644
--- a/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
+++ b/uefi-sct/SctPkg/Tools/Source/GenBin/GenBin.c
@@ -2,6 +2,7 @@
 
   Copyright 2006 - 2010 Unified EFI, Inc.
   Copyright (c) 2010 Intel Corporation. All rights reserved.
+  Copyright (c) 2018 ARM Ltd. All rights reserved.
 
   This program and the accompanying materials
   are licensed and made available under the terms and conditions of the BSD 
License @@ -32,6 +33,7 @@ Abstract:
 #include 
 #include 
 #include 
+#include 
 
 //
 // Definitions
@@ -49,7 +51,7 @@ PrintUsage (
   void
   );
 
-void
+char *
 Trim (
   char*String
   );
@@ -159,50 +161,42 @@ PrintUsage (
 }
 
 
-void
+char *
 Trim (
   char*String
   )
 {
-  int   Index1;
-  int   Index2;
   int   Length;
+  char  *end;
 
   Length = strlen (String);
 
-  //
-  // Remove the space characters from the beginning of this string
-  //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Index1] != ' ' ) &&
-(String[Index1] != '\t') &&
-(String[Index1] != '\n')) {
-  break;
-}
-  }
-
-  for (Index2 = Index1; Index2 < Length; Index2++) {
-String[Index2 - Index1] = String[Index2];
+  if (!Length) {
+return String;
   }
 
-  Length = Length - Index1;
+  end = String + Length - 1;
 
   //
   // Remove the space characters from the end of this string
   //
-  for (Index1 = 0; Index1 < Length; Index1++) {
-if ((String[Length - 1 - Index1] != ' ' ) &&
-(String[Length - 1 - Index1] != '\t') &&
-(String[Length - 1 - Index1] != '\n')) {
-  break;
-}
+  while (end >= String && isspace (*end)) {
+end--;
   }
 
-  String[Length - Index1] = '\0';
+  *(end + 1) = '\0';
+
+  //
+  // Remove the space characters from the beginning of this string  //  
+ while (*String && isspace (*String)) {
+String++;
+  }
 
   //
   // Done
   //
+  return String;
 }
 
 
@@ -227,20 +221,20 @@ GetLine (
   return -1;
 }
 
-(*LineNo)++;
-
 //
 // Remove the beginning and ending space characters
 //
-Trim (String);
+String = Trim (Result);
 
 //
-// Ignore the empty line and comment line
+// Skip the empty line and comment line
 //
-if ((String[0] != '\0') &&
-(String[0] != '#' )) {
-  break;
+if ((String[0] == '\0') ||
+(String[0] == '#' )) {
+  continue;
 }
+
+(*LineNo)++;
   }
 
   //
--
2.7.4


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


[edk2] [PATCH edk2-non-osi] Platform/DeveloperBox: add binary build of TF-A + standalone MM varstore

2019-03-29 Thread Ard Biesheuvel
Provide a prebuilt binary of the standalone MM payload containing the
UEFI authenticated variable store drivers. These are built from EDK2
components, but the resulting image needs to be wrapped in a FIP
container and built into the secure world TF-A image.

TF-A commit:   e86e202c2e4e
edk2 commit:   8028f0303218
edk2-platforms commit: 05fdad573966

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin | Bin 0 -> 374776 bytes
 1 file changed, 0 insertions(+), 0 deletions(-)

diff --git a/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin 
b/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin
new file mode 100644
index ..eaae94874d4d
Binary files /dev/null and 
b/Platform/Socionext/DeveloperBox/fip_all_arm_tf_mm.bin differ
-- 
2.20.1

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


Re: [edk2] [PATCH edk2-platforms 2/2] Platform/Socionext/DeveloperBox: align with upstream StandaloneMmPkg changes

2019-03-29 Thread Ard Biesheuvel
On Fri, 8 Mar 2019 at 16:31, Ard Biesheuvel  wrote:
>
> Bring DeveloperBox in line with EDK2 core changes to StandaloneMmPkg:
> - switch from BaseExtractGuidedSectionLib to PrePiExtractGuidedSectionLib
> - include a NULL library class resolution for VariableMmDependency
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ard Biesheuvel 

Leif,

I'd like to merge this today if you don't have any objections.

> ---
>  Platform/Socionext/DeveloperBox/DeveloperBox.dsc   | 5 -
>  Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc | 7 +++
>  2 files changed, 7 insertions(+), 5 deletions(-)
>
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc 
> b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> index 31afc4aac3c4..39077ab5ee79 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBox.dsc
> @@ -293,7 +293,10 @@
>VarCheckLib|MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
>}
>  !else
> -  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf
> +  ArmPkg/Drivers/MmCommunicationDxe/MmCommunication.inf {
> +
> +  
> NULL|StandaloneMmPkg/Library/VariableMmDependency/VariableMmDependency.inf
> +  }
>MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
>
> SecurityPkg/VariableAuthenticated/SecureBootConfigDxe/SecureBootConfigDxe.inf
>  !endif
> diff --git a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc 
> b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> index 55c5fbb7350d..141b175047b2 100644
> --- a/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> +++ b/Platform/Socionext/DeveloperBox/DeveloperBoxMm.dsc
> @@ -68,9 +68,6 @@
>  [PcdsFixedAtBuild]
>gEfiMdeModulePkgTokenSpaceGuid.PcdSerialRegisterBase|0x5104
>
> -[PcdsPatchableInModule]
> -  gEfiMdePkgTokenSpaceGuid.PcdGuidedExtractHandlerTableAddress|0x0
> -
>  
> 
>  #
>  # Components Section - list of all EDK II Modules needed by this Platform
> @@ -82,8 +79,10 @@
>#
>StandaloneMmPkg/Core/StandaloneMmCore.inf {
>  
> -  
> ExtractGuidedSectionLib|MdePkg/Library/BaseExtractGuidedSectionLib/BaseExtractGuidedSectionLib.inf
> +  
> ExtractGuidedSectionLib|EmbeddedPkg/Library/PrePiExtractGuidedSectionLib/PrePiExtractGuidedSectionLib.inf
>
> NULL|MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaCustomDecompressLib.inf
> +
> +  gEfiMdePkgTokenSpaceGuid.PcdMaximumGuidedExtractHandler|0x2
>}
>
>StandaloneMmPkg/Drivers/StandaloneMmCpu/AArch64/StandaloneMmCpu.inf
> --
> 2.20.1
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Ting Ye 
Cc: Jian Wang 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -
 .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 ---
 .../Library/IntrinsicLib/IntrinsicLib.inf |  2 -
 3 files changed, 130 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
deleted file mode 100644
index 7031a59a71..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathLShiftS64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit signed value left by a certain number of bits.
-#
-#--
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashldi3)
-
-#--
-#
-# void __cdecl __ashldi3 (void)
-#
-#--
-ASM_PFX(__ashldi3):
-#
-# Handle shifting of 64 or more bits (return 0)
-#
-cmpb$64, %cl
-jae ReturnZero
-
-#
-# Handle shifting of between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shld%cl, %eax, %edx
-shl %cl, %eax
-ret
-
-#
-# Handle shifting of between 32 and 63 bits
-#
-More32:
-movl%eax, %edx
-xor %eax, %eax
-and $31, %cl
-shl %cl, %edx
-ret
-
-ReturnZero:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
deleted file mode 100644
index 24142b088e..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathRShiftU64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit unsigned value right by a certain number of bits.
-#
-#--
-
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashrdi3)
-
-#--
-#
-# void __cdecl __ashrdi3 (void)
-#
-#--
-ASM_PFX(__ashrdi3):
-#
-# Checking: Only handle 64bit shifting or more
-#
-cmpb$64, %cl
-jae _Exit
-
-#
-# Handle shifting between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shrd%cl, %edx, %eax
-shr %cl, %edx
-ret
-
-#
-# Handle shifting of 32-63 bits
-#
-More32:
-movl%edx, %eax
-xor %edx, %edx
-and $31, %cl
-shr %cl, %eax
-ret
-
-#
-# Invalid number (less then 32bits), return 0
-#
-_Exit:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index a91c850013..9704b9ea7d 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -39,8 +39,6 @@
   Ia32/MathLShiftS64.c  | INTEL
   Ia32/MathRShiftU64.c  | INTEL
 
-  Ia32/MathLShiftS64.S  | GCC
-  Ia32/MathRShiftU64.S  | GCC
   Ia32/MathLShiftS64.nasm   | GCC
   Ia32/MathRShiftU64.nasm   | GCC
 
-- 
2.18.0.windows.1


[edk2] [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Ting Ye 
Cc: Gang Wei 
Cc: Jian Wang 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -
 .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 ---
 .../Library/IntrinsicLib/IntrinsicLib.inf |  2 -
 3 files changed, 130 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
deleted file mode 100644
index 7031a59a71..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathLShiftS64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit signed value left by a certain number of bits.
-#
-#--
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashldi3)
-
-#--
-#
-# void __cdecl __ashldi3 (void)
-#
-#--
-ASM_PFX(__ashldi3):
-#
-# Handle shifting of 64 or more bits (return 0)
-#
-cmpb$64, %cl
-jae ReturnZero
-
-#
-# Handle shifting of between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shld%cl, %eax, %edx
-shl %cl, %eax
-ret
-
-#
-# Handle shifting of between 32 and 63 bits
-#
-More32:
-movl%eax, %edx
-xor %eax, %eax
-and $31, %cl
-shl %cl, %edx
-ret
-
-ReturnZero:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
deleted file mode 100644
index 24142b088e..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathRShiftU64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit unsigned value right by a certain number of bits.
-#
-#--
-
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashrdi3)
-
-#--
-#
-# void __cdecl __ashrdi3 (void)
-#
-#--
-ASM_PFX(__ashrdi3):
-#
-# Checking: Only handle 64bit shifting or more
-#
-cmpb$64, %cl
-jae _Exit
-
-#
-# Handle shifting between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shrd%cl, %edx, %eax
-shr %cl, %edx
-ret
-
-#
-# Handle shifting of 32-63 bits
-#
-More32:
-movl%edx, %eax
-xor %edx, %edx
-and $31, %cl
-shr %cl, %eax
-ret
-
-#
-# Invalid number (less then 32bits), return 0
-#
-_Exit:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index a91c850013..9704b9ea7d 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -39,8 +39,6 @@
   Ia32/MathLShiftS64.c  | INTEL
   Ia32/MathRShiftU64.c  | INTEL
 
-  Ia32/MathLShiftS64.S  | GCC
-  Ia32/MathRShiftU64.S  | GCC
   Ia32/MathLShiftS64.nasm   | GCC
   Ia32/MathRShiftU64.nasm   | GCC
 
-- 
2.18.0.windows.1


[edk2] [PATCH v3 11/12] CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Ting Ye 
Cc: Gang Wei 
Cc: Jian Wang 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../Library/IntrinsicLib/Ia32/MathLShiftS64.S | 62 -
 .../Library/IntrinsicLib/Ia32/MathRShiftU64.S | 66 ---
 .../Library/IntrinsicLib/IntrinsicLib.inf |  2 -
 3 files changed, 130 deletions(-)
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
 delete mode 100644 CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S

diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
deleted file mode 100644
index 7031a59a71..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathLShiftS64.S
+++ /dev/null
@@ -1,62 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathLShiftS64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit signed value left by a certain number of bits.
-#
-#--
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashldi3)
-
-#--
-#
-# void __cdecl __ashldi3 (void)
-#
-#--
-ASM_PFX(__ashldi3):
-#
-# Handle shifting of 64 or more bits (return 0)
-#
-cmpb$64, %cl
-jae ReturnZero
-
-#
-# Handle shifting of between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shld%cl, %eax, %edx
-shl %cl, %eax
-ret
-
-#
-# Handle shifting of between 32 and 63 bits
-#
-More32:
-movl%eax, %edx
-xor %eax, %eax
-and $31, %cl
-shl %cl, %edx
-ret
-
-ReturnZero:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S 
b/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
deleted file mode 100644
index 24142b088e..00
--- a/CryptoPkg/Library/IntrinsicLib/Ia32/MathRShiftU64.S
+++ /dev/null
@@ -1,66 +0,0 @@
-#--
-#
-# Copyright (c) 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.
-#
-# Module Name:
-#
-#   MathRShiftU64.S
-#
-# Abstract:
-#
-#   64-bit Math Worker Function.
-#   Shifts a 64-bit unsigned value right by a certain number of bits.
-#
-#--
-
-
-.686:
-.code:
-
-ASM_GLOBAL ASM_PFX(__ashrdi3)
-
-#--
-#
-# void __cdecl __ashrdi3 (void)
-#
-#--
-ASM_PFX(__ashrdi3):
-#
-# Checking: Only handle 64bit shifting or more
-#
-cmpb$64, %cl
-jae _Exit
-
-#
-# Handle shifting between 0 and 31 bits
-#
-cmpb$32, %cl
-jae More32
-shrd%cl, %edx, %eax
-shr %cl, %edx
-ret
-
-#
-# Handle shifting of 32-63 bits
-#
-More32:
-movl%edx, %eax
-xor %edx, %edx
-and $31, %cl
-shr %cl, %eax
-ret
-
-#
-# Invalid number (less then 32bits), return 0
-#
-_Exit:
-xor %eax, %eax
-xor %edx, %edx
-ret
diff --git a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf 
b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
index a91c850013..9704b9ea7d 100644
--- a/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
+++ b/CryptoPkg/Library/IntrinsicLib/IntrinsicLib.inf
@@ -39,8 +39,6 @@
   Ia32/MathLShiftS64.c  | INTEL
   Ia32/MathRShiftU64.c  | INTEL
 
-  Ia32/MathLShiftS64.S  | GCC
-  Ia32/MathRShiftU64.S  | GCC
   Ia32/MathLShiftS64.nasm   | GCC
   Ia32/MathRShiftU64.nasm   | GCC
 
-- 
2.18.0.windows.1


[edk2] [PATCH v3 10/12] MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibSse2/BaseMemoryLibSse2.inf   | 22 -
 .../BaseMemoryLibSse2/Ia32/CompareMem.S   | 55 
 .../Library/BaseMemoryLibSse2/Ia32/CopyMem.S  | 85 ---
 .../BaseMemoryLibSse2/Ia32/ScanMem16.S| 52 
 .../BaseMemoryLibSse2/Ia32/ScanMem32.S| 52 
 .../BaseMemoryLibSse2/Ia32/ScanMem64.S| 61 -
 .../Library/BaseMemoryLibSse2/Ia32/ScanMem8.S | 52 
 .../Library/BaseMemoryLibSse2/Ia32/SetMem.S   | 76 -
 .../Library/BaseMemoryLibSse2/Ia32/SetMem16.S | 69 ---
 .../Library/BaseMemoryLibSse2/Ia32/SetMem32.S | 68 ---
 .../Library/BaseMemoryLibSse2/Ia32/SetMem64.S | 58 -
 .../Library/BaseMemoryLibSse2/Ia32/ZeroMem.S  | 65 --
 .../BaseMemoryLibSse2/X64/CompareMem.S| 59 -
 .../Library/BaseMemoryLibSse2/X64/CopyMem.S   | 83 --
 .../Library/BaseMemoryLibSse2/X64/ScanMem16.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem32.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem64.S | 56 
 .../Library/BaseMemoryLibSse2/X64/ScanMem8.S  | 56 
 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S | 72 
 .../Library/BaseMemoryLibSse2/X64/SetMem16.S  | 70 ---
 .../Library/BaseMemoryLibSse2/X64/SetMem32.S  | 69 ---
 .../Library/BaseMemoryLibSse2/X64/SetMem64.S  | 60 -
 .../Library/BaseMemoryLibSse2/X64/ZeroMem.S   | 65 --
 23 files changed, 1417 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibSse2/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf 
b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
index 771fddaa45..340ca15f06 100644
--- a/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
+++ b/MdePkg/Library/BaseMemoryLibSse2/BaseMemoryLibSse2.inf
@@ -47,27 +47,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -94,27 +83,16 @@
   X64/SetMem.nasm
   X64/CopyMem.nasm
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
 
 [Packages]
diff --git a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- a/MdePkg/Library/BaseMemoryLibSse2/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@

[edk2] [PATCH v3 09/12] MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibRepStr.inf   | 22 ---
 .../BaseMemoryLibRepStr/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibRepStr/Ia32/CopyMem.S| 65 --
 .../BaseMemoryLibRepStr/Ia32/ScanMem16.S  | 54 ---
 .../BaseMemoryLibRepStr/Ia32/ScanMem32.S  | 54 ---
 .../BaseMemoryLibRepStr/Ia32/ScanMem64.S  | 63 --
 .../BaseMemoryLibRepStr/Ia32/ScanMem8.S   | 54 ---
 .../Library/BaseMemoryLibRepStr/Ia32/SetMem.S | 46 -
 .../BaseMemoryLibRepStr/Ia32/SetMem16.S   | 43 
 .../BaseMemoryLibRepStr/Ia32/SetMem32.S   | 43 
 .../BaseMemoryLibRepStr/Ia32/SetMem64.S   | 46 -
 .../BaseMemoryLibRepStr/Ia32/ZeroMem.S| 49 --
 .../BaseMemoryLibRepStr/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibRepStr/X64/CopyMem.S | 66 ---
 .../BaseMemoryLibRepStr/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem64.S   | 56 
 .../BaseMemoryLibRepStr/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibRepStr/X64/SetMem.S  | 47 -
 .../BaseMemoryLibRepStr/X64/SetMem16.S| 47 -
 .../BaseMemoryLibRepStr/X64/SetMem32.S| 47 -
 .../BaseMemoryLibRepStr/X64/SetMem64.S| 46 -
 .../Library/BaseMemoryLibRepStr/X64/ZeroMem.S | 50 --
 23 files changed, 1180 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibRepStr/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf 
b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
index 049936deab..7b315b8302 100644
--- a/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
+++ b/MdePkg/Library/BaseMemoryLibRepStr/BaseMemoryLibRepStr.inf
@@ -48,27 +48,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/ScanMem64.nasm
   X64/ScanMem32.nasm
   X64/ScanMem16.nasm
diff --git a/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibRepStr/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- 

[edk2] [PATCH v3 12/12] SourceLevelDebugPkg/DebugAgentCommon: Remove .S files

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Hao Wu 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../DebugAgentCommon/Ia32/AsmFuncs.S  | 415 -
 .../DebugAgentCommon/X64/AsmFuncs.S   | 431 --
 .../Library/DebugAgent/DxeDebugAgentLib.inf   |   2 -
 3 files changed, 848 deletions(-)
 delete mode 100644 
SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
 delete mode 100644 
SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/X64/AsmFuncs.S

diff --git 
a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S 
b/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
deleted file mode 100644
index 30d279e80d..00
--- a/SourceLevelDebugPkg/Library/DebugAgent/DebugAgentCommon/Ia32/AsmFuncs.S
+++ /dev/null
@@ -1,415 +0,0 @@
-#--
-#
-# Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# http://opensource.org/licenses/bsd-license.php.
-#
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-# Module Name:
-#
-#   AsmFuncs.S
-#
-# Abstract:
-#
-#   Debug interrupt handle functions.
-#
-#--
-
-#include "DebugException.h"
-
-ASM_GLOBAL ASM_PFX(InterruptProcess)
-ASM_GLOBAL ASM_PFX(Exception0Handle)
-ASM_GLOBAL ASM_PFX(ExceptionStubHeaderSize)
-ASM_GLOBAL ASM_PFX(TimerInterruptHandle)
-ASM_GLOBAL ASM_PFX(CommonEntry)
-
-.macro  AGENT_HANDLER_SIGNATURE
-  .byte 0x41, 0x47, 0x54, 0x48   # AGENT_HANDLER_SIGNATURE 
SIGNATURE_32('A','G','T','H')
-.endm
-
-.data
-
-ASM_PFX(ExceptionStubHeaderSize):  .long ASM_PFX(Exception1Handle) - 
ASM_PFX(Exception0Handle)
-
-.text
-
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception0Handle):
-   cli
-   pushl %eax
-   mov   $0, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception1Handle):
-   cli
-   pushl %eax
-   mov   $1, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception2Handle):
-   cli
-   pushl %eax
-   mov   $2, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception3Handle):
-   cli
-   pushl %eax
-   mov   $3, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception4Handle):
-   cli
-   pushl %eax
-   mov   $4, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception5Handle):
-   cli
-   pushl %eax
-   mov   $5, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception6Handle):
-   cli
-   pushl %eax
-   mov   $6, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception7Handle):
-   cli
-   pushl %eax
-   mov   $7, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception8Handle):
-   cli
-   pushl %eax
-   mov   $8, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception9Handle):
-   cli
-   pushl %eax
-   mov   $9, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception10Handle):
-   cli
-   pushl %eax
-   mov   $10, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception11Handle):
-   cli
-   pushl %eax
-   mov   $11, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception12Handle):
-   cli
-   pushl %eax
-   mov   $12, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception13Handle):
-   cli
-   pushl %eax
-   mov   $13, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception14Handle):
-   cli
-   pushl %eax
-   mov   $14, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception15Handle):
-   cli
-   pushl %eax
-   mov   $15, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception16Handle):
-   cli
-   pushl %eax
-   mov   $16, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception17Handle):
-   cli
-   pushl %eax
-   mov   $17, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception18Handle):
-   cli
-   pushl %eax
-   mov   $18, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(Exception19Handle):
-   cli
-   pushl %eax
-   mov   $19, %eax
-   jmp   ASM_PFX(CommonEntry)
-AGENT_HANDLER_SIGNATURE
-ASM_PFX(TimerInterruptHandle):
-   cli
-   pushl %eax
-   mov   $32, %eax
-   jmp   ASM_PFX(CommonEntry)
-
-
-ASM_PFX(CommonEntry):
-
-#---;
-# _CommonEntry   

[edk2] [PATCH v3 00/12] Remove .S files for IA32 and X64 arch in MdePkg and UefiCpuPkg

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

v2: Remove some description in 04/10.

v3: Add 11/12 and 12/12.

Cc: Michael D Kinney 
Cc: Liming Gao 
Cc: Eric Dong 
Cc: Ray Ni 
Shenglei Zhang (12):
  UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch
  UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch
  UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch
  MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch
  MdePkg/BaseLib: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibRepStr: Remove .S files for IA32 and X64 arch
  MdePkg/BaseMemoryLibSse2: Remove .S files for IA32 and X64 arch
  CryptoPkg/IntrinsicLib: Remove .S files for IA32 arch
  SourceLevelDebugPkg/DebugAgentCommon: Remove .S files

 .../Library/IntrinsicLib/Ia32/MathLShiftS64.S |  62 --
 .../Library/IntrinsicLib/Ia32/MathRShiftU64.S |  66 --
 .../Library/IntrinsicLib/IntrinsicLib.inf |   2 -
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf  |   4 -
 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S   |  35 -
 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S  |  34 -
 MdePkg/Library/BaseLib/BaseLib.inf|  38 -
 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S  |  43 --
 MdePkg/Library/BaseLib/Ia32/CpuId.S   |  63 --
 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S |  67 --
 MdePkg/Library/BaseLib/Ia32/DisableCache.S|  39 -
 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S |  52 --
 MdePkg/Library/BaseLib/Ia32/DivU64x32.S   |  41 --
 .../Library/BaseLib/Ia32/DivU64x32Remainder.S |  46 --
 .../Library/BaseLib/Ia32/DivU64x64Remainder.S |  89 ---
 MdePkg/Library/BaseLib/Ia32/EnableCache.S |  39 -
 .../BaseLib/Ia32/EnableDisableInterrupts.S|  36 -
 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S  |  52 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S  |  63 --
 .../BaseLib/Ia32/InternalSwitchStack.S|  48 --
 MdePkg/Library/BaseLib/Ia32/LRotU64.S |  48 --
 MdePkg/Library/BaseLib/Ia32/LShiftU64.S   |  43 --
 MdePkg/Library/BaseLib/Ia32/LongJump.S|  41 --
 MdePkg/Library/BaseLib/Ia32/ModU64x32.S   |  40 --
 MdePkg/Library/BaseLib/Ia32/Monitor.S |  40 --
 MdePkg/Library/BaseLib/Ia32/MultU64x32.S  |  41 --
 MdePkg/Library/BaseLib/Ia32/MultU64x64.S  |  44 --
 MdePkg/Library/BaseLib/Ia32/Mwait.S   |  38 -
 MdePkg/Library/BaseLib/Ia32/RRotU64.S |  48 --
 MdePkg/Library/BaseLib/Ia32/RShiftU64.S   |  46 --
 MdePkg/Library/BaseLib/Ia32/RdRand.S  |  80 ---
 MdePkg/Library/BaseLib/Ia32/SetJump.S |  44 --
 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S |  38 -
 MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 --
 MdePkg/Library/BaseLib/X64/CpuId.S|  60 --
 MdePkg/Library/BaseLib/X64/CpuIdEx.S  |  62 --
 MdePkg/Library/BaseLib/X64/DisableCache.S |  39 -
 MdePkg/Library/BaseLib/X64/DisablePaging64.S  |  82 ---
 MdePkg/Library/BaseLib/X64/EnableCache.S  |  39 -
 .../BaseLib/X64/EnableDisableInterrupts.S |  36 -
 MdePkg/Library/BaseLib/X64/LongJump.S |  54 --
 MdePkg/Library/BaseLib/X64/RdRand.S   |  72 --
 MdePkg/Library/BaseLib/X64/SetJump.S  |  53 --
 MdePkg/Library/BaseLib/X64/SwitchStack.S  |  52 --
 MdePkg/Library/BaseLib/X64/Thunk16.S  | 334 -
 .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf |  22 -
 .../BaseMemoryLibMmx/Ia32/CompareMem.S|  55 --
 .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S   |  86 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S |  61 --
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S  |  52 --
 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S |  66 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S  |  59 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S  |  52 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S  |  43 --
 .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S   |  54 --
 .../Library/BaseMemoryLibMmx/X64/CompareMem.S |  59 --
 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S |  74 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem16.S  |  56 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem32.S  |  56 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem64.S  |  55 --
 .../Library/BaseMemoryLibMmx/X64/ScanMem8.S   |  56 --
 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S  |  61 --
 .../Library/BaseMemoryLibMmx/X64/SetMem16.S   |  60 --
 .../Library/BaseMemoryLibMmx/X64/SetMem32.S   |  55 --
 .../Library/BaseMemoryLibMmx/X64/SetMem64.S   |  47 --
 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S |  57 --
 .../BaseMemoryLibOptDxe.inf   |  22 -
 .../BaseMemoryLibOptDxe/Ia32/CompareMem.S |  55 --
 

[edk2] [PATCH v3 05/12] MdePkg/BaseLib: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseLib/BaseLib.inf|  38 --
 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S  |  43 ---
 MdePkg/Library/BaseLib/Ia32/CpuId.S   |  63 
 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S |  67 
 MdePkg/Library/BaseLib/Ia32/DisableCache.S|  39 --
 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S |  52 ---
 MdePkg/Library/BaseLib/Ia32/DivU64x32.S   |  41 ---
 .../Library/BaseLib/Ia32/DivU64x32Remainder.S |  46 ---
 .../Library/BaseLib/Ia32/DivU64x64Remainder.S |  89 -
 MdePkg/Library/BaseLib/Ia32/EnableCache.S |  39 --
 .../BaseLib/Ia32/EnableDisableInterrupts.S|  36 --
 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S  |  52 ---
 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S  |  63 
 .../BaseLib/Ia32/InternalSwitchStack.S|  48 ---
 MdePkg/Library/BaseLib/Ia32/LRotU64.S |  48 ---
 MdePkg/Library/BaseLib/Ia32/LShiftU64.S   |  43 ---
 MdePkg/Library/BaseLib/Ia32/LongJump.S|  41 ---
 MdePkg/Library/BaseLib/Ia32/ModU64x32.S   |  40 ---
 MdePkg/Library/BaseLib/Ia32/Monitor.S |  40 ---
 MdePkg/Library/BaseLib/Ia32/MultU64x32.S  |  41 ---
 MdePkg/Library/BaseLib/Ia32/MultU64x64.S  |  44 ---
 MdePkg/Library/BaseLib/Ia32/Mwait.S   |  38 --
 MdePkg/Library/BaseLib/Ia32/RRotU64.S |  48 ---
 MdePkg/Library/BaseLib/Ia32/RShiftU64.S   |  46 ---
 MdePkg/Library/BaseLib/Ia32/RdRand.S  |  80 -
 MdePkg/Library/BaseLib/Ia32/SetJump.S |  44 ---
 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S |  38 --
 MdePkg/Library/BaseLib/Ia32/Thunk16.S | 222 
 MdePkg/Library/BaseLib/X64/CpuId.S|  60 
 MdePkg/Library/BaseLib/X64/CpuIdEx.S  |  62 
 MdePkg/Library/BaseLib/X64/DisableCache.S |  39 --
 MdePkg/Library/BaseLib/X64/DisablePaging64.S  |  82 -
 MdePkg/Library/BaseLib/X64/EnableCache.S  |  39 --
 .../BaseLib/X64/EnableDisableInterrupts.S |  36 --
 MdePkg/Library/BaseLib/X64/LongJump.S |  54 ---
 MdePkg/Library/BaseLib/X64/RdRand.S   |  72 
 MdePkg/Library/BaseLib/X64/SetJump.S  |  53 ---
 MdePkg/Library/BaseLib/X64/SwitchStack.S  |  52 ---
 MdePkg/Library/BaseLib/X64/Thunk16.S  | 334 --
 39 files changed, 2412 deletions(-)
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/ARShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuId.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/CpuIdEx.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DisablePaging32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x32Remainder.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/DivU64x64Remainder.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnableDisableInterrupts.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/EnablePaging64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/InternalSwitchStack.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LRotU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/LongJump.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/ModU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Monitor.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x32.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/MultU64x64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Mwait.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RRotU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RShiftU64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/RdRand.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/SetJump.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/SwapBytes64.S
 delete mode 100644 MdePkg/Library/BaseLib/Ia32/Thunk16.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/CpuId.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/CpuIdEx.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/DisableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/DisablePaging64.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/EnableCache.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/EnableDisableInterrupts.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/LongJump.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/RdRand.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/SetJump.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/SwitchStack.S
 delete mode 100644 MdePkg/Library/BaseLib/X64/Thunk16.S

diff --git a/MdePkg/Library/BaseLib/BaseLib.inf 
b/MdePkg/Library/BaseLib/BaseLib.inf
index a0d6c372f9..16829deeb4 

[edk2] [PATCH v3 02/12] UefiCpuPkg/BaseUefiCpuLib: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
Reviewed-by: Eric Dong 
---
 .../Library/BaseUefiCpuLib/BaseUefiCpuLib.inf |  2 -
 .../BaseUefiCpuLib/Ia32/InitializeFpu.S   | 73 ---
 .../BaseUefiCpuLib/X64/InitializeFpu.S| 57 ---
 3 files changed, 132 deletions(-)
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
 delete mode 100644 UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S

diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf 
b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
index 5614452a88..2e9756e50e 100644
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
+++ b/UefiCpuPkg/Library/BaseUefiCpuLib/BaseUefiCpuLib.inf
@@ -31,11 +31,9 @@
 
 [Sources.IA32]
   Ia32/InitializeFpu.nasm
-  Ia32/InitializeFpu.S
 
 [Sources.X64]
   X64/InitializeFpu.nasm
-  X64/InitializeFpu.S
 
 [Packages]
   MdePkg/MdePkg.dec
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S 
b/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
deleted file mode 100644
index 0a1a9198f6..00
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/Ia32/InitializeFpu.S
+++ /dev/null
@@ -1,73 +0,0 @@
-#--
-#*
-#*   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-#*   This program and the accompanying materials
-#*   are licensed and made available under the terms and conditions of the BSD 
License
-#*   which accompanies this distribution.  The full text of the license may be 
found at
-#*   http://opensource.org/licenses/bsd-license.php
-#*
-#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-#*
-#*
-#--
-
-#
-# Float control word initial value:
-# all exceptions masked, double-precision, round-to-nearest
-#
-ASM_PFX(mFpuControlWord): .word 0x027F
-#
-# Multimedia-extensions control word:
-# all exceptions masked, round-to-nearest, flush to zero for masked underflow
-#
-ASM_PFX(mMmxControlWord): .long 0x01F80
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x027F (all 
exceptions
-# masked,double-precision, round-to-nearest) and multimedia-extensions control 
word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-pushl   %ebx
-
-#
-# Initialize floating point units
-#
-finit
-fldcw   ASM_PFX(mFpuControlWord)
-
-#
-# Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
-# whether the processor supports SSE instruction.
-#
-movl$1,  %eax
-cpuid
-btl $25, %edx
-jnc Done
-
-#
-# Set OSFXSR bit 9 in CR4
-#
-movl%cr4, %eax
-or  $0x200, %eax
-movl%eax, %cr4
-
-#
-# The processor should support SSE instruction and we can use
-# ldmxcsr instruction
-#
-ldmxcsr ASM_PFX(mMmxControlWord)
-
-Done:
-popl%ebx
-
-ret
-
-#END
-
diff --git a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S 
b/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
deleted file mode 100644
index f0b0d3e264..00
--- a/UefiCpuPkg/Library/BaseUefiCpuLib/X64/InitializeFpu.S
+++ /dev/null
@@ -1,57 +0,0 @@
-#--
-#*
-#*   Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
-#*   This program and the accompanying materials
-#*   are licensed and made available under the terms and conditions of the BSD 
License
-#*   which accompanies this distribution.  The full text of the license may be 
found at
-#*   http://opensource.org/licenses/bsd-license.php
-#*
-#*   THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-#*   WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR 
IMPLIED.
-#*
-#*
-#--
-
-#
-# Initializes floating point units for requirement of UEFI specification.
-#
-# This function initializes floating-point control word to 0x037F (all 
exceptions
-# masked,double-extended-precision, round-to-nearest) and 
multimedia-extensions control word
-# (if supported) to 0x1F80 (all exceptions masked, round-to-nearest, flush to 
zero
-# for masked underflow).
-#
-ASM_GLOBAL ASM_PFX(InitializeFloatingPointUnits)
-ASM_PFX(InitializeFloatingPointUnits):
-
-#
-# Initialize floating 

[edk2] [PATCH v3 03/12] UefiCpuPkg/CpuExceptionHandlerLib:Remove.S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../DxeCpuExceptionHandlerLib.inf |   2 -
 .../Ia32/ExceptionHandlerAsm.S| 667 --
 .../PeiCpuExceptionHandlerLib.inf |   2 -
 .../SecPeiCpuExceptionHandlerLib.inf  |   2 -
 .../SmmCpuExceptionHandlerLib.inf |   2 -
 .../X64/ExceptionHandlerAsm.S | 434 
 6 files changed, 1109 deletions(-)
 delete mode 100644 
UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
 delete mode 100644 
UefiCpuPkg/Library/CpuExceptionHandlerLib/X64/ExceptionHandlerAsm.S

diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
index a480890165..391e49f077 100644
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
+++ b/UefiCpuPkg/Library/CpuExceptionHandlerLib/DxeCpuExceptionHandlerLib.inf
@@ -30,13 +30,11 @@
 [Sources.Ia32]
   Ia32/ExceptionHandlerAsm.nasm
   Ia32/ExceptionTssEntryAsm.nasm
-  Ia32/ExceptionHandlerAsm.S
   Ia32/ArchExceptionHandler.c
   Ia32/ArchInterruptDefs.h
 
 [Sources.X64]
   X64/ExceptionHandlerAsm.nasm
-  X64/ExceptionHandlerAsm.S
   X64/ArchExceptionHandler.c
   X64/ArchInterruptDefs.h
 
diff --git 
a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S 
b/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
deleted file mode 100644
index c134257d9d..00
--- a/UefiCpuPkg/Library/CpuExceptionHandlerLib/Ia32/ExceptionHandlerAsm.S
+++ /dev/null
@@ -1,667 +0,0 @@
-#--
-#*
-#*   Copyright (c) 2012 - 2015, 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.
-#*
-#*ExceptionHandlerAsm.S
-#*
-#*   Abstract:
-#*
-#* IA32 CPU Exception Handler
-#
-#--
-
-
-#.MMX
-#.XMM
-
-ASM_GLOBAL ASM_PFX(CommonExceptionHandler)
-ASM_GLOBAL ASM_PFX(CommonInterruptEntry)
-ASM_GLOBAL ASM_PFX(HookAfterStubHeaderEnd)
-
-#EXTRN ASM_PFX(mErrorCodeFlag):DWORD   # Error code flags for 
exceptions
-#EXTRN ASM_PFX(mDoFarReturnFlag):DWORD # Do far return flag
-
-.text
-
-#
-# exception handler stub table
-#
-Exception0Handle:
-.byte   0x6a#  push #VectorNum
-.byte   0
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception1Handle:
-.byte   0x6a#  push #VectorNum
-.byte   1
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception2Handle:
-.byte   0x6a#  push #VectorNum
-.byte   2
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception3Handle:
-.byte   0x6a#  push #VectorNum
-.byte   3
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception4Handle:
-.byte   0x6a#  push #VectorNum
-.byte   4
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception5Handle:
-.byte   0x6a#  push #VectorNum
-.byte   5
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception6Handle:
-.byte   0x6a#  push #VectorNum
-.byte   6
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception7Handle:
-.byte   0x6a#  push #VectorNum
-.byte   7
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception8Handle:
-.byte   0x6a#  push #VectorNum
-.byte   8
-pushl   %eax
- .byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception9Handle:
-.byte   0x6a#  push #VectorNum
-.byte   9
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception10Handle:
-.byte   0x6a#  push #VectorNum
-.byte   10
-pushl   %eax
-.byte   0xB8
-.long   ASM_PFX(CommonInterruptEntry)
-jmp *%eax
-Exception11Handle:
-.byte   0x6a#  push #VectorNum
-.byte   11
-pushl   %eax
-.byte   0xB8
-.long   

[edk2] [PATCH v3 08/12] MdePkg/BaseMemoryLibOptPei: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibOptPei.inf   | 22 ---
 .../BaseMemoryLibOptPei/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibOptPei/Ia32/CopyMem.S| 62 -
 .../BaseMemoryLibOptPei/Ia32/ScanMem16.S  | 52 ---
 .../BaseMemoryLibOptPei/Ia32/ScanMem32.S  | 52 ---
 .../BaseMemoryLibOptPei/Ia32/ScanMem64.S  | 61 -
 .../BaseMemoryLibOptPei/Ia32/ScanMem8.S   | 52 ---
 .../Library/BaseMemoryLibOptPei/Ia32/SetMem.S | 50 --
 .../BaseMemoryLibOptPei/Ia32/SetMem16.S   | 43 
 .../BaseMemoryLibOptPei/Ia32/SetMem32.S   | 43 
 .../BaseMemoryLibOptPei/Ia32/SetMem64.S   | 46 -
 .../BaseMemoryLibOptPei/Ia32/ZeroMem.S| 49 --
 .../BaseMemoryLibOptPei/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibOptPei/X64/CopyMem.S | 66 ---
 .../BaseMemoryLibOptPei/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem64.S   | 56 
 .../BaseMemoryLibOptPei/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibOptPei/X64/SetMem.S  | 47 -
 .../BaseMemoryLibOptPei/X64/SetMem16.S| 47 -
 .../BaseMemoryLibOptPei/X64/SetMem32.S| 47 -
 .../BaseMemoryLibOptPei/X64/SetMem64.S| 46 -
 .../Library/BaseMemoryLibOptPei/X64/ZeroMem.S | 50 --
 23 files changed, 1173 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptPei/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf 
b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
index 8f274d83b0..6fcb5fdac2 100644
--- a/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
+++ b/MdePkg/Library/BaseMemoryLibOptPei/BaseMemoryLibOptPei.inf
@@ -35,27 +35,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -84,27 +73,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
   ScanMem64Wrapper.c
   ScanMem32Wrapper.c
diff --git a/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibOptPei/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..00
--- 

[edk2] [PATCH v3 04/12] MdePkg/BaseCpuLib: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

v2: Remove CpuSleep.nasm| GCC and CpuFlushTlb.nasm| GCC in X64 arch
in BaseCpuLib.inf.

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 MdePkg/Library/BaseCpuLib/BaseCpuLib.inf|  4 ---
 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S | 35 -
 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S| 34 
 3 files changed, 73 deletions(-)
 delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
 delete mode 100644 MdePkg/Library/BaseCpuLib/X64/CpuSleep.S

diff --git a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf 
b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
index af2f09617a..a734cac377 100644
--- a/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
+++ b/MdePkg/Library/BaseCpuLib/BaseCpuLib.inf
@@ -46,10 +46,6 @@
   X64/CpuFlushTlb.nasm
   X64/CpuSleep.nasm
 
-  X64/CpuSleep.nasm| GCC
-  X64/CpuSleep.S | GCC
-  X64/CpuFlushTlb.nasm| GCC
-  X64/CpuFlushTlb.S | GCC
 
 [Sources.EBC]
   Ebc/CpuSleepFlushTlb.c
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S 
b/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
deleted file mode 100644
index 05d916a589..00
--- a/MdePkg/Library/BaseCpuLib/X64/CpuFlushTlb.S
+++ /dev/null
@@ -1,35 +0,0 @@
-#--
-# Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# 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.
-#
-# Module Name:
-#
-#   CpuFlushTlb.Asm
-#
-# Abstract:
-#
-#   CpuFlushTlb function
-#
-# Notes:
-#
-#--
-
-ASM_GLOBAL ASM_PFX(CpuFlushTlb)
-
-#--
-# VOID
-# EFIAPI
-# CpuFlushTlb (
-#   VOID
-#   );
-#--
-ASM_PFX(CpuFlushTlb):
-mov %cr3, %rax
-mov %rax, %cr3
-ret
diff --git a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S 
b/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
deleted file mode 100644
index cf763689d7..00
--- a/MdePkg/Library/BaseCpuLib/X64/CpuSleep.S
+++ /dev/null
@@ -1,34 +0,0 @@
-#--
 ;
-# Copyright (c) 2006 - 2008, 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.
-#
-# Module Name:
-#
-#   CpuSleep.S
-#
-# Abstract:
-#
-#   CpuSleep function
-#
-# Notes:
-#
-#--
-
-
-#--
-# VOID
-# EFIAPI
-# CpuSleep (
-#   VOID
-#   );
-#--
-ASM_GLOBAL ASM_PFX(CpuSleep)
-ASM_PFX(CpuSleep):
-hlt
-ret
-- 
2.18.0.windows.1

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


[edk2] [PATCH v3 01/12] UefiCpuPkg/SmmCpuFeaturesLib: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Change-Id: Ibf97f907a36f84bf46b2b562a2f7e8eb514a8b8e
Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
Reviewed-by: Eric Dong 
---
 .../Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S | 278 -
 .../SmmCpuFeaturesLib/Ia32/SmiException.S | 174 ---
 .../SmmCpuFeaturesLibStm.inf  |   6 -
 .../Library/SmmCpuFeaturesLib/X64/SmiEntry.S  | 282 --
 .../SmmCpuFeaturesLib/X64/SmiException.S  | 178 ---
 5 files changed, 918 deletions(-)
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiException.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiEntry.S
 delete mode 100644 UefiCpuPkg/Library/SmmCpuFeaturesLib/X64/SmiException.S

diff --git a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S 
b/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
deleted file mode 100644
index 4c0f8c8933..00
--- a/UefiCpuPkg/Library/SmmCpuFeaturesLib/Ia32/SmiEntry.S
+++ /dev/null
@@ -1,278 +0,0 @@
-#--
-#
-# Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD 
License
-# which accompanies this distribution.  The full text of the license may be 
found at
-# 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.
-#
-# Module Name:
-#
-#   SmiEntry.S
-#
-# Abstract:
-#
-#   Code template of the SMI handler for a particular processor
-#
-#--
-
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerTemplate)
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerSize)
-ASM_GLOBAL  ASM_PFX(gcStmSmiHandlerOffset)
-ASM_GLOBAL  ASM_PFX(gStmSmiCr3)
-ASM_GLOBAL  ASM_PFX(gStmSmiStack)
-ASM_GLOBAL  ASM_PFX(gStmSmbase)
-ASM_GLOBAL  ASM_PFX(gStmXdSupported)
-ASM_GLOBAL  ASM_PFX(FeaturePcdGet (PcdCpuSmmStackGuard))
-ASM_GLOBAL  ASM_PFX(gStmSmiHandlerIdtr)
-
-.equMSR_IA32_MISC_ENABLE, 0x1A0
-.equMSR_EFER, 0xc080
-.equMSR_EFER_XD, 0x800
-
-#
-# Constants relating to TXT_PROCESSOR_SMM_DESCRIPTOR
-#
-.equDSC_OFFSET, 0xfb00
-.equDSC_GDTPTR, 0x48
-.equDSC_GDTSIZ, 0x50
-.equDSC_CS, 0x14
-.equDSC_DS, 0x16
-.equDSC_SS, 0x18
-.equDSC_OTHERSEG, 0x1A
-
-.equPROTECT_MODE_CS, 0x08
-.equPROTECT_MODE_DS, 0x20
-.equTSS_SEGMENT, 0x40
-
-.text
-ASM_PFX(gcStmSmiHandlerTemplate):
-
-_StmSmiEntryPoint:
-.byte 0xbb  # mov bx, imm16
-.word _StmGdtDesc - _StmSmiEntryPoint + 0x8000
-.byte 0x2e,0xa1 # mov ax, cs:[offset16]
-.word DSC_OFFSET + DSC_GDTSIZ
-decl%eax
-movl%eax, %cs:(%edi)# mov cs:[bx], ax
-.byte 0x66,0x2e,0xa1# mov eax, cs:[offset16]
-.word   DSC_OFFSET + DSC_GDTPTR
-movw%ax, %cs:2(%edi)
-movw%ax, %bp# ebp = GDT base
-.byte 0x66
-lgdt%cs:(%edi)
-# Patch ProtectedMode Segment
-.byte   0xb8# mov ax, imm16
-.word   PROTECT_MODE_CS # set AX for segment directly
-movl%eax, %cs:-2(%edi)  # mov cs:[bx - 2], ax
-# Patch ProtectedMode entry
-.byte 0x66, 0xbf# mov edi, SMBASE
-ASM_PFX(gStmSmbase): .space 4
-.byte 0x67
-lea ((Start32bit - _StmSmiEntryPoint) + 0x8000)(%edi), %ax
-movw %ax, %cs:-6(%edi)
-movl%cr0, %ebx
-.byte 0x66
-andl$0x9ffafff3, %ebx
-.byte 0x66
-orl $0x23, %ebx
-movl%ebx, %cr0
-.byte 0x66,0xea
-.space  4
-.space  2
-_StmGdtDesc:   .space 4
-.space 2
-
-Start32bit:
-movw$PROTECT_MODE_DS, %ax
-movl%eax,%ds
-movl%eax,%es
-movl%eax,%fs
-movl%eax,%gs
-movl%eax,%ss
-.byte   0xbc  # mov esp, imm32
-ASM_PFX(gStmSmiStack): .space 4
-movl$ASM_PFX(gStmSmiHandlerIdtr), %eax
-lidt(%eax)
-jmp ProtFlatMode
-
-ProtFlatMode:
-.byte   0xb8   # mov eax, imm32
-ASM_PFX(gStmSmiCr3): .space 4
-movl%eax, %cr3
-#
-# Need to test for CR4 specific bit support
-#
-movl$1, %eax
-cpuid  # use CPUID to determine if 
specific CR4 bits are supported
-xorl%eax, %eax # Clear EAX
-testl   $BIT2, %edx

[edk2] [PATCH v3 06/12] MdePkg/BaseMemoryLibMmx: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibMmx/BaseMemoryLibMmx.inf | 22 -
 .../BaseMemoryLibMmx/Ia32/CompareMem.S| 55 
 .../Library/BaseMemoryLibMmx/Ia32/CopyMem.S   | 86 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem16.S | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem32.S | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem64.S | 61 -
 .../Library/BaseMemoryLibMmx/Ia32/ScanMem8.S  | 52 ---
 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S | 66 --
 .../Library/BaseMemoryLibMmx/Ia32/SetMem16.S  | 59 -
 .../Library/BaseMemoryLibMmx/Ia32/SetMem32.S  | 52 ---
 .../Library/BaseMemoryLibMmx/Ia32/SetMem64.S  | 43 --
 .../Library/BaseMemoryLibMmx/Ia32/ZeroMem.S   | 54 
 .../Library/BaseMemoryLibMmx/X64/CompareMem.S | 59 -
 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S | 74 
 .../Library/BaseMemoryLibMmx/X64/ScanMem16.S  | 56 
 .../Library/BaseMemoryLibMmx/X64/ScanMem32.S  | 56 
 .../Library/BaseMemoryLibMmx/X64/ScanMem64.S  | 55 
 .../Library/BaseMemoryLibMmx/X64/ScanMem8.S   | 56 
 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S  | 61 -
 .../Library/BaseMemoryLibMmx/X64/SetMem16.S   | 60 -
 .../Library/BaseMemoryLibMmx/X64/SetMem32.S   | 55 
 .../Library/BaseMemoryLibMmx/X64/SetMem64.S   | 47 --
 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S | 57 
 23 files changed, 1290 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibMmx/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf 
b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
index d17fcf24b6..9a073d1cd9 100644
--- a/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
+++ b/MdePkg/Library/BaseMemoryLibMmx/BaseMemoryLibMmx.inf
@@ -52,27 +52,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -99,27 +88,16 @@
   X64/SetMem.nasm
   X64/CopyMem.nasm
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
 
 
diff --git a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
deleted file mode 100644
index b509586adb..00
--- a/MdePkg/Library/BaseMemoryLibMmx/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@
-#--
-#
-# Copyright 

[edk2] [PATCH v3 07/12] MdePkg/BaseMemoryLibOptDxe: Remove .S files for IA32 and X64 arch

2019-03-29 Thread Shenglei Zhang
.nasm file has been added for X86 arch. .S assembly code
is not required any more.
https://bugzilla.tianocore.org/show_bug.cgi?id=1594

Cc: Michael D Kinney 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Shenglei Zhang 
---
 .../BaseMemoryLibOptDxe.inf   | 22 -
 .../BaseMemoryLibOptDxe/Ia32/CompareMem.S | 55 
 .../BaseMemoryLibOptDxe/Ia32/CopyMem.S| 85 ---
 .../BaseMemoryLibOptDxe/Ia32/ScanMem16.S  | 52 
 .../BaseMemoryLibOptDxe/Ia32/ScanMem32.S  | 52 
 .../BaseMemoryLibOptDxe/Ia32/ScanMem64.S  | 61 -
 .../BaseMemoryLibOptDxe/Ia32/ScanMem8.S   | 52 
 .../Library/BaseMemoryLibOptDxe/Ia32/SetMem.S | 50 ---
 .../BaseMemoryLibOptDxe/Ia32/SetMem16.S   | 43 --
 .../BaseMemoryLibOptDxe/Ia32/SetMem32.S   | 43 --
 .../BaseMemoryLibOptDxe/Ia32/SetMem64.S   | 46 --
 .../BaseMemoryLibOptDxe/Ia32/ZeroMem.S| 49 ---
 .../BaseMemoryLibOptDxe/X64/CompareMem.S  | 59 -
 .../Library/BaseMemoryLibOptDxe/X64/CopyMem.S | 82 --
 .../BaseMemoryLibOptDxe/X64/ScanMem16.S   | 56 
 .../BaseMemoryLibOptDxe/X64/ScanMem32.S   | 56 
 .../BaseMemoryLibOptDxe/X64/ScanMem64.S   | 55 
 .../BaseMemoryLibOptDxe/X64/ScanMem8.S| 56 
 .../Library/BaseMemoryLibOptDxe/X64/SetMem.S  | 57 -
 .../BaseMemoryLibOptDxe/X64/SetMem16.S| 47 --
 .../BaseMemoryLibOptDxe/X64/SetMem32.S| 47 --
 .../BaseMemoryLibOptDxe/X64/SetMem64.S| 46 --
 .../Library/BaseMemoryLibOptDxe/X64/ZeroMem.S | 51 ---
 23 files changed, 1222 deletions(-)
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/Ia32/ZeroMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CompareMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/CopyMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ScanMem8.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem16.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem32.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/SetMem64.S
 delete mode 100644 MdePkg/Library/BaseMemoryLibOptDxe/X64/ZeroMem.S

diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf 
b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
index 3f756647e1..5ee1d70473 100644
--- a/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
+++ b/MdePkg/Library/BaseMemoryLibOptDxe/BaseMemoryLibOptDxe.inf
@@ -35,27 +35,16 @@
 
 [Sources.Ia32]
   Ia32/ScanMem64.nasm
-  Ia32/ScanMem64.S
   Ia32/ScanMem32.nasm
-  Ia32/ScanMem32.S
   Ia32/ScanMem16.nasm
-  Ia32/ScanMem16.S
   Ia32/ScanMem8.nasm
-  Ia32/ScanMem8.S
   Ia32/CompareMem.nasm
-  Ia32/CompareMem.S
   Ia32/ZeroMem.nasm
-  Ia32/ZeroMem.S
   Ia32/SetMem64.nasm
-  Ia32/SetMem64.S
   Ia32/SetMem32.nasm
-  Ia32/SetMem32.S
   Ia32/SetMem16.nasm
-  Ia32/SetMem16.S
   Ia32/SetMem.nasm
-  Ia32/SetMem.S
   Ia32/CopyMem.nasm
-  Ia32/CopyMem.S
   Ia32/ScanMem64.nasm
   Ia32/ScanMem32.nasm
   Ia32/ScanMem16.nasm
@@ -72,27 +61,16 @@
 
 [Sources.X64]
   X64/ScanMem64.nasm
-  X64/ScanMem64.S
   X64/ScanMem32.nasm
-  X64/ScanMem32.S
   X64/ScanMem16.nasm
-  X64/ScanMem16.S
   X64/ScanMem8.nasm
-  X64/ScanMem8.S
   X64/CompareMem.nasm
-  X64/CompareMem.S
   X64/ZeroMem.nasm
-  X64/ZeroMem.S
   X64/SetMem64.nasm
-  X64/SetMem64.S
   X64/SetMem32.nasm
-  X64/SetMem32.S
   X64/SetMem16.nasm
-  X64/SetMem16.S
   X64/SetMem.nasm
-  X64/SetMem.S
   X64/CopyMem.nasm
-  X64/CopyMem.S
   X64/IsZeroBuffer.nasm
   MemLibGuid.c
 
diff --git a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S 
b/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
deleted file mode 100644
index 23758781c9..00
--- a/MdePkg/Library/BaseMemoryLibOptDxe/Ia32/CompareMem.S
+++ /dev/null
@@ -1,55 +0,0 @@

Re: [edk2] [Patch][edk2-platforms/devel-MinnowBoardMax-UDK2017] Vlv2TbltDevicePkg: Fix issue with SOURCE_DEBUG_ENABLE

2019-03-29 Thread Qian, Yi
Reviewed by Qian Yi

Thanks
Qian Yi

> -Original Message-
> From: Sun, Zailiang
> Sent: Friday, March 29, 2019 3:13 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David ; Qian, Yi 
> Subject: [Patch][edk2-platforms/devel-MinnowBoardMax-UDK2017]
> Vlv2TbltDevicePkg: Fix issue with SOURCE_DEBUG_ENABLE
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1671
> 
> Build fails when SOURCE_DEBUG_ENABLE is set to TRUE. This is due to
> limited size of FV MAIN region. To work around the issue, we increase size
> for the region by another 320KB provided that MINNOW2_FSP_BUILD is set
> to FALSE.
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Zailiang Sun 
> Cc: David Wei 
> Cc: Yi Qian 
> ---
>  Vlv2TbltDevicePkg/PlatformPkg.fdf | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf
> b/Vlv2TbltDevicePkg/PlatformPkg.fdf
> index 4c19f156ea..84e3014178 100644
> --- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
> +++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
> @@ -47,8 +47,13 @@ DEFINE FLASH_REGION_AZALIABIN_BASE
> = 0xFFD08000
> 
>  !endif
> 
> +!if $(MINNOW2_FSP_BUILD) == TRUE
>  DEFINE FLASH_REGION_FVMAIN_OFFSET = 0x0011
>  DEFINE FLASH_REGION_FVMAIN_SIZE   = 0x0021
> +!else
> +DEFINE FLASH_REGION_FVMAIN_OFFSET = 0x000C
> +DEFINE FLASH_REGION_FVMAIN_SIZE   = 0x0026
> +!endif
> 
>  DEFINE FLASH_REGION_FV_RECOVERY2_OFFSET   = 0x0032
>  DEFINE FLASH_REGION_FV_RECOVERY2_SIZE = 0x0007
> --
> 2.19.1.windows.1

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


[edk2] [Patch][edk2-platforms/devel-MinnowBoardMax-UDK2017] Vlv2TbltDevicePkg: Fix issue with SOURCE_DEBUG_ENABLE

2019-03-29 Thread Zailiang Sun
https://bugzilla.tianocore.org/show_bug.cgi?id=1671

Build fails when SOURCE_DEBUG_ENABLE is set to TRUE. This is due to
limited size of FV MAIN region. To work around the issue, we increase
size for the region by another 320KB provided that MINNOW2_FSP_BUILD
is set to FALSE.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Zailiang Sun 
Cc: David Wei 
Cc: Yi Qian 
---
 Vlv2TbltDevicePkg/PlatformPkg.fdf | 5 +
 1 file changed, 5 insertions(+)

diff --git a/Vlv2TbltDevicePkg/PlatformPkg.fdf 
b/Vlv2TbltDevicePkg/PlatformPkg.fdf
index 4c19f156ea..84e3014178 100644
--- a/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -47,8 +47,13 @@ DEFINE FLASH_REGION_AZALIABIN_BASE   
 = 0xFFD08000
 
 !endif
 
+!if $(MINNOW2_FSP_BUILD) == TRUE
 DEFINE FLASH_REGION_FVMAIN_OFFSET = 0x0011
 DEFINE FLASH_REGION_FVMAIN_SIZE   = 0x0021
+!else
+DEFINE FLASH_REGION_FVMAIN_OFFSET = 0x000C
+DEFINE FLASH_REGION_FVMAIN_SIZE   = 0x0026
+!endif
 
 DEFINE FLASH_REGION_FV_RECOVERY2_OFFSET   = 0x0032
 DEFINE FLASH_REGION_FV_RECOVERY2_SIZE = 0x0007
-- 
2.19.1.windows.1

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