[edk2-devel] [ PATCH v2 0/2] Add edk2 submodule policy

2019-07-09 Thread Wang, Jian J
https://bugzilla.tianocore.org/show_bug.cgi?id=1910

Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Liming Gao 

Jian J Wang (2):
  Readme.md: add submodule policy and clone commands
  CryptoPkg/OpensslLib: remove clone commands

 .../Library/OpensslLib/OpenSSL-HOWTO.txt  | 18 ++--
 Readme.md | 28 +++
 2 files changed, 30 insertions(+), 16 deletions(-)

-- 
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43456): https://edk2.groups.io/g/devel/message/43456
Mute This Topic: https://groups.io/mt/32413654/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [ PATCH v2 2/2] CryptoPkg/OpensslLib: remove clone commands

2019-07-09 Thread Wang, Jian J
https://bugzilla.tianocore.org/show_bug.cgi?id=1910

edk2/Readme.md has added a section to explain the correct clone
commands for submodules. Detailed steps in the OpenSSL-HOWTO.txt
are removed to avoid any inconsistency.

Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Jian J Wang 
Reviewed-by: Leif Lindholm 
---
 CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt | 18 ++
 1 file changed, 2 insertions(+), 16 deletions(-)

diff --git a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt 
b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
index db45eb88d1..e52ee27b49 100644
--- a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
+++ b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
@@ -24,22 +24,8 @@ on the cryptography.
 =
   HOW to Install OpenSSL for UEFI Building
 =
-  OpenSSL repository was added as one submodule of EDKII project.
-
-  The user can use the following commands to clone both main EDKII repo and
-openssl submodule:
-  1) Add the "--recursive" flag to the git clone command:
- $ git clone --recursive https://github.com/tianocore/edk2
-or
-  2) Manually initialize and update the submodules after the clone operation
- on main project:
- $ git clone https://github.com/tianocore/edk2
- $ git submodule update --init --recursive
-
-  And use the following combined commands to pull the remote submodule updates
-(e.g. Updating the new supported OpenSSL release tag):
- $ git pull --recurse-submodules && \
-   git submodule update --recursive
+  OpenSSL repository was added as one submodule of EDKII project. Please
+refer to edk2/Readme.md for how to clone the code.
 
 =
   About process_files.pl
-- 
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43458): https://edk2.groups.io/g/devel/message/43458
Mute This Topic: https://groups.io/mt/32413656/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [ PATCH v2 1/2] Readme.md: add submodule policy and clone commands

2019-07-09 Thread Wang, Jian J
> v2: update wording per Leif's and others' comments

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

A section 'Submodules' is added to clarify the submodule policy
in edk2 repo. Git commands are also added to show the correct
way to clone submodule repos, in which '--recursive' is removed
because it's not needed but recommended in other document.

Related commits:
Openssl-1.1.1b upgrade: acfb90911840c38a0beb9bcfe0065668244d2b4d
berkeley-softfloat-3:   3cc57695df5a6e8c65fb46b993836c315cabf49d

Cc: Leif Lindholm 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Jian J Wang 
---
 Readme.md | 28 
 1 file changed, 28 insertions(+)

diff --git a/Readme.md b/Readme.md
index e564c6c09b..c475468655 100644
--- a/Readme.md
+++ b/Readme.md
@@ -143,3 +143,31 @@ Signed-off-by: Contributor Name 
   the change.  Each line should be less than ~70 characters.
 * `Signed-off-by` is the contributor's signature identifying them
   by their real/legal name and their email address.
+
+# Submodules
+
+As a general policy, submodule chain should be avoided in EDK II repo
+as possible as we can. Currently EDK II  contains two submodules
+
+- CryptoPkg/Library/OpensslLib/openssl
+- ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
+
+The latter one is actually required by previous one. It's inevitable
+in openssl-1.1.1 (since stable201905) for floating point parameter
+conversion, but should be dropped once there's no such need in future
+release of openssl.
+
+To get a full, buildable EDK II repository, use following two steps
+of git command
+
+```
+$ git clone https://github.com/tianocore/edk2.git
+$ git submodule update --init
+```
+
+Note: When cloning submodule repos, '--recursive' option is not
+recommended. EDK II itself will not use any code/feature from
+submodules in above submodules. So using '--recursive' adds a
+dependency on being able to reach servers we do not actually want
+any code from, as well as needlessly downloading code we will not
+use.
-- 
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43457): https://edk2.groups.io/g/devel/message/43457
Mute This Topic: https://groups.io/mt/32413655/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-platforms Patch 00/14] Vlv2TbltDevicePkg: Remove Intel Framework dependencies

2019-07-09 Thread Michael D Kinney
Hi Gary,

I have added 2 more patches.  One to disable capsule generation
for IA32 builds.  There are several places the output directory
is hard coded for X64.  Will require converting the POST_BUILD
scripts to python to make this much better.

The second patch is for the Readme.md.  Please review and
verify the instructions.

Thanks,

Mike

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io]
> On Behalf Of Gary Lin
> Sent: Tuesday, July 9, 2019 9:14 PM
> To: devel@edk2.groups.io; Kinney, Michael D
> 
> Cc: Qian, Yi ; Sun, Zailiang
> 
> Subject: Re: [edk2-devel] [edk2-platforms Patch 00/14]
> Vlv2TbltDevicePkg: Remove Intel Framework dependencies
> 
> On Wed, Jul 10, 2019 at 03:38:01AM +,  Michael D
> Kinney  wrote:
> > Hi Gary,
> >
> > I have pushed 2 more patches to my branch.  One fixes
> the ASL issue
> > without removing the code.  The second is a clean up to
> all the DSC
> > files and build scripts to make everything more
> consistent and remove
> > more unused content.
> >
> > https://github.com/mdkinney/edk2-
> platforms/tree/Bug_xxx_Vlv2_Linux_And
> > _Smbios_Fixes_V2
> >
> > Please test this to make sure it still works.
> >
> It works great! I don't need to comment out the
> problematic line anymore.
> 
> > I will work on the Readme and will review the series to
> prepare for
> > sending the patch email review tomorrow.
> >
> > Thanks for all your help and testing.
> Thanks for fixing the gcc build :)
> 
> Gary Lin
> 
> >
> > Mike
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf
> > > Of Gary Lin
> > > Sent: Monday, July 8, 2019 11:04 PM
> > > To: devel@edk2.groups.io; Kinney, Michael D
> > > 
> > > Cc: Qian, Yi ; Sun, Zailiang
> > > 
> > > Subject: Re: [edk2-devel] [edk2-platforms Patch
> 00/14]
> > > Vlv2TbltDevicePkg: Remove Intel Framework
> dependencies
> > >
> > > On Tue, Jul 09, 2019 at 03:52:37AM +,  Michael D
> Kinney  wrote:
> > > > Hi Gary,
> > > >
> > > Hi Mike,
> > >
> > > > I picked up the changes on your branch.  I re-
> enabled
> > > the BIOS ID
> > > > Feature and added support for IA32 GCC builds, so
> the
> > > builds available
> > > > from Windows and Linux are matched now.
> > > >
> > > > I have posted my updated branch here:
> > > >
> > > > https://github.com/mdkinney/edk2-
> > > platforms/tree/Bug_xxx_Vlv2_Linux_And
> > > > _Smbios_Fixes_V2
> > > >
> > > > I also verified that the SD Card support does work,
> so
> > > I am keeping
> > > > that change.
> > > >
> > > I tested the branch + my ASL workaround and booted
> into Linux
> > > successfully.
> > >
> > > > I agree the Readme is out of date.  I will work on
> that
> > > and add to the
> > > > branch referenced above tomorrow.
> > > >
> > > Thanks!
> > >
> > > Gary Lin
> > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > > > -Original Message-
> > > > > From: devel@edk2.groups.io
> > > [mailto:devel@edk2.groups.io] On Behalf
> > > > > Of Gary Lin
> > > > > Sent: Tuesday, July 2, 2019 8:57 PM
> > > > > To: Kinney, Michael D
> 
> > > > > Cc: devel@edk2.groups.io; Qian, Yi
> > > ; Sun,
> > > > > Zailiang 
> > > > > Subject: Re: [edk2-devel] [edk2-platforms Patch
> > > 00/14]
> > > > > Vlv2TbltDevicePkg: Remove Intel Framework
> > > dependencies
> > > > >
> > > > > On Tue, Jul 02, 2019 at 09:11:06PM +,
> Kinney,
> > > Michael D  wrote:
> > > > > > Hi Gary,
> > > > > >
> > > > > Hi Mike,
> > > > >
> > > > > > I have posted an update to your patches the
> removes
> > > the
> > > > > setting of
> > > > > > WORKSPACE and accesses all files relative to
> > > WORKSPACE
> > > > > in the Linux shell scripts.
> > > > > > It also fixes null pointer bugs in the
> > > SmbiosMiscDxe
> > > > > module.
> > > > > >
> > > > > > https://github.com/mdkinney/edk2-
> > > > > platforms/tree/Bug_xxx_Vlv2_Linux_And
> > > > > > _Smbios_Fixes
> > > > > >
> > > > > > With these changes I can boot to the UEFI Shell
> and
> > > to
> > > > > Linux.  Please
> > > > > > verify from your environments.
> > > > > >
> > > > > The fix for SmbiosMiscDxe works for me. Thanks
> for
> > > that!
> > > > >
> > > > > I pushed another commit to my branch to check
> > > WORKSPACE to notify
> > > > > the
> > > > > user:
> > > > >
> > > > > https://github.com/lcp/edk2-
> > > > >
> > >
> platforms/commit/fc530689e913e3de25ca2c553d616b9cef28901c
> > > > >
> > > > > We probably have to update Readme.md later. It's
> > > already dated.
> > > > >
> > > > > > I see you have added the SDMMC modules, but I
> do
> > > not
> > > > > see that peripheral yet.
> > > > > > That feature looks like it needs some more
> debug.
> > > We
> > > > > may need to back
> > > > > > out those changes for now.
> > > > > >
> > > > > I saw the SD card settings in the South Cluster
> > > Configuration menu
> > > > > even without those SDMMC modules, so they are
> > > probably from the
> > > > > edk2-non-osi drivers. However, the SD card didn't
> > > work until I added
> > > > > 

Re: [edk2-devel] [edk2-platforms Patch 00/14] Vlv2TbltDevicePkg: Remove Intel Framework dependencies

2019-07-09 Thread Gary Lin
On Wed, Jul 10, 2019 at 03:38:01AM +,  Michael D Kinney  wrote:
> Hi Gary,
> 
> I have pushed 2 more patches to my branch.  One fixes the
> ASL issue without removing the code.  The second is a clean
> up to all the DSC files and build scripts to make everything
> more consistent and remove more unused content.
> 
> https://github.com/mdkinney/edk2-platforms/tree/Bug_xxx_Vlv2_Linux_And_Smbios_Fixes_V2
> 
> Please test this to make sure it still works.
> 
It works great! I don't need to comment out the problematic line
anymore.

> I will work on the Readme and will review the series to prepare
> for sending the patch email review tomorrow.
> 
> Thanks for all your help and testing.
Thanks for fixing the gcc build :)

Gary Lin

> 
> Mike
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io]
> > On Behalf Of Gary Lin
> > Sent: Monday, July 8, 2019 11:04 PM
> > To: devel@edk2.groups.io; Kinney, Michael D
> > 
> > Cc: Qian, Yi ; Sun, Zailiang
> > 
> > Subject: Re: [edk2-devel] [edk2-platforms Patch 00/14]
> > Vlv2TbltDevicePkg: Remove Intel Framework dependencies
> > 
> > On Tue, Jul 09, 2019 at 03:52:37AM +,  Michael D
> > Kinney  wrote:
> > > Hi Gary,
> > >
> > Hi Mike,
> > 
> > > I picked up the changes on your branch.  I re-enabled
> > the BIOS ID
> > > Feature and added support for IA32 GCC builds, so the
> > builds available
> > > from Windows and Linux are matched now.
> > >
> > > I have posted my updated branch here:
> > >
> > > https://github.com/mdkinney/edk2-
> > platforms/tree/Bug_xxx_Vlv2_Linux_And
> > > _Smbios_Fixes_V2
> > >
> > > I also verified that the SD Card support does work, so
> > I am keeping
> > > that change.
> > >
> > I tested the branch + my ASL workaround and booted into
> > Linux successfully.
> > 
> > > I agree the Readme is out of date.  I will work on that
> > and add to the
> > > branch referenced above tomorrow.
> > >
> > Thanks!
> > 
> > Gary Lin
> > 
> > > Thanks,
> > >
> > > Mike
> > >
> > > > -Original Message-
> > > > From: devel@edk2.groups.io
> > [mailto:devel@edk2.groups.io] On Behalf
> > > > Of Gary Lin
> > > > Sent: Tuesday, July 2, 2019 8:57 PM
> > > > To: Kinney, Michael D 
> > > > Cc: devel@edk2.groups.io; Qian, Yi
> > ; Sun,
> > > > Zailiang 
> > > > Subject: Re: [edk2-devel] [edk2-platforms Patch
> > 00/14]
> > > > Vlv2TbltDevicePkg: Remove Intel Framework
> > dependencies
> > > >
> > > > On Tue, Jul 02, 2019 at 09:11:06PM +,  Kinney,
> > Michael D  wrote:
> > > > > Hi Gary,
> > > > >
> > > > Hi Mike,
> > > >
> > > > > I have posted an update to your patches the removes
> > the
> > > > setting of
> > > > > WORKSPACE and accesses all files relative to
> > WORKSPACE
> > > > in the Linux shell scripts.
> > > > > It also fixes null pointer bugs in the
> > SmbiosMiscDxe
> > > > module.
> > > > >
> > > > > https://github.com/mdkinney/edk2-
> > > > platforms/tree/Bug_xxx_Vlv2_Linux_And
> > > > > _Smbios_Fixes
> > > > >
> > > > > With these changes I can boot to the UEFI Shell and
> > to
> > > > Linux.  Please
> > > > > verify from your environments.
> > > > >
> > > > The fix for SmbiosMiscDxe works for me. Thanks for
> > that!
> > > >
> > > > I pushed another commit to my branch to check
> > WORKSPACE to notify
> > > > the
> > > > user:
> > > >
> > > > https://github.com/lcp/edk2-
> > > >
> > platforms/commit/fc530689e913e3de25ca2c553d616b9cef28901c
> > > >
> > > > We probably have to update Readme.md later. It's
> > already dated.
> > > >
> > > > > I see you have added the SDMMC modules, but I do
> > not
> > > > see that peripheral yet.
> > > > > That feature looks like it needs some more debug.
> > We
> > > > may need to back
> > > > > out those changes for now.
> > > > >
> > > > I saw the SD card settings in the South Cluster
> > Configuration menu
> > > > even without those SDMMC modules, so they are
> > probably from the
> > > > edk2-non-osi drivers. However, the SD card didn't
> > work until I added
> > > > the drivers from MdeModulePkg, so I need those
> > drivers at least for
> > > > my Minnowboard Turbot.
> > > >
> > > > Thanks,
> > > >
> > > > Gary Lin
> > > >
> > > > > I agree there are ASL issues.  The ASL code needs
> > to be
> > > > updated to the
> > > > > latest ASL compiler.
> > > > >
> > > > > Thanks,
> > > > >
> > > > > Mike
> > > > >
> > > > > > -Original Message-
> > > > > > From: Kinney, Michael D
> > > > > > Sent: Tuesday, July 2, 2019 9:50 AM
> > > > > > To: Gary Lin ;
> > devel@edk2.groups.io;
> > > > Kinney, Michael
> > > > > > D 
> > > > > > Cc: Qian, Yi ; Sun, Zailiang
> > > > > > 
> > > > > > Subject: RE: [edk2-devel] [edk2-platforms Patch
> > > > 00/14]
> > > > > > Vlv2TbltDevicePkg: Remove Intel Framework
> > > > dependencies
> > > > > >
> > > > > > Hi Gary,
> > > > > >
> > > > > > Thanks for the branch.  I have the build working
> > and
> > > > have reproduced
> > > > > > the SMBIOS issue and am debugging that now.
> > > > > >
> > > > > > Mike
> > > > > >
> > > > > > > 

Re: [edk2-devel] [edk2-platforms Patch 00/14] Vlv2TbltDevicePkg: Remove Intel Framework dependencies

2019-07-09 Thread Michael D Kinney
Hi Gary,

I have pushed 2 more patches to my branch.  One fixes the
ASL issue without removing the code.  The second is a clean
up to all the DSC files and build scripts to make everything
more consistent and remove more unused content.

https://github.com/mdkinney/edk2-platforms/tree/Bug_xxx_Vlv2_Linux_And_Smbios_Fixes_V2

Please test this to make sure it still works.

I will work on the Readme and will review the series to prepare
for sending the patch email review tomorrow.

Thanks for all your help and testing.

Mike

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io]
> On Behalf Of Gary Lin
> Sent: Monday, July 8, 2019 11:04 PM
> To: devel@edk2.groups.io; Kinney, Michael D
> 
> Cc: Qian, Yi ; Sun, Zailiang
> 
> Subject: Re: [edk2-devel] [edk2-platforms Patch 00/14]
> Vlv2TbltDevicePkg: Remove Intel Framework dependencies
> 
> On Tue, Jul 09, 2019 at 03:52:37AM +,  Michael D
> Kinney  wrote:
> > Hi Gary,
> >
> Hi Mike,
> 
> > I picked up the changes on your branch.  I re-enabled
> the BIOS ID
> > Feature and added support for IA32 GCC builds, so the
> builds available
> > from Windows and Linux are matched now.
> >
> > I have posted my updated branch here:
> >
> > https://github.com/mdkinney/edk2-
> platforms/tree/Bug_xxx_Vlv2_Linux_And
> > _Smbios_Fixes_V2
> >
> > I also verified that the SD Card support does work, so
> I am keeping
> > that change.
> >
> I tested the branch + my ASL workaround and booted into
> Linux successfully.
> 
> > I agree the Readme is out of date.  I will work on that
> and add to the
> > branch referenced above tomorrow.
> >
> Thanks!
> 
> Gary Lin
> 
> > Thanks,
> >
> > Mike
> >
> > > -Original Message-
> > > From: devel@edk2.groups.io
> [mailto:devel@edk2.groups.io] On Behalf
> > > Of Gary Lin
> > > Sent: Tuesday, July 2, 2019 8:57 PM
> > > To: Kinney, Michael D 
> > > Cc: devel@edk2.groups.io; Qian, Yi
> ; Sun,
> > > Zailiang 
> > > Subject: Re: [edk2-devel] [edk2-platforms Patch
> 00/14]
> > > Vlv2TbltDevicePkg: Remove Intel Framework
> dependencies
> > >
> > > On Tue, Jul 02, 2019 at 09:11:06PM +,  Kinney,
> Michael D  wrote:
> > > > Hi Gary,
> > > >
> > > Hi Mike,
> > >
> > > > I have posted an update to your patches the removes
> the
> > > setting of
> > > > WORKSPACE and accesses all files relative to
> WORKSPACE
> > > in the Linux shell scripts.
> > > > It also fixes null pointer bugs in the
> SmbiosMiscDxe
> > > module.
> > > >
> > > > https://github.com/mdkinney/edk2-
> > > platforms/tree/Bug_xxx_Vlv2_Linux_And
> > > > _Smbios_Fixes
> > > >
> > > > With these changes I can boot to the UEFI Shell and
> to
> > > Linux.  Please
> > > > verify from your environments.
> > > >
> > > The fix for SmbiosMiscDxe works for me. Thanks for
> that!
> > >
> > > I pushed another commit to my branch to check
> WORKSPACE to notify
> > > the
> > > user:
> > >
> > > https://github.com/lcp/edk2-
> > >
> platforms/commit/fc530689e913e3de25ca2c553d616b9cef28901c
> > >
> > > We probably have to update Readme.md later. It's
> already dated.
> > >
> > > > I see you have added the SDMMC modules, but I do
> not
> > > see that peripheral yet.
> > > > That feature looks like it needs some more debug.
> We
> > > may need to back
> > > > out those changes for now.
> > > >
> > > I saw the SD card settings in the South Cluster
> Configuration menu
> > > even without those SDMMC modules, so they are
> probably from the
> > > edk2-non-osi drivers. However, the SD card didn't
> work until I added
> > > the drivers from MdeModulePkg, so I need those
> drivers at least for
> > > my Minnowboard Turbot.
> > >
> > > Thanks,
> > >
> > > Gary Lin
> > >
> > > > I agree there are ASL issues.  The ASL code needs
> to be
> > > updated to the
> > > > latest ASL compiler.
> > > >
> > > > Thanks,
> > > >
> > > > Mike
> > > >
> > > > > -Original Message-
> > > > > From: Kinney, Michael D
> > > > > Sent: Tuesday, July 2, 2019 9:50 AM
> > > > > To: Gary Lin ;
> devel@edk2.groups.io;
> > > Kinney, Michael
> > > > > D 
> > > > > Cc: Qian, Yi ; Sun, Zailiang
> > > > > 
> > > > > Subject: RE: [edk2-devel] [edk2-platforms Patch
> > > 00/14]
> > > > > Vlv2TbltDevicePkg: Remove Intel Framework
> > > dependencies
> > > > >
> > > > > Hi Gary,
> > > > >
> > > > > Thanks for the branch.  I have the build working
> and
> > > have reproduced
> > > > > the SMBIOS issue and am debugging that now.
> > > > >
> > > > > Mike
> > > > >
> > > > > > -Original Message-
> > > > > > From: Gary Lin [mailto:g...@suse.com]
> > > > > > Sent: Tuesday, July 2, 2019 2:48 AM
> > > > > > To: devel@edk2.groups.io; Kinney, Michael D
> > > > > > 
> > > > > > Cc: Qian, Yi ; Sun, Zailiang
> > > > > > 
> > > > > > Subject: Re: [edk2-devel] [edk2-platforms Patch
> > > 00/14]
> > > > > > Vlv2TbltDevicePkg: Remove Intel Framework
> > > dependencies
> > > > > >
> > > > > > On Mon, Jul 01, 2019 at 11:07:11PM +,
> Michael
> > > D
> > > > > Kinney  wrote:
> > > > > > > Hi Gary,
> > > > > > >

Re: [edk2-devel] [PATCH] MdeModulePkg/Setup: Check ConfigAccess protocol in case it's destroyed

2019-07-09 Thread Wang, Jian J
Patch was pushed at 034a3b4f555c6844673a5ee6b7aa4faa74e90a6e

Regards,
Jian


> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Dandan Bi
> Sent: Wednesday, July 10, 2019 8:42 AM
> To: devel@edk2.groups.io; Yeh, GregX 
> Cc: Ni, Ray ; Kuo, Ted 
> Subject: Re: [edk2-devel] [PATCH] MdeModulePkg/Setup: Check
> ConfigAccess protocol in case it's destroyed
> 
> Reviewed-by: Dandan Bi 
> 
> Thanks,
> Dandan
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > GregX Yeh
> > Sent: Tuesday, July 9, 2019 11:47 AM
> > To: devel@edk2.groups.io
> > Cc: Bi, Dandan ; Ni, Ray ; Kuo,
> Ted
> > 
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/Setup: Check ConfigAccess
> > protocol in case it's destroyed
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1920
> > Check ConfigAccess protocol is available before process user input.
> >
> > Signed-off-by: GregX Yeh 
> > Cc: Dandan Bi 
> > Cc: Ray Ni 
> > Cc: Ted Kuo 
> > ---
> >  .../Universal/SetupBrowserDxe/Presentation.c   | 34
> > ++
> >  1 file changed, 34 insertions(+)
> >
> > diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> > b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> > index d7927725b2..7c36a6f2b7 100644
> > --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> > +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> > @@ -20,6 +20,38 @@ UINT16 mCurFakeQestId;
> >  FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
> >  BOOLEANmFinishRetrieveCall = FALSE;
> >
> > +/**
> > +  Check whether the ConfigAccess protocol is available
> > +
> > +  @parm FormSet   FormSet of which the ConfigAcces protocol need
> to
> > be checked.
> > +
> > +  @retval EFI_SUCCESS The function executed successfully.
> > +
> > +**/
> > +EFI_STATUS
> > +CheckConfigAccess(
> > +  IN FORM_BROWSER_FORMSET  *FormSet
> > +  )
> > +{
> > +  EFI_STATUS  Status;
> > +
> > +  Status = gBS->HandleProtocol (
> > +  FormSet->DriverHandle,
> > +  &gEfiHiiConfigAccessProtocolGuid,
> > +  (VOID **) &FormSet->ConfigAccess
> > +  );
> > +  if (EFI_ERROR (Status)) {
> > +//
> > +// Configuration Driver don't attach ConfigAccess protocol to its HII
> > package
> > +// list, then there will be no configuration action required.
> > +// Or the ConfigAccess protocol has been uninstalled.
> > +//
> > +FormSet->ConfigAccess = NULL;
> > +  }
> > +
> > +  return EFI_SUCCESS;
> > +}
> > +
> >  /**
> >Evaluate all expressions in a Form.
> >
> > @@ -1686,6 +1718,8 @@ DisplayForm (
> >  return Status;
> >}
> >
> > +  CheckConfigAccess(gCurrentSelection->FormSet);
> > +
> >Status = ProcessUserInput (&UserInput);
> >FreeDisplayFormData();
> >return Status;
> > --
> > 2.16.2.windows.1
> >
> >
> >
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43452): https://edk2.groups.io/g/devel/message/43452
Mute This Topic: https://groups.io/mt/32402217/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 1/2] Readme.md: add submodule policy and clone commands

2019-07-09 Thread Wang, Jian J
Leif,

> -Original Message-
> From: Leif Lindholm [mailto:leif.lindh...@linaro.org]
> Sent: Tuesday, July 09, 2019 5:27 PM
> To: Wang, Jian J 
> Cc: devel@edk2.groups.io; Kinney, Michael D
> ; Gao, Liming 
> Subject: Re: [PATCH 1/2] Readme.md: add submodule policy and clone
> commands
> 
> Hi Jian,
> 
> Many thanks for this.
> A few comments on the text.
> 
> On Tue, Jul 09, 2019 at 02:36:00PM +0800, Jian J Wang wrote:
> > https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> >
> > A section 'Submodules' is added to clarify the submodule policy
> > in edk2 repo. Git commands are also added to show the correct
> > way to clone submodule repos, in which '--recursive' is removed
> > because it's not needed but recommended in other document.
> >
> > Related commits:
> > Openssl-1.1.1b upgrade: acfb90911840c38a0beb9bcfe0065668244d2b4d
> > berkeley-softfloat-3:   3cc57695df5a6e8c65fb46b993836c315cabf49d
> >
> > Cc: Leif Lindholm 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Signed-off-by: Jian J Wang 
> > ---
> >  Readme.md | 19 +++
> >  1 file changed, 19 insertions(+)
> >
> > diff --git a/Readme.md b/Readme.md
> > index e564c6c09b..ddb4da5648 100644
> > --- a/Readme.md
> > +++ b/Readme.md
> > @@ -143,3 +143,22 @@ Signed-off-by: Contributor Name
> 
> >the change.  Each line should be less than ~70 characters.
> >  * `Signed-off-by` is the contributor's signature identifying them
> >by their real/legal name and their email address.
> > +
> > +# Submodules
> > +
> > +As a general policy, submodules should be avoided in EDK II repo as
> possible as we can, especially submodules required by other submodules.
> Currently EDK II  contains two submodules
> 
> Please wrap lines at 80 characters.
> One of the benefits of markdown is that it can be easily read both as
> a plain text file, and be rendered into something else (like html for
> displaying on the web).
> 

I used markdown editor to do this. I didn't notice the line length. I'll wrap
it.

> > +
> > +- CryptoPkg/Library/OpensslLib/openssl
> > +- ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
> > +
> > +The later one is actually required by previous one. It's inevitable in
> openssl-1.1.1 (since stable201905) for floating point parameter conversion,
> but should be dropped once there's no such need in future release of
> openssl.
> 
> "later" -> "latter" when referring to items in an enumeration
> (interesting quirk of English)
> 

Thanks for catching this. I might have used this wrong word for years:(

> > +
> > +Note: When cloning submodule repos, '--recursive' option is not
> recommended. EDK II itself will not use any code/feature from submodules
> in above submodules. '--recursive' might cause failure in cloning behind
> proxy.
> 
> I wouldn't say "behind proxy". It may fail because it adds additional
> servers that must be reachable in order for the clone to succeed.
> 
> So we could replace the last sentence above with something like:
> "So using '--recursive' adds a dependency on being able to reach
> servers we do not actually want any code from, as well as needlessly
> downloading code we will not use."
> 
> I would also prefer to move this "Note:" to immediately below the
> command example:

You're right. I'll use your version instead in v2. Thanks for the comments.

Regards,
Jian
> 
> > +
> > +To get a full, buildable EDK II repository, use following two steps of git
> command
> > +
> > +```
> > +$ git clone https://github.com/tianocore/edk2.git
> > +$ git submodule update --init
> > +```
> > +
> 
> ("Note:" here.)
> 
> /
> Leif
> 
> > --
> > 2.17.1.windows.2
> >

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43451): https://edk2.groups.io/g/devel/message/43451
Mute This Topic: https://groups.io/mt/32402918/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way of cloning edk2 repo

2019-07-09 Thread Wang, Jian J
Pushed at 369c177357312c3e66721f1ea6216ce06c90f569

Regards,
Jian


> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Wang, Jian J
> Sent: Tuesday, July 09, 2019 5:55 PM
> To: devel@edk2.groups.io; leif.lindh...@linaro.org
> Cc: Ard Biesheuvel ; Kinney, Michael D
> ; Gao, Liming 
> Subject: Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way
> of cloning edk2 repo
> 
> Leif,
> 
> I'll try push first (not sure I have write access right). If I can't, please 
> do it
> for me.
> 
> Regards,
> Jian
> 
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Leif Lindholm
> > Sent: Tuesday, July 09, 2019 5:28 PM
> > To: Wang, Jian J 
> > Cc: devel@edk2.groups.io; Ard Biesheuvel ;
> > Kinney, Michael D ; Gao, Liming
> > 
> > Subject: Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change
> way
> > of cloning edk2 repo
> >
> > On Tue, Jul 09, 2019 at 03:21:42PM +0800, Jian J Wang wrote:
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> > >
> > > '--recursive' in cloning edk2 repo might cause failure on machine
> > > behind proxy. It's not actually necessary for edk2. This patch removed
> > > it from git command. A separate command
> > >
> > >$ git submodule update --init
> > >
> > > is added to retrieve repo specified via submodule.
> > >
> > > Cc: Leif Lindholm 
> > > Cc: Ard Biesheuvel 
> > > Cc: Michael D Kinney 
> > > Cc: Liming Gao 
> > > Signed-off-by: Jian J Wang 
> >
> > Reviewed-by: Leif Lindholm 
> >
> > Can you push it yourself, or would you like me to do it?
> >
> > > ---
> > >  Readme.md | 3 ++-
> > >  1 file changed, 2 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/Readme.md b/Readme.md
> > > index e203795d47..63e59f60b4 100644
> > > --- a/Readme.md
> > > +++ b/Readme.md
> > > @@ -83,7 +83,8 @@ target-specific binutils. These are included with
> any
> > prepackaged GCC toolchain
> > > 1. [edk2-non-osi](https://github.com/tianocore/edk2-non-osi) (if
> > building
> > >platforms that need it)
> > > ```
> > > -   $ git clone https://github.com/tianocore/edk2.git --recursive
> > > +   $ git clone https://github.com/tianocore/edk2.git
> > > +   $ git submodule update --init
> > > ...
> > > $ git clone https://github.com/tianocore/edk2-platforms.git
> > > ...
> > > --
> > > 2.17.1.windows.2
> > >
> >
> >
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43450): https://edk2.groups.io/g/devel/message/43450
Mute This Topic: https://groups.io/mt/32403141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] MdeModulePkg/Setup: Check ConfigAccess protocol in case it's destroyed

2019-07-09 Thread Dandan Bi
Reviewed-by: Dandan Bi 

Thanks,
Dandan

> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> GregX Yeh
> Sent: Tuesday, July 9, 2019 11:47 AM
> To: devel@edk2.groups.io
> Cc: Bi, Dandan ; Ni, Ray ; Kuo, Ted
> 
> Subject: [edk2-devel] [PATCH] MdeModulePkg/Setup: Check ConfigAccess
> protocol in case it's destroyed
> 
> https://bugzilla.tianocore.org/show_bug.cgi?id=1920
> Check ConfigAccess protocol is available before process user input.
> 
> Signed-off-by: GregX Yeh 
> Cc: Dandan Bi 
> Cc: Ray Ni 
> Cc: Ted Kuo 
> ---
>  .../Universal/SetupBrowserDxe/Presentation.c   | 34
> ++
>  1 file changed, 34 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> index d7927725b2..7c36a6f2b7 100644
> --- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
> @@ -20,6 +20,38 @@ UINT16 mCurFakeQestId;
>  FORM_DISPLAY_ENGINE_FORM gDisplayFormData;
>  BOOLEANmFinishRetrieveCall = FALSE;
> 
> +/**
> +  Check whether the ConfigAccess protocol is available
> +
> +  @parm FormSet   FormSet of which the ConfigAcces protocol need to
> be checked.
> +
> +  @retval EFI_SUCCESS The function executed successfully.
> +
> +**/
> +EFI_STATUS
> +CheckConfigAccess(
> +  IN FORM_BROWSER_FORMSET  *FormSet
> +  )
> +{
> +  EFI_STATUS  Status;
> +
> +  Status = gBS->HandleProtocol (
> +  FormSet->DriverHandle,
> +  &gEfiHiiConfigAccessProtocolGuid,
> +  (VOID **) &FormSet->ConfigAccess
> +  );
> +  if (EFI_ERROR (Status)) {
> +//
> +// Configuration Driver don't attach ConfigAccess protocol to its HII
> package
> +// list, then there will be no configuration action required.
> +// Or the ConfigAccess protocol has been uninstalled.
> +//
> +FormSet->ConfigAccess = NULL;
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
>  /**
>Evaluate all expressions in a Form.
> 
> @@ -1686,6 +1718,8 @@ DisplayForm (
>  return Status;
>}
> 
> +  CheckConfigAccess(gCurrentSelection->FormSet);
> +
>Status = ProcessUserInput (&UserInput);
>FreeDisplayFormData();
>return Status;
> --
> 2.16.2.windows.1
> 
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43449): https://edk2.groups.io/g/devel/message/43449
Mute This Topic: https://groups.io/mt/32402217/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol

2019-07-09 Thread Gao, Zhichao



> -Original Message-
> From: Wang, Jian J
> Sent: Tuesday, July 9, 2019 5:24 PM
> To: Gao, Zhichao ; devel@edk2.groups.io
> Cc: Sean Brogan ; Wu, Hao A
> ; Ni, Ray ; Zeng, Star
> ; Gao, Liming ; Michael Turner
> ; Bret Barkelew
> 
> Subject: RE: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common
> event protocol
> 
> Hi Zhichao,
> 
> One common comment: please update copy right year.

I got the copyright remind before. Refer to 
https://edk2.groups.io/g/devel/topic/31828852#41576.
This patch is almost provided from MU project and contributed by Microsoft 
developers, 'From:...' is the author. And they didn't add their copyright. So I 
think it is fine to keep the copyright.

> 
> See another comment at the almost the end of the email.
> 
> > -Original Message-
> > From: Gao, Zhichao
> > Sent: Tuesday, July 09, 2019 4:40 PM
> > To: devel@edk2.groups.io
> > Cc: Sean Brogan ; Wang, Jian J
> > ; Wu, Hao A ; Ni, Ray
> > ; Zeng, Star ; Gao, Liming
> > ; Michael Turner
> ;
> > Bret Barkelew 
> > Subject: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common
> event
> > protocol
> >
> > From: Sean Brogan 
> >
> > REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1400
> >
> > If an interrupt happens between CheckEvent and gIdleLoopEvent, there
> > would be a event pending during cpu sleep. So it is required to check
> > the gEventPending with the interrupt disabled.
> >
> > Implement a protocol gEdkiiCommonEventProtocolGuid to support all TPL
> > event for PI drivers that use HW interrput. It has two interface, one
> > is to create event and the other one is to wait for event.
> >
> > Add 'volatile' specifier for gEfiCurrentTpl and gEventPending because
> > they may be changed out of the context (interrupt context).
> >
> > Cc: Jian J Wang 
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Cc: Star Zeng 
> > Cc: Liming gao 
> > Cc: Sean Brogan 
> > Cc: Michael Turner 
> > Cc: Bret Barkelew 
> > Signed-off-by: Zhichao Gao 
> > ---
> >  MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
> >  MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +
> >  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
> >  .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
> >  MdeModulePkg/Core/Dxe/Event/Event.c   | 102 -
> > -
> >  MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
> >  MdeModulePkg/Include/Protocol/Cpu2.h  |   2 +-
> >  7 files changed, 181 insertions(+), 14 deletions(-)
> >
> > diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h
> > b/MdeModulePkg/Core/Dxe/DxeMain.h index 6a64852730..38907bfe8d
> 100644
> > --- a/MdeModulePkg/Core/Dxe/DxeMain.h
> > +++ b/MdeModulePkg/Core/Dxe/DxeMain.h
> > @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> > #include   #include   #include
> > 
> > +#include 
> >  #include 
> >  #include   #include
> >  @@ -47,6 +48,7 @@ SPDX-License-Identifier:
> > BSD-2-Clause-Patent  #include   #include
> >   #include 
> > +#include 
> >  #include   #include
> >   #include 
> @@
> > -274,10 +276,11 @@ extern EFI_METRONOME_ARCH_PROTOCOL
> *gMetronome;
> >  extern EFI_TIMER_ARCH_PROTOCOL  *gTimer;
> >  extern EFI_SECURITY_ARCH_PROTOCOL   *gSecurity;
> >  extern EFI_SECURITY2_ARCH_PROTOCOL  *gSecurity2;
> > +extern EDKII_CPU2_PROTOCOL  *gCpu2;
> >  extern EFI_BDS_ARCH_PROTOCOL*gBds;
> >  extern EFI_SMM_BASE2_PROTOCOL   *gSmmBase2;
> >
> > -extern EFI_TPL  gEfiCurrentTpl;
> > +extern volatile EFI_TPL gEfiCurrentTpl;
> >
> >  extern EFI_GUID *gDxeCoreFileName;
> >  extern EFI_LOADED_IMAGE_PROTOCOL*gDxeCoreLoadedImage;
> > @@ -1714,6 +1717,65 @@ CoreCheckEvent (
> >);
> >
> >
> > +/**
> > +  Stops execution until an event is signaled.
> > +
> > +  Support all TPL.
> > +
> > +  @param  NumberOfEvents The number of events in the UserEvents
> > array
> > +  @param  UserEvents An array of EFI_EVENT
> > +  @param  UserIndex  Pointer to the index of the event which
> > + satisfied the wait condition
> > +
> > +  @retval EFI_SUCCESSThe event indicated by Index was signaled.
> > +  @retval EFI_INVALID_PARAMETER  The event indicated by Index has a
> > notification
> > + function or Event was not a valid type
> > +  @retval EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION
> > +
> > +**/
> > +EFI_STATUS
> > +EFIAPI
> > +CommonWaitForEvent (
> > +  IN UINTNNumberOfEvents,
> > +  IN EFI_EVENT*UserEvents,
> > +  OUT UINTN   *UserIndex
> > +  );
> > +
> > +
> > +/**
> > +  Creates an event in a group.
> > +
> > +  Support all TPL.
> > +
> > +  @param  Type   The type of event to create and its mode 
> > and
> > + attributes
> > +  @param  NotifyTpl

Re: [edk2-devel] [Patch v3] BaseTools: Fix GCC compiler failure in new added tools.

2019-07-09 Thread Leif Lindholm
Hi Liming,

On Tue, Jul 09, 2019 at 05:53:33PM +0800, Liming Gao wrote:
> From: gaozhic 
> 
> GCC 7 or 8 reports some warnings in new added FCE/FMMT/BlmLib.

Please list the specific warnings addressed.
(But also see my comments below - I think this utility needs ripping
out and rewriting.)

> Signed-off-by: Liming Gao 
> Cc: Bob Feng 
> ---
> In V2: 
>   Fix GCC8 compiler issue.
> 
> In V3:
>   Fix snprintf wrong replacement.
> 
>  BaseTools/Source/C/BfmLib/BfmLib.c | 117 
> +++--
>  BaseTools/Source/C/FCE/BinaryParse.c   |   2 +-
>  BaseTools/Source/C/FMMT/FirmwareModuleManagement.c |   2 +-
>  BaseTools/Source/C/FMMT/FmmtLib.c  | 117 
> +++--
>  4 files changed, 122 insertions(+), 116 deletions(-)
> 
> diff --git a/BaseTools/Source/C/BfmLib/BfmLib.c 
> b/BaseTools/Source/C/BfmLib/BfmLib.c
> index 9dedda3da2..8d0ec9038c 100644
> --- a/BaseTools/Source/C/BfmLib/BfmLib.c
> +++ b/BaseTools/Source/C/BfmLib/BfmLib.c
> @@ -9,6 +9,9 @@
>  
>  #include "BinFileManager.h"
>  
> +#define STR_LEN_MAX_4K 4096
> +#define STR_LEN_MAX_1K 1024
> +

Coding style 3.3.3: "Code files should not contain #define and typedef
statements."

Move these to BinFileManager.h?

>  #define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
>  ( \
>(BOOLEAN) ( \
> @@ -116,7 +119,7 @@ LibInitializeFvStruct (
>  
>for (Index = 0; Index < MAX_NUMBER_OF_FILES_IN_FV; Index ++) {
>  memset (Fv->FfsAttuibutes[Index].FfsName, '\0', _MAX_PATH);
> -memset (Fv->FfsAttuibutes[Index].UiName, '\0', _MAX_PATH);
> +memset (Fv->FfsAttuibutes[Index].UiName, '\0', _MAX_PATH * sizeof 
> (CHAR16));
>  
>  Fv->FfsAttuibutes[Index].IsLeaf   = TRUE;
>  Fv->FfsAttuibutes[Index].TotalSectionNum  = 0;
> @@ -2399,153 +2402,153 @@ LibFvHeaderAttributeToStr (
>  
>LocalStr  = NULL;
>  
> -  LocalStr = (CHAR8 *) malloc (1024 * 4);
> +  LocalStr = (CHAR8 *) malloc (STR_LEN_MAX_4K);
>  
>if (LocalStr == NULL) {
>  printf ("Out of resource, memory allocation failed. \n");
>  return EFI_OUT_OF_RESOURCES;
>}
>  
> -  memset (LocalStr, '\0', 1024 * 4);
> +  memset (LocalStr, '\0', STR_LEN_MAX_4K);
>  
>if (Attr == 0 || InfFile  == NULL) {
>  free (LocalStr);
>  return EFI_INVALID_PARAMETER;
>}
>  
> -  strncat (LocalStr, "[attributes] \n", sizeof("[attributes] \n"));
> +  strncat (LocalStr, "[attributes] \n", STR_LEN_MAX_4K - strlen (LocalStr) - 
> 1);

This is a very inefficient, and difficult to read, way of doing this.
It also performs absolutely no error checking (making any future
debugging tedious at best).

I have to be honest - looking at this code, I think the right thing to
do would be to revert the commit adding it and reworking the utility
completely (making sure it gets serious review) before merging it.

I am not surprised the compilers get upset.

This made me have a closer look at the patches adding FCE and FMMT,
and frankly, my opinion of them are similar. These aren't being
upstreamed - this is textbook "chuck over the wall".

Don't get me wrong - the code quality of FMMT is notably higher than
the code quality of FCE, which is notably higher than the code quality
of BfmLib. But even 

BfmLib was added with the comment that it is used by FCE.
So why do FCE and FMMT both have separate copies of LibBfmGuidToStr?
Not just functions doing the same thing, but with the same name.

There are many other issues with these tools.

/
Leif

>  
>if (Attr & EFI_FVB2_READ_DISABLED_CAP) {
> -strncat (LocalStr, "EFI_READ_DISABLED_CAP = TRUE \n", sizeof 
> ("EFI_READ_DISABLED_CAP = TRUE \n"));
> +strncat (LocalStr, "EFI_READ_DISABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
> strlen (LocalStr) - 1);
>}
>  
>if (Attr & EFI_FVB2_READ_ENABLED_CAP) {
> -strncat (LocalStr, "EFI_READ_ENABLED_CAP = TRUE \n", sizeof 
> ("EFI_READ_ENABLED_CAP = TRUE \n"));
> +strncat (LocalStr, "EFI_READ_ENABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
> strlen (LocalStr) - 1);
>}
>  
>if (Attr & EFI_FVB2_READ_STATUS) {
> -strncat (LocalStr, "EFI_READ_STATUS = TRUE \n", sizeof ("EFI_READ_STATUS 
> = TRUE \n"));
> +strncat (LocalStr, "EFI_READ_STATUS = TRUE \n", STR_LEN_MAX_4K - strlen 
> (LocalStr) - 1);
>}
>  
>if (Attr & EFI_FVB2_WRITE_DISABLED_CAP) {
> -strncat (LocalStr, "EFI_WRITE_DISABLED_CAP = TRUE \n", sizeof 
> ("EFI_WRITE_DISABLED_CAP = TRUE \n"));
> +strncat (LocalStr, "EFI_WRITE_DISABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
> strlen (LocalStr) - 1);
>}
>  
>if (Attr & EFI_FVB2_WRITE_ENABLED_CAP) {
> -strncat (LocalStr, "EFI_WRITE_ENABLED_CAP = TRUE \n", sizeof 
> ("EFI_WRITE_ENABLED_CAP = TRUE \n"));
> +strncat (LocalStr, "EFI_WRITE_ENABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
> strlen (LocalStr) - 1);
>}
>  
>if (Attr & EFI_FVB2_WRITE_STATUS) {
> -strncat (LocalStr, "EFI_WRITE_STATUS = TRUE \n", sizeof 
> ("EFI_WRITE_STATUS = TRUE \n"));

[edk2-devel] [PATCH edk2-platforms 0/3] Rectify licensing on various files

2019-07-09 Thread Leif Lindholm
When the change from 2-Clause BSD + CLA to only BSD+Patent happened,
a small number of files in the tree were left untouched because the
licensing situation was unclear; two files had accidental 3-Clause BSD
licenses so could not simply be changed, and some others accidentally
lacked explicit license statements.

This small series rectifies the situation for these files.

This does *not* touch the Marvell Armada/Macchiato source files which
were *intentionally* 3-clause BSD and Marvell have since  agreed to
relicense.

Leif Lindholm (3):
  Platform,Silicon RPi3: update license headers to BSD+Patent
  Platform/RaspberryPi: add license header to PlatformUiAppLib.inf
  Silicon/Hisilicon: add SPDX license tags to IORT .asl files

Cc: Michael D Kinney 
Cc: Ard Biesheuvel 

 Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h| 26 
+-
 Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf |  8 

 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h | 26 
+-
 Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl   |  4 
+++-
 Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl  |  4 
+++-
 Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl|  4 
+++-
 Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl  |  4 
+++-
 7 files changed, 22 insertions(+), 54 deletions(-)

-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43443): https://edk2.groups.io/g/devel/message/43443
Mute This Topic: https://groups.io/mt/32406747/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH edk2-platforms 3/3] Silicon/Hisilicon: add SPDX license tags to IORT .asl files

2019-07-09 Thread Leif Lindholm
These files were generated using iasl as a disassembler, which adds a
(questionable) copyright Intel statement (which I don't actually care
about), but leaves out any sort of license message.

As per https://edk2.groups.io/g/devel/message/41048, these were
always intended to be contributed as 2-clause BSD + CLA, and would
have been converted to BSD+Patent at the big switchover had that been
the case.

Add SPDX header for BSD+Patent, and adjust the questionable copyright
year to when the files were actually created/modified.

Signed-off-by: Leif Lindholm 
Cc: Michael D Kinney 
---
 Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl  | 4 +++-
 Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl | 4 +++-
 Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl   | 4 +++-
 Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl | 4 +++-
 4 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl 
b/Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl
index bb70dcd0c443..4101d86672cd 100644
--- a/Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl
+++ b/Silicon/Hisilicon/Hi1610/Hi1610AcpiTables/D03Iort.asl
@@ -1,7 +1,9 @@
 /*
  * Intel ACPI Component Architecture
  * iASL Compiler/Disassembler version 20151124-64
- * Copyright (c) 2000 - 2015 Intel Corporation
+ * Copyright (c) 2015 Intel Corporation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  * Template for [IORT] ACPI Table (static data table)
  * Format: [ByteLength]  FieldName : HexFieldValue
diff --git a/Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl 
b/Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl
index b64fcb4c7891..472e461f9f07 100644
--- a/Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl
+++ b/Silicon/Hisilicon/Hi1616/D05AcpiTables/D05Iort.asl
@@ -1,7 +1,9 @@
 /*
  * Intel ACPI Component Architecture
  * iASL Compiler/Disassembler version 20151124-64
- * Copyright (c) 2000 - 2015 Intel Corporation
+ * Copyright (c) 2015 - 2016 Intel Corporation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  * Template for [IORT] ACPI Table (static data table)
  * Format: [ByteLength]  FieldName : HexFieldValue
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl 
b/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl
index 994018db96b5..910e406841c1 100644
--- a/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl
+++ b/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620Iort.asl
@@ -1,7 +1,9 @@
 /*
  * Intel ACPI Component Architecture
  * iASL Compiler/Disassembler version 20151124-64
- * Copyright (c) 2000 - 2015 Intel Corporation
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  * Template for [IORT] ACPI Table (static data table)
  * Format: [ByteLength]  FieldName : HexFieldValue
diff --git a/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl 
b/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl
index c9e1cbd6830d..ce56157b3a92 100644
--- a/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl
+++ b/Silicon/Hisilicon/Hi1620/Hi1620AcpiTables/Hi1620IortNoSmmu.asl
@@ -1,7 +1,9 @@
 /*
  * Intel ACPI Component Architecture
  * iASL Compiler/Disassembler version 20151124-64
- * Copyright (c) 2000 - 2015 Intel Corporation
+ * Copyright (c) 2018 Intel Corporation
+ *
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  * Template for [IORT] ACPI Table (static data table)
  * Format: [ByteLength]  FieldName : HexFieldValue
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43446): https://edk2.groups.io/g/devel/message/43446
Mute This Topic: https://groups.io/mt/32406750/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH edk2-platforms 2/3] Platform/RaspberryPi: add license header to PlatformUiAppLib.inf

2019-07-09 Thread Leif Lindholm
PlatformUiAppLib.inf was accidentally merged without an explicit license
header. Add one that matches the actuakl source code (BSD+Patent, after
the general relicensing earlier this year.
(This has been OK:d with Andrei off-list.)

Signed-off-by: Leif Lindholm 
Cc: Michael D Kinney 
---
 Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf | 8 

 1 file changed, 8 insertions(+)

diff --git 
a/Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf 
b/Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf
index cacf55f02a14..27b0c30c3917 100644
--- a/Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf
+++ b/Platform/RaspberryPi/RPi3/Library/PlatformUiAppLib/PlatformUiAppLib.inf
@@ -1,3 +1,11 @@
+#/** @file
+#
+#  Copyright (c) 2017-2018, Andrei Warkentin 
+#
+#  SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+#**/
+
 [Defines]
   INF_VERSION= 0x0001001A
   BASE_NAME  = PlatformUiAppLib
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43445): https://edk2.groups.io/g/devel/message/43445
Mute This Topic: https://groups.io/mt/32406749/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH edk2-platforms 1/3] Platform,Silicon RPi3: update license headers to BSD+Patent

2019-07-09 Thread Leif Lindholm
RpiMbox.h and Bcm2836.h originate from Ard's original efforts, and were
always intended to be 2-clause BSD licensed, but due to a copy/paste
error, they ended up with a 3-clause BSD license instead - which meant
they were left out in Mike's major relicensing set.

(This is explained/confirmed in
https://edk2.groups.io/g/devel/message/40909
and
https://edk2.groups.io/g/devel/message/40911.)

This patch replaces the license headers in both with the SPDX statement
bringing it inline with the majority of the rest of the codebase.

Signed-off-by: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Michael D Kinney 
---
 Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h | 26 
+-
 Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h  | 26 
+-
 2 files changed, 2 insertions(+), 50 deletions(-)

diff --git a/Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h 
b/Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h
index 8547ad05ba61..d3b6f117cfdf 100644
--- a/Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h
+++ b/Platform/RaspberryPi/RPi3/Include/IndustryStandard/RpiMbox.h
@@ -3,31 +3,7 @@
  * Copyright (c) 2019, Pete Batard 
  * Copyright (c) 2016, Linaro Limited. All rights reserved.
  *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- *
- * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- *
- * Neither the name of ARM nor the names of its contributors may be used
- * to endorse or promote products derived from this software without specific
- * prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
+ * SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  **/
 
diff --git a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h 
b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
index f06eb2312c61..4007301228be 100644
--- a/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
+++ b/Silicon/Broadcom/Bcm283x/Include/IndustryStandard/Bcm2836.h
@@ -3,31 +3,7 @@
  *  Copyright (c) 2017, Andrei Warkentin 
  *  Copyright (c) 2016, Linaro Limited. All rights reserved.
  *
- *  Redistribution and use in source and binary forms, with or without
- *  modification, are permitted provided that the following conditions are met:
- *
- *  Redistributions of source code must retain the above copyright notice, this
- *  list of conditions and the following disclaimer.
- *
- *  Redistributions in binary form must reproduce the above copyright notice,
- *  this list of conditions and the following disclaimer in the documentation
- *  and/or other materials provided with the distribution.
- *
- *  Neither the name of ARM nor the names of its contributors may be used
- *  to endorse or promote products derived from this software without specific
- *  prior written permission.
- *
- *  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- *  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- *  IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- *  ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
- *  LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- *  CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- *  SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- *  INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- *  CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- *  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- *  POSSIBILITY OF SUCH DAMAGE.
+ *  SPDX-License-Identifier: BSD-2-Clause-Patent
  *
  **/
 
-- 
2.20.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43444): https://edk2.gr

Re: [edk2-devel] [PATCH] SecurityPkg: Don't Verify the enrolled PK in setup mode

2019-07-09 Thread Zhang, Chao B
Hi Derek:
   The patch is good to me.
   Reviewed-by : Chao Zhang 

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of 
derek.l...@hpe.com
Sent: Tuesday, July 2, 2019 1:25 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH] SecurityPkg: Don't Verify the enrolled PK in 
setup mode

Patch is attached from group.io.
Since ECR785, which is added UEFI 2.3.1 errata A, enrolling a PK in setup mode 
doesn't need to verify the PK.
Below is the sentence about it in UEFI spec
```
3. If the firmware is in setup mode and the variable is one of:
- The global PK variable;
- The global KEK variable;
- The "db" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID; or
- The "dbx" variable with GUID EFI_IMAGE_SECURITY_DATABASE_GUID,
then the firmware implementation shall consider the checks in the following 
steps 4 and 5 to
have passed, and proceed with updating the variable value as outlined below.
```
The step 4 is to verify the signature and the step 5 is to verify the cert.

After this change, when system is in Setup mode, setting a PK does not require 
authenticated variable descriptor.

Signed-off-by: Derek Lin mailto:derek.l...@hpe.com>>
Signed-off-by: cinnamon shia 
mailto:cinnamon.s...@hpe.com>>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43442): https://edk2.groups.io/g/devel/message/43442
Mute This Topic: https://groups.io/mt/32283314/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] Upcoming Event: TianoCore Design / Bug Triage - EMEA - Wed, 07/10/2019 8:00am-9:00am #cal-reminder

2019-07-09 Thread devel@edk2.groups.io Calendar
*Reminder:* TianoCore Design / Bug Triage - EMEA

*When:* Wednesday, 10 July 2019, 8:00am to 9:00am, (GMT-07:00) America/Los 
Angeles

*Where:* https://zoom.us/j/695893389

View Event ( https://edk2.groups.io/g/devel/viewevent?eventid=500773 )

*Organizer:* Stephano Cetola stephano.cet...@linux.intel.com ( 
stephano.cet...@linux.intel.com?subject=Re:%20Event:%20TianoCore%20Design%20%2F%20Bug%20Triage%20-%20EMEA
 )

*Description:*

Join Zoom Meeting

https://zoom.us/j/695893389

One tap mobile

+17207072699,,695893389# US

+16465588656,,695893389# US (New York)

Dial by your location

+1 720 707 2699 US

+1 646 558 8656 US (New York)

Meeting ID: 695 893 389

Find your local number: https://zoom.us/u/abOtdJckxL

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43441): https://edk2.groups.io/g/devel/message/43441
Mute This Topic: https://groups.io/mt/32405919/21656
Mute #cal-reminder: https://groups.io/mk?hashtag=cal-reminder&subid=3846945
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH] IntelFsp2Pkg: Fix various typos

2019-07-09 Thread Chiu, Chasel


Patch pushed: f527942e6bdd9f198db90f2de99a0482e9be5b1b

Thanks!
Chasel

> -Original Message-
> From: Antoine Cœur [mailto:co...@gmx.fr]
> Sent: Friday, July 5, 2019 10:17 PM
> To: devel@edk2.groups.io; Desimone, Nathaniel L
> ; Zeng, Star ; Chiu,
> Chasel 
> Cc: Antoine Cœur 
> Subject: [PATCH] IntelFsp2Pkg: Fix various typos
> 
> Fix various typos in IntelFsp2Pkg.
> ---
>  .../FspSecCore/Ia32/FspApiEntryM.nasm |  4 +--
>  .../FspSecCore/Ia32/InitializeFpu.nasm|  2 +-
>  .../FspSecCore/Ia32/SaveRestoreSseNasm.inc|  2 +-
>  IntelFsp2Pkg/FspSecCore/Ia32/Stack.nasm   |  2 +-
>  IntelFsp2Pkg/FspSecCore/SecFsp.c  |  2 +-
>  IntelFsp2Pkg/FspSecCore/SecMain.c |  2 +-
>  .../FspSecCore/Vtf0/Ia16/ResetVec.asm16   |  2 +-
>  IntelFsp2Pkg/Include/FspEas/FspApi.h  |  6 ++--
>  .../Include/Library/FspSecPlatformLib.h   |  2 +-
>  IntelFsp2Pkg/Library/BaseCacheLib/CacheLib.c  | 10 +++---
>  .../BaseFspDebugLibSerialPort/DebugLib.c  | 34 +--
>  .../BaseFspSwitchStackLib/Ia32/Stack.nasm |  2 +-
>  .../SecFspSecPlatformLibNull/Ia32/Flat32.nasm |  2 +-
>  .../PlatformSecLibNull.c  |  2 +-
>  IntelFsp2Pkg/Tools/GenCfgOpt.py   |  2 +-
>  IntelFsp2Pkg/Tools/PatchFv.py |  2 +-
>  .../Tools/UserManuals/GenCfgOptUserManual.md  |  2 +-
>  .../Tools/UserManuals/PatchFvUserManual.md|  2 +-
>  18 files changed, 41 insertions(+), 41 deletions(-)
> 
> diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
> b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
> index f14c18c7b9..e7261b41cd 100644
> --- a/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
> +++ b/IntelFsp2Pkg/FspSecCore/Ia32/FspApiEntryM.nasm
> @@ -194,9 +194,9 @@ StackSetupDone:
> 
>;
>; Pass BFV into the PEI Core
> -  ; It uses relative address to calucate the actual boot FV base
> +  ; It uses relative address to calculate the actual boot FV base
>; For FSP implementation with single FV, PcdFspBootFirmwareVolumeBase
> and
> -  ; PcdFspAreaBaseAddress are the same. For FSP with mulitple FVs,
> +  ; PcdFspAreaBaseAddress are the same. For FSP with multiple FVs,
>; they are different. The code below can handle both cases.
>;
>callASM_PFX(AsmGetFspBaseAddress)
> diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/InitializeFpu.nasm
> b/IntelFsp2Pkg/FspSecCore/Ia32/InitializeFpu.nasm
> index e1886ea11b..c45520c6c1 100644
> --- a/IntelFsp2Pkg/FspSecCore/Ia32/InitializeFpu.nasm
> +++ b/IntelFsp2Pkg/FspSecCore/Ia32/InitializeFpu.nasm
> @@ -46,7 +46,7 @@ ASM_PFX(InitializeFloatingPointUnits):
>  fldcw[ASM_PFX(mFpuControlWord)]
> 
>  ;
> -; Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
> +; Use CpuId instruction (CPUID.01H:EDX.SSE[bit 25] = 1) to test
>  ; whether the processor supports SSE instruction.
>  ;
>  mov eax, 1
> diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/SaveRestoreSseNasm.inc
> b/IntelFsp2Pkg/FspSecCore/Ia32/SaveRestoreSseNasm.inc
> index b257deb76c..09cb813497 100644
> --- a/IntelFsp2Pkg/FspSecCore/Ia32/SaveRestoreSseNasm.inc
> +++ b/IntelFsp2Pkg/FspSecCore/Ia32/SaveRestoreSseNasm.inc
> @@ -150,7 +150,7 @@ NextAddress:
>  fldcw   [FpuControlWord]
> 
>  ;
> -; Use CpuId instructuion (CPUID.01H:EDX.SSE[bit 25] = 1) to test
> +; Use CpuId instruction (CPUID.01H:EDX.SSE[bit 25] = 1) to
> + test
>  ; whether the processor supports SSE instruction.
>  ;
>  mov eax, 1
> diff --git a/IntelFsp2Pkg/FspSecCore/Ia32/Stack.nasm
> b/IntelFsp2Pkg/FspSecCore/Ia32/Stack.nasm
> index d72212ed45..f183d0d10b 100644
> --- a/IntelFsp2Pkg/FspSecCore/Ia32/Stack.nasm
> +++ b/IntelFsp2Pkg/FspSecCore/Ia32/Stack.nasm
> @@ -58,7 +58,7 @@ ASM_PFX(SecSwitchStack):
>  mov   esp, eax ; From now, esp is pointed to 
> permanent
> memory
> 
>  ;
> -; Fixup the ebp point to permenent memory
> +; Fixup the ebp point to permanent memory
>  ;
>  mov   eax, ebp
>  sub   eax, ebx
> diff --git a/IntelFsp2Pkg/FspSecCore/SecFsp.c
> b/IntelFsp2Pkg/FspSecCore/SecFsp.c
> index 6497c88ebe..a939b7e836 100644
> --- a/IntelFsp2Pkg/FspSecCore/SecFsp.c
> +++ b/IntelFsp2Pkg/FspSecCore/SecFsp.c
> @@ -169,7 +169,7 @@ FspGlobalDataInit (
>SerialPortInitialize ();
> 
>//
> -  // Ensure the golbal data pointer is valid
> +  // Ensure the global data pointer is valid
>//
>ASSERT (GetFspGlobalDataPointer () == PeiFspData);
> 
> diff --git a/IntelFsp2Pkg/FspSecCore/SecMain.c
> b/IntelFsp2Pkg/FspSecCore/SecMain.c
> index cd3ab46ce2..a63d1336e4 100644
> --- a/IntelFsp2Pkg/FspSecCore/SecMain.c
> +++ b/IntelFsp2Pkg/FspSecCore/SecMain.c
> @@ -110,7 +110,7 @@ SecStartup (
>// |---|>
>// |   |
>// |   |
> -  // |  Heap |PeiTemporayRamSize
> +  // |  Heap |PeiTemporaryRamSize

Re: [edk2-devel] [PATCH v2 3/3] UefiCpuPkg/PiSmmCpu: Enable 5 level paging when CPU supports

2019-07-09 Thread Dong, Eric
Reviewed-by: Eric Dong 

> -Original Message-
> From: Ni, Ray
> Sent: Wednesday, July 3, 2019 2:54 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Laszlo Ersek 
> Subject: [PATCH v2 3/3] UefiCpuPkg/PiSmmCpu: Enable 5 level paging when
> CPU supports
> 
> REF:https://bugzilla.tianocore.org/show_bug.cgi?id=1946
> 
> The patch changes SMM environment to use 5 level paging when CPU
> supports it.
> 
> Signed-off-by: Ray Ni 
> Cc: Eric Dong 
> Regression-tested-by: Laszlo Ersek 
> ---
>  .../PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c   |  20 +-
>  UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c| 272 ++
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c   | 485 -
> -
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/SmiEntry.nasm   |  12 +
>  .../PiSmmCpuDxeSmm/X64/SmmProfileArch.c   |  72 ++-
>  5 files changed, 561 insertions(+), 300 deletions(-)
> 
> diff --git
> a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> index 069be3aaa5..55090e9c3e 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
> @@ -125,18 +125,36 @@ GetPageTableEntry (
>UINTN Index2;
>UINTN Index3;
>UINTN Index4;
> +  UINTN Index5;
>UINT64*L1PageTable;
>UINT64*L2PageTable;
>UINT64*L3PageTable;
>UINT64*L4PageTable;
> +  UINT64*L5PageTable;
> +  IA32_CR4  Cr4;
> +  BOOLEAN   Enable5LevelPaging;
> 
> +  Index5 = ((UINTN)RShiftU64 (Address, 48)) & PAGING_PAE_INDEX_MASK;
>Index4 = ((UINTN)RShiftU64 (Address, 39)) & PAGING_PAE_INDEX_MASK;
>Index3 = ((UINTN)Address >> 30) & PAGING_PAE_INDEX_MASK;
>Index2 = ((UINTN)Address >> 21) & PAGING_PAE_INDEX_MASK;
>Index1 = ((UINTN)Address >> 12) & PAGING_PAE_INDEX_MASK;
> 
> +  Cr4.UintN = AsmReadCr4 ();
> +  Enable5LevelPaging = (BOOLEAN) (Cr4.Bits.LA57 == 1);
> +
>if (sizeof(UINTN) == sizeof(UINT64)) {
> -L4PageTable = (UINT64 *)GetPageTableBase ();
> +if (Enable5LevelPaging) {
> +  L5PageTable = (UINT64 *)GetPageTableBase ();
> +  if (L5PageTable[Index5] == 0) {
> +*PageAttribute = PageNone;
> +return NULL;
> +  }
> +
> +  L4PageTable = (UINT64 *)(UINTN)(L5PageTable[Index5] &
> ~mAddressEncMask & PAGING_4K_ADDRESS_MASK_64);
> +} else {
> +  L4PageTable = (UINT64 *)GetPageTableBase ();
> +}
>  if (L4PageTable[Index4] == 0) {
>*PageAttribute = PageNone;
>return NULL;
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> index e2b6a2d9b2..c5131526f0 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmProfile.c
> @@ -534,43 +534,78 @@ InitPaging (
>VOID
>)
>  {
> +  UINT64Pml5Entry;
> +  UINT64Pml4Entry;
> +  UINT64*Pml5;
>UINT64*Pml4;
>UINT64*Pdpt;
>UINT64*Pd;
>UINT64*Pt;
>UINTN Address;
> +  UINTN Pml5Index;
>UINTN Pml4Index;
>UINTN PdptIndex;
>UINTN PdIndex;
>UINTN PtIndex;
>UINTN NumberOfPdptEntries;
>UINTN NumberOfPml4Entries;
> +  UINTN NumberOfPml5Entries;
>UINTN SizeOfMemorySpace;
>BOOLEAN   Nx;
> +  IA32_CR4  Cr4;
> +  BOOLEAN   Enable5LevelPaging;
> +
> +  Cr4.UintN = AsmReadCr4 ();
> +  Enable5LevelPaging = (BOOLEAN) (Cr4.Bits.LA57 == 1);
> 
>if (sizeof (UINTN) == sizeof (UINT64)) {
> -Pml4 = (UINT64*)(UINTN)mSmmProfileCr3;
> +if (!Enable5LevelPaging) {
> +  Pml5Entry = (UINTN) mSmmProfileCr3 | IA32_PG_P;
> +  Pml5 = &Pml5Entry;
> +} else {
> +  Pml5 = (UINT64*) (UINTN) mSmmProfileCr3;
> +}
>  SizeOfMemorySpace = HighBitSet64 (gPhyMask) + 1;
>  //
>  // Calculate the table entries of PML4E and PDPTE.
>  //
> -if (SizeOfMemorySpace <= 39 ) {
> -  NumberOfPml4Entries = 1;
> -  NumberOfPdptEntries = (UINT32)LShiftU64 (1, (SizeOfMemorySpace -
> 30));
> -} else {
> -  NumberOfPml4Entries = (UINT32)LShiftU64 (1, (SizeOfMemorySpace -
> 39));
> -  NumberOfPdptEntries = 512;
> +NumberOfPml5Entries = 1;
> +if (SizeOfMemorySpace > 48) {
> +  NumberOfPml5Entries = (UINTN) LShiftU64 (1, SizeOfMemorySpace - 48);
> +  SizeOfMemorySpace = 48;
>  }
> -  } else {
> +
>  NumberOfPml4Entries = 1;
> +if (SizeOfMemorySpa

Re: [edk2-devel] [Patch v3] BaseTools: Fix GCC compiler failure in new added tools.

2019-07-09 Thread Gary Lin
On Tue, Jul 09, 2019 at 05:53:33PM +0800,  Liming Gao  wrote:
> From: gaozhic 
> 
> GCC 7 or 8 reports some warnings in new added FCE/FMMT/BlmLib.
> 
> Signed-off-by: Liming Gao 
> Cc: Bob Feng 
> ---
> In V2: 
>   Fix GCC8 compiler issue.
> 
> In V3:
>   Fix snprintf wrong replacement.
> 
>  BaseTools/Source/C/BfmLib/BfmLib.c | 117 
> +++--
>  BaseTools/Source/C/FCE/BinaryParse.c   |   2 +-
>  BaseTools/Source/C/FMMT/FirmwareModuleManagement.c |   2 +-
>  BaseTools/Source/C/FMMT/FmmtLib.c  | 117 
> +++--
>  4 files changed, 122 insertions(+), 116 deletions(-)
> 
-->8--

> diff --git a/BaseTools/Source/C/FCE/BinaryParse.c 
> b/BaseTools/Source/C/FCE/BinaryParse.c
> index e9f8ee6826..97d6ecf93b 100644
> --- a/BaseTools/Source/C/FCE/BinaryParse.c
> +++ b/BaseTools/Source/C/FCE/BinaryParse.c
> @@ -1240,7 +1240,7 @@ Done:
>) {
>  continue;
>}
> -  sprintf (FileNameArry, "%s%c%s", FolderName, OS_SEP, pDirent->d_name);
> +  snprintf (FileNameArry, MAX_FILENAME_LEN, "%s%c%s", FolderName, 
> OS_SEP, pDirent->d_name);
>FfsFile = fopen (FileNameArry, "rb");
>Status = ReadFfsHeader (FfsFile, (UINT32 *)&FileSize);
>if (EFI_ERROR (Status)) {
I got a new warning after applying this patch:

BinaryParse.c: In function ‘FindFileInFolder’:
BinaryParse.c:1243:54: error: ‘%s’ directive output may be truncated writing up 
to 255 bytes into a region of size 199 [-Werror=format-truncation=]
 1243 |   snprintf (FileNameArry, MAX_FILENAME_LEN, "%s%c%s", FolderName, 
OS_SEP, pDirent->d_name);
  |  ^~
BinaryParse.c:1243:7: note: ‘snprintf’ output 2 or more bytes (assuming 257) 
into a destination of size 200
 1243 |   snprintf (FileNameArry, MAX_FILENAME_LEN, "%s%c%s", FolderName, 
OS_SEP, pDirent->d_name);
  |   
^~~~
cc1: all warnings being treated as errors

Gary Lin

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43438): https://edk2.groups.io/g/devel/message/43438
Mute This Topic: https://groups.io/mt/32403705/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way of cloning edk2 repo

2019-07-09 Thread Wang, Jian J
Leif,

I'll try push first (not sure I have write access right). If I can't, please do 
it
for me.

Regards,
Jian


> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Leif Lindholm
> Sent: Tuesday, July 09, 2019 5:28 PM
> To: Wang, Jian J 
> Cc: devel@edk2.groups.io; Ard Biesheuvel ;
> Kinney, Michael D ; Gao, Liming
> 
> Subject: Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way
> of cloning edk2 repo
> 
> On Tue, Jul 09, 2019 at 03:21:42PM +0800, Jian J Wang wrote:
> > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> >
> > '--recursive' in cloning edk2 repo might cause failure on machine
> > behind proxy. It's not actually necessary for edk2. This patch removed
> > it from git command. A separate command
> >
> >$ git submodule update --init
> >
> > is added to retrieve repo specified via submodule.
> >
> > Cc: Leif Lindholm 
> > Cc: Ard Biesheuvel 
> > Cc: Michael D Kinney 
> > Cc: Liming Gao 
> > Signed-off-by: Jian J Wang 
> 
> Reviewed-by: Leif Lindholm 
> 
> Can you push it yourself, or would you like me to do it?
> 
> > ---
> >  Readme.md | 3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> >
> > diff --git a/Readme.md b/Readme.md
> > index e203795d47..63e59f60b4 100644
> > --- a/Readme.md
> > +++ b/Readme.md
> > @@ -83,7 +83,8 @@ target-specific binutils. These are included with any
> prepackaged GCC toolchain
> > 1. [edk2-non-osi](https://github.com/tianocore/edk2-non-osi) (if
> building
> >platforms that need it)
> > ```
> > -   $ git clone https://github.com/tianocore/edk2.git --recursive
> > +   $ git clone https://github.com/tianocore/edk2.git
> > +   $ git submodule update --init
> > ...
> > $ git clone https://github.com/tianocore/edk2-platforms.git
> > ...
> > --
> > 2.17.1.windows.2
> >
> 
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43437): https://edk2.groups.io/g/devel/message/43437
Mute This Topic: https://groups.io/mt/32403141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-DecSpecification PATCH v1] DEC document: Add HOST_APPLICATION ModuleType

2019-07-09 Thread Xiaoyu Lu
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1952

INF spec add a new ModuleType HOST_APPLICATION.
DEC spec also need to be updated.

Cc: Liming Gao 
Cc: Jiewen Yao 
Signed-off-by: Xiaoyu Lu 
---
 1_introduction/12_terms.md   | 5 +++--
 .../32_package_declaration_dec_definitions.md| 1 +
 README.md| 4 ++--
 appendix_b_edk_ii_module_types.md| 1 +
 4 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/1_introduction/12_terms.md b/1_introduction/12_terms.md
index e6f7a3d..40e78aa 100644
--- a/1_introduction/12_terms.md
+++ b/1_introduction/12_terms.md
@@ -222,8 +222,9 @@ All libraries and components belong to one of the following 
module types: `BASE`
 framework that is consistent with a similar set of requirements. A module that
 is of module type BASE, depends only on headers and libraries provided in the
 MDE, while a module that is of module type DXE_DRIVER depends on common DXE
-components. The EDK II build system also permits modules of type 
`USER_DEFINED`.
-These modules will not be processed by the EDK II Build system. See
+components. The EDK II build system also permits modules of type `USER_DEFINED`
+and `HOST_APPLICATION`. These modules will not be processed by the EDK II Build
+system. See
 [Table 2 EDK II Module 
Types](appendix_b_edk_ii_module_types.md#table-2-edk-ii-module-types).
 
 **Package**
diff --git a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md 
b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
index dc18fb0..92d6fb4 100644
--- a/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
+++ b/3_edk_ii_dec_file_format/32_package_declaration_dec_definitions.md
@@ -236,6 +236,7 @@ DEC file (for example, `` statements are not 
permitted).
   {"DXE_RUNTIME_DRIVER"} {"DXE_SAL_DRIVER"}
   {"DXE_SMM_DRIVER"} {"UEFI_DRIVER"}
   {"UEFI_APPLICATION"} {"USER_DEFINED"}
+  {"HOST_APPLICATION"}
   ::=  [" " ]*
   ::=  {} {} 
  ::= {} {}
diff --git a/README.md b/README.md
index 64a0964..70d0278 100644
--- a/README.md
+++ b/README.md
@@ -1,7 +1,7 @@
 

[edk2-devel] [Patch v3] BaseTools: Fix GCC compiler failure in new added tools.

2019-07-09 Thread Liming Gao
From: gaozhic 

GCC 7 or 8 reports some warnings in new added FCE/FMMT/BlmLib.

Signed-off-by: Liming Gao 
Cc: Bob Feng 
---
In V2: 
  Fix GCC8 compiler issue.

In V3:
  Fix snprintf wrong replacement.

 BaseTools/Source/C/BfmLib/BfmLib.c | 117 +++--
 BaseTools/Source/C/FCE/BinaryParse.c   |   2 +-
 BaseTools/Source/C/FMMT/FirmwareModuleManagement.c |   2 +-
 BaseTools/Source/C/FMMT/FmmtLib.c  | 117 +++--
 4 files changed, 122 insertions(+), 116 deletions(-)

diff --git a/BaseTools/Source/C/BfmLib/BfmLib.c 
b/BaseTools/Source/C/BfmLib/BfmLib.c
index 9dedda3da2..8d0ec9038c 100644
--- a/BaseTools/Source/C/BfmLib/BfmLib.c
+++ b/BaseTools/Source/C/BfmLib/BfmLib.c
@@ -9,6 +9,9 @@
 
 #include "BinFileManager.h"
 
+#define STR_LEN_MAX_4K 4096
+#define STR_LEN_MAX_1K 1024
+
 #define EFI_TEST_FFS_ATTRIBUTES_BIT(FvbAttributes, TestAttributes, Bit) \
 ( \
   (BOOLEAN) ( \
@@ -116,7 +119,7 @@ LibInitializeFvStruct (
 
   for (Index = 0; Index < MAX_NUMBER_OF_FILES_IN_FV; Index ++) {
 memset (Fv->FfsAttuibutes[Index].FfsName, '\0', _MAX_PATH);
-memset (Fv->FfsAttuibutes[Index].UiName, '\0', _MAX_PATH);
+memset (Fv->FfsAttuibutes[Index].UiName, '\0', _MAX_PATH * sizeof 
(CHAR16));
 
 Fv->FfsAttuibutes[Index].IsLeaf   = TRUE;
 Fv->FfsAttuibutes[Index].TotalSectionNum  = 0;
@@ -2399,153 +2402,153 @@ LibFvHeaderAttributeToStr (
 
   LocalStr  = NULL;
 
-  LocalStr = (CHAR8 *) malloc (1024 * 4);
+  LocalStr = (CHAR8 *) malloc (STR_LEN_MAX_4K);
 
   if (LocalStr == NULL) {
 printf ("Out of resource, memory allocation failed. \n");
 return EFI_OUT_OF_RESOURCES;
   }
 
-  memset (LocalStr, '\0', 1024 * 4);
+  memset (LocalStr, '\0', STR_LEN_MAX_4K);
 
   if (Attr == 0 || InfFile  == NULL) {
 free (LocalStr);
 return EFI_INVALID_PARAMETER;
   }
 
-  strncat (LocalStr, "[attributes] \n", sizeof("[attributes] \n"));
+  strncat (LocalStr, "[attributes] \n", STR_LEN_MAX_4K - strlen (LocalStr) - 
1);
 
   if (Attr & EFI_FVB2_READ_DISABLED_CAP) {
-strncat (LocalStr, "EFI_READ_DISABLED_CAP = TRUE \n", sizeof 
("EFI_READ_DISABLED_CAP = TRUE \n"));
+strncat (LocalStr, "EFI_READ_DISABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
strlen (LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_READ_ENABLED_CAP) {
-strncat (LocalStr, "EFI_READ_ENABLED_CAP = TRUE \n", sizeof 
("EFI_READ_ENABLED_CAP = TRUE \n"));
+strncat (LocalStr, "EFI_READ_ENABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
strlen (LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_READ_STATUS) {
-strncat (LocalStr, "EFI_READ_STATUS = TRUE \n", sizeof ("EFI_READ_STATUS = 
TRUE \n"));
+strncat (LocalStr, "EFI_READ_STATUS = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_WRITE_DISABLED_CAP) {
-strncat (LocalStr, "EFI_WRITE_DISABLED_CAP = TRUE \n", sizeof 
("EFI_WRITE_DISABLED_CAP = TRUE \n"));
+strncat (LocalStr, "EFI_WRITE_DISABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
strlen (LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_WRITE_ENABLED_CAP) {
-strncat (LocalStr, "EFI_WRITE_ENABLED_CAP = TRUE \n", sizeof 
("EFI_WRITE_ENABLED_CAP = TRUE \n"));
+strncat (LocalStr, "EFI_WRITE_ENABLED_CAP = TRUE \n", STR_LEN_MAX_4K - 
strlen (LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_WRITE_STATUS) {
-strncat (LocalStr, "EFI_WRITE_STATUS = TRUE \n", sizeof ("EFI_WRITE_STATUS 
= TRUE \n"));
+strncat (LocalStr, "EFI_WRITE_STATUS = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_LOCK_CAP) {
-strncat (LocalStr, "EFI_LOCK_CAP = TRUE \n", sizeof ("EFI_LOCK_CAP = TRUE 
\n"));
+strncat (LocalStr, "EFI_LOCK_CAP = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_LOCK_STATUS) {
-strncat (LocalStr, "EFI_LOCK_STATUS = TRUE \n", sizeof ("EFI_LOCK_STATUS = 
TRUE \n"));
+strncat (LocalStr, "EFI_LOCK_STATUS = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_STICKY_WRITE) {
-strncat (LocalStr, "EFI_STICKY_WRITE = TRUE \n", sizeof ("EFI_STICKY_WRITE 
= TRUE \n"));
+strncat (LocalStr, "EFI_STICKY_WRITE = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_MEMORY_MAPPED) {
-strncat (LocalStr, "EFI_MEMORY_MAPPED = TRUE \n", sizeof 
("EFI_MEMORY_MAPPED = TRUE \n"));
+strncat (LocalStr, "EFI_MEMORY_MAPPED = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_ERASE_POLARITY) {
-strncat (LocalStr, "EFI_ERASE_POLARITY = 1 \n", sizeof 
("EFI_ERASE_POLARITY = 1 \n"));
+strncat (LocalStr, "EFI_ERASE_POLARITY = 1 \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_READ_LOCK_CAP) {
-strncat (LocalStr, "EFI_READ_LOCK_CAP = TRUE \n", sizeof 
("EFI_READ_LOCK_CAP = TRUE \n"));
+strncat (LocalStr, "EFI_READ_LOCK_CAP = TRUE \n", STR_LEN_MAX_4K - strlen 
(LocalStr) - 1);
   }
 
   if (Attr & EFI_FVB2_READ_LOCK_STATUS) {
-   

Re: [edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way of cloning edk2 repo

2019-07-09 Thread Leif Lindholm
On Tue, Jul 09, 2019 at 03:21:42PM +0800, Jian J Wang wrote:
> BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> 
> '--recursive' in cloning edk2 repo might cause failure on machine
> behind proxy. It's not actually necessary for edk2. This patch removed
> it from git command. A separate command
> 
>$ git submodule update --init
> 
> is added to retrieve repo specified via submodule.
> 
> Cc: Leif Lindholm 
> Cc: Ard Biesheuvel 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Jian J Wang 

Reviewed-by: Leif Lindholm 

Can you push it yourself, or would you like me to do it?

> ---
>  Readme.md | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/Readme.md b/Readme.md
> index e203795d47..63e59f60b4 100644
> --- a/Readme.md
> +++ b/Readme.md
> @@ -83,7 +83,8 @@ target-specific binutils. These are included with any 
> prepackaged GCC toolchain
> 1. [edk2-non-osi](https://github.com/tianocore/edk2-non-osi) (if building
>platforms that need it)
> ```
> -   $ git clone https://github.com/tianocore/edk2.git --recursive
> +   $ git clone https://github.com/tianocore/edk2.git
> +   $ git submodule update --init
> ...
> $ git clone https://github.com/tianocore/edk2-platforms.git
> ...
> -- 
> 2.17.1.windows.2
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43434): https://edk2.groups.io/g/devel/message/43434
Mute This Topic: https://groups.io/mt/32403141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 2/2] CryptoPkg/OpensslLib: remove clone commands

2019-07-09 Thread Leif Lindholm
On Tue, Jul 09, 2019 at 02:36:01PM +0800, Jian J Wang wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> 
> edk2/Readme.md has added a section to explain the correct clone
> commands for submodules. Detailed steps in the OpenSSL-HOWTO.txt
> are removed to avoid any inconsistency.
> 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Jian J Wang 

Reviewed-by: Leif Lindholm 

> ---
>  CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt | 18 ++
>  1 file changed, 2 insertions(+), 16 deletions(-)
> 
> diff --git a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt 
> b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
> index db45eb88d1..e52ee27b49 100644
> --- a/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
> +++ b/CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt
> @@ -24,22 +24,8 @@ on the cryptography.
>  =
>HOW to Install OpenSSL for UEFI Building
>  =
> -  OpenSSL repository was added as one submodule of EDKII project.
> -
> -  The user can use the following commands to clone both main EDKII repo and
> -openssl submodule:
> -  1) Add the "--recursive" flag to the git clone command:
> - $ git clone --recursive https://github.com/tianocore/edk2
> -or
> -  2) Manually initialize and update the submodules after the clone operation
> - on main project:
> - $ git clone https://github.com/tianocore/edk2
> - $ git submodule update --init --recursive
> -
> -  And use the following combined commands to pull the remote submodule 
> updates
> -(e.g. Updating the new supported OpenSSL release tag):
> - $ git pull --recurse-submodules && \
> -   git submodule update --recursive
> +  OpenSSL repository was added as one submodule of EDKII project. Please
> +refer to edk2/Readme.md for how to clone the code.
>  
>  =
>About process_files.pl
> -- 
> 2.17.1.windows.2
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43433): https://edk2.groups.io/g/devel/message/43433
Mute This Topic: https://groups.io/mt/32402920/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH 1/2] Readme.md: add submodule policy and clone commands

2019-07-09 Thread Leif Lindholm
Hi Jian,

Many thanks for this.
A few comments on the text.

On Tue, Jul 09, 2019 at 02:36:00PM +0800, Jian J Wang wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=1910
> 
> A section 'Submodules' is added to clarify the submodule policy
> in edk2 repo. Git commands are also added to show the correct
> way to clone submodule repos, in which '--recursive' is removed
> because it's not needed but recommended in other document.
> 
> Related commits:
> Openssl-1.1.1b upgrade: acfb90911840c38a0beb9bcfe0065668244d2b4d
> berkeley-softfloat-3:   3cc57695df5a6e8c65fb46b993836c315cabf49d
> 
> Cc: Leif Lindholm 
> Cc: Michael D Kinney 
> Cc: Liming Gao 
> Signed-off-by: Jian J Wang 
> ---
>  Readme.md | 19 +++
>  1 file changed, 19 insertions(+)
> 
> diff --git a/Readme.md b/Readme.md
> index e564c6c09b..ddb4da5648 100644
> --- a/Readme.md
> +++ b/Readme.md
> @@ -143,3 +143,22 @@ Signed-off-by: Contributor Name 
>the change.  Each line should be less than ~70 characters.
>  * `Signed-off-by` is the contributor's signature identifying them
>by their real/legal name and their email address.
> +
> +# Submodules
> +
> +As a general policy, submodules should be avoided in EDK II repo as possible 
> as we can, especially submodules required by other submodules. Currently EDK 
> II  contains two submodules

Please wrap lines at 80 characters.
One of the benefits of markdown is that it can be easily read both as
a plain text file, and be rendered into something else (like html for
displaying on the web).

> +
> +- CryptoPkg/Library/OpensslLib/openssl
> +- ArmPkg/Library/ArmSoftFloatLib/berkeley-softfloat-3
> +
> +The later one is actually required by previous one. It's inevitable in 
> openssl-1.1.1 (since stable201905) for floating point parameter conversion, 
> but should be dropped once there's no such need in future release of openssl.

"later" -> "latter" when referring to items in an enumeration
(interesting quirk of English)

> +
> +Note: When cloning submodule repos, '--recursive' option is not recommended. 
> EDK II itself will not use any code/feature from submodules in above 
> submodules. '--recursive' might cause failure in cloning behind proxy.

I wouldn't say "behind proxy". It may fail because it adds additional
servers that must be reachable in order for the clone to succeed.

So we could replace the last sentence above with something like:
"So using '--recursive' adds a dependency on being able to reach
servers we do not actually want any code from, as well as needlessly
downloading code we will not use."

I would also prefer to move this "Note:" to immediately below the
command example:

> +
> +To get a full, buildable EDK II repository, use following two steps of git 
> command
> +
> +```
> +$ git clone https://github.com/tianocore/edk2.git
> +$ git submodule update --init
> +```
> +

("Note:" here.)

/
Leif

> -- 
> 2.17.1.windows.2
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43432): https://edk2.groups.io/g/devel/message/43432
Mute This Topic: https://groups.io/mt/32402918/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



Re: [edk2-devel] [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol

2019-07-09 Thread Wang, Jian J
Hi Zhichao,

One common comment: please update copy right year.

See another comment at the almost the end of the email.

> -Original Message-
> From: Gao, Zhichao
> Sent: Tuesday, July 09, 2019 4:40 PM
> To: devel@edk2.groups.io
> Cc: Sean Brogan ; Wang, Jian J
> ; Wu, Hao A ; Ni, Ray
> ; Zeng, Star ; Gao, Liming
> ; Michael Turner ;
> Bret Barkelew 
> Subject: [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common
> event protocol
> 
> From: Sean Brogan 
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1400
> 
> If an interrupt happens between CheckEvent and gIdleLoopEvent,
> there would be a event pending during cpu sleep. So it is
> required to check the gEventPending with the interrupt disabled.
> 
> Implement a protocol gEdkiiCommonEventProtocolGuid to support
> all TPL event for PI drivers that use HW interrput. It has two
> interface, one is to create event and the other one is to wait for
> event.
> 
> Add 'volatile' specifier for gEfiCurrentTpl and gEventPending
> because they may be changed out of the context (interrupt context).
> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Cc: Star Zeng 
> Cc: Liming gao 
> Cc: Sean Brogan 
> Cc: Michael Turner 
> Cc: Bret Barkelew 
> Signed-off-by: Zhichao Gao 
> ---
>  MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
>  MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +
>  MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
>  .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
>  MdeModulePkg/Core/Dxe/Event/Event.c   | 102 -
> -
>  MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
>  MdeModulePkg/Include/Protocol/Cpu2.h  |   2 +-
>  7 files changed, 181 insertions(+), 14 deletions(-)
> 
> diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h
> b/MdeModulePkg/Core/Dxe/DxeMain.h
> index 6a64852730..38907bfe8d 100644
> --- a/MdeModulePkg/Core/Dxe/DxeMain.h
> +++ b/MdeModulePkg/Core/Dxe/DxeMain.h
> @@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -47,6 +48,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
>  #include 
>  #include 
> @@ -274,10 +276,11 @@ extern EFI_METRONOME_ARCH_PROTOCOL
> *gMetronome;
>  extern EFI_TIMER_ARCH_PROTOCOL  *gTimer;
>  extern EFI_SECURITY_ARCH_PROTOCOL   *gSecurity;
>  extern EFI_SECURITY2_ARCH_PROTOCOL  *gSecurity2;
> +extern EDKII_CPU2_PROTOCOL  *gCpu2;
>  extern EFI_BDS_ARCH_PROTOCOL*gBds;
>  extern EFI_SMM_BASE2_PROTOCOL   *gSmmBase2;
> 
> -extern EFI_TPL  gEfiCurrentTpl;
> +extern volatile EFI_TPL gEfiCurrentTpl;
> 
>  extern EFI_GUID *gDxeCoreFileName;
>  extern EFI_LOADED_IMAGE_PROTOCOL*gDxeCoreLoadedImage;
> @@ -1714,6 +1717,65 @@ CoreCheckEvent (
>);
> 
> 
> +/**
> +  Stops execution until an event is signaled.
> +
> +  Support all TPL.
> +
> +  @param  NumberOfEvents The number of events in the UserEvents
> array
> +  @param  UserEvents An array of EFI_EVENT
> +  @param  UserIndex  Pointer to the index of the event which
> + satisfied the wait condition
> +
> +  @retval EFI_SUCCESSThe event indicated by Index was signaled.
> +  @retval EFI_INVALID_PARAMETER  The event indicated by Index has a
> notification
> + function or Event was not a valid type
> +  @retval EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +CommonWaitForEvent (
> +  IN UINTNNumberOfEvents,
> +  IN EFI_EVENT*UserEvents,
> +  OUT UINTN   *UserIndex
> +  );
> +
> +
> +/**
> +  Creates an event in a group.
> +
> +  Support all TPL.
> +
> +  @param  Type   The type of event to create and its mode and
> + attributes
> +  @param  NotifyTpl  The task priority level of event 
> notifications
> +  @param  NotifyFunction Pointer to the events notification function
> +  @param  NotifyContext  Pointer to the notification functions 
> context;
> + corresponds to parameter "Context" in the
> + notification function
> +  @param  EventGroup GUID for EventGroup if NULL act the same
> as
> + gBS->CreateEvent().
> +  @param  Event  Pointer to the newly created event if the 
> call
> + succeeds; undefined otherwise
> +
> +  @retval EFI_SUCCESSThe event structure was created
> +  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid
> value
> +  @retval EFI_OUT_OF_RESOURCES   The event could not be all

[edk2-devel] [PATCH V2 1/4] MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file

2019-07-09 Thread Gao, Zhichao
From: Sean Brogan 

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

Add gEdkiiCpu2ProtocolGuid to MdeMdeModulePkg.dec.
Add the header file of Cpu2 protocol: it has one interface
to enable interrupt and put cpu to sleep to wait for an
interrupt.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Include/Protocol/Cpu2.h | 43 
 MdeModulePkg/MdeModulePkg.dec|  3 ++
 2 files changed, 46 insertions(+)
 create mode 100644 MdeModulePkg/Include/Protocol/Cpu2.h

diff --git a/MdeModulePkg/Include/Protocol/Cpu2.h 
b/MdeModulePkg/Include/Protocol/Cpu2.h
new file mode 100644
index 00..14464a38c8
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/Cpu2.h
@@ -0,0 +1,43 @@
+/** @file
+  CPU2 Protocol
+
+  This code abstracts the DXE core from processor implementation details.
+
+  Copyright (c) 2006 - 2018, Microsoft Corporation. All rights reserved.
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#ifndef __PROTOCOL_CPU2_H__
+#define __PROTOCOL_CPU2_H__
+
+#include 
+
+typedef struct _EDKII_CPU2_PROTOCOL   EDKII_CPU2_PROTOCOL;
+
+
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EDKII_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EDKII_CPU_ENABLE_AND_WAIT_FOR_INTERRUPT)(
+  IN EDKII_CPU2_PROTOCOL  *This
+  );
+
+///
+/// The EDKII_CPU2_PROTOCOL is used to abstract processor-specific functions 
from the DXE
+/// Foundation.
+///
+struct _EDKII_CPU2_PROTOCOL {
+  EDKII_CPU_ENABLE_AND_WAIT_FOR_INTERRUPTEnableAndForWaitInterrupt;
+};
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 12e0bbf579..354241c2ab 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -620,6 +620,9 @@
   ## Include/Protocol/PeCoffImageEmulator.h
   gEdkiiPeCoffImageEmulatorProtocolGuid = { 0x96f46153, 0x97a7, 0x4793, { 
0xac, 0xc1, 0xfa, 0x19, 0xbf, 0x78, 0xea, 0x97 } }
 
+  ## Include/Protocol/Cpu2.h
+  gEdkiiCpu2ProtocolGuid = { 0x55198405, 0x26C0, 0x4765, {0x8B, 0x7D, 0xBE, 
0x1D, 0xF5, 0xF9, 0x97, 0x12 }}
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43427): https://edk2.groups.io/g/devel/message/43427
Mute This Topic: https://groups.io/mt/32403449/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 4/4] MdeModulePkg/DxeMain: Implement common event protocol

2019-07-09 Thread Gao, Zhichao
From: Sean Brogan 

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

If an interrupt happens between CheckEvent and gIdleLoopEvent,
there would be a event pending during cpu sleep. So it is
required to check the gEventPending with the interrupt disabled.

Implement a protocol gEdkiiCommonEventProtocolGuid to support
all TPL event for PI drivers that use HW interrput. It has two
interface, one is to create event and the other one is to wait for
event.

Add 'volatile' specifier for gEfiCurrentTpl and gEventPending
because they may be changed out of the context (interrupt context).

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
 MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
 .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
 MdeModulePkg/Core/Dxe/Event/Event.c   | 102 --
 MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
 MdeModulePkg/Include/Protocol/Cpu2.h  |   2 +-
 7 files changed, 181 insertions(+), 14 deletions(-)

diff --git a/MdeModulePkg/Core/Dxe/DxeMain.h b/MdeModulePkg/Core/Dxe/DxeMain.h
index 6a64852730..38907bfe8d 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.h
+++ b/MdeModulePkg/Core/Dxe/DxeMain.h
@@ -38,6 +38,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -47,6 +48,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -274,10 +276,11 @@ extern EFI_METRONOME_ARCH_PROTOCOL  
*gMetronome;
 extern EFI_TIMER_ARCH_PROTOCOL  *gTimer;
 extern EFI_SECURITY_ARCH_PROTOCOL   *gSecurity;
 extern EFI_SECURITY2_ARCH_PROTOCOL  *gSecurity2;
+extern EDKII_CPU2_PROTOCOL  *gCpu2;
 extern EFI_BDS_ARCH_PROTOCOL*gBds;
 extern EFI_SMM_BASE2_PROTOCOL   *gSmmBase2;
 
-extern EFI_TPL  gEfiCurrentTpl;
+extern volatile EFI_TPL gEfiCurrentTpl;
 
 extern EFI_GUID *gDxeCoreFileName;
 extern EFI_LOADED_IMAGE_PROTOCOL*gDxeCoreLoadedImage;
@@ -1714,6 +1717,65 @@ CoreCheckEvent (
   );
 
 
+/**
+  Stops execution until an event is signaled.
+
+  Support all TPL.
+
+  @param  NumberOfEvents The number of events in the UserEvents array
+  @param  UserEvents An array of EFI_EVENT
+  @param  UserIndex  Pointer to the index of the event which
+ satisfied the wait condition
+
+  @retval EFI_SUCCESSThe event indicated by Index was signaled.
+  @retval EFI_INVALID_PARAMETER  The event indicated by Index has a 
notification
+ function or Event was not a valid type
+  @retval EFI_UNSUPPORTEDThe current TPL is not TPL_APPLICATION
+
+**/
+EFI_STATUS
+EFIAPI
+CommonWaitForEvent (
+  IN UINTNNumberOfEvents,
+  IN EFI_EVENT*UserEvents,
+  OUT UINTN   *UserIndex
+  );
+
+
+/**
+  Creates an event in a group.
+
+  Support all TPL.
+
+  @param  Type   The type of event to create and its mode and
+ attributes
+  @param  NotifyTpl  The task priority level of event notifications
+  @param  NotifyFunction Pointer to the events notification function
+  @param  NotifyContext  Pointer to the notification functions context;
+ corresponds to parameter "Context" in the
+ notification function
+  @param  EventGroup GUID for EventGroup if NULL act the same as
+ gBS->CreateEvent().
+  @param  Event  Pointer to the newly created event if the call
+ succeeds; undefined otherwise
+
+  @retval EFI_SUCCESSThe event structure was created
+  @retval EFI_INVALID_PARAMETER  One of the parameters has an invalid value
+  @retval EFI_OUT_OF_RESOURCES   The event could not be allocated
+
+**/
+EFI_STATUS
+EFIAPI
+CommonCreateEventEx (
+  IN UINT32   Type,
+  IN EFI_TPL  NotifyTpl,
+  IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
+  IN CONST VOID   *NotifyContext, OPTIONAL
+  IN CONST EFI_GUID   *EventGroup,OPTIONAL
+  OUT EFI_EVENT   *Event
+  );
+
+
 /**
   Adds reserved memory, system memory, or memory-mapped I/O resources to the
   global coherency domain of the processor.
diff --git a/MdeModulePkg/Core/Dxe/DxeMain.inf 
b/MdeModulePkg/Core/Dxe/DxeMain.inf
index 61161bee28..44f90bcf4b 100644
--- a/MdeModulePkg/Core/Dxe/DxeMain.inf
+++ b/MdeModulePkg/Core/Dxe/DxeMain.inf
@@ -17

[edk2-devel] [PATCH V2 2/4] UefiCpuPkg/CpuDxe: Implement Cpu2 protocol

2019-07-09 Thread Gao, Zhichao
From: Sean Brogan 

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

Implement Cp2 protocol: it has one interface to enable the
interrupt and put cpu to sleep and wait for an interrupt.

Cc: Eric Dong 
Cc: Ray Ni 
Cc: Laszlo Ersek 
Cc: Liming Gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 UefiCpuPkg/CpuDxe/CpuDxe.c| 38 +++
 UefiCpuPkg/CpuDxe/CpuDxe.h| 25 
 UefiCpuPkg/CpuDxe/CpuDxe.inf  |  3 ++
 .../CpuDxe/Ia32/EnableInterruptsAndSleep.c| 24 
 .../CpuDxe/X64/EnableInterruptsAndSleep.nasm  | 31 +++
 5 files changed, 121 insertions(+)
 create mode 100644 UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
 create mode 100644 UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm

diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.c b/UefiCpuPkg/CpuDxe/CpuDxe.c
index 7d7270e10b..2eeffcf426 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.c
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.c
@@ -18,6 +18,7 @@
 //
 BOOLEAN   InterruptState = FALSE;
 EFI_HANDLEmCpuHandle = NULL;
+EFI_HANDLEmCpu2Handle = NULL;
 BOOLEAN   mIsFlushingGCD;
 BOOLEAN   mIsAllocatingPageTable = FALSE;
 UINT64mValidMtrrAddressMask;
@@ -96,6 +97,10 @@ EFI_CPU_ARCH_PROTOCOL  gCpu = {
   4   // DmaBufferAlignment
 };
 
+EDKII_CPU2_PROTOCOL   gCpu2 = {
+  CpuEnableAndWaitForInterrupt
+};
+
 //
 // CPU Arch Protocol Functions
 //
@@ -499,6 +504,28 @@ CpuSetMemoryAttributes (
   return AssignMemoryPageAttributes (NULL, BaseAddress, Length, 
MemoryAttributes, NULL);
 }
 
+//
+// CPU2 Protocol Functions
+//
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EFI_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+EFI_STATUS
+CpuEnableAndWaitForInterrupt (
+  IN EDKII_CPU2_PROTOCOL  *This
+  )
+{
+  EnableInterruptsAndSleep ();
+
+  return EFI_SUCCESS;
+}
+
 /**
   Initializes the valid bits mask and valid address mask for MTRRs.
 
@@ -1211,6 +1238,17 @@ InitializeCpu (
   );
   ASSERT_EFI_ERROR (Status);
 
+  //
+  // Install CPU2 Protocol
+  //
+  Status = gBS->InstallMultipleProtocolInterfaces (
+  &mCpu2Handle,
+  &gEdkiiCpu2ProtocolGuid,
+  &gCpu2,
+  NULL
+  );
+  ASSERT_EFI_ERROR (Status);
+
   InitializeMpSupport ();
 
   return Status;
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.h b/UefiCpuPkg/CpuDxe/CpuDxe.h
index b029be430b..c1398830ba 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.h
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.h
@@ -12,6 +12,7 @@
 #include 
 
 #include 
+#include 
 #include 
 #include 
 
@@ -305,6 +306,30 @@ PageFaultExceptionHandler (
   IN EFI_SYSTEM_CONTEXT   SystemContext
   );
 
+/**
+  This function enables CPU interrupts and then waits for an interrupt to 
arrive.
+
+  @param  This  The EFI_CPU2_PROTOCOL instance.
+
+  @retval EFI_SUCCESS   Interrupts are enabled on the processor.
+  @retval EFI_DEVICE_ERROR  Interrupts could not be enabled on the 
processor.
+
+**/
+EFI_STATUS
+CpuEnableAndWaitForInterrupt (
+  IN EDKII_CPU2_PROTOCOL  *This
+  );
+
+/**
+  Enables CPU interrupts and then waits for an interrupt to arrive.
+
+**/
+VOID
+EFIAPI
+EnableInterruptsAndSleep (
+  VOID
+  );
+
 extern BOOLEAN mIsAllocatingPageTable;
 extern UINTN   mNumberOfProcessors;
 
diff --git a/UefiCpuPkg/CpuDxe/CpuDxe.inf b/UefiCpuPkg/CpuDxe/CpuDxe.inf
index 57381dbc85..334ddb142f 100644
--- a/UefiCpuPkg/CpuDxe/CpuDxe.inf
+++ b/UefiCpuPkg/CpuDxe/CpuDxe.inf
@@ -54,14 +54,17 @@
 
 [Sources.IA32]
   Ia32/CpuAsm.nasm
+  Ia32/EnableInterruptsAndSleep.c
 
 [Sources.X64]
   X64/CpuAsm.nasm
+  X64/EnableInterruptsAndSleep.nasm
 
 [Protocols]
   gEfiCpuArchProtocolGuid   ## PRODUCES
   gEfiMpServiceProtocolGuid ## PRODUCES
   gEfiSmmBase2ProtocolGuid  ## SOMETIMES_CONSUMES
+  gEdkiiCpu2ProtocolGuid## PRODUCES
 
 [Guids]
   gIdleLoopEventGuid## CONSUMES   ## Event
diff --git a/UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c 
b/UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
new file mode 100644
index 00..dda76139ab
--- /dev/null
+++ b/UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
@@ -0,0 +1,24 @@
+/** @file
+  EnableInterruptsAndSleep function
+
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+
+/**
+  Enables CPU interrupts and then sleep.
+
+**/
+VOID
+EFIAPI
+EnableInterruptsAndSleep (
+  VOID
+  )
+{
+  _asm {
+sti
+hlt
+  }
+}
diff --git a/UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm 
b/UefiCpuPkg/CpuDxe/X6

[edk2-devel] [PATCH V2 3/4] MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event

2019-07-09 Thread Gao, Zhichao
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=1400

Add common event protocol to support all TPL event:
Add the guid and header file of it.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Signed-off-by: Zhichao Gao 
---
 MdeModulePkg/Include/Protocol/CommonEvent.h | 18 ++
 MdeModulePkg/MdeModulePkg.dec   |  3 +++
 2 files changed, 21 insertions(+)
 create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h

diff --git a/MdeModulePkg/Include/Protocol/CommonEvent.h 
b/MdeModulePkg/Include/Protocol/CommonEvent.h
new file mode 100644
index 00..176be14101
--- /dev/null
+++ b/MdeModulePkg/Include/Protocol/CommonEvent.h
@@ -0,0 +1,18 @@
+/** @file
+  Common event protocol would provide a service of event.
+
+  Copyright (c) 2019, Intel Corporation. All rights reserved.
+  SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#ifndef __COMMON_EVENT_H__
+#define __COMMON_EVENT_H__
+
+#include 
+
+typedef struct {
+  EFI_CREATE_EVENT_EX   CreateEventEx;
+  EFI_WAIT_FOR_EVENTWaitForEvent;
+} EDKII_COMMON_EVENT_PROTOCOL;
+
+#endif
diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec
index 354241c2ab..8c746927e5 100644
--- a/MdeModulePkg/MdeModulePkg.dec
+++ b/MdeModulePkg/MdeModulePkg.dec
@@ -623,6 +623,9 @@
   ## Include/Protocol/Cpu2.h
   gEdkiiCpu2ProtocolGuid = { 0x55198405, 0x26C0, 0x4765, {0x8B, 0x7D, 0xBE, 
0x1D, 0xF5, 0xF9, 0x97, 0x12 }}
 
+  ## Include/Protocole/CommonEvent.h
+  gEdkiiCommonEventProtocolGuid = { 0x8bfb3718, 0xdb10, 0x4cc1, { 0xa9, 0xf5, 
0x84, 0xae, 0xce, 0xce, 0x99, 0x55 } }
+
 #
 # [Error.gEfiMdeModulePkgTokenSpaceGuid]
 #   0x8001 | Invalid value provided.
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43429): https://edk2.groups.io/g/devel/message/43429
Mute This Topic: https://groups.io/mt/32403451/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [PATCH V2 0/4] Fix race condition and add event protocol

2019-07-09 Thread Gao, Zhichao
V1:
There is a race condition in CoreWaitForEvent function:
If an interrupt happens between CheckEvent and gIdleLoopEvent,
there would be a event pending during cpu sleep. 
So it is required to check the gEventPending with the interrupt
disabled.
Implement a gEfiCpu2ProtocolGuid to fix that. The protocol include
one interface to enable interrupt and put the cpu to sleep.

Add a event protocol gEdkiiCommonEventProtocolGuid to support
all TPL event. It is require for PI drivers that use HW interrput.

V2:
Move EnableInterruptsAndSleep to UefiCpuPkg/CpuDxe. It is inappropiate
to add it to MdePkg which should only contain code base on the UEFI spec.
Change the name gEfiCpu2ProtocolGuid to gEdkiiCpu2ProtocolGuid.

Cc: Jian J Wang 
Cc: Hao A Wu 
cc: Ray Ni 
Cc: Star Zeng 
Cc: Liming gao 
Cc: Sean Brogan 
Cc: Michael Turner 
Cc: Bret Barkelew 
Cc: Michael D Kinney 
Cc: Eric Dong 

Sean Brogan (3):
  MdeModulePkg: Add gEdkiiCpu2ProtocolGuid and header file
  UefiCpuPkg/CpuDxe: Implement Cpu2 protocol
  MdeModulePkg/DxeMain: Implement common event protocol

Zhichao Gao (1):
  MdeModulePkg: Add gEdkiiCommonEventProtocolGuid for creating event

 MdeModulePkg/Core/Dxe/DxeMain.h   |  64 ++-
 MdeModulePkg/Core/Dxe/DxeMain.inf |   2 +
 MdeModulePkg/Core/Dxe/DxeMain/DxeMain.c   |  22 
 .../Core/Dxe/DxeMain/DxeProtocolNotify.c  |   1 +
 MdeModulePkg/Core/Dxe/Event/Event.c   | 102 --
 MdeModulePkg/Core/Dxe/Event/Event.h   |   2 +-
 MdeModulePkg/Include/Protocol/CommonEvent.h   |  18 
 MdeModulePkg/Include/Protocol/Cpu2.h  |  43 
 MdeModulePkg/MdeModulePkg.dec |   6 ++
 UefiCpuPkg/CpuDxe/CpuDxe.c|  38 +++
 UefiCpuPkg/CpuDxe/CpuDxe.h|  25 +
 UefiCpuPkg/CpuDxe/CpuDxe.inf  |   3 +
 .../CpuDxe/Ia32/EnableInterruptsAndSleep.c|  24 +
 .../CpuDxe/X64/EnableInterruptsAndSleep.nasm  |  31 ++
 14 files changed, 368 insertions(+), 13 deletions(-)
 create mode 100644 MdeModulePkg/Include/Protocol/CommonEvent.h
 create mode 100644 MdeModulePkg/Include/Protocol/Cpu2.h
 create mode 100644 UefiCpuPkg/CpuDxe/Ia32/EnableInterruptsAndSleep.c
 create mode 100644 UefiCpuPkg/CpuDxe/X64/EnableInterruptsAndSleep.nasm

-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43426): https://edk2.groups.io/g/devel/message/43426
Mute This Topic: https://groups.io/mt/32403448/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-



[edk2-devel] [edk2-platforms: PATCH] Readme.md: Change way of cloning edk2 repo

2019-07-09 Thread Wang, Jian J
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1910

'--recursive' in cloning edk2 repo might cause failure on machine
behind proxy. It's not actually necessary for edk2. This patch removed
it from git command. A separate command

   $ git submodule update --init

is added to retrieve repo specified via submodule.

Cc: Leif Lindholm 
Cc: Ard Biesheuvel 
Cc: Michael D Kinney 
Cc: Liming Gao 
Signed-off-by: Jian J Wang 
---
 Readme.md | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Readme.md b/Readme.md
index e203795d47..63e59f60b4 100644
--- a/Readme.md
+++ b/Readme.md
@@ -83,7 +83,8 @@ target-specific binutils. These are included with any 
prepackaged GCC toolchain
1. [edk2-non-osi](https://github.com/tianocore/edk2-non-osi) (if building
   platforms that need it)
```
-   $ git clone https://github.com/tianocore/edk2.git --recursive
+   $ git clone https://github.com/tianocore/edk2.git
+   $ git submodule update --init
...
$ git clone https://github.com/tianocore/edk2-platforms.git
...
-- 
2.17.1.windows.2


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#43425): https://edk2.groups.io/g/devel/message/43425
Mute This Topic: https://groups.io/mt/32403141/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-