Re: [edk2] [PATCH 00/13] Extend secure variable service to be usable from Standalone MM

2019-01-02 Thread Jagadeesh Ujja
hi Ard

On Wed, Jan 2, 2019 at 10:45 PM Ard Biesheuvel
 wrote:
>
> On Thu, 20 Dec 2018 at 15:23, Gao, Liming  wrote:
> >
> > Jagadeesh:
> >   MdeModulePkg Variable service/Fault tolerant/Nor Flash driver depends on 
> > StandaloneMmServicesTableLib library class header file. This header file is 
> > added into MdePkg. It has two interfaces. One is global gMmst, another is 
> > function InMm(). So, there is no dependency issue here.
> > And, MdePkg adds one StandaloneMmServicesTableLib library INF with empty 
> > implementation, this library is just for build. It sets gMmst=NULL, and 
> > always return FASLE in InMm(). This library can be used in MdeModulePkg.dsc 
> > to make Variable driver pass build. There is also no dependency issue here. 
> > Last, Platform DSC file will refer to the real StandaloneMmServicesTableLib 
> > library INF from StandaloneMmPkg.
> >
>
> I think we should avoid the need for InMm() altogether for standalone
> MM. It will always return TRUE for standalone MM modules, and it will
> always return FALSE for other modules, so the distinction should be
> made at build time.
>
> This means that we need to refactor the SMM 'server' modules and/or
> libraries so that any code they cannot share (like boot services
> invocations) are only included in the classic SMM versions.
>
> I have pushed my own prototype code here:
> https://github.com/ardbiesheuvel/edk2/commits/standalone-mm
>
> There is some overlap with Jagadeesh's work. I will work with him
> directly to resolve this before posting any new revisions.
>
InMm()”  and “PcdStandaloneMmVariableEnabled” are defined to reuse the
existing code as much as possible.
Initially I have done separate copy of the file to avoid “if..else”
but had a comment about “duplicating code primarily due to the
maintenance overhead”

So we are using “InMm()” and “PcdStandaloneMmVariableEnabled” PCD flag
and trying to use the same code as much as possible.

The patchset “Extend secure variable service to be usable from
Standalone MM” as POC was submitted as RFC patches on “October 31,
2018”.
Subsequent comments are fixed and we had 7 version of the patch set
under review.

Thanks
Jagadeesh

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


Re: [edk2] [PATCH v2 10/11] SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Jagadeesh Ujja
On Thu, Jan 3, 2019 at 6:45 AM Zhang, Chao B  wrote:
>
> Reviewed-by : Chao Zhang 

Hi Chao Zhang,

Thanks for the review, I will not be having any new changes with this
specific patch.
Can you please merge this patch, so that I will not resubmit with
other patch set

Thanks
Jagadeesh
>
> -Original Message-
> From: Jagadeesh Ujja [mailto:jagadeesh.u...@arm.com]
> Sent: Wednesday, January 2, 2019 9:14 PM
> To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Chao 
> B ; leif.lindh...@linaro.org; 
> ard.biesheu...@linaro.org; achin.gu...@arm.com; supreeth.venkat...@arm.com; 
> Wang, Jian J 
> Subject: [PATCH v2 10/11] SecurityPkg/AuthVariableLib: allow MM_STANDALONE 
> drivers to use this library
>
> “AuthVariableLib” library can be used by MM_STANDALONE drivers as well.
> So add MM_STANDALONE as the module type this library supports.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jagadeesh Ujja 
> Reviewed-by: Chao Zhang 
> ---
>  SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
> b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> index 572ba4e..4294d3b 100644
> --- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> +++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> @@ -2,6 +2,7 @@
>  #  Provides authenticated variable services.
>  #
>  #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2018, ARM Limited. All rights reserved.
>  #
>  #  This program and the accompanying materials  #  are licensed and made 
> available under the terms and conditions @@ -21,12 +22,12 @@
>FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
>MODULE_TYPE= DXE_RUNTIME_DRIVER
>VERSION_STRING = 1.0
> -  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER
> +  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER MM_STANDALONE
>
>  #
>  # The following information is for reference only and not required by the 
> build tools.
>  #
> -#  VALID_ARCHITECTURES   = IA32 X64
> +#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
>  #
>
>  [Sources]
> --
> 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


Re: [edk2] [PATCH 25/26] CryptoPkg/BaseCryptLib: drop build flags specific to GCC44

2019-01-02 Thread Wang, Jian J


Reviewed-by: Jian J Wang 

> -Original Message-
> From: Laszlo Ersek [mailto:ler...@redhat.com]
> Sent: Thursday, January 03, 2019 10:48 AM
> To: edk2-devel-01 
> Cc: Wei, Gang ; Wang, Jian J ;
> Ye, Ting 
> Subject: [PATCH 25/26] CryptoPkg/BaseCryptLib: drop build flags specific to
> GCC44
> 
> We've removed BaseTools support for GCC44..GCC47. Drop
> CryptoPkg/BaseCryptLib build flags that are specific to any of those gcc
> versions.
> 
> No GCC44..GCC47 references remain under CryptoPkg after this patch.
> 
> Cc: Gang Wei 
> Cc: Jian Wang 
> Cc: Ting Ye 
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek 
> ---
> 
> Notes:
> Build tested with:
> 
> (
>   set -e
>   for INF in CryptoPkg/Library/BaseCryptLib/*.inf; do
> build -t GCC48 -a IA32 -b DEBUG -p CryptoPkg/CryptoPkg.dsc \
>   -m "$INF"
>   done
> )
> 
>  CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf| 2 --
>  CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 2 --
>  CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 2 --
>  CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 -
>  4 files changed, 7 deletions(-)
> 
> diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> index f29445ce3402..0d81db2fbd7f 100644
> --- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
> @@ -96,8 +96,6 @@ [BuildOptions]
>#
>MSFT:*_*_*_CC_FLAGS = /wd4090
> 
> -  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-
> D__declspec(t)=__attribute__((t))"
> -
># -JCryptoPkg/Include : To disable the use of the system includes provided 
> by
> RVCT
># --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
> without a
> newline"
>RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
> diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> index e7b4b2f61855..4bcf064c5623 100644
> --- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
> @@ -93,8 +93,6 @@ [BuildOptions]
>#
>MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4718
> 
> -  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-
> D__declspec(t)=__attribute__((t))"
> -
># -JCryptoPkg/Include : To disable the use of the system includes provided 
> by
> RVCT
># --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
> without a
> newline"
>RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
> diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> index 32628c8835a6..a6e433f6ced1 100644
> --- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
> @@ -102,8 +102,6 @@ [BuildOptions]
>#
>MSFT:*_*_*_CC_FLAGS = /wd4090
> 
> -  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-
> D__declspec(t)=__attribute__((t))"
> -
># -JCryptoPkg/Include : To disable the use of the system includes provided 
> by
> RVCT
># --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
> without a
> newline"
>RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
> diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> index 4829669c1f3f..c34699cd62bf 100644
> --- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> +++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
> @@ -100,5 +100,4 @@ [BuildOptions]
>#
>MSFT:*_*_*_CC_FLAGS = /wd4090
> 
> -  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" "-
> D__declspec(t)=__attribute__((t))"
>XCODE:*_*_*_CC_FLAGS = -mmmx -msse
> --
> 2.19.1.3.g30247aa5d201
> 

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


[edk2] [PATCH 26/26] Revert "MdePkg: avoid __builtin_unreachable() on GCC v4.4"

2019-01-02 Thread Laszlo Ersek
This reverts commit 357cec385d4f ("MdePkg: avoid __builtin_unreachable()
on GCC v4.4", 2016-07-21).

We've removed BaseTools support for GCC44..GCC47, therefore we need not
catch the GCC44 corner case for __builtin_unreachable().

No GCC44..GCC47 references remain under MdePkg after this patch.

Cc: Ard Biesheuvel 
Cc: Liming Gao 
Cc: Marvin Haeuser 
Cc: Michael D Kinney 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Signed-off-by: Laszlo Ersek 
---

Notes:
I build-tested this change by building ArmVirtQemu with the GCC5
toolchain (gcc-6.1.1), and OVMF with the GCC48 toolchain (gcc-4.8.5).

Namely, the PeiCore() function [MdeModulePkg/Core/Pei/PeiMain/PeiMain.c]
and the DxeMain() function [MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c]
use UNREACHABLE().

 MdePkg/Include/Base.h | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h
index bc877d8125a5..d6b04baeaf8b 100644
--- a/MdePkg/Include/Base.h
+++ b/MdePkg/Include/Base.h
@@ -112,11 +112,10 @@ VERIFY_SIZE_OF (__VERIFY_UINT32_ENUM_SIZE, 4);
 // warnings.
 //
 #ifndef UNREACHABLE
-  #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ > 4)
+  #ifdef __GNUC__
 ///
 /// Signal compilers and analyzers that this call is not reachable.  It is
 /// up to the compiler to remove any code past that point.
-/// Not implemented by GCC 4.4 or earlier.
 ///
 #define UNREACHABLE()  __builtin_unreachable ()
   #elif defined (__has_feature)
-- 
2.19.1.3.g30247aa5d201

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


[edk2] [PATCH 24/26] ArmPkg/ArmSoftFloatLib: drop build flags specific to GCC46/GCC47

2019-01-02 Thread Laszlo Ersek
We've removed BaseTools support for GCC44..GCC47. Drop
ArmPkg/ArmSoftFloatLib build flags that are specific to any of those gcc
versions. (See also commit 01627dba0911, "ArmPkg/ArmSoftfloatLib: restrict
-fno-tree-vrp option to GCC46 and GCC47", 2015-12-15).

No GCC44..GCC47 references remain under ArmPkg after this patch.

Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
Build-tested with a 32-bit ArmVirtQemu build, with -D
SECURE_BOOT_ENABLE, using the GCC5 toolchain. Such a build consumes
ArmSoftFloatLib via OpensslLib.

 ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf | 2 --
 1 file changed, 2 deletions(-)

diff --git a/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf 
b/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
index 3c76381b25dc..9c4cd62b3dd9 100644
--- a/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
+++ b/ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf
@@ -49,6 +49,4 @@ [Packages]
 
 [BuildOptions]
   GCC:*_*_*_CC_FLAGS = -DSOFTFLOAT_FOR_GCC -Wno-enum-compare -fno-lto
-  *_GCC46_*_CC_FLAGS = -fno-tree-vrp
-  *_GCC47_*_CC_FLAGS = -fno-tree-vrp
   RVCT:*_*_*_CC_FLAGS = -DSOFTFLOAT_FOR_GCC
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 23/26] BaseTools/tools_def.template: remove GCC44 documentation

2019-01-02 Thread Laszlo Ersek
No GCC44 definitions or remarks exist at this point, so remove the GCC44
documentation too, from "tools_def.template".

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 6 --
 1 file changed, 6 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 5afbb4ff2743..4d74816837ab 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -343,12 +343,6 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
-#   GCC44   -Linux,Windows-  Requires:
-# GCC 4.4 targeting x86_64-linux-gnu
-#Optional:
-# Required to build platforms or ACPI tables:
-#   Intel(r) ACPI Compiler from
-#   https://acpica.org/downloads
 #   GCC48   -Linux,Windows-  Requires:
 # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
 #Optional:
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 25/26] CryptoPkg/BaseCryptLib: drop build flags specific to GCC44

2019-01-02 Thread Laszlo Ersek
We've removed BaseTools support for GCC44..GCC47. Drop
CryptoPkg/BaseCryptLib build flags that are specific to any of those gcc
versions.

No GCC44..GCC47 references remain under CryptoPkg after this patch.

Cc: Gang Wei 
Cc: Jian Wang 
Cc: Ting Ye 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
Build tested with:

(
  set -e
  for INF in CryptoPkg/Library/BaseCryptLib/*.inf; do
build -t GCC48 -a IA32 -b DEBUG -p CryptoPkg/CryptoPkg.dsc \
  -m "$INF"
  done
)

 CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf| 2 --
 CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf | 2 --
 CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf | 2 --
 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 1 -
 4 files changed, 7 deletions(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
index f29445ce3402..0d81db2fbd7f 100644
--- a/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/BaseCryptLib.inf
@@ -96,8 +96,6 @@ [BuildOptions]
   #
   MSFT:*_*_*_CC_FLAGS = /wd4090
 
-  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" 
"-D__declspec(t)=__attribute__((t))"
-
   # -JCryptoPkg/Include : To disable the use of the system includes provided 
by RVCT
   # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
without a newline"
   RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
diff --git a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
index e7b4b2f61855..4bcf064c5623 100644
--- a/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/PeiCryptLib.inf
@@ -93,8 +93,6 @@ [BuildOptions]
   #
   MSFT:*_*_*_CC_FLAGS = /wd4090 /wd4718
 
-  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" 
"-D__declspec(t)=__attribute__((t))"
-
   # -JCryptoPkg/Include : To disable the use of the system includes provided 
by RVCT
   # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
without a newline"
   RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
diff --git a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
index 32628c8835a6..a6e433f6ced1 100644
--- a/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/RuntimeCryptLib.inf
@@ -102,8 +102,6 @@ [BuildOptions]
   #
   MSFT:*_*_*_CC_FLAGS = /wd4090
 
-  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" 
"-D__declspec(t)=__attribute__((t))"
-
   # -JCryptoPkg/Include : To disable the use of the system includes provided 
by RVCT
   # --diag_remark=1 : Reduce severity of "#1-D: last line of file ends 
without a newline"
   RVCT:*_*_ARM_CC_FLAGS = -JCryptoPkg/Include --diag_remark=1
diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index 4829669c1f3f..c34699cd62bf 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -100,5 +100,4 @@ [BuildOptions]
   #
   MSFT:*_*_*_CC_FLAGS = /wd4090
 
-  GCC:*_GCC44_IA32_CC_FLAGS = "-D__cdecl=__attribute__((cdecl))" 
"-D__declspec(t)=__attribute__((t))"
   XCODE:*_*_*_CC_FLAGS = -mmmx -msse
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 19/26] BaseTools/tools_def.template: rename GCC44_ALL_CC_FLAGS to GCC48_ALL_CC_FLAGS

2019-01-02 Thread Laszlo Ersek
GCC44_ALL_CC_FLAGS is only referenced by:
- GCC48_IA32_CC_FLAGS,
- GCC48_X64_CC_FLAGS,
- GCC49_AARCH64_CC_FLAGS,
- CLANG38_ALL_CC_FLAGS.

Thus, we can rename ("raise") it to GCC48_ALL_CC_FLAGS.

(It's easier to review this patch with "git show --word-diff".)

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 91f1b1d04e02..b3fbb73f4853 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4139,12 +4139,12 @@ DEFINE GCC_X64_RC_FLAGS= -I binary -O 
elf64-x86-64-B i386
 DEFINE GCC_ARM_RC_FLAGS= -I binary -O elf32-littlearm -B arm   
  --rename-section .data=.hii
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
-DEFINE GCC44_ALL_CC_FLAGS= -g -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections 
-fdata-sections -include AutoGen.h -fno-common 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
+DEFINE GCC48_ALL_CC_FLAGS= -g -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections 
-fdata-sections -include AutoGen.h -fno-common 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
 DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC44_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC44_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
 DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
@@ -4177,7 +4177,7 @@ DEFINE GCC49_ARM_ASM_FLAGS   = 
DEF(GCC48_ARM_ASM_FLAGS)
 DEFINE GCC49_AARCH64_ASM_FLAGS   = DEF(GCC48_AARCH64_ASM_FLAGS)
 DEFINE GCC49_ARM_CC_FLAGS= DEF(GCC48_ARM_CC_FLAGS)
 DEFINE GCC49_ARM_CC_XIPFLAGS = DEF(GCC48_ARM_CC_XIPFLAGS)
-DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC44_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
+DEFINE GCC49_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC48_ALL_CC_FLAGS) DEF(GCC_AARCH64_CC_FLAGS) -mcmodel=small
 DEFINE GCC49_AARCH64_CC_XIPFLAGS = DEF(GCC48_AARCH64_CC_XIPFLAGS)
 DEFINE GCC49_ARM_DLINK_FLAGS = DEF(GCC48_ARM_DLINK_FLAGS)
 DEFINE GCC49_ARM_DLINK2_FLAGS= DEF(GCC48_ARM_DLINK2_FLAGS)
@@ -4818,7 +4818,7 @@ DEFINE CLANG38_IA32_TARGET  = -target 
i686-pc-linux-gnu
 DEFINE CLANG38_X64_TARGET   = -target x86_64-pc-linux-gnu
 
 DEFINE CLANG38_WARNING_OVERRIDES= -Wno-parentheses-equality 
-Wno-tautological-compare -Wno-tautological-constant-out-of-range-compare 
-Wno-empty-body -Wno-unused-const-variable -Wno-varargs 
-Wno-unknown-warning-option
-DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC44_ALL_CC_FLAGS) 
DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address 
-Wno-shift-negative-value -Wno-unknown-pragmas 
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables 
-mno-sse -mno-mmx -msoft-float -mno-implicit-float  
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang 
-funsigned-char -fno-ms-extensions -Wno-null-dereference
+DEFINE CLANG38_ALL_CC_FLAGS = DEF(GCC48_ALL_CC_FLAGS) 
DEF(CLANG38_WARNING_OVERRIDES) -fno-stack-protector -mms-bitfields -Wno-address 
-Wno-shift-negative-value -Wno-unknown-pragmas 
-Wno-incompatible-library-redeclaration -fno-asynchronous-unwind-tables 
-mno-sse -mno-mmx -msoft-float -mno-implicit-float  
-ftrap-function=undefined_behavior_has_been_optimized_away_by_clang 
-funsigned-char 

[edk2] [PATCH 22/26] BaseTools/tools_def.template: remove comment about GCC44 + LzmaF86Compress

2019-01-02 Thread Laszlo Ersek
"tools_def.template" currently suggests, in the documentation of the
LzmaF86Compress utility, that said tool is generally unhelpful on binaries
built with the GCC44 toolchain, relative to LzmaCompress.

This statement doesn't apply to the GCC48 toolchain. I compressed 126
NOOPT_GCC48/IA32 unique EFI modules (built with gcc-4.8.5, as part of
OVMF) with both LzmaCompress and LzmaF86Compress. I repeated the same for
117 NOOPT_GCC48/X64 unique EFI modules. On average, the LzmaF86Compress
output size was 92.4% of the LzmaCompress output size in the IA32 case
(best relative compression: 86.01%, poorest relative compression: 97.47%
-- still a win). In the X64 case, the LzmaF86Compress output size was
92.95% of the LzmaCompress output size, on avarege (best relative
compression: 87.69%, poorest relative compression: 97.65% -- again, still
a win).

Given the consistent improvement from LzmaCompress to LzmaF86Compress,
remove the statement (rather than updating it to GCC48).

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 1 -
 1 file changed, 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index d1324d56a1a4..5afbb4ff2743 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -6588,7 +6588,6 @@ RELEASE_RVCTCYGWIN_ARM_CC_FLAGS  = "$(CCPATH_FLAG)" 
$(ARCHCC_FLAGS) $(PLATFORM_F
 ##
 # LzmaF86Compress tool definitions with converter for x86 code.
 # It can improve the compression ratio if the input file is IA32 or X64 PE 
image.
-# Notes: If X64 PE image is built based on GCC44, it may not get the better 
compression.
 ##
 *_*_*_LZMAF86_PATH = LzmaF86Compress
 *_*_*_LZMAF86_GUID = D42AE6BD-1352-4bfb-909A-CA72A6EAE889
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 20/26] BaseTools/tools_def.template: eliminate GCC44_IA32_X64_DLINK_FLAGS

2019-01-02 Thread Laszlo Ersek
GCC48_IA32_X64_DLINK_FLAGS is defined *wholly* as
GCC44_IA32_X64_DLINK_FLAGS, therefore:

- expand the contents of GCC44_IA32_X64_DLINK_FLAGS into
  GCC48_IA32_X64_DLINK_FLAGS,

- re-point all references of GCC44_IA32_X64_DLINK_FLAGS to
  GCC48_IA32_X64_DLINK_FLAGS,

- remove GCC44_IA32_X64_DLINK_FLAGS.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index b3fbb73f4853..28e8f31cb9ee 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4141,14 +4141,13 @@ DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O 
elf64-littleaarch64 -B aarch64
 
 DEFINE GCC48_ALL_CC_FLAGS= -g -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections 
-fdata-sections -include AutoGen.h -fno-common 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
-DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 
 DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
 DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
+DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
 DEFINE GCC48_X64_DLINK2_FLAGS= -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC48_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 DEFINE GCC48_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 13/26] BaseTools/tools_def.template: remove GCC46 documentation

2019-01-02 Thread Laszlo Ersek
No GCC46 definitions exist at this point, so remove the GCC46
documentation too, from "tools_def.template".

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 6 --
 1 file changed, 6 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index dc43fed2b3ad..cb67a48e4ab5 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -361,12 +361,6 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
-#   GCC46   -Linux,Windows-  Requires:
-# GCC 4.6 targeting x86_64-linux-gnu
-#Optional:
-# Required to build platforms or ACPI tables:
-#   Intel(r) ACPI Compiler from
-#   https://acpica.org/downloads
 #   GCC48   -Linux,Windows-  Requires:
 # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
 #Optional:
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 18/26] BaseTools/tools_def.template: propagate loss of GCC44 references

2019-01-02 Thread Laszlo Ersek
The last patch decremented references on a number of DEFs. They can be
classified into three groups:

(a) those that remain used by multiple toolchains, or by multiple
definitions of a given toolchain (refcount >= 2):

- GCC_ASLCC_FLAGS
- GCC_ASLPP_FLAGS
- GCC_HOST_PREFIX
- GCC_IA32_RC_FLAGS
- GCC_PP_FLAGS
- GCC_VFRPP_FLAGS
- GCC_X64_RC_FLAGS
- IASL_FLAGS
- IASL_OUTFLAGS
- UNIX_IASL_BIN
- GCC44_IA32_X64_DLINK_FLAGS (!)

(b) those that are only used by GCC48 (refcount == 1):

- GCC44_ASM_FLAGS
- GCC44_IA32_CC_FLAGS
- GCC44_IA32_DLINK2_FLAGS
- GCC44_IA32_X64_ASLDLINK_FLAGS
- GCC44_X64_CC_FLAGS
- GCC44_X64_DLINK2_FLAGS
- GCC44_X64_DLINK_FLAGS

(c) those that are no longer used (refcount == 0):

- GCC44_IA32_PREFIX
- GCC44_X64_PREFIX

For the members of class (b), expand their definitions at the referring
sites, and remove their definitions.

For the members of class (c), remove their definitions.

(It's easier to review this patch with "git show --word-diff".)

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 24 ++--
 1 file changed, 7 insertions(+), 17 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 3596eac9e0e4..91f1b1d04e02 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -187,9 +187,6 @@ DEFINE CYGWIN_BIN  = c:/cygwin/bin
 DEFINE CYGWIN_BINIA32  = 
c:/cygwin/opt/tiano/i386-tiano-pe/i386-tiano-pe/bin/
 DEFINE CYGWIN_BINX64   = 
c:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc-mingw64/bin/
 
-DEFINE GCC44_IA32_PREFIX   = ENV(GCC44_BIN)
-DEFINE GCC44_X64_PREFIX= ENV(GCC44_BIN)
-
 DEFINE GCC48_IA32_PREFIX   = ENV(GCC48_BIN)
 DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN)
 
@@ -4143,24 +4140,17 @@ DEFINE GCC_ARM_RC_FLAGS= -I binary -O 
elf32-littlearm -B arm
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
 DEFINE GCC44_ALL_CC_FLAGS= -g -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections 
-fdata-sections -include AutoGen.h -fno-common 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
-DEFINE GCC44_IA32_CC_FLAGS   = DEF(GCC44_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables
-DEFINE GCC44_X64_CC_FLAGS= DEF(GCC44_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables
 DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
-DEFINE GCC44_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC44_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
-DEFINE GCC44_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC44_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
-DEFINE GCC44_X64_DLINK2_FLAGS= -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
-DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS) -Wno-address
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC44_X64_CC_FLAGS) -Wno-address
-DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC44_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC44_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
-DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC44_IA32_DLINK2_FLAGS)
-DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
-DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
-DEFINE GCC48_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
+DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
+DEFINE GCC48_X64_DLINK2_FLAGS= 

[edk2] [PATCH 17/26] BaseTools/tools_def.template: remove GCC44 leaf definitions

2019-01-02 Thread Laszlo Ersek
Remove the "leaf" definitions for GCC44. These definitions are never
referenced in "tools_def.template", so their removal can't break other
definitions. Instead, their erasure turns other definitions into leaves
(subject to further removal).

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 76 
 1 file changed, 76 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index bd530c73e216..3596eac9e0e4 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4284,82 +4284,6 @@ DEFINE GCC5_AARCH64_ASLDLINK_FLAGS   = 
DEF(GCC49_AARCH64_ASLDLINK_FLAGS)
 *_UNIXGCC_X64_OBJCOPY_FLAGS =
 *_UNIXGCC_X64_NASM_FLAGS= -f win64
 
-
-#
-# GCC 4.4 - This configuration is used to compile under Linux to produce
-#   PE/COFF binaries using GCC 4.4.
-#
-
-*_GCC44_*_*_FAMILY   = GCC
-
-*_GCC44_*_MAKE_PATH= DEF(GCC_HOST_PREFIX)make
-*_GCC44_*_*_DLL= ENV(GCC44_DLL)
-*_GCC44_*_ASL_PATH = DEF(UNIX_IASL_BIN)
-
-*_GCC44_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
-*_GCC44_*_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS)
-*_GCC44_*_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS)
-*_GCC44_*_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS)
-*_GCC44_*_APP_FLAGS= DEF(GCC_PP_FLAGS)
-*_GCC44_*_ASL_FLAGS= DEF(IASL_FLAGS)
-*_GCC44_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-
-##
-# GCC44 IA32 definitions
-##
-*_GCC44_IA32_OBJCOPY_PATH = DEF(GCC44_IA32_PREFIX)objcopy
-*_GCC44_IA32_CC_PATH  = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_SLINK_PATH   = DEF(GCC44_IA32_PREFIX)ar
-*_GCC44_IA32_DLINK_PATH   = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_ASLDLINK_PATH= DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_ASM_PATH = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_PP_PATH  = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_VFRPP_PATH   = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_ASLCC_PATH   = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_ASLPP_PATH   = DEF(GCC44_IA32_PREFIX)gcc
-*_GCC44_IA32_RC_PATH  = DEF(GCC44_IA32_PREFIX)objcopy
-
-*_GCC44_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC44_IA32_ASLDLINK_FLAGS   = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_i386
-*_GCC44_IA32_ASM_FLAGS= DEF(GCC44_ASM_FLAGS) -m32 --32 -march=i386
-*_GCC44_IA32_DLINK_FLAGS  = DEF(GCC44_IA32_X64_DLINK_FLAGS) 
-Wl,-m,elf_i386,--oformat=elf32-i386
-*_GCC44_IA32_DLINK2_FLAGS = DEF(GCC44_IA32_DLINK2_FLAGS)
-*_GCC44_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
-*_GCC44_IA32_OBJCOPY_FLAGS=
-*_GCC44_IA32_NASM_FLAGS   = -f elf32
-
-  DEBUG_GCC44_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS) -Os
-RELEASE_GCC44_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS) -Os
-  NOOPT_GCC44_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS) -O0
-
-##
-# GCC44 X64 definitions
-##
-*_GCC44_X64_OBJCOPY_PATH = DEF(GCC44_X64_PREFIX)objcopy
-*_GCC44_X64_CC_PATH  = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_SLINK_PATH   = DEF(GCC44_X64_PREFIX)ar
-*_GCC44_X64_DLINK_PATH   = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_ASLDLINK_PATH= DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_ASM_PATH = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_PP_PATH  = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_VFRPP_PATH   = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_ASLCC_PATH   = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_ASLPP_PATH   = DEF(GCC44_X64_PREFIX)gcc
-*_GCC44_X64_RC_PATH  = DEF(GCC44_X64_PREFIX)objcopy
-
-*_GCC44_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC44_X64_ASLDLINK_FLAGS   = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_x86_64
-*_GCC44_X64_ASM_FLAGS= DEF(GCC44_ASM_FLAGS) -m64 --64 -melf_x86_64
-*_GCC44_X64_DLINK_FLAGS  = DEF(GCC44_X64_DLINK_FLAGS)
-*_GCC44_X64_DLINK2_FLAGS = DEF(GCC44_X64_DLINK2_FLAGS)
-*_GCC44_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
-*_GCC44_X64_OBJCOPY_FLAGS=
-*_GCC44_X64_NASM_FLAGS   = -f elf64
-
-  DEBUG_GCC44_X64_CC_FLAGS   = DEF(GCC44_X64_CC_FLAGS) -Os
-RELEASE_GCC44_X64_CC_FLAGS   = DEF(GCC44_X64_CC_FLAGS) -Os
-  NOOPT_GCC44_X64_CC_FLAGS   = DEF(GCC44_X64_CC_FLAGS) -O0
-
 

 #
 # GCC 4.8 - This configuration is used to compile under Linux to produce

[edk2] [PATCH 21/26] BaseTools/tools_def.template: rename GCC44_IA32_X64_DLINK_COMMON to GCC48_IA32_X64_DLINK_COMMON

2019-01-02 Thread Laszlo Ersek
GCC44_IA32_X64_DLINK_COMMON is only referenced by:
- GCC48_IA32_X64_ASLDLINK_FLAGS,
- GCC48_IA32_X64_DLINK_FLAGS.

Thus, we can rename ("raise") it to GCC48_IA32_X64_DLINK_COMMON.

(It's easier to review this patch with "git show --word-diff".)

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 7 +++
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 28e8f31cb9ee..d1324d56a1a4 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4140,12 +4140,11 @@ DEFINE GCC_ARM_RC_FLAGS= -I binary -O 
elf32-littlearm -B arm
 DEFINE GCC_AARCH64_RC_FLAGS= -I binary -O elf64-littleaarch64 -B 
aarch64 --rename-section .data=.hii
 
 DEFINE GCC48_ALL_CC_FLAGS= -g -fshort-wchar -fno-builtin 
-fno-strict-aliasing -Wall -Werror -Wno-array-bounds -ffunction-sections 
-fdata-sections -include AutoGen.h -fno-common 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
-DEFINE GCC44_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
-
+DEFINE GCC48_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x20
 DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC48_ALL_CC_FLAGS) -m32 
-march=i586 -malign-double -fno-stack-protector -D EFI32 
-fno-asynchronous-unwind-tables -Wno-address
 DEFINE GCC48_X64_CC_FLAGS= DEF(GCC48_ALL_CC_FLAGS) -m64 
-fno-stack-protector "-DEFIAPI=__attribute__((ms_abi))" 
-maccumulate-outgoing-args -mno-red-zone -Wno-address -mcmodel=small -fpie 
-fno-asynchronous-unwind-tables -Wno-address
-DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
-DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC48_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC48_IA32_DLINK2_FLAGS   = -Wl,--defsym=PECOFF_HEADER_SIZE=0x220 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC48_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
 DEFINE GCC48_X64_DLINK2_FLAGS= -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 16/26] BaseTools/tools_def.template: remove GCC45 documentation

2019-01-02 Thread Laszlo Ersek
No GCC45 definitions exist at this point, so remove the GCC45
documentation too, from "tools_def.template".

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 6 --
 1 file changed, 6 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index a848bfef700b..bd530c73e216 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -352,12 +352,6 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
-#   GCC45   -Linux,Windows-  Requires:
-# GCC 4.5 targeting x86_64-linux-gnu
-#Optional:
-# Required to build platforms or ACPI tables:
-#   Intel(r) ACPI Compiler from
-#   https://acpica.org/downloads
 #   GCC48   -Linux,Windows-  Requires:
 # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
 #Optional:
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 15/26] BaseTools/tools_def.template: propagate loss of GCC45 references

2019-01-02 Thread Laszlo Ersek
The last patch decremented references on a number of DEFs. They can be
classified into three groups:

(a) those that remain used by multiple toolchains (refcount >= 2):

- GCC_ASLCC_FLAGS
- GCC_ASLPP_FLAGS
- GCC_HOST_PREFIX
- GCC_IA32_RC_FLAGS
- GCC_PP_FLAGS
- GCC_VFRPP_FLAGS
- GCC_X64_RC_FLAGS
- IASL_FLAGS
- IASL_OUTFLAGS
- UNIX_IASL_BIN

(b) those that are only used by GCC48 (refcount == 1):

- GCC45_ASM_FLAGS
- GCC45_IA32_CC_FLAGS
- GCC45_IA32_DLINK2_FLAGS
- GCC45_IA32_X64_ASLDLINK_FLAGS
- GCC45_IA32_X64_DLINK_FLAGS
- GCC45_X64_CC_FLAGS
- GCC45_X64_DLINK2_FLAGS
- GCC45_X64_DLINK_FLAGS

(c) those that are no longer used (refcount == 0):

- GCC45_IA32_PREFIX
- GCC45_X64_PREFIX

For the members of class (b), expand their definitions at the referring
sites, and remove their definitions.

For the members of class (c), remove their definitions.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 28 ++--
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index cd6eb8124aad..a848bfef700b 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -190,9 +190,6 @@ DEFINE CYGWIN_BINX64   = 
c:/cygwin/opt/tiano/x86_64-pc-mingw64/x86_64-pc
 DEFINE GCC44_IA32_PREFIX   = ENV(GCC44_BIN)
 DEFINE GCC44_X64_PREFIX= ENV(GCC44_BIN)
 
-DEFINE GCC45_IA32_PREFIX   = ENV(GCC45_BIN)
-DEFINE GCC45_X64_PREFIX= ENV(GCC45_BIN)
-
 DEFINE GCC48_IA32_PREFIX   = ENV(GCC48_BIN)
 DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN)
 
@@ -4162,23 +4159,14 @@ DEFINE GCC44_X64_DLINK_FLAGS = 
DEF(GCC44_IA32_X64_DLINK_FLAGS) -Wl,-melf
 DEFINE GCC44_X64_DLINK2_FLAGS= -Wl,--defsym=PECOFF_HEADER_SIZE=0x228 
DEF(GCC_DLINK2_FLAGS_COMMON)
 DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
-DEFINE GCC45_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS)
-DEFINE GCC45_X64_CC_FLAGS= DEF(GCC44_X64_CC_FLAGS)
-DEFINE GCC45_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC45_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
-DEFINE GCC45_IA32_DLINK2_FLAGS   = DEF(GCC44_IA32_DLINK2_FLAGS)
-DEFINE GCC45_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
-DEFINE GCC45_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
-DEFINE GCC45_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
-
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Wno-address
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS) -Wno-address
-DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
-DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC45_IA32_DLINK2_FLAGS)
-DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
-DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
-DEFINE GCC48_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS) -Wno-address
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC44_X64_CC_FLAGS) -Wno-address
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
+DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC44_IA32_DLINK2_FLAGS)
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC44_X64_DLINK_FLAGS)
+DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
+DEFINE GCC48_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
 DEFINE GCC48_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 07/26] BaseTools/tools_def.template: remove GCC48_IA32_X64_DLINK_COMMON dead-end

2019-01-02 Thread Laszlo Ersek
DLINK_COMMON definitions are not consumed by "build_rule.template";
instead, DLINK_COMMON definitions (internal to "tools_def.template") were
invented for sharing options between ASLDLINK_FLAGS and DLINK_FLAGS.

However, this intent doesn't actually apply to
GCC48_IA32_X64_DLINK_COMMON: it is never consumed. Furthermore, the
GCC45..GCC47 instances of IA32_X64_DLINK_COMMON too lead up to
GCC48_IA32_X64_DLINK_COMMON only -- they form a dead-end. Remove them
altogether, in order to simplify the subsequent patches.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 4 
 1 file changed, 4 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 5df9438757bc..c14fcdf5f5e5 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4182,7 +4182,6 @@ DEFINE GCC44_ASM_FLAGS   = DEF(GCC_ASM_FLAGS)
 
 DEFINE GCC45_IA32_CC_FLAGS   = DEF(GCC44_IA32_CC_FLAGS)
 DEFINE GCC45_X64_CC_FLAGS= DEF(GCC44_X64_CC_FLAGS)
-DEFINE GCC45_IA32_X64_DLINK_COMMON   = DEF(GCC44_IA32_X64_DLINK_COMMON)
 DEFINE GCC45_IA32_X64_ASLDLINK_FLAGS = DEF(GCC44_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC45_IA32_X64_DLINK_FLAGS= DEF(GCC44_IA32_X64_DLINK_FLAGS)
 DEFINE GCC45_IA32_DLINK2_FLAGS   = DEF(GCC44_IA32_DLINK2_FLAGS)
@@ -4192,7 +4191,6 @@ DEFINE GCC45_ASM_FLAGS   = 
DEF(GCC44_ASM_FLAGS)
 
 DEFINE GCC46_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Wno-address
 DEFINE GCC46_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS) -Wno-address
-DEFINE GCC46_IA32_X64_DLINK_COMMON   = DEF(GCC45_IA32_X64_DLINK_COMMON)
 DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC46_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
 DEFINE GCC46_IA32_DLINK2_FLAGS   = DEF(GCC45_IA32_DLINK2_FLAGS)
@@ -4202,7 +4200,6 @@ DEFINE GCC46_ASM_FLAGS   = 
DEF(GCC45_ASM_FLAGS)
 
 DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
 DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
-DEFINE GCC47_IA32_X64_DLINK_COMMON   = DEF(GCC46_IA32_X64_DLINK_COMMON)
 DEFINE GCC47_IA32_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC47_IA32_X64_DLINK_FLAGS= DEF(GCC46_IA32_X64_DLINK_FLAGS)
 DEFINE GCC47_IA32_DLINK2_FLAGS   = DEF(GCC46_IA32_DLINK2_FLAGS)
@@ -4212,7 +4209,6 @@ DEFINE GCC47_ASM_FLAGS   = 
DEF(GCC46_ASM_FLAGS)
 
 DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
 DEFINE GCC48_X64_CC_FLAGS= DEF(GCC47_X64_CC_FLAGS)
-DEFINE GCC48_IA32_X64_DLINK_COMMON   = DEF(GCC47_IA32_X64_DLINK_COMMON)
 DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS)
 DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC47_IA32_X64_DLINK_FLAGS)
 DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC47_IA32_DLINK2_FLAGS)
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 09/26] BaseTools/tools_def.template: propagate loss of GCC47 references

2019-01-02 Thread Laszlo Ersek
The last patch decremented references on a number of DEFs. They can be
classified into three groups:

(a) those that remain used by multiple toolchains (refcount >= 2):

- GCC_ASLCC_FLAGS
- GCC_ASLPP_FLAGS
- GCC_HOST_PREFIX
- GCC_IA32_RC_FLAGS
- GCC_PP_FLAGS
- GCC_VFRPP_FLAGS
- GCC_X64_RC_FLAGS
- IASL_FLAGS
- IASL_OUTFLAGS
- UNIX_IASL_BIN

(b) those that are only used by GCC48 (refcount == 1):

- GCC47_ASM_FLAGS
- GCC47_IA32_CC_FLAGS
- GCC47_IA32_DLINK2_FLAGS
- GCC47_IA32_X64_ASLDLINK_FLAGS
- GCC47_IA32_X64_DLINK_FLAGS
- GCC47_X64_CC_FLAGS
- GCC47_X64_DLINK2_FLAGS
- GCC47_X64_DLINK_FLAGS

(c) those that are no longer used (refcount == 0):

- GCC47_IA32_PREFIX
- GCC47_X64_PREFIX

For the members of class (b), expand their definitions at the referring
sites, and remove their definitions.

For the members of class (c), remove their definitions.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 28 ++--
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 32b263913814..adde159d7677 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -196,9 +196,6 @@ DEFINE GCC45_X64_PREFIX= ENV(GCC45_BIN)
 DEFINE GCC46_IA32_PREFIX   = ENV(GCC46_BIN)
 DEFINE GCC46_X64_PREFIX= ENV(GCC46_BIN)
 
-DEFINE GCC47_IA32_PREFIX   = ENV(GCC47_BIN)
-DEFINE GCC47_X64_PREFIX= ENV(GCC47_BIN)
-
 DEFINE GCC48_IA32_PREFIX   = ENV(GCC48_BIN)
 DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN)
 
@@ -4198,23 +4195,14 @@ DEFINE GCC46_X64_DLINK_FLAGS = 
DEF(GCC45_X64_DLINK_FLAGS)
 DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
 DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
 
-DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
-DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
-DEFINE GCC47_IA32_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC47_IA32_X64_DLINK_FLAGS= DEF(GCC46_IA32_X64_DLINK_FLAGS)
-DEFINE GCC47_IA32_DLINK2_FLAGS   = DEF(GCC46_IA32_DLINK2_FLAGS)
-DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
-DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
-DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
-
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC47_X64_CC_FLAGS)
-DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC47_IA32_X64_DLINK_FLAGS)
-DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC47_IA32_DLINK2_FLAGS)
-DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC47_X64_DLINK_FLAGS)
-DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC47_X64_DLINK2_FLAGS)
-DEFINE GCC48_ASM_FLAGS   = DEF(GCC47_ASM_FLAGS)
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC46_IA32_X64_DLINK_FLAGS)
+DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC46_IA32_DLINK2_FLAGS)
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
+DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
+DEFINE GCC48_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
 DEFINE GCC48_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 05/26] BaseTools/tools_def.template: fix up LF-only line terminator

2019-01-02 Thread Laszlo Ersek
"tools_def.template" should only use CRLF line terminators, at this time.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Fixes: 88e8498f8a72cff1f7af6852ec8166772913399e
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index a2ab9680b0aa..0869e8d8c73e 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4235,7 +4235,7 @@ DEFINE GCC48_AARCH64_ASLDLINK_FLAGS  = 
DEF(GCC_AARCH64_ASLDLINK_FLAGS)
 DEFINE GCC49_IA32_CC_FLAGS   = DEF(GCC48_IA32_CC_FLAGS)
 DEFINE GCC49_X64_CC_FLAGS= DEF(GCC48_X64_CC_FLAGS)
 DEFINE GCC49_IA32_X64_DLINK_COMMON   = -nostdlib -Wl,-n,-q,--gc-sections -z 
common-page-size=0x40
-DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) 
-Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
+DEFINE GCC49_IA32_X64_ASLDLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_COMMON) 
-Wl,--defsym=PECOFF_HEADER_SIZE=0 DEF(GCC_DLINK2_FLAGS_COMMON) 
-Wl,--entry,ReferenceAcpiTable -u ReferenceAcpiTable
 DEFINE GCC49_IA32_X64_DLINK_FLAGS= DEF(GCC49_IA32_X64_DLINK_COMMON) 
-Wl,--entry,$(IMAGE_ENTRY_POINT) -u $(IMAGE_ENTRY_POINT) 
-Wl,-Map,$(DEST_DIR_DEBUG)/$(BASE_NAME).map,--whole-archive
 DEFINE GCC49_IA32_DLINK2_FLAGS   = DEF(GCC48_IA32_DLINK2_FLAGS)
 DEFINE GCC49_X64_DLINK_FLAGS = DEF(GCC49_IA32_X64_DLINK_FLAGS) 
-Wl,-melf_x86_64,--oformat=elf64-x86-64,-pie
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 03/26] Vlv2TbltDevicePkg: assume GCC48 or later

2019-01-02 Thread Laszlo Ersek
We're about to remove BaseTools support for GCC44..GCC47. Bump the
assumption about the minimum gcc version to GCC48 in
"Vlv2TbltDevicePkg/bld_vlv.sh".

No GCC44..GCC47 references remain under Vlv2TbltDevicePkg after this
patch.

Cc: Zailiang Sun 
Cc: Yi Qian 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
Untested.

 Vlv2TbltDevicePkg/bld_vlv.sh | 14 +-
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/Vlv2TbltDevicePkg/bld_vlv.sh b/Vlv2TbltDevicePkg/bld_vlv.sh
index 538b3ef9d730..51d3acacb48b 100755
--- a/Vlv2TbltDevicePkg/bld_vlv.sh
+++ b/Vlv2TbltDevicePkg/bld_vlv.sh
@@ -179,23 +179,11 @@ sed -i '/^MAX_CONCURRENT_THREAD_NUMBER/d' Conf/target.txt
 
 gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
 case $gcc_version in
-4.5.*)
-  TARGET_TOOLS=GCC45
-  ;;
-4.6.*)
-  TARGET_TOOLS=GCC46
-  ;;
-4.7.*)
-  TARGET_TOOLS=GCC47
-  ;;
-4.8.*)
-  TARGET_TOOLS=GCC48
-  ;;
 4.9.*|4.1[0-9].*|5.*.*|6.*.*)
   TARGET_TOOLS=GCC49
   ;;
 *)
-  TARGET_TOOLS=GCC44
+  TARGET_TOOLS=GCC48
   ;;
 esac
 
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 06/26] BaseTools/tools_def.template: strip trailing whitespace

2019-01-02 Thread Laszlo Ersek
Whitespace just before line terminators is useless, remove it.

("git show -b" produces a null diff for this patch.)

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 108 ++--
 1 file changed, 54 insertions(+), 54 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 0869e8d8c73e..5df9438757bc 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -429,7 +429,7 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Intel C Compiler V9.1
 #Dependencies:
 # Microsoft Visual Studio 2003 or 2005
-# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) 
+# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK)
 # version 3790.1830 for X64 target architectures
 #Optional:
 # Required to build EBC drivers:
@@ -441,7 +441,7 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Intel C Compiler V11.1
 #Dependencies:
 # Microsoft Visual Studio 2005 or 2008
-# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) 
+# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK)
 # version 3790.1830 for X64 target architectures
 #Optional:
 # Required to build EBC drivers:
@@ -541,7 +541,7 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Intel C Compiler V9.1
 #Dependencies:
 # Microsoft Visual Studio 2003 or 2005
-# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) 
+# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK)
 # version 3790.1830 for X64 target architectures
 #Optional:
 # Required to build EBC drivers:
@@ -553,7 +553,7 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Intel C Compiler V11.1
 #Dependencies:
 # Microsoft Visual Studio 2005 or 2008
-# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) 
+# Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK)
 # version 3790.1830 for X64 target architectures
 #Optional:
 # Required to build EBC drivers:
@@ -569,21 +569,21 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 #   Intel(r) Compiler for Efi Byte Code (Intel(r) 
EBC Compiler)
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler (iasl.exe) from
-#   https://acpica.org/downloads 
+#   https://acpica.org/downloads
 #   VS2008x86   -win64-  Requires:
 # Microsoft Visual Studio 2008 (x86)
 # Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) version 3790.1830
 #Optional:
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler (iasl.exe) from
-#   https://acpica.org/downloads 
+#   https://acpica.org/downloads
 #   VS2010x86   -win64-  Requires:
 # Microsoft Visual Studio 2010 (x86) Premium 
Edition
 # Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) version 3790.1830
 #Optional:
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler (iasl.exe) from
-#   https://acpica.org/downloads 
+#   https://acpica.org/downloads
 #   VS2012x86   -win64-  Requires:
 # Microsoft Visual Studio 2012 (x86) Professional 
Edition
 # Microsoft Windows Server 2003 Driver Development 
Kit (Microsoft WINDDK) version 3790.1830
@@ -609,29 +609,29 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Intel C Compiler 

[edk2] [PATCH 14/26] BaseTools/tools_def.template: remove GCC45 leaf definitions

2019-01-02 Thread Laszlo Ersek
Remove the "leaf" definitions for GCC45. These definitions are never
referenced in "tools_def.template" (they are the last GCC45 mentions in
the file), so their removal can't break other definitions. Instead, their
erasure turns other definitions into leaves (subject to further removal).

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 76 
 1 file changed, 76 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index cb67a48e4ab5..cd6eb8124aad 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4378,82 +4378,6 @@ RELEASE_GCC44_IA32_CC_FLAGS   = 
DEF(GCC44_IA32_CC_FLAGS) -Os
 RELEASE_GCC44_X64_CC_FLAGS   = DEF(GCC44_X64_CC_FLAGS) -Os
   NOOPT_GCC44_X64_CC_FLAGS   = DEF(GCC44_X64_CC_FLAGS) -O0
 
-
-#
-# GCC 4.5 - This configuration is used to compile under Linux to produce
-#   PE/COFF binaries using GCC 4.5.
-#
-
-*_GCC45_*_*_FAMILY   = GCC
-
-*_GCC45_*_MAKE_PATH= DEF(GCC_HOST_PREFIX)make
-*_GCC45_*_*_DLL= ENV(GCC45_DLL)
-*_GCC45_*_ASL_PATH = DEF(UNIX_IASL_BIN)
-
-*_GCC45_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
-*_GCC45_*_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS)
-*_GCC45_*_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS)
-*_GCC45_*_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS)
-*_GCC45_*_APP_FLAGS=
-*_GCC45_*_ASL_FLAGS= DEF(IASL_FLAGS)
-*_GCC45_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-
-##
-# GCC45 IA32 definitions
-##
-*_GCC45_IA32_OBJCOPY_PATH = DEF(GCC45_IA32_PREFIX)objcopy
-*_GCC45_IA32_CC_PATH  = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_SLINK_PATH   = DEF(GCC45_IA32_PREFIX)ar
-*_GCC45_IA32_DLINK_PATH   = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_ASLDLINK_PATH= DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_ASM_PATH = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_PP_PATH  = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_VFRPP_PATH   = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_ASLCC_PATH   = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_ASLPP_PATH   = DEF(GCC45_IA32_PREFIX)gcc
-*_GCC45_IA32_RC_PATH  = DEF(GCC45_IA32_PREFIX)objcopy
-
-*_GCC45_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC45_IA32_ASLDLINK_FLAGS   = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_i386
-*_GCC45_IA32_ASM_FLAGS= DEF(GCC45_ASM_FLAGS) -m32 --32 -march=i386
-*_GCC45_IA32_DLINK_FLAGS  = DEF(GCC45_IA32_X64_DLINK_FLAGS) 
-Wl,-m,elf_i386,--oformat=elf32-i386
-*_GCC45_IA32_DLINK2_FLAGS = DEF(GCC45_IA32_DLINK2_FLAGS)
-*_GCC45_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
-*_GCC45_IA32_OBJCOPY_FLAGS=
-*_GCC45_IA32_NASM_FLAGS   = -f elf32
-
-  DEBUG_GCC45_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Os
-RELEASE_GCC45_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Os
-  NOOPT_GCC45_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -O0
-
-##
-# GCC45 X64 definitions
-##
-*_GCC45_X64_OBJCOPY_PATH = DEF(GCC45_X64_PREFIX)objcopy
-*_GCC45_X64_CC_PATH  = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_SLINK_PATH   = DEF(GCC45_X64_PREFIX)ar
-*_GCC45_X64_DLINK_PATH   = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_ASLDLINK_PATH= DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_ASM_PATH = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_PP_PATH  = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_VFRPP_PATH   = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_ASLCC_PATH   = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_ASLPP_PATH   = DEF(GCC45_X64_PREFIX)gcc
-*_GCC45_X64_RC_PATH  = DEF(GCC45_X64_PREFIX)objcopy
-
-*_GCC45_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC45_X64_ASLDLINK_FLAGS   = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_x86_64
-*_GCC45_X64_ASM_FLAGS= DEF(GCC45_ASM_FLAGS) -m64 --64 -melf_x86_64
-*_GCC45_X64_DLINK_FLAGS  = DEF(GCC45_X64_DLINK_FLAGS)
-*_GCC45_X64_DLINK2_FLAGS = DEF(GCC45_X64_DLINK2_FLAGS)
-*_GCC45_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
-*_GCC45_X64_OBJCOPY_FLAGS=
-*_GCC45_X64_NASM_FLAGS   = -f elf64
-
-  DEBUG_GCC45_X64_CC_FLAGS   = DEF(GCC45_X64_CC_FLAGS) -Os
-RELEASE_GCC45_X64_CC_FLAGS   = DEF(GCC45_X64_CC_FLAGS) -Os
-  NOOPT_GCC45_X64_CC_FLAGS   = DEF(GCC45_X64_CC_FLAGS) -O0
-
 

 #
 # GCC 4.8 

[edk2] [PATCH 10/26] BaseTools/tools_def.template: remove GCC47 documentation

2019-01-02 Thread Laszlo Ersek
No GCC47 definitions exist at this point, so remove the GCC47
documentation too, from "tools_def.template".

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 6 --
 1 file changed, 6 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index adde159d7677..67cba281539e 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -370,12 +370,6 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
-#   GCC47   -Linux,Windows-  Requires:
-# GCC 4.7 targeting x86_64-linux-gnu
-#Optional:
-# Required to build platforms or ACPI tables:
-#   Intel(r) ACPI Compiler from
-#   https://acpica.org/downloads
 #   GCC48   -Linux,Windows-  Requires:
 # GCC 4.8 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
 #Optional:
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 02/26] OvmfPkg: require GCC48 or later

2019-01-02 Thread Laszlo Ersek
We're about to remove BaseTools support for GCC44..GCC47. Reject those gcc
versions cleanly in "OvmfPkg/build.sh". In "OvmfPkg/README", upgrade any
mentions of the same gcc versions to GCC48.

No GCC44..GCC47 references remain under OvmfPkg after this patch.

Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Jordan Justen 
Cc: Julien Grall 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
I tested that, after this patch, "build.sh" successfully builds OvmfPkg
with GCC48. I did no runtime tests, nor did I test the rejection path
with any of gcc-4.4 through gcc-4.7.

 OvmfPkg/README   |  6 +++---
 OvmfPkg/build.sh | 16 ++--
 2 files changed, 5 insertions(+), 17 deletions(-)

diff --git a/OvmfPkg/README b/OvmfPkg/README
index 7415419d2dd7..68ce0750af19 100644
--- a/OvmfPkg/README
+++ b/OvmfPkg/README
@@ -115,8 +115,8 @@ $ OvmfPkg/build.sh -a X64 qemu
 And to run a 64-bit UEFI bootable ISO image:
 $ OvmfPkg/build.sh -a X64 qemu -cdrom /path/to/disk-image.iso
 
-To build a 32-bit OVMF without debug messages using GCC 4.5:
-$ OvmfPkg/build.sh -a IA32 -b RELEASE -t GCC45
+To build a 32-bit OVMF without debug messages using GCC 4.8:
+$ OvmfPkg/build.sh -a IA32 -b RELEASE -t GCC48
 
 === SMM support ===
 
@@ -406,7 +406,7 @@ volume image.
 
 If you build with the UNIXGCC toolchain, then debugging will be disabled
 due to larger image sizes being produced by the UNIXGCC toolchain. The
-first choice recommendation is to use GCC44 or newer instead.
+first choice recommendation is to use GCC48 or newer instead.
 
 If you must use UNIXGCC, then you can override the build options for
 particular libraries and modules in the .dsc to re-enable debugging
diff --git a/OvmfPkg/build.sh b/OvmfPkg/build.sh
index 682155202564..6821742e7acd 100755
--- a/OvmfPkg/build.sh
+++ b/OvmfPkg/build.sh
@@ -83,22 +83,10 @@ case `uname` in
   Linux*)
 gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
 case $gcc_version in
-  [1-3].*|4.[0-3].*)
-echo OvmfPkg requires GCC4.4 or later
+  [1-3].*|4.[0-7].*)
+echo OvmfPkg requires GCC4.8 or later
 exit 1
 ;;
-  4.4.*)
-TARGET_TOOLS=GCC44
-;;
-  4.5.*)
-TARGET_TOOLS=GCC45
-;;
-  4.6.*)
-TARGET_TOOLS=GCC46
-;;
-  4.7.*)
-TARGET_TOOLS=GCC47
-;;
   4.8.*)
 TARGET_TOOLS=GCC48
 ;;
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 12/26] BaseTools/tools_def.template: propagate loss of GCC46 references

2019-01-02 Thread Laszlo Ersek
The last patch decremented references on a number of DEFs. They can be
classified into three groups:

(a) those that remain used by multiple toolchains (refcount >= 2):

- GCC_ASLCC_FLAGS
- GCC_ASLPP_FLAGS
- GCC_HOST_PREFIX
- GCC_IA32_RC_FLAGS
- GCC_PP_FLAGS
- GCC_VFRPP_FLAGS
- GCC_X64_RC_FLAGS
- IASL_FLAGS
- IASL_OUTFLAGS
- UNIX_IASL_BIN

(b) those that are only used by GCC48 (refcount == 1):

- GCC46_ASM_FLAGS
- GCC46_IA32_CC_FLAGS
- GCC46_IA32_DLINK2_FLAGS
- GCC46_IA32_X64_ASLDLINK_FLAGS
- GCC46_IA32_X64_DLINK_FLAGS
- GCC46_X64_CC_FLAGS
- GCC46_X64_DLINK2_FLAGS
- GCC46_X64_DLINK_FLAGS

(c) those that are no longer used (refcount == 0):

- GCC46_IA32_PREFIX
- GCC46_X64_PREFIX

For the members of class (b), expand their definitions at the referring
sites, and remove their definitions.

For the members of class (c), remove their definitions.

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 28 ++--
 1 file changed, 8 insertions(+), 20 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index d345050aa844..dc43fed2b3ad 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -193,9 +193,6 @@ DEFINE GCC44_X64_PREFIX= ENV(GCC44_BIN)
 DEFINE GCC45_IA32_PREFIX   = ENV(GCC45_BIN)
 DEFINE GCC45_X64_PREFIX= ENV(GCC45_BIN)
 
-DEFINE GCC46_IA32_PREFIX   = ENV(GCC46_BIN)
-DEFINE GCC46_X64_PREFIX= ENV(GCC46_BIN)
-
 DEFINE GCC48_IA32_PREFIX   = ENV(GCC48_BIN)
 DEFINE GCC48_X64_PREFIX= ENV(GCC48_BIN)
 
@@ -4180,23 +4177,14 @@ DEFINE GCC45_X64_DLINK_FLAGS = 
DEF(GCC44_X64_DLINK_FLAGS)
 DEFINE GCC45_X64_DLINK2_FLAGS= DEF(GCC44_X64_DLINK2_FLAGS)
 DEFINE GCC45_ASM_FLAGS   = DEF(GCC44_ASM_FLAGS)
 
-DEFINE GCC46_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Wno-address
-DEFINE GCC46_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS) -Wno-address
-DEFINE GCC46_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC46_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
-DEFINE GCC46_IA32_DLINK2_FLAGS   = DEF(GCC45_IA32_DLINK2_FLAGS)
-DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
-DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
-DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
-
-DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
-DEFINE GCC48_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
-DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS)
-DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC46_IA32_X64_DLINK_FLAGS)
-DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC46_IA32_DLINK2_FLAGS)
-DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
-DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
-DEFINE GCC48_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
+DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC45_IA32_CC_FLAGS) -Wno-address
+DEFINE GCC48_X64_CC_FLAGS= DEF(GCC45_X64_CC_FLAGS) -Wno-address
+DEFINE GCC48_IA32_X64_ASLDLINK_FLAGS = DEF(GCC45_IA32_X64_ASLDLINK_FLAGS)
+DEFINE GCC48_IA32_X64_DLINK_FLAGS= DEF(GCC45_IA32_X64_DLINK_FLAGS)
+DEFINE GCC48_IA32_DLINK2_FLAGS   = DEF(GCC45_IA32_DLINK2_FLAGS)
+DEFINE GCC48_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
+DEFINE GCC48_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
+DEFINE GCC48_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
 DEFINE GCC48_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
 DEFINE GCC48_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 04/26] BaseTools/Conf/tools_def.template: drop ARM/AARCH support from GCC46/GCC47

2019-01-02 Thread Laszlo Ersek
From: Ard Biesheuvel 

This drops ARM and AARCH64 support from the GCC46 and GCC47 toolchain
definitions, which are on the list to be removed, along with VS2003,
VS2005, VS2008, VS2010, DDK3790, UNIXGCC, GCC44, GCC45, ELFGCC, CYGGCC,
ICC, ICC11 and MYTOOLS.

Since GCC46 and GCC47 are the only ones on that list that support ARM
and/or AARCH64, let's give Liming a hand and cover the ARM side of
things first, so that everything that remains to be removed is x86
only.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
Reviewed-by: Leif Lindholm 
Reviewed-by: Laszlo Ersek 
Reviewed-by: Liming Gao 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Cc: Ard Biesheuvel 
Cc: Leif Lindholm 
Cc: Liming Gao 
[ler...@redhat.com: add bugzilla reference and CCs]
Signed-off-by: Laszlo Ersek 
---

Notes:
This is a verbatim forward / repost of Ard's "[edk2] [PATCH]
BaseTools/Conf/tools_def.template: drop ARM/AARCH support from
GCC46/GCC47" at

<20181208093242.3313-1-ard.biesheuvel@linaro.org">http://mid.mail-archive.com/20181208093242.3313-1-ard.biesheuvel@linaro.org>,
with the feedback tags picked up from the list. I've also added a
bugzilla reference (as documented near the end of the commit message).

 BaseTools/Conf/tools_def.template | 143 ++--
 1 file changed, 14 insertions(+), 129 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index f7eb87af14c2..a2ab9680b0aa 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -368,13 +368,13 @@ DEFINE DTC_BIN = ENV(DTC_PREFIX)dtc
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
 #   GCC46   -Linux,Windows-  Requires:
-# GCC 4.6 targeting x86_64-linux-gnu or 
arm-linux-gnueabi
+# GCC 4.6 targeting x86_64-linux-gnu
 #Optional:
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
 #   https://acpica.org/downloads
 #   GCC47   -Linux,Windows-  Requires:
-# GCC 4.7 targeting x86_64-linux-gnu, 
aarch64-linux-gnu, or arm-linux-gnueabi
+# GCC 4.7 targeting x86_64-linux-gnu
 #Optional:
 # Required to build platforms or ACPI tables:
 #   Intel(r) ACPI Compiler from
@@ -4199,12 +4199,6 @@ DEFINE GCC46_IA32_DLINK2_FLAGS   = 
DEF(GCC45_IA32_DLINK2_FLAGS)
 DEFINE GCC46_X64_DLINK_FLAGS = DEF(GCC45_X64_DLINK_FLAGS)
 DEFINE GCC46_X64_DLINK2_FLAGS= DEF(GCC45_X64_DLINK2_FLAGS)
 DEFINE GCC46_ASM_FLAGS   = DEF(GCC45_ASM_FLAGS)
-DEFINE GCC46_ARM_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC46_ARM_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ARM_CC_FLAGS) -fstack-protector -mword-relocations
-DEFINE GCC46_ARM_CC_XIPFLAGS = -D__ARM_FEATURE_UNALIGNED=0
-DEFINE GCC46_ARM_DLINK_FLAGS = DEF(GCC_ARM_DLINK_FLAGS) 
-Wl,--oformat=elf32-littlearm
-DEFINE GCC46_ARM_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
-Wl,--defsym=PECOFF_HEADER_SIZE=0x220
-DEFINE GCC46_ARM_ASLDLINK_FLAGS  = DEF(GCC_ARM_ASLDLINK_FLAGS) 
-Wl,--oformat=elf32-littlearm
 
 DEFINE GCC47_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS)
 DEFINE GCC47_X64_CC_FLAGS= DEF(GCC46_X64_CC_FLAGS)
@@ -4215,18 +4209,6 @@ DEFINE GCC47_IA32_DLINK2_FLAGS   = 
DEF(GCC46_IA32_DLINK2_FLAGS)
 DEFINE GCC47_X64_DLINK_FLAGS = DEF(GCC46_X64_DLINK_FLAGS)
 DEFINE GCC47_X64_DLINK2_FLAGS= DEF(GCC46_X64_DLINK2_FLAGS)
 DEFINE GCC47_ASM_FLAGS   = DEF(GCC46_ASM_FLAGS)
-DEFINE GCC47_ARM_ASM_FLAGS   = DEF(GCC46_ARM_ASM_FLAGS)
-DEFINE GCC47_AARCH64_ASM_FLAGS   = $(ARCHASM_FLAGS) $(PLATFORM_FLAGS) 
DEF(GCC_ASM_FLAGS) -mlittle-endian
-DEFINE GCC47_ARM_CC_FLAGS= DEF(GCC46_ARM_CC_FLAGS)
-DEFINE GCC47_ARM_CC_XIPFLAGS = DEF(GCC_ARM_CC_XIPFLAGS)
-DEFINE GCC47_AARCH64_CC_FLAGS= $(ARCHCC_FLAGS) $(PLATFORM_FLAGS) 
-mcmodel=large DEF(GCC_AARCH64_CC_FLAGS)
-DEFINE GCC47_AARCH64_CC_XIPFLAGS = DEF(GCC_AARCH64_CC_XIPFLAGS)
-DEFINE GCC47_ARM_DLINK_FLAGS = DEF(GCC46_ARM_DLINK_FLAGS)
-DEFINE GCC47_ARM_DLINK2_FLAGS= DEF(GCC46_ARM_DLINK2_FLAGS)
-DEFINE GCC47_AARCH64_DLINK_FLAGS = DEF(GCC_AARCH64_DLINK_FLAGS)
-DEFINE GCC47_AARCH64_DLINK2_FLAGS= DEF(GCC_DLINK2_FLAGS_COMMON) 
-Wl,--defsym=PECOFF_HEADER_SIZE=0x228
-DEFINE GCC47_ARM_ASLDLINK_FLAGS  = DEF(GCC46_ARM_ASLDLINK_FLAGS)
-DEFINE GCC47_AARCH64_ASLDLINK_FLAGS  = DEF(GCC_AARCH64_ASLDLINK_FLAGS)
 
 DEFINE GCC48_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS)
 DEFINE GCC48_X64_CC_FLAGS= 

[edk2] [PATCH 01/26] EmulatorPkg: require GCC48 or later

2019-01-02 Thread Laszlo Ersek
We're about to remove BaseTools support for GCC44..GCC47. Reject those gcc
versions cleanly in "EmulatorPkg/build.sh", and drop build flags too that
are specific to them.

No GCC44..GCC47 references remain under EmulatorPkg after this patch.

Cc: Andrew Fish 
Cc: Jordan Justen 
Cc: Ruiyu Ni 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---

Notes:
I tested that, after this patch, "build.sh" successfully builds
EmulatorPkg with GCC48. I did no runtime tests, nor did I test the
rejection path with any of gcc-4.4 through gcc-4.7.

 EmulatorPkg/Unix/Host/Host.inf |  4 
 EmulatorPkg/build.sh   | 18 +++---
 2 files changed, 3 insertions(+), 19 deletions(-)

diff --git a/EmulatorPkg/Unix/Host/Host.inf b/EmulatorPkg/Unix/Host/Host.inf
index 9bcdfd85332b..6db269842e1b 100644
--- a/EmulatorPkg/Unix/Host/Host.inf
+++ b/EmulatorPkg/Unix/Host/Host.inf
@@ -124,10 +124,6 @@ [BuildOptions]
GCC:*_*_X64_DLINK_FLAGS == -o $(BIN_DIR)/Host -m64 -L/usr/X11R6/lib
GCC:*_GCC5_X64_DLINK_FLAGS == -flto -o $(BIN_DIR)/Host -m64 -L/usr/X11R6/lib
GCC:*_*_X64_CC_FLAGS == -m64 -g -fshort-wchar -fno-strict-aliasing -Wall 
-malign-double -idirafter/usr/include -c -include $(DEST_DIR_DEBUG)/AutoGen.h 
-DSTRING_ARRAY_NAME=$(BASE_NAME)Strings
-   GCC:*_GCC44_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
-   GCC:*_GCC45_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
-   GCC:*_GCC46_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
-   GCC:*_GCC47_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC48_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC49_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))"
GCC:*_GCC5_X64_CC_FLAGS = "-DEFIAPI=__attribute__((ms_abi))" -flto 
-DUSING_LTO -Os
diff --git a/EmulatorPkg/build.sh b/EmulatorPkg/build.sh
index 9ed59387d197..2ddcd421 100755
--- a/EmulatorPkg/build.sh
+++ b/EmulatorPkg/build.sh
@@ -48,7 +48,7 @@ PLATFORMFILE=
 LAST_ARG=
 RUN_EMULATOR=no
 CLEAN_TYPE=none
-TARGET_TOOLS=GCC44
+TARGET_TOOLS=GCC48
 NETWORK_SUPPORT=
 BUILD_NEW_SHELL=
 BUILD_FAT=
@@ -93,22 +93,10 @@ case `uname` in
 
 gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
 case $gcc_version in
-  [1-3].*|4.[0-3].*)
-echo EmulatorPkg requires GCC4.4 or later
+  [1-3].*|4.[0-7].*)
+echo EmulatorPkg requires GCC4.8 or later
 exit 1
 ;;
-  4.4.*)
-TARGET_TOOLS=GCC44
-;;
-  4.5.*)
-TARGET_TOOLS=GCC45
-;;
-  4.6.*)
-TARGET_TOOLS=GCC46
-;;
-  4.7.*)
-TARGET_TOOLS=GCC47
-;;
   4.8.*)
 TARGET_TOOLS=GCC48
 ;;
-- 
2.19.1.3.g30247aa5d201


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


[edk2] [PATCH 11/26] BaseTools/tools_def.template: remove GCC46 leaf definitions

2019-01-02 Thread Laszlo Ersek
Remove the "leaf" definitions for GCC46. These definitions are never
referenced in "tools_def.template" (they are the last GCC46 mentions in
the file), so their removal can't break other definitions. Instead, their
erasure turns other definitions into leaves (subject to further removal).

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 76 
 1 file changed, 76 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index 67cba281539e..d345050aa844 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4472,82 +4472,6 @@ RELEASE_GCC45_IA32_CC_FLAGS   = 
DEF(GCC45_IA32_CC_FLAGS) -Os
 RELEASE_GCC45_X64_CC_FLAGS   = DEF(GCC45_X64_CC_FLAGS) -Os
   NOOPT_GCC45_X64_CC_FLAGS   = DEF(GCC45_X64_CC_FLAGS) -O0
 
-
-#
-# GCC 4.6 - This configuration is used to compile under Linux to produce
-#   PE/COFF binaries using GCC 4.6.
-#
-
-*_GCC46_*_*_FAMILY   = GCC
-
-*_GCC46_*_MAKE_PATH= DEF(GCC_HOST_PREFIX)make
-*_GCC46_*_*_DLL= ENV(GCC46_DLL)
-*_GCC46_*_ASL_PATH = DEF(UNIX_IASL_BIN)
-
-*_GCC46_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
-*_GCC46_*_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS)
-*_GCC46_*_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS)
-*_GCC46_*_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS)
-*_GCC46_*_APP_FLAGS=
-*_GCC46_*_ASL_FLAGS= DEF(IASL_FLAGS)
-*_GCC46_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-
-##
-# GCC46 IA32 definitions
-##
-*_GCC46_IA32_OBJCOPY_PATH = DEF(GCC46_IA32_PREFIX)objcopy
-*_GCC46_IA32_CC_PATH  = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_SLINK_PATH   = DEF(GCC46_IA32_PREFIX)ar
-*_GCC46_IA32_DLINK_PATH   = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_ASLDLINK_PATH= DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_ASM_PATH = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_PP_PATH  = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_VFRPP_PATH   = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_ASLCC_PATH   = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_ASLPP_PATH   = DEF(GCC46_IA32_PREFIX)gcc
-*_GCC46_IA32_RC_PATH  = DEF(GCC46_IA32_PREFIX)objcopy
-
-*_GCC46_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC46_IA32_ASLDLINK_FLAGS   = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_i386
-*_GCC46_IA32_ASM_FLAGS= DEF(GCC46_ASM_FLAGS) -m32 -march=i386
-*_GCC46_IA32_DLINK_FLAGS  = DEF(GCC46_IA32_X64_DLINK_FLAGS) 
-Wl,-m,elf_i386,--oformat=elf32-i386
-*_GCC46_IA32_DLINK2_FLAGS = DEF(GCC46_IA32_DLINK2_FLAGS)
-*_GCC46_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
-*_GCC46_IA32_OBJCOPY_FLAGS=
-*_GCC46_IA32_NASM_FLAGS   = -f elf32
-
-  DEBUG_GCC46_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS) -Os
-RELEASE_GCC46_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS) -Os 
-Wno-unused-but-set-variable
-  NOOPT_GCC46_IA32_CC_FLAGS   = DEF(GCC46_IA32_CC_FLAGS) -O0
-
-##
-# GCC46 X64 definitions
-##
-*_GCC46_X64_OBJCOPY_PATH = DEF(GCC46_X64_PREFIX)objcopy
-*_GCC46_X64_CC_PATH  = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_SLINK_PATH   = DEF(GCC46_X64_PREFIX)ar
-*_GCC46_X64_DLINK_PATH   = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_ASLDLINK_PATH= DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_ASM_PATH = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_PP_PATH  = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_VFRPP_PATH   = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_ASLCC_PATH   = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_ASLPP_PATH   = DEF(GCC46_X64_PREFIX)gcc
-*_GCC46_X64_RC_PATH  = DEF(GCC46_X64_PREFIX)objcopy
-
-*_GCC46_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC46_X64_ASLDLINK_FLAGS   = DEF(GCC46_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_x86_64
-*_GCC46_X64_ASM_FLAGS= DEF(GCC46_ASM_FLAGS) -m64 -melf_x86_64
-*_GCC46_X64_DLINK_FLAGS  = DEF(GCC46_X64_DLINK_FLAGS)
-*_GCC46_X64_DLINK2_FLAGS = DEF(GCC46_X64_DLINK2_FLAGS)
-*_GCC46_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
-*_GCC46_X64_OBJCOPY_FLAGS=
-*_GCC46_X64_NASM_FLAGS   = -f elf64
-
-  DEBUG_GCC46_X64_CC_FLAGS   = DEF(GCC46_X64_CC_FLAGS) -Os
-RELEASE_GCC46_X64_CC_FLAGS   = DEF(GCC46_X64_CC_FLAGS) -Os 
-Wno-unused-but-set-variable
-  NOOPT_GCC46_X64_CC_FLAGS   = DEF(GCC46_X64_CC_FLAGS) -O0
-
 

[edk2] [PATCH 08/26] BaseTools/tools_def.template: remove GCC47 leaf definitions

2019-01-02 Thread Laszlo Ersek
Remove the "leaf" definitions for GCC47. These definitions are never
referenced in "tools_def.template" (they are the last GCC47 mentions in
the file), so their removal can't break other definitions. Instead, their
erasure turns other definitions into leaves (subject to further removal).

Cc: Bob Feng 
Cc: Liming Gao 
Cc: Yonghong Zhu 
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1377
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek 
---
 BaseTools/Conf/tools_def.template | 76 
 1 file changed, 76 deletions(-)

diff --git a/BaseTools/Conf/tools_def.template 
b/BaseTools/Conf/tools_def.template
index c14fcdf5f5e5..32b263913814 100755
--- a/BaseTools/Conf/tools_def.template
+++ b/BaseTools/Conf/tools_def.template
@@ -4566,82 +4566,6 @@ RELEASE_GCC46_IA32_CC_FLAGS   = 
DEF(GCC46_IA32_CC_FLAGS) -Os -Wno-unused-but
 RELEASE_GCC46_X64_CC_FLAGS   = DEF(GCC46_X64_CC_FLAGS) -Os 
-Wno-unused-but-set-variable
   NOOPT_GCC46_X64_CC_FLAGS   = DEF(GCC46_X64_CC_FLAGS) -O0
 
-
-#
-# GCC 4.7 - This configuration is used to compile under Linux to produce
-#   PE/COFF binaries using GCC 4.7.
-#
-
-*_GCC47_*_*_FAMILY   = GCC
-
-*_GCC47_*_MAKE_PATH= DEF(GCC_HOST_PREFIX)make
-*_GCC47_*_*_DLL= ENV(GCC47_DLL)
-*_GCC47_*_ASL_PATH = DEF(UNIX_IASL_BIN)
-
-*_GCC47_*_PP_FLAGS = DEF(GCC_PP_FLAGS)
-*_GCC47_*_ASLPP_FLAGS  = DEF(GCC_ASLPP_FLAGS)
-*_GCC47_*_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS)
-*_GCC47_*_VFRPP_FLAGS  = DEF(GCC_VFRPP_FLAGS)
-*_GCC47_*_APP_FLAGS=
-*_GCC47_*_ASL_FLAGS= DEF(IASL_FLAGS)
-*_GCC47_*_ASL_OUTFLAGS = DEF(IASL_OUTFLAGS)
-
-##
-# GCC47 IA32 definitions
-##
-*_GCC47_IA32_OBJCOPY_PATH = DEF(GCC47_IA32_PREFIX)objcopy
-*_GCC47_IA32_CC_PATH  = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_SLINK_PATH   = DEF(GCC47_IA32_PREFIX)ar
-*_GCC47_IA32_DLINK_PATH   = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_ASLDLINK_PATH= DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_ASM_PATH = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_PP_PATH  = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_VFRPP_PATH   = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_ASLCC_PATH   = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_ASLPP_PATH   = DEF(GCC47_IA32_PREFIX)gcc
-*_GCC47_IA32_RC_PATH  = DEF(GCC47_IA32_PREFIX)objcopy
-
-*_GCC47_IA32_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m32
-*_GCC47_IA32_ASLDLINK_FLAGS   = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_i386
-*_GCC47_IA32_ASM_FLAGS= DEF(GCC47_ASM_FLAGS) -m32 -march=i386
-*_GCC47_IA32_DLINK_FLAGS  = DEF(GCC47_IA32_X64_DLINK_FLAGS) 
-Wl,-m,elf_i386,--oformat=elf32-i386
-*_GCC47_IA32_DLINK2_FLAGS = DEF(GCC47_IA32_DLINK2_FLAGS)
-*_GCC47_IA32_RC_FLAGS = DEF(GCC_IA32_RC_FLAGS)
-*_GCC47_IA32_OBJCOPY_FLAGS=
-*_GCC47_IA32_NASM_FLAGS   = -f elf32
-
-  DEBUG_GCC47_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS) -Os
-RELEASE_GCC47_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS) -Os 
-Wno-unused-but-set-variable
-  NOOPT_GCC47_IA32_CC_FLAGS   = DEF(GCC47_IA32_CC_FLAGS) -O0
-
-##
-# GCC47 X64 definitions
-##
-*_GCC47_X64_OBJCOPY_PATH = DEF(GCC47_X64_PREFIX)objcopy
-*_GCC47_X64_CC_PATH  = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_SLINK_PATH   = DEF(GCC47_X64_PREFIX)ar
-*_GCC47_X64_DLINK_PATH   = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_ASLDLINK_PATH= DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_ASM_PATH = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_PP_PATH  = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_VFRPP_PATH   = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_ASLCC_PATH   = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_ASLPP_PATH   = DEF(GCC47_X64_PREFIX)gcc
-*_GCC47_X64_RC_PATH  = DEF(GCC47_X64_PREFIX)objcopy
-
-*_GCC47_X64_ASLCC_FLAGS  = DEF(GCC_ASLCC_FLAGS) -m64
-*_GCC47_X64_ASLDLINK_FLAGS   = DEF(GCC47_IA32_X64_ASLDLINK_FLAGS) 
-Wl,-m,elf_x86_64
-*_GCC47_X64_ASM_FLAGS= DEF(GCC47_ASM_FLAGS) -m64
-*_GCC47_X64_DLINK_FLAGS  = DEF(GCC47_X64_DLINK_FLAGS)
-*_GCC47_X64_DLINK2_FLAGS = DEF(GCC47_X64_DLINK2_FLAGS)
-*_GCC47_X64_RC_FLAGS = DEF(GCC_X64_RC_FLAGS)
-*_GCC47_X64_OBJCOPY_FLAGS=
-*_GCC47_X64_NASM_FLAGS   = -f elf64
-
-  DEBUG_GCC47_X64_CC_FLAGS   = DEF(GCC47_X64_CC_FLAGS) -Os
-RELEASE_GCC47_X64_CC_FLAGS   = DEF(GCC47_X64_CC_FLAGS) -Os 
-Wno-unused-but-set-variable
-  NOOPT_GCC47_X64_CC_FLAGS   = DEF(GCC47_X64_CC_FLAGS) -O0
-
 

[edk2] [PATCH 00/26] remove the GCC44 through GCC47 toolchains

2019-01-02 Thread Laszlo Ersek
Repo:   https://github.com/lersek/edk2.git
Branch: drop_gcc44_gcc47_tiano1377

(0) This series is meant as an alternative to

  [edk2] [Patch 0/5] Remove unused tool chains in tools_def.template
  20181224150107.28624-1-liming.gao@intel.com">http://mid.mail-archive.com/20181224150107.28624-1-liming.gao@intel.com

Out of that series, patch #1 (from Ard) is included here, while patch #3
is reimplemented from scratch (making up the bulk of this series) in a
way that at least I would be capable of reviewing. The rest of the
patches from Liming's series (#2, #4, #5) are out of scope for me, and I
ask for them to be rebased on top of this series (if this one is
acceptable).

Thus, this series intends to address

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

only in part.

(1) For locating GCC44 references, I used the following grep command:

  git grep -H -n -i -E 'gcc[- ]?4\.?[4567]'

That is,
- "gcc" (case-insensitively),
- optionally followed by hyphen or space,
- followed by "4",
- optionally followed by ".",
- followed by 4 through 7.

One hit that persists after this patch set is in
"AppPkg/Applications/Python/Python-2.7.2/Lib/distutils/tests/test_unixccompiler.py".
It's a bundled software distribution so I didn't touch it.

Another hit that remains is "StdLib/Include/sys/EfiCdefs.h"; see (2) for
that.

(2) __GNUC_PREREQ__ is used in StdLib/Include. But StdLib/Include checks
for ancient GCC versions too (such as 2.0), so it clearly hasn't been
kept in sync with the minimum edk2 requirement over time. I didn't touch
it.

(3) __GNUC_MINOR__ is used in the following directories:

(3a) bundled Python:

- AppPkg/Applications/Python/PyMod-2.7.2
- AppPkg/Applications/Python/Python-2.7.10
- AppPkg/Applications/Python/Python-2.7.2

(3b) bundled Brotli:

- BaseTools/Source/C/BrotliCompress/include/brotli
- MdeModulePkg/Library/BrotliCustomDecompressLib/brotli/

(3c) bundled LZMA:

- BaseTools/Source/C/LzmaCompress/Sdk/C/
- IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/
- MdeModulePkg/Library/LzmaCustomDecompressLib/Sdk/C/

(3d) bundled Lua / Lua interface:

- StdLib/Include/Lua/

(3e) Same as (2):

- StdLib/Include/sys/EfiCdefs.h

(3f) bundled OpenSSL / OpenSSL interface:

- CryptoPkg/Library/Include/openssl/opensslconf.h

I didn't touch any of these.

(4) I built OVMF with GCC48, and ArmVirtQemu with GCC5, using "-n 1",
and compared the build logs, before/after.

(For the comparison, I first sorted the build logs: I didn't care about
the relative order between the commands, I just wanted the sets of
commands to be comparable. Sorting was necessary because even with "-n
1", modules weren't built in the same order, and that interfered with
diffing.)

The sorted logs were identical, except for any time stamps / durations
that had been logged.

Cc: Andrew Fish 
Cc: Anthony Perard 
Cc: Ard Biesheuvel 
Cc: Bob Feng 
Cc: Gang Wei 
Cc: Jian Wang 
Cc: Jordan Justen 
Cc: Julien Grall 
Cc: Leif Lindholm 
Cc: Liming Gao 
Cc: Marvin Haeuser 
Cc: Michael D Kinney 
Cc: Ruiyu Ni 
Cc: Ting Ye 
Cc: Yi Qian 
Cc: Yonghong Zhu 
Cc: Zailiang Sun 

Thanks,
Laszlo

Ard Biesheuvel (1):
  BaseTools/Conf/tools_def.template: drop ARM/AARCH support from
GCC46/GCC47

Laszlo Ersek (25):
  EmulatorPkg: require GCC48 or later
  OvmfPkg: require GCC48 or later
  Vlv2TbltDevicePkg: assume GCC48 or later
  BaseTools/tools_def.template: fix up LF-only line terminator
  BaseTools/tools_def.template: strip trailing whitespace
  BaseTools/tools_def.template: remove GCC48_IA32_X64_DLINK_COMMON
dead-end
  BaseTools/tools_def.template: remove GCC47 leaf definitions
  BaseTools/tools_def.template: propagate loss of GCC47 references
  BaseTools/tools_def.template: remove GCC47 documentation
  BaseTools/tools_def.template: remove GCC46 leaf definitions
  BaseTools/tools_def.template: propagate loss of GCC46 references
  BaseTools/tools_def.template: remove GCC46 documentation
  BaseTools/tools_def.template: remove GCC45 leaf definitions
  BaseTools/tools_def.template: propagate loss of GCC45 references
  BaseTools/tools_def.template: remove GCC45 documentation
  BaseTools/tools_def.template: remove GCC44 leaf definitions
  BaseTools/tools_def.template: propagate loss of GCC44 references
  BaseTools/tools_def.template: rename GCC44_ALL_CC_FLAGS to
GCC48_ALL_CC_FLAGS
  BaseTools/tools_def.template: eliminate GCC44_IA32_X64_DLINK_FLAGS
  BaseTools/tools_def.template: rename GCC44_IA32_X64_DLINK_COMMON to
GCC48_IA32_X64_DLINK_COMMON
  BaseTools/tools_def.template: remove comment about GCC44 +
LzmaF86Compress
  BaseTools/tools_def.template: remove GCC44 documentation
  ArmPkg/ArmSoftFloatLib: drop build flags specific to GCC46/GCC47
  CryptoPkg/BaseCryptLib: drop build flags specific to GCC44
  Revert "MdePkg: avoid __builtin_unreachable() on GCC v4.4"

 ArmPkg/Library/ArmSoftFloatLib/ArmSoftFloatLib.inf |   2 -
 BaseTools/Conf/tools_def.template  | 638 +++-
 

Re: [edk2] [PATCH v8] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC v4 and above Support.

2019-01-02 Thread Wu, Hao A
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> Ashish Singhal
> Sent: Wednesday, January 02, 2019 11:47 PM
> To: edk2-devel@lists.01.org
> Cc: Ashish Singhal
> Subject: [edk2] [PATCH v8] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC
> HC v4 and above Support.
> 
> Add SDMA, ADMA2 and 26b data length support.
> 
> If V4 64 bit address mode is supported in capabilities register,
> program controller to enable V4 host mode and use appropriate
> SDMA registers supporting 64 bit addresses.
> 
> If V4 64 bit address mode is supported in capabilities register,
> program controller to enable V4 host mode and use appropriate
> ADMA descriptors supporting 64 bit addresses.
> 
> If host controller version is above V4.0, enable ADMA2 with 26b data
> length support for better performance. HC 2 register is configured to
> use 26 bit data lengths and ADMA2 descriptors are configured appropriately.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1359
> 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Ashish Singhal 
> Reviewed-by: Hao Wu 

Thanks for the contribution.
Patch pushed at edk2 b5547b9ce97e80c3127682a2a5d4b9bd14af353e.

Best Regards,
Hao Wu

> ---
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c|   3 +-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c  |   5 +-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c |  22 +-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |   7 +-
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 328
> +
>  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  84 --
>  6 files changed, 366 insertions(+), 83 deletions(-)
>  mode change 100755 => 100644
> MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> 
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> old mode 100755
> new mode 100644
> index 2d3fb68..4ef849f
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> @@ -1,6 +1,7 @@
>  /** @file
>This file provides some helper functions which are specific for EMMC
> device.
> 
> +  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
>Copyright (c) 2015 - 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
> @@ -707,7 +708,7 @@ EmmcSwitchClockFreq (
>//
>// Convert the clock freq unit from MHz to KHz.
>//
> -  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private-
> >BaseClkFreq[Slot]);
> +  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private-
> >BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
>if (EFI_ERROR (Status)) {
>  return Status;
>}
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> index 68485c8..83e6bf0 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> @@ -1,6 +1,7 @@
>  /** @file
>This file provides some helper functions which are specific for SD card
> device.
> 
> +  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
>Copyright (c) 2015 - 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
> @@ -864,7 +865,7 @@ SdCardSetBusMode (
>  return Status;
>}
> 
> -  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private-
> >BaseClkFreq[Slot]);
> +  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, Private-
> >BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
>if (EFI_ERROR (Status)) {
>  return Status;
>}
> @@ -1064,7 +1065,7 @@ SdCardIdentification (
>  goto Error;
>}
> 
> -  SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot]);
> +  SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot], Private-
> >ControllerVersion[Slot]);
> 
>gBS->Stall (1000);
> 
> diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> index a87f8de..76c32a4 100644
> --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> @@ -4,6 +4,7 @@
> 
>It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use.
> 
> +  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
>Copyright (c) 2015 - 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
> @@ -62,7 +63,9 @@ SD_MMC_HC_PRIVATE_DATA gSdMmcPciHcTemplate = {
>{ // MaxCurrent
>  0,
>},
> -  0  

Re: [edk2] [PATCH 00/13] Extend secure variable service to be usable from Standalone MM

2019-01-02 Thread Wang, Jian J
Hi Jagadeesh,

Since those code are used in different drivers, a new library would be better. 
For
example, we could have a CommonMmServicesLibrary, in which following interfaces
are defined ((just for example)

EFI_STATUS
MmstLocateProtocol(
  IN  EFI_GUID  *Protocol,
  IN  VOID  *Registration, OPTIONAL
  OUT VOID  **Interface
  )
{
  EFI_STATUS  Status;

  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
Status = gSmst->SmmLocateProtocol (
  ,
  NULL,
  SarProtocol
  );
  } else {
Status = gMmst->MmLocateProtocol (
  ,
  NULL,
  SarProtocol
  );
  }

  return Status;
}

Then you can use MmstLocateProtocol() in FaultTolerantWriteDxe, Variable 
driver, etc.
This applies to other interfaces like InstallProtocolInterface, AllocatePage in 
SMM/MM
system table.

Regards,
Jian

> -Original Message-
> From: Jagadeesh Ujja [mailto:jagadeesh.u...@arm.com]
> Sent: Wednesday, January 02, 2019 9:19 PM
> To: Wang, Jian J 
> Cc: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Chao
> B ; leif.lindh...@linaro.org;
> ard.biesheu...@linaro.org
> Subject: Re: [edk2] [PATCH 00/13] Extend secure variable service to be usable
> from Standalone MM
> 
> hi Jian,
> 
> On Fri, Dec 21, 2018 at 8:27 AM Wang, Jian J  wrote:
> >
> > Jagadeesh,
> >
> > There're many places in this patch series where code similar to following is
> added.
> > It'd better to wrap them into module private functions or even a library, if
> necessary.
> > This can make the code cleaner (no if/else) and easier (central place) to
> maintain in
> > the future.
> >
> > +  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
> > +Status = gSmst->SmmLocateProtocol (
> > +  ,
> > +  NULL,
> > +  SarProtocol
> > +  );
> > +  } else {
> > +Status = gMmst->MmLocateProtocol (
> > +  ,
> > +  NULL,
> > +  SarProtocol
> > +  );
> > +  }
> >
> Thank you for your comment. This patch series try to reuse code as
> much as possible between MM and non-MM code. So, in some changes,
> if..else was used which helps to reuse most of the other bits of code.
> To address your comment, can you please let me know how we could avoid
> this if..else without duplicating the too much code. I am not clear
> about " module private functions or even a library" comment that you
> have made. Can you please help me with this.
> 
> Thanks,
> Jagadeesh.
> 
> > Regards,
> > Jian
> >
> >
> > > -Original Message-
> > > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > > Jagadeesh Ujja
> > > Sent: Friday, December 14, 2018 8:13 PM
> > > To: edk2-devel@lists.01.org; Gao, Liming ; Zhang,
> Chao
> > > B ; leif.lindh...@linaro.org;
> > > ard.biesheu...@linaro.org
> > > Subject: [edk2] [PATCH 00/13] Extend secure variable service to be usable
> from
> > > Standalone MM
> > >
> > > Changes since RFC v4:
> > > - Addressed all the comments from Liming Gao
> > >   - Added an additional PCD 'PcdStandaloneMmCodeEnabled' to indicate
> > > presence of StandaloneMM support.
> > >   - MdePkg.dec file updated to include StandaloneMmServiceTableLib and
> > > StandaloneMmRuntimeDxe library.
> > >   - Platform specific changes will be posted in a seperate patchset.
> > >   - AsmLfence wrapper function is supported for AArch64 platforms.
> > >   - All the patches in this series can be pulled from
> > > https://github.com/jagadeeshujja/edk2 (branch:
> topics/aarch64_secure_vars)
> > >
> > > Changes since RFC v3:
> > > - Addressed all the comments from Liming Gao
> > >   - Added a AArch64 implementation of AsmLfence which is a wrapper for
> > > MemoryFence. The changes in variable service driver in v3 of this
> > > patchset that used MemoryFence instead of AsmLfence have been
> removed.
> > >   - Added StandaloneMmServicesTableLib.h and StandaloneMmRuntimeDxe
> > > library into MdePkg.
> > >   - Renamed PcdStandaloneMmEnable as PcdStandaloneMmVariableEnabled
> and
> > > added to in to MdePkg.
> > >   - Now with above changes, edk2 packages don't need to depend on
> > > StandaloneMmPkg/StandaloneMmPkg.dec
> > > - Addressed comments from Ting Ye
> > >   - Removed the hacks in the v3 version.
> > >   - Will relook into the “TimerWrapp.c” file and add a appropriate
> > > implementation of this for MM Standalone mode code.
> > >
> > > Changes since RFC v2:
> > > - Added 'Contributed-under' tag, removed Change-ID tag and
> > >   maintained a single signed-off-by for the all the patches.
> > >
> > > Changes since RFC v1:
> > > - Addressed all the comments from Liming Gao
> > >   - Removed the use of #ifdef/#else/#endif and used a Pcd instead to
> > > select between MM and non-MM paths.
> > >   - Removed all 

Re: [edk2] [PATCH v2 10/11] SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Zhang, Chao B
Reviewed-by : Chao Zhang 


-Original Message-
From: Jagadeesh Ujja [mailto:jagadeesh.u...@arm.com] 
Sent: Wednesday, January 2, 2019 9:14 PM
To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Chao B 
; leif.lindh...@linaro.org; ard.biesheu...@linaro.org; 
achin.gu...@arm.com; supreeth.venkat...@arm.com; Wang, Jian J 

Subject: [PATCH v2 10/11] SecurityPkg/AuthVariableLib: allow MM_STANDALONE 
drivers to use this library

“AuthVariableLib” library can be used by MM_STANDALONE drivers as well.
So add MM_STANDALONE as the module type this library supports.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
Reviewed-by: Chao Zhang 
---
 SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
index 572ba4e..4294d3b 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
@@ -2,6 +2,7 @@
 #  Provides authenticated variable services.
 #
 #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials  #  are licensed and made 
available under the terms and conditions @@ -21,12 +22,12 @@
   FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
--
2.7.4

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


[edk2] [Patch] SecurityPkg/Tcg: Fix Warnings and Remarks reported by IASL

2019-01-02 Thread Zhang, Chao B
Addressed warnings and remarks reported by IASL.EXE. Some methods had
unused arguments. A method was returning a value when it should not.

Cc: Zhang Chao B 
Cc: Jiewen Yao 
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Thomas Rydman 
Signed-off-by: Zhang, Chao B 
---
 SecurityPkg/Tcg/Tcg2Smm/Tpm.asl | 140 
 SecurityPkg/Tcg/TcgSmm/Tpm.asl  |  26 
 2 files changed, 82 insertions(+), 84 deletions(-)

diff --git a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
index 471b6b1fa1..903252f7d7 100644
--- a/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
+++ b/SecurityPkg/Tcg/Tcg2Smm/Tpm.asl
@@ -158,72 +158,70 @@ DefinitionBlock (
   Method(_SRS,1,Serialized)
   {
 //
 // Do not configure Interrupt if IRQ Num is configured 0 by default
 //
-If (LEqual(IRQN, 0)) {
-  Return (0)
-}
-
-//
-// Update resource descriptor
-// Use the field name to identify the offsets in the argument
-// buffer and RES0 buffer.
-//
-CreateDWordField(Arg0, ^INTR._INT, IRQ0)
-CreateDWordField(RES0, ^INTR._INT, LIRQ)
-Store(IRQ0, LIRQ)
-Store(IRQ0, IRQN)
+If (LNotEqual(IRQN, 0)) {
+  //
+  // Update resource descriptor
+  // Use the field name to identify the offsets in the argument
+  // buffer and RES0 buffer.
+  //
+  CreateDWordField(Arg0, ^INTR._INT, IRQ0)
+  CreateDWordField(RES0, ^INTR._INT, LIRQ)
+  Store(IRQ0, LIRQ)
+  Store(IRQ0, IRQN)
 
-CreateBitField(Arg0, ^INTR._HE, ITRG)
-CreateBitField(RES0, ^INTR._HE, LTRG)
-Store(ITRG, LTRG)
+  CreateBitField(Arg0, ^INTR._HE, ITRG)
+  CreateBitField(RES0, ^INTR._HE, LTRG)
+  Store(ITRG, LTRG)
 
-CreateBitField(Arg0, ^INTR._LL, ILVL)
-CreateBitField(RES0, ^INTR._LL, LLVL)
-Store(ILVL, LLVL)
+  CreateBitField(Arg0, ^INTR._LL, ILVL)
+  CreateBitField(RES0, ^INTR._LL, LLVL)
+  Store(ILVL, LLVL)
 
-//
-// Update TPM FIFO PTP/TIS interface only, identified by 
TPM_INTERFACE_ID_x lowest
-// nibble.
-//  - FIFO interface as defined in PTP for TPM 2.0 is active
-//  - FIFO interface as defined in TIS1.3 is active
-//
-If (LOr(LEqual (And (TID0, 0x0F), 0x00), LEqual (And (TID0, 0x0F), 
0x0F))) {
   //
-  // If FIFO interface, interrupt vector register is
-  // available. TCG PTP specification allows only
-  // values 1..15 in this field. For other interrupts
-  // the field should stay 0.
+  // Update TPM FIFO PTP/TIS interface only, identified by 
TPM_INTERFACE_ID_x lowest
+  // nibble.
+  //  - FIFO interface as defined in PTP for TPM 2.0 is active
+  //  - FIFO interface as defined in TIS1.3 is active
   //
-  If (LLess (IRQ0, 16)) {
-Store (And(IRQ0, 0xF), INTV)
-  }
-  //
-  // Interrupt enable register (TPM_INT_ENABLE_x) bits 3:4
-  // contains settings for interrupt polarity.
-  // The other bits of the byte enable individual interrupts.
-  // They should be all be zero, but to avoid changing the
-  // configuration, the other bits are be preserved.
-  // 00 - high level
-  // 01 - low level
-  // 10 - rising edge
-  // 11 - falling edge
-  //
-  // ACPI spec definitions:
-  // _HE: '1' is Edge, '0' is Level
-  // _LL: '1' is ActiveHigh, '0' is ActiveLow (inverted from TCG spec)
-  //
-  If (LEqual (ITRG, 1)) {
-Or(INTE, 0x0010, INTE)
-  } Else {
-And(INTE, 0xFFEF, INTE)
-  }
-  if (LEqual (ILVL, 0)) {
-Or(INTE, 0x0008, INTE)
-  } Else {
-And(INTE, 0xFFF7, INTE)
+  If (LOr(LEqual (And (TID0, 0x0F), 0x00), LEqual (And (TID0, 0x0F), 
0x0F))) {
+//
+// If FIFO interface, interrupt vector register is
+// available. TCG PTP specification allows only
+// values 1..15 in this field. For other interrupts
+// the field should stay 0.
+//
+If (LLess (IRQ0, 16)) {
+  Store (And(IRQ0, 0xF), INTV)
+}
+//
+// Interrupt enable register (TPM_INT_ENABLE_x) bits 3:4
+// contains settings for interrupt polarity.
+// The other bits of the byte enable individual interrupts.
+// They should be all be zero, but to avoid changing the
+// configuration, the other bits are be preserved.
+// 00 - high level
+// 01 - low level
+// 10 - rising edge
+// 11 - falling edge
+//
+// ACPI spec 

Re: [edk2] [PATCH v1 2/2] StdLib/Environs: Avoid infinite recursion in _Exit

2019-01-02 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

And pushed.

> -Original Message-
> From: Alex James [mailto:theracermas...@gmail.com]
> Sent: Monday, December 17, 2018 8:25 PM
> To: edk2-devel@lists.01.org
> Cc: Daryl McDaniel ; Carsey, Jaben
> 
> Subject: [PATCH v1 2/2] StdLib/Environs: Avoid infinite recursion in _Exit
> Importance: High
> 
> Use __builtin_unreachable instead of infinite recursion to fix an
> infinite recursion error when building StdLib with XCODE5/CLANG38.
> 
> Cc: Daryl McDaniel 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Alex James 
> ---
>  StdLib/LibC/StdLib/Environs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/StdLib/LibC/StdLib/Environs.c b/StdLib/LibC/StdLib/Environs.c
> index 15221a1260..a29cb9954c 100644
> --- a/StdLib/LibC/StdLib/Environs.c
> +++ b/StdLib/LibC/StdLib/Environs.c
> @@ -120,7 +120,7 @@ _Exit(int status)
>longjmp(gMD->MainExit, 0x55); // Get out of here.  longjmp can't return
> 0. Use 0x55 for a non-zero value.
> 
>  #ifdef __GNUC__
> -  _Exit(status);/* Keep GCC happy - never reached */
> +  __builtin_unreachable (); // Keep GCC happy
>  #endif
>  }
> 
> --
> 2.20.1

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


Re: [edk2] [PATCH v1 2/2] StdLib/Environs: Avoid infinite recursion in _Exit

2019-01-02 Thread Carsey, Jaben
Reviewed-by: Jaben Carsey 

And pushed.

> -Original Message-
> From: Alex James [mailto:theracermas...@gmail.com]
> Sent: Monday, December 17, 2018 8:25 PM
> To: edk2-devel@lists.01.org
> Cc: Daryl McDaniel ; Carsey, Jaben
> 
> Subject: [PATCH v1 2/2] StdLib/Environs: Avoid infinite recursion in _Exit
> Importance: High
> 
> Use __builtin_unreachable instead of infinite recursion to fix an
> infinite recursion error when building StdLib with XCODE5/CLANG38.
> 
> Cc: Daryl McDaniel 
> Cc: Jaben Carsey 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Alex James 
> ---
>  StdLib/LibC/StdLib/Environs.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/StdLib/LibC/StdLib/Environs.c b/StdLib/LibC/StdLib/Environs.c
> index 15221a1260..a29cb9954c 100644
> --- a/StdLib/LibC/StdLib/Environs.c
> +++ b/StdLib/LibC/StdLib/Environs.c
> @@ -120,7 +120,7 @@ _Exit(int status)
>longjmp(gMD->MainExit, 0x55); // Get out of here.  longjmp can't return
> 0. Use 0x55 for a non-zero value.
> 
>  #ifdef __GNUC__
> -  _Exit(status);/* Keep GCC happy - never reached */
> +  __builtin_unreachable (); // Keep GCC happy
>  #endif
>  }
> 
> --
> 2.20.1

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


Re: [edk2] [PATCH v2 05/11] MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver

2019-01-02 Thread Ard Biesheuvel
On Wed, 2 Jan 2019 at 14:14, Jagadeesh Ujja  wrote:
>
> Adapt the FaultTolerantWriteDxe driver to be used as a MM_STANDALONE
> driver to provide UEFI fault tolerant write protocol functionality
> for variable reclaim operation on EFI variables stored on a NOR flash
> that is only accessible to code executing in MM Standalone mode.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jagadeesh Ujja 
> ---
>  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf   
>|   1 +
>  MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c 
>| 203 +++-
>  
> MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf
>  | 101 ++
>  MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c
>|  27 +--
>  4 files changed, 271 insertions(+), 61 deletions(-)
>
> diff --git 
> a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
> b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> index dcde58d..026bc60 100644
> --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
> @@ -77,6 +77,7 @@
>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase  ## 
> SOMETIMES_CONSUMES
>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64## 
> CONSUMES
>gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize  ## 
> CONSUMES
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
>
>  #
>  # gBS->CalculateCrc32() is consumed in EntryPoint.
> diff --git 
> a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c 
> b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
> index 481fea3..33f99e6 100644
> --- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
> +++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
> @@ -44,6 +44,7 @@
>This driver need to make sure the CommBuffer is not in the SMRAM range.
>
>  Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
> +Copyright (c) 2018, ARM Limited. All rights reserved.
>  This program and the accompanying materials
>  are licensed and made available under the terms and conditions of the BSD 
> License
>  which accompanies this distribution.  The full text of the license may be 
> found at
> @@ -55,13 +56,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
> EXPRESS OR IMPLIED.
>  **/
>
>  #include 
> +#include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include "FaultTolerantWrite.h"
>  #include "FaultTolerantWriteSmmCommon.h"
>  #include 
> +#include 
>
>  EFI_EVENT mFvbRegistration = NULL;
>  EFI_FTW_DEVICE*mFtwDevice  = NULL;
> @@ -92,11 +96,19 @@ FtwGetFvbByHandle (
>//
>// To get the SMM FVB protocol interface on the handle
>//
> -  return gSmst->SmmHandleProtocol (
> -  FvBlockHandle,
> -  ,
> -  (VOID **) FvBlock
> -  );
> +  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
> +return gSmst->SmmHandleProtocol (
> +FvBlockHandle,
> +,
> +(VOID **) FvBlock
> +);
> +  } else {
> +return gMmst->MmHandleProtocol (
> +FvBlockHandle,
> +,
> +(VOID **) FvBlock
> +);
> +  }
>  }
>
>  /**
> @@ -119,11 +131,19 @@ FtwGetSarProtocol (
>//
>// Locate Smm Swap Address Range protocol
>//
> -  Status = gSmst->SmmLocateProtocol (
> -,
> -NULL,
> -SarProtocol
> -);
> +  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
> +Status = gSmst->SmmLocateProtocol (
> +  ,
> +  NULL,
> +  SarProtocol
> +  );
> +  } else {
> +Status = gMmst->MmLocateProtocol (
> +  ,
> +  NULL,
> +  SarProtocol
> +  );
> +  }
>return Status;
>  }
>
> @@ -158,13 +178,23 @@ GetFvbCountAndBuffer (
>BufferSize = 0;
>*NumberHandles = 0;
>*Buffer= NULL;
> -  Status = gSmst->SmmLocateHandle (
> -ByProtocol,
> -,
> -NULL,
> -,
> -*Buffer
> -);
> +  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
> +Status = gSmst->SmmLocateHandle (
> +  ByProtocol,
> +  ,
> +  NULL,
> +  ,
> +  *Buffer
> +  );
> +  } else {
> +Status = gMmst->MmLocateHandle (
> 

Re: [edk2] [PATCH 00/13] Extend secure variable service to be usable from Standalone MM

2019-01-02 Thread Ard Biesheuvel
On Thu, 20 Dec 2018 at 15:23, Gao, Liming  wrote:
>
> Jagadeesh:
>   MdeModulePkg Variable service/Fault tolerant/Nor Flash driver depends on 
> StandaloneMmServicesTableLib library class header file. This header file is 
> added into MdePkg. It has two interfaces. One is global gMmst, another is 
> function InMm(). So, there is no dependency issue here.
> And, MdePkg adds one StandaloneMmServicesTableLib library INF with empty 
> implementation, this library is just for build. It sets gMmst=NULL, and 
> always return FASLE in InMm(). This library can be used in MdeModulePkg.dsc 
> to make Variable driver pass build. There is also no dependency issue here. 
> Last, Platform DSC file will refer to the real StandaloneMmServicesTableLib 
> library INF from StandaloneMmPkg.
>

I think we should avoid the need for InMm() altogether for standalone
MM. It will always return TRUE for standalone MM modules, and it will
always return FALSE for other modules, so the distinction should be
made at build time.

This means that we need to refactor the SMM 'server' modules and/or
libraries so that any code they cannot share (like boot services
invocations) are only included in the classic SMM versions.

I have pushed my own prototype code here:
https://github.com/ardbiesheuvel/edk2/commits/standalone-mm

There is some overlap with Jagadeesh's work. I will work with him
directly to resolve this before posting any new revisions.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Ard Biesheuvel
On Wed, 2 Jan 2019 at 15:23, Ard Biesheuvel  wrote:
>
> On Wed, 2 Jan 2019 at 14:23, Gao, Liming  wrote:
> >
> > Ard:
> >   Why need to change module type? The non-base type library can support 
> > more than one module types, such as 
> > MdeModulePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.inf.
> >  Only if this library has constructor and needs to support cross module 
> > type, it must be set to BASE. For other case, its module type can be kept 
> > as-is. I clarify this rule in 
> > https://lists.01.org/pipermail/edk2-devel/2018-December/033523.html.
> >
>
> Currently, standalone MM on AArch64 requires strict alignment, and we
> only build SEC, PEI_CORE, PEIM and BASE modules with strict alignment.
>
> In general, I think it makes sense to default to BASE type for all
> libraries unless there is a need to using something else, i.e, when
> the library has a constructor that needs to ImageHandle and/or
> SystemTable arguments.

Actually, regardless of whether BASE is more appropriate in general, I
think there is no reason to keep the strict alignment checking in
standalone MM, since the MM core will be invoked with MMU and caches
enabled, and so there is no reason to disallow unaligned accesses
(this is different from SEC and PEI modules on ARM, since they may
execute in place with the caches and MMU off, in which case unaligned
accesses are never permitted)

I will raise this internally. In the mean time, please disregard this
aspect of my feedback. Simply adding MM_STANDALONE to the list of
permitted module types should be sufficient.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH v7] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC v4 and above Support.

2019-01-02 Thread Ashish Singhal
Hello Hao,

I have submitted patch v8 which incorporates all the changes.

Thanks
Ashish


-Original Message-
From: Wu, Hao A  
Sent: Tuesday, January 1, 2019 11:37 PM
To: Wu, Hao A ; Ashish Singhal ; 
edk2-devel@lists.01.org
Subject: RE: [edk2] [PATCH v7] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC v4 and 
above Support.

Missed one comment for commit message:

"If V4 64 bit address mode is enabled in compatibility register"
->
"If V4 64 bit address mode is supported in capabilities register"


Best Regards,
Hao Wu


> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
> Wu, Hao A
> Sent: Wednesday, January 02, 2019 2:29 PM
> To: Ashish Singhal; edk2-devel@lists.01.org
> Subject: Re: [edk2] [PATCH v7] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC 
> HC v4 and above Support.
> 
> Hello,
> 
> I have 2 minor comments, please refer to those inline comments.
> Apart from that, the patch is good to me:
> Reviewed-by: Hao Wu 
> 
> If you agree those inline comments, I will directly modify the patch 
> on my side and then push it into the repository.
> 
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf 
> > Of Ashish Singhal
> > Sent: Wednesday, December 19, 2018 5:29 AM
> > To: edk2-devel@lists.01.org
> > Cc: Ashish Singhal
> > Subject: [edk2] [PATCH v7] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC 
> > v4 and above Support.
> 
> Add the Bugzilla tracker information at the start of the commit log message:
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1359
> 
> >
> > Add SDMA, ADMA2 and 26b data length support.
> >
> > If V4 64 bit address mode is enabled in compatibility register, 
> > program controller to enable V4 host mode and use appropriate SDMA 
> > registers supporting 64 bit addresses.
> >
> > If V4 64 bit address mode is enabled in compatibility register, 
> > program controller to enable V4 host mode and use appropriate ADMA 
> > descriptors supporting 64 bit addresses.
> >
> > If host controller version is above V4.0, enable ADMA2 with 26b data 
> > length support for better performance. HC 2 register is configured 
> > to use 26 bit data lengths and ADMA2 descriptors are configured
> appropriately.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Ashish Singhal 
> > ---
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c|   2 +-
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c  |   4 +-
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c |  21 +-
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |   7 +-
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 328
> > +
> >  MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  84 --
> >  6 files changed, 363 insertions(+), 83 deletions(-)  mode change 
> > 100755 => 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> >
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > old mode 100755
> > new mode 100644
> > index 2d3fb68..0c5646f
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
> > @@ -707,7 +707,7 @@ EmmcSwitchClockFreq (
> >//
> >// Convert the clock freq unit from MHz to KHz.
> >//
> > -  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
> > Private-
> > >BaseClkFreq[Slot]);
> > +  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
> > + Private-
> > >BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
> >if (EFI_ERROR (Status)) {
> >  return Status;
> >}
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > index 68485c8..cdcdfa3 100644
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
> > @@ -864,7 +864,7 @@ SdCardSetBusMode (
> >  return Status;
> >}
> >
> > -  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
> > Private-
> > >BaseClkFreq[Slot]);
> > +  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
> > + Private-
> > >BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
> >if (EFI_ERROR (Status)) {
> >  return Status;
> >}
> > @@ -1064,7 +1064,7 @@ SdCardIdentification (
> >  goto Error;
> >}
> >
> > -  SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot]);
> > +  SdMmcHcInitClockFreq (PciIo, Slot, 
> > + Private->BaseClkFreq[Slot],
> Private-
> > >ControllerVersion[Slot]);
> >
> >gBS->Stall (1000);
> >
> > diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> > b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> > index a87f8de..b5bc260 100644
> > --- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> > +++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
> > @@ -62,7 +62,9 @@ SD_MMC_HC_PRIVATE_DATA gSdMmcPciHcTemplate
> =
> > {
> >

[edk2] [PATCH v8] MdeModulePkg/SdMmcPciHcDxe: Add SDMMC HC v4 and above Support.

2019-01-02 Thread Ashish Singhal
Add SDMA, ADMA2 and 26b data length support.

If V4 64 bit address mode is supported in capabilities register,
program controller to enable V4 host mode and use appropriate
SDMA registers supporting 64 bit addresses.

If V4 64 bit address mode is supported in capabilities register,
program controller to enable V4 host mode and use appropriate
ADMA descriptors supporting 64 bit addresses.

If host controller version is above V4.0, enable ADMA2 with 26b data
length support for better performance. HC 2 register is configured to
use 26 bit data lengths and ADMA2 descriptors are configured appropriately.

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

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ashish Singhal 
Reviewed-by: Hao Wu 
---
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c|   3 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c  |   5 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c |  22 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.h |   7 +-
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.c   | 328 +
 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHci.h   |  84 --
 6 files changed, 366 insertions(+), 83 deletions(-)
 mode change 100755 => 100644 MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c

diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
old mode 100755
new mode 100644
index 2d3fb68..4ef849f
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/EmmcDevice.c
@@ -1,6 +1,7 @@
 /** @file
   This file provides some helper functions which are specific for EMMC device.
 
+  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
   Copyright (c) 2015 - 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
@@ -707,7 +708,7 @@ EmmcSwitchClockFreq (
   //
   // Convert the clock freq unit from MHz to KHz.
   //
-  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
Private->BaseClkFreq[Slot]);
+  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
Private->BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
   if (EFI_ERROR (Status)) {
 return Status;
   }
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
index 68485c8..83e6bf0 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdDevice.c
@@ -1,6 +1,7 @@
 /** @file
   This file provides some helper functions which are specific for SD card 
device.
 
+  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
   Copyright (c) 2015 - 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
@@ -864,7 +865,7 @@ SdCardSetBusMode (
 return Status;
   }
 
-  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
Private->BaseClkFreq[Slot]);
+  Status = SdMmcHcClockSupply (PciIo, Slot, ClockFreq * 1000, 
Private->BaseClkFreq[Slot], Private->ControllerVersion[Slot]);
   if (EFI_ERROR (Status)) {
 return Status;
   }
@@ -1064,7 +1065,7 @@ SdCardIdentification (
 goto Error;
   }
 
-  SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot]);
+  SdMmcHcInitClockFreq (PciIo, Slot, Private->BaseClkFreq[Slot], 
Private->ControllerVersion[Slot]);
 
   gBS->Stall (1000);
 
diff --git a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c 
b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
index a87f8de..76c32a4 100644
--- a/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
+++ b/MdeModulePkg/Bus/Pci/SdMmcPciHcDxe/SdMmcPciHcDxe.c
@@ -4,6 +4,7 @@
 
   It would expose EFI_SD_MMC_PASS_THRU_PROTOCOL for upper layer use.
 
+  Copyright (c) 2018, NVIDIA CORPORATION. All rights reserved.
   Copyright (c) 2015 - 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
@@ -62,7 +63,9 @@ SD_MMC_HC_PRIVATE_DATA gSdMmcPciHcTemplate = {
   { // MaxCurrent
 0,
   },
-  0 // ControllerVersion
+  {
+0   // ControllerVersion
+  }
 };
 
 SD_DEVICE_PATHmSdDpTemplate = {
@@ -621,6 +624,14 @@ SdMmcPciHcDriverBindingStart (
   for (Slot = FirstBar; Slot < (FirstBar + SlotNum); Slot++) {
 Private->Slot[Slot].Enable = TRUE;
 
+//
+// Get SD/MMC Pci Host Controller Version
+//
+Status = SdMmcHcGetControllerVersion (PciIo, Slot, 
>ControllerVersion[Slot]);
+if (EFI_ERROR (Status)) {
+  continue;
+}
+
 Status = SdMmcHcGetCapability (PciIo, Slot, >Capability[Slot]);
 if (EFI_ERROR (Status)) {
   continue;
@@ -649,7 +660,14 @@ 

[edk2] [PATCH edk2-platforms v2 3/6] Platform/ARM: Configuration Manager for FVP

2019-01-02 Thread Sami Mujawar
The dynamic tables framework utilizes the configuration manager
protocol to get the platform specific information required for
building the firmware tables.

The configuration manager is a platform specific component that
collates the platform hardware information and builds an abstract
platform configuration repository. The configuration manager also
implements the configuration manager protocol which returns the
hardware information requested by the table generators.

This patch implements the configuration manager support for the
FVP platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
---
The changes can be seen at:
https://github.com/samimujawar/edk2-platforms/tree/365_dynamic_tables_framework_v2

Notes:
v2:
- Fixed flags for GT Timer Frame1 as non-secure [SAMI]

 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc 
   |  31 +
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
  | 610 
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
  | 172 ++
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 |  79 +++
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Platform.h
  |  94 +++
 Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/Dsdt.asl
   |  73 +++
 
Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/PlatformASLTablesLib.inf
   |  35 ++
 7 files changed, 1094 insertions(+)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
new file mode 100644
index 
..788b145b273fd49da7fb5d238491aef956977e61
--- /dev/null
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
@@ -0,0 +1,31 @@
+## @file
+#  dsc include file for Configuration Manager
+#
+#  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions of the BSD 
License
+#  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.
+##
+
+[Defines]
+
+[BuildOptions]
+# Required for pre-processing ASL files that include ArmPlatform.h
+  *_*_*_ASLPP_FLAGS= $(PLATFORM_FLAGS)
+
+[LibraryClasses.common]
+
+[Components.common]
+  # Configuration Manager
+  
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 {
+
+# Platform ASL Tables
+
PlatformAslTablesLib|Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/PlatformASLTablesLib.inf
+  
+   *_*_*_PLATFORM_FLAGS = 
-I$(BIN_DIR)/Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/PlatformASLTablesLib/OUTPUT
+  }
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
new file mode 100644
index 
..d7f64a53e47c6e09da9d21a4bf3d33e2d9294af2
--- /dev/null
+++ 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
@@ -0,0 +1,610 @@
+/** @file
+  Configuration Manager Dxe
+
+  Copyright (c) 2017 - 2019, ARM Limited. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  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.
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "ConfigurationManager.h"
+#include "Platform.h"
+
+// AML Code Include files generated by iASL Compiler
+#include 
+
+/** The platform configuration repository information.
+*/
+STATIC
+EDKII_PLATFORM_REPOSITORY_INFO VExpressPlatRepositoryInfo = {
+  /// Configuration Manager information
+  { CONFIGURATION_MANAGER_REVISION, CFG_MGR_OEM_ID },
+
+  // ACPI Table List
+  {
+// FADT Table
+{
+  EFI_ACPI_6_2_FIXED_ACPI_DESCRIPTION_TABLE_SIGNATURE,
+  CREATE_STD_ACPI_TABLE_GEN_ID (ESTD_ACPI_TABLE_ID_FADT),
+  NULL
+

Re: [edk2] [PATCH edk2-platforms v1 3/6] Platform/ARM: Configuration Manager for FVP

2019-01-02 Thread Sami Mujawar
Hi Ard, Leif,

Please ignore this patch in the series. I am sending an updated (v2) patch that 
configures the GT Timer Frame 1 as non-secure. 

Regards,

Sami Mujawar

-Original Message-
From: edk2-devel  On Behalf Of Sami Mujawar
Sent: 21 December 2018 05:00 PM
To: edk2-devel@lists.01.org
Cc: nd ; Arvind Chauhan ; Alexei Fedorov 
; Stephanie Hughes-Fitt 
; michael.d.kin...@intel.com
Subject: [edk2] [PATCH edk2-platforms v1 3/6] Platform/ARM: Configuration 
Manager for FVP

The dynamic tables framework utilizes the configuration manager protocol to get 
the platform specific information required for building the firmware tables.

The configuration manager is a platform specific component that collates the 
platform hardware information and builds an abstract platform configuration 
repository. The configuration manager also implements the configuration manager 
protocol which returns the hardware information requested by the table 
generators.

This patch implements the configuration manager support for the FVP platform.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Sami Mujawar 
---
 Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc 
   |  31 +
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
  | 610 
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.h
  | 172 ++
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 |  79 +++
 
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/Platform.h
  |  91 +++
 Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/Dsdt.asl
   |  73 +++
 
Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLTablesLib/PlatformASLTablesLib.inf
   |  35 ++
 7 files changed, 1091 insertions(+)

diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager.dsc.inc
new file mode 100644
index 
..788b145b273fd49da7fb5d238491aef956977e61
--- /dev/null
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager
+++ .dsc.inc
@@ -0,0 +1,31 @@
+## @file
+#  dsc include file for Configuration Manager # #  Copyright (c) 2017 - 
+2018, ARM Limited. All rights reserved.
+#
+#  This program and the accompanying materials #  are licensed and made 
+available under the terms and conditions of the BSD License #  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.
+##
+
+[Defines]
+
+[BuildOptions]
+# Required for pre-processing ASL files that include ArmPlatform.h
+  *_*_*_ASLPP_FLAGS= $(PLATFORM_FLAGS)
+
+[LibraryClasses.common]
+
+[Components.common]
+  # Configuration Manager
+  
Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManagerDxe.inf
 {
+
+# Platform ASL Tables
+
+PlatformAslTablesLib|Platform/ARM/VExpressPkg/ConfigurationManager/Plat
+formASLTablesLib/PlatformASLTablesLib.inf
+  
+   *_*_*_PLATFORM_FLAGS = 
+-I$(BIN_DIR)/Platform/ARM/VExpressPkg/ConfigurationManager/PlatformASLT
+ablesLib/PlatformASLTablesLib/OUTPUT
+  }
diff --git 
a/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
 
b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManagerDxe/ConfigurationManager.c
new file mode 100644
index 
..4f79f91ef32cad4a1967d969cb39f801c3593089
--- /dev/null
+++ b/Platform/ARM/VExpressPkg/ConfigurationManager/ConfigurationManager
+++ Dxe/ConfigurationManager.c
@@ -0,0 +1,610 @@
+/** @file
+  Configuration Manager Dxe
+
+  Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+
+  This program and the accompanying materials  are licensed and made 
+ available under the terms and conditions of the BSD License  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.
+
+  @par Glossary:
+- Cm or CM   - Configuration Manager
+- Obj or OBJ - Object
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include "ConfigurationManager.h"
+#include "Platform.h"
+
+// AML Code Include files generated by iASL Compiler #include 
+
+
+/** The platform configuration repository information.
+*/
+STATIC
+EDKII_PLATFORM_REPOSITORY_INFO 

Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Ard Biesheuvel
On Wed, 2 Jan 2019 at 14:23, Gao, Liming  wrote:
>
> Ard:
>   Why need to change module type? The non-base type library can support more 
> than one module types, such as 
> MdeModulePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.inf.
>  Only if this library has constructor and needs to support cross module type, 
> it must be set to BASE. For other case, its module type can be kept as-is. I 
> clarify this rule in 
> https://lists.01.org/pipermail/edk2-devel/2018-December/033523.html.
>

Currently, standalone MM on AArch64 requires strict alignment, and we
only build SEC, PEI_CORE, PEIM and BASE modules with strict alignment.

In general, I think it makes sense to default to BASE type for all
libraries unless there is a need to using something else, i.e, when
the library has a constructor that needs to ImageHandle and/or
SystemTable arguments.
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Jagadeesh Ujja
Hi Ard,

On Wed, Jan 2, 2019 at 6:35 PM Ard Biesheuvel  wrote:
>
> On Fri, 14 Dec 2018 at 13:14, Jagadeesh Ujja  wrote:
> >
> > “VarCheckLib” library can be used by MM_STANDALONE drivers as well.
> > So add MM_STANDALONE as the module type this library supports.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jagadeesh Ujja 
> > ---
> >  MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf 
> > b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > index 099f83d..c8cf810 100644
> > --- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > +++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > @@ -2,6 +2,7 @@
> >  #  Provides variable check services and database management.
> >  #
> >  #  Copyright (c) 2015, Intel Corporation. All rights reserved.
> > +#  Copyright (c) 2018, ARM Limited. All rights reserved.
> >  #
> >  #  This program and the accompanying materials
> >  #  are licensed and made available under the terms and conditions
> > @@ -21,12 +22,12 @@
> >FILE_GUID  = 63E12D08-0C5D-47F8-95E4-09F89D7506C5
> >MODULE_TYPE= DXE_RUNTIME_DRIVER
>
> Please change the module type to 'BASE' as well. Note that this may
> require you to add
>
> #include 
>
> to some source or header files.
>
> With that
>
> Reviewed-by: Ard Biesheuvel 
>
Sorry Just now I submitted patch set v2, will take care of this review
comments in the next patchset

Thanks
Jagadeesh

> >VERSION_STRING = 1.0
> > -  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> > DXE_SMM_DRIVER
> > +  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> > DXE_SMM_DRIVER MM_STANDALONE
> >
> >  #
> >  # The following information is for reference only and not required by the 
> > build tools.
> >  #
> > -#  VALID_ARCHITECTURES   = IA32 X64
> > +#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
> >  #
> >
> >  [Sources]
> > --
> > 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


Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Gao, Liming
Ard:
  Why need to change module type? The non-base type library can support more 
than one module types, such as 
MdeModulePkg\Library\PeiDxeDebugLibReportStatusCode\PeiDxeDebugLibReportStatusCode.inf.
 Only if this library has constructor and needs to support cross module type, 
it must be set to BASE. For other case, its module type can be kept as-is. I 
clarify this rule in 
https://lists.01.org/pipermail/edk2-devel/2018-December/033523.html.

Thanks
Liming
> -Original Message-
> From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Ard 
> Biesheuvel
> Sent: Wednesday, January 2, 2019 9:05 PM
> To: Jagadeesh Ujja 
> Cc: edk2-devel@lists.01.org; Zhang, Chao B ; Gao, 
> Liming 
> Subject: Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow 
> MM_STANDALONE drivers to use this library
> 
> On Fri, 14 Dec 2018 at 13:14, Jagadeesh Ujja  wrote:
> >
> > “VarCheckLib” library can be used by MM_STANDALONE drivers as well.
> > So add MM_STANDALONE as the module type this library supports.
> >
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Jagadeesh Ujja 
> > ---
> >  MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf 
> > b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > index 099f83d..c8cf810 100644
> > --- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > +++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> > @@ -2,6 +2,7 @@
> >  #  Provides variable check services and database management.
> >  #
> >  #  Copyright (c) 2015, Intel Corporation. All rights reserved.
> > +#  Copyright (c) 2018, ARM Limited. All rights reserved.
> >  #
> >  #  This program and the accompanying materials
> >  #  are licensed and made available under the terms and conditions
> > @@ -21,12 +22,12 @@
> >FILE_GUID  = 63E12D08-0C5D-47F8-95E4-09F89D7506C5
> >MODULE_TYPE= DXE_RUNTIME_DRIVER
> 
> Please change the module type to 'BASE' as well. Note that this may
> require you to add
> 
> #include 
> 
> to some source or header files.
> 
> With that
> 
> Reviewed-by: Ard Biesheuvel 
> 
> >VERSION_STRING = 1.0
> > -  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> > DXE_SMM_DRIVER
> > +  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> > DXE_SMM_DRIVER MM_STANDALONE
> >
> >  #
> >  # The following information is for reference only and not required by the 
> > build tools.
> >  #
> > -#  VALID_ARCHITECTURES   = IA32 X64
> > +#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
> >  #
> >
> >  [Sources]
> > --
> > 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


Re: [edk2] [PATCH 00/13] Extend secure variable service to be usable from Standalone MM

2019-01-02 Thread Jagadeesh Ujja
hi Jian,

On Fri, Dec 21, 2018 at 8:27 AM Wang, Jian J  wrote:
>
> Jagadeesh,
>
> There're many places in this patch series where code similar to following is 
> added.
> It'd better to wrap them into module private functions or even a library, if 
> necessary.
> This can make the code cleaner (no if/else) and easier (central place) to 
> maintain in
> the future.
>
> +  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
> +Status = gSmst->SmmLocateProtocol (
> +  ,
> +  NULL,
> +  SarProtocol
> +  );
> +  } else {
> +Status = gMmst->MmLocateProtocol (
> +  ,
> +  NULL,
> +  SarProtocol
> +  );
> +  }
>
Thank you for your comment. This patch series try to reuse code as
much as possible between MM and non-MM code. So, in some changes,
if..else was used which helps to reuse most of the other bits of code.
To address your comment, can you please let me know how we could avoid
this if..else without duplicating the too much code. I am not clear
about " module private functions or even a library" comment that you
have made. Can you please help me with this.

Thanks,
Jagadeesh.

> Regards,
> Jian
>
>
> > -Original Message-
> > From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of
> > Jagadeesh Ujja
> > Sent: Friday, December 14, 2018 8:13 PM
> > To: edk2-devel@lists.01.org; Gao, Liming ; Zhang, Chao
> > B ; leif.lindh...@linaro.org;
> > ard.biesheu...@linaro.org
> > Subject: [edk2] [PATCH 00/13] Extend secure variable service to be usable 
> > from
> > Standalone MM
> >
> > Changes since RFC v4:
> > - Addressed all the comments from Liming Gao
> >   - Added an additional PCD 'PcdStandaloneMmCodeEnabled' to indicate
> > presence of StandaloneMM support.
> >   - MdePkg.dec file updated to include StandaloneMmServiceTableLib and
> > StandaloneMmRuntimeDxe library.
> >   - Platform specific changes will be posted in a seperate patchset.
> >   - AsmLfence wrapper function is supported for AArch64 platforms.
> >   - All the patches in this series can be pulled from
> > https://github.com/jagadeeshujja/edk2 (branch: 
> > topics/aarch64_secure_vars)
> >
> > Changes since RFC v3:
> > - Addressed all the comments from Liming Gao
> >   - Added a AArch64 implementation of AsmLfence which is a wrapper for
> > MemoryFence. The changes in variable service driver in v3 of this
> > patchset that used MemoryFence instead of AsmLfence have been removed.
> >   - Added StandaloneMmServicesTableLib.h and StandaloneMmRuntimeDxe
> > library into MdePkg.
> >   - Renamed PcdStandaloneMmEnable as PcdStandaloneMmVariableEnabled and
> > added to in to MdePkg.
> >   - Now with above changes, edk2 packages don't need to depend on
> > StandaloneMmPkg/StandaloneMmPkg.dec
> > - Addressed comments from Ting Ye
> >   - Removed the hacks in the v3 version.
> >   - Will relook into the “TimerWrapp.c” file and add a appropriate
> > implementation of this for MM Standalone mode code.
> >
> > Changes since RFC v2:
> > - Added 'Contributed-under' tag, removed Change-ID tag and
> >   maintained a single signed-off-by for the all the patches.
> >
> > Changes since RFC v1:
> > - Addressed all the comments from Liming Gao
> >   - Removed the use of #ifdef/#else/#endif and used a Pcd instead to
> > select between MM and non-MM paths.
> >   - Removed all dependencies on edk2-platforms.
> >   - Dropped the use of mMmst and used gSmst instead.
> >   - Added a dummy implementation UefiRuntimeServiceTableLib for
> > MM_STANDALONE usage
> > - Replaced all uses of AsmLfence with MemoryFence from variable
> >   service code.
> > - Add a new StandaloneMmRuntimeDxe library to for use by non-MM code.
> >
> > This patch series extends the existing secure variable service support for
> > use with Standalone MM. This is applicable to paltforms that use Standalone
> > Management Mode to protect access to non-volatile memory (NOR flash in case
> > of these patches) used to store the secure EFI variables.
> >
> > The first patch pulls in additional libraries from the staging branch of
> > StandaloneMmPkg into the edk2's StandaloneMmPkg. The existing secure
> > variable
> > service implementation supports only the traditional MM mode and so the rest
> > of the patches extends the existing secure variable service support to be
> > useable with Standalone MM mode as well.
> >
> > Jagadeesh Ujja (13):
> >   StandaloneMmPkg: Pull in additonal libraries from staging branch
> >   MdePkg: Add a PCD that indicates presence of Standalone MM mode
> >   MdeModulePkg: Add a PCD to indicate Standalone MM supports secure
> > variable
> >   MdePkg/Include: add StandaloneMmServicesTableLib header file
> >   MdePkg/Library/BaseLib/AArch64: Add AsmLfence function
> >   MdePkg/Library: Add StandaloneMmRuntimeDxe library
> >   

[edk2] [PATCH v2 11/11] CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Jagadeesh Ujja
“SmmCryptLib” library can be used by MM_STANDALONE drivers as well.
So add MM_STANDALONE as the module type this library supports.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
index 4829669..9a63419 100644
--- a/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
+++ b/CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf
@@ -30,7 +30,7 @@
   MODULE_TYPE= DXE_SMM_DRIVER
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x0001000A
-  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE
+  LIBRARY_CLASS  = BaseCryptLib|DXE_SMM_DRIVER SMM_CORE 
MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
-- 
2.7.4

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


[edk2] [PATCH v2 10/11] SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Jagadeesh Ujja
“AuthVariableLib” library can be used by MM_STANDALONE drivers as well.
So add MM_STANDALONE as the module type this library supports.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
Reviewed-by: Chao Zhang 
---
 SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
index 572ba4e..4294d3b 100644
--- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
+++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
@@ -2,6 +2,7 @@
 #  Provides authenticated variable services.
 #
 #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions
@@ -21,12 +22,12 @@
   FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
-- 
2.7.4

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


[edk2] [PATCH v2 09/11] ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver

2019-01-02 Thread Jagadeesh Ujja
Adapt the NorFlashDxe driver to be used as a MM_STANDALONE driver to
allow access to NOR flash for code executing in MM_STANDALONE mode.
This allows storing of EFI variables on NOR flash which is accessible
only via the MM STANDALONE mode software.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h|4 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf  |2 +
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c |   96 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c   | 1339 

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf |   76 ++
 5 files changed, 1470 insertions(+), 47 deletions(-)

diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
index c0563f6..d149652 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h
@@ -1,6 +1,6 @@
 /** @file  NorFlashDxe.h
 
-  Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+  Copyright (c) 2011 - 2019, 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
@@ -19,6 +19,7 @@
 #include 
 #include 
 
+#include 
 #include 
 
 #include 
@@ -30,6 +31,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #define NOR_FLASH_ERASE_RETRY 10
 
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
index a59a21a..6bf0ff2 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf
@@ -44,6 +44,7 @@
   UefiBootServicesTableLib
   UefiRuntimeLib
   DxeServicesTableLib
+  StandaloneMmServicesTableLib
 
 [Guids]
   gEfiSystemNvDataFvGuid
@@ -57,6 +58,7 @@
   gEfiDevicePathProtocolGuid
   gEfiFirmwareVolumeBlockProtocolGuid
   gEfiDiskIoProtocolGuid
+  gEfiSmmFirmwareVolumeBlockProtocolGuid
 
 [Pcd.common]
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageVariableBase
diff --git a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c 
b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
index e62ffbb..024da28 100644
--- a/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
+++ b/ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
@@ -1,6 +1,6 @@
 /*++ @file  NorFlashFvbDxe.c
 
- Copyright (c) 2011 - 2014, ARM Ltd. All rights reserved.
+ Copyright (c) 2011 - 2019, 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
@@ -720,27 +720,29 @@ NorFlashFvbInitialize (
   DEBUG((DEBUG_BLKIO,"NorFlashFvbInitialize\n"));
   ASSERT((Instance != NULL));
 
-  //
-  // Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME
-  //
-
-  // Note: all the NOR Flash region needs to be reserved into the UEFI Runtime 
memory;
-  //   even if we only use the small block region at the top of the NOR 
Flash.
-  //   The reason is when the NOR Flash memory is set into program mode, 
the command
-  //   is written as the base of the flash region (ie: 
Instance->DeviceBaseAddress)
-  RuntimeMmioRegionSize = (Instance->RegionBaseAddress - 
Instance->DeviceBaseAddress) + Instance->Size;
-
-  Status = gDS->AddMemorySpace (
-  EfiGcdMemoryTypeMemoryMappedIo,
-  Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
-  EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
-  );
-  ASSERT_EFI_ERROR (Status);
-
-  Status = gDS->SetMemorySpaceAttributes (
-  Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
-  EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
-  ASSERT_EFI_ERROR (Status);
+  if (!InMm ()) {
+//
+// Declare the Non-Volatile storage as EFI_MEMORY_RUNTIME
+//
+
+// Note: all the NOR Flash region needs to be reserved into the UEFI 
Runtime memory;
+//   even if we only use the small block region at the top of the NOR 
Flash.
+//   The reason is when the NOR Flash memory is set into program mode, 
the command
+//   is written as the base of the flash region (ie: 
Instance->DeviceBaseAddress)
+RuntimeMmioRegionSize = (Instance->RegionBaseAddress - 
Instance->DeviceBaseAddress) + Instance->Size;
+
+Status = gDS->AddMemorySpace (
+EfiGcdMemoryTypeMemoryMappedIo,
+Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
+EFI_MEMORY_UC | EFI_MEMORY_RUNTIME
+);
+ASSERT_EFI_ERROR (Status);
+
+Status = gDS->SetMemorySpaceAttributes (
+Instance->DeviceBaseAddress, RuntimeMmioRegionSize,
+EFI_MEMORY_UC | EFI_MEMORY_RUNTIME);
+ASSERT_EFI_ERROR (Status);
+  }
 
   mFlashNvStorageVariableBase = FixedPcdGet32 (PcdFlashNvStorageVariableBase);
 
@@ -777,30 +779,32 @@ NorFlashFvbInitialize (
 }
   }
 
-  //
-  // The driver implementing the variable read service can 

[edk2] [PATCH v2 08/11] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Jagadeesh Ujja
“VarCheckLib” library can be used by MM_STANDALONE drivers as well.
So add MM_STANDALONE as the module type this library supports.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf 
b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
index 099f83d..c8cf810 100644
--- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
+++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
@@ -2,6 +2,7 @@
 #  Provides variable check services and database management.
 #
 #  Copyright (c) 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
 #
 #  This program and the accompanying materials
 #  are licensed and made available under the terms and conditions
@@ -21,12 +22,12 @@
   FILE_GUID  = 63E12D08-0C5D-47F8-95E4-09F89D7506C5
   MODULE_TYPE= DXE_RUNTIME_DRIVER
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER
+  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
DXE_SMM_DRIVER MM_STANDALONE
 
 #
 # The following information is for reference only and not required by the 
build tools.
 #
-#  VALID_ARCHITECTURES   = IA32 X64
+#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
 #
 
 [Sources]
-- 
2.7.4

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


[edk2] [PATCH v2 07/11] MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver

2019-01-02 Thread Jagadeesh Ujja
Adapt the variable runtime dxe driver to be used as a MM_STANDALONE
driver to provide variable storage service in MM Standalone mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c   |  37 ++--
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c| 201 

 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableStandaloneMm.inf | 132 
+
 3 files changed, 312 insertions(+), 58 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
index 443cf07..ff30c98 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/Variable.c
@@ -18,6 +18,7 @@
 
 Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
 (C) Copyright 2015-2018 Hewlett Packard Enterprise Development LP
+Copyright (c) 2018, ARM Limited. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -3277,19 +3278,21 @@ VariableServiceSetVariable (
 }
   }
 
-  //
-  // Special Handling for MOR Lock variable.
-  //
-  Status = SetVariableCheckHandlerMor (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize));
-  if (Status == EFI_ALREADY_STARTED) {
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
 //
-// EFI_ALREADY_STARTED means the SetVariable() action is handled inside of 
SetVariableCheckHandlerMor().
-// Variable driver can just return SUCCESS.
+// Special Handling for MOR Lock variable.
 //
-return EFI_SUCCESS;
-  }
-  if (EFI_ERROR (Status)) {
-return Status;
+Status = SetVariableCheckHandlerMor (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize));
+if (Status == EFI_ALREADY_STARTED) {
+  //
+  // EFI_ALREADY_STARTED means the SetVariable() action is handled inside 
of SetVariableCheckHandlerMor().
+  // Variable driver can just return SUCCESS.
+  //
+  return EFI_SUCCESS;
+}
+if (EFI_ERROR (Status)) {
+  return Status;
+}
   }
 
   Status = VarCheckLibSetVariableCheck (VariableName, VendorGuid, Attributes, 
PayloadSize, (VOID *) ((UINTN) Data + DataSize - PayloadSize), mRequestSource);
@@ -4098,12 +4101,14 @@ VariableWriteServiceInitialize (
 }
   }
 
-  ReleaseLockOnlyAtBootTime 
(>VariableGlobal.VariableServicesLock);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+ReleaseLockOnlyAtBootTime 
(>VariableGlobal.VariableServicesLock);
 
-  //
-  // Initialize MOR Lock variable.
-  //
-  MorLockInit ();
+//
+// Initialize MOR Lock variable.
+//
+MorLockInit ();
+  }
 
   return Status;
 }
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
index 8c53f84..02b6638 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmm.c
@@ -15,6 +15,7 @@
   SmmVariableGetStatistics() should also do validation based on its own 
knowledge.
 
 Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -34,6 +35,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 
+#include 
+#include 
 #include 
 #include "Variable.h"
 
@@ -218,11 +221,19 @@ GetFtwProtocol (
   //
   // Locate Smm Fault Tolerent Write protocol
   //
-  Status = gSmst->SmmLocateProtocol (
-,
-NULL,
-FtwProtocol
-);
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gMmst->MmLocateProtocol (
+  ,
+  NULL,
+  FtwProtocol
+  );
+  } else {
+Status = gSmst->SmmLocateProtocol (
+  ,
+  NULL,
+  FtwProtocol
+  );
+  }
   return Status;
 }
 
@@ -248,11 +259,19 @@ GetFvbByHandle (
   //
   // To get the SMM FVB protocol interface on the handle
   //
-  return gSmst->SmmHandleProtocol (
-  FvBlockHandle,
-  ,
-  (VOID **) FvBlock
-  );
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+return gMmst->MmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+ 

[edk2] [PATCH v2 06/11] MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM Standalone

2019-01-02 Thread Jagadeesh Ujja
Adapt the VariableSmmRuntimeDxe driver to communicate with a VariableSmm
driver that is implemented as a MM Standalone driver.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf|  1 +
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c   | 31 
+---
 MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf |  3 ++
 3 files changed, 24 insertions(+), 11 deletions(-)

diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
index 7ef8a97..6bb35bb 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableRuntimeDxe.inf
@@ -131,6 +131,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdMaxUserNvVariableSpaceSize   ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdBoottimeReservedNvVariableSpaceSize  ## 
CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdReclaimVariableSpaceAtEndOfDxe  ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
 
 [FeaturePcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdVariableCollectStatistics  ## CONSUMES # 
statistic the information of variable.
diff --git a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
index 85d655d..1902348 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.c
@@ -14,6 +14,8 @@
   InitCommunicateBuffer() is really function to check the variable data size.
 
 Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
+
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -179,7 +181,11 @@ SendCommunicateBuffer (
   SMM_VARIABLE_COMMUNICATE_HEADER   *SmmVariableFunctionHeader;
 
   CommSize = DataSize + SMM_COMMUNICATE_HEADER_SIZE + 
SMM_VARIABLE_COMMUNICATE_HEADER_SIZE;
-  Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBufferPhysical, );
+  if (PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBuffer, );
+  } else {
+Status = mSmmCommunication->Communicate (mSmmCommunication, 
mVariableBufferPhysical, );
+  }
   ASSERT_EFI_ERROR (Status);
 
   SmmCommunicateHeader  = (EFI_SMM_COMMUNICATE_HEADER *) mVariableBuffer;
@@ -991,9 +997,11 @@ SmmVariableReady (
 {
   EFI_STATUSStatus;
 
-  Status = gBS->LocateProtocol (, NULL, (VOID 
**));
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gBS->LocateProtocol (, NULL, (VOID 
**));
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
@@ -1069,13 +1077,14 @@ SmmVariableWriteReady (
 {
   EFI_STATUSStatus;
   VOID  *ProtocolOps;
-
-  //
-  // Check whether the protocol is installed or not.
-  //
-  Status = gBS->LocateProtocol (, NULL, (VOID **) 
);
-  if (EFI_ERROR (Status)) {
-return;
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+//
+// Check whether the protocol is installed or not.
+//
+Status = gBS->LocateProtocol (, NULL, (VOID **) 
);
+if (EFI_ERROR (Status)) {
+  return;
+}
   }
 
   //
diff --git 
a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf 
b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
index bd73f7a..c84dd2d 100644
--- a/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
+++ b/MdeModulePkg/Universal/Variable/RuntimeDxe/VariableSmmRuntimeDxe.inf
@@ -87,6 +87,9 @@
   ## SOMETIMES_CONSUMES   ## Variable:L"dbt"
   gEfiImageSecurityDatabaseGuid
 
+[Pcd]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
+
 [Depex]
   gEfiSmmCommunicationProtocolGuid
 
-- 
2.7.4

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


[edk2] [PATCH v2 05/11] MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver

2019-01-02 Thread Jagadeesh Ujja
Adapt the FaultTolerantWriteDxe driver to be used as a MM_STANDALONE
driver to provide UEFI fault tolerant write protocol functionality
for variable reclaim operation on EFI variables stored on a NOR flash
that is only accessible to code executing in MM Standalone mode.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 |   1 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c   
 | 203 +++-
 
MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteStandaloneMm.inf 
| 101 ++
 MdeModulePkg/Universal/FaultTolerantWriteDxe/UpdateWorkingBlock.c  
 |  27 +--
 4 files changed, 271 insertions(+), 61 deletions(-)

diff --git 
a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
index dcde58d..026bc60 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf
@@ -77,6 +77,7 @@
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase  ## 
SOMETIMES_CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareBase64## CONSUMES
   gEfiMdeModulePkgTokenSpaceGuid.PcdFlashNvStorageFtwSpareSize  ## CONSUMES
+  gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled
 
 #
 # gBS->CalculateCrc32() is consumed in EntryPoint.
diff --git 
a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c 
b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
index 481fea3..33f99e6 100644
--- a/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
+++ b/MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c
@@ -44,6 +44,7 @@
   This driver need to make sure the CommBuffer is not in the SMRAM range.
 
 Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2018, ARM Limited. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -55,13 +56,16 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 **/
 
 #include 
+#include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include "FaultTolerantWrite.h"
 #include "FaultTolerantWriteSmmCommon.h"
 #include 
+#include 
 
 EFI_EVENT mFvbRegistration = NULL;
 EFI_FTW_DEVICE*mFtwDevice  = NULL;
@@ -92,11 +96,19 @@ FtwGetFvbByHandle (
   //
   // To get the SMM FVB protocol interface on the handle
   //
-  return gSmst->SmmHandleProtocol (
-  FvBlockHandle,
-  ,
-  (VOID **) FvBlock
-  );
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+return gSmst->SmmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+);
+  } else {
+return gMmst->MmHandleProtocol (
+FvBlockHandle,
+,
+(VOID **) FvBlock
+);
+  }
 }
 
 /**
@@ -119,11 +131,19 @@ FtwGetSarProtocol (
   //
   // Locate Smm Swap Address Range protocol
   //
-  Status = gSmst->SmmLocateProtocol (
-,
-NULL,
-SarProtocol
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateProtocol (
+  ,
+  NULL,
+  SarProtocol
+  );
+  } else {
+Status = gMmst->MmLocateProtocol (
+  ,
+  NULL,
+  SarProtocol
+  );
+  }
   return Status;
 }
 
@@ -158,13 +178,23 @@ GetFvbCountAndBuffer (
   BufferSize = 0;
   *NumberHandles = 0;
   *Buffer= NULL;
-  Status = gSmst->SmmLocateHandle (
-ByProtocol,
-,
-NULL,
-,
-*Buffer
-);
+  if (!PcdGetBool (PcdStandaloneMmVariableEnabled)) {
+Status = gSmst->SmmLocateHandle (
+  ByProtocol,
+  ,
+  NULL,
+  ,
+  *Buffer
+  );
+  } else {
+Status = gMmst->MmLocateHandle (
+  ByProtocol,
+  ,
+  NULL,
+  ,
+  *Buffer
+  );
+  }
   if (EFI_ERROR(Status) && Status != EFI_BUFFER_TOO_SMALL) {
 return EFI_NOT_FOUND;
   }
@@ -173,15 +203,23 @@ GetFvbCountAndBuffer (
   if 

[edk2] [PATCH v2 04/11] MdePkg/Include: Add StandaloneMmServicesTableLib library

2019-01-02 Thread Jagadeesh Ujja
Some of the existing DXE drivers can be refactored to execute within
the Standalone MM execution environment as well. Allow such drivers to
get access to the Standalone MM services tables.

Add a mechanism to determine the execution mode is required.
i.e, in MM or non-MM

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdePkg/Include/Library/StandaloneMmServicesTableLib.h| 
43 
 MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c   | 
39 ++
 MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf | 
36 
 MdePkg/MdePkg.dec| 
 4 ++
 4 files changed, 122 insertions(+)

diff --git a/MdePkg/Include/Library/StandaloneMmServicesTableLib.h 
b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
new file mode 100644
index 000..3a27ac4
--- /dev/null
+++ b/MdePkg/Include/Library/StandaloneMmServicesTableLib.h
@@ -0,0 +1,43 @@
+/** @file
+  Provides a service to retrieve a pointer to the Standalone MM Services Table.
+  Provides a InMm implementation for RUNTIME DXE drivers
+
+Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.
+Copyright (c) 2016 - 2018, ARM Limited. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+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.
+
+**/
+
+#ifndef __MM_SERVICES_TABLE_LIB_H__
+#define __MM_SERVICES_TABLE_LIB_H__
+
+#include 
+#include 
+
+extern EFI_MM_SYSTEM_TABLE *gMmst;
+
+/**
+  This function allows the caller to determine if the driver is executing in
+  Standalone Management Mode(SMM).
+
+  This function returns TRUE if the driver is executing in SMM and FALSE if the
+  driver is not executing in SMM.
+
+  @retval  TRUE  The driver is executing in Standalone Management Mode (SMM).
+  @retval  FALSE The driver is not executing in Standalone Management Mode 
(SMM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+  VOID
+  );
+
+#endif
diff --git 
a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c 
b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
new file mode 100644
index 000..6f37cd8
--- /dev/null
+++ b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
@@ -0,0 +1,39 @@
+/** @file
+  Standalone MM Services Table Library.
+
+  Copyright (c) 2018, ARM Limited. All rights reserved.
+
+  This program and the accompanying materials
+  are licensed and made available under the terms and conditions of the BSD 
License
+  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.
+
+**/
+
+#include 
+#include 
+
+EFI_MM_SYSTEM_TABLE *gMmst = NULL;
+
+/**
+  This function allows the caller to determine if the driver is executing in
+  Standalone Management Mode(SMM).
+
+  This function returns TRUE if the driver is executing in SMM and FALSE if the
+  driver is not executing in SMM.
+
+  @retval  TRUE  The driver is executing in Standalone Management Mode (SMM).
+  @retval  FALSE The driver is not executing in Standalone Management Mode 
(SMM).
+
+**/
+BOOLEAN
+EFIAPI
+InMm (
+  VOID
+  )
+{
+  return FALSE;
+}
diff --git 
a/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf 
b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
new file mode 100644
index 000..c94b605
--- /dev/null
+++ 
b/MdePkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
@@ -0,0 +1,36 @@
+## @file
+#  Provides StandaloneMmServicesTableLib.
+#
+#  Copyright (c) 2018, ARM Limited. All rights reserved.
+#
+#  This program and the accompanying materials
+#  are licensed and made available under the terms and conditions
+#  of the BSD License 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.
+#
+##
+
+[Defines]
+  INF_VERSION= 0x00010005
+  BASE_NAME  = StandaloneMmServicesTableLib
+  FILE_GUID  = 8099cfbf-9564-4c9b-9052-e66b1da88930
+  MODULE_TYPE= DXE_RUNTIME_DRIVER
+  VERSION_STRING = 1.0
+  LIBRARY_CLASS  = 

[edk2] [PATCH v2 03/11] MdeModulePkg: Add a PCD to indicate Standalone MM supports secure variable

2019-01-02 Thread Jagadeesh Ujja
Add a flag that indicates whether Standalone MM mode supports
secure storage of variables.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 MdeModulePkg/MdeModulePkg.dec | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 41d2b04..badea4a 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -1041,6 +1041,11 @@
   # @Prompt Enable UEFI Stack Guard.
   gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard|FALSE|BOOLEAN|0x30001055
 
+  ## This flag indicates secure variable functionality is implemented by 
Standalone MM
+  #  TRUE  - Secure variable storage supported by Standalone MM code.
+  #  FALSE - Standalone MM code does not support secure storage of variables
+  
gEfiMdeModulePkgTokenSpaceGuid.PcdStandaloneMmVariableEnabled|FALSE|BOOLEAN|0x30001056
+
 [PcdsFixedAtBuild, PcdsPatchableInModule]
   ## Dynamic type PCD can be registered callback function for Pcd setting 
action.
   #  PcdMaxPeiPcdCallBackNumberPerPcdEntry indicates the maximum number of 
callback function
-- 
2.7.4

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


[edk2] [PATCH v2 02/11] StandaloneMmPkg: Adding the library packages used by MM_STANDALONE drivers

2019-01-02 Thread Jagadeesh Ujja
Drivers of type MM_STANDALONE uses these libraries for accessing the
hoblib and memory allocation.

The Library being added are
  - StandaloneMmHobLib
  - StandaloneMmMemoryAllocationLib
  - StandaloneMmServicesTableLib

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 
StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
 |  64 ++
 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
 | 651 
 StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.inf  
 |  48 ++
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.c
   | 823 
 
StandaloneMmPkg/Library/StandaloneMmMemoryAllocationLib/StandaloneMmMemoryAllocationLib.inf
 |  45 ++
 
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.c
 |  64 ++
 
StandaloneMmPkg/Library/StandaloneMmServicesTableLib/StandaloneMmServicesTableLib.inf
   |  36 +
 7 files changed, 1731 insertions(+)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
new file mode 100644
index 000..ac5a1c0
--- /dev/null
+++ 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/AArch64/StandaloneMmCoreHobLibInternal.c
@@ -0,0 +1,64 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+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.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+//
+// Cache copy of HobList pointer.
+//
+extern VOID *gHobList;
+
+EFI_HOB_HANDOFF_INFO_TABLE*
+HobConstructor (
+  IN VOID   *EfiMemoryBegin,
+  IN UINTN  EfiMemoryLength,
+  IN VOID   *EfiFreeMemoryBottom,
+  IN VOID   *EfiFreeMemoryTop
+  )
+{
+  EFI_HOB_HANDOFF_INFO_TABLE  *Hob;
+  EFI_HOB_GENERIC_HEADER  *HobEnd;
+
+  Hob= EfiFreeMemoryBottom;
+  HobEnd = (EFI_HOB_GENERIC_HEADER *)(Hob+1);
+
+  Hob->Header.HobType = EFI_HOB_TYPE_HANDOFF;
+  Hob->Header.HobLength   = sizeof(EFI_HOB_HANDOFF_INFO_TABLE);
+  Hob->Header.Reserved= 0;
+
+  HobEnd->HobType = EFI_HOB_TYPE_END_OF_HOB_LIST;
+  HobEnd->HobLength   = sizeof(EFI_HOB_GENERIC_HEADER);
+  HobEnd->Reserved= 0;
+
+  Hob->Version = EFI_HOB_HANDOFF_TABLE_VERSION;
+  Hob->BootMode= BOOT_WITH_FULL_CONFIGURATION;
+
+  Hob->EfiMemoryTop= (UINTN)EfiMemoryBegin + EfiMemoryLength;
+  Hob->EfiMemoryBottom = (UINTN)EfiMemoryBegin;
+  Hob->EfiFreeMemoryTop= (UINTN)EfiFreeMemoryTop;
+  Hob->EfiFreeMemoryBottom = (EFI_PHYSICAL_ADDRESS)(UINTN)(HobEnd+1);
+  Hob->EfiEndOfHobList = (EFI_PHYSICAL_ADDRESS)(UINTN)HobEnd;
+
+  gHobList = Hob;
+
+  return Hob;
+}
diff --git a/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c 
b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
new file mode 100644
index 000..e399058
--- /dev/null
+++ b/StandaloneMmPkg/Library/StandaloneMmHobLib/StandaloneMmHobLib.c
@@ -0,0 +1,651 @@
+/** @file
+  HOB Library implementation for Standalone MM Core.
+
+Copyright (c) 2006 - 2014, Intel Corporation. All rights reserved.
+Copyright (c) 2017 - 2018, ARM Limited. All rights reserved.
+
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+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.
+
+**/
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+
+//
+// Cache copy of HobList pointer.
+//
+VOID *gHobList = NULL;
+
+EFI_MM_SYSTEM_TABLE   *gMmst = NULL;
+
+/**
+  The constructor function caches the pointer to HOB list.
+
+  The constructor function gets the start address of HOB list from system 
configuration table.
+  It will ASSERT() if that operation fails and it will always return 
EFI_SUCCESS.
+
+  @param  ImageHandle   The firmware allocated handle for the EFI image.
+  @param  SystemTable   A pointer to the EFI System Table.
+
+  @retval EFI_SUCCESS   The constructor successfully gets HobList.
+  @retval Other value   The constructor can't get HobList.
+
+**/
+EFI_STATUS
+EFIAPI
+HobLibConstructor (
+  IN EFI_HANDLE   

[edk2] [PATCH v2 01/11] StandaloneMmPkg: Remove MM_STANDALONE LIBRARY_CLASS from StandaloneMmCoreHobLib

2019-01-02 Thread Jagadeesh Ujja
For MM_STANDALONE drivers hoblib information will be retrieved from
StandaloneMmHobLib, hence removing from StandaloneMmCoreHobLib
library class.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jagadeesh Ujja 
---
 StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf | 2 
+-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf 
b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
index db19d3c..ac036e3 100644
--- a/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
+++ b/StandaloneMmPkg/Library/StandaloneMmCoreHobLib/StandaloneMmCoreHobLib.inf
@@ -24,7 +24,7 @@
   MODULE_TYPE= MM_CORE_STANDALONE
   VERSION_STRING = 1.0
   PI_SPECIFICATION_VERSION   = 0x00010032
-  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE MM_STANDALONE
+  LIBRARY_CLASS  = HobLib|MM_CORE_STANDALONE
 
 #
 #  VALID_ARCHITECTURES   = AARCH64
-- 
2.7.4

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


[edk2] [PATCH v2 00/11] Extend secure variable service to be usable from Standalone MM

2019-01-02 Thread Jagadeesh Ujja
In-Reply-To: 

Changes since v1:
-Addressed the comments from Liming Gao
 - StandaloneMmServicesTableLib library implemented in MdePkg.
- Addressed all the comments from Ard Biesheuvel.
- For comment from Jian Wang about avoiding if..else, this
  requires a bit more clarity and so this comment has not
  been addressed.
- All the patches in this series can be pulled from
  https://github.com/jagadeeshujja/edk2.git branch: topics/aarch64_secure_vars


Changes since RFC v4:
- Addressed all the comments from Liming Gao
  - Added an additional PCD 'PcdStandaloneMmCodeEnabled' to indicate
presence of StandaloneMM support.
  - MdePkg.dec file updated to include StandaloneMmServiceTableLib and
StandaloneMmRuntimeDxe library.
  - Platform specific changes will be posted in a seperate patchset.
  - AsmLfence wrapper function is supported for AArch64 platforms.
  - All the patches in this series can be pulled from
https://github.com/jagadeeshujja/edk2 (branch: topics/aarch64_secure_vars)

Changes since RFC v3:
- Addressed all the comments from Liming Gao
  - Added a AArch64 implementation of AsmLfence which is a wrapper for
MemoryFence. The changes in variable service driver in v3 of this
patchset that used MemoryFence instead of AsmLfence have been removed.
  - Added StandaloneMmServicesTableLib.h and StandaloneMmRuntimeDxe
library into MdePkg.
  - Renamed PcdStandaloneMmEnable as PcdStandaloneMmVariableEnabled and
added to in to MdePkg.
  - Now with above changes, edk2 packages don't need to depend on
StandaloneMmPkg/StandaloneMmPkg.dec
- Addressed comments from Ting Ye
  - Removed the hacks in the v3 version.
  - Will relook into the “TimerWrapp.c” file and add a appropriate
implementation of this for MM Standalone mode code.

Changes since RFC v2:
- Added 'Contributed-under' tag, removed Change-ID tag and
  maintained a single signed-off-by for the all the patches.

Changes since RFC v1:
- Addressed all the comments from Liming Gao
  - Removed the use of #ifdef/#else/#endif and used a Pcd instead to
select between MM and non-MM paths.
  - Removed all dependencies on edk2-platforms.
  - Dropped the use of mMmst and used gSmst instead.
  - Added a dummy implementation UefiRuntimeServiceTableLib for
MM_STANDALONE usage
- Replaced all uses of AsmLfence with MemoryFence from variable
  service code.
- Add a new StandaloneMmRuntimeDxe library to for use by non-MM code.

This patch series extends the existing secure variable service support for
use with Standalone MM. This is applicable to paltforms that use Standalone
Management Mode to protect access to non-volatile memory (NOR flash in case
of these patches) used to store the secure EFI variables.

The first patch pulls in additional libraries from the staging branch of
StandaloneMmPkg into the edk2's StandaloneMmPkg. The existing secure variable
service implementation supports only the traditional MM mode and so the rest
of the patches extends the existing secure variable service support to be
useable with Standalone MM mode as well.

Jagadeesh Ujja (11):
  StandaloneMmPkg: Remove MM_STANDALONE LIBRARY_CLASS from
StandaloneMmCoreHobLib
  StandaloneMmPkg: Adding the library packages used by MM_STANDALONE
drivers
  MdeModulePkg: Add a PCD to indicate Standalone MM supports secure
variable
  MdePkg/Include: Add StandaloneMmServicesTableLib library
  MdeModulePkg/FaultTolerantWriteDxe: allow reusability as a MM driver
  MdeModulePkg/Variable/RuntimeDxe: adapt for usability with MM
Standalone
  MdeModulePkg/Variable/RuntimeDxe: adapt as a MM Standalone driver
  MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this
library
  ArmPlatformPkg/NorFlashDxe: allow reusability as a MM driver
  SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this
library
  CryptoPkg/BaseCryptLib: allow MM_STANDALONE drivers to use this
library

 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.h   
 |4 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashDxe.inf 
 |2 +
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashFvbDxe.c
 |   96 +-
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.c  
 | 1339 
 ArmPlatformPkg/Drivers/NorFlashDxe/NorFlashStandaloneMm.inf
 |   76 ++
 CryptoPkg/Library/BaseCryptLib/SmmCryptLib.inf 
 |2 +-
 MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf   
 |5 +-
 MdeModulePkg/MdeModulePkg.dec  
 |5 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteDxe.inf 
 |1 +
 MdeModulePkg/Universal/FaultTolerantWriteDxe/FaultTolerantWriteSmm.c   
 |  203 ++-
 

Re: [edk2] [PATCH 12/13] SecurityPkg/AuthVariableLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Ard Biesheuvel
On Fri, 14 Dec 2018 at 13:14, Jagadeesh Ujja  wrote:
>
> “AuthVariableLib” library can be used by MM_STANDALONE drivers as well.
> So add MM_STANDALONE as the module type this library supports.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jagadeesh Ujja 
> Reviewed-by: Chao Zhang 
> ---
>  SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf 
> b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> index 572ba4e..4294d3b 100644
> --- a/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> +++ b/SecurityPkg/Library/AuthVariableLib/AuthVariableLib.inf
> @@ -2,6 +2,7 @@
>  #  Provides authenticated variable services.
>  #
>  #  Copyright (c) 2015 - 2016, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2018, ARM Limited. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions
> @@ -21,12 +22,12 @@
>FILE_GUID  = B23CF5FB-6FCC-4422-B145-D855DBC05457
>MODULE_TYPE= DXE_RUNTIME_DRIVER

Please change the module type to 'BASE' as well. Note that this may
require you to add

#include 

to some source or header files.

With that

Reviewed-by: Ard Biesheuvel 

>VERSION_STRING = 1.0
> -  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER
> +  LIBRARY_CLASS  = AuthVariableLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER MM_STANDALONE
>
>  #
>  # The following information is for reference only and not required by the 
> build tools.
>  #
> -#  VALID_ARCHITECTURES   = IA32 X64
> +#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
>  #
>
>  [Sources]
> --
> 2.7.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [PATCH 10/13] MdeModulePkg/VarCheckLib: allow MM_STANDALONE drivers to use this library

2019-01-02 Thread Ard Biesheuvel
On Fri, 14 Dec 2018 at 13:14, Jagadeesh Ujja  wrote:
>
> “VarCheckLib” library can be used by MM_STANDALONE drivers as well.
> So add MM_STANDALONE as the module type this library supports.
>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Jagadeesh Ujja 
> ---
>  MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf 
> b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> index 099f83d..c8cf810 100644
> --- a/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> +++ b/MdeModulePkg/Library/VarCheckLib/VarCheckLib.inf
> @@ -2,6 +2,7 @@
>  #  Provides variable check services and database management.
>  #
>  #  Copyright (c) 2015, Intel Corporation. All rights reserved.
> +#  Copyright (c) 2018, ARM Limited. All rights reserved.
>  #
>  #  This program and the accompanying materials
>  #  are licensed and made available under the terms and conditions
> @@ -21,12 +22,12 @@
>FILE_GUID  = 63E12D08-0C5D-47F8-95E4-09F89D7506C5
>MODULE_TYPE= DXE_RUNTIME_DRIVER

Please change the module type to 'BASE' as well. Note that this may
require you to add

#include 

to some source or header files.

With that

Reviewed-by: Ard Biesheuvel 

>VERSION_STRING = 1.0
> -  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER
> +  LIBRARY_CLASS  = VarCheckLib|DXE_RUNTIME_DRIVER 
> DXE_SMM_DRIVER MM_STANDALONE
>
>  #
>  # The following information is for reference only and not required by the 
> build tools.
>  #
> -#  VALID_ARCHITECTURES   = IA32 X64
> +#  VALID_ARCHITECTURES   = IA32 X64 AARCH64
>  #
>
>  [Sources]
> --
> 2.7.4
>
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [PATCH] EmbeddedPkg/NorFlashInfoLib: convert to BASE library

2019-01-02 Thread Ard Biesheuvel
The library's MODULE_TYPE and the module type restrictions it
defines are needlessly strict. Just change the library to BASE
type and drop the restrictions entirely. Also, drop a bogus
library dependency on DxeServicesLib.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Ard Biesheuvel 
---
 EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf 
b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
index b4b33247fa52..ee207ae7e9d7 100644
--- a/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
+++ b/EmbeddedPkg/Library/NorFlashInfoLib/NorFlashInfoLib.inf
@@ -16,9 +16,9 @@ [Defines]
   INF_VERSION= 0x00010019
   BASE_NAME  = NorFlashInfoLib
   FILE_GUID  = 6b639c7e-9b53-4e9f-89a3-2e711729709c
-  MODULE_TYPE= DXE_DRIVER
+  MODULE_TYPE= BASE
   VERSION_STRING = 1.0
-  LIBRARY_CLASS  = NorFlashInfoLib|DXE_DRIVER 
DXE_RUNTIME_DRIVER UEFI_APPLICATION
+  LIBRARY_CLASS  = NorFlashInfoLib
 
 [Sources]
   NorFlashInfoLib.c
@@ -30,5 +30,4 @@ [Packages]
 [LibraryClasses]
   BaseLib
   DebugLib
-  DxeServicesLib
   MemoryAllocationLib
-- 
2.19.2

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


Re: [edk2] [RFC] Edk2 BaseTools Python3 Migration Update

2019-01-02 Thread Gary Lin
On Sat, Dec 29, 2018 at 06:07:10AM +, Gao, Liming wrote:
> Lin:
>Thanks for your verification.  This issue has been fixed in the latest 
> version of https://github.com/lgao4/edk2/tree/Python3. Could you try again?
> 
Hi Liming,

I can confirm that the crash I had was fixed in the latest git branch.

Thanks!

Gary Lin

> Thanks
> Liming
> >-Original Message-
> >From: Gary Lin [mailto:g...@suse.com]
> >Sent: Friday, December 28, 2018 6:40 PM
> >To: Gao, Liming 
> >Cc: edk2-devel@lists.01.org; Kinney, Michael D
> >; Laszlo Ersek (ler...@redhat.com)
> >
> >Subject: Re: [edk2] [RFC] Edk2 BaseTools Python3 Migration Update
> >
> >On Tue, Dec 25, 2018 at 07:50:43AM +, Gao, Liming wrote:
> >> Hi, all
> >>   On Python3 migration https://bugzilla.tianocore.org/show_bug.cgi?id=55,
> >we update Edk2 BaseTools python source code with the compatible syntax to
> >support Python2 and Python3 both. Here is code
> >https://github.com/lgao4/edk2/tree/Python3 for dry run. To enable Python3,
> >you just need to set PYTHON3_ENABLE environment as TRUE, then type
> >edksetup.bat/edksetup.sh. Without this setting, BaseTools still run with
> >Python2. So, there is no change for current usage model with Python27.
> >>
> >I've built OVMF with both python2 and python3 based on the branch and
> >the VM crashed immediately. The only message in the debug log is:
> >
> >SecCoreStartupWithStack(0xFFFCC000, 0x82)
> >
> >The result of bisect showed the first bad commit is
> >
> > 500aad1a02c5a8c0f208c9422cce19de7d304faa
> > BaseTools: Update windows and linux run scripts file to use Python3
> >
> >Cheers,
> >
> >Gary Lin
> >
> >>   But, we have no enough resource to fully verify Python2 and Python3 both.
> >We will focus on Python3 validation. If anyone can help verify Python2, it 
> >will
> >be great. And, if you meet with the issue on Python2, please file BZ. We 
> >still
> >fix them.
> >>
> >> Thanks
> >> Liming
> >>
> >> ___
> >> 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-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Patch] BaseTools: Report Error if use SET in Dsc

2019-01-02 Thread BobCF
Build tool do not support SET syntax in DSC.

If the SET statement is used in DSC, build tool just ignore it.

That behavior confused some users that
they think SET statement works in DSC like in FDF.

To avoid such confusion, build tool report ERROR

if there is "SET" statement in Dsc file.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Bob Feng 
Cc: Liming Gao 
---
 BaseTools/Source/Python/Workspace/MetaFileParser.py | 5 +
 1 file changed, 5 insertions(+)

diff --git a/BaseTools/Source/Python/Workspace/MetaFileParser.py 
b/BaseTools/Source/Python/Workspace/MetaFileParser.py
index 032220813b..19d8452a35 100644
--- a/BaseTools/Source/Python/Workspace/MetaFileParser.py
+++ b/BaseTools/Source/Python/Workspace/MetaFileParser.py
@@ -975,10 +975,15 @@ class DscParser(MetaFileParser):
 else:
 SectionType = self._SectionType
 self._ItemType = SectionType
 
 self._ValueList = ['', '', '']
+# "SET pcd = pcd_expression" syntax is not supported in Dsc file.
+if self._CurrentLine.upper().strip().startswith("SET "):
+EdkLogger.error('Parser', FORMAT_INVALID, '''"SET pcd = 
pcd_expression" syntax is not support in Dsc file''',
+ExtraData=self._CurrentLine,
+File=self.MetaFile, Line=self._LineIndex + 1)
 self._SectionParser[SectionType](self)
 if self._ValueList is None:
 continue
 #
 # Model, Value1, Value2, Value3, Arch, ModuleType, 
BelongsToItem=-1, BelongsToFile=-1,
-- 
2.19.1.windows.1

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