Re: [edk2-devel] [edk2-platforms: PATCH v2 0/6] Add SetCacheLib library class.

2019-10-30 Thread Kubacki, Michael A
Hi Chasel,

I don't think SetCacheLib is quite precise enough. Can you please
consider an alternative such as SetMtrrLib?

Thanks,
Michael

> -Original Message-
> From: Chiu, Chasel 
> Sent: Wednesday, October 30, 2019 5:30 PM
> To: devel@edk2.groups.io
> Cc: Kubacki, Michael A ; Desimone, Nathaniel
> L ; Gao, Liming ;
> Jeremy Soller ; Lu, Shifei A
> ; Zhou, Bowen ; Oram,
> Isaac W ; Wei, David Y ;
> Agyeman, Prince 
> Subject: [edk2-platforms: PATCH v2 0/6] Add SetCacheLib library class.
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314
> 
> The MTRRs may be redundantly or incorrectly configured.
> It is recommended to move this functionality to a library class that with a
> NULL library by default. The board package may provide its own library
> implementation.
> MinPlatformPkg should contain the library class header (API) and the NULL
> library class instance.
> 
> Cc: Michael Kubacki 
> Cc: Nate DeSimone 
> Cc: Liming Gao 
> Cc: Jeremy Soller 
> Cc: Shifei A Lu 
> Cc: Xiaohu Zhou 
> Cc: Isaac W Oram 
> Cc: Wei David Y 
> Cc: Agyeman Prince 
> Signed-off-by: Chasel Chiu 
> 
> Chasel Chiu (6):
>   MinPlatformPkg: Add SetCacheLib library class.
>   MinPlatformPkg: Add SetCacheLib library class.
>   KabylakeOpenBoardPkg: Add SetCacheLib library class.
>   WhiskeylakeOpenBoardPkg: Add SetCacheLib library class.
>   PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.
>   SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.
> 
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel
> /MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c   | 640
> --
> --
> --
> --
> --
> --
> 
>  Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
> | 325
> ++
> ++
> ++
> ++
> ++
> +++
>  Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.c
> |  37 +
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPos
> tMem.c  | 149 
> +-
> --
> -
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPre
> Mem.c   | 164 
> ++
> --
> 
>  Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
> |   3 ++-
>  Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
> |   2 +-
> 
> Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel
> /MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf |  67
> ---
>  Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc
> |   1 +
>  Platform/Intel/MinPlatformPkg/Include/Library/SetCacheLib.h
> |  34 ++
>  Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf
> |  44 
>  Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.inf
> |  30 ++
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPos
> tMem.inf|  11 
> +--
> 
> Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPre
> Mem.inf |   7 ++-
>  Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
> |   3 ++-
>  Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
> |   1 +
> 
> Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
> g.dsc   |   1 
> +
>  17 files changed, 484 insertions(+), 1035 deletions(-)  delete mode 100644

Re: [edk2-devel] [Patch v3 03/22] requirements.txt: Add python pip requirements file

2019-10-30 Thread Leif Lindholm
Agreed.

On Thu, 31 Oct 2019, 12:39 Kinney, Michael D, 
wrote:

> Hi Leif,
>
> I will see if we can add a proper file header with a description.
>
> I may break this out into its own patch since it is useful to
> install these pip modules to run CI tests and builds locally.
> The pip modules are not only use in a CI agent.
>
> Mike
>
> > -Original Message-
> > From: devel@edk2.groups.io  On
> > Behalf Of Leif Lindholm
> > Sent: Tuesday, October 29, 2019 8:03 PM
> > To: devel@edk2.groups.io; sean.bro...@microsoft.com
> > Subject: Re: [edk2-devel] [Patch v3 03/22]
> > requirements.txt: Add python pip requirements file
> >
> > OK, if it makes a difference for tools (and security
> > updates), let's try to keep it. (*grumble*)
> >
> > *But* given its too-generic name, can we add a big bold
> > comment header to the file explaining what it is?
> > Some quick searching suggests lines starting with # are
> > ignored, so hopefully this should be possible?
> >
> > Best Regards,
> >
> > Leif
> >
> > On Tue, Oct 29, 2019 at 07:52:48PM -0700, Sean via
> > Groups.Io wrote:
> > > It is a convention for projects using python.  It
> > definitely isn't required but there are some features
> > that come for free when using that filename.
> > >
> > > https://github.blog/2018-07-12-security-vulnerability-
> > alerts-for-pytho
> > > n/
> > > and
> > > https://help.github.com/en/github/visualizing-
> > repository-data-with-gra
> > > phs/listing-the-packages-that-a-repository-depends-on
> > >
> > > You can also get more insight from github into
> > dependencies and dependents.
> > > example:
> > > https://github.com/tianocore/edk2-pytool-
> > extensions/network/dependenci
> > > es
> > >
> > > I did notice on the example from above that github
> > picked up the requirements.publisher.txt so i don't know
> > what their pattern matching does exactly.
> > >
> > >
> > >
> >
> > 
>
>

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

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



Re: [edk2-devel] [Patch v3 02/22] .gitignore: Ignore python compiled files, extdeps, and vscode

2019-10-30 Thread Michael D Kinney
Leif,

Thanks.  I agree.  I will split it out.

Mike

> -Original Message-
> From: Leif Lindholm 
> Sent: Tuesday, October 29, 2019 7:30 PM
> To: Kinney, Michael D 
> Cc: devel@edk2.groups.io; Sean Brogan
> ; Andrew Fish
> ; Laszlo Ersek 
> Subject: Re: [Patch v3 02/22] .gitignore: Ignore python
> compiled files, extdeps, and vscode
> 
> On Tue, Oct 29, 2019 at 12:54:57PM -0700, Michael D
> Kinney wrote:
> > From: Sean Brogan 
> >
> > https://bugzilla.tianocore.org/show_bug.cgi?id=2315
> >
> > Update .gitignore to ignore .pyc files and __pycache__
> directories.
> > Python based plugins can be added to any package or
> platform, so these
> > files and directories may be present outside of
> BaseTools.
> >
> > Ignore _extdep directories that are generated by the
> pytool external
> > dependency feature.
> >
> > Ignore .vscode directories generated by the VS Code
> editor.
> >
> > Cc: Andrew Fish 
> > Cc: Laszlo Ersek 
> > Cc: Leif Lindholm 
> > Signed-off-by: Kinney 
> 
> Reviewed-by: Leif Lindholm 
> 
> (This one could be merged independently of rest of set,
> it's useful on its own.)
> 
> > ---
> >  .gitignore | 5 +
> >  1 file changed, 5 insertions(+)
> >
> > diff --git a/.gitignore b/.gitignore
> > index 97f22c348c..71679478ac 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -1,3 +1,8 @@
> >  Build/
> >  tags/
> >  .DS_Store
> > +*.pyc
> > +__pycache__/
> > +*_extdep/
> > +
> > +.vscode/
> > --
> > 2.21.0.windows.1
> >

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

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



Re: [edk2-devel] [Patch v3 22/22] Readme.md: Add CI build status badges

2019-10-30 Thread Michael D Kinney
Hi Leif,

Thanks for noticing the reference to the ci dir.  That content
Has been moved to .azurepipelines directory and the Readme.md 
filename is correct there.

I will split out the format changes to this Readme.md into its
own patch so it will not be mixed with the CI features.

I agree that the table with CI status is not very readable.
This is true in MD files for most long hyperlinks, especially
when they are put into a table format.  We can see if we can
improve the readability to make it easier to maintain, but 
will likely still be long lines.

Mike

> -Original Message-
> From: Leif Lindholm 
> Sent: Tuesday, October 29, 2019 7:58 PM
> To: Kinney, Michael D 
> Cc: devel@edk2.groups.io; Andrew Fish ;
> Laszlo Ersek 
> Subject: Re: [Patch v3 22/22] Readme.md: Add CI build
> status badges
> 
> On Tue, Oct 29, 2019 at 12:55:17PM -0700, Michael D
> Kinney wrote:
> > https://bugzilla.tianocore.org/show_bug.cgi?id=2315
> >
> > Update Readme.md with status badges from the most
> recent EDK II
> > Continuous Integration(CI) build.
> >
> > Cc: Andrew Fish 
> > Cc: Laszlo Ersek 
> > Cc: Leif Lindholm 
> > Signed-off-by: Michael D Kinney
> 
> > ---
> >  Readme.md | 29 ++---
> >  1 file changed, 22 insertions(+), 7 deletions(-)
> >
> > diff --git a/Readme.md b/Readme.md
> > index 27e4ce0771..37183c3265 100644
> > --- a/Readme.md
> > +++ b/Readme.md
> > @@ -3,6 +3,19 @@
> >  A modern, feature-rich, cross-platform firmware
> development
> > environment  for the UEFI and PI specifications from
> www.uefi.org.
> >
> > +## Build Status
> > +
> > +| Host Type | Toolchain | Branch | Build Status |
> Test Status | Code
> > +| Coverage |
> 
> This may sound like nitpicking, but I think it's
> important for
> messaging: we aren't listing tolchains, we are listing
> toolchain profiles. For VS, we are actually adding new
> profiles for each version, so that statement is not
> misleading. However, GCC5 is highly misleading (it is
> the profile we use for anything gcc5 onwards).
> 
> I don't think we can usefully pull in information about
> the toolchain actually used, so I think the name of the
> column should really be toolchain profile.
> 
> Even given that, I think it is time we create an
> abstracted GCC_CURRENT toolchain profile, pointing to
> GCC5. But if we rename the column, that may not be a
> prerequisite for this set.
> 
> > +| : | : | : | :- | : | :-
> -- | Windows |
> > +| VS2019 | master | [![Build
> > +| Status](https://dev.azure.com/tianocore/edk2-ci-
> play/_apis/build/st
> > +|
> atus/Edk2%20Windows%20VS2019%20CI?branchName=master)](ht
> tps://dev.a
> > +| zure.com/tianocore/edk2-ci-
> play/_build/latest?definitionId=14
> > +| hName=master) | [![Azure DevOps
> > +| tests](https://img.shields.io/azure-
> devops/tests/tianocore/edk2-ci-
> > +| play/14.svg)](https://dev.azure.com/tianocore/edk2-
> ci-play/_build/l
> > +| atest?definitionId=14=master) | [![Code
> > +| Coverage](https://img.shields.io/badge/coverage-
> coming_soon-blue)](
> > +| https://dev.azure.com/tianocore/edk2-ci-
> play/_build/latest?definiti
> > +| onId=14=master)| Ubuntu | GCC5 | master
> | [![Build
> > +| Status](https://dev.azure.com/tianocore/edk2-ci-
> play/_apis/build/st
> > +|
> atus/Edk2%20Ubuntu%20GCC5%20CI?branchName=master)](https
> ://dev.azur
> > +| e.com/tianocore/edk2-ci-
> play/_build/latest?definitionId=15
> > +| me=master) | [![Azure DevOps
> > +| tests](https://img.shields.io/azure-
> devops/tests/tianocore/edk2-ci-
> > +| play/15.svg)](https://dev.azure.com/tianocore/edk2-
> ci-play/_build/l
> > +| atest?definitionId=15=master)  | [![Code
> > +| Coverage](https://img.shields.io/badge/coverage-
> coming_soon-blue)](
> > +| https://dev.azure.com/tianocore/edk2-ci-
> play/_build/latest?definiti
> > +| onId=15=master) |
> 
> I have one problem with the above, which is that it
> turns an otherwise very readable in text mode file
> (which is half the point of .md) into what looks a
> little bit like a transmission error.
> 
> While I agree there is value in having this on the
> default loaded github webpage, do we have other options?
> 
> > +
> > +[More CI Build information](ci/readme.md)
> 
> I don't see this file in the tree?
> Which is good, beacuse it doesn't follow name standards.
> 
> > +
> > +## License Details
> > +
> > +[![License](https://img.shields.io/badge/license-BSD-
> -2--Clause--Pate
> > +nt-blue)](License.txt)
> > +
> 
> I don't mind this addition, but I think it should be a
> separate patch.
> I also think it would be best to hold this back until
> we've submoduled some of those otherwise licensed
> components.
> There is a very real likelihood of people skimming,
> seeing the image and ignoring the text.
> 
> >  The majority of the content in the EDK II open source
> project uses a
> > [BSD-2-Clause Plus Patent License](License.txt).  The
> EDK II open
> > source project  contains the following components that
> are covered by additional 

Re: [edk2-devel] [Patch v3 03/22] requirements.txt: Add python pip requirements file

2019-10-30 Thread Michael D Kinney
Hi Leif,

I will see if we can add a proper file header with a description.

I may break this out into its own patch since it is useful to
install these pip modules to run CI tests and builds locally.
The pip modules are not only use in a CI agent.

Mike

> -Original Message-
> From: devel@edk2.groups.io  On
> Behalf Of Leif Lindholm
> Sent: Tuesday, October 29, 2019 8:03 PM
> To: devel@edk2.groups.io; sean.bro...@microsoft.com
> Subject: Re: [edk2-devel] [Patch v3 03/22]
> requirements.txt: Add python pip requirements file
> 
> OK, if it makes a difference for tools (and security
> updates), let's try to keep it. (*grumble*)
> 
> *But* given its too-generic name, can we add a big bold
> comment header to the file explaining what it is?
> Some quick searching suggests lines starting with # are
> ignored, so hopefully this should be possible?
> 
> Best Regards,
> 
> Leif
> 
> On Tue, Oct 29, 2019 at 07:52:48PM -0700, Sean via
> Groups.Io wrote:
> > It is a convention for projects using python.  It
> definitely isn't required but there are some features
> that come for free when using that filename.
> >
> > https://github.blog/2018-07-12-security-vulnerability-
> alerts-for-pytho
> > n/
> > and
> > https://help.github.com/en/github/visualizing-
> repository-data-with-gra
> > phs/listing-the-packages-that-a-repository-depends-on
> >
> > You can also get more insight from github into
> dependencies and dependents.
> > example:
> > https://github.com/tianocore/edk2-pytool-
> extensions/network/dependenci
> > es
> >
> > I did notice on the example from above that github
> picked up the requirements.publisher.txt so i don't know
> what their pattern matching does exactly.
> >
> >
> >
> 
> 


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

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



Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

2019-10-30 Thread Andrew Fish via Groups.Io
Liming,

For gcc/clang if you repeat an argument the last argument wins. This is the 
default behavior and it does not warn, as it is designed to work with features 
like PcdOptimizeCompilerEnable. 

If VC++ warns for this behavior should we disable D9025 for VC++ so all the 
toolchains have the same behavior?

Thanks,

Andrew Fish

> On Oct 30, 2019, at 6:46 PM, Liming Gao  wrote:
> 
> Yes. This is the expect behavior. Compiler optimization is disabled, then Od 
> option will be used for VS tool chain.
>
> From: devel@edk2.groups.io  
> [mailto:devel@edk2.groups.io ] On Behalf Of 
> Tiger Liu(BJ-RD)
> Sent: Thursday, October 31, 2019 9:40 AM
> To: devel@edk2.groups.io ; Gao, Liming 
> mailto:liming@intel.com>>
> Subject: Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable
>
> Hi, Liming:
> Thanks for your explanation.
>
> If setting PcdOptimizeCompilerEnable as disable, then will cause D9025 
> compiling warning.
> Such as:
> cl : Command line warning D9025 : overriding '/O1' with '/Od'
>
> So, is it ok?
>
> Thanks
> 发件人: devel@edk2.groups.io   > 代表 Liming Gao
> 发送时间: 2019年10月30日 23:00
> 收件人: devel@edk2.groups.io ; Tiger Liu(BJ-RD) 
> mailto:tiger...@zhaoxin.com>>
> 主题: Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable
>
> NOOPT is build target. It includes the compiler option to disable 
> optimization. If the platform supports NOOPT target, it can be built with -b 
> NOOPT.
>
> PcdOptimizeCompilerEnable is one feature PCD defined in edk2-platforms. It 
> can be used to control the compiler option in [BuildOptions] section. It can 
> also be used for DEBUG or RELEASE target. 
>
> Thanks
> Liming
>  <>From: devel@edk2.groups.io  
> mailto:devel@edk2.groups.io>> On Behalf Of Tiger 
> Liu(BJ-RD)
> Sent: Tuesday, October 29, 2019 7:01 PM
> To: devel@edk2.groups.io 
> Subject: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable
>
> Hi, All:
> I have a question about NOOPT and PcdOptimizeCompilerEnable.
>
> If Target = NOOPT, then will disable all optimizations.
> And PcdOptimizeCompilerEnable has the same function.
>
> So, What’s the relationship between PcdOptimizeCompilerEnable and NOOPT?
>
> Thanks
>
> Best wishes,
>
> 
> 保密声明:
> 本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
> CONFIDENTIAL NOTE:
> This email contains confidential or legally privileged information and is for 
> the sole use of its intended recipient. Any unauthorized review, use, copying 
> or forwarding of this email or the content of this email is strictly 
> prohibited.
>
> 
> 保密声明:
> 本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
> CONFIDENTIAL NOTE:
> This email contains confidential or legally privileged information and is for 
> the sole use of its intended recipient. Any unauthorized review, use, copying 
> or forwarding of this email or the content of this email is strictly 
> prohibited.
> 


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

View/Reply Online (#49709): https://edk2.groups.io/g/devel/message/49709
Mute This Topic: https://groups.io/mt/39414231/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/SetupBrowserDxe: Add check for GetBufferForValue()

2019-10-30 Thread Dandan Bi
-Original Message-
From: devel@edk2.groups.io  On Behalf Of Zhang, Shenglei
Sent: Wednesday, October 30, 2019 10:27 PM
To: devel@edk2.groups.io
Cc: Wang, Jian J ; Wu, Hao A 
Subject: [edk2-devel] [PATCH v2 4/4] MdeModulePkg/SetupBrowserDxe: Add check 
for GetBufferForValue()

The returned value from GetBufferForValue might be NULL, so add a check for 
that before it is used.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 7f4929c2fcd9..984c68c6bb7a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -1281,7 +1281,12 @@ IfrToUint (
   Result->Type = EFI_IFR_TYPE_UNDEFINED;
   return EFI_SUCCESS;
 }
+
+if (GetBufferForValue () == NULL) {
+  return EFI_NOT_FOUND;
+}

Hi Shenglei,

Before call GetBufferForValue function, has already called function  
IsTypeInBuffer to make sure the value must be buffer type.
So GetBufferForValue can not return NULL. 
I think we also can add ASSERT here.

Thanks,
Dandan

 Result->Value.u64 = *(UINT64*) GetBufferForValue ();
+
 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
   FreePool (Value.Buffer);
 }
--
2.18.0.windows.1





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

View/Reply Online (#49708): https://edk2.groups.io/g/devel/message/49708
Mute This Topic: https://groups.io/mt/39808369/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 1/3] MdeModulePkg/EhciPei: Initialize the variable Map

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:08 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH v2 1/3] MdeModulePkg/EhciPei: Initialize the variable Map
> 
> Map is used but not Initialized.
> Map is called by IoMmuMap, in which Mapping(Map) is called by IoMmu-
> >Map.
> We can not assume Map is given an initial value at any step.


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> index 7c6a6a5f9716..995ccd2463d2 100644
> --- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> +++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> @@ -534,6 +534,8 @@ EhcCreateUrb (
>PEI_URB   *Urb;
>VOID  *Map;
> 
> +  Map = NULL;
> +
>Urb = Ehc->Urb;
>Urb->Signature  = EHC_URB_SIG;
>InitializeListHead (>UrbList);
> --
> 2.18.0.windows.1


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

View/Reply Online (#49707): https://edk2.groups.io/g/devel/message/49707
Mute This Topic: https://groups.io/mt/39796126/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 2/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 10:08 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH v2 2/3] MdeModulePkg/UhciPei: Initialize the variable
> RequestMap
> 
> RequestMap is used but not Initialized.
> RequestMap is called by UhciMapUserRequest, in which RequestMap(Map)
> is called by IoMmuMap, and is finally called by IoMmu->Map.
> We can not assume RequestMap is given an initial value at any step.


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> index b897c3f82ce6..a05834da3c4a 100644
> --- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> +++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> @@ -274,6 +274,8 @@ UhcControlTransfer (
> 
>PktID   = INPUT_PACKET_ID;
> 
> +  RequestMap  = NULL;
> +
>if (Request == NULL || TransferResult == NULL) {
>  return EFI_INVALID_PARAMETER;
>}
> --
> 2.18.0.windows.1


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

View/Reply Online (#49706): https://edk2.groups.io/g/devel/message/49706
Mute This Topic: https://groups.io/mt/39796153/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] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, October 30, 2019 8:33 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH v2] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex
> 
> DeviceIndex is used as index in Slot[]. The max size of Slot[]
> is SD_PEIM_MAX_SLOTS. So DeviceIndex should be checked before used.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
> v2. Update the check boundary from "SD_PEIM_MAX_SLOTS-1"
> to "SD_PEIM_MAX_SLOTS". Beacuse DeviceIndex is used as "DeviceIndex-1"
> in arrays.
> 
>  MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> index 8fa58d65b22c..ebd8270ce8e0 100644
> --- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> +++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> @@ -174,7 +174,7 @@ SdBlockIoPeimGetMediaInfo (
> 
>Private   = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
> 
> -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> (DeviceIndex > SD_PEIM_MAX_SLOTS)) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> @@ -252,7 +252,7 @@ SdBlockIoPeimReadBlocks (
>  return EFI_SUCCESS;
>}
> 
> -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> (DeviceIndex > SD_PEIM_MAX_SLOTS)) {


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


>  return EFI_INVALID_PARAMETER;
>}
> 
> --
> 2.18.0.windows.1


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

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



Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

2019-10-30 Thread Liming Gao
Yes. This is the expect behavior. Compiler optimization is disabled, then Od 
option will be used for VS tool chain.

From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Tiger 
Liu(BJ-RD)
Sent: Thursday, October 31, 2019 9:40 AM
To: devel@edk2.groups.io; Gao, Liming 
Subject: Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

Hi, Liming:
Thanks for your explanation.

If setting PcdOptimizeCompilerEnable as disable, then will cause D9025 
compiling warning.
Such as:
cl : Command line warning D9025 : overriding '/O1' with '/Od'

So, is it ok?

Thanks
发件人: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> 代表 Liming Gao
发送时间: 2019年10月30日 23:00
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) 
mailto:tiger...@zhaoxin.com>>
主题: Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

NOOPT is build target. It includes the compiler option to disable optimization. 
If the platform supports NOOPT target, it can be built with -b NOOPT.

PcdOptimizeCompilerEnable is one feature PCD defined in edk2-platforms. It can 
be used to control the compiler option in [BuildOptions] section. It can also 
be used for DEBUG or RELEASE target.

Thanks
Liming
From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Tiger 
Liu(BJ-RD)
Sent: Tuesday, October 29, 2019 7:01 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

Hi, All:
I have a question about NOOPT and PcdOptimizeCompilerEnable.

If Target = NOOPT, then will disable all optimizations.
And PcdOptimizeCompilerEnable has the same function.

So, What’s the relationship between PcdOptimizeCompilerEnable and NOOPT?

Thanks

Best wishes,

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.


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

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



Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

2019-10-30 Thread Tiger Liu(BJ-RD)
Hi, Liming:
Thanks for your explanation.

If setting PcdOptimizeCompilerEnable as disable, then will cause D9025 
compiling warning.
Such as:
cl : Command line warning D9025 : overriding '/O1' with '/Od'

So, is it ok?

Thanks
发件人: devel@edk2.groups.io  代表 Liming Gao
发送时间: 2019年10月30日 23:00
收件人: devel@edk2.groups.io; Tiger Liu(BJ-RD) 
主题: Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

NOOPT is build target. It includes the compiler option to disable optimization. 
If the platform supports NOOPT target, it can be built with -b NOOPT.

PcdOptimizeCompilerEnable is one feature PCD defined in edk2-platforms. It can 
be used to control the compiler option in [BuildOptions] section. It can also 
be used for DEBUG or RELEASE target.

Thanks
Liming
From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Tiger 
Liu(BJ-RD)
Sent: Tuesday, October 29, 2019 7:01 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

Hi, All:
I have a question about NOOPT and PcdOptimizeCompilerEnable.

If Target = NOOPT, then will disable all optimizations.
And PcdOptimizeCompilerEnable has the same function.

So, What’s the relationship between PcdOptimizeCompilerEnable and NOOPT?

Thanks

Best wishes,

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.



保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.

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

View/Reply Online (#49703): https://edk2.groups.io/g/devel/message/49703
Mute This Topic: https://groups.io/mt/39414231/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 v2 4/6] WhiskeylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel  
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Desimone, Nathaniel L 

Subject: [edk2-platforms: PATCH v2 4/6] WhiskeylakeOpenBoardPkg: Add 
SetCacheLib library class.

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

Whiskeylake board relying on FSP to configure MTRRs so it can include 
SetCacheLibNull.

Test: internal platform can boot with FSP API modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 8e0ea2d5ce..ba06ba3c89 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPk
+++ g.dsc
@@ -164,6 +164,7 @@
 !if $(TARGET) == DEBUG
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
+
+ SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLibNull.in
+ f
 
   ###
   # Board Package
--
2.13.3.windows.1


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

View/Reply Online (#49700): https://edk2.groups.io/g/devel/message/49700
Mute This Topic: https://groups.io/mt/40049899/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 v2 6/6] SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chiu, Chasel
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Wei, David Y ; Agyeman, Prince 

Subject: [edk2-devel] [edk2-platforms: PATCH v2 6/6] 
SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.

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

Include SetCacheLib from MinPlatformPkg.

Cc: Wei David Y 
Cc: Agyeman Prince 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..85691c55dd 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -136,6 +136,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
+  SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   ###
-- 
2.13.3.windows.1





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

View/Reply Online (#49702): https://edk2.groups.io/g/devel/message/49702
Mute This Topic: https://groups.io/mt/40049902/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 v2 3/6] KabylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel  
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Desimone, Nathaniel L 
; Gao, Liming ; Jeremy 
Soller 
Subject: [edk2-platforms: PATCH v2 3/6] KabylakeOpenBoardPkg: Add SetCacheLib 
library class.

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

Kabylake boards are relying on FSP to configure MTRRs so they can include 
SetCacheLibNull.

Test: internal platform can boot with FSP API and Dispatch modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Jeremy Soller 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
   | 640 

 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
   |   3 ++-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
   |   2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 |  67 ---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  
   |   1 +
 5 files changed, 4 insertions(+), 709 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
deleted file mode 100644
index b784026c1b..00
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/** @file
-  Source code file for Platform Init Pre-Memory PEI module
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include  -#include  
-#include 
-
-EFI_STATUS
-EFIAPI
-MemoryDiscoveredPpiNotifyCallback (
-  IN CONST EFI_PEI_SERVICES  **PeiServices,
-  IN EFI_PEI_NOTIFY_DESCRIPTOR   *NotifyDescriptor,
-  IN VOID*Ppi
-  );
-
-EFI_STATUS
-EFIAPI
-GetPlatformMemorySize (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_PLATFORM_MEMORY_SIZE_PPI   *This,
-  IN OUT  UINT64 *MemorySize
-  );
-
-/**
-
-  This function checks the memory range in PEI.
-
-  @param PeiServices Pointer to PEI Services.
-  @param ThisPei memory test PPI pointer.
-  @param BeginAddressBeginning of the memory address to be checked.
-  @param MemoryLengthBytes of memory range to be checked.
-  @param Operation   Type of memory check operation to be performed.
-  @param ErrorAddressReturn the address of the error memory address.
-
-  @retval EFI_SUCCESS The operation completed successfully.
-  @retval EFI_DEVICE_ERRORMemory test failed. It's not safe to use this 
range of memory.
-
-**/
-EFI_STATUS
-EFIAPI
-BaseMemoryTest (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_BASE_MEMORY_TEST_PPI   *This,
-  IN  EFI_PHYSICAL_ADDRESS   BeginAddress,
-  IN  UINT64 MemoryLength,
-  IN  PEI_MEMORY_TEST_OP Operation,
-  OUT EFI_PHYSICAL_ADDRESS   *ErrorAddress
-  );
-
-static EFI_PEI_NOTIFY_DESCRIPTOR mMemDiscoveredNotifyList = {
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  (EFI_PEIM_NOTIFY_ENTRY_POINT) MemoryDiscoveredPpiNotifyCallback -};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode 
= {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  NULL
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED 

Re: [edk2-devel] [edk2-platforms: PATCH v2 2/6] MinPlatformPkg: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel  
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platforms: PATCH v2 2/6] MinPlatformPkg: Add SetCacheLib library 
class.

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

MinPlatformPkg PlatformInit modules to consume SetCacheLib.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
   | 149 
+
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c 
   | 164 
++--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
 |  11 +--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
  |   7 ++-
 4 files changed, 6 insertions(+), 325 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
index 70e6b9a495..df64d4fc0d 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
+++ b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/Platfor
+++ mInitPostMem.c
@@ -13,8 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent  #include 
  #include   #include 
 -#include  -#include 

 
 #include 
 #include  @@ -22,6 +20,7 @@ 
SPDX-License-Identifier: BSD-2-Clause-Patent  #include   
#include   #include 
+#include 
 
 EFI_STATUS
 EFIAPI
@@ -38,152 +37,6 @@ static EFI_PEI_NOTIFY_DESCRIPTOR  mEndOfPeiNotifyList = {  
};
 
 /**
-  Update MTRR setting and set write back as default memory attribute.
-
-  @retval  EFI_SUCCESS  The function completes successfully.
-  @retval  Others   Some error occurs.
-**/
-EFI_STATUS
-EFIAPI
-SetCacheMtrrAfterEndOfPei (
-  VOID
-  )
-{
-  EFI_STATUSStatus;
-  MTRR_SETTINGS MtrrSetting;
-  EFI_PEI_HOB_POINTERS  Hob;
-  UINT64MemoryBase;
-  UINT64MemoryLength;
-  UINT64Power2Length;
-  EFI_BOOT_MODE BootMode;
-  UINTN Index;
-  UINT64SmramSize;
-  UINT64SmramBase;
-  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK*SmramHobDescriptorBlock;
-  Status = PeiServicesGetBootMode ();
-  ASSERT_EFI_ERROR (Status);
-
-  if (BootMode == BOOT_ON_S3_RESUME) {
-return EFI_SUCCESS;
-  }
-  //
-  // Clear the CAR Settings
-  //
-  ZeroMem(, sizeof(MTRR_SETTINGS));
-
-  //
-  // Default Cachable attribute will be set to WB to support large memory 
size/hot plug memory
-  //
-  MtrrSetting.MtrrDefType &= ~((UINT64)(0xFF));
-  MtrrSetting.MtrrDefType |= (UINT64) CacheWriteBack;
-
-  //
-  // Set fixed cache for memory range below 1MB
-  //
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0x0,
- 0xA,
- CacheWriteBack
- );
-  ASSERT_EFI_ERROR (Status);
-
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0xA,
- 0x2,
- CacheUncacheable
- );
-  ASSERT_EFI_ERROR (Status);
-
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0xC,
- 0x4,
- CacheWriteProtected
- );
-  ASSERT_EFI_ERROR ( Status);
-
-  //
-  // PI SMM IPL can't set SMRAM to WB because at that time CPU ARCH protocol 
is not available.
-  // Set cacheability of SMRAM to WB here to improve SMRAM initialization 
performance.
-  //
-  SmramSize = 0;
-  SmramBase = 0;
-  Status = PeiServicesGetHobList ((VOID **) );
-  while (!END_OF_HOB_LIST (Hob)) {
-if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
-  if (CompareGuid (>Name, )) {
-SmramHobDescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *) (Hob.Guid 
+ 1);
-for (Index = 0; Index < 
SmramHobDescriptorBlock->NumberOfSmmReservedRegions; Index++) {
-  if (SmramHobDescriptorBlock->Descriptor[Index].PhysicalStart > 
0x10) {
-SmramSize += 
SmramHobDescriptorBlock->Descriptor[Index].PhysicalSize;
-if (SmramBase == 0 || SmramBase > 
SmramHobDescriptorBlock->Descriptor[Index].CpuStart) {
-  

Re: [edk2-devel] [edk2-platforms: PATCH v2 5/6] PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Chiu, Chasel
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Lu, Shifei A ; Zhou, Bowen ; 
Oram, Isaac W 
Subject: [edk2-devel] [edk2-platforms: PATCH v2 5/6] 
PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.

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

Include SetCacheLib from MinPlatformPkg.

Cc: Shifei A Lu 
Cc: Xiaohu Zhou 
Cc: Isaac W Oram 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
index 595ffd4144..c7be68d979 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
@@ -1,6 +1,6 @@
 ### @file
 #
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights 
+reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent  # @@ -135,6 +135,7 @@  
!include $(RC_PKG)/RcDxeLib.dsc  !include $(SKT_PKG)/SktDxeLib.dsc  !include 
$(PCH_PKG)/PchDxeLib.dsc
+  SetCacheLib|MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.X64]
   
BoardAcpiTableLib|$(BOARD_PKG)/$(BOARD_NAME)/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
--
2.13.3.windows.1





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

View/Reply Online (#49701): https://edk2.groups.io/g/devel/message/49701
Mute This Topic: https://groups.io/mt/40049901/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 v2 1/6] MinPlatformPkg: Add SetCacheLib library class.

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Chiu, Chasel  
Sent: Wednesday, October 30, 2019 5:30 PM
To: devel@edk2.groups.io
Cc: Kubacki, Michael A ; Desimone, Nathaniel L 
; Gao, Liming 
Subject: [edk2-platforms: PATCH v2 1/6] MinPlatformPkg: Add SetCacheLib library 
class.

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

MinPlatformPkg should contain the library class header (API) and the NULL 
library class instance.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c   | 325 
+
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.c   |  37 
+
 Platform/Intel/MinPlatformPkg/Include/Library/SetCacheLib.h   |  34 
++
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf |  44 

 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.inf |  30 
++
 5 files changed, 470 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c 
b/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
new file mode 100644
index 00..b5c5041430
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
@@ -0,0 +1,325 @@
+/** @file
+
+SetCache library functions.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Set Cache Mtrr.
+**/
+VOID
+EFIAPI
+SetCacheMtrr (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+  EFI_PEI_HOB_POINTERSHob;
+  MTRR_SETTINGS   MtrrSetting;
+  UINT64  MemoryBase;
+  UINT64  MemoryLength;
+  UINT64  LowMemoryLength;
+  UINT64  HighMemoryLength;
+  EFI_BOOT_MODE   BootMode;
+  EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
+  UINT64  CacheMemoryLength;
+
+  ///
+  /// Reset all MTRR setting.
+  ///
+  ZeroMem(, sizeof(MTRR_SETTINGS));
+
+  ///
+  /// Cache the Flash area as WP to boost performance  ///  Status = 
+ MtrrSetMemoryAttributeInMtrrSettings (
+,
+(UINTN) PcdGet32 (PcdFlashAreaBaseAddress),
+(UINTN) PcdGet32 (PcdFlashAreaSize),
+CacheWriteProtected
+);
+  ASSERT_EFI_ERROR (Status);
+
+  ///
+  /// Update MTRR setting from MTRR buffer for Flash Region to be WP to 
+ boost performance  ///  MtrrSetAllMtrrs ();
+
+  ///
+  /// Set low to 1 MB. Since 1MB cacheability will always be set  /// 
+ until override by CSM.
+  /// Initialize high memory to 0.
+  ///
+  LowMemoryLength   = 0x10;
+  HighMemoryLength  = 0;
+  ResourceAttribute = (
+   EFI_RESOURCE_ATTRIBUTE_PRESENT |
+   EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+   EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
+   );
+
+  Status = PeiServicesGetBootMode ();  ASSERT_EFI_ERROR 
+ (Status);
+
+  if (BootMode != BOOT_ON_S3_RESUME) {
+ResourceAttribute |= EFI_RESOURCE_ATTRIBUTE_TESTED;  }
+
+  Status = PeiServicesGetHobList ((VOID **) );  while 
+ (!END_OF_HOB_LIST (Hob)) {
+if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
+  if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) 
||
+  ((Hob.ResourceDescriptor->ResourceType == 
EFI_RESOURCE_MEMORY_RESERVED) &&
+   (Hob.ResourceDescriptor->ResourceAttribute == ResourceAttribute))
+ ) {
+if (Hob.ResourceDescriptor->PhysicalStart >= 0x1ULL) {
+  HighMemoryLength += Hob.ResourceDescriptor->ResourceLength;
+} else if (Hob.ResourceDescriptor->PhysicalStart >= 0x10) {
+  LowMemoryLength += Hob.ResourceDescriptor->ResourceLength;
+}
+  }
+}
+
+Hob.Raw = GET_NEXT_HOB (Hob);
+  }
+
+  DEBUG ((DEBUG_INFO, "Memory Length (Below 4GB) = %lx.\n", 
+ LowMemoryLength));  DEBUG ((DEBUG_INFO, "Memory Length (Above 4GB) = 
+ %lx.\n", HighMemoryLength));
+
+  ///
+  /// Assume size of main memory is multiple of 256MB  ///
+ MemoryLength = (LowMemoryLength + 0xFFF) & 0xF000;  MemoryBase 
+ = 0;
+
+  

Re: [edk2-devel] [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Fix gcc build failure

2019-10-30 Thread Nate DeSimone
Your whitespace doesn't quite match edk2 coding style guidelines, but we can 
fix that during commit.

Reviewed-by: Nate DeSimone 

-Original Message-
From: Agyeman, Prince  
Sent: Wednesday, October 30, 2019 10:05 AM
To: devel@edk2.groups.io
Cc: Sinha, Ankit ; Desimone, Nathaniel L 
; Kubacki, Michael A 

Subject: [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Fix gcc build failure

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

Currently, gcc 5 encounters an error "unused-but-set-variable" in BdsPlatform.c 
 as a result of a Status variable not being used after it's set.

This was fixed by printing the Status variable when 
EfiBootManagerDeleteLoadOptionVariable function encounters an error

Cc: Ankit Sinha 
Cc: Nate DeSimone 
Cc: Kubacki Michael A 

Signed-off-by: Prince Agyeman 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c  | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 7aa3860f75..a4b010be63 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/B
+++ dsPlatform.c
@@ -348,6 +348,10 @@ PlatformBootManagerBeforeConsole (
   NvBootOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypeBoot);
   for (Index = 0; Index < NvBootOptionCount; Index++) {
 Status = EfiBootManagerDeleteLoadOptionVariable 
(NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);
+if(EFI_ERROR (Status)){
+  DEBUG ((DEBUG_ERROR,
+  "%a: removing Boot#%04x %r\n", __FUNCTION__, 
(UINT32)NvBootOptions[Index].OptionNumber, Status));
+}
   }
 
   InstallDevicePathCallback ();
--
2.19.1.windows.1


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

View/Reply Online (#49696): https://edk2.groups.io/g/devel/message/49696
Mute This Topic: https://groups.io/mt/39839161/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 V1 1/2] KabylakeOpenBoardPkg: Correct Platform Hook Library references

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: devel@edk2.groups.io  On Behalf Of Kubacki, Michael 
A
Sent: Tuesday, October 29, 2019 4:05 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 
; Jeremy Soller 
Subject: [edk2-devel] [edk2-platforms][PATCH V1 1/2] KabylakeOpenBoardPkg: 
Correct Platform Hook Library references

Many file descriptions reference "Platform Hook Library" when the file is not 
related to the PlatformHookLib library class. This change updates those 
references in KabylakeOpenBoardPkg to a more accurate description.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Cc: Jeremy Soller 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
|  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeMultiBoardAcpiSupportLib.inf
 |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
   |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
 |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Library/BoardAcpiLib/SmmGalagoPro3AcpiEnableLib.c
  |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeBoardAcpiTableLib.c
  |  4 ++--
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeKabylakeRvp3AcpiTableLib.c
   |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeMultiBoardAcpiSupportLib.c
   |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
 |  4 ++--
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmKabylakeRvp3AcpiEnableLib.c
  |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
   |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
   | 10 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiBoardInitPostMemLib.c
|  4 ++--
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiBoardInitPreMemLib.c
 |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.c
   |  2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.c
|  2 +-
 16 files changed, 23 insertions(+), 23 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
index e7a30a726a..bfb58e868f 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpi
+++ Lib/DxeBoardAcpiTableLib.inf
@@ -1,5 +1,5 @@
 ### @file
-# Platform Hook Library instance for Kaby Lake RVP3.
+# Kaby Lake RVP 3 Board ACPI library
 #
 # Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.  # 
diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeMultiBoardAcpiSupportLib.inf
 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeMultiBoardAcpiSupportLib.inf
index 0bd821ffbb..00cdbe80ce 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/DxeMultiBoardAcpiSupportLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpi
+++ Lib/DxeMultiBoardAcpiSupportLib.inf
@@ -1,5 +1,5 @@
 ### @file
-# Platform Hook Library instance for Kaby Lake RVP3.
+# Kaby Lake RVP 3 Multi-Board ACPI Support library
 #
 # Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.  # 
diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
index cad0caa79c..46a714dc1d 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpi
+++ Lib/SmmBoardAcpiEnableLib.inf
@@ -1,5 +1,5 @@
 ### @file
-# Platform Hook Library instance for Kaby Lake RVP3.
+# Kaby Lake RVP 3 SMM Board ACPI Enable library
 #
 # Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.  # 
diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
 
b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
index 6628d30b6b..fca63c8314 100644
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
+++ b/Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/Library/BoardAcpi
+++ 

Re: [edk2-devel] [edk2-platforms][PATCH V1 2/2] WhiskeylakeOpenBoardPkg: Correct Platform Hook Library references

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Kubacki, Michael A  
Sent: Tuesday, October 29, 2019 4:05 PM
To: devel@edk2.groups.io
Cc: Chiu, Chasel ; Desimone, Nathaniel L 

Subject: [edk2-platforms][PATCH V1 2/2] WhiskeylakeOpenBoardPkg: Correct 
Platform Hook Library references

Many file descriptions reference "Platform Hook Library" when the file is not 
related to the PlatformHookLib library class. This change updates those 
references in WhiskeylakeOpenBoardPkg to a more accurate description.

Cc: Chasel Chiu 
Cc: Nate DeSimone 
Signed-off-by: Michael Kubacki 
---
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
 | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
   | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
   | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
 | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
 | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmWhiskeylakeURvpAcpiEnableLib.c
 | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPostMemLib.c
  | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiBoardInitPreMemLib.c
   | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPostMemLib.c
 | 2 +-
 
Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardInitLib/PeiMultiBoardInitPreMemLib.c
  | 2 +-
 10 files changed, 10 insertions(+), 10 deletions(-)

diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
index c3fd60007a..7c360a8043 100644
--- 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boa
+++ rdAcpiLib/SmmBoardAcpiEnableLib.inf
@@ -1,5 +1,5 @@
 ## @file
-# Platform Hook Library instance for Whiskeylake Mobile/Desktop CRB.
+# Whiskey Lake U RVP SMM Board ACPI Enable library
 #
 #
 #  Copyright (c) 2019, Intel Corporation. All rights reserved. diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
index eaf46ad4ef..32e63b15ce 100644
--- 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.inf
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boa
+++ rdAcpiLib/SmmMultiBoardAcpiSupportLib.inf
@@ -1,5 +1,5 @@
 ## @file
-# Platform Hook Library instance for Whiskeylake Mobile/Desktop CRB.
+# Whiskey Lake U RVP SMM Multi-Board ACPI Support library
 #
 #
 #  Copyright (c) 2019, Intel Corporation. All rights reserved. diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
index e7acbda03a..1554b568d7 100644
--- 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmBoardAcpiEnableLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boa
+++ rdAcpiLib/SmmBoardAcpiEnableLib.c
@@ -1,5 +1,5 @@
 /** @file
-  Platform Hook Library instances
+  Whiskey Lake U RVP SMM Board ACPI Enable library
 
 
   Copyright (c) 2019, Intel Corporation. All rights reserved. diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
index 5fc61861a6..6ff78c2946 100644
--- 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmMultiBoardAcpiSupportLib.c
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/Boa
+++ rdAcpiLib/SmmMultiBoardAcpiSupportLib.c
@@ -1,5 +1,5 @@
 /** @file
-  Platform Hook Library instances
+  Whiskey Lake U RVP SMM Multi-Board ACPI Support library
 
 
   Copyright (c) 2019, Intel Corporation. All rights reserved. diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
index 9daceaa25c..6d04e83be2 100644
--- 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/Library/BoardAcpiLib/SmmSiliconAcpiEnableLib.c
+++ 

Re: [edk2-devel] [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Add CmosAccessLib to BoardX58Ich10

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Agyeman, Prince  
Sent: Tuesday, October 29, 2019 3:27 PM
To: devel@edk2.groups.io
Cc: Sinha, Ankit ; Desimone, Nathaniel L 
; Kubacki, Michael A 

Subject: [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Add CmosAccessLib to 
BoardX58Ich10

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

Replaced Cmos.c and Cmos.h with BoardModulePkg's Cmos library CmosAccessLib

Cc: Ankit Sinha 
Cc: Nate DeSimone 
Cc: Kubacki Michael A 

Signed-off-by: Prince Agyeman 
---
 .../BoardX58Ich10/OpenBoardPkg.dsc|  2 +
 .../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c | 57 ---  
.../Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h | 50   
.../SimicsOpenBoardPkg/SimicsPei/MemDetect.c  |  4 +-
 .../SimicsOpenBoardPkg/SimicsPei/Platform.c   |  4 +-
 .../SimicsPei/SimicsPei.inf   |  3 +-
 6 files changed, 8 insertions(+), 112 deletions(-)  delete mode 100644 
Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c
 delete mode 100644 Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..67f1680a4f 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -115,6 +115,8 @@
   
SerializeVariablesLib|$(BOARD_PKG)/Library/SerializeVariablesLib/SerializeVariablesLib.inf
   
SiliconPolicyInitLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyInitLib/SiliconPolicyInitLib.inf
   
SiliconPolicyUpdateLib|$(BOARD_PKG)/Policy/Library/SiliconPolicyUpdateLib/SiliconPolicyUpdateLib.inf
+
+ PlatformCmosAccessLib|BoardModulePkg/Library/PlatformCmosAccessLibNull
+ /PlatformCmosAccessLibNull.inf
+ CmosAccessLib|BoardModulePkg/Library/CmosAccessLib/CmosAccessLib.inf
 
 [LibraryClasses.common.SEC]
   ###
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c
deleted file mode 100644
index b34ba9283b..00
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/** @file
-  PC/AT CMOS access routines
-
-  Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved. 
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent -**/
-
-#include "Cmos.h"
-#include "Library/IoLib.h"
-
-/**
-  Reads 8-bits of CMOS data.
-
-  Reads the 8-bits of CMOS data at the location specified by Index.
-  The 8-bit read value is returned.
-
-  @param  Index  The CMOS location to read.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-CmosRead8 (
-  IN  UINTN Index
-  )
-{
-  IoWrite8 (0x70, (UINT8) Index);
-  return IoRead8 (0x71);
-}
-
-
-/**
-  Writes 8-bits of CMOS data.
-
-  Writes 8-bits of CMOS data to the location specified by Index
-  with the value specified by Value and returns Value.
-
-  @param  Index  The CMOS location to write.
-  @param  Value  The value to write to CMOS.
-
-  @return The value written to CMOS.
-
-**/
-UINT8
-EFIAPI
-CmosWrite8 (
-  IN  UINTN Index,
-  IN  UINT8 Value
-  )
-{
-  IoWrite8 (0x70, (UINT8) Index);
-  IoWrite8 (0x71, Value);
-  return Value;
-}
-
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h
deleted file mode 100644
index 07fa2e2d11..00
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/Cmos.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/** @file
-  PC/AT CMOS access routines
-
-  Copyright (c) 2006 - 2019 Intel Corporation. All rights reserved. 
-
-  SPDX-License-Identifier: BSD-2-Clause-Patent -**/
-
-#ifndef __CMOS_H__
-#define __CMOS_H__
-
-/**
-  Reads 8-bits of CMOS data.
-
-  Reads the 8-bits of CMOS data at the location specified by Index.
-  The 8-bit read value is returned.
-
-  @param  Index  The CMOS location to read.
-
-  @return The value read.
-
-**/
-UINT8
-EFIAPI
-CmosRead8 (
-  IN  UINTN Index
-  );
-
-/**
-  Writes 8-bits of CMOS data.
-
-  Writes 8-bits of CMOS data to the location specified by Index
-  with the value specified by Value and returns Value.
-
-  @param  Index  The CMOS location to write.
-  @param  Value  The value to write to CMOS.
-
-  @return The value written to CMOS.
-
-**/
-UINT8
-EFIAPI
-CmosWrite8 (
-  IN  UINTN Index,
-  IN  UINT8 Value
-  );
-
-
-#endif
-
diff --git a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c 
b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
index ee0eead5a8..4d16fd2fac 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
+++ b/Platform/Intel/SimicsOpenBoardPkg/SimicsPei/MemDetect.c
@@ -22,11 +22,11 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
 #include "Platform.h"
-#include "Cmos.h"
 
 UINT8 

Re: [edk2-devel] [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Change Build Output Directory

2019-10-30 Thread Nate DeSimone
Reviewed-by: Nate DeSimone 

-Original Message-
From: Agyeman, Prince  
Sent: Tuesday, October 29, 2019 1:36 PM
To: devel@edk2.groups.io
Cc: Sinha, Ankit ; Desimone, Nathaniel L 
; Kubacki, Michael A 

Subject: [edk2-platforms] [PATCH] SimicsOpenBoardPkg: Change Build Output 
Directory

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

Changed BoardX558ich10's build directory to
Build/SimicsOpenBoardPkg/BoardX58Ich10 to align it with align with the other 
Intel board packages

Cc: Ankit Sinha 
Cc: Nate DeSimone 
Cc: Kubacki Michael A 

Signed-off-by: Prince Agyeman 
---
 .../BoardX58Ich10/OpenBoardPkg.dsc  | 13 +++--
 .../BoardX58Ich10/OpenBoardPkg.fdf  |  2 +-
 2 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..78f1e80990 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -20,16 +20,17 @@
   DEFINE PCH_PKG   = SimicsIch10Pkg
   DEFINE DXE_ARCH  = X64
   DEFINE PEI_ARCH  = IA32
+  DEFINE PROJECT   = $(BOARD_PKG)/$(BOARD_NAME)
 
   PLATFORM_NAME  = SimicsX58
   PLATFORM_GUID  = EE8EBB5A-CC95-412f-9987-2AF70F88B69A
   PLATFORM_VERSION   = 0.1
   DSC_SPECIFICATION  = 0x00010005
-  OUTPUT_DIRECTORY   = Build/SimicsX58Ia32X64
+  OUTPUT_DIRECTORY   = Build/$(PROJECT)
   SUPPORTED_ARCHITECTURES= IA32|X64
   BUILD_TARGETS  = DEBUG|RELEASE|NOOPT
   SKUID_IDENTIFIER   = DEFAULT
-  FLASH_DEFINITION   = $(BOARD_PKG)/$(BOARD_NAME)/OpenBoardPkg.fdf
+  FLASH_DEFINITION   = $(PROJECT)/OpenBoardPkg.fdf
 
   DEFINE SMM_REQUIRE = TRUE
 
@@ -41,7 +42,7 @@
   DEFINE NETWORK_ISCSI_ENABLE   = FALSE
   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = TRUE
 
-  !include $(BOARD_PKG)/$(BOARD_NAME)/OpenBoardPkgPcd.dsc
+  !include $(PROJECT)/OpenBoardPkgPcd.dsc
   !include NetworkPkg/NetworkDefines.dsc.inc
 
 

@@ -80,7 +81,7 @@
 ###
 # Build Option Includes
 ###
-!include $(BOARD_PKG)/$(BOARD_NAME)/OpenBoardPkgBuildOption.dsc
+!include $(PROJECT)/OpenBoardPkgBuildOption.dsc
 
 

 #
@@ -175,11 +176,11 @@
   #
   $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf {
 
-  
BoardInitLib|$(BOARD_PKG)/$(BOARD_NAME)/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
+
+ BoardInitLib|$(PROJECT)/Library/BoardInitLib/PeiBoardInitPreMemLib.inf
   }
   $(PLATFORM_PACKAGE)/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf {
 
-  
BoardInitLib|$(BOARD_PKG)/$(BOARD_NAME)/Library/BoardInitLib/PeiBoardInitPostMemLib.inf
+
+ BoardInitLib|$(PROJECT)/Library/BoardInitLib/PeiBoardInitPostMemLib.in
+ f
   }
   $(PLATFORM_PACKAGE)/PlatformInit/ReportFv/ReportFvPei.inf
   $(PLATFORM_PACKAGE)/PlatformInit/SiliconPolicyPei/SiliconPolicyPeiPreMem.inf
diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
index 0c27cb0ef2..39226251a7 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.fdf
@@ -13,7 +13,7 @@
 # Build the variable store and the firmware code as one unified flash device  
# image.
 #
-[FD.SIMICSX58IA32X64]
+[FD.BOARDX58ICH10]
 BaseAddress   = $(FW_BASE_ADDRESS)
 Size  = $(FW_SIZE)
 ErasePolarity = 1
--
2.19.1.windows.1


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

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



Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files

2019-10-30 Thread Liming Gao
Pierre:
  Can you give the whole solution for this usage model? Does it mean C source 
file depends on ASL file? This is related to the priority of source file type. 
Now, there is no method to let user configure them. I suggest to introduce the 
generic way instead of the specific handle. 

Thanks
Liming
>-Original Message-
>From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
>PierreGondois
>Sent: Wednesday, October 30, 2019 9:51 PM
>To: devel@edk2.groups.io
>Cc: Pierre Gondois ; Feng, Bob C
>; Gao, Liming ;
>sami.muja...@arm.com; n...@arm.com
>Subject: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files
>
>From: Pierre Gondois 
>
>The '-tc' option of the Intel iASL compiler facilitates
>generation of AML code in a C array. This AML code is
>output to a .hex file. The .hex file can be included
>from a C source file, thereby allowing one to run a
>fix-up code in C.
>
>For example, this technique can be used to patch the
>resource data elements that describe the base address
>or interrupt number for a device, before installing
>the ACPI table.
>
>To implement this feature two conditions need to be
>satisfied:
> - The ASL and C files must be included in the sources
>   section of the same .inf file for the module.
> - The ASL files are pre-processed and compiled before
>   the C files (so that the .hex file include dependency
>   is satisfied).
>
>This patch resolves the dependency by sorting the
>CODA_TARGET list for the module being built and
>placing the .aml files at the very beginning of
>the list.
>
>Signed-off-by: Pierre Gondois 
>---
>
>The changes can be seen at
>https://github.com/PierreARM/edk2/commits/676_build_asl_first_v1
>
>Notes:
>v1:
>- Sort .aml files first in the CODA_TARGET to build  [Pierre]
>  them before other files.
>
> BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 10 +-
> 1 file changed, 9 insertions(+), 1 deletion(-)
>
>diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>index
>f0812b6887be6f9fbdb14003f2efff229633fb34..a59ed1d1952c23d0d3de83353a0
>566fb8a7dab77 100755
>--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
>@@ -2,6 +2,7 @@
> # Create makefile for MS nmake and GNU make
> #
> # Copyright (c) 2019, Intel Corporation. All rights reserved.
>+# Copyright (c) 2019, ARM Limited. All rights reserved.
> # SPDX-License-Identifier: BSD-2-Clause-Patent
> #
> from __future__ import absolute_import
>@@ -931,7 +932,14 @@ class ModuleAutoGen(AutoGen):
> @cached_property
> def CodaTargetList(self):
> self.Targets
>-return self._FinalBuildTargetList
>+
>+# To resolve dependencies on compiled ASL files (.aml files) in 
>modules,
>+# build them first by putting them as the first targets in the
>+# CodaTargetList.
>+OrderedList = list(self._FinalBuildTargetList)
>+OrderedList.sort(key=lambda T: (T.Target.Ext.lower() != '.aml'))
>+
>+return OrderedList
>
> @cached_property
> def FileTypes(self):
>--
>'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>
>
>
>


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

View/Reply Online (#49691): https://edk2.groups.io/g/devel/message/49691
Mute This Topic: https://groups.io/mt/39786201/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 v2 6/6] SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Include SetCacheLib from MinPlatformPkg.

Cc: Wei David Y 
Cc: Agyeman Prince 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..85691c55dd 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -136,6 +136,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
+  SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   ###
-- 
2.13.3.windows.1


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

View/Reply Online (#49690): https://edk2.groups.io/g/devel/message/49690
Mute This Topic: https://groups.io/mt/40049902/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 v2 1/6] MinPlatformPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

MinPlatformPkg should contain the library class header (API)
and the NULL library class instance.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c   | 325 
+
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.c   |  37 
+
 Platform/Intel/MinPlatformPkg/Include/Library/SetCacheLib.h   |  34 
++
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf |  44 

 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.inf |  30 
++
 5 files changed, 470 insertions(+)

diff --git a/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c 
b/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
new file mode 100644
index 00..b5c5041430
--- /dev/null
+++ b/Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
@@ -0,0 +1,325 @@
+/** @file
+
+SetCache library functions.
+
+Copyright (c) 2019, Intel Corporation. All rights reserved.
+SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+/**
+  Set Cache Mtrr.
+**/
+VOID
+EFIAPI
+SetCacheMtrr (
+  VOID
+  )
+{
+  EFI_STATUS  Status;
+  EFI_PEI_HOB_POINTERSHob;
+  MTRR_SETTINGS   MtrrSetting;
+  UINT64  MemoryBase;
+  UINT64  MemoryLength;
+  UINT64  LowMemoryLength;
+  UINT64  HighMemoryLength;
+  EFI_BOOT_MODE   BootMode;
+  EFI_RESOURCE_ATTRIBUTE_TYPE ResourceAttribute;
+  UINT64  CacheMemoryLength;
+
+  ///
+  /// Reset all MTRR setting.
+  ///
+  ZeroMem(, sizeof(MTRR_SETTINGS));
+
+  ///
+  /// Cache the Flash area as WP to boost performance
+  ///
+  Status = MtrrSetMemoryAttributeInMtrrSettings (
+,
+(UINTN) PcdGet32 (PcdFlashAreaBaseAddress),
+(UINTN) PcdGet32 (PcdFlashAreaSize),
+CacheWriteProtected
+);
+  ASSERT_EFI_ERROR (Status);
+
+  ///
+  /// Update MTRR setting from MTRR buffer for Flash Region to be WP to boost 
performance
+  ///
+  MtrrSetAllMtrrs ();
+
+  ///
+  /// Set low to 1 MB. Since 1MB cacheability will always be set
+  /// until override by CSM.
+  /// Initialize high memory to 0.
+  ///
+  LowMemoryLength   = 0x10;
+  HighMemoryLength  = 0;
+  ResourceAttribute = (
+   EFI_RESOURCE_ATTRIBUTE_PRESENT |
+   EFI_RESOURCE_ATTRIBUTE_INITIALIZED |
+   EFI_RESOURCE_ATTRIBUTE_UNCACHEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_COMBINEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_THROUGH_CACHEABLE |
+   EFI_RESOURCE_ATTRIBUTE_WRITE_BACK_CACHEABLE
+   );
+
+  Status = PeiServicesGetBootMode ();
+  ASSERT_EFI_ERROR (Status);
+
+  if (BootMode != BOOT_ON_S3_RESUME) {
+ResourceAttribute |= EFI_RESOURCE_ATTRIBUTE_TESTED;
+  }
+
+  Status = PeiServicesGetHobList ((VOID **) );
+  while (!END_OF_HOB_LIST (Hob)) {
+if (Hob.Header->HobType == EFI_HOB_TYPE_RESOURCE_DESCRIPTOR) {
+  if ((Hob.ResourceDescriptor->ResourceType == EFI_RESOURCE_SYSTEM_MEMORY) 
||
+  ((Hob.ResourceDescriptor->ResourceType == 
EFI_RESOURCE_MEMORY_RESERVED) &&
+   (Hob.ResourceDescriptor->ResourceAttribute == ResourceAttribute))
+ ) {
+if (Hob.ResourceDescriptor->PhysicalStart >= 0x1ULL) {
+  HighMemoryLength += Hob.ResourceDescriptor->ResourceLength;
+} else if (Hob.ResourceDescriptor->PhysicalStart >= 0x10) {
+  LowMemoryLength += Hob.ResourceDescriptor->ResourceLength;
+}
+  }
+}
+
+Hob.Raw = GET_NEXT_HOB (Hob);
+  }
+
+  DEBUG ((DEBUG_INFO, "Memory Length (Below 4GB) = %lx.\n", LowMemoryLength));
+  DEBUG ((DEBUG_INFO, "Memory Length (Above 4GB) = %lx.\n", HighMemoryLength));
+
+  ///
+  /// Assume size of main memory is multiple of 256MB
+  ///
+  MemoryLength = (LowMemoryLength + 0xFFF) & 0xF000;
+  MemoryBase = 0;
+
+  CacheMemoryLength = MemoryLength;
+  ///
+  /// Programming MTRRs to avoid override SPI region with UC when MAX TOLUD 
Length >= 3.5GB
+  ///
+  if (MemoryLength > 0xDC00) {
+ CacheMemoryLength = 0xC000;
+ Status = MtrrSetMemoryAttributeInMtrrSettings (
+,
+  

[edk2-devel] [edk2-platforms: PATCH v2 5/6] PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Include SetCacheLib from MinPlatformPkg.

Cc: Shifei A Lu 
Cc: Xiaohu Zhou 
Cc: Isaac W Oram 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
index 595ffd4144..c7be68d979 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
@@ -1,6 +1,6 @@
 ### @file
 #
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -135,6 +135,7 @@
 !include $(RC_PKG)/RcDxeLib.dsc
 !include $(SKT_PKG)/SktDxeLib.dsc
 !include $(PCH_PKG)/PchDxeLib.dsc
+  SetCacheLib|MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.X64]
   
BoardAcpiTableLib|$(BOARD_PKG)/$(BOARD_NAME)/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
-- 
2.13.3.windows.1


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

View/Reply Online (#49689): https://edk2.groups.io/g/devel/message/49689
Mute This Topic: https://groups.io/mt/40049901/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 v2 2/6] MinPlatformPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

MinPlatformPkg PlatformInit modules to consume SetCacheLib.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
   | 149 
+
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c 
   | 164 
++--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
 |  11 +--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
  |   7 ++-
 4 files changed, 6 insertions(+), 325 deletions(-)

diff --git 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
index 70e6b9a495..df64d4fc0d 100644
--- 
a/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
+++ 
b/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
@@ -13,8 +13,6 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
-#include 
-#include 
 
 #include 
 #include 
@@ -22,6 +20,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include 
 #include 
 #include 
+#include 
 
 EFI_STATUS
 EFIAPI
@@ -38,152 +37,6 @@ static EFI_PEI_NOTIFY_DESCRIPTOR  mEndOfPeiNotifyList = {
 };
 
 /**
-  Update MTRR setting and set write back as default memory attribute.
-
-  @retval  EFI_SUCCESS  The function completes successfully.
-  @retval  Others   Some error occurs.
-**/
-EFI_STATUS
-EFIAPI
-SetCacheMtrrAfterEndOfPei (
-  VOID
-  )
-{
-  EFI_STATUSStatus;
-  MTRR_SETTINGS MtrrSetting;
-  EFI_PEI_HOB_POINTERS  Hob;
-  UINT64MemoryBase;
-  UINT64MemoryLength;
-  UINT64Power2Length;
-  EFI_BOOT_MODE BootMode;
-  UINTN Index;
-  UINT64SmramSize;
-  UINT64SmramBase;
-  EFI_SMRAM_HOB_DESCRIPTOR_BLOCK*SmramHobDescriptorBlock;
-  Status = PeiServicesGetBootMode ();
-  ASSERT_EFI_ERROR (Status);
-
-  if (BootMode == BOOT_ON_S3_RESUME) {
-return EFI_SUCCESS;
-  }
-  //
-  // Clear the CAR Settings
-  //
-  ZeroMem(, sizeof(MTRR_SETTINGS));
-
-  //
-  // Default Cachable attribute will be set to WB to support large memory 
size/hot plug memory
-  //
-  MtrrSetting.MtrrDefType &= ~((UINT64)(0xFF));
-  MtrrSetting.MtrrDefType |= (UINT64) CacheWriteBack;
-
-  //
-  // Set fixed cache for memory range below 1MB
-  //
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0x0,
- 0xA,
- CacheWriteBack
- );
-  ASSERT_EFI_ERROR (Status);
-
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0xA,
- 0x2,
- CacheUncacheable
- );
-  ASSERT_EFI_ERROR (Status);
-
-  Status = MtrrSetMemoryAttributeInMtrrSettings (
- ,
- 0xC,
- 0x4,
- CacheWriteProtected
- );
-  ASSERT_EFI_ERROR ( Status);
-
-  //
-  // PI SMM IPL can't set SMRAM to WB because at that time CPU ARCH protocol 
is not available.
-  // Set cacheability of SMRAM to WB here to improve SMRAM initialization 
performance.
-  //
-  SmramSize = 0;
-  SmramBase = 0;
-  Status = PeiServicesGetHobList ((VOID **) );
-  while (!END_OF_HOB_LIST (Hob)) {
-if (Hob.Header->HobType == EFI_HOB_TYPE_GUID_EXTENSION) {
-  if (CompareGuid (>Name, )) {
-SmramHobDescriptorBlock = (EFI_SMRAM_HOB_DESCRIPTOR_BLOCK *) (Hob.Guid 
+ 1);
-for (Index = 0; Index < 
SmramHobDescriptorBlock->NumberOfSmmReservedRegions; Index++) {
-  if (SmramHobDescriptorBlock->Descriptor[Index].PhysicalStart > 
0x10) {
-SmramSize += 
SmramHobDescriptorBlock->Descriptor[Index].PhysicalSize;
-if (SmramBase == 0 || SmramBase > 
SmramHobDescriptorBlock->Descriptor[Index].CpuStart) {
-  SmramBase = SmramHobDescriptorBlock->Descriptor[Index].CpuStart;
-}
-  }
-}
-break;
-  }
-}
-Hob.Raw = GET_NEXT_HOB (Hob);
-  }
-
-  //
-  // Set non system memory as UC
-  //
-  MemoryBase   = 0x1;
-
-  //
-  // Add IED size to set whole SMRAM as 

[edk2-devel] [edk2-platforms: PATCH v2 3/6] KabylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Kabylake boards are relying on FSP to configure MTRRs so
they can include SetCacheLibNull.

Test: internal platform can boot with FSP API and Dispatch modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Jeremy Soller 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
   | 640 

 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
   |   3 ++-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
   |   2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 |  67 ---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  
   |   1 +
 5 files changed, 4 insertions(+), 709 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
deleted file mode 100644
index b784026c1b..00
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/** @file
-  Source code file for Platform Init Pre-Memory PEI module
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-EFI_STATUS
-EFIAPI
-MemoryDiscoveredPpiNotifyCallback (
-  IN CONST EFI_PEI_SERVICES  **PeiServices,
-  IN EFI_PEI_NOTIFY_DESCRIPTOR   *NotifyDescriptor,
-  IN VOID*Ppi
-  );
-
-EFI_STATUS
-EFIAPI
-GetPlatformMemorySize (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_PLATFORM_MEMORY_SIZE_PPI   *This,
-  IN OUT  UINT64 *MemorySize
-  );
-
-/**
-
-  This function checks the memory range in PEI.
-
-  @param PeiServices Pointer to PEI Services.
-  @param ThisPei memory test PPI pointer.
-  @param BeginAddressBeginning of the memory address to be checked.
-  @param MemoryLengthBytes of memory range to be checked.
-  @param Operation   Type of memory check operation to be performed.
-  @param ErrorAddressReturn the address of the error memory address.
-
-  @retval EFI_SUCCESS The operation completed successfully.
-  @retval EFI_DEVICE_ERRORMemory test failed. It's not safe to use this 
range of memory.
-
-**/
-EFI_STATUS
-EFIAPI
-BaseMemoryTest (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_BASE_MEMORY_TEST_PPI   *This,
-  IN  EFI_PHYSICAL_ADDRESS   BeginAddress,
-  IN  UINT64 MemoryLength,
-  IN  PEI_MEMORY_TEST_OP Operation,
-  OUT EFI_PHYSICAL_ADDRESS   *ErrorAddress
-  );
-
-static EFI_PEI_NOTIFY_DESCRIPTOR mMemDiscoveredNotifyList = {
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  (EFI_PEIM_NOTIFY_ENTRY_POINT) MemoryDiscoveredPpiNotifyCallback
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode 
= {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  NULL
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mPpiBootMode = {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  NULL
-};
-
-static PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = { BaseMemoryTest };
-
-static PEI_PLATFORM_MEMORY_SIZE_PPI mMemoryMemorySizePpi  = { 
GetPlatformMemorySize };
-
-static EFI_PEI_PPI_DESCRIPTOR 

[edk2-devel] [edk2-platforms: PATCH v2 4/6] WhiskeylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Whiskeylake board relying on FSP to configure MTRRs so
it can include SetCacheLibNull.

Test: internal platform can boot with FSP API modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 8e0ea2d5ce..ba06ba3c89 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -164,6 +164,7 @@
 !if $(TARGET) == DEBUG
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
+  SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLibNull.inf
 
   ###
   # Board Package
-- 
2.13.3.windows.1


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

View/Reply Online (#49688): https://edk2.groups.io/g/devel/message/49688
Mute This Topic: https://groups.io/mt/40049899/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 v2 0/6] Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

The MTRRs may be redundantly or incorrectly configured.
It is recommended to move this functionality to a library
class that with a NULL library by default. The board
package may provide its own library implementation.
MinPlatformPkg should contain the library class header (API)
and the NULL library class instance.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Jeremy Soller 
Cc: Shifei A Lu 
Cc: Xiaohu Zhou 
Cc: Isaac W Oram 
Cc: Wei David Y 
Cc: Agyeman Prince 
Signed-off-by: Chasel Chiu 

Chasel Chiu (6):
  MinPlatformPkg: Add SetCacheLib library class.
  MinPlatformPkg: Add SetCacheLib library class.
  KabylakeOpenBoardPkg: Add SetCacheLib library class.
  WhiskeylakeOpenBoardPkg: Add SetCacheLib library class.
  PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.
  SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.

 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
   | 640 

 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.c
   | 325 
+
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.c
   |  37 
+
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.c
  | 149 
+
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c 
  | 164 
++--
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
   |   3 ++-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
   |   2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 |  67 ---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  
   |   1 +
 Platform/Intel/MinPlatformPkg/Include/Library/SetCacheLib.h
   |  34 
++
 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf  
   |  44 

 Platform/Intel/MinPlatformPkg/Library/SetCacheLib/SetCacheLibNull.inf  
   |  30 
++
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPostMem.inf
|  11 +--
 
Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 |   7 ++-
 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc   
   |   3 ++-
 Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc   
   |   1 +
 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
   |   1 +
 17 files changed, 484 

[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Make Installer use ProductCode from Vendor Customizer

2019-10-30 Thread Nate DeSimone
Signed-off-by: Nate DeSimone 
Cc: Ashley E Desimone 
Cc: Puja Pandya 
---
 edkrepo_installer/EdkRepoInstaller/App.xaml.cs | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/edkrepo_installer/EdkRepoInstaller/App.xaml.cs 
b/edkrepo_installer/EdkRepoInstaller/App.xaml.cs
index 3e56f60..58186c9 100644
--- a/edkrepo_installer/EdkRepoInstaller/App.xaml.cs
+++ b/edkrepo_installer/EdkRepoInstaller/App.xaml.cs
@@ -214,7 +214,15 @@ namespace TianoCore.EdkRepoInstaller
 
 private bool FoundVendorCustomizedEdkRepoAlreadyInstalled(out 
RegistryKey FoundVendorUninstallKey)
 {
-string ProductCode = InstallerStrings.ProductCode;
+string ProductCode = null;
+if (VendorCustomizer.Instance != null)
+{
+ProductCode = VendorCustomizer.Instance.ProductCode;
+}
+else
+{
+ProductCode = InstallerStrings.ProductCode;
+}
 RegistryKey hklm = 
RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64);
 RegistryKey winUninstallRegistryKey = 
hklm.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall", true);
 foreach (string VendorCustomizerProductCode in 
InstallerStrings.KnownVendorProductCodes)
-- 
2.23.0.windows.1


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

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



[edk2-devel] [edk2-staging/EdkRepo] [PATCH] EdkRepo: Python 2.x deprecation warning in pip breaks EdkRepoInstaller

2019-10-30 Thread Nate DeSimone
Newer versions of pip add the following output in addition to
the JSON output when running on Python 2.7:

DEPRECATION: Python 2.7 will reach the end of its life on
January 1st, 2020. Please upgrade your Python as Python 2.7 won't
be maintained after that date. A future version of pip will
drop support for Python 2.7.

This breaks machine parsing of the JSON output from pip.
Adding logic to strip the deprecation warning to fix this issue.

Signed-off-by: Nate DeSimone 
Cc: Ashley E Desimone 
Cc: Puja Pandya 
---
 .../EdkRepoInstaller/PythonOperations.cs  | 37 +--
 1 file changed, 34 insertions(+), 3 deletions(-)

diff --git a/edkrepo_installer/EdkRepoInstaller/PythonOperations.cs 
b/edkrepo_installer/EdkRepoInstaller/PythonOperations.cs
index f96502c..73d5bec 100644
--- a/edkrepo_installer/EdkRepoInstaller/PythonOperations.cs
+++ b/edkrepo_installer/EdkRepoInstaller/PythonOperations.cs
@@ -600,17 +600,48 @@ namespace TianoCore.EdkRepoInstaller
 return PythonPackages;
 }
 
+private static string SanitizePipOutput(string PipOutput)
+{
+StringBuilder Sanitized = new StringBuilder();
+IEnumerable PipLines = PipOutput.SplitLines();
+foreach(string line in PipLines)
+{
+if(line.StartsWith("DEPRECATION:"))
+{
+continue;
+}
+if (string.IsNullOrWhiteSpace(line))
+{
+continue;
+}
+Sanitized.Append(line.Trim());
+Sanitized.Append("\r\n");
+}
+return Sanitized.ToString().Trim();
+}
+
 public static List GetInstalledPythonPackages(string 
PythonPath)
 {
 List PythonPackages = new List();
 SilentProcess.StdoutDataCapture dataCapture = new 
SilentProcess.StdoutDataCapture();
 SilentProcess process = 
SilentProcess.StartConsoleProcessSilently(PythonPath, "-m pip list 
--format=\"json\" --no-index", dataCapture.DataReceivedHandler);
 process.WaitForExit();
+bool TryLegacy = true;
 if (process.ExitCode == 0)
 {
-PythonPackages = ParseJsonPipList(dataCapture.GetData());
+try
+{
+PythonPackages = 
ParseJsonPipList(SanitizePipOutput(dataCapture.GetData()));
+TryLegacy = false;
+}
+catch(Exception e)
+{
+InstallLogger.Log("Error occurred while trying to parse 
pip JSON:");
+InstallLogger.Log(e.ToString());
+InstallLogger.Log("Falling back to legacy mode");
+}
 }
-else
+if(TryLegacy)
 {
 //
 // Older versions of pip don't support the --format flag, 
parse the legacy format
@@ -620,7 +651,7 @@ namespace TianoCore.EdkRepoInstaller
 process.WaitForExit();
 if (process.ExitCode == 0)
 {
-PythonPackages = ParseLegacyPipList(dataCapture.GetData());
+PythonPackages = 
ParseLegacyPipList(SanitizePipOutput(dataCapture.GetData()));
 }
 }
 return PythonPackages;
-- 
2.23.0.windows.1


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

View/Reply Online (#49682): https://edk2.groups.io/g/devel/message/49682
Mute This Topic: https://groups.io/mt/40038547/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] SimicsOpenBoardPkg: Fix gcc build failure

2019-10-30 Thread Agyeman, Prince
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2225

Currently, gcc 5 encounters an error "unused-but-set-variable" in
BdsPlatform.c  as a result of a Status variable not being used
after it's set.

This was fixed by printing the Status variable when
EfiBootManagerDeleteLoadOptionVariable function encounters an error

Cc: Ankit Sinha 
Cc: Nate DeSimone 
Cc: Kubacki Michael A 

Signed-off-by: Prince Agyeman 
---
 .../Library/PlatformBootManagerLib/BdsPlatform.c  | 4 
 1 file changed, 4 insertions(+)

diff --git 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
 
b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
index 7aa3860f75..a4b010be63 100644
--- 
a/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
+++ 
b/Platform/Intel/SimicsOpenBoardPkg/Library/PlatformBootManagerLib/BdsPlatform.c
@@ -348,6 +348,10 @@ PlatformBootManagerBeforeConsole (
   NvBootOptions = EfiBootManagerGetLoadOptions (, 
LoadOptionTypeBoot);
   for (Index = 0; Index < NvBootOptionCount; Index++) {
 Status = EfiBootManagerDeleteLoadOptionVariable 
(NvBootOptions[Index].OptionNumber, LoadOptionTypeBoot);
+if(EFI_ERROR (Status)){
+  DEBUG ((DEBUG_ERROR,
+  "%a: removing Boot#%04x %r\n", __FUNCTION__, 
(UINT32)NvBootOptions[Index].OptionNumber, Status));
+}
   }
 
   InstallDevicePathCallback ();
-- 
2.19.1.windows.1


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

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



Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Andrew Fish via Groups.Io
Mike,

On the Unix side the strategy was to launch via the debugger [1], and also pass 
EFI specific debugger scripts into the debuggers on launch. 

I've played with trick with OS apps by using CpuDeadLoop(). To get unstuck you 
just need to update Index to be non Zero.  I've also used this technique for 
JTAG debuggers. For an EFI App I generally use CpuBreakpoint(). The advantage 
to using getchar() is the "otherwise press enter to continue..." path. So I 
agree the command line option seems like a reasonable thing to do.

The other trick I played in this area was to have both a `run` and `lldb` 
option to the script. The `run` option launches the debugger, the 'lldb' (or 
gdb) option drops you into a debugger prompt so you can set breakpoints early 
in boot. 

Long term maybe we could have a common Python based build commands for both 
Windows and Unix and at that point we could move to launching via the debugger 
for all paths? 

[1] https://github.com/tianocore/edk2/blob/master/EmulatorPkg/build.sh#L221

Thanks,

Andrew Fish


> On Oct 30, 2019, at 9:16 AM, Michael D Kinney  
> wrote:
> 
> Liming,
>
> This may be something that is better with a command line option when 
> WinHost.exe is started instead of a PCD.
>
> I also think there is a way to run VS first and start a process from VS and 
> do an initial BP.  Does that work with latest Windows 10?
>
> Mike
>
> From: Gao, Liming mailto:liming@intel.com>> 
> Sent: Wednesday, October 30, 2019 8:03 AM
> To: devel@edk2.groups.io ; 
> kilian_ke...@outlook.com 
> Cc: Richardson, Brian  >; Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>; Ni, Ray 
> mailto:ray...@intel.com>>
> Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()
>
> Kilian:
>  I think this idea is good. It can be enabled when the developer wants to do 
> the source level debug. So, one PCD may be introduced to control the logic. 
> By default, there is no change. When PCD is enabled, WinHost will wait for 
> the developer input. 
>
> Can you submit BZ for this request, and prepare the patch for the change?
>
> Thanks
> Liming
>  <>From: devel@edk2.groups.io  
> mailto:devel@edk2.groups.io>> On Behalf Of Kilian Kegel
> Sent: Wednesday, October 30, 2019 5:17 PM
> To: Gao, Liming mailto:liming@intel.com>>; 
> devel@edk2.groups.io 
> Cc: Richardson, Brian  >; Kinney, Michael D 
> mailto:michael.d.kin...@intel.com>>
> Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()
>
> Hi Liming,
>
> CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
> generates INT 3 DebugTrap.
>
> Yes, that procedure has worked in the past and I have used it in the same way 
> as you do.
>
> But with newer Windows versions, Windows just terminates the “exceptional” 
> process that emits
> INT 3 or any other violation trap and does not offer to debug the process – 
> surly for security reasons…
>
> For debugging purpose on newer Windows 10 versions I always insert the code 
> snippet  below.
>
> It gives the developer the chance to connect VS to the process to be 
> debugged, while waiting on keyboard input.
> (ALT-CTRL-P attach to process)
>
> After that, with the debuggee is connected to VS _before_ the debug trap 
> appears. VS is now
> available for debugging the process with full source code.
>
> The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and 
> debug UEFI internals for me.
>
> EmulatorPkg should also usable and helpful for other devolpers.
> Can you please insert the code snippet into main() from WinHost.c?
>
> Thanks,
> Kilian
>
>
> From: Gao, Liming 
> Sent: Wednesday, October 30, 2019 06:33 AM
> To: devel@edk2.groups.io ; 
> kilian_ke...@outlook.com 
> Cc: Richardson, Brian ; Kinney, Michael D 
> 
> Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()
>
> Kilian:
>I normally modify the source code and insert CpuBreakpoint() function. 
> That will trig VS debugger for the source code.
>
> Thanks
> Liming
> From: devel@edk2.groups.io  
> [mailto:devel@edk2.groups.io ] On Behalf Of 
> Kilian Kegel
> Sent: Monday, October 28, 2019 9:01 PM
> To: Gao, Liming mailto:liming@intel.com>>
> Cc: devel@edk2.groups.io ; Richardson, Brian 
> mailto:brian.richard...@intel.com>>; Kinney, 
> Michael D mailto:michael.d.kin...@intel.com>>
> Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()
>
> Hi Liming,
>
> If have observed in newer Windows 10 versions, when using __debugbreak()in any
> application that Windows just terminates the app, instead offering to debug 
> it.
> 

Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Michael D Kinney
Liming,

This may be something that is better with a command line option when 
WinHost.exe is started instead of a PCD.

I also think there is a way to run VS first and start a process from VS and do 
an initial BP.  Does that work with latest Windows 10?

Mike

From: Gao, Liming 
Sent: Wednesday, October 30, 2019 8:03 AM
To: devel@edk2.groups.io; kilian_ke...@outlook.com
Cc: Richardson, Brian ; Kinney, Michael D 
; Ni, Ray 
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Kilian:
 I think this idea is good. It can be enabled when the developer wants to do 
the source level debug. So, one PCD may be introduced to control the logic. By 
default, there is no change. When PCD is enabled, WinHost will wait for the 
developer input.

Can you submit BZ for this request, and prepare the patch for the change?

Thanks
Liming
From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Kilian Kegel
Sent: Wednesday, October 30, 2019 5:17 PM
To: Gao, Liming mailto:liming@intel.com>>; 
devel@edk2.groups.io
Cc: Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,

CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
generates INT 3 DebugTrap.

Yes, that procedure has worked in the past and I have used it in the same way 
as you do.

But with newer Windows versions, Windows just terminates the "exceptional" 
process that emits
INT 3 or any other violation trap and does not offer to debug the process - 
surly for security reasons...

For debugging purpose on newer Windows 10 versions I always insert the code 
snippet  below.

It gives the developer the chance to connect VS to the process to be debugged, 
while waiting on keyboard input.
(ALT-CTRL-P attach to process)

After that, with the debuggee is connected to VS _before_ the debug trap 
appears. VS is now
available for debugging the process with full source code.

The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and debug 
UEFI internals for me.

EmulatorPkg should also usable and helpful for other devolpers.
Can you please insert the code snippet into main() from WinHost.c?

Thanks,
Kilian


From: Gao, Liming
Sent: Wednesday, October 30, 2019 06:33 AM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com
Cc: Richardson, Brian; Kinney, Michael 
D
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Kilian:
   I normally modify the source code and insert CpuBreakpoint() function. That 
will trig VS debugger for the source code.

Thanks
Liming
From: devel@edk2.groups.io 
[mailto:devel@edk2.groups.io] On Behalf Of Kilian Kegel
Sent: Monday, October 28, 2019 9:01 PM
To: Gao, Liming mailto:liming@intel.com>>
Cc: devel@edk2.groups.io; Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,

If have observed in newer Windows 10 versions, when using __debugbreak()in any
application that Windows just terminates the app, instead offering to debug it.
So in WinHost.exe too.

That's why I usually insert the code snippet below to run into getchar()
when the program was started with the /debug command line switch.
As long as the App waits for the next keystroke, I can start the debugger 
(VS2019)
and connect to WinHost.exe process for debugging.

Do you have a better solution without modifying the source code?

Thanks,
Kilian
if(1){
int i;

SecPrint 
("##\n");
SecPrint ("add \"/debug\" command line switch, to connect to the 
debugger at the very beginning of POST emulation\n");
SecPrint 
("##\n");

if(Argc > 1){
for(i = 1 ; i < Argc ; i++){
if(0 == strcmp("/debug", Argv[i])){
//SecPrint("IF YOU WANT TO DEBUG from the very 
beginning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe 
to the debugger\n\t3. and press ENTER in this command box\nOR\n");
SecPrint("\t1. start Visual Studio\n");
SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL + ALT + 
P) --> WinHost.exe\n");
SecPrint("\t3. Break All  (CTRL + ALT + Break) --> 
WinHost.exe\n");
SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 
445\n");
SecPrint("\t5. and press ENTER in 

Re: [edk2-devel] [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain

2019-10-30 Thread Liming Gao
Andrew:

  I prefer to keep short CLANG9 as the tool chain name. I add wiki page 
https://github.com/tianocore/tianocore.github.io/wiki/CLANG9-Tools-Chain to 
introduce it. And, we have CLANG38 tool chain. It generates ELF image and DWARF 
debug symbol format. It can work with LLVM 9.0 release. Current tool chain tag 
name includes compiler name and version. There is no specific info in the tool 
chain name. The developer can get the more tool chain information from wiki 
page.



  CLANG9 is designed to support Emulator for Windows host only. CLANG38 may be 
used for Emulator in Linux or Mac. I don’t try it before.

  CLANG9 goal is to align the same compiler in the different host development 
environment. It can replace VS or GCC compiler. On Windows Host, I verify VS 
debugger for the source level debug. On Linux host, I have not verified llvm 
debugger. I will investigate the debugger solution for OVMF in Linux host.

Thanks
Liming
From: af...@apple.com 
Sent: Saturday, October 26, 2019 2:45 AM
To: devel@edk2.groups.io; Gao, Liming 
Cc: Ni, Ray ; Justen, Jordan L 
Subject: Re: [edk2-devel] [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain

Liming,

Sorry I missed this mail. Thanks for the info! I was doing some research into 
this too and now I think I finally understand. I think the name for the tool 
chain really confused me and we should think about changing the name.

From what I understand CLANG9 means produce PE/COFF directly and used the PDB 
debugging format. I see from the llvm site that the linker can produce PDB 
directly as you mention. This all makes sense to me now as LLVM tries to make 
it easy to be a drop in replacement for VC++ or GCC. So this tool chain is 
designed to be able to cross build a "Windows App" on a Linux or macOS. It also 
looks like the llvm debugger, lldb, is lagging in its support for PDB based 
debugging.


Anyway I think Leif and I agree the toolchain name is very confusing. I'd 
rather see it called CLANG9_WIN or CLANG_PDB.


On Oct 18, 2019, at 7:27 AM, Liming Gao 
mailto:liming@intel.com>> wrote:

Andrew:
 Here is the cover letter on CLANG9 introduction. 
https://edk2.groups.io/g/devel/message/49157

1)  Yes. CLANG9 tool chain is added to directly generate PE/COFF image (EFI 
image).
This tool chain uses LLVM clang C compiler and lld linker, generates PE/COFF
image and PDB compatible debug symbol format. Now, it supports IA32/X64 Archs.
LLVM clang C compiler and lld linker are the standalone tool set. They don’t 
depend other lib to generate PE/COFF image.

2)  Yes. CLANG9 is the cross OS tool chain. It can work on 
Windows/Linux/Mac host OS.
LLVM LLD linker uses Windows style arguments. I verify CLANG9 for Ovmf3264 in 
Windows/Linux host OS.


On Linux can you source level debug Ovmf?


3) This patch enables WinHost in Windows. It doesn’t enable UnixHost. Now, 
EmulatorPkg with CLANG9 only works on Windows Host.
This patch can make other modules pass build in Windows/Linux/Mac only if LLVM9 
tool set is installed.
But, the generated image may not work on Linux/Mac. I agree below linker flags 
are specific to windows host.
So, I suggest to add the conditional statement of $(WIN_HOST_BUILD) == TRUE for 
them.


For the EmulatorPkg the Host is a native App for that OS you build on, but it 
seems like CLANG9 is targeted to build Windows Apps. I'm not sure  but you 
might be able to override all the linker commands to build a native app, or 
just use the system linker for the Host?

I'm not sure how well debugging will work mixing PDB and DWARF symbol formats?

Thanks,

Andrew Fish



!if $(WIN_HOST_BUILD) == TRUE
  GCC:*_CLANG9_*_DLINK_FLAGS = /ALIGN:4096 /FILEALIGN:4096 
/SUBSYSTEM:CONSOLE
  GCC:DEBUG_CLANG9_*_DLINK_FLAGS = 
/EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x1
  GCC:NOOPT_CLANG9_*_DLINK_FLAGS = 
/EXPORT:InitializeDriver=$(IMAGE_ENTRY_POINT) /BASE:0x1
!endif

Thanks
Liming
From: af...@apple.com 
mailto:af...@apple.com>>
Sent: Friday, October 18, 2019 1:15 AM
To: Ni, Ray mailto:ray...@intel.com>>
Cc: Gao, Liming mailto:liming@intel.com>>; 
devel@edk2.groups.io; Justen, Jordan L 
mailto:jordan.l.jus...@intel.com>>
Subject: Re: [Patch v3 10/11] EmulatorPkg: Enable CLANG9 tool chain

Ray,

Sorry I'm coming a little late to this and I'm confused. I have some questions?
1) Does CLANG9 imply CLANGPE?
2) Does CLANGPE work on Linux and macOS? Can you pass the Windows style 
arguments to CLANGPE linker on Linux and macOS?
3) For the EmulatorPkg don't you have the extra requirement that compiler needs 
a standard C lib (or platform specific libs) to function?
   a) GCC:*_CLANG9_*_DLINK_FLAGS in EmulatorPkg.dsc seems to imply the 
Linux and macOS systems will have a Windows SKD dir and a lot of Windows DLLs? 
Does all that come when you install CLANG9 when you install it on Linux or 
macOS?



So I guess I'm asking is the linker really the same for CLANG9 on all 

Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Liming Gao
OK. I see now. This way is better.

Thanks
Liming
From: Minnow Ware 
Sent: Wednesday, October 30, 2019 11:22 PM
To: devel@edk2.groups.io; Gao, Liming ; 
kilian_ke...@outlook.com
Cc: Richardson, Brian ; Kinney, Michael D 
; Ni, Ray 
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,


  1.  when you invoke WINHOST.EXE /debug, it waits for developer input
  2.  otherwise default behavior

A PCD is needless.

Regards,
Kilian


From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> on behalf of Liming Gao 
mailto:liming@intel.com>>
Sent: Wednesday, October 30, 2019 4:03:13 PM
To: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>>; 
kilian_ke...@outlook.com 
mailto:kilian_ke...@outlook.com>>
Cc: Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>; Ni, 
Ray mailto:ray...@intel.com>>
Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()


Kilian:

 I think this idea is good. It can be enabled when the developer wants to do 
the source level debug. So, one PCD may be introduced to control the logic. By 
default, there is no change. When PCD is enabled, WinHost will wait for the 
developer input.



Can you submit BZ for this request, and prepare the patch for the change?



Thanks

Liming

From: devel@edk2.groups.io 
mailto:devel@edk2.groups.io>> On Behalf Of Kilian Kegel
Sent: Wednesday, October 30, 2019 5:17 PM
To: Gao, Liming mailto:liming@intel.com>>; 
devel@edk2.groups.io
Cc: Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Hi Liming,



CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
generates INT 3 DebugTrap.



Yes, that procedure has worked in the past and I have used it in the same way 
as you do.



But with newer Windows versions, Windows just terminates the "exceptional" 
process that emits

INT 3 or any other violation trap and does not offer to debug the process - 
surly for security reasons...



For debugging purpose on newer Windows 10 versions I always insert the code 
snippet  below.



It gives the developer the chance to connect VS to the process to be debugged, 
while waiting on keyboard input.

(ALT-CTRL-P attach to process)



After that, with the debuggee is connected to VS _before_ the debug trap 
appears. VS is now

available for debugging the process with full source code.



The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and debug 
UEFI internals for me.



EmulatorPkg should also usable and helpful for other devolpers.

Can you please insert the code snippet into main() from WinHost.c?



Thanks,

Kilian





From: Gao, Liming
Sent: Wednesday, October 30, 2019 06:33 AM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com
Cc: Richardson, Brian; Kinney, Michael 
D
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Kilian:

   I normally modify the source code and insert CpuBreakpoint() function. That 
will trig VS debugger for the source code.



Thanks

Liming

From: devel@edk2.groups.io 
[mailto:devel@edk2.groups.io] On Behalf Of Kilian Kegel
Sent: Monday, October 28, 2019 9:01 PM
To: Gao, Liming mailto:liming@intel.com>>
Cc: devel@edk2.groups.io; Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Hi Liming,



If have observed in newer Windows 10 versions, when using __debugbreak()in any

application that Windows just terminates the app, instead offering to debug it.

So in WinHost.exe too.



That's why I usually insert the code snippet below to run into getchar()

when the program was started with the /debug command line switch.

As long as the App waits for the next keystroke, I can start the debugger 
(VS2019)

and connect to WinHost.exe process for debugging.



Do you have a better solution without modifying the source code?



Thanks,

Kilian

if(1){

int i;



SecPrint 
("##\n");

SecPrint ("add \"/debug\" command line switch, to connect to the 
debugger at the very beginning of POST emulation\n");

SecPrint 
("##\n");



if(Argc > 1){

for(i = 1 ; i < Argc ; i++){

if(0 == 

Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Minnow Ware
Hi Liming,


  1.  when you invoke WINHOST.EXE /debug, it waits for developer input
  2.  otherwise default behavior

A PCD is needless.

Regards,
Kilian


From: devel@edk2.groups.io  on behalf of Liming Gao 

Sent: Wednesday, October 30, 2019 4:03:13 PM
To: devel@edk2.groups.io ; kilian_ke...@outlook.com 

Cc: Richardson, Brian ; Kinney, Michael D 
; Ni, Ray 
Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()


Kilian:

 I think this idea is good. It can be enabled when the developer wants to do 
the source level debug. So, one PCD may be introduced to control the logic. By 
default, there is no change. When PCD is enabled, WinHost will wait for the 
developer input.



Can you submit BZ for this request, and prepare the patch for the change?



Thanks

Liming

From: devel@edk2.groups.io  On Behalf Of Kilian Kegel
Sent: Wednesday, October 30, 2019 5:17 PM
To: Gao, Liming ; devel@edk2.groups.io
Cc: Richardson, Brian ; Kinney, Michael D 

Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Hi Liming,



CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
generates INT 3 DebugTrap.



Yes, that procedure has worked in the past and I have used it in the same way 
as you do.



But with newer Windows versions, Windows just terminates the “exceptional” 
process that emits

INT 3 or any other violation trap and does not offer to debug the process – 
surly for security reasons…



For debugging purpose on newer Windows 10 versions I always insert the code 
snippet  below.



It gives the developer the chance to connect VS to the process to be debugged, 
while waiting on keyboard input.

(ALT-CTRL-P attach to process)



After that, with the debuggee is connected to VS _before_ the debug trap 
appears. VS is now

available for debugging the process with full source code.



The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and debug 
UEFI internals for me.



EmulatorPkg should also usable and helpful for other devolpers.

Can you please insert the code snippet into main() from WinHost.c?



Thanks,

Kilian





From: Gao, Liming
Sent: Wednesday, October 30, 2019 06:33 AM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com
Cc: Richardson, Brian; Kinney, Michael 
D
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Kilian:

   I normally modify the source code and insert CpuBreakpoint() function. That 
will trig VS debugger for the source code.



Thanks

Liming

From: devel@edk2.groups.io 
[mailto:devel@edk2.groups.io] On Behalf Of Kilian Kegel
Sent: Monday, October 28, 2019 9:01 PM
To: Gao, Liming mailto:liming@intel.com>>
Cc: devel@edk2.groups.io; Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()



Hi Liming,



If have observed in newer Windows 10 versions, when using __debugbreak()in any

application that Windows just terminates the app, instead offering to debug it.

So in WinHost.exe too.



That’s why I usually insert the code snippet below to run into getchar()

when the program was started with the /debug command line switch.

As long as the App waits for the next keystroke, I can start the debugger 
(VS2019)

and connect to WinHost.exe process for debugging.



Do you have a better solution without modifying the source code?



Thanks,

Kilian

if(1){

int i;



SecPrint 
("##\n");

SecPrint ("add \"/debug\" command line switch, to connect to the 
debugger at the very beginning of POST emulation\n");

SecPrint 
("##\n");



if(Argc > 1){

for(i = 1 ; i < Argc ; i++){

if(0 == strcmp("/debug", Argv[i])){

//SecPrint("IF YOU WANT TO DEBUG from the very 
beginning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe 
to the debugger\n\t3. and press ENTER in this command box\nOR\n");

SecPrint("\t1. start Visual Studio\n");

SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL + ALT + 
P) --> WinHost.exe\n");

SecPrint("\t3. Break All  (CTRL + ALT + Break) --> 
WinHost.exe\n");

SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 
445\n");

SecPrint("\t5. and press ENTER in this command box\n");

SecPrint("\t6. go back to Visual Studio an RUN/SINGLE 
STEP the application\n");

 

Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Add AML OpCode definition for ExternalOp

2019-10-30 Thread Sami Mujawar
Reviewed-by: Sami Mujawar 

Regards,

Sami Mujawar

-Original Message-
From: devel@edk2.groups.io  On Behalf Of PierreGondois 
via Groups.Io
Sent: 30 October 2019 02:17 PM
To: devel@edk2.groups.io
Cc: Pierre Gondois ; 
michael.d.kin...@intel.comliming.gao@intel.comsami.muja...@arm.com; nd 

Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Add AML OpCode definition for 
ExternalOp

From: Pierre Gondois 

The ACPI specification, version 6.3, January 2019, defines the Named Object 
Encoding for ExternalOp in section '20.2.5.2 Named Objects Encoding'.

This patch adds the definition for ExternalOp to the list of Primary Opcode 
definitions.

Signed-off-by: Pierre Gondois 
---

The changes can be seen at 
https://github.com/PierreARM/edk2/commits/677_Add_ExternalOp_definition_v1

Notes:
v1:
- Add the ExternalOp AML OpCode [Pierre]

 MdePkg/Include/IndustryStandard/AcpiAml.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdePkg/Include/IndustryStandard/AcpiAml.h 
b/MdePkg/Include/IndustryStandard/AcpiAml.h
index 
6919622af212c58dd92fc4d2bbd3b9447961d20a..3dd5408b359f9192e2fa9cedd0260a0f6bb5603a
 100644
--- a/MdePkg/Include/IndustryStandard/AcpiAml.h
+++ b/MdePkg/Include/IndustryStandard/AcpiAml.h
@@ -2,6 +2,7 @@
   This file contains AML code definition in the latest ACPI spec.
 
   Copyright (c) 2011, Intel Corporation. All rights reserved.
+  Copyright (c) 2019, ARM Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -30,6 +31,7 @@
 #define AML_PACKAGE_OP   0x12
 #define AML_VAR_PACKAGE_OP   0x13
 #define AML_METHOD_OP0x14
+#define AML_EXTERNAL_OP  0x15
 #define AML_DUAL_NAME_PREFIX 0x2e
 #define AML_MULTI_NAME_PREFIX0x2f
 #define AML_NAME_CHAR_A  0x41
--
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'






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

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



Re: [edk2-devel] [PATCH v1 1/1] MdePkg: Add AML OpCode definition for ExternalOp

2019-10-30 Thread Liming Gao
Reviewed-by: Liming Gao 

> -Original Message-
> From: devel@edk2.groups.io  On Behalf Of PierreGondois
> Sent: Wednesday, October 30, 2019 10:17 PM
> To: devel@edk2.groups.io
> Cc: Pierre Gondois ; 
> michael.d.kin...@intel.comliming.gao@intel.comsami.muja...@arm.com;
> n...@arm.com
> Subject: [edk2-devel] [PATCH v1 1/1] MdePkg: Add AML OpCode definition for 
> ExternalOp
> 
> From: Pierre Gondois 
> 
> The ACPI specification, version 6.3, January 2019,
> defines the Named Object Encoding for ExternalOp
> in section '20.2.5.2 Named Objects Encoding'.
> 
> This patch adds the definition for ExternalOp to
> the list of Primary Opcode definitions.
> 
> Signed-off-by: Pierre Gondois 
> ---
> 
> The changes can be seen at 
> https://github.com/PierreARM/edk2/commits/677_Add_ExternalOp_definition_v1
> 
> Notes:
> v1:
> - Add the ExternalOp AML OpCode [Pierre]
> 
>  MdePkg/Include/IndustryStandard/AcpiAml.h | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdePkg/Include/IndustryStandard/AcpiAml.h 
> b/MdePkg/Include/IndustryStandard/AcpiAml.h
> index 
> 6919622af212c58dd92fc4d2bbd3b9447961d20a..3dd5408b359f9192e2fa9cedd0260a0f6bb5603a
>  100644
> --- a/MdePkg/Include/IndustryStandard/AcpiAml.h
> +++ b/MdePkg/Include/IndustryStandard/AcpiAml.h
> @@ -2,6 +2,7 @@
>This file contains AML code definition in the latest ACPI spec.
> 
>Copyright (c) 2011, Intel Corporation. All rights reserved.
> +  Copyright (c) 2019, ARM Limited. All rights reserved.
>SPDX-License-Identifier: BSD-2-Clause-Patent
> 
>  **/
> @@ -30,6 +31,7 @@
>  #define AML_PACKAGE_OP   0x12
>  #define AML_VAR_PACKAGE_OP   0x13
>  #define AML_METHOD_OP0x14
> +#define AML_EXTERNAL_OP  0x15
>  #define AML_DUAL_NAME_PREFIX 0x2e
>  #define AML_MULTI_NAME_PREFIX0x2f
>  #define AML_NAME_CHAR_A  0x41
> --
> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
> 
> 
> 
> 


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

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



Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Liming Gao
Kilian:
 I think this idea is good. It can be enabled when the developer wants to do 
the source level debug. So, one PCD may be introduced to control the logic. By 
default, there is no change. When PCD is enabled, WinHost will wait for the 
developer input.

Can you submit BZ for this request, and prepare the patch for the change?

Thanks
Liming
From: devel@edk2.groups.io  On Behalf Of Kilian Kegel
Sent: Wednesday, October 30, 2019 5:17 PM
To: Gao, Liming ; devel@edk2.groups.io
Cc: Richardson, Brian ; Kinney, Michael D 

Subject: Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,

CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
generates INT 3 DebugTrap.

Yes, that procedure has worked in the past and I have used it in the same way 
as you do.

But with newer Windows versions, Windows just terminates the "exceptional" 
process that emits
INT 3 or any other violation trap and does not offer to debug the process - 
surly for security reasons...

For debugging purpose on newer Windows 10 versions I always insert the code 
snippet  below.

It gives the developer the chance to connect VS to the process to be debugged, 
while waiting on keyboard input.
(ALT-CTRL-P attach to process)

After that, with the debuggee is connected to VS _before_ the debug trap 
appears. VS is now
available for debugging the process with full source code.

The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and debug 
UEFI internals for me.

EmulatorPkg should also usable and helpful for other devolpers.
Can you please insert the code snippet into main() from WinHost.c?

Thanks,
Kilian


From: Gao, Liming
Sent: Wednesday, October 30, 2019 06:33 AM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com
Cc: Richardson, Brian; Kinney, Michael 
D
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Kilian:
   I normally modify the source code and insert CpuBreakpoint() function. That 
will trig VS debugger for the source code.

Thanks
Liming
From: devel@edk2.groups.io 
[mailto:devel@edk2.groups.io] On Behalf Of Kilian Kegel
Sent: Monday, October 28, 2019 9:01 PM
To: Gao, Liming mailto:liming@intel.com>>
Cc: devel@edk2.groups.io; Richardson, Brian 
mailto:brian.richard...@intel.com>>; Kinney, 
Michael D mailto:michael.d.kin...@intel.com>>
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,

If have observed in newer Windows 10 versions, when using __debugbreak()in any
application that Windows just terminates the app, instead offering to debug it.
So in WinHost.exe too.

That's why I usually insert the code snippet below to run into getchar()
when the program was started with the /debug command line switch.
As long as the App waits for the next keystroke, I can start the debugger 
(VS2019)
and connect to WinHost.exe process for debugging.

Do you have a better solution without modifying the source code?

Thanks,
Kilian
if(1){
int i;

SecPrint 
("##\n");
SecPrint ("add \"/debug\" command line switch, to connect to the 
debugger at the very beginning of POST emulation\n");
SecPrint 
("##\n");

if(Argc > 1){
for(i = 1 ; i < Argc ; i++){
if(0 == strcmp("/debug", Argv[i])){
//SecPrint("IF YOU WANT TO DEBUG from the very 
beginning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe 
to the debugger\n\t3. and press ENTER in this command box\nOR\n");
SecPrint("\t1. start Visual Studio\n");
SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL + ALT + 
P) --> WinHost.exe\n");
SecPrint("\t3. Break All  (CTRL + ALT + Break) --> 
WinHost.exe\n");
SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 
445\n");
SecPrint("\t5. and press ENTER in this command box\n");
SecPrint("\t6. go back to Visual Studio an RUN/SINGLE 
STEP the application\n");
SecPrint("\t7. otherwise press enter to continue...\n");
getchar();
//
// 1. SET A SOFTWARE BREAKPOINT TO THE NEXT LINE of 
code below -->> SecPrint("");
// 2. switch to the command box and press ENTER
// 3. start single stepping the entire boot/emulation 
process, good luck...
//
SecPrint("");//now you can single step the entire 
boot/emulation process, good 

Re: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

2019-10-30 Thread Liming Gao
NOOPT is build target. It includes the compiler option to disable optimization. 
If the platform supports NOOPT target, it can be built with -b NOOPT.

PcdOptimizeCompilerEnable is one feature PCD defined in edk2-platforms. It can 
be used to control the compiler option in [BuildOptions] section. It can also 
be used for DEBUG or RELEASE target.

Thanks
Liming
From: devel@edk2.groups.io  On Behalf Of Tiger Liu(BJ-RD)
Sent: Tuesday, October 29, 2019 7:01 PM
To: devel@edk2.groups.io
Subject: [edk2-devel] [edk2] NOOPT and PcdOptimizeCompilerEnable

Hi, All:
I have a question about NOOPT and PcdOptimizeCompilerEnable.

If Target = NOOPT, then will disable all optimizations.
And PcdOptimizeCompilerEnable has the same function.

So, What’s the relationship between PcdOptimizeCompilerEnable and NOOPT?

Thanks

Best wishes,

保密声明:
本邮件含有保密或专有信息,仅供指定收件人使用。严禁对本邮件或其内容做任何未经授权的查阅、使用、复制或转发。
CONFIDENTIAL NOTE:
This email contains confidential or legally privileged information and is for 
the sole use of its intended recipient. Any unauthorized review, use, copying 
or forwarding of this email or the content of this email is strictly prohibited.


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

View/Reply Online (#49672): https://edk2.groups.io/g/devel/message/49672
Mute This Topic: https://groups.io/mt/39414231/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/4] MdeModulePkg/EbcDebugger: Add check for Entry and RetEntry

2019-10-30 Thread Zhang, Shenglei
Entry and RetEntry might be NULL before used.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Hao A Wu 
---
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c | 2 +-
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c| 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c 
b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
index 8e305e4243a5..7b453fa98c2b 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
@@ -143,7 +143,7 @@ DebuggerDisplaySymbolAccrodingToAddress (
   // Find the nearest symbol address
   //
   CandidateAddress = EbdFindSymbolAddress (Address, 
EdbMatchSymbolTypeNearestAddress, , );
-  if (CandidateAddress == 0 || CandidateAddress == (UINTN) -1) {
+  if (CandidateAddress == 0 || CandidateAddress == (UINTN) -1 || Entry == 
NULL) {
 EDBPrint (L"Symbole at Address not found!\n");
 return EFI_DEBUG_CONTINUE;
   } else if (Address != CandidateAddress) {
diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c 
b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
index 85cc275c114b..90a9b9fbd7ee 100644
--- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
+++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
@@ -2062,7 +2062,7 @@ EdbPrintSource (
 ,
 
 );
-  if (SymbolAddress == 0) {
+  if (SymbolAddress == 0 || RetEntry == NULL) {
 return 0 ;
   }
 
-- 
2.18.0.windows.1


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

View/Reply Online (#49668): https://edk2.groups.io/g/devel/message/49668
Mute This Topic: https://groups.io/mt/39808301/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] MdeModulePkg: Add check for variables and return value

2019-10-30 Thread Zhang, Shenglei
The variables and return value might be NULL.
So add check for them before they are used.

Cc: Jian J Wang 
Cc: Hao A Wu 
Cc: Dandan Bi 
Cc: Eric Dong 
Cc: Hao A Wu 
Cc: Liming Gao 
Shenglei Zhang (4):

v2: Update the checking method in 02/04.

  MdeModulePkg/EbcDebugger: Add check for Entry and RetEntry
  MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr
  MdeModulePkg/EsrtDxe: Add check for EsrtRepository
  MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue()

 .../Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c|  2 +-
 MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c  |  2 +-
 MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c  | 10 ++
 MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c  |  1 +
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c|  5 +
 5 files changed, 18 insertions(+), 2 deletions(-)

-- 
2.18.0.windows.1


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

View/Reply Online (#49667): https://edk2.groups.io/g/devel/message/49667
Mute This Topic: https://groups.io/mt/39808291/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/SetupBrowserDxe: Add check for GetBufferForValue()

2019-10-30 Thread Zhang, Shenglei
The returned value from GetBufferForValue might be NULL, so add a
check for that before it is used.

Cc: Jian J Wang 
Cc: Hao A Wu 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c 
b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
index 7f4929c2fcd9..984c68c6bb7a 100644
--- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
+++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
@@ -1281,7 +1281,12 @@ IfrToUint (
   Result->Type = EFI_IFR_TYPE_UNDEFINED;
   return EFI_SUCCESS;
 }
+
+if (GetBufferForValue () == NULL) {
+  return EFI_NOT_FOUND;
+} 
 Result->Value.u64 = *(UINT64*) GetBufferForValue ();
+
 if (Value.Type == EFI_IFR_TYPE_BUFFER) {
   FreePool (Value.Buffer);
 }
-- 
2.18.0.windows.1


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

View/Reply Online (#49671): https://edk2.groups.io/g/devel/message/49671
Mute This Topic: https://groups.io/mt/39808369/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/4] MdeModulePkg/HiiDatabaseDxe: Add check for StringPtr

2019-10-30 Thread Zhang, Shenglei
If the target string doesn't appear in the searched string,
StringPtr will be NULL. So add a check for that.

Cc: Dandan Bi 
Cc: Eric Dong 
Signed-off-by: Shenglei Zhang 
---
v2: Instead of returning a value, we add ASSERT to ensure
StringPtr is not NULL.

 MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
index 71ea25bc19bf..19a23fcc951e 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/ConfigRouting.c
@@ -909,6 +909,7 @@ CompareAndMergeDefaultString (
   // To find the  with AltConfigHdr in AltCfgResp, ignore other 
 which follow it.
   //
   StringPtr = StrStr (*AltCfgResp, AltConfigHdr);
+  ASSERT (StringPtr != NULL); 
   StringPtrNext = StrStr (StringPtr + 1, L"");
   if (StringPtrNext != NULL) {
 TempCharA = *StringPtrNext;
-- 
2.18.0.windows.1


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

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



[edk2-devel] [PATCH v2 3/4] MdeModulePkg/EsrtDxe: Add check for EsrtRepository

2019-10-30 Thread Zhang, Shenglei
EsrtRepository might be NULL. So return EFI_OUT_OF_RESOURCES
when it is NULL.

Cc: Hao A Wu 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
Reviewed-by: Hao A Wu 
---
 MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c | 10 ++
 1 file changed, 10 insertions(+)

diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c 
b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
index f48125382dbc..fff17b98fa3d 100644
--- a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
+++ b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
@@ -239,6 +239,11 @@ DeleteEsrtEntry(
 goto EXIT;
   }
 
+  if (EsrtRepository == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+goto EXIT;
+  }
+
   if ((RepositorySize % sizeof(EFI_SYSTEM_RESOURCE_ENTRY)) != 0) {
 DEBUG((EFI_D_ERROR, "Repository Corrupt. Need to rebuild Repository.\n"));
 //
@@ -332,6 +337,11 @@ UpdateEsrtEntry(
  
  );
 
+  if (EsrtRepository == NULL) {
+Status = EFI_OUT_OF_RESOURCES;
+goto EXIT;
+  }
+
   if (!EFI_ERROR(Status)) {
 //
 // if exist, update Esrt cache repository
-- 
2.18.0.windows.1


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

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



[edk2-devel] [PATCH v1 1/1] MdePkg: Add AML OpCode definition for ExternalOp

2019-10-30 Thread PierreGondois
From: Pierre Gondois 

The ACPI specification, version 6.3, January 2019,
defines the Named Object Encoding for ExternalOp
in section '20.2.5.2 Named Objects Encoding'.

This patch adds the definition for ExternalOp to
the list of Primary Opcode definitions.

Signed-off-by: Pierre Gondois 
---

The changes can be seen at 
https://github.com/PierreARM/edk2/commits/677_Add_ExternalOp_definition_v1

Notes:
v1:
- Add the ExternalOp AML OpCode [Pierre]

 MdePkg/Include/IndustryStandard/AcpiAml.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdePkg/Include/IndustryStandard/AcpiAml.h 
b/MdePkg/Include/IndustryStandard/AcpiAml.h
index 
6919622af212c58dd92fc4d2bbd3b9447961d20a..3dd5408b359f9192e2fa9cedd0260a0f6bb5603a
 100644
--- a/MdePkg/Include/IndustryStandard/AcpiAml.h
+++ b/MdePkg/Include/IndustryStandard/AcpiAml.h
@@ -2,6 +2,7 @@
   This file contains AML code definition in the latest ACPI spec.
 
   Copyright (c) 2011, Intel Corporation. All rights reserved.
+  Copyright (c) 2019, ARM Limited. All rights reserved.
   SPDX-License-Identifier: BSD-2-Clause-Patent
 
 **/
@@ -30,6 +31,7 @@
 #define AML_PACKAGE_OP   0x12
 #define AML_VAR_PACKAGE_OP   0x13
 #define AML_METHOD_OP0x14
+#define AML_EXTERNAL_OP  0x15
 #define AML_DUAL_NAME_PREFIX 0x2e
 #define AML_MULTI_NAME_PREFIX0x2f
 #define AML_NAME_CHAR_A  0x41
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

View/Reply Online (#49665): https://edk2.groups.io/g/devel/message/49665
Mute This Topic: https://groups.io/mt/39802142/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/3] MdeModulePkg: Initialize variables

2019-10-30 Thread Zhang, Shenglei
Initialize the variables before used.

v2: Commit message in all patches has been updated.

Cc: Hao A Wu 
Cc: Ray Ni 
Cc: Dandan Bi 
Cc: Liming Gao 

Shenglei Zhang (3):
  MdeModulePkg/EhciPei: Initialize the variable Map
  MdeModulePkg/UhciPei: Initialize the variable RequestMap
  MdeModulePkg/Mem: Initialize the variable MapMemory

 MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c  | 2 ++
 3 files changed, 6 insertions(+)

-- 
2.18.0.windows.1


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

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



[edk2-devel] [PATCH v2 3/3] MdeModulePkg/Mem: Initialize the variable MapMemory

2019-10-30 Thread Zhang, Shenglei
MapMemory is not initialized by FindGuardedMemoryMap
or CoreInternalAllocatePages which calls MapMemory.
So we give a 0 to it.

Cc: Dandan Bi 
Cc: Liming Gao 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Core/Dxe/Mem/HeapGuard.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c 
b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
index 9477b94044ba..b4cb48843fb7 100644
--- a/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
+++ b/MdeModulePkg/Core/Dxe/Mem/HeapGuard.c
@@ -225,6 +225,8 @@ FindGuardedMemoryMap (
   UINTN   BitsToUnitEnd;
   EFI_STATUS  Status;
 
+  MapMemory = 0;
+
   //
   // Adjust current map table depth according to the address to access
   //
-- 
2.18.0.windows.1


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

View/Reply Online (#49664): https://edk2.groups.io/g/devel/message/49664
Mute This Topic: https://groups.io/mt/39796173/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/3] MdeModulePkg/EhciPei: Initialize the variable Map

2019-10-30 Thread Zhang, Shenglei
Map is used but not Initialized.
Map is called by IoMmuMap, in which Mapping(Map) is called by IoMmu->Map.
We can not assume Map is given an initial value at any step.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c 
b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
index 7c6a6a5f9716..995ccd2463d2 100644
--- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
+++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
@@ -534,6 +534,8 @@ EhcCreateUrb (
   PEI_URB   *Urb;
   VOID  *Map;
 
+  Map = NULL;
+
   Urb = Ehc->Urb;
   Urb->Signature  = EHC_URB_SIG;
   InitializeListHead (>UrbList);
-- 
2.18.0.windows.1


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

View/Reply Online (#49662): https://edk2.groups.io/g/devel/message/49662
Mute This Topic: https://groups.io/mt/39796126/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/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap

2019-10-30 Thread Zhang, Shenglei
RequestMap is used but not Initialized.
RequestMap is called by UhciMapUserRequest, in which RequestMap(Map)
is called by IoMmuMap, and is finally called by IoMmu->Map.
We can not assume RequestMap is given an initial value at any step.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
 MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c 
b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
index b897c3f82ce6..a05834da3c4a 100644
--- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
+++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
@@ -274,6 +274,8 @@ UhcControlTransfer (
 
   PktID   = INPUT_PACKET_ID;
 
+  RequestMap  = NULL;
+
   if (Request == NULL || TransferResult == NULL) {
 return EFI_INVALID_PARAMETER;
   }
-- 
2.18.0.windows.1


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

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



Re: [edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files

2019-10-30 Thread PierreGondois
The first one was not sent to devel@edk2.groups.io

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

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



[edk2-devel] [PATCH v1 1/1] BaseTools: Build ASL files before C files

2019-10-30 Thread PierreGondois
From: Pierre Gondois 

The '-tc' option of the Intel iASL compiler facilitates
generation of AML code in a C array. This AML code is
output to a .hex file. The .hex file can be included
from a C source file, thereby allowing one to run a
fix-up code in C.

For example, this technique can be used to patch the
resource data elements that describe the base address
or interrupt number for a device, before installing
the ACPI table.

To implement this feature two conditions need to be
satisfied:
 - The ASL and C files must be included in the sources
   section of the same .inf file for the module.
 - The ASL files are pre-processed and compiled before
   the C files (so that the .hex file include dependency
   is satisfied).

This patch resolves the dependency by sorting the
CODA_TARGET list for the module being built and
placing the .aml files at the very beginning of
the list.

Signed-off-by: Pierre Gondois 
---

The changes can be seen at 
https://github.com/PierreARM/edk2/commits/676_build_asl_first_v1

Notes:
v1:
- Sort .aml files first in the CODA_TARGET to build  [Pierre]
  them before other files.

 BaseTools/Source/Python/AutoGen/ModuleAutoGen.py | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py 
b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
index 
f0812b6887be6f9fbdb14003f2efff229633fb34..a59ed1d1952c23d0d3de83353a0566fb8a7dab77
 100755
--- a/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
+++ b/BaseTools/Source/Python/AutoGen/ModuleAutoGen.py
@@ -2,6 +2,7 @@
 # Create makefile for MS nmake and GNU make
 #
 # Copyright (c) 2019, Intel Corporation. All rights reserved.
+# Copyright (c) 2019, ARM Limited. All rights reserved.
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
 from __future__ import absolute_import
@@ -931,7 +932,14 @@ class ModuleAutoGen(AutoGen):
 @cached_property
 def CodaTargetList(self):
 self.Targets
-return self._FinalBuildTargetList
+
+# To resolve dependencies on compiled ASL files (.aml files) in 
modules,
+# build them first by putting them as the first targets in the
+# CodaTargetList.
+OrderedList = list(self._FinalBuildTargetList)
+OrderedList.sort(key=lambda T: (T.Target.Ext.lower() != '.aml'))
+
+return OrderedList
 
 @cached_property
 def FileTypes(self):
-- 
'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'



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

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



[edk2-devel] [PATCH v2] MdeModulePkg/HiiDatabaseDxe: Add check for 'Private->Attribute >> 4'

2019-10-30 Thread Zhang, Shenglei
The size of mHiiEfiColors is 16.
mHiiEfiColors[Private->Attribute >> 4] may be out of boundary.
So add a check for that.

Cc: Dandan Bi 
Cc: Eric Dong 
Signed-off-by: Shenglei Zhang 
---
v2: Instead of returing value, we add ASSERT to ensure
"Private->Attribute >> 4" is not out of boundary.

 MdeModulePkg/Universal/HiiDatabaseDxe/Font.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c 
b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
index ca63df168c94..1eee5ec76bb0 100644
--- a/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
+++ b/MdeModulePkg/Universal/HiiDatabaseDxe/Font.c
@@ -999,6 +999,7 @@ GetSystemFont (
   }
 
   Info->ForegroundColor= mHiiEfiColors[Private->Attribute & 0x0f];
+  ASSERT ((Private->Attribute >> 4) < 16);
   Info->BackgroundColor= mHiiEfiColors[Private->Attribute >> 4];
   Info->FontInfoMask   = EFI_FONT_INFO_SYS_FONT | EFI_FONT_INFO_SYS_SIZE | 
EFI_FONT_INFO_SYS_STYLE;
   Info->FontInfo.FontStyle = 0;
-- 
2.18.0.windows.1


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

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



[edk2-devel] [PATCH v2] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex

2019-10-30 Thread Zhang, Shenglei
DeviceIndex is used as index in Slot[]. The max size of Slot[]
is SD_PEIM_MAX_SLOTS. So DeviceIndex should be checked before used.

Cc: Hao A Wu 
Cc: Ray Ni 
Signed-off-by: Shenglei Zhang 
---
v2. Update the check boundary from "SD_PEIM_MAX_SLOTS-1"
to "SD_PEIM_MAX_SLOTS". Beacuse DeviceIndex is used as "DeviceIndex-1"
in arrays.

 MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c 
b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
index 8fa58d65b22c..ebd8270ce8e0 100644
--- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
+++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
@@ -174,7 +174,7 @@ SdBlockIoPeimGetMediaInfo (
 
   Private   = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
 
-  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
+  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) || 
(DeviceIndex > SD_PEIM_MAX_SLOTS)) {
 return EFI_INVALID_PARAMETER;
   }
 
@@ -252,7 +252,7 @@ SdBlockIoPeimReadBlocks (
 return EFI_SUCCESS;
   }
 
-  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
+  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) || 
(DeviceIndex > SD_PEIM_MAX_SLOTS)) {
 return EFI_INVALID_PARAMETER;
   }
 
-- 
2.18.0.windows.1


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

View/Reply Online (#49657): https://edk2.groups.io/g/devel/message/49657
Mute This Topic: https://groups.io/mt/39770853/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 4/5] PurleyOpenBoardPkg/BoardMtOlympus: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Include SetCacheLib from MinPlatformPkg.

Cc: Shifei A Lu 
Cc: Xiaohu Zhou 
Cc: Isaac W Oram 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc 
b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
index 595ffd4144..c7be68d979 100644
--- a/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
+++ b/Platform/Intel/PurleyOpenBoardPkg/BoardMtOlympus/PlatformPkg.dsc
@@ -1,6 +1,6 @@
 ### @file
 #
-# Copyright (c) 2018, Intel Corporation. All rights reserved.
+# Copyright (c) 2018 - 2019, Intel Corporation. All rights reserved.
 #
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 #
@@ -135,6 +135,7 @@
 !include $(RC_PKG)/RcDxeLib.dsc
 !include $(SKT_PKG)/SktDxeLib.dsc
 !include $(PCH_PKG)/PchDxeLib.dsc
+  SetCacheLib|MinPlatformPkg/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.X64]
   
BoardAcpiTableLib|$(BOARD_PKG)/$(BOARD_NAME)/Library/BoardAcpiLib/DxeBoardAcpiTableLib.inf
-- 
2.13.3.windows.1


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

View/Reply Online (#49655): https://edk2.groups.io/g/devel/message/49655
Mute This Topic: https://groups.io/mt/39770825/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 5/5] SimicsOpenBoardPkg/BoardX58Ich10: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Include SetCacheLib from MinPlatformPkg.

Cc: Wei David Y 
Cc: Agyeman Prince 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc 
b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
index 4f8ab4170d..85691c55dd 100644
--- a/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
+++ b/Platform/Intel/SimicsOpenBoardPkg/BoardX58Ich10/OpenBoardPkg.dsc
@@ -136,6 +136,7 @@
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
   
TestPointLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointLib/PeiTestPointLib.inf
+  SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLib.inf
 
 [LibraryClasses.common.DXE_DRIVER]
   ###
-- 
2.13.3.windows.1


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

View/Reply Online (#49656): https://edk2.groups.io/g/devel/message/49656
Mute This Topic: https://groups.io/mt/39770827/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 2/5] KabylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Kabylake boards are relying on FSP to configure MTRRs so
they can include SetCacheLibNull.

Test: internal platform can boot with FSP API and Dispatch modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Cc: Liming Gao 
Cc: Jeremy Soller 
Signed-off-by: Chasel Chiu 
---
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
   | 640 

 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.dsc
   |   3 ++-
 Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/OpenBoardPkg.fdf
   |   2 +-
 
Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.inf
 |  67 ---
 Platform/Intel/KabylakeOpenBoardPkg/KabylakeRvp3/OpenBoardPkg.dsc  
   |   1 +
 5 files changed, 4 insertions(+), 709 deletions(-)

diff --git 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
 
b/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
deleted file mode 100644
index b784026c1b..00
--- 
a/Platform/Intel/KabylakeOpenBoardPkg/GalagoPro3/Override/Platform/Intel/MinPlatformPkg/PlatformInit/PlatformInitPei/PlatformInitPreMem.c
+++ /dev/null
@@ -1,640 +0,0 @@
-/** @file
-  Source code file for Platform Init Pre-Memory PEI module
-
-Copyright (c) 2019, Intel Corporation. All rights reserved.
-SPDX-License-Identifier: BSD-2-Clause-Patent
-
-**/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-EFI_STATUS
-EFIAPI
-MemoryDiscoveredPpiNotifyCallback (
-  IN CONST EFI_PEI_SERVICES  **PeiServices,
-  IN EFI_PEI_NOTIFY_DESCRIPTOR   *NotifyDescriptor,
-  IN VOID*Ppi
-  );
-
-EFI_STATUS
-EFIAPI
-GetPlatformMemorySize (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_PLATFORM_MEMORY_SIZE_PPI   *This,
-  IN OUT  UINT64 *MemorySize
-  );
-
-/**
-
-  This function checks the memory range in PEI.
-
-  @param PeiServices Pointer to PEI Services.
-  @param ThisPei memory test PPI pointer.
-  @param BeginAddressBeginning of the memory address to be checked.
-  @param MemoryLengthBytes of memory range to be checked.
-  @param Operation   Type of memory check operation to be performed.
-  @param ErrorAddressReturn the address of the error memory address.
-
-  @retval EFI_SUCCESS The operation completed successfully.
-  @retval EFI_DEVICE_ERRORMemory test failed. It's not safe to use this 
range of memory.
-
-**/
-EFI_STATUS
-EFIAPI
-BaseMemoryTest (
-  IN  EFI_PEI_SERVICES   **PeiServices,
-  IN  PEI_BASE_MEMORY_TEST_PPI   *This,
-  IN  EFI_PHYSICAL_ADDRESS   BeginAddress,
-  IN  UINT64 MemoryLength,
-  IN  PEI_MEMORY_TEST_OP Operation,
-  OUT EFI_PHYSICAL_ADDRESS   *ErrorAddress
-  );
-
-static EFI_PEI_NOTIFY_DESCRIPTOR mMemDiscoveredNotifyList = {
-  (EFI_PEI_PPI_DESCRIPTOR_NOTIFY_CALLBACK | 
EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  (EFI_PEIM_NOTIFY_ENTRY_POINT) MemoryDiscoveredPpiNotifyCallback
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mPpiListRecoveryBootMode 
= {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  NULL
-};
-
-GLOBAL_REMOVE_IF_UNREFERENCED EFI_PEI_PPI_DESCRIPTOR mPpiBootMode = {
-  (EFI_PEI_PPI_DESCRIPTOR_PPI | EFI_PEI_PPI_DESCRIPTOR_TERMINATE_LIST),
-  ,
-  NULL
-};
-
-static PEI_BASE_MEMORY_TEST_PPI mPeiBaseMemoryTestPpi = { BaseMemoryTest };
-
-static PEI_PLATFORM_MEMORY_SIZE_PPI mMemoryMemorySizePpi  = { 
GetPlatformMemorySize };
-
-static EFI_PEI_PPI_DESCRIPTOR 

[edk2-devel] [edk2-platforms: PATCH 3/5] WhiskeylakeOpenBoardPkg: Add SetCacheLib library class.

2019-10-30 Thread Chiu, Chasel
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2314

Whiskeylake board relying on FSP to configure MTRRs so
it can include SetCacheLibNull.

Test: internal platform can boot with FSP API modes.

Cc: Michael Kubacki 
Cc: Nate DeSimone 
Signed-off-by: Chasel Chiu 
---
 Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc | 1 +
 1 file changed, 1 insertion(+)

diff --git 
a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc 
b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
index 8e0ea2d5ce..ba06ba3c89 100644
--- a/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
+++ b/Platform/Intel/WhiskeylakeOpenBoardPkg/WhiskeylakeURvp/OpenBoardPkg.dsc
@@ -164,6 +164,7 @@
 !if $(TARGET) == DEBUG
   
TestPointCheckLib|$(PLATFORM_PACKAGE)/Test/Library/TestPointCheckLib/PeiTestPointCheckLib.inf
 !endif
+  SetCacheLib|$(PLATFORM_PACKAGE)/Library/SetCacheLib/SetCacheLibNull.inf
 
   ###
   # Board Package
-- 
2.13.3.windows.1


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

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



[edk2-devel] [PATCH 1/2] UefiCpuPkg/MpInitLib: Set X2ApicEnable flag from BSP

2019-10-30 Thread Ni, Ray
Today's logic sets X2ApicEnable flag in each AP's initialization
path when InitFlag == ApInitConfig.
Since all CPUs update the same global data, a spin-lock is used
to avoid modifications from multiple CPUs happen at the same time.
The spin-lock causes two problems:
1. Potential performance downgrade.
2. Undefined behavior when improper timer lib is used.
   For example we saw certain platforms used AcpiTimerLib from
   PcAtChipsetPkg and that library depends on retrieving PeiServices
   from idtr. But in fact AP's (idtr - 4) doesn't point to
   PeiServices.

The patch simplifies the code to let BSP set the X2ApicEnable flag so
the spin-lock acquisition from AP is not needed any more.

Signed-off-by: Ray Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 25 -
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 622b70ca3c..8f62a8d965 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -458,6 +458,7 @@ CollectProcessorCount (
   )
 {
   UINTN  Index;
+  CPU_INFO_IN_HOB*CpuInfoInHob;
 
   //
   // Send 1st broadcast IPI to APs to wakeup APs
@@ -474,12 +475,27 @@ CollectProcessorCount (
 CpuPause ();
   }
 
+  
+  //
+  // Enable x2APIC mode if
+  //  1. Number of CPU is greater than 255; or
+  //  2. There are any logical processors reporting an Initial APIC ID of 255 
or greater.
+  //
   if (CpuMpData->CpuCount > 255) {
 //
 // If there are more than 255 processor found, force to enable X2APIC
 //
 CpuMpData->X2ApicEnable = TRUE;
+  } else {
+CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
+for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
+  if (CpuInfoInHob[Index].InitialApicId >= 0xFF) {
+CpuMpData->X2ApicEnable = TRUE;
+break;
+  }
+}
   }
+
   if (CpuMpData->X2ApicEnable) {
 DEBUG ((DEBUG_INFO, "Force x2APIC mode!\n"));
 //
@@ -541,15 +557,6 @@ InitializeApData (
 
   CpuMpData->CpuData[ProcessorNumber].Waiting= FALSE;
   CpuMpData->CpuData[ProcessorNumber].CpuHealthy = (BistData == 0) ? TRUE : 
FALSE;
-  if (CpuInfoInHob[ProcessorNumber].InitialApicId >= 0xFF) {
-//
-// Set x2APIC mode if there are any logical processor reporting
-// an Initial APIC ID of 255 or greater.
-//
-AcquireSpinLock(>MpLock);
-CpuMpData->X2ApicEnable = TRUE;
-ReleaseSpinLock(>MpLock);
-  }
 
   InitializeSpinLock(>CpuData[ProcessorNumber].ApLock);
   SetApState (>CpuData[ProcessorNumber], CpuStateIdle);
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 2/2] UefiCpuPkg/MpInitLib: Remove global variable X2ApicEnable

2019-10-30 Thread Ni, Ray
MpInitLib sets X2ApicEnable in two places.
1. CollectProcessorCount()
   This function is called when MpInitLibInitialize() hasn't been
   called before.
   It sets X2ApicEnable and later in the same function it configures
   all CPUs to operate in X2 APIC mode.
2. MpInitLibInitialize()
   The X2ApicEnable setting happens when this function is called in
   second time. But after that setting, no code consumes that flag.

With the above analysis and with the purpose of simplifying the code,
the X2ApicEnable in #1 is changed to local variable and the #2 can be
changed to remove the setting of X2ApicEnable.

Signed-off-by: Ray Ni 
Cc: Eric Dong 
Cc: Laszlo Ersek 
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 14 ++
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  1 -
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c 
b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 8f62a8d965..49be5d5385 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -459,12 +459,12 @@ CollectProcessorCount (
 {
   UINTN  Index;
   CPU_INFO_IN_HOB*CpuInfoInHob;
+  BOOLEANX2Apic;
 
   //
   // Send 1st broadcast IPI to APs to wakeup APs
   //
-  CpuMpData->InitFlag = ApInitConfig;
-  CpuMpData->X2ApicEnable = FALSE;
+  CpuMpData->InitFlag = ApInitConfig;
   WakeUpAP (CpuMpData, TRUE, 0, NULL, NULL, TRUE);
   CpuMpData->InitFlag = ApInitDone;
   ASSERT (CpuMpData->CpuCount <= PcdGet32 (PcdCpuMaxLogicalProcessorNumber));
@@ -481,22 +481,23 @@ CollectProcessorCount (
   //  1. Number of CPU is greater than 255; or
   //  2. There are any logical processors reporting an Initial APIC ID of 255 
or greater.
   //
+  X2Apic = FALSE;
   if (CpuMpData->CpuCount > 255) {
 //
 // If there are more than 255 processor found, force to enable X2APIC
 //
-CpuMpData->X2ApicEnable = TRUE;
+X2Apic = TRUE;
   } else {
 CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
   if (CpuInfoInHob[Index].InitialApicId >= 0xFF) {
-CpuMpData->X2ApicEnable = TRUE;
+X2Apic = TRUE;
 break;
   }
 }
   }
 
-  if (CpuMpData->X2ApicEnable) {
+  if (X2Apic) {
 DEBUG ((DEBUG_INFO, "Force x2APIC mode!\n"));
 //
 // Wakeup all APs to enable x2APIC mode
@@ -1780,9 +1781,6 @@ MpInitLibInitialize (
 CpuInfoInHob = (CPU_INFO_IN_HOB *) (UINTN) CpuMpData->CpuInfoInHob;
 for (Index = 0; Index < CpuMpData->CpuCount; Index++) {
   InitializeSpinLock(>CpuData[Index].ApLock);
-  if (CpuInfoInHob[Index].InitialApicId >= 255 || Index > 254) {
-CpuMpData->X2ApicEnable = TRUE;
-  }
   CpuMpData->CpuData[Index].CpuHealthy = (CpuInfoInHob[Index].Health == 
0)? TRUE:FALSE;
   CpuMpData->CpuData[Index].ApFunction = 0;
   CopyMem (>CpuData[Index].VolatileRegisters, 
, sizeof (CPU_VOLATILE_REGISTERS));
diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.h 
b/UefiCpuPkg/Library/MpInitLib/MpLib.h
index 107872b367..8fa07b12c5 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.h
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.h
@@ -227,7 +227,6 @@ struct _CPU_MP_DATA {
   UINTN  **FailedCpuList;
 
   AP_INIT_STATE  InitFlag;
-  BOOLEANX2ApicEnable;
   BOOLEANSwitchBspFlag;
   UINTN  NewBspNumber;
   CPU_EXCHANGE_ROLE_INFO BSPInfo;
-- 
2.21.0.windows.1


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

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



[edk2-devel] [PATCH 0/2] Set X2ApicEnable flag from BSP

2019-10-30 Thread Ni, Ray
Ray Ni (2):
  UefiCpuPkg/MpInitLib: Set X2ApicEnable flag from BSP
  UefiCpuPkg/MpInitLib: Remove global variable X2ApicEnable

 UefiCpuPkg/Library/MpInitLib/MpLib.c | 37 
 UefiCpuPkg/Library/MpInitLib/MpLib.h |  1 -
 2 files changed, 21 insertions(+), 17 deletions(-)

-- 
2.21.0.windows.1


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

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



Re: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

2019-10-30 Thread Kilian Kegel
Hi Liming,

CpuBreakPoint() is the same as __debugbreak() on Microsoft Compiler and 
generates INT 3 DebugTrap.

Yes, that procedure has worked in the past and I have used it in the same way 
as you do.

But with newer Windows versions, Windows just terminates the “exceptional” 
process that emits
INT 3 or any other violation trap and does not offer to debug the process – 
surly for security reasons…

For debugging purpose on newer Windows 10 versions I always insert the code 
snippet  below.

It gives the developer the chance to connect VS to the process to be debugged, 
while waiting on keyboard input.
(ALT-CTRL-P attach to process)

After that, with the debuggee is connected to VS _before_ the debug trap 
appears. VS is now
available for debugging the process with full source code.

The EmulatorPkg (and Nt32Pkg) was the most helpful tool to understand and debug 
UEFI internals for me.

EmulatorPkg should also usable and helpful for other devolpers.
Can you please insert the code snippet into main() from WinHost.c?

Thanks,
Kilian


From: Gao, Liming
Sent: Wednesday, October 30, 2019 06:33 AM
To: devel@edk2.groups.io; 
kilian_ke...@outlook.com
Cc: Richardson, Brian; Kinney, Michael 
D
Subject: RE: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Kilian:
   I normally modify the source code and insert CpuBreakpoint() function. That 
will trig VS debugger for the source code.

Thanks
Liming
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Kilian 
Kegel
Sent: Monday, October 28, 2019 9:01 PM
To: Gao, Liming 
Cc: devel@edk2.groups.io; Richardson, Brian ; 
Kinney, Michael D 
Subject: [edk2-devel] [edk2] [EmulatorPkg] using __debugbreak()

Hi Liming,

If have observed in newer Windows 10 versions, when using __debugbreak()in any
application that Windows just terminates the app, instead offering to debug it.
So in WinHost.exe too.

That’s why I usually insert the code snippet below to run into getchar()
when the program was started with the /debug command line switch.
As long as the App waits for the next keystroke, I can start the debugger 
(VS2019)
and connect to WinHost.exe process for debugging.

Do you have a better solution without modifying the source code?

Thanks,
Kilian
if(1){
int i;

SecPrint 
("##\n");
SecPrint ("add \"/debug\" command line switch, to connect to the 
debugger at the very beginning of POST emulation\n");
SecPrint 
("##\n");

if(Argc > 1){
for(i = 1 ; i < Argc ; i++){
if(0 == strcmp("/debug", Argv[i])){
//SecPrint("IF YOU WANT TO DEBUG from the very 
beginning of the EMULATION:\n\t1. start the TASKMGR\n\t2. connect WinHost.exe 
to the debugger\n\t3. and press ENTER in this command box\nOR\n");
SecPrint("\t1. start Visual Studio\n");
SecPrint("\t2. DEBUG->ATTACH TO PROCESS (CTRL + ALT + 
P) --> WinHost.exe\n");
SecPrint("\t3. Break All  (CTRL + ALT + Break) --> 
WinHost.exe\n");
SecPrint("\t4. SET A SOFTWARE BREAKPOINT (F9) in line 
445\n");
SecPrint("\t5. and press ENTER in this command box\n");
SecPrint("\t6. go back to Visual Studio an RUN/SINGLE 
STEP the application\n");
SecPrint("\t7. otherwise press enter to continue...\n");
getchar();
//
// 1. SET A SOFTWARE BREAKPOINT TO THE NEXT LINE of 
code below -->> SecPrint("");
// 2. switch to the command box and press ENTER
// 3. start single stepping the entire boot/emulation 
process, good luck...
//
SecPrint("");//now you can single step the entire 
boot/emulation process, good luck...
   }
}
}
}



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

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



Re: [edk2-devel] How /sys/firmware/fdt getting created

2019-10-30 Thread Prabhakar Kushwaha
On Wed, Oct 30, 2019 at 1:14 PM Ard Biesheuvel
 wrote:
>
> On Wed, 30 Oct 2019 at 08:36, Prabhakar Kushwaha
>  wrote:
> >
> > On Wed, Oct 30, 2019 at 12:43 PM Ard Biesheuvel
> >  wrote:
> > >
> > > On Tue, 29 Oct 2019 at 18:17, Prabhakar Kushwaha
> > >  wrote:
> > > >
> > > > Hi All,
> > > >
> > > > I am working on Ubuntu-18.04 with UEFI on ARM64(64 bit) platform. The
> > > > UEFI used is having ACPI tables.
> > > >
> > > > I am trying to understand where and how /sys/firmware/fdt is getting
> > > > created. is it created by UEFI or grub and passed to Linux?
> > > >
> > >
> > > Neither. It is created by Linux itself.
> > >
> > >
> > >
> >
> > Thanks Ard,
> >
> > Can you please point me the code where it is getting created.
> > I want to add below in /sys/firmware/fdt.
> >
> > #size-cells = <0x02>;
> > #address-cells = <0x02>;
> >
>
> Actually, in your case it is GRUB not the kernel that creates the FDT.
> It does this to pass the initrd information.
>
> So if you want to add these properties, you should add them there.
>
> Can you explain why doing this is necessary?

I am trying to test kexec -p (kdump feature) on CentOS-release
7.7.1908 and Ubuntu-18.04 distributions.

 "kexec -p" command show error on Ubuntu. While no error on CentOS

CentOS:
$ kexec -p /boot/vmlinuz-`uname -r` --initrd=/boot/initramfs-`uname
-r`.img --reuse-cmdline
$==> No error

Ubuntu
$ kexec -p /boot/vmlinuz-`uname -r` --initrd=/boot/initrd.img-`uname
-r` --reuse-cmdline
$ kexec: elfcorehdr doesn't fit cells-size.
$ kexec: setup_2nd_dtb failed.
$ kexec: load failed.
$ Cannot load /boot/vmlinuz-5.4.0-rc4+

Note: Both CentOS and Ubuntu has Linux-5.4-rc4 tag.

When i debugged further reason for Ubuntu error is due to
address-cells and size-cells as "1"
log from kexec tool :-
load_crashdump_segments: elfcorehdr 0x7f7cbfc000-0x7f7cbff7ff
read_1st_dtb: found name =dtb_sys  /sys/firmware/fdt
get_cells_size: #address-cells:1 #size-cells:1

On CentOS both values are "2".
log from kexec tool :-
load_crashdump_segments: elfcorehdr 0xbf98bf-0xbf98bf33ff
read_1st_dtb: found nmae=dtb_sys /sys/firmware/fdt
get_cells_size: #address-cells:2 #size-cells:2

Note: Kexec tool read values from /sys/firmware/fdt.

I am trying to figure out why 2 distributions showing different values.

--pk

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

View/Reply Online (#49646): https://edk2.groups.io/g/devel/message/49646
Mute This Topic: https://groups.io/mt/39480086/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/SdBlockIoPei: Add check for DeviceIndex

2019-10-30 Thread Zhang, Shenglei



> -Original Message-
> From: Wu, Hao A
> Sent: Wednesday, October 30, 2019 3:15 PM
> To: devel@edk2.groups.io; Zhang, Shenglei 
> Cc: Ni, Ray 
> Subject: RE: [edk2-devel] [PATCH] MdeModulePkg/SdBlockIoPei: Add check
> for DeviceIndex
> 
> > -Original Message-
> > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> > Zhang, Shenglei
> > Sent: Thursday, October 17, 2019 2:21 PM
> > To: devel@edk2.groups.io
> > Cc: Wu, Hao A; Ni, Ray
> > Subject: [edk2-devel] [PATCH] MdeModulePkg/SdBlockIoPei: Add check
> for
> > DeviceIndex
> >
> > DeviceIndex is used as index in Slot[]. The max size of Slot[]
> > is SD_PEIM_MAX_SLOTS. So DeviceIndex should be checked before used.
> >
> > Cc: Hao A Wu 
> > Cc: Ray Ni 
> > Signed-off-by: Shenglei Zhang 
> > ---
> >  MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c | 4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> > b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> > index 8fa58d65b22c..25530dcb34ce 100644
> > --- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> > +++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> > @@ -174,7 +174,7 @@ SdBlockIoPeimGetMediaInfo (
> >
> >Private   = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
> >
> > -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> > +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> > (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1))) {
> 
> 
> Hello,
> 
> I do not think the change is proper, since 'DeviceIndex' is used to access the
> array Private->Slot[SD_PEIM_MAX_SLOTS] like:
> 
>   Private->Slot[DeviceIndex - 1]
> 
> I think the change should be:
> 
>   ... || (DeviceIndex > (SD_PEIM_MAX_SLOTS)
> 
> instead of:
> 
>   ... || (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1)
> 
> 
> Could you help to double confirm on this? Thanks in advance.
> 

Hao,

You are right. The index used below the if statement is " DeviceIndex -1" not " 
DeviceIndex ".

Thanks,
Shenglei

> Best Regards,
> Hao Wu
> 
> 
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > @@ -252,7 +252,7 @@ SdBlockIoPeimReadBlocks (
> >  return EFI_SUCCESS;
> >}
> >
> > -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> > +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> > (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1))) {
> >  return EFI_INVALID_PARAMETER;
> >}
> >
> > --
> > 2.18.0.windows.1
> >
> >
> > 


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

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



Re: [edk2-devel] How /sys/firmware/fdt getting created

2019-10-30 Thread Ard Biesheuvel
On Wed, 30 Oct 2019 at 08:36, Prabhakar Kushwaha
 wrote:
>
> On Wed, Oct 30, 2019 at 12:43 PM Ard Biesheuvel
>  wrote:
> >
> > On Tue, 29 Oct 2019 at 18:17, Prabhakar Kushwaha
> >  wrote:
> > >
> > > Hi All,
> > >
> > > I am working on Ubuntu-18.04 with UEFI on ARM64(64 bit) platform. The
> > > UEFI used is having ACPI tables.
> > >
> > > I am trying to understand where and how /sys/firmware/fdt is getting
> > > created. is it created by UEFI or grub and passed to Linux?
> > >
> >
> > Neither. It is created by Linux itself.
> >
> >
> >
>
> Thanks Ard,
>
> Can you please point me the code where it is getting created.
> I want to add below in /sys/firmware/fdt.
>
> #size-cells = <0x02>;
> #address-cells = <0x02>;
>

Actually, in your case it is GRUB not the kernel that creates the FDT.
It does this to pass the initrd information.

So if you want to add these properties, you should add them there.

Can you explain why doing this is necessary?

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

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



Re: [edk2-devel] How /sys/firmware/fdt getting created

2019-10-30 Thread Prabhakar Kushwaha
On Wed, Oct 30, 2019 at 12:43 PM Ard Biesheuvel
 wrote:
>
> On Tue, 29 Oct 2019 at 18:17, Prabhakar Kushwaha
>  wrote:
> >
> > Hi All,
> >
> > I am working on Ubuntu-18.04 with UEFI on ARM64(64 bit) platform. The
> > UEFI used is having ACPI tables.
> >
> > I am trying to understand where and how /sys/firmware/fdt is getting
> > created. is it created by UEFI or grub and passed to Linux?
> >
>
> Neither. It is created by Linux itself.
>
>
>

Thanks Ard,

Can you please point me the code where it is getting created.
I want to add below in /sys/firmware/fdt.

#size-cells = <0x02>;
#address-cells = <0x02>;

--prabhakar (pk)

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

View/Reply Online (#49643): https://edk2.groups.io/g/devel/message/49643
Mute This Topic: https://groups.io/mt/39480086/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/Oniguruma: Remove redundant IF statement

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Monday, October 21, 2019 10:13 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A
> Subject: [edk2-devel] [PATCH] MdeModulePkg/Oniguruma: Remove redundant
> IF statement
> 
> The if statement is not necessary, so keep it to edk2 style.
> And this change has been merged to onigruma.
> REF:https://github.com/kkos/oniguruma/pull/158


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Signed-off-by: Shenglei Zhang 
> ---
>  .../Oniguruma/unicode_fold1_key.c  | 18 +++---
>  .../Oniguruma/unicode_fold2_key.c  | 17 ++---
>  .../Oniguruma/unicode_fold3_key.c  | 18 +++---
>  .../Oniguruma/unicode_unfold_key.c | 17 ++---
>  4 files changed, 26 insertions(+), 44 deletions(-)
> 
> diff --git
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1
> _key.c
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1
> _key.c
> index 7dbd6a5995be..0aa54ee172b2 100644
> ---
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1
> _key.c
> +++
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold1
> _key.c
> @@ -2983,17 +2983,13 @@ onigenc_unicode_fold1_key(OnigCodePoint
> codes[])
>4026
>  };
> 
> -  if (0 == 0)
> -{
> -  int key = hash(codes);
> -
> -  if (key <= MAX_HASH_VALUE)
> -{
> -  int index = wordlist[key];
> -
> -  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds1 + index, 
> 1)
> == 0)
> -return index;
> -}
> +int key = hash(codes);
> +if (key <= MAX_HASH_VALUE) {
> +  int index = wordlist[key];
> +  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds1 + index, 1)
> == 0) {
> +return index;
> +  }
>  }
> +
>return -1;
>  }
> diff --git
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2
> _key.c
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2
> _key.c
> index 3d93e2417a2c..44f8cb660071 100644
> ---
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2
> _key.c
> +++
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold2
> _key.c
> @@ -211,17 +211,12 @@ onigenc_unicode_fold2_key(OnigCodePoint codes[])
>129
>  };
> 
> -  if (0 == 0)
> -{
> -  int key = hash(codes);
> -
> -  if (key <= MAX_HASH_VALUE)
> -{
> -  int index = wordlist[key];
> -
> -  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 
> 2)
> == 0)
> -return index;
> -}
> +int key = hash(codes);
> +if (key <= MAX_HASH_VALUE) {
> +  int index = wordlist[key];
> +  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds2 + index, 2)
> == 0)
> +return index;
>  }
> +
>return -1;
>  }
> diff --git
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3
> _key.c
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3
> _key.c
> index bdd5667c6ae2..b36500b135e6 100644
> ---
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3
> _key.c
> +++
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_fold3
> _key.c
> @@ -121,17 +121,13 @@ onigenc_unicode_fold3_key(OnigCodePoint codes[])
>0
>  };
> 
> -  if (0 == 0)
> -{
> -  int key = hash(codes);
> -
> -  if (key <= MAX_HASH_VALUE)
> -{
> -  int index = wordlist[key];
> -
> -  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 
> 3)
> == 0)
> -return index;
> -}
> +int key = hash(codes);
> +if (key <= MAX_HASH_VALUE) {
> +  int index = wordlist[key];
> +  if (index >= 0 && onig_codes_cmp(codes, OnigUnicodeFolds3 + index, 3)
> == 0) {
> +return index;
> +  }
>  }
> +
>return -1;
>  }
> diff --git
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfol
> d_key.c
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfol
> d_key.c
> index 10f7889ea372..1f03b21cfe54 100644
> ---
> a/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfol
> d_key.c
> +++
> b/MdeModulePkg/Universal/RegularExpressionDxe/Oniguruma/unicode_unfol
> d_key.c
> @@ -3288,17 +3288,12 @@ onigenc_unicode_unfold_key(OnigCodePoint code)
>{0x1e907, 4005, 1}
>  };
> 
> -  if (0 == 0)
> -{
> -  int key = hash();
> -
> -  if (key <= MAX_HASH_VALUE)
> -{
> -  OnigCodePoint gcode = wordlist[key].code;
> -
> -  if (code == gcode && wordlist[key].index >= 0)
> -return [key];
> -}
> +int key = hash();
> +if (key <= MAX_HASH_VALUE) {
> +  OnigCodePoint gcode = wordlist[key].code;
> +  if (code == gcode && wordlist[key].index 

Re: [edk2-devel] [PATCH] MdeModulePkg/SdBlockIoPei: Add check for DeviceIndex

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
> Zhang, Shenglei
> Sent: Thursday, October 17, 2019 2:21 PM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [edk2-devel] [PATCH] MdeModulePkg/SdBlockIoPei: Add check for
> DeviceIndex
> 
> DeviceIndex is used as index in Slot[]. The max size of Slot[]
> is SD_PEIM_MAX_SLOTS. So DeviceIndex should be checked before used.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> index 8fa58d65b22c..25530dcb34ce 100644
> --- a/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> +++ b/MdeModulePkg/Bus/Sd/SdBlockIoPei/SdBlockIoPei.c
> @@ -174,7 +174,7 @@ SdBlockIoPeimGetMediaInfo (
> 
>Private   = GET_SD_PEIM_HC_PRIVATE_DATA_FROM_THIS (This);
> 
> -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1))) {


Hello,

I do not think the change is proper, since 'DeviceIndex' is used to access the
array Private->Slot[SD_PEIM_MAX_SLOTS] like:

  Private->Slot[DeviceIndex - 1]

I think the change should be:

  ... || (DeviceIndex > (SD_PEIM_MAX_SLOTS)

instead of:

  ... || (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1)


Could you help to double confirm on this? Thanks in advance.

Best Regards,
Hao Wu


>  return EFI_INVALID_PARAMETER;
>}
> 
> @@ -252,7 +252,7 @@ SdBlockIoPeimReadBlocks (
>  return EFI_SUCCESS;
>}
> 
> -  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices)) {
> +  if ((DeviceIndex == 0) || (DeviceIndex > Private->TotalBlkIoDevices) ||
> (DeviceIndex > (SD_PEIM_MAX_SLOTS - 1))) {
>  return EFI_INVALID_PARAMETER;
>}
> 
> --
> 2.18.0.windows.1
> 
> 
> 


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

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



Re: [edk2-devel] How /sys/firmware/fdt getting created

2019-10-30 Thread Ard Biesheuvel
On Tue, 29 Oct 2019 at 18:17, Prabhakar Kushwaha
 wrote:
>
> Hi All,
>
> I am working on Ubuntu-18.04 with UEFI on ARM64(64 bit) platform. The
> UEFI used is having ACPI tables.
>
> I am trying to understand where and how /sys/firmware/fdt is getting
> created. is it created by UEFI or grub and passed to Linux?
>

Neither. It is created by Linux itself.



> below is the dts format of /sys/firmware/fdt.
>
> /dts-v1/;
>
> / {
>
> chosen {
> linux,uefi-mmap-desc-ver = <0x1>;
> linux,uefi-mmap-desc-size = <0x30>;
> linux,uefi-mmap-size = <0xcc0>;
> linux,uefi-mmap-start = <0x0 0xeda13018>;
> linux,uefi-system-table = <0x0 0xfafd0018>;
> bootargs = "BOOT_IMAGE=/boot/vmlinuz-5.4.0-rc4+
> root=UUID=798a858c-4f20-4b99-aa40-99bff9394093 ro crashkernel=2G
> console=ttyAMA0";
> linux,initrd-end = <0x0 0xeb381a34>;
> linux,initrd-start = <0x0 0xdd5f5000>;
> };
> };
>
> also, under what scenario/config fields is getting added fdt.
> #size-cells = <0x02>;
> #address-cells = <0x02>;
>
> --prabhakar (pk)
>
> 
>

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

View/Reply Online (#49640): https://edk2.groups.io/g/devel/message/49640
Mute This Topic: https://groups.io/mt/39480086/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/4] MdeModulePkg/EbcDebugger: Add check for Entry and RetEntry

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:31 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A
> Subject: [PATCH 1/4] MdeModulePkg/EbcDebugger: Add check for Entry and
> RetEntry
> 
> Entry and RetEntry might be NULL before used.
> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c | 2 +-
>  MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c| 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
> b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
> index 8e305e4243a5..7b453fa98c2b 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbCmdSymbol.c
> @@ -143,7 +143,7 @@ DebuggerDisplaySymbolAccrodingToAddress (
>// Find the nearest symbol address
>//
>CandidateAddress = EbdFindSymbolAddress (Address,
> EdbMatchSymbolTypeNearestAddress, , );
> -  if (CandidateAddress == 0 || CandidateAddress == (UINTN) -1) {
> +  if (CandidateAddress == 0 || CandidateAddress == (UINTN) -1 || Entry ==
> NULL) {
>  EDBPrint (L"Symbole at Address not found!\n");
>  return EFI_DEBUG_CONTINUE;
>} else if (Address != CandidateAddress) {
> diff --git a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
> b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
> index 85cc275c114b..90a9b9fbd7ee 100644
> --- a/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
> +++ b/MdeModulePkg/Universal/EbcDxe/EbcDebugger/EdbSymbol.c
> @@ -2062,7 +2062,7 @@ EdbPrintSource (
>  ,
>  
>  );
> -  if (SymbolAddress == 0) {
> +  if (SymbolAddress == 0 || RetEntry == NULL) {
>  return 0 ;
>}


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


> 
> --
> 2.18.0.windows.1


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

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



Re: [edk2-devel] [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for GetBufferForValue()

2019-10-30 Thread Wu, Hao A
Hello Eric and Dandan,

Could you help to review this patch?
Thanks in advance.

Best Regards,
Hao Wu


> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:31 AM
> To: devel@edk2.groups.io
> Cc: Wang, Jian J; Wu, Hao A
> Subject: [PATCH 4/4] MdeModulePkg/SetupBrowserDxe: Add check for
> GetBufferForValue()
> 
> The returned value from GetBufferForValue might be NULL, so add a
> check for that before it is used.
> 
> Cc: Jian J Wang 
> Cc: Hao A Wu 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Universal/SetupBrowserDxe/Expression.c | 5 +
>  1 file changed, 5 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
> b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
> index 7f4929c2fcd9..984c68c6bb7a 100644
> --- a/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
> +++ b/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
> @@ -1281,7 +1281,12 @@ IfrToUint (
>Result->Type = EFI_IFR_TYPE_UNDEFINED;
>return EFI_SUCCESS;
>  }
> +
> +if (GetBufferForValue () == NULL) {
> +  return EFI_NOT_FOUND;
> +}
>  Result->Value.u64 = *(UINT64*) GetBufferForValue ();
> +
>  if (Value.Type == EFI_IFR_TYPE_BUFFER) {
>FreePool (Value.Buffer);
>  }
> --
> 2.18.0.windows.1


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

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



Re: [edk2-devel] [PATCH 3/4] MdeModulePkg/EsrtDxe: Add check for EsrtRepository

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:31 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Gao, Liming
> Subject: [PATCH 3/4] MdeModulePkg/EsrtDxe: Add check for EsrtRepository
> 
> EsrtRepository might be NULL. So return EFI_OUT_OF_RESOURCES
> when it is NULL.
> 
> Cc: Hao A Wu 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c | 10 ++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
> b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
> index f48125382dbc..fff17b98fa3d 100644
> --- a/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
> +++ b/MdeModulePkg/Universal/EsrtDxe/EsrtImpl.c
> @@ -239,6 +239,11 @@ DeleteEsrtEntry(
>  goto EXIT;
>}
> 
> +  if (EsrtRepository == NULL) {
> +Status = EFI_OUT_OF_RESOURCES;
> +goto EXIT;
> +  }
> +
>if ((RepositorySize % sizeof(EFI_SYSTEM_RESOURCE_ENTRY)) != 0) {
>  DEBUG((EFI_D_ERROR, "Repository Corrupt. Need to rebuild 
> Repository.\n"));
>  //
> @@ -332,6 +337,11 @@ UpdateEsrtEntry(
>   
>   );
> 
> +  if (EsrtRepository == NULL) {
> +Status = EFI_OUT_OF_RESOURCES;
> +goto EXIT;
> +  }
> +


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


>if (!EFI_ERROR(Status)) {
>  //
>  // if exist, update Esrt cache repository
> --
> 2.18.0.windows.1


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

View/Reply Online (#49637): https://edk2.groups.io/g/devel/message/49637
Mute This Topic: https://groups.io/mt/34668866/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/Variable/Pei: Update the condition in if statement

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Thursday, October 17, 2019 11:20 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Gao, Liming
> Subject: [PATCH] MdeModulePkg/Variable/Pei: Update the condition in if
> statement
> 
> IndexTable->Length is used as index in array IndexTable->Index[].
> So IndexTable->Length needs to be checked, which should be less than
> the array size.
> 
> Cc: Hao A Wu 
> Cc: Liming Gao 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Universal/Variable/Pei/Variable.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/MdeModulePkg/Universal/Variable/Pei/Variable.c
> b/MdeModulePkg/Universal/Variable/Pei/Variable.c
> index 715802f33c29..f61465fc3045 100644
> --- a/MdeModulePkg/Universal/Variable/Pei/Variable.c
> +++ b/MdeModulePkg/Universal/Variable/Pei/Variable.c
> @@ -896,7 +896,7 @@ FindVariableEx (
>//
>if ((IndexTable != NULL) && !StopRecord) {
>  Offset = (UINTN) Variable - (UINTN) LastVariable;
> -if ((Offset > 0x0) || (IndexTable->Length == sizeof 
> (IndexTable->Index)
> / sizeof (IndexTable->Index[0]))) {
> +if ((Offset > 0x0) || (IndexTable->Length >= sizeof (IndexTable-
> >Index) / sizeof (IndexTable->Index[0]))) {


Reviewed-by: Hao A Wu 

Best Regards,
Hao Wu


>//
>// Stop to record if the distance of two neighbouring VAR_ADDED
> variable is larger than the allowable scope(UINT16),
>// or the record buffer is full.
> --
> 2.18.0.windows.1


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

View/Reply Online (#49636): https://edk2.groups.io/g/devel/message/49636
Mute This Topic: https://groups.io/mt/34668808/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/3] MdeModulePkg/UhciPei: Initialize the variable RequestMap

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, October 16, 2019 9:47 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH 2/3] MdeModulePkg/UhciPei: Initialize the variable
> RequestMap
> 
> RequestMap is used but not Initialized.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> index b897c3f82ce6..a05834da3c4a 100644
> --- a/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> +++ b/MdeModulePkg/Bus/Pci/UhciPei/UhcPeim.c
> @@ -274,6 +274,8 @@ UhcControlTransfer (
> 
>PktID   = INPUT_PACKET_ID;
> 
> +  RequestMap  = NULL;


Hello,

Is this a real issue or just a false positive report by some compiler or static
analyzer?

If is a real issue, could you help to describe the issue in more detail? If it
is a false positive report, could you help to add some comments together with
the change? Thanks in advance.

Best Regards,
Hao Wu


> +
>if (Request == NULL || TransferResult == NULL) {
>  return EFI_INVALID_PARAMETER;
>}
> --
> 2.18.0.windows.1


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

View/Reply Online (#49634): https://edk2.groups.io/g/devel/message/49634
Mute This Topic: https://groups.io/mt/34556041/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/3] MdeModulePkg/EhciPei: Initialize the variable Map

2019-10-30 Thread Wu, Hao A
> -Original Message-
> From: Zhang, Shenglei
> Sent: Wednesday, October 16, 2019 9:47 AM
> To: devel@edk2.groups.io
> Cc: Wu, Hao A; Ni, Ray
> Subject: [PATCH 1/3] MdeModulePkg/EhciPei: Initialize the variable Map
> 
> Map is used but not Initialized.
> 
> Cc: Hao A Wu 
> Cc: Ray Ni 
> Signed-off-by: Shenglei Zhang 
> ---
>  MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> index 7c6a6a5f9716..995ccd2463d2 100644
> --- a/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> +++ b/MdeModulePkg/Bus/Pci/EhciPei/EhciUrb.c
> @@ -534,6 +534,8 @@ EhcCreateUrb (
>PEI_URB   *Urb;
>VOID  *Map;
> 
> +  Map = NULL;
> +


Hello,

Is this a real issue or just a false positive report by some compiler or static
analyzer?

If is a real issue, could you help to describe the issue in more detail? If it
is a false positive report, could you help to add some comments together with
the change? Thanks in advance.

Best Regards,
Hao Wu


>Urb = Ehc->Urb;
>Urb->Signature  = EHC_URB_SIG;
>InitializeListHead (>UrbList);
> --
> 2.18.0.windows.1


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

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