Re: [edk2] [Patch V3 3/8] edk2: Remove commit message details from Contributions.txt

2017-07-21 Thread Leif Lindholm
On Fri, Jul 21, 2017 at 02:16:54PM -0700, Jordan Justen wrote:
> On 2017-07-19 22:44:06, Michael D Kinney wrote:
> > https://bugzilla.tianocore.org/show_bug.cgi?id=629
> > 
> > Remove the change description, commit message, and
> > patch email section from Contributions.txt.  This
> > section is not part of the TianoCore Contribution
> > Agreement.
> 
> Neither are the ~35 remaining lines before this content, which you are
> not removing.
> 
> > The information is very important and is
> > provided on the TianoCore web site and wiki and will
> > be added to Readme.md in the root of the edk2
> > repository.
> 
> Yes. It is important for making contributions, as is the ~35 lines
> before the agreement that you didn't remove. So, why don't we just
> keep them in Contributions.txt since they document how to make a
> contribution?
> 
> If you want a single file that only has the contribution agreement
> text, then how about moving it to a ContributionAgreement.txt file,
> and making Contributions.txt refer to it? I'm not sure why this would
> be needed though.

I think separating the mechanics of what a developer is supposed to do
in order to contribute code from legalese of more interest to their
legal department is a useful thing.

This was why I was suggesting a SubmittingPatches.txt. Renaming
Contributions.txt ContributionAgreement.txt would however indicate it
contained only the contribution agreement, which (as you allude to) is
not currently the case. The list of acceptable licenses would also
need to move into the "howto" in this case.

Regards,

Leif

> -Jordan
> 
> > 
> > Cc: Leif Lindholm 
> > Cc: Andrew Fish 
> > Cc: Jordan Justen 
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Michael D Kinney 
> > ---
> >  Contributions.txt | 49 -
> >  1 file changed, 49 deletions(-)
> > 
> > diff --git a/Contributions.txt b/Contributions.txt
> > index f87cbd73c6..06c60d8e17 100644
> > --- a/Contributions.txt
> > +++ b/Contributions.txt
> > @@ -34,55 +34,6 @@ To make a contribution to a TianoCore project, follow 
> > these steps.
> > Contributions using other licenses might be accepted, but further
> > review will be required.
> >  
> > -=
> > -= Change Description / Commit Message / Patch Email =
> > -=
> > -
> > -Your change description should use the standard format for a
> > -commit message, and must include your "Signed-off-by" signature
> > -and the "Contributed-under" message.
> > -
> > -== Sample Change Description / Commit Message =
> > -
> > -=== Start of sample patch email message ===
> > -
> > -From: Contributor Name 
> > -Subject: [PATCH] CodeModule: Brief-single-line-summary
> > -
> > -Full-commit-message
> > -
> > -Contributed-under: TianoCore Contribution Agreement 1.0
> > -Signed-off-by: Contributor Name 
> > 
> > -
> > -An extra message for the patch email which will not be considered part
> > -of the commit message can be added here.
> > -
> > -Patch content inline or attached
> > -
> > -=== End of sample patch email message ===
> > -
> > -=== Notes for sample patch email ===
> > -
> > -* The first line of commit message is taken from the email's subject
> > -  line following [PATCH]. The remaining portion of the commit message
> > -  is the email's content until the '---' line.
> > -* git format-patch is one way to create this format
> > -
> > -=== Definitions for sample patch email ===
> > -
> > -* "CodeModule" is a short idenfier for the affected code.  For
> > -  example MdePkg, or MdeModulePkg UsbBusDxe.
> > -* "Brief-single-line-summary" is a short summary of the change.
> > -* The entire first line should be less than ~70 characters.
> > -* "Full-commit-message" a verbose multiple line comment describing
> > -  the change.  Each line should be less than ~70 characters.
> > -* "Contributed-under" explicitely states that the contribution is
> > -  made under the terms of the contribtion agreement.  This
> > -  agreement is included below in this document.
> > -* "Signed-off-by" is the contributor's signature identifying them
> > -  by their real/legal name and their email address.
> > -
> >  
> >  = TianoCore Contribution Agreement 1.0 =
> >  
> > -- 
> > 2.13.1.windows.2
> > 
> > ___
> > edk2-devel mailing list
> > edk2-devel@lists.01.org
> > https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] [Patch V3 3/8] edk2: Remove commit message details from Contributions.txt

2017-07-21 Thread Jordan Justen
On 2017-07-19 22:44:06, Michael D Kinney wrote:
> https://bugzilla.tianocore.org/show_bug.cgi?id=629
> 
> Remove the change description, commit message, and
> patch email section from Contributions.txt.  This
> section is not part of the TianoCore Contribution
> Agreement.

Neither are the ~35 remaining lines before this content, which you are
not removing.

> The information is very important and is
> provided on the TianoCore web site and wiki and will
> be added to Readme.md in the root of the edk2
> repository.

Yes. It is important for making contributions, as is the ~35 lines
before the agreement that you didn't remove. So, why don't we just
keep them in Contributions.txt since they document how to make a
contribution?

If you want a single file that only has the contribution agreement
text, then how about moving it to a ContributionAgreement.txt file,
and making Contributions.txt refer to it? I'm not sure why this would
be needed though.

-Jordan

> 
> Cc: Leif Lindholm 
> Cc: Andrew Fish 
> Cc: Jordan Justen 
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Michael D Kinney 
> ---
>  Contributions.txt | 49 -
>  1 file changed, 49 deletions(-)
> 
> diff --git a/Contributions.txt b/Contributions.txt
> index f87cbd73c6..06c60d8e17 100644
> --- a/Contributions.txt
> +++ b/Contributions.txt
> @@ -34,55 +34,6 @@ To make a contribution to a TianoCore project, follow 
> these steps.
> Contributions using other licenses might be accepted, but further
> review will be required.
>  
> -=
> -= Change Description / Commit Message / Patch Email =
> -=
> -
> -Your change description should use the standard format for a
> -commit message, and must include your "Signed-off-by" signature
> -and the "Contributed-under" message.
> -
> -== Sample Change Description / Commit Message =
> -
> -=== Start of sample patch email message ===
> -
> -From: Contributor Name 
> -Subject: [PATCH] CodeModule: Brief-single-line-summary
> -
> -Full-commit-message
> -
> -Contributed-under: TianoCore Contribution Agreement 1.0
> -Signed-off-by: Contributor Name 
> 
> -
> -An extra message for the patch email which will not be considered part
> -of the commit message can be added here.
> -
> -Patch content inline or attached
> -
> -=== End of sample patch email message ===
> -
> -=== Notes for sample patch email ===
> -
> -* The first line of commit message is taken from the email's subject
> -  line following [PATCH]. The remaining portion of the commit message
> -  is the email's content until the '---' line.
> -* git format-patch is one way to create this format
> -
> -=== Definitions for sample patch email ===
> -
> -* "CodeModule" is a short idenfier for the affected code.  For
> -  example MdePkg, or MdeModulePkg UsbBusDxe.
> -* "Brief-single-line-summary" is a short summary of the change.
> -* The entire first line should be less than ~70 characters.
> -* "Full-commit-message" a verbose multiple line comment describing
> -  the change.  Each line should be less than ~70 characters.
> -* "Contributed-under" explicitely states that the contribution is
> -  made under the terms of the contribtion agreement.  This
> -  agreement is included below in this document.
> -* "Signed-off-by" is the contributor's signature identifying them
> -  by their real/legal name and their email address.
> -
>  
>  = TianoCore Contribution Agreement 1.0 =
>  
> -- 
> 2.13.1.windows.2
> 
> ___
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


Re: [edk2] DHCP Option 61 support

2017-07-21 Thread Richardson, Brian
Option 61 is listed in dhcp.h of the EDK II NetworkPkg, which applies to 
generic stack support.
https://github.com/tianocore/edk2/blob/master/MdePkg/Include/IndustryStandard/Dhcp.h
 

The link you provided applies to specific Intel products, which are removing 
Option 61 from specific versions of the driver.

Thanks ... br
---
Brian Richardson, Senior Technical Marketing Engineer, Intel Software
brian.richard...@intel.com -- @intel_brian (Twitter & WeChat)
https://software.intel.com/en-us/meet-the-developers/evangelists/team/brian-richardson
 

-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of 
Santhapur Naveen
Sent: Thursday, July 20, 2017 11:48 PM
To: edk2-devel@lists.01.org
Subject: [edk2] DHCP Option 61 support

Hello all,

Does the edk2 support DHCP option 61?
I can see some piece of code which makes use of this option in 
MdeModulePkg\Universal\Network\Dhcp4DxeDhcp4Io.c
But I also have found an article 
https://www.intel.com/content/www/us/en/support/software/manageability-products/07129.html
 in conflict.

Please clarify.

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


Re: [edk2] Adding OpenSSL as the submodule of EDKII project...

2017-07-21 Thread Sean Brogan
Long,Qin

I think this is a great idea and great step forward for making edk2 more 
consumable.  We already do this for our internal clones of edk2 and would like 
to see more work like this done to make edk2 consumable in a sustainable and 
easy way.  For example we also use submodules within our clone of edk2 for 
win32 basetools bin and nasm.  We then use submodules exclusively to manage 
consuming edk2 into our project repos.  This gives us great flexibility and 
agility to manage, update, and sustain our code trees.  TianoCore should think 
of itself not as the final repo but as an ingredient in a larger repository for 
building and shipping UEFI based products.   In that end I would like to see 
EDK2 break into smaller repositories (but I'll save that for another day).  

Thanks
Sean


-Original Message-
From: edk2-devel [mailto:edk2-devel-boun...@lists.01.org] On Behalf Of Long, Qin
Sent: Thursday, July 20, 2017 12:18 AM
To: edk2-devel@lists.01.org
Cc: Long, Qin 
Subject: [edk2] Adding OpenSSL as the submodule of EDKII project...

Hi,

The Git submodule allows us to keep another Git repository in a subdirectory of 
main project. The Submodule repository has its own history, which does not 
interfere with the history of the current repository. This can be used to have 
external dependencies such as third party libraries.

After the extra patch for EDKII-OpenSSL build was removed, OpenSSL can be one 
typical use case of Git Submodule in EDKII project. The Git parent (EDKII) will 
keep track of the release version / tag IDs of Submodules when the module owner 
commit. That will also help to ensure that when we check out the EDKII project 
then the openssl Submodule will also contain its right tags.

One forked EDK2 repository with OpenSSL submodule support was available at 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqloong%2Fedk2=02%7C01%7Csean.brogan%40microsoft.com%7C25cfc5e585ab4364560708d4cf3f860c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636361319131460644=JlxveSrNDXpxECNOAS7zxfDkOvz%2FX5rc9RE%2FA9XYroA%3D=0
 for testing.

For EDKII developers, the possible impacts will include (comparing to the 
original openssl source download / unpacking mechanism):

-  Cloning EDKII project with Submodules
The user can use the following commands to clone both main EDKII repo and 
openssl submodule:
1) Add the "--recursive" flag to their git clone command:
  $ git clone --recursive 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqloong%2Fedk2=02%7C01%7Csean.brogan%40microsoft.com%7C25cfc5e585ab4364560708d4cf3f860c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636361319131460644=JlxveSrNDXpxECNOAS7zxfDkOvz%2FX5rc9RE%2FA9XYroA%3D=0
or
2) Manually initialize and update the submodules after the clone operation on 
main project:
  $ git clone 
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fqloong%2Fedk2=02%7C01%7Csean.brogan%40microsoft.com%7C25cfc5e585ab4364560708d4cf3f860c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636361319131460644=JlxveSrNDXpxECNOAS7zxfDkOvz%2FX5rc9RE%2FA9XYroA%3D=0
  $ git submodule update -init -recursive


-  Pulling in Upstream Changes
For Pull operations, one single "git pull" will not update the submodule 
repository. So the following combined commands can be used to pull the remote 
submodule updates (e.g. updating to new supported OpenSSL release tag) $ git 
pull -recurse-submodules && git submodule update -recursive -remote

(For any third-party GUI tools (e.g. TortoiseGit), there are also no direct 
support to sync-up the primary and submodule repo. We need to use extra 
"Pull..." and "Submodule Update..." to handle this case.)

Let me know your comments & suggestions on this possible submodule updates 
(advantage or disadvantage of this change? Any impacts? ...). Thanks.


Best Regards & Thanks,
LONG, Qin
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.01.org%2Fmailman%2Flistinfo%2Fedk2-devel=02%7C01%7Csean.brogan%40microsoft.com%7C25cfc5e585ab4364560708d4cf3f860c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636361319131460644=SU3grvQcPSSDREJnEvg%2F6m55JCXJV01jAoSZi2nwcZA%3D=0
___
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel


[edk2] [Suggestion/Bug] Extend the usage of 'shared' modules

2017-07-21 Thread Marvin H?user
Dear developers,

Dear KabylakeSiliconPkg devs: If you are not interested in the suggestion of 
generic, shared modules, please read my comment on 2) nevertheless, as it 
contains a potential bug report. Sorry, but I could not verify this yet.

I have been exploring the code of most of the Intel 'open platforms' lately and 
noticed they shared a bunch of slightly different modules, which are diverse to 
fit the platform's requirements.
One of them is PchSmmDispatcher/QNCSmmDispatcher. I'm not sure about non-Intel 
platforms, though in my opinion, there should be a generic module in 
MdeModulePkg, if it can be shared across brands, or one in In IntelSiliconPkg, 
if it's useful for Intel platforms only. To see why I think a generic, shared 
module that consumes a platform library would be hugely beneficial, please take 
a look at these lines:


  1.  
https://github.com/tianocore/edk2-platforms/blob/devel-MinPlatform/Silicon/Intel/KabylakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c#L361
  2.  
https://github.com/tianocore/edk2-platforms/blob/devel-MinPlatform/Silicon/Intel/KabylakeSiliconPkg/Pch/PchSmiDispatcher/Smm/PchSmmCore.c#L890
  3.  
https://github.com/tianocore/edk2/blob/master/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c#L753

1) shows a hook to SmmReadyToLock, which I first and only saw in 
KabylakeSiliconPkg. This addition has not been brought to the Quark platform, 
for example. With a shared module, all platforms that embed it would have 
profited.

2) on the other hand shows KabylakeSiliconPkg's PchSmmDispatcher accessing 
RecordInDb after the callback function has been executed, which QuarkSocPkg's 
QNCSmmDispatcher explicitely forbids in 3), as it might have been freed by the 
call. I am not sure whether it was a bug in the Quark firmware that has been 
fixed by the time the Kabylake code was written, though I don't believe so, 
because the changes to the loop to process multiple SMI sources in one go is 
not present in the Kabylake code either. If there was a shared module, the fix 
to Quark would have profited all other platforms.

It's obvious to me that KabylakeSiliconPkg has a bunch of things that were 
previously only distributed privately as part of the private Reference Code. I 
think that keeping the RC as small as possible (the very best case would be 
only platform library classes consumed by generic, open source modules) is a 
goal worth persuing, as more code can be shared and community-verified as part 
of EDK2.

Thanks for your time!

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


Re: [edk2] [RFC v1 0/3] Add VIRTIO_F_IOMMU_PLATFORM support

2017-07-21 Thread Brijesh Singh

On 7/20/17 10:24 PM, Jason Wang wrote:
>
>
> On 2017年07月20日 06:09, Brijesh Singh wrote:
>> I have found that OVMF fails to detect the disk when iommu_platform
>> is set from
>> qemu cli. The failure occurs during the feature bit negotiation.
>>
>> Recently, EDKII introduced IOMMU protocol d1fddc4533bf. SEV patch
>> series introduced
>> a IoMmu protocol driver f9d129e68a45 to set a DMA access attribute
>> and methods to
>> allocate, free, map and unmap the DMA memory for the master bus devices
>>
>> In this patch series, I have tried to enable the IOMMU_PLATFORM
>> feature for
>> VirtioBlkDevice. I am sending this as RFC to seek feedback before I
>> extend the support
>> for other Virtio devices. The patch has been tested in SEV guest -
>> mainly because
>> IoMmuDxe driver installs the IOMMU protocol for SEV guest only. If
>> needed, I can
>> extend the IoMmuDxe driver to install IOMMU protocol for non SEV guests.
>>
>> qemu cli used for testing:
>>
>> # $QEMU \
>>...
>>-drive file=${HDA_FILE},if=none,id=disk0,format=qcow2 \
>>-device
>> virtio-blk-pci,drive=disk0,disable-legacy=on,iommu_platform=true,disable-modern=off,scsi=off
>>...
>>
>> Cc: Jordan Justen 
>> Cc: Laszlo Ersek 
>> Cc: Jason Wang 
>> Cc: Michael S. Tsirkin 
>> Contributed-under: TianoCore Contribution Agreement 1.0
>> Signed-off-by: Brijesh Singh 
>>
>> Brijesh Singh (3):
>>OvmfPkg/Include/Virtio10: Define VIRTIO_F_IOMMU_PLATFORM feature bit
>>OvmfPkg/VirtioLib: Add IOMMU_PLATFORM support
>>OvmfPkg/VirtioBlkDxe: Add VIRITO_F_IOMMU_PLATFORM support
>
> Hi, do we need change virtio-scsi driver as well?
>
I see that OVMF has the following virtio drivers, we need to update them
all:

VirtioBlkDxe
VirtioGpuDxe
VirtioNetDxe
VirtioRngDxe
VirtioScsiDxe

I will wait for Laszlo and Jordan's initial feedback before changing
other drivers.
> Thanks
>
>>
>>   OvmfPkg/Library/VirtioLib/VirtioLib.inf  |   1 +
>>   OvmfPkg/VirtioBlkDxe/VirtioBlk.inf   |   5 +
>>   OvmfPkg/VirtioGpuDxe/VirtioGpu.inf   |   1 +
>>   OvmfPkg/VirtioNetDxe/VirtioNet.inf   |   1 +
>>   OvmfPkg/VirtioRngDxe/VirtioRng.inf   |   1 +
>>   OvmfPkg/VirtioScsiDxe/VirtioScsi.inf |   1 +
>>   OvmfPkg/Include/IndustryStandard/Virtio095.h |   1 +
>>   OvmfPkg/Include/IndustryStandard/Virtio10.h  |   5 +
>>   OvmfPkg/Include/Library/VirtioLib.h  |  20 
>>   OvmfPkg/Library/VirtioLib/VirtioLib.c|  96 ++-
>>   OvmfPkg/VirtioBlkDxe/VirtioBlk.c | 125
>> ++--
>>   11 files changed, 244 insertions(+), 13 deletions(-)
>>
>

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


[edk2] [PATCH] UefiCpuPkg: Add BOOLEAN casts to return statements.

2017-07-21 Thread Marvin Häuser
Old versions of the Visual Studio C compiler return a value of type
'int' for comparisons, which is what the C99 standard defines in the
sections 6.5.8 and 6.5.9. When the result of a comparison is
returned, int is implicitely casted to BOOLEAN, which is smaller, and
hence a warning about a possible loss of data is generated. This
patch adds casts to BOOLEAN where necessary to silence these.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c | 8 
 UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c | 8 
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c| 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ClockModulation.c  | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Eist.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/ExecuteDisable.c   | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/FeatureControl.c   | 4 ++--
 UefiCpuPkg/Library/CpuCommonFeaturesLib/LimitCpuIdMaxval.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MachineCheck.c | 6 +++---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/MonitorMwait.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/PendingBreak.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c | 2 +-
 UefiCpuPkg/Library/CpuCommonFeaturesLib/X2Apic.c   | 2 +-
 UefiCpuPkg/Library/RegisterCpuFeaturesLib/RegisterCpuFeaturesLib.c | 2 +-
 15 files changed, 24 insertions(+), 24 deletions(-)

diff --git a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c 
b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
index 2091e5e2d0dd..55aee6c607f7 100644
--- a/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicLib/BaseXApicLib.c
@@ -3,7 +3,7 @@
 
   This local APIC library instance supports xAPIC mode only.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials
@@ -49,9 +49,9 @@ StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c 
b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
index d5d4efaeb408..bfd5acceebfa 100644
--- a/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
+++ b/UefiCpuPkg/Library/BaseXApicX2ApicLib/BaseXApicX2ApicLib.c
@@ -4,7 +4,7 @@
   This local APIC library instance supports x2APIC capable processors
   which have xAPIC and x2APIC modes.
 
-  Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
+  Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
   Copyright (c) 2017, AMD Inc. All rights reserved.
 
   This program and the accompanying materials
@@ -50,9 +50,9 @@ StandardSignatureIsAuthenticAMD (
   UINT32  RegEdx;
 
   AsmCpuid(CPUID_SIGNATURE, NULL, , , );
-  return (RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
-  RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
-  RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
+  return (BOOLEAN)(RegEbx == CPUID_SIGNATURE_AUTHENTIC_AMD_EBX &&
+   RegEcx == CPUID_SIGNATURE_AUTHENTIC_AMD_ECX &&
+   RegEdx == CPUID_SIGNATURE_AUTHENTIC_AMD_EDX);
 }
 
 /**
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
index 178bfb50abcf..df0f56ab9d82 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Aesni.c
@@ -69,7 +69,7 @@ AesniSupport (
   IS_XEON_PHI_PROCESSOR (CpuInfo->DisplayFamily, CpuInfo->DisplayModel)) {
 MsrFeatureConfig = (MSR_SANDY_BRIDGE_FEATURE_CONFIG_REGISTER *) ConfigData;
 MsrFeatureConfig[ProcessorNumber].Uint64 = AsmReadMsr64 
(MSR_SANDY_BRIDGE_FEATURE_CONFIG);
-return (CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
+return (BOOLEAN)(CpuInfo->CpuIdVersionInfoEcx.Bits.AESNI == 1);
   }
   return FALSE;
 }
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
index 47116355a8ff..00ebc5c9a19e 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/C1e.c
@@ -38,7 +38,7 @@ C1eSupport (
   IN VOID  

[edk2] [PATCH] UefiCpuPkg/CpuCommonFeaturesLib: Fix the documentation of PpinSupport().

2017-07-21 Thread Marvin Häuser
The documentation of PpinSupport() refers to 'Enhanced Intel
SpeedStep'. This patch fixes these referneces.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c  | 4 ++--
 UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c
index 438578a83230..58e303448507 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/Ppin.c
@@ -26,8 +26,8 @@
CPU_FEATURE_GET_CONFIG_DATA was not provided in
RegisterCpuFeature().
 
-  @retval TRUE Enhanced Intel SpeedStep feature is supported.
-  @retval FALSEEnhanced Intel SpeedStep feature is not supported.
+  @retval TRUE Protected Processor Inventory Number feature is supported.
+  @retval FALSEProtected Processor Inventory Number feature is not 
supported.
 
   @note This service could be called by BSP/APs.
 **/
diff --git a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h 
b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
index c03e5ab0183f..c5bc62b20728 100644
--- a/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
+++ b/UefiCpuPkg/Library/CpuCommonFeaturesLib/CpuCommonFeatures.h
@@ -866,8 +866,8 @@ FeatureControlGetConfigData (
CPU_FEATURE_GET_CONFIG_DATA was not provided in
RegisterCpuFeature().
 
-  @retval TRUE Enhanced Intel SpeedStep feature is supported.
-  @retval FALSEEnhanced Intel SpeedStep feature is not supported.
+  @retval TRUE Protected Processor Inventory Number feature is supported.
+  @retval FALSEProtected Processor Inventory Number feature is not 
supported.
 
   @note This service could be called by BSP/APs.
 **/
-- 
2.12.2.windows.2

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


[edk2] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Cast the return value of GetPageTableBase().

2017-07-21 Thread Marvin Häuser
The value returned by GetPageTableBase() is of type UINT64, which is
implicitely casted to UINTN by the return statement. To purge the
'possible loss of data' warning on 32-bit platforms, with this patch,
the value is casted to UINTN before returning.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c 
b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
index a535389c26ce..009d8eb01347 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmCpuMemoryManagement.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials
 are licensed and made available under the terms and conditions of the BSD 
License
 which accompanies this distribution.  The full text of the license may be 
found at
@@ -39,7 +39,7 @@ GetPageTableBase (
   VOID
   )
 {
-  return (AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64);
+  return (UINTN)(AsmReadCr3 () & PAGING_4K_ADDRESS_MASK_64);
 }
 
 /**
-- 
2.12.2.windows.2

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


Re: [edk2] [PATCH] MdePkg UsbFunctionIo.h: Update comments for GetDeviceInfo return status

2017-07-21 Thread Gao, Liming
Reviewed-by: Liming Gao 

>-Original Message-
>From: Zeng, Star
>Sent: Wednesday, July 19, 2017 6:29 PM
>To: edk2-devel@lists.01.org
>Cc: Zeng, Star ; Gao, Liming 
>Subject: [PATCH] MdePkg UsbFunctionIo.h: Update comments for
>GetDeviceInfo return status
>
>UEFI spec 2.6 errata B update Status Codes Returned table of the
>EFI_USBFN_IO_PROTOCOL.GetDeviceInfo function as follows:
>
>1. Update EFI_INVALID_PARAMETER description:
>Original text:
>A parameter is invalid.
>New text:
>One or more of the following conditions is TRUE:
>BufferSize is NULL.
>*BufferSize is not 0 and Buffer is NULL.
>Id in invalid.
>
>2. Update EFI_BUFFER_TOO_SMALL description:
>Original text:
>Supplied buffer isn’t large enough to hold the request string.
>New text:
>The buffer is too small to hold the buffer.
>*BufferSize has been updated with the size needed to hold the
>request string.
>
>Cc: Liming Gao 
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Star Zeng 
>---
> MdePkg/Include/Protocol/UsbFunctionIo.h | 10 +++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
>diff --git a/MdePkg/Include/Protocol/UsbFunctionIo.h
>b/MdePkg/Include/Protocol/UsbFunctionIo.h
>index 923c1d3527ed..ce556bdbaf31 100644
>--- a/MdePkg/Include/Protocol/UsbFunctionIo.h
>+++ b/MdePkg/Include/Protocol/UsbFunctionIo.h
>@@ -11,7 +11,7 @@
>   or interrupt transfers, alternate interfaces, or USB 3.0 functionality.
>   Future revisions of this protocol may support these or additional features.
>
>-  Copyright (c) 2015, Intel Corporation. All rights reserved.
>+  Copyright (c) 2015 - 2017, Intel Corporation. All rights reserved.
>   This program and the accompanying materials
>   are licensed and made available under the terms and conditions of the BSD
>License
>   which accompanies this distribution.  The full text of the license may be
>found at
>@@ -273,9 +273,13 @@ EFI_STATUS
> as a Unicode string.
>
>   @retval EFI_SUCCESS   The function returned successfully.
>-  @retval EFI_INVALID_PARAMETER A parameter is invalid.
>+  @retval EFI_INVALID_PARAMETER One or more of the following conditions
>is TRUE:
>+BufferSize is NULL.
>+*BufferSize is not 0 and Buffer is NULL.
>+Id in invalid.
>   @retval EFI_DEVICE_ERROR  The physical device reported an error.
>-  @retval EFI_BUFFER_TOO_SMALL  Supplied buffer isn't large enough to
>hold the request string.
>+  @retval EFI_BUFFER_TOO_SMALL  The buffer is too small to hold the buffer.
>+*BufferSize has been updated with the size 
>needed to hold
>the request string.
>
> **/
> typedef
>--
>2.7.0.windows.1

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


[edk2] [PATCH v2 1/3] MdeModulePkg/SetupBrowser: Record the reset status in all SendForm

2017-07-21 Thread Dandan Bi
After calling SendForm to enter front page, configuration change in some
driver may require system reset. Currently the reset status is saved in
SendForm level. Then SendForm can return the reset status.
IsResetRequired API also can return the reset status before exiting browser.
It return the reset status in current SendForm level now. But SendForm can
be recursive called by some module.so the reset status in previous SendForm
may be lost. Now change the IsResetRequired API to return the reset info no
matter the reset is caught in any SendForm.

Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c |  9 ++---
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c| 19 +++
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.h|  5 +++--
 3 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
index 08d46cf..97713eb 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Presentation.c
@@ -995,11 +995,12 @@ ProcessAction (
   if ((Action & BROWSER_ACTION_SUBMIT) == BROWSER_ACTION_SUBMIT) {
 SubmitForm (gCurrentSelection->FormSet, gCurrentSelection->Form, 
gBrowserSettingScope);
   }
 
   if ((Action & BROWSER_ACTION_RESET) == BROWSER_ACTION_RESET) {
-gResetRequired = TRUE;
+gResetRequiredFormLevel = TRUE;
+gResetRequiredSystemLevel = TRUE;
   }
 
   if ((Action & BROWSER_ACTION_EXIT) == BROWSER_ACTION_EXIT) {
 //
 // Form Exit without saving, Similar to ESC Key.
@@ -2043,11 +2044,12 @@ ProcessCallBackFunction (
   switch (Action) {
   case EFI_BROWSER_ACTION_CHANGED:
 switch (ActionRequest) {
 case EFI_BROWSER_ACTION_REQUEST_RESET:
   DiscardFormIsRequired = TRUE;
-  gResetRequired = TRUE;
+  gResetRequiredFormLevel = TRUE;
+  gResetRequiredSystemLevel = TRUE;
   NeedExit  = TRUE;
   break;
 
 case EFI_BROWSER_ACTION_REQUEST_SUBMIT:
   SubmitFormIsRequired = TRUE;
@@ -2542,11 +2544,12 @@ SetupBrowser (
   // and process question success till here, trig the 
gResetFlag/gFlagReconnect.
   //
   if ((Status == EFI_SUCCESS) && 
   (Statement->Storage == NULL)) { 
 if ((Statement->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
-  gResetRequired = TRUE;
+  gResetRequiredFormLevel = TRUE;
+  gResetRequiredSystemLevel = TRUE;
 }
 
 if ((Statement->QuestionFlags & EFI_IFR_FLAG_RECONNECT_REQUIRED) != 0) 
{
   gFlagReconnect = TRUE;
 }
diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
index 83dc2b8..89e06de 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Setup.c
@@ -51,11 +51,12 @@ LIST_ENTRY  gBrowserFormSetList = 
INITIALIZE_LIST_HEAD_VARIABLE (gBrowserFor
 LIST_ENTRY  gBrowserHotKeyList  = INITIALIZE_LIST_HEAD_VARIABLE 
(gBrowserHotKeyList);
 LIST_ENTRY  gBrowserStorageList = INITIALIZE_LIST_HEAD_VARIABLE 
(gBrowserStorageList);
 LIST_ENTRY  gBrowserSaveFailFormSetList = INITIALIZE_LIST_HEAD_VARIABLE 
(gBrowserSaveFailFormSetList);
 
 BOOLEAN   mSystemSubmit = FALSE;
-BOOLEAN   gResetRequired;
+BOOLEAN   gResetRequiredFormLevel;
+BOOLEAN   gResetRequiredSystemLevel = FALSE;
 BOOLEAN   gExitRequired;
 BOOLEAN   gFlagReconnect;
 BOOLEAN   gCallbackReconnect;
 BROWSER_SETTING_SCOPE gBrowserSettingScope = FormSetLevel;
 BOOLEAN   mBrowserScopeFirstSet = TRUE;
@@ -497,11 +498,11 @@ SendForm (
   // Save globals used by SendForm()
   //
   SaveBrowserContext ();
 
   gFlagReconnect = FALSE;
-  gResetRequired = FALSE;
+  gResetRequiredFormLevel = FALSE;
   gExitRequired  = FALSE;
   gCallbackReconnect = FALSE;
   Status = EFI_SUCCESS;
   gEmptyString   = L"";
   gDisplayFormData.ScreenDimensions = (EFI_SCREEN_DESCRIPTOR *) 
ScreenDimensions;
@@ -577,11 +578,11 @@ SendForm (
 FreePool (Selection);
   }
 
   if (ActionRequest != NULL) {
 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_NONE;
-if (gResetRequired) {
+if (gResetRequiredFormLevel) {
   *ActionRequest = EFI_BROWSER_ACTION_REQUEST_RESET;
 }
   }
 
   mFormDisplay->ExitDisplay();
@@ -2676,11 +2677,12 @@ UpdateFlagForForm (
 //
 // Only the changed data has been saved, then need to set the reset flag.
 //
 if (SetFlag && OldValue && !Question->ValueChanged) {
   if ((Question->QuestionFlags & EFI_IFR_FLAG_RESET_REQUIRED) != 0) {
-gResetRequired = TRUE;
+gResetRequiredFormLevel = TRUE;
+

[edk2] [PATCH v2 2/3] MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp

2017-07-21 Thread Dandan Bi
V2: Refine the comments.


In UI page, some configuration change may require system reset.
BootManagerUiLib misses this check before exiting UiApp to boot
other boot options. Now add the check.

Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 .../Library/BootManagerUiLib/BootManager.c | 51 +-
 .../Library/BootManagerUiLib/BootManager.h |  4 +-
 .../Library/BootManagerUiLib/BootManagerUiLib.inf  |  3 +-
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c 
b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
index bf872f8..8e77632 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.c
@@ -1,9 +1,9 @@
 /** @file
   The boot manager reference implementation
 
-Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
 
@@ -292,10 +292,54 @@ BmSetConsoleMode (
 
   return EFI_SUCCESS;
 }
 
 /**
+
+  Check whether a reset is needed,if reset is needed, Popup a menu to notice 
user.
+
+**/
+VOID
+BmSetupResetReminder (
+  VOID
+  )
+{
+  EFI_INPUT_KEY Key;
+  CHAR16*StringBuffer1;
+  CHAR16*StringBuffer2;
+  EFI_STATUSStatus;
+  EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
+
+  //
+  // Use BrowserEx2 protocol to check whether reset is required.
+  //
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
+  //
+  //check any reset required change is applied? if yes, reset system
+  //
+  if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired ()) {
+StringBuffer1 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ASSERT (StringBuffer1 != NULL);
+StringBuffer2 = AllocateZeroPool (MAX_STRING_LEN * sizeof (CHAR16));
+ASSERT (StringBuffer2 != NULL);
+StrCpyS (StringBuffer1, MAX_STRING_LEN, L"Configuration changed. Reset to 
apply it Now.");
+StrCpyS (StringBuffer2, MAX_STRING_LEN, L"Press ENTER to reset");
+//
+// Popup a menu to notice user
+//
+do {
+  CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , StringBuffer1, 
StringBuffer2, NULL);
+} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+FreePool (StringBuffer1);
+FreePool (StringBuffer2);
+
+gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+  }
+}
+
+/**
   Group the legacy boot options in the BootOption.
 
   The routine assumes the boot options in the beginning that covers all the 
device 
   types are ordered properly and re-position the following boot options just 
after
   the corresponding boot options with the same device type.
@@ -780,10 +824,15 @@ BootManagerCallback (
   //
   gST->ConOut->SetAttribute (gST->ConOut, EFI_TEXT_ATTR (EFI_LIGHTGRAY, 
EFI_BLACK));
   gST->ConOut->ClearScreen (gST->ConOut);
 
   //
+  //check any reset required change is applied? if yes, reset system
+  //
+  BmSetupResetReminder ();
+
+  //
   // parse the selected option
   //
   BmSetConsoleMode (FALSE);
   EfiBootManagerBoot ([QuestionId - 1]);
   BmSetConsoleMode (TRUE);
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h 
b/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
index 1bedff4..3adddf6 100644
--- a/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
+++ b/MdeModulePkg/Library/BootManagerUiLib/BootManager.h
@@ -1,9 +1,9 @@
 /** @file
   The boot manager reference implementation
 
-Copyright (c) 2004 - 2015, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
 This program and the accompanying materials are licensed and made available 
under
 the terms and conditions of the BSD License that accompanies this distribution.
 The full text of the license may be found at
 http://opensource.org/licenses/bsd-license.php.
 
@@ -18,10 +18,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
@@ -53,10 +54,11 @@ typedef struct {
 
 #define BOOT_MANAGER_FORM_ID 0x1000
 
 #define LABEL_BOOT_OPTION0x00
 #define LABEL_BOOT_OPTION_END0x01
+#define MAX_STRING_LEN   200
 
 //
 // Variable created with this flag will be "Efi:"
 //
 #define VAR_FLAG  EFI_VARIABLE_BOOTSERVICE_ACCESS | 
EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_NON_VOLATILE
diff --git a/MdeModulePkg/Library/BootManagerUiLib/BootManagerUiLib.inf 

[edk2] [PATCH v2 0/3] Check reset requirement before exiting UiApp

2017-07-21 Thread Dandan Bi
V2: Refine the comments in patch 2 and 3.

Patch 1 enahce the IsResetRequired API to return to reset info in system level.
Patch 2 Check reset requirement before exiting UiApp (thorugh boot option).
Patch 3 Check reset requirement before exiting UiApp (through boot from file).

Cc: Eric Dong 
Cc: Liming Gao 
Dandan Bi (3):
  MdeModulePkg/SetupBrowser: Record the reset status in all SendForm
  MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
  MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp

 .../BootMaintenanceManager.h   |  1 +
 .../BootMaintenanceManagerUiLib.inf|  3 +-
 .../BootMaintenanceManagerUiLib/BootOption.c   | 50 +
 .../Library/BootManagerUiLib/BootManager.c | 52 +-
 .../Library/BootManagerUiLib/BootManager.h |  4 +-
 .../Library/BootManagerUiLib/BootManagerUiLib.inf  |  3 +-
 .../Universal/SetupBrowserDxe/Presentation.c   |  9 ++--
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.c | 19 
 MdeModulePkg/Universal/SetupBrowserDxe/Setup.h |  5 ++-
 9 files changed, 129 insertions(+), 17 deletions(-)

-- 
1.9.5.msysgit.1

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


[edk2] [PATCH v2 3/3] MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp

2017-07-21 Thread Dandan Bi
V2: Refine the comments.

In UI page, some configuration change may require system reset.
BootMaintenanceManagerUiLib misses this check before exiting UiApp
to boot other boot options. Now add the check.

Cc: Eric Dong 
Cc: Liming Gao 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi 
---
 .../BootMaintenanceManager.h   |  1 +
 .../BootMaintenanceManagerUiLib.inf|  3 +-
 .../BootMaintenanceManagerUiLib/BootOption.c   | 49 ++
 3 files changed, 52 insertions(+), 1 deletion(-)

diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
index a8d7a0f..99d1656 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManager.h
@@ -26,10 +26,11 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
 #include 
 #include 
diff --git 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
index 6f2cda3..1c0c0e1 100644
--- 
a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
+++ 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootMaintenanceManagerUiLib.inf
@@ -1,9 +1,9 @@
 ## @file
 #  Boot Maintenance Manager Library used by UiApp.
 #
-#  Copyright (c) 2011 - 2015, Intel Corporation. All rights reserved.
+#  Copyright (c) 2011 - 2017, Intel Corporation. All rights reserved.
 #  This program and the accompanying materials are licensed and made available 
under
 #  the terms and conditions of the BSD License that accompanies this 
distribution.
 #  The full text of the license may be found at
 #  http://opensource.org/licenses/bsd-license.php.
 #  
@@ -89,10 +89,11 @@
   gEfiSimpleFileSystemProtocolGuid  ## CONSUMES
   gEfiLoadFileProtocolGuid  ## CONSUMES
   gEfiHiiConfigAccessProtocolGuid   ## CONSUMES
   gEfiSerialIoProtocolGuid  ## CONSUMES
   gEfiDevicePathToTextProtocolGuid  ## CONSUMES
+  gEdkiiFormBrowserEx2ProtocolGuid  ## CONSUMES
 
 [FeaturePcd]
 
 [Pcd]
   gEfiMdeModulePkgTokenSpaceGuid.PcdConOutRow  ## CONSUMES
diff --git a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c 
b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
index 890728a..8680a51 100644
--- a/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
+++ b/MdeModulePkg/Library/BootMaintenanceManagerUiLib/BootOption.c
@@ -22,10 +22,55 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 /// Define the maximum characters that will be accepted.
 ///
 #define MAX_CHAR480
 
 /**
+
+  Check whether a reset is needed, if reset is needed, Popup a menu to notice 
user.
+
+**/
+VOID
+BmmSetupResetReminder (
+  VOID
+  )
+{
+  EFI_INPUT_KEY Key;
+  CHAR16*StringBuffer1;
+  CHAR16*StringBuffer2;
+  EFI_STATUSStatus;
+  EDKII_FORM_BROWSER_EXTENSION2_PROTOCOL *FormBrowserEx2;
+
+  //
+  // Use BrowserEx2 protocol to check whether reset is required.
+  //
+  Status = gBS->LocateProtocol (, NULL, (VOID 
**) );
+
+  //
+  //check any reset required change is applied? if yes, reset system
+  //
+  if (!EFI_ERROR(Status) && FormBrowserEx2->IsResetRequired()) {
+StringBuffer1 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16));
+ASSERT (StringBuffer1 != NULL);
+StringBuffer2 = AllocateZeroPool (MAX_CHAR * sizeof (CHAR16));
+ASSERT (StringBuffer2 != NULL);
+StrCpyS (StringBuffer1, MAX_CHAR, L"Configuration changed. Reset to apply 
it Now.");
+StrCpyS (StringBuffer2, MAX_CHAR, L"Press ENTER to reset");
+//
+// Popup a menu to notice user
+//
+do {
+  CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, , StringBuffer1, 
StringBuffer2, NULL);
+} while (Key.UnicodeChar != CHAR_CARRIAGE_RETURN);
+
+FreePool (StringBuffer1);
+FreePool (StringBuffer2);
+
+gRT->ResetSystem (EfiResetCold, EFI_SUCCESS, 0, NULL);
+  }
+}
+
+/**
   Create a menu entry by given menu type.
 
   @param MenuTypeThe Menu type to be created.
 
   @retval NULL   If failed to create the menu.
@@ -881,10 +926,14 @@ BootFromFile (
   );
 //
 // Since current no boot from removable media directly is allowed */
 //
 gST->ConOut->ClearScreen (gST->ConOut);
+//
+// Check whether need to reset system.
+//
+BmmSetupResetReminder ();
 
 BmmSetConsoleMode (FALSE);
 EfiBootManagerBoot ();
 BmmSetConsoleMode (TRUE);
 
-- 

[edk2] [PATCH] MdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM buffer

2017-07-21 Thread Star Zeng
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=593

Currently, SmmCommunciate fails in RestoreLockBox after
SmmReadyToLock since COMM buffer is in stack instead of
using SmmCommRegion by gEdkiiPiSmmCommunicationRegionTableGuid.

This patch is to get SmmCommRegion by
gEdkiiPiSmmCommunicationRegionTableGuid for COMM buffer

Cc: Jiewen Yao 
Cc: Baraneedharan Anbazhagan 
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng 
---
 .../Library/SmmLockBoxLib/SmmLockBoxDxeLib.c   | 199 +++--
 .../Library/SmmLockBoxLib/SmmLockBoxDxeLib.inf |   6 +-
 2 files changed, 147 insertions(+), 58 deletions(-)

diff --git a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.c 
b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.c
index 9659f014e937..b75f81e69e04 100644
--- a/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.c
+++ b/MdeModulePkg/Library/SmmLockBoxLib/SmmLockBoxDxeLib.c
@@ -1,6 +1,6 @@
 /** @file
 
-Copyright (c) 2010, Intel Corporation. All rights reserved.
+Copyright (c) 2010 - 2017, Intel Corporation. All rights reserved.
 
 This program and the accompanying materials
 are licensed and made available under the terms and conditions
@@ -20,11 +20,108 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER 
EXPRESS OR IMPLIED.
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include "SmmLockBoxLibPrivate.h"
 
+EFI_SMM_COMMUNICATION_PROTOCOL  *mLockBoxSmmCommProtocol = NULL;
+UINT8   *mLockBoxSmmCommBuffer   = NULL;
+
+/**
+  Get smm communication protocol for lockbox.
+
+  @return Pointer to smm communication protocol, NULL if not found.
+
+**/
+EFI_SMM_COMMUNICATION_PROTOCOL *
+LockBoxGetSmmCommProtocol (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+
+  //
+  // If the protocol has been got previously, return it.
+  //
+  if (mLockBoxSmmCommProtocol != NULL) {
+return mLockBoxSmmCommProtocol;
+  }
+
+  Status = gBS->LocateProtocol (
+  ,
+  NULL,
+  (VOID **)
+  );
+  if (EFI_ERROR (Status)) {
+mLockBoxSmmCommProtocol = NULL;
+  }
+  return mLockBoxSmmCommProtocol;
+}
+
+/**
+  Get smm communication buffer for lockbox.
+
+  @return Pointer to smm communication buffer, NULL if not found.
+
+**/
+UINT8 *
+LockBoxGetSmmCommBuffer (
+  VOID
+  )
+{
+  EFI_STATUSStatus;
+  UINTN MinimalSizeNeeded;
+  EDKII_PI_SMM_COMMUNICATION_REGION_TABLE   *PiSmmCommunicationRegionTable;
+  UINT32Index;
+  EFI_MEMORY_DESCRIPTOR *Entry;
+  UINTN Size;
+
+  //
+  // If the buffer has been got previously, return it.
+  //
+  if (mLockBoxSmmCommBuffer != NULL) {
+return mLockBoxSmmCommBuffer;
+  }
+
+  MinimalSizeNeeded = sizeof (EFI_GUID) +
+  sizeof (UINTN) +
+  MAX (sizeof (EFI_SMM_LOCK_BOX_PARAMETER_SAVE),
+   MAX (sizeof 
(EFI_SMM_LOCK_BOX_PARAMETER_SET_ATTRIBUTES),
+MAX (sizeof 
(EFI_SMM_LOCK_BOX_PARAMETER_UPDATE),
+ MAX (sizeof 
(EFI_SMM_LOCK_BOX_PARAMETER_RESTORE),
+  sizeof 
(EFI_SMM_LOCK_BOX_PARAMETER_RESTORE_ALL_IN_PLACE);
+
+  Status = EfiGetSystemConfigurationTable (
+ ,
+ (VOID **) 
+ );
+  if (EFI_ERROR (Status)) {
+mLockBoxSmmCommBuffer = NULL;
+return mLockBoxSmmCommBuffer;
+  }
+  ASSERT (PiSmmCommunicationRegionTable != NULL);
+  Entry = (EFI_MEMORY_DESCRIPTOR *) (PiSmmCommunicationRegionTable + 1);
+  Size = 0;
+  for (Index = 0; Index < PiSmmCommunicationRegionTable->NumberOfEntries; 
Index++) {
+if (Entry->Type == EfiConventionalMemory) {
+  Size = EFI_PAGES_TO_SIZE ((UINTN) Entry->NumberOfPages);
+  if (Size >= MinimalSizeNeeded) {
+break;
+  }
+}
+Entry = (EFI_MEMORY_DESCRIPTOR *) ((UINT8 *) Entry + 
PiSmmCommunicationRegionTable->DescriptorSize);
+  }
+  if (Index >= PiSmmCommunicationRegionTable->NumberOfEntries) {
+mLockBoxSmmCommBuffer = NULL;
+  } else {
+mLockBoxSmmCommBuffer = (UINT8 *) (UINTN) Entry->PhysicalStart;
+  }
+  return mLockBoxSmmCommBuffer;
+}
+
 /**
   This function will save confidential information to lockbox.
 
@@ -52,7 +149,8 @@ SaveLockBox (
   EFI_SMM_COMMUNICATION_PROTOCOL  *SmmCommunication;
   EFI_SMM_LOCK_BOX_PARAMETER_SAVE *LockBoxParameterSave;
   EFI_SMM_COMMUNICATE_HEADER  *CommHeader;
-  UINT8   CommBuffer[sizeof(EFI_GUID) + sizeof(UINTN) 
+ sizeof(EFI_SMM_LOCK_BOX_PARAMETER_SAVE)];
+  UINT8   TempCommBuffer[sizeof(EFI_GUID) + 
sizeof(UINTN) + sizeof(EFI_SMM_LOCK_BOX_PARAMETER_SAVE)];
+  UINT8   *CommBuffer;
   UINTN   

[edk2] [PATCH] QuarkSocPkg/QNCSmmDispatcher: Fix use after free issue #2

2017-07-21 Thread Marvin Häuser
As part of commit 5f82e02, ActiveRecordInDb was introduced as a copy
of RecordInDb as latter may be freed by the callback function. This
commit replaces an access of RecordInDb after the callback function
has been executed with an access to ActiveRecordInDb.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser 
---
 QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git 
a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c 
b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
index c2f75f86647a..29ad5f493466 100644
--- a/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
+++ b/QuarkSocPkg/QuarkNorthCluster/Smm/DxeSmm/QncSmmDispatcher/QNCSmmCore.c
@@ -758,7 +758,7 @@ QNCSmmCoreDispatcher (
 }
   }
 
-  if (RecordInDb->ClearSource == NULL) {
+  if (ActiveRecordInDb.ClearSource == NULL) {
 //
 // Clear the SMI associated w/ the source using the default 
function
 //
-- 
2.12.2.windows.2

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