Date   
Re: [PATCH V2] ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

Augustine, Linson <linson.augustine@...>
 

Reviewed-by: Linson Augustine <Linson.augustine@...>

Regards,
-Linson

-----Original Message-----
From: Gao, Zhichao
Sent: Wednesday, August 14, 2019 2:03 PM
To: devel@edk2.groups.io; Gao, Zhichao <zhichao.gao@...>
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray <ray.ni@...>; oleksiyy@...; Augustine, Linson <linson.augustine@...>
Subject: RE: [edk2-devel] [PATCH V2] ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

Ping again.

Thanks,
Zhichao

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Gao, Zhichao
Sent: Friday, July 26, 2019 3:47 PM
To: devel@edk2.groups.io
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray
<ray.ni@...>; oleksiyy@...
Subject: FW: [edk2-devel] [PATCH V2]
ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

Ping. Please help to review it.

Thanks,
Zhichao

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Gao, Zhichao
Sent: Monday, July 22, 2019 2:58 PM
To: devel@edk2.groups.io
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray
<ray.ni@...>; Oleksiy <oleksiyy@...>
Subject: [edk2-devel] [PATCH V2] ShellPkg/UefiShellDriver1CommandsLib:
Make array big enough

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

The two CHAR16 array ChildCountStr and DeviceCountStr is defined to
hold the decimal string data of UINTN. The max of UINTN is
18446744073709551615 and it contain 20 characters.
So make their size to 21 CHAR16s to hold the string data with a null-
terminate.
UnicodeValueToStringS regard the value input as INT64, and
21 CHARs is enough to hold the lowest value with minus '-'.
Although the value shouldn't be such big.

Cc: Jaben Carsey <jaben.carsey@...>
Cc: Ray Ni <ray.ni@...>
Cc: Oleksiy <oleksiyy@...>
Signed-off-by: Zhichao Gao <zhichao.gao@...>
---

V2:
Update the copyright.

ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
index 794b737bd1..27cd278cf0 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
@@ -2,7 +2,7 @@
Main file for Drivers shell Driver1 function.

(C) Copyright 2012-2015 Hewlett-Packard Development Company,
L.P.<BR>
- Copyright (c) 2010 - 2018, Intel Corporation. All rights
reserved.<BR>
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights
+ reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -263,8 +263,8 @@ ShellCommandRunDrivers (
EFI_HANDLE *HandleWalker;
UINTN ChildCount;
UINTN DeviceCount;
- CHAR16 ChildCountStr[3];
- CHAR16 DeviceCountStr[3];
+ CHAR16 ChildCountStr[21];
+ CHAR16 DeviceCountStr[21];
CHAR16 *Temp2;
CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName;
--
2.21.0.windows.1





Re: [Patch v1] ShellPkg: update drivers command for more children

Augustine, Linson <linson.augustine@...>
 

Reviewed-by: Linson Augustine <Linson.augustine@...>

Regards,
-Linson

-----Original Message-----
From: Carsey, Jaben
Sent: Tuesday, August 13, 2019 8:12 PM
To: devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>; Augustine, Linson <linson.augustine@...>; Gao, Zhichao <zhichao.gao@...>
Subject: [Patch v1] ShellPkg: update drivers command for more children

this allows for > 99 children

Cc: ray ni <ray.ni@...>
Cc: linson augustine <linson.augustine@...>
Cc: zhichao gao <zhichao.gao@...>
Signed-off-by: Jaben Carsey <jaben.carsey@...>
---
ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
index 794b737bd1..7d45f2fc40 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
@@ -2,7 +2,7 @@
Main file for Drivers shell Driver1 function.

(C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -263,8 +263,8 @@ ShellCommandRunDrivers (
EFI_HANDLE *HandleWalker;
UINTN ChildCount;
UINTN DeviceCount;
- CHAR16 ChildCountStr[3];
- CHAR16 DeviceCountStr[3];
+ CHAR16 ChildCountStr[7];
+ CHAR16 DeviceCountStr[7];
CHAR16 *Temp2;
CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName;
--
2.16.2.windows.1

Re: [PATCH] MdePkg: Add MmAccess and MmControl definition.

Marc W Chen
 

Thanks Liming for pushing the code.

Can we have a conclusion for the SmmAccess.h removal from MdeModulePkg? Who can make the decision? Or do we need any further discussion?

Thanks,
Marc

-----Original Message-----
From: Gao, Liming
Sent: Tuesday, August 13, 2019 5:20 PM
To: devel@edk2.groups.io; Gao, Liming <liming.gao@...>; Chen, Marc
W <marc.w.chen@...>; lersek@...; Ni, Ray
<ray.ni@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and MmControl
definition.

Push @6f33f7a262314af35e2b99c849e08928ea49aa55

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Liming Gao
Sent: Saturday, August 10, 2019 11:34 AM
To: Chen, Marc W <marc.w.chen@...>; devel@edk2.groups.io;
lersek@...; Ni, Ray <ray.ni@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: Re: [edk2-devel] [PATCH] MdePkg: Add MmAccess and MmControl
definition.

I agree. The patch to add them in MdePkg is clear. I will push it next Monday.

Thanks
Liming
-----Original Message-----
From: Chen, Marc W
Sent: Saturday, August 10, 2019 11:33 AM
To: devel@edk2.groups.io; lersek@...; Ni, Ray
<ray.ni@...>;
Gao, Liming <liming.gao@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

Hi Liming

Since the SmmAccess.h of MdeModulePkg removal is still under discussion,
can we push the MmAccess.h and MmControl.h to MdePkg
first? I have other tasks pending by this.
We can keep discussing the SmmAccess after push the code.

Thanks,
Marc

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
Laszlo
Ersek
Sent: Thursday, August 8, 2019 12:11 AM
To: Ni, Ray <ray.ni@...>; Chen, Marc W
<marc.w.chen@...>;
devel@edk2.groups.io; Gao, Liming <liming.gao@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: Re: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

On 08/06/19 12:08, Ni, Ray wrote:
Laszlo,
Do you want to avoid touching the OvmfPkg due the file removal in
MdeModulePkg?

My main problem with this *specific* update proposal is that the
identifiers (type names and such) that would be subject to removal were
publicly specified in earlier PI spec releases.

I don't suggest that we maintain two parallel sets of typedefs and such
in edk2. It's fine to keep the new "MM" nomenclature the main one. But
we should keep the "SMM" set of terms too, as a thin wrapper, if that's
technically feasible.

If we remove "SMM", that will not only affect OvmfPkg unpleasantly, but
a bunch of other, out-of-tree code. And the reason I suddenly care
about
out-of-tree code is that such code was written against a public industry
spec (= earlier versions of the PI spec).

I don't think that the simplicity that would come from removing "SMM"
altogether, is well-balanced against the pain that it would cause for
platforms.

Earlier this was solved in the following commits:
- 07c6a47e70ba ("MdePkg: Add new definitions for Management
Mode.",
2017-08-29)
- 2f208e59e4b9 ("MdePkg: Reference new definitions for Management
Mode.", 2017-08-29)

Thanks
Laszlo

I prefer to remove the files in MdeModulePkg to avoid future
confusion.

Thanks,
Ray

-----Original Message-----
From: Chen, Marc W
Sent: Tuesday, August 6, 2019 4:57 PM
To: devel@edk2.groups.io; lersek@...; Ni, Ray
<ray.ni@...>;
Gao, Liming <liming.gao@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

Hi Liming and Ray

Do you also agree?

Thanks,
Marc

-----Original Message-----
From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of
Laszlo
Ersek
Sent: Friday, August 2, 2019 10:14 AM
To: devel@edk2.groups.io; Chen, Marc W
<marc.w.chen@...>;
Ni,
Ray <ray.ni@...>; Gao, Liming <liming.gao@...>
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: Re: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

On 08/01/19 12:15, Marc W Chen wrote:
Yes, my purpose is to avoid platform code update if the package is
allowed
to use MdeModulePkg like OvmfPkg.
For those packages that cannot depend on MdeModulePkg must
change
to
use new definition.

Agreed.

Thanks!
Laszlo

-----Original Message-----
From: Ni, Ray
Sent: Thursday, August 1, 2019 6:04 PM
To: Chen, Marc W <marc.w.chen@...>; Gao, Liming
<liming.gao@...>; devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

Marc,
Is the purpose to avoid platform code update with the wrapper
header
file in
MdeModulePkg?
Certain platforms they may require to not depend on
MdeModulePkg
but just depend on MdePkg.
Having SmmAccess.h in MdeModulePkg doesn't help.

It also bring confusing.

Thanks,
Ray

-----Original Message-----
From: Chen, Marc W
Sent: Thursday, August 1, 2019 4:53 PM
To: Gao, Liming <liming.gao@...>; devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Ni, Ray
<ray.ni@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

Hi Liming

Another thought, do you think it is ok to keep SmmAccess.h in
MdeModulePkg? We can use #define and typedef to convert
MmAccess
to
SmmAccess, just like current SmmAccess Protocol in MdePkg.

Thanks,
Marc

-----Original Message-----
From: Chen, Marc W
Sent: Thursday, August 1, 2019 4:48 PM
To: Gao, Liming <liming.gao@...>;
devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Ni, Ray
<ray.ni@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

Hi Liming

Since there are multiple packages are still using SmmAccess.h,
we
need to change all packages to use MmAccess.h instead of
SmmAccess.h first, then clean up SmmAccess.h from
MdeModulePkg
will be the last step.
Below are the packages that has "include <Ppi/SmmAccess.h>"
for
your reference.
* Edk2 repo:
o MdeModulePkg
o OvmfPkg
o UefiCpuPkg
* Edk2Platform repo:
o MinPlatformPkg
o QuarkSocPkg

Thanks,
Marc

-----Original Message-----
From: Gao, Liming
Sent: Thursday, August 1, 2019 4:42 PM
To: devel@edk2.groups.io; Chen, Marc W
<marc.w.chen@...>
Cc: Kinney, Michael D <michael.d.kinney@...>; Ni, Ray
<ray.ni@...>
Subject: RE: [edk2-devel] [PATCH] MdePkg: Add MmAccess
and
MmControl
definition.

Marc:
The change is good. Reviewed-by: Liming Gao
<liming.gao@...>

Besides, I see BZ also mention to remove the one in
MdeModulePkg.
Have you the following patches for the change in
MdeModulePkg?

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io]
On
Behalf
Of Marc W Chen
Sent: Monday, July 29, 2019 12:26 PM
To: devel@edk2.groups.io
Cc: Kinney, Michael D <michael.d.kinney@...>; Gao,
Liming
<liming.gao@...>; Ni, Ray <ray.ni@...>
Subject: [edk2-devel] [PATCH] MdePkg: Add MmAccess and
MmControl
definition.

EFI MmAccess and MmControl PPIs are defined in the PI 1.5
specification.

Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>
Cc: Ray Ni <ray.ni@...>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2023
Signed-off-by: Marc W Chen <marc.w.chen@...>
---
MdePkg/Include/Ppi/MmAccess.h | 155
+++++++++++++++++++++++++++++++++++++++++
MdePkg/Include/Ppi/MmControl.h | 90
++++++++++++++++++++++++
MdePkg/MdePkg.dec | 6 ++
3 files changed, 251 insertions(+) create mode 100644
MdePkg/Include/Ppi/MmAccess.h create mode 100644
MdePkg/Include/Ppi/MmControl.h

diff --git a/MdePkg/Include/Ppi/MmAccess.h
b/MdePkg/Include/Ppi/MmAccess.h new file mode 100644
index
0000000000..636e7288a0
--- /dev/null
+++ b/MdePkg/Include/Ppi/MmAccess.h
@@ -0,0 +1,155 @@
+/** @file
+ EFI MM Access PPI definition.
+
+ This PPI is used to control the visibility of the MMRAM on
+ the
platform.
+ The EFI_PEI_MM_ACCESS_PPI abstracts the location and
+ characteristics
of
MMRAM. The
+ principal functionality found in the memory controller
+ includes the
following:
+ - Exposing the MMRAM to all non-MM agents, or the
"open"
+ state
+ - Shrouding the MMRAM to all but the MM agents, or the
"closed"
+ state
+ - Preserving the system integrity, or "locking" the MMRAM,
+ such that
the
settings cannot be
+ perturbed by either boot service or runtime agents
+
+ Copyright (c) 2019, Intel Corporation. All rights
+ reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Revision Reference:
+ This PPI is introduced in PI Version 1.5.
+
+**/
+
+#ifndef _MM_ACCESS_PPI_H_
+#define _MM_ACCESS_PPI_H_
+
+#define EFI_PEI_MM_ACCESS_PPI_GUID \
+ { 0x268f33a9, 0xcccd, 0x48be, { 0x88, 0x17, 0x86, 0x5, 0x3a,
+0xc3, 0x2e,
0xd6 }}
+
+typedef struct _EFI_PEI_MM_ACCESS_PPI
EFI_PEI_MM_ACCESS_PPI;
+
+/**
+ Opens the MMRAM area to be accessible by a PEIM.
+
+ This function "opens" MMRAM so that it is visible while
not
+ inside of
MM.
The function should
+ return EFI_UNSUPPORTED if the hardware does not
support
+ hiding of
MMRAM. The function
+ should return EFI_DEVICE_ERROR if the MMRAM
configuration
is
locked.
+
+ @param PeiServices An indirect pointer to the PEI
Services
Table
published by the PEI Foundation.
+ @param This The EFI_PEI_MM_ACCESS_PPI
instance.
+ @param DescriptorIndex The region of MMRAM to
Open.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_UNSUPPORTED The system does not
support
opening
and
closing of MMRAM.
+ @retval EFI_DEVICE_ERROR MMRAM cannot be
opened,
perhaps
because it is locked.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_MM_OPEN)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ );
+
+/**
+ Inhibits access to the MMRAM.
+
+ This function "closes" MMRAM so that it is not visible
while
+ outside of
MM.
The function should
+ return EFI_UNSUPPORTED if the hardware does not
support
+ hiding of
MMRAM.
+
+ @param PeiServices An indirect pointer to the PEI
Services
Table
published by the PEI Foundation.
+ @param This The EFI_PEI_MM_ACCESS_PPI
instance.
+ @param DescriptorIndex The region of MMRAM to
Close.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_UNSUPPORTED The system does not
support
opening
and
closing of MMRAM.
+ @retval EFI_DEVICE_ERROR MMRAM cannot be closed.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_MM_CLOSE)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ );
+
+/**
+ This function prohibits access to the MMRAM region. This
+function is
usually
implemented such
+ that it is a write-once operation.
+
+ @param PeiServices An indirect pointer to the PEI
Services
Table
published by the PEI Foundation.
+ @param This The EFI_PEI_MM_ACCESS_PPI
instance.
+ @param DescriptorIndex The region of MMRAM to
Lock.
+
+ @retval EFI_SUCCESS The operation was successful.
+ @retval EFI_UNSUPPORTED The system does not
support
opening
and
closing of MMRAM.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_MM_LOCK)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_ACCESS_PPI *This,
+ IN UINTN DescriptorIndex
+ );
+
+/**
+ Queries the memory controller for the possible regions
that
+will support
MMRAM.
+
+ This function describes the MMRAM regions.
+ This data structure forms the contract between the
MM_ACCESS
and
MM_IPL drivers. There is an
+ ambiguity when any MMRAM region is remapped. For
example,
on
some
chipsets, some MMRAM
+ regions can be initialized at one physical address but is
+ later accessed at
another processor address.
+ There is currently no way for the MM IPL driver to know
that
+ it must use
two different addresses
+ depending on what it is trying to do. As a result, initial
+ configuration and
loading can use the
+ physical address PhysicalStart while MMRAM is open.
However,
+ once
the
region has been
+ closed and needs to be accessed by agents in MM, the
+ CpuStart address
must be used.
+ This PPI publishes the available memory that the chipset
can
+ shroud for
the
use of installing code.
+ These regions serve the dual purpose of describing which
+ regions have
been open, closed, or locked.
+ In addition, these regions may include overlapping
memory
+ ranges,
depending on the chipset
+ implementation. The latter might include a chipset that
+ supports T-SEG,
where memory near the top
+ of the physical DRAM can be allocated for MMRAM too.
+ The key thing to note is that the regions that are described
+ by the PPI
are
a
subset of the capabilities
+ of the hardware.
+
+ @param PeiServices An indirect pointer to the PEI
Services
Table
published by the PEI Foundation.
+ @param This The EFI_PEI_MM_ACCESS_PPI
instance.
+ @param MmramMapSize A pointer to the size, in
bytes,
of
the
MmramMemoryMap buffer. On input, this value is
+ the size of the buffer that
+ is allocated by the caller. On
output, it is the size of the
+ buffer that was returned by
+ the firmware if the buffer
was
large enough, or, if the
+ buffer was too small, the
+ size of the buffer that is
needed to
contain the map.
+ @param MmramMap A pointer to the buffer in
which
firmware
places the current memory map. The map is
+ an array of
+ EFI_MMRAM_DESCRIPTORs
+
+ @retval EFI_SUCCESS The chipset supported the
given
resource.
+ @retval EFI_BUFFER_TOO_SMALL The MmramMap
parameter
was
too
small. The current
+ buffer size needed to hold
+ the memory map is
returned
in
+ MmramMapSize.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_MM_CAPABILITIES)(
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_ACCESS_PPI *This,
+ IN OUT UINTN *MmramMapSize,
+ IN OUT EFI_MMRAM_DESCRIPTOR *MmramMap
+ );
+
+///
+/// EFI MM Access PPI is used to control the visibility of
+the MMRAM on
the
platform.
+/// It abstracts the location and characteristics of MMRAM.
+The platform
should report
+/// all MMRAM via EFI_PEI_MM_ACCESS_PPI. The
expectation
is
that
+the
north bridge or
+/// memory controller would publish this PPI.
+///
+struct _EFI_PEI_MM_ACCESS_PPI {
+ EFI_PEI_MM_OPEN Open;
+ EFI_PEI_MM_CLOSE Close;
+ EFI_PEI_MM_LOCK Lock;
+ EFI_PEI_MM_CAPABILITIES GetCapabilities;
+ BOOLEAN LockState;
+ BOOLEAN OpenState;
+};
+
+extern EFI_GUID gEfiPeiMmAccessPpiGuid;
+
+#endif
diff --git a/MdePkg/Include/Ppi/MmControl.h
b/MdePkg/Include/Ppi/MmControl.h new file mode 100644
index
0000000000..983ed95cd5
--- /dev/null
+++ b/MdePkg/Include/Ppi/MmControl.h
@@ -0,0 +1,90 @@
+/** @file
+ EFI MM Control PPI definition.
+
+ This PPI is used initiate synchronous MMI activations. This
+ PPI could be
published by a processor
+ driver to abstract the MMI IPI or a driver which abstracts
+ the ASIC that
is
supporting the APM port.
+ Because of the possibility of performing MMI IPI
+ transactions, the ability
to
generate this event
+ from a platform chipset agent is an optional capability for
+ both
+ IA-32
and
x64-based systems.
+
+ Copyright (c) 2019, Intel Corporation. All rights
+ reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+ @par Revision Reference:
+ This PPI is introduced in PI Version 1.5.
+
+**/
+
+
+#ifndef _MM_CONTROL_PPI_H_
+#define _MM_CONTROL_PPI_H_
+
+#define EFI_PEI_MM_CONTROL_PPI_GUID \
+ { 0x61c68702, 0x4d7e, 0x4f43, 0x8d, 0xef, 0xa7, 0x43, 0x5,
+0xce, 0x74,
0xc5 }
+
+typedef struct _EFI_PEI_MM_CONTROL_PPI
EFI_PEI_MM_CONTROL_PPI;
+
+/**
+ Invokes PPI activation from the PI PEI environment.
+
+ @param PeiServices An indirect pointer to the PEI
Services
Table
published by the PEI Foundation.
+ @param This The PEI_MM_CONTROL_PPI
instance.
+ @param ArgumentBuffer The value passed to the
MMI
handler.
This
value corresponds to the
+ SwMmiInputValue in the
+ RegisterContext parameter
for
the
Register()
+ function in the
+ EFI_MM_SW_DISPATCH_PROTOCOL
and
in
the Context parameter
+ in the call to the DispatchFunction
+ @param ArgumentBufferSize The size of the data
passed
in
ArgumentBuffer or NULL if ArgumentBuffer is NULL.
+ @param Periodic An optional mechanism to
periodically
repeat
activation.
+ @param ActivationInterval An optional parameter to
repeat
at
this
period
one
+ time or, if the Periodic Boolean is set,
periodically.
+
+ @retval EFI_SUCCESS The MMI has been engendered.
+ @retval EFI_DEVICE_ERROR The timing is unsupported.
+ @retval EFI_INVALID_PARAMETER The activation period is
unsupported.
+ @retval EFI_NOT_STARTED The MM base service has
not
been
initialized.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *EFI_PEI_MM_ACTIVATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_CONTROL_PPI * This,
+ IN OUT INT8 *ArgumentBuffer
OPTIONAL,
+ IN OUT UINTN *ArgumentBufferSize
OPTIONAL,
+ IN BOOLEAN Periodic OPTIONAL,
+ IN UINTN ActivationInterval
OPTIONAL
+ );
+
+/**
+ Clears any system state that was created in response to
the
Trigger()
call.
+
+ @param PeiServices General purpose services
available
to
every
PEIM.
+ @param This The PEI_MM_CONTROL_PPI
instance.
+ @param Periodic Optional parameter to repeat at
this
period
one
+ time or, if the Periodic Boolean is set,
periodically.
+
+ @retval EFI_SUCCESS The MMI has been engendered.
+ @retval EFI_DEVICE_ERROR The source could not be
cleared.
+ @retval EFI_INVALID_PARAMETER The service did not
support
+ the
Periodic
input argument.
+
+**/
+typedef
+EFI_STATUS
+(EFIAPI *PEI_MM_DEACTIVATE) (
+ IN EFI_PEI_SERVICES **PeiServices,
+ IN EFI_PEI_MM_CONTROL_PPI * This,
+ IN BOOLEAN Periodic OPTIONAL
+ );
+
+///
+/// The EFI_PEI_MM_CONTROL_PPI is produced by a PEIM.
It
provides
an
abstraction of the
+/// platform hardware that generates an MMI. There are
often
+I/O ports
that, when accessed, will
+/// generate the MMI. Also, the hardware optionally
supports
+the
periodic
generation of these signals.
+///
+struct _PEI_MM_CONTROL_PPI {
+ PEI_MM_ACTIVATE Trigger;
+ PEI_MM_DEACTIVATE Clear;
+};
+
+extern EFI_GUID gEfiPeiMmControlPpiGuid;
+
+#endif
diff --git a/MdePkg/MdePkg.dec b/MdePkg/MdePkg.dec
index
b382efd578..34e0f39395 100644
--- a/MdePkg/MdePkg.dec
+++ b/MdePkg/MdePkg.dec
@@ -925,6 +925,12 @@
## Include/Ppi/SecHobData.h
gEfiSecHobDataPpiGuid = { 0x3ebdaf20, 0x6667, 0x40d8,
{0xb4,
0xee,
0xf5,
0x99, 0x9a, 0xc1, 0xb7, 0x1f } }

+ ## Include/Ppi/MmAccess.h
+ gEfiPeiMmAccessPpiGuid = { 0x268f33a9, 0xcccd,
0x48be,
{ 0x88,
0x17,
0x86, 0x5, 0x3a, 0xc3, 0x2e, 0xd6 }}
+
+ ## Include/Ppi/MmControl.h
+ gEfiPeiMmControlPpiGuid = { 0x61c68702, 0x4d7e,
0x4f43,
{ 0x8d,
0xef,
0xa7, 0x43, 0x5, 0xce, 0x74, 0xc5 }}
+
#
# PPIs defined in PI 1.7.
#
--
2.16.2.windows.1







[PATCH] SecurityPkg/SecurityPkg.uni: Add missing strings for new PCDs

Wang, Jian J
 

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

Cc: Jiewen Yao <jiewen.yao@...>
Cc: Chao Zhang <chao.b.zhang@...>
Cc: Shenglei Zhang <shenglei.zhang@...>
Signed-off-by: Jian J Wang <jian.j.wang@...>
---
SecurityPkg/SecurityPkg.uni | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

diff --git a/SecurityPkg/SecurityPkg.uni b/SecurityPkg/SecurityPkg.uni
index 9c0c008f9c..14077fbc28 100644
--- a/SecurityPkg/SecurityPkg.uni
+++ b/SecurityPkg/SecurityPkg.uni
@@ -263,3 +263,26 @@
"0x01 - Do not support IdleByPass.<BR>\n"
"0x02 - Support IdleByPass.<BR>\n"
"0xFF - IdleByPass State is not synced with TPM hardware.<BR>"
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdStatusCodeFvVerificationPass_PROMPT #language en-US "Status Code for FV verification pass."
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdStatusCodeFvVerificationPass_HELP #language en-US "Progress Code for FV verification result.\n"
+ " (EFI_SOFTWARE_PEI_MODULE | EFI_SUBCLASS_SPECIFIC | 00A).\n"
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdStatusCodeFvVerificationFail_PROMPT #language en-US "Status Code for FV verification failure."
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdStatusCodeFvVerificationFail_HELP #language en-US "Progress Code for FV verification result.\n"
+ " (EFI_SOFTWARE_PEI_MODULE | EFI_SUBCLASS_SPECIFIC | 00B).\n"
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipOpalPasswordPrompt_PROMPT #language en-US "Skip Opal DXE driver password prompt."
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipOpalPasswordPrompt_HELP #language en-US "Indicates if Opal DXE driver skip password prompt.\n\n"
+ " TRUE - Skip password prompt.\n"
+ " FALSE - Does not skip password prompt.\n"
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipHddPasswordPrompt_PROMPT #language en-US "Skip Hdd Password prompt."
+
+#string STR_gEfiSecurityPkgTokenSpaceGuid_PcdSkipHddPasswordPrompt_HELP #language en-US "Indicates if Hdd Password driver skip password prompt.\n\n"
+ " TRUE - Skip password prompt.\n"
+ " FALSE - Does not skip password prompt.\n"
+
--
2.17.1.windows.2

Re: [PATCH V2] ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

Gao, Zhichao
 

Ping again.

Thanks,
Zhichao

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Gao, Zhichao
Sent: Friday, July 26, 2019 3:47 PM
To: devel@edk2.groups.io
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray <ray.ni@...>;
oleksiyy@...
Subject: FW: [edk2-devel] [PATCH V2]
ShellPkg/UefiShellDriver1CommandsLib: Make array big enough

Ping. Please help to review it.

Thanks,
Zhichao

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Gao, Zhichao
Sent: Monday, July 22, 2019 2:58 PM
To: devel@edk2.groups.io
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray <ray.ni@...>;
Oleksiy <oleksiyy@...>
Subject: [edk2-devel] [PATCH V2] ShellPkg/UefiShellDriver1CommandsLib:
Make array big enough

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

The two CHAR16 array ChildCountStr and DeviceCountStr is defined to hold
the decimal string data of UINTN. The max of UINTN is
18446744073709551615 and it contain 20 characters.
So make their size to 21 CHAR16s to hold the string data with a null-
terminate.
UnicodeValueToStringS regard the value input as INT64, and
21 CHARs is enough to hold the lowest value with minus '-'.
Although the value shouldn't be such big.

Cc: Jaben Carsey <jaben.carsey@...>
Cc: Ray Ni <ray.ni@...>
Cc: Oleksiy <oleksiyy@...>
Signed-off-by: Zhichao Gao <zhichao.gao@...>
---

V2:
Update the copyright.

ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
index 794b737bd1..27cd278cf0 100644
--- a/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
+++ b/ShellPkg/Library/UefiShellDriver1CommandsLib/Drivers.c
@@ -2,7 +2,7 @@
Main file for Drivers shell Driver1 function.

(C) Copyright 2012-2015 Hewlett-Packard Development Company, L.P.<BR>
- Copyright (c) 2010 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2010 - 2019, Intel Corporation. All rights
+ reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -263,8 +263,8 @@ ShellCommandRunDrivers (
EFI_HANDLE *HandleWalker;
UINTN ChildCount;
UINTN DeviceCount;
- CHAR16 ChildCountStr[3];
- CHAR16 DeviceCountStr[3];
+ CHAR16 ChildCountStr[21];
+ CHAR16 DeviceCountStr[21];
CHAR16 *Temp2;
CONST CHAR16 *FullDriverName;
CHAR16 *TruncatedDriverName;
--
2.21.0.windows.1





Re: [PATCH v3 0/2] Add edk2 submodule policy

Wang, Jian J
 

Sorry for the late update for this patch series. Please find v2 review at
https://edk2.groups.io/g/devel/topic/32413655#43457

Regards,
Jian

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Wang, Jian J
Sent: Wednesday, August 14, 2019 4:15 PM
To: devel@edk2.groups.io
Cc: Leif Lindholm <leif.lindholm@...>; Kinney, Michael D
<michael.d.kinney@...>; Gao, Liming <liming.gao@...>
Subject: [edk2-devel] [PATCH v3 0/2] Add edk2 submodule policy

v3 change
[1/2] a. change wording about submodule per Liming's comment.
b. add more steps to do submodule update per Mike's comment.
c. add commands for update of submodule
[2/2] no changes.
https://bugzilla.tianocore.org/show_bug.cgi?id=1910

Cc: Leif Lindholm <leif.lindholm@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>

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

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

--
2.17.1.windows.2


[PATCH v3 2/2] CryptoPkg/OpensslLib: remove clone commands

Wang, Jian J
 

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

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

Cc: Leif Lindholm <leif.lindholm@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>
Signed-off-by: Jian J Wang <jian.j.wang@...>
Reviewed-by: Leif Lindholm <leif.lindholm@...>
---
CryptoPkg/Library/OpensslLib/OpenSSL-HOWTO.txt | 18 ++----------------
1 file changed, 2 insertions(+), 16 deletions(-)

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

=============================================================================
About process_files.pl
--
2.17.1.windows.2

[PATCH v3 1/2] Readme.md: add submodule policy and clone commands

Wang, Jian J
 

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

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

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

Cc: Leif Lindholm <leif.lindholm@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>
Signed-off-by: Jian J Wang <jian.j.wang@...>
Reviewed-by: Leif Lindholm <leif.lindholm@...>
---
Readme.md | 39 +++++++++++++++++++++++++++++++++++++++
1 file changed, 39 insertions(+)

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

[PATCH v3 0/2] Add edk2 submodule policy

Wang, Jian J
 

v3 change
[1/2] a. change wording about submodule per Liming's comment.
b. add more steps to do submodule update per Mike's comment.
c. add commands for update of submodule
[2/2] no changes.
https://bugzilla.tianocore.org/show_bug.cgi?id=1910

Cc: Leif Lindholm <leif.lindholm@...>
Cc: Michael D Kinney <michael.d.kinney@...>
Cc: Liming Gao <liming.gao@...>

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

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

--
2.17.1.windows.2

[PATCH 1/1] MdeModulePkg/DxeIplPeim: Initialize pointer PageMapLevel5Entry

Zhang, Shenglei
 

Initialize PageMapLevel5Entry at the beginning of the function.

This commit will fix a GCC 4.8.5 build failure introduced by commit
b3527dedc3951f061c5a73cb4fb2b0f95f47e08b.

OvmfPkg build failure wtih gcc 4.8.5 still exists at latest edk2 version.
The commit 46f8a6891606746ca8b1e684ac379ce271306dc0 seems not to fix
the build failure completely.

Cc: Dandan Bi <dandan.bi@...>
Cc: Liming Gao <liming.gao@...>
Cc: Hao A Wu <hao.a.wu@...>
Signed-off-by: Shenglei Zhang <shenglei.zhang@...>
---
MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
index 2389f3eb485b..aae80536ac3d 100644
--- a/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
+++ b/MdeModulePkg/Core/DxeIplPeim/X64/VirtualMemory.c
@@ -652,6 +652,8 @@ CreateIdentityMappingPageTables (
UINT64 AddressEncMask;
IA32_CR4 Cr4;

+ PageMapLevel5Entry = NULL;
+
//
// Make sure AddressEncMask is contained to smallest supported address field
//
--
2.18.0.windows.1

Re: [Patch v2 0/6] Add "test then write" mechanism.

Dong, Eric
 

Hi liming,

This is a bug fix. It is required by 201908 stable tag.

Thanks,
Eric

-----Original Message-----
From: Gao, Liming
Sent: Wednesday, August 14, 2019 3:27 PM
To: devel@edk2.groups.io; Dong, Eric <eric.dong@...>;
lersek@...
Cc: Ni, Ray <ray.ni@...>; leif.lindholm@...; afish@...;
Cetola, Stephano <stephano.cetola@...>; Kinney, Michael D
<michael.d.kinney@...>
Subject: RE: [edk2-devel] [Patch v2 0/6] Add "test then write" mechanism.

Eric:
Is this a bug fix or new feature? Dose it catch to this 201908 stable tag?

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Dong, Eric
Sent: Tuesday, August 13, 2019 10:29 AM
To: devel@edk2.groups.io; lersek@...
Cc: Ni, Ray <ray.ni@...>
Subject: Re: [edk2-devel] [Patch v2 0/6] Add "test then write" mechanism.

Hi Laszlo,

Yes, I already checked IA32 build.

As Ray is leaving these days, can you help to review this serial?

Thanks,
Eric

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Laszlo Ersek
Sent: Monday, August 12, 2019 10:15 PM
To: Dong, Eric <eric.dong@...>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>
Subject: Re: [edk2-devel] [Patch v2 0/6] Add "test then write" mechanism.

On 08/12/19 12:31, Eric Dong wrote:
V2 changes:
1. Split CR read/write action in to one discrete patch 2. Keep the
old logic which continue the process if error found.

Below code is current implementation:
if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
CPU_REGISTER_TABLE_WRITE_FIELD (
ProcessorNumber,
Msr,
MSR_IA32_FEATURE_CONTROL,
MSR_IA32_FEATURE_CONTROL_REGISTER,
Bits.Lock,
1
);
}

With below steps, the Bits.Lock bit will lose its value:
1. Trig normal boot, the Bits.Lock is 0. 1 will be added
into the register table and then will set to the MSR.
2. Trig warm reboot, MSR value preserves. After normal boot phase,
the Bits.Lock is 1, so it will not be added into the register
table during the warm reboot phase.
3. Trig S3 then resume, the Bits.Lock change to 0 and Bits.Lock is
not added in register table during normal boot phase. so it's
still 0 after resume.
This is not an expect behavior. The expect result is the value
should always 1 after booting or resuming from S3.

The root cause for this issue is
1. driver bases on current value to insert the "set value action" to
the register table.
2. Some MSRs may reserve their value during warm reboot. So the
insert
action may be skip after warm reboot.

The solution for this issue is:
1. Always add "Test then Set" action for above referred MSRs.
2. Detect current value before set new value. Only set new value when
current value not same as new value.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>

Eric Dong (6):
UefiCpuPkg/RegisterCpuFeaturesLib: Add "Test Then Write" Macros.
UefiCpuPkg/PiSmmCpuDxeSmm: Combine CR read/write action in one
function.
UefiCpuPkg/PiSmmCpuDxeSmm: Supports test then write new value
logic.
UefiCpuPkg/RegisterCpuFeaturesLib: Combine CR read/write action
in
one
function.
UefiCpuPkg/RegisterCpuFeaturesLib: Supports test then write new
value
logic.
UefiCpuPkg/CpuCommonFeaturesLib: Use new macros.

UefiCpuPkg/Include/AcpiCpuData.h | 1 +
.../Include/Library/RegisterCpuFeaturesLib.h | 77 +++++++++-
.../CpuCommonFeaturesLib/CpuCommonFeatures.h | 15 --
.../CpuCommonFeaturesLib.c | 8 +-
.../CpuCommonFeaturesLib/FeatureControl.c | 141 ++++++------------
.../CpuCommonFeaturesLib/MachineCheck.c | 23 ++-
.../CpuFeaturesInitialize.c | 141 ++++++++++++------
.../RegisterCpuFeaturesLib.c | 14 +-
UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 135 +++++++++++----
--
9 files changed, 323 insertions(+), 232 deletions(-)
Please don't forget to build-test this series for IA32 too.

Thanks
Laszlo


Re: [Patch v2 0/6] Add "test then write" mechanism.

Liming Gao
 

Eric:
Is this a bug fix or new feature? Dose it catch to this 201908 stable tag?

Thanks
Liming

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Dong, Eric
Sent: Tuesday, August 13, 2019 10:29 AM
To: devel@edk2.groups.io; lersek@...
Cc: Ni, Ray <ray.ni@...>
Subject: Re: [edk2-devel] [Patch v2 0/6] Add "test then write" mechanism.

Hi Laszlo,

Yes, I already checked IA32 build.

As Ray is leaving these days, can you help to review this serial?

Thanks,
Eric

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Laszlo Ersek
Sent: Monday, August 12, 2019 10:15 PM
To: Dong, Eric <eric.dong@...>; devel@edk2.groups.io
Cc: Ni, Ray <ray.ni@...>
Subject: Re: [edk2-devel] [Patch v2 0/6] Add "test then write" mechanism.

On 08/12/19 12:31, Eric Dong wrote:
V2 changes:
1. Split CR read/write action in to one discrete patch 2. Keep the old
logic which continue the process if error found.

Below code is current implementation:
if (MsrRegister[ProcessorNumber].Bits.Lock == 0) {
CPU_REGISTER_TABLE_WRITE_FIELD (
ProcessorNumber,
Msr,
MSR_IA32_FEATURE_CONTROL,
MSR_IA32_FEATURE_CONTROL_REGISTER,
Bits.Lock,
1
);
}

With below steps, the Bits.Lock bit will lose its value:
1. Trig normal boot, the Bits.Lock is 0. 1 will be added
into the register table and then will set to the MSR.
2. Trig warm reboot, MSR value preserves. After normal boot phase,
the Bits.Lock is 1, so it will not be added into the register
table during the warm reboot phase.
3. Trig S3 then resume, the Bits.Lock change to 0 and Bits.Lock is
not added in register table during normal boot phase. so it's
still 0 after resume.
This is not an expect behavior. The expect result is the value should
always 1 after booting or resuming from S3.

The root cause for this issue is
1. driver bases on current value to insert the "set value action" to
the register table.
2. Some MSRs may reserve their value during warm reboot. So the insert
action may be skip after warm reboot.

The solution for this issue is:
1. Always add "Test then Set" action for above referred MSRs.
2. Detect current value before set new value. Only set new value when
current value not same as new value.

Cc: Ray Ni <ray.ni@...>
Cc: Laszlo Ersek <lersek@...>

Eric Dong (6):
UefiCpuPkg/RegisterCpuFeaturesLib: Add "Test Then Write" Macros.
UefiCpuPkg/PiSmmCpuDxeSmm: Combine CR read/write action in one
function.
UefiCpuPkg/PiSmmCpuDxeSmm: Supports test then write new value
logic.
UefiCpuPkg/RegisterCpuFeaturesLib: Combine CR read/write action in
one
function.
UefiCpuPkg/RegisterCpuFeaturesLib: Supports test then write new value
logic.
UefiCpuPkg/CpuCommonFeaturesLib: Use new macros.

UefiCpuPkg/Include/AcpiCpuData.h | 1 +
.../Include/Library/RegisterCpuFeaturesLib.h | 77 +++++++++-
.../CpuCommonFeaturesLib/CpuCommonFeatures.h | 15 --
.../CpuCommonFeaturesLib.c | 8 +-
.../CpuCommonFeaturesLib/FeatureControl.c | 141 ++++++------------
.../CpuCommonFeaturesLib/MachineCheck.c | 23 ++-
.../CpuFeaturesInitialize.c | 141 ++++++++++++------
.../RegisterCpuFeaturesLib.c | 14 +-
UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 135 +++++++++++------
9 files changed, 323 insertions(+), 232 deletions(-)
Please don't forget to build-test this series for IA32 too.

Thanks
Laszlo


Re: [PATCH V2 00/10] Multiple Controllers Support solution

Eric Jin
 

Liming,

Thank you for notification.

Best Regards
Eric

-----Original Message-----
From: Gao, Liming <liming.gao@...>
Sent: Wednesday, August 14, 2019 12:38 PM
To: Jin, Eric <eric.jin@...>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support solution

Eric:
I push the first 3 patches 82407bd129dca8ec6d96e85f541b0974c8d7e087..1f06aa24c29405f271f514f01c396c2ba19c1370.
Then, the changes in edk2 platform can be submitted. After edk2platform change is ready, I will push the remaining patch set.

Thanks
Liming
-----Original Message-----
From: Jin, Eric
Sent: Monday, August 12, 2019 11:17 PM
To: Gao, Liming <liming.gao@...>; devel@edk2.groups.io
Cc: Jin, Eric <eric.jin@...>
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

Liming,

Thank you for comment.
We will update GetLowestSupportedVersion() API function header to
include Private param when we push the code to repo. Thanks.

Best Regards
Eric

-----Original Message-----
From: Gao, Liming
Sent: Monday, August 12, 2019 5:24 PM
To: Jin, Eric <eric.jin@...>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

That's good information.

In patch 5, GetLowestSupportedVersion() API function header should be
updated to include Private param. I have no other comments.

With this change, Reviewed-by: Liming Gao <liming.gao@...>

///
@@ -193,7 +200,7 @@ GetImageTypeNameString ( **/
UINT32
GetLowestSupportedVersion (
- VOID
+ FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private
)

Thanks
Liming
-----Original Message-----
From: Jin, Eric
Sent: Monday, August 12, 2019 3:14 PM
To: Gao, Liming <liming.gao@...>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers
Support solution

Liming,

The differences between V2 and V1 are listed below.

1) The series is composed of 10 patches in V2 (14 in V1). patch 14 is
merged into patch 4, and patch 11/12/13 are merged into patch 5.
2) Try to fix the issue exposed by ECC.

Btw, the patch of edk2-platform
Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\FmpDeviceLib
to support new APIs is provided in separated patch
https://edk2.groups.io/g/devel/message/45328

Best Regards
Eric

-----Original Message-----
From: Gao, Liming
Sent: Monday, August 12, 2019 1:19 PM
To: devel@edk2.groups.io; Jin, Eric <eric.jin@...>
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers
Support solution

Eric:
Can you list the difference compared to version 1?

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Eric Jin
Sent: Monday, August 12, 2019 9:46 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

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

The patch set is to support drivers that manage multiple controllers
and also provide a firmware update capability to each managed controller.

The following modules are related to Multiple Controllers Support
solution

FmpDevicePkg\FmpDxe\FmpDxe.inf - Driver to manage multiple
controllers
and provide the firmware update capability to each managed controller.
FmpDevicePkg\CapsuleUpdatePolicyDxe\CapsuleUpdatePolicyDxe.inf -
Driver
to produce the Capsule Update Policy Protocol using the services of
the CapsuleUpdatePolicyLib class. The protocol is a private interface
to the FmpDevicePkg
FmpDevicePkg\Library\CapsuleUpdatePolicyLibOnProtocol\CapsuleUpdate
P
o
licyLibOnProtocol.inf -
CapsuleUpdatePolicyLib instance that uses the services of the Capsule
Update Policy Protocol produced by CapsuleUpdatePolicyDxe
FmpDevicePkg\Library\CapsuleUpdatePolicyLibNull\CapsuleUpdatePolicyLi
b
N
ull.inf -
Null CapsuleUpdatePolicyLib instance and the template for platform
specific implementation
FmpDevicePkg\Library\FmpDeviceLibNull\FmpDeviceLibNull.inf - Null
FmpDeviceLib instance and the template for platform specific
implementation

Eric Jin (10):
FmpDevicePkg: Add UEFI_DRIVER support
FmpDevicePkg: Add APIs to FmpDeviceLib
FmpDEvicePkg/FmpDeviceLibNull: Implement new APIs
FmpDevicePkg/FmpDxe: Use new FmpDeviceLib APIs
FmpDevicePkg/FmpDxe: Different variable for each FMP Descriptor
FmpDevicePkg: Add Capsule Update Policy Protocol
FmpDevicePkg/FmpDxe: Improve all DEBUG() messages
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceStorageAccessEnable
FmpDevicePkg/FmpDxe: Remove use of CatSprint()

.../CapsuleUpdatePolicyDxe.c | 173 ++++
.../CapsuleUpdatePolicyDxe.h | 140 +++
.../CapsuleUpdatePolicyDxe.inf | 48 +
.../CapsuleUpdatePolicyDxe.uni | 14 +
.../CapsuleUpdatePolicyDxeExtra.uni | 14 +
FmpDevicePkg/FmpDevicePkg.dec | 43 +-
FmpDevicePkg/FmpDevicePkg.dsc | 64 +-
FmpDevicePkg/FmpDevicePkg.uni | 16 +-
FmpDevicePkg/FmpDxe/DetectTestKey.c | 16 +-
FmpDevicePkg/FmpDxe/FmpDxe.c | 792 ++++++++++------
FmpDevicePkg/FmpDxe/FmpDxe.h | 355 ++++++++
FmpDevicePkg/FmpDxe/FmpDxe.inf | 7 +-
FmpDevicePkg/FmpDxe/FmpDxeLib.inf | 7 +-
FmpDevicePkg/FmpDxe/VariableSupport.c | 844 +++++++++++++-----
FmpDevicePkg/FmpDxe/VariableSupport.h | 135 ++-
FmpDevicePkg/Include/Library/FmpDeviceLib.h | 104 ++-
.../CapsuleUpdatePolicyLibOnProtocol.c | 171 ++++
.../CapsuleUpdatePolicyLibOnProtocol.inf | 40 +
.../CapsuleUpdatePolicyLibOnProtocol.uni | 15 +
.../Library/FmpDeviceLibNull/FmpDeviceLib.c | 93 +-
.../FmpDeviceLibNull/FmpDeviceLibNull.inf | 4 +-
.../FmpPayloadHeaderLibV1.inf | 4 +-
.../Library/FmpPayloadHeaderLib.h | 0
.../Protocol/CapsuleUpdatePolicy.h | 132 +++
24 files changed, 2644 insertions(+), 587 deletions(-) create mode
100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.c
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.h
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.inf
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.uni
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxeExtra.un
i
create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.h create mode
100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.c
create mode 100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.inf
create mode 100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.uni
rename FmpDevicePkg/{Include =>
PrivateInclude}/Library/FmpPayloadHeaderLib.h (100%) create mode
100644 FmpDevicePkg/PrivateInclude/Protocol/CapsuleUpdatePolicy.h

--
2.20.1.windows.1


Re: [RFC] BZ 1837 Enable Windows Firmware Update Driver Tool in Edk2/BaseTools for 201908 stable tag

Eric Jin
 

Hi Leif,

Thank for the valuable suggestion.
In the patch series V2, Sean has been set as author on patch 1/2. Thank you.

Best Regards
Eric

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Leif Lindholm
Sent: Wednesday, August 14, 2019 2:47 AM
To: Gao, Liming <liming.gao@...>
Cc: Jin, Eric <eric.jin@...>; rfc@edk2.groups.io; devel@edk2.groups.io; Feng, Bob C <bob.c.feng@...>; Cetola, Stephano <stephano.cetola@...>; Laszlo Ersek (lersek@...) <lersek@...>; afish@...; Kinney, Michael D <michael.d.kinney@...>
Subject: Re: [edk2-devel] [RFC] BZ 1837 Enable Windows Firmware Update Driver Tool in Edk2/BaseTools for 201908 stable tag

Hi Liming,

This is the other one. As I said, the fact that we are slipping multiple scripts in *just* before freeze is a concern for me.

I have no objection to the code here though.

I would however request that Sean is set as author on patch 1/2 as he was the original author of the script. (This was easy for me to find out because the commit message was exemplary.)

Best Regards,

Leif

On Tue, Aug 13, 2019 at 01:49:24PM +0000, Gao, Liming wrote:
I see this patch was sent a week ago. This is a standalone tool. There is no impact on normal build and boot. I am OK to add it for 201908 stable tag.

Thanks
Liming
From: Jin, Eric
Sent: Monday, August 12, 2019 3:09 PM
To: rfc@edk2.groups.io
Cc: Gao, Liming <liming.gao@...>; Jin, Eric
<eric.jin@...>; devel@edk2.groups.io; Feng, Bob C
<bob.c.feng@...>
Subject: [RFC] BZ 1837 Enable Windows Firmware Update Driver Tool in
Edk2/BaseTools for 201908 stable tag

Hi All,

It is the request to Enable Windows Firmware Update Driver Tool in Edk2/BaseTools and catch the Q3 tag.
The new tool will leverage the edk2-pytool-library to generate the cat/inf file based on the cap file. The output driver package can be trigged in Windows OS to complete capsule update.

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

Patch link: https://edk2.groups.io/g/devel/topic/32780378#44992

Best Regards
Eric

Re: [PATCH V2 00/10] Multiple Controllers Support solution

Liming Gao
 

Eric:
I push the first 3 patches 82407bd129dca8ec6d96e85f541b0974c8d7e087..1f06aa24c29405f271f514f01c396c2ba19c1370.
Then, the changes in edk2 platform can be submitted. After edk2platform change is ready, I will push the remaining patch set.

Thanks
Liming

-----Original Message-----
From: Jin, Eric
Sent: Monday, August 12, 2019 11:17 PM
To: Gao, Liming <liming.gao@...>; devel@edk2.groups.io
Cc: Jin, Eric <eric.jin@...>
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

Liming,

Thank you for comment.
We will update GetLowestSupportedVersion() API function header to include
Private param when we push the code to repo. Thanks.

Best Regards
Eric

-----Original Message-----
From: Gao, Liming
Sent: Monday, August 12, 2019 5:24 PM
To: Jin, Eric <eric.jin@...>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

That's good information.

In patch 5, GetLowestSupportedVersion() API function header should be
updated to include Private param. I have no other comments.

With this change, Reviewed-by: Liming Gao <liming.gao@...>

///
@@ -193,7 +200,7 @@ GetImageTypeNameString ( **/
UINT32
GetLowestSupportedVersion (
- VOID
+ FIRMWARE_MANAGEMENT_PRIVATE_DATA *Private
)

Thanks
Liming
-----Original Message-----
From: Jin, Eric
Sent: Monday, August 12, 2019 3:14 PM
To: Gao, Liming <liming.gao@...>; devel@edk2.groups.io
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

Liming,

The differences between V2 and V1 are listed below.

1) The series is composed of 10 patches in V2 (14 in V1). patch 14 is
merged into patch 4, and patch 11/12/13 are merged into patch 5.
2) Try to fix the issue exposed by ECC.

Btw, the patch of edk2-platform
Platform\Intel\Vlv2TbltDevicePkg\Feature\Capsule\Library\FmpDeviceLib
to support new APIs is provided in separated patch
https://edk2.groups.io/g/devel/message/45328

Best Regards
Eric

-----Original Message-----
From: Gao, Liming
Sent: Monday, August 12, 2019 1:19 PM
To: devel@edk2.groups.io; Jin, Eric <eric.jin@...>
Subject: RE: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

Eric:
Can you list the difference compared to version 1?

Thanks
Liming
-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Eric Jin
Sent: Monday, August 12, 2019 9:46 AM
To: devel@edk2.groups.io
Subject: [edk2-devel] [PATCH V2 00/10] Multiple Controllers Support
solution

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

The patch set is to support drivers that manage multiple controllers
and also provide a firmware update capability to each managed controller.

The following modules are related to Multiple Controllers Support
solution

FmpDevicePkg\FmpDxe\FmpDxe.inf - Driver to manage multiple
controllers
and provide the firmware update capability to each managed controller.
FmpDevicePkg\CapsuleUpdatePolicyDxe\CapsuleUpdatePolicyDxe.inf -
Driver
to produce the Capsule Update Policy Protocol using the services of
the CapsuleUpdatePolicyLib class. The protocol is a private interface
to the FmpDevicePkg
FmpDevicePkg\Library\CapsuleUpdatePolicyLibOnProtocol\CapsuleUpdate
P
o
licyLibOnProtocol.inf -
CapsuleUpdatePolicyLib instance that uses the services of the Capsule
Update Policy Protocol produced by CapsuleUpdatePolicyDxe
FmpDevicePkg\Library\CapsuleUpdatePolicyLibNull\CapsuleUpdatePolicyLi
b
N
ull.inf -
Null CapsuleUpdatePolicyLib instance and the template for platform
specific implementation
FmpDevicePkg\Library\FmpDeviceLibNull\FmpDeviceLibNull.inf - Null
FmpDeviceLib instance and the template for platform specific
implementation

Eric Jin (10):
FmpDevicePkg: Add UEFI_DRIVER support
FmpDevicePkg: Add APIs to FmpDeviceLib
FmpDEvicePkg/FmpDeviceLibNull: Implement new APIs
FmpDevicePkg/FmpDxe: Use new FmpDeviceLib APIs
FmpDevicePkg/FmpDxe: Different variable for each FMP Descriptor
FmpDevicePkg: Add Capsule Update Policy Protocol
FmpDevicePkg/FmpDxe: Improve all DEBUG() messages
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceImageTypeIdGuid
FmpDevicePkg/FmpDxe: Add PcdFmpDeviceStorageAccessEnable
FmpDevicePkg/FmpDxe: Remove use of CatSprint()

.../CapsuleUpdatePolicyDxe.c | 173 ++++
.../CapsuleUpdatePolicyDxe.h | 140 +++
.../CapsuleUpdatePolicyDxe.inf | 48 +
.../CapsuleUpdatePolicyDxe.uni | 14 +
.../CapsuleUpdatePolicyDxeExtra.uni | 14 +
FmpDevicePkg/FmpDevicePkg.dec | 43 +-
FmpDevicePkg/FmpDevicePkg.dsc | 64 +-
FmpDevicePkg/FmpDevicePkg.uni | 16 +-
FmpDevicePkg/FmpDxe/DetectTestKey.c | 16 +-
FmpDevicePkg/FmpDxe/FmpDxe.c | 792 ++++++++++------
FmpDevicePkg/FmpDxe/FmpDxe.h | 355 ++++++++
FmpDevicePkg/FmpDxe/FmpDxe.inf | 7 +-
FmpDevicePkg/FmpDxe/FmpDxeLib.inf | 7 +-
FmpDevicePkg/FmpDxe/VariableSupport.c | 844 +++++++++++++-----
FmpDevicePkg/FmpDxe/VariableSupport.h | 135 ++-
FmpDevicePkg/Include/Library/FmpDeviceLib.h | 104 ++-
.../CapsuleUpdatePolicyLibOnProtocol.c | 171 ++++
.../CapsuleUpdatePolicyLibOnProtocol.inf | 40 +
.../CapsuleUpdatePolicyLibOnProtocol.uni | 15 +
.../Library/FmpDeviceLibNull/FmpDeviceLib.c | 93 +-
.../FmpDeviceLibNull/FmpDeviceLibNull.inf | 4 +-
.../FmpPayloadHeaderLibV1.inf | 4 +-
.../Library/FmpPayloadHeaderLib.h | 0
.../Protocol/CapsuleUpdatePolicy.h | 132 +++
24 files changed, 2644 insertions(+), 587 deletions(-) create mode
100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.c
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.h
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.inf
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxe.uni
create mode 100644
FmpDevicePkg/CapsuleUpdatePolicyDxe/CapsuleUpdatePolicyDxeExtra.un
i
create mode 100644 FmpDevicePkg/FmpDxe/FmpDxe.h create mode
100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.c
create mode 100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.inf
create mode 100644
FmpDevicePkg/Library/CapsuleUpdatePolicyLibOnProtocol/CapsuleUpdate
P
o
licyLibOnProtocol.uni
rename FmpDevicePkg/{Include =>
PrivateInclude}/Library/FmpPayloadHeaderLib.h (100%) create mode
100644 FmpDevicePkg/PrivateInclude/Protocol/CapsuleUpdatePolicy.h

--
2.20.1.windows.1


Re: [PATCH v2] IntelSiliconPkg-Vtd: A new PMR interface

Yao, Jiewen
 

Evelyn
I still saw below EFIAPI missing issue:

+UINTN
+GetGlobalVtdPmrAlignment (
+);

Thank you
Yao jiewen

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of
Evelyn Wang
Sent: Monday, August 12, 2019 12:48 PM
To: devel@edk2.groups.io
Cc: Huang, Jenny <jenny.huang@...>; Shih, More
<more.shih@...>; Ni, Ray <ray.ni@...>; Chaganty, Rangasai V
<rangasai.v.chaganty@...>
Subject: [edk2-devel] [PATCH v2] IntelSiliconPkg-Vtd: A new PMR interface

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

1) IOMMU PMR feature should be generic to support different hardware
architecture. Platforms may request no overlap between PMR regions
and system reserve memory. Create an interface to control PLMR/PHMR
regions. It allows silicon code to adjust PLMR/PHMR region base on
the project needs.

2) DisableDMAr Function Code Optimization
Optimize the flow to follow the VT-d spec requirements.

3) Renamed InitDmar() to InitGlobalVtd()
The oringal function name is misleading

4) A new GetVtdPmrAlignmentLib for silicon code to get
PMR alignment values.

Signed-off-by: Evelyn Wang <iwen.evelyn.wang@...>
Cc: Jenny Huang <jenny.huang@...>
Cc: More Shih <more.shih@...>
Cc: Ray Ni <ray.ni@...>
Cc: Rangasai V Chaganty <rangasai.v.chaganty@...>

---
In V2:
1) Fixed the EFIAPI is missing in library API issue
2) Logs will be provided to make sure the backwards compatibility
3) Replaced BIT0 with EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL
4) Renamed GetVtdPmrAlignmentLib to PeiGetVtdPmrAlignmentLib
5) Fixed the indent in IntelVTdPmrPei.c
6) Follow VTd spec to define the data type of the SYSTEM_MEM_INFO_HOB
Applied few changes coordinately
---
Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
| 30 +++++++++++++++++++++++++++---
Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmr.c
| 4 ++--
Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.c
| 72
+++++++++++++++++++++++++++++++++++++++++++++++++--------------------
---
Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c
| 29 ++++++++++++++++++++++++++---

Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Platfor
mVTdInfoSamplePei.c | 9 +++++----

Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtdP
mrAlignmentLib.c | 166
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
++++++++++++++++++++++++++++++++++++++++++

Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.inf
| 5 ++++-
Silicon/Intel/IntelSiliconPkg/Include/Library/PeiGetVtdPmrAlignmentLib.h
| 31 +++++++++++++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/Include/SysMemInfoHob.h
| 25 +++++++++++++++++++++++++
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
| 11 +++++++++--
Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
| 3 ++-

Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtdP
mrAlignmentLib.inf | 32 ++++++++++++++++++++++++++++++++
12 files changed, 378 insertions(+), 39 deletions(-)

diff --git a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
index 22bf821d2b..699639ba88 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdDxe/VtdReg.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -309,6 +309,8 @@ DisableDmar (
UINTN Index;
UINTN SubIndex;
UINT32 Reg32;
+ UINT32 Status;
+ UINT32 Command;

for (Index = 0; Index < mVtdUnitNumber; Index++) {
DEBUG((DEBUG_INFO, ">>>>>>DisableDmar() for engine [%d] \n",
Index));
@@ -319,9 +321,31 @@ DisableDmar (
FlushWriteBuffer (Index);

//
- // Disable VTd
+ // Disable Dmar
//
- MmioWrite32 (mVtdUnitInformation[Index].VtdUnitBaseAddress +
R_GCMD_REG, B_GMCD_REG_SRTP);
+ //
+ // Set TE (Translation Enable: BIT31) of Global command register to
zero
+ //
+ Reg32 = MmioRead32
(mVtdUnitInformation[Index].VtdUnitBaseAddress + R_GSTS_REG);
+ Status = (Reg32 & 0x96FFFFFF); // Reset the one-shot bits
+ Command = (Status & ~B_GMCD_REG_TE);
+ MmioWrite32 (mVtdUnitInformation[Index].VtdUnitBaseAddress +
R_GCMD_REG, Command);
+
+ //
+ // Poll on TE Status bit of Global status register to become zero
+ //
+ do {
+ Reg32 = MmioRead32
(mVtdUnitInformation[Index].VtdUnitBaseAddress + R_GSTS_REG);
+ } while ((Reg32 & B_GSTS_REG_TE) == B_GSTS_REG_TE);
+
+ //
+ // Set SRTP (Set Root Table Pointer: BIT30) of Global command
register in order to update the root table pointerDisable VTd
+ //
+ Reg32 = MmioRead32
(mVtdUnitInformation[Index].VtdUnitBaseAddress + R_GSTS_REG);
+ Status = (Reg32 & 0x96FFFFFF); // Reset the one-shot bits
+ Command = (Status | B_GMCD_REG_SRTP);
+ MmioWrite32 (mVtdUnitInformation[Index].VtdUnitBaseAddress +
R_GCMD_REG, Command);
+
do {
Reg32 = MmioRead32
(mVtdUnitInformation[Index].VtdUnitBaseAddress + R_GSTS_REG);
} while((Reg32 & B_GSTS_REG_RTPS) == 0);
diff --git
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmr.c
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmr.c
index 37283f0fab..9103e53922 100644
---
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmr.c
+++
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmr.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -294,7 +294,7 @@ SetDmaProtectedRange (
UINTN Index;
EFI_STATUS Status;

- DEBUG ((DEBUG_INFO, "SetDmaProtectedRange(0x%lx) - [0x%x, 0x%x]
[0x%lx, 0x%lx]\n", EngineMask, LowMemoryBase, LowMemoryLength,
HighMemoryBase, HighMemoryLength));
+ DEBUG ((DEBUG_INFO, "SetDmaProtectedRange(0x%lx) - [0x%x, 0x%x]
[0x%016lx, 0x%016lx]\n", EngineMask, LowMemoryBase,
LowMemoryLength, HighMemoryBase, HighMemoryLength));

for (Index = 0; Index < VTdInfo->VTdEngineCount; Index++) {
if ((EngineMask & LShiftU64(1, Index)) == 0) {
diff --git
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.
c
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.
c
index ca099ed71d..faffb0a431 100644
---
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.
c
+++
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.
c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -20,7 +20,7 @@
#include <Ppi/VtdInfo.h>
#include <Ppi/MemoryDiscovered.h>
#include <Ppi/EndOfPeiPhase.h>
-
+#include <SysMemInfoHob.h>
#include "IntelVTdPmrPei.h"

EFI_GUID mVTdInfoGuid = {
@@ -424,38 +424,68 @@ InitDmaProtection (
UINTN MemoryAlignment;
UINTN LowBottom;
UINTN LowTop;
- UINTN HighBottom;
+ UINT64 HighBottom;
UINT64 HighTop;
DMA_BUFFER_INFO *DmaBufferInfo;
VOID *Hob;
EFI_PEI_PPI_DESCRIPTOR *OldDescriptor;
EDKII_IOMMU_PPI *OldIoMmuPpi;
+ SYSTEM_MEM_INFO_HOB *SysMemHob;
+ VOID *SysMemHobPtr;
+
+ SysMemHob = NULL;
+

Hob = GetFirstGuidHob (&mDmaBufferInfoGuid);
DmaBufferInfo = GET_GUID_HOB_DATA(Hob);

- DEBUG ((DEBUG_INFO, " DmaBufferSize : 0x%x\n",
DmaBufferInfo->DmaBufferSize));
+ SysMemHobPtr = GetFirstGuidHob (&gSysMemInfoDataHobGuid);
+
+ if (SysMemHobPtr == NULL) {
+ //
+ // Calcuate the PMR memory alignment
+ //
+ LowMemoryAlignment = GetLowMemoryAlignment (VTdInfo,
VTdInfo->EngineMask);
+ HighMemoryAlignment = GetHighMemoryAlignment (VTdInfo,
VTdInfo->EngineMask);
+ if (LowMemoryAlignment < HighMemoryAlignment) {
+ MemoryAlignment = (UINTN)HighMemoryAlignment;
+ } else {
+ MemoryAlignment = LowMemoryAlignment;
+ }
+ ASSERT (DmaBufferInfo->DmaBufferSize ==
ALIGN_VALUE(DmaBufferInfo->DmaBufferSize, MemoryAlignment));
+
+ //
+ // Allocate memory for DMA buffer
+ //
+ DmaBufferInfo->DmaBufferBase = (UINTN)AllocateAlignedPages
(EFI_SIZE_TO_PAGES(DmaBufferInfo->DmaBufferSize), MemoryAlignment);
+ ASSERT (DmaBufferInfo->DmaBufferBase != 0);
+ if (DmaBufferInfo->DmaBufferBase == 0) {
+ DEBUG ((DEBUG_INFO, " InitDmaProtection : OutOfResource\n"));
+ return EFI_OUT_OF_RESOURCES;
+ }

- LowMemoryAlignment = GetLowMemoryAlignment (VTdInfo,
VTdInfo->EngineMask);
- HighMemoryAlignment = GetHighMemoryAlignment (VTdInfo,
VTdInfo->EngineMask);
- if (LowMemoryAlignment < HighMemoryAlignment) {
- MemoryAlignment = (UINTN)HighMemoryAlignment;
+ DmaBufferInfo->DmaBufferCurrentTop =
DmaBufferInfo->DmaBufferBase + DmaBufferInfo->DmaBufferSize;
+ DmaBufferInfo->DmaBufferCurrentBottom =
DmaBufferInfo->DmaBufferBase;
+ LowBottom = 0;
+ LowTop = DmaBufferInfo->DmaBufferBase;
+ HighBottom = DmaBufferInfo->DmaBufferBase +
DmaBufferInfo->DmaBufferSize;
+ HighTop = LShiftU64 (1, VTdInfo->HostAddressWidth + 1);
} else {
- MemoryAlignment = LowMemoryAlignment;
- }
- ASSERT (DmaBufferInfo->DmaBufferSize ==
ALIGN_VALUE(DmaBufferInfo->DmaBufferSize, MemoryAlignment));
- DmaBufferInfo->DmaBufferBase = (UINTN)AllocateAlignedPages
(EFI_SIZE_TO_PAGES(DmaBufferInfo->DmaBufferSize), MemoryAlignment);
- ASSERT (DmaBufferInfo->DmaBufferBase != 0);
- if (DmaBufferInfo->DmaBufferBase == 0) {
- DEBUG ((DEBUG_INFO, " InitDmaProtection : OutOfResource\n"));
- return EFI_OUT_OF_RESOURCES;
+
+ //
+ // Get the PMR ranges information for the system hob
+ //
+ SysMemHob = GET_GUID_HOB_DATA (SysMemHobPtr);
+ DmaBufferInfo->DmaBufferBase = SysMemHob->ProtectedLowLimit;
+ LowBottom = SysMemHob->ProtectedLowBase;
+ LowTop = SysMemHob->ProtectedLowLimit;
+ HighBottom = SysMemHob->ProtectedHighBase;
+ HighTop = SysMemHob->ProtectedHighLimit;
}

+ DEBUG ((DEBUG_INFO, " DmaBufferSize : 0x%x\n",
DmaBufferInfo->DmaBufferSize));
DEBUG ((DEBUG_INFO, " DmaBufferBase : 0x%x\n",
DmaBufferInfo->DmaBufferBase));

- DmaBufferInfo->DmaBufferCurrentTop =
DmaBufferInfo->DmaBufferBase + DmaBufferInfo->DmaBufferSize;
- DmaBufferInfo->DmaBufferCurrentBottom =
DmaBufferInfo->DmaBufferBase;
-
//
// (Re)Install PPI.
//
@@ -472,10 +502,6 @@ InitDmaProtection (
}
ASSERT_EFI_ERROR (Status);

- LowBottom = 0;
- LowTop = DmaBufferInfo->DmaBufferBase;
- HighBottom = DmaBufferInfo->DmaBufferBase +
DmaBufferInfo->DmaBufferSize;
- HighTop = LShiftU64 (1, VTdInfo->HostAddressWidth + 1);

Status = SetDmaProtectedRange (
VTdInfo,
diff --git
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c
index 4774a2ae5b..c9669426aa 100644
--- a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c
+++ b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/VtdReg.c
@@ -1,6 +1,6 @@
/** @file

- Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>

SPDX-License-Identifier: BSD-2-Clause-Patent

@@ -197,6 +197,8 @@ DisableDmar (
)
{
UINT32 Reg32;
+ UINT32 Status;
+ UINT32 Command;

DEBUG((DEBUG_INFO, ">>>>>>DisableDmar() for engine [%x] \n",
VtdUnitBaseAddress));

@@ -206,9 +208,30 @@ DisableDmar (
FlushWriteBuffer (VtdUnitBaseAddress);

//
- // Disable VTd
+ // Disable Dmar
//
- MmioWrite32 (VtdUnitBaseAddress + R_GCMD_REG,
B_GMCD_REG_SRTP);
+ //
+ // Set TE (Translation Enable: BIT31) of Global command register to zero
+ //
+ Reg32 = MmioRead32 (VtdUnitBaseAddress + R_GSTS_REG);
+ Status = (Reg32 & 0x96FFFFFF); // Reset the one-shot bits
+ Command = (Status & ~B_GMCD_REG_TE);
+ MmioWrite32 (VtdUnitBaseAddress + R_GCMD_REG, Command);
+
+ //
+ // Poll on TE Status bit of Global status register to become zero
+ //
+ do {
+ Reg32 = MmioRead32 (VtdUnitBaseAddress + R_GSTS_REG);
+ } while ((Reg32 & B_GSTS_REG_TE) == B_GSTS_REG_TE);
+
+ //
+ // Set SRTP (Set Root Table Pointer: BIT30) of Global command register
in order to update the root table pointerDisable VTd
+ //
+ Reg32 = MmioRead32 (VtdUnitBaseAddress + R_GSTS_REG);
+ Status = (Reg32 & 0x96FFFFFF); // Reset the one-shot bits
+ Command = (Status | B_GMCD_REG_SRTP);
+ MmioWrite32 (VtdUnitBaseAddress + R_GCMD_REG, Command);
do {
Reg32 = MmioRead32 (VtdUnitBaseAddress + R_GSTS_REG);
} while((Reg32 & B_GSTS_REG_RTPS) == 0);
diff --git
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Platf
ormVTdInfoSamplePei.c
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Platf
ormVTdInfoSamplePei.c
index 3698c3d3f1..6f6c14f7a9 100644
---
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Platf
ormVTdInfoSamplePei.c
+++
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/PlatformVTdInfoSamplePei/Platf
ormVTdInfoSamplePei.c
@@ -1,7 +1,7 @@
/** @file
Platform VTd Info Sample PEI driver.

- Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+ Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
SPDX-License-Identifier: BSD-2-Clause-Patent

**/
@@ -166,15 +166,16 @@ EFI_PEI_PPI_DESCRIPTOR
mPlatformVTdNoIgdInfoSampleDesc = {

/**
Initialize VTd register.
+ Initialize the VTd hardware unit which has INCLUDE_PCI_ALL set
**/
VOID
-InitDmar (
+InitGlobalVtd (
VOID
)
{
UINT32 MchBar;

- DEBUG ((DEBUG_INFO, "InitDmar\n"));
+ DEBUG ((DEBUG_INFO, "InitGlobalVtd\n"));

MchBar = PciRead32 (PCI_LIB_ADDRESS(0, 0, 0, R_SA_MCHBAR)) &
~BIT0;
PciWrite32 (PCI_LIB_ADDRESS(0, 0, 0, R_SA_MCHBAR), 0xFED10000 |
BIT0);
@@ -346,7 +347,7 @@ PlatformVTdInfoSampleInitialize (
DEBUG ((DEBUG_INFO, "SiliconInitialized - %x\n", SiliconInitialized));
if (!SiliconInitialized) {
Status = PeiServicesNotifyPpi (&mSiliconInitializedNotifyList);
- InitDmar ();
+ InitGlobalVtd ();

Status = PeiServicesInstallPpi (&mPlatformVTdNoIgdInfoSampleDesc);
ASSERT_EFI_ERROR (Status);
diff --git
a/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.c
b/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.c
new file mode 100644
index 0000000000..5a205f29e0
--- /dev/null
+++
b/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.c
@@ -0,0 +1,166 @@
+/** @file
+ Library to get Global VTd PMR alignment information.
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+#include <PiPei.h>
+#include <Library/BaseLib.h>
+#include <Library/BaseMemoryLib.h>
+#include <Library/IoLib.h>
+#include <Library/DebugLib.h>
+#include <Library/PeiGetVtdPmrAlignmentLib.h>
+#include <Library/PeiServicesLib.h>
+#include <IndustryStandard/DmaRemappingReportingTable.h>
+#include <IndustryStandard/VTd.h>
+
+typedef union {
+ struct {
+ UINT32 Low;
+ UINT32 High;
+ } Data32;
+ UINT64 Data;
+} UINT64_STRUCT;
+
+/**
+ Get protected low memory alignment.
+
+ @param HostAddressWidth The host address width.
+ @param VtdUnitBaseAddress The base address of the VTd engine.
+
+ @return protected low memory alignment.
+**/
+UINT32
+EFIAPI
+GetGlobalVTdPlmrAlignment (
+ IN UINT8 HostAddressWidth,
+ IN UINTN VtdUnitBaseAddress
+ )
+{
+ UINT32 Data32;
+
+ MmioWrite32 (VtdUnitBaseAddress + R_PMEN_LOW_BASE_REG,
0xFFFFFFFF);
+ Data32 = MmioRead32 (VtdUnitBaseAddress +
R_PMEN_LOW_BASE_REG);
+ Data32 = ~Data32 + 1;
+
+ return Data32;
+}
+
+/**
+ Get protected high memory alignment.
+
+ @param HostAddressWidth The host address width.
+ @param VtdUnitBaseAddress The base address of the VTd engine.
+
+ @return protected high memory alignment.
+**/
+UINT64_STRUCT
+EFIAPI
+GetGlobalVTdPhmrAlignment (
+ IN UINT8 HostAddressWidth,
+ IN UINTN VtdUnitBaseAddress
+ )
+{
+ UINT64_STRUCT Data64;
+
+ MmioWrite64 (VtdUnitBaseAddress + R_PMEN_HIGH_BASE_REG,
0xFFFFFFFFFFFFFFFF);
+ Data64.Data = MmioRead64 (VtdUnitBaseAddress +
R_PMEN_HIGH_BASE_REG);
+ Data64.Data = ~Data64.Data + 1;
+ Data64.Data = Data64.Data & (LShiftU64 (1, HostAddressWidth) - 1);
+
+ return Data64;
+}
+
+/**
+ Get Global VT-d Protected Memory Aignment.
+
+ @return protected high memory alignment.
+**/
+UINTN
+GetGlobalVtdPmrAlignment (
+)
+{
+ UINT32 LowMemoryAlignment;
+ UINT64_STRUCT HighMemoryAlignment;
+ UINTN MemoryAlignment;
+ UINT32 GlobalVTdBaseAddress;
+ EFI_STATUS Status;
+ UINTN VtdIndex;
+ EFI_ACPI_DMAR_STRUCTURE_HEADER *DmarHeader;
+ EFI_ACPI_DMAR_DRHD_HEADER *DrhdHeader;
+ EFI_ACPI_DMAR_HEADER *AcpiDmarTable;
+
+ //
+ // Initialization
+ //
+ GlobalVTdBaseAddress = 0xFFFFFFFF;
+ LowMemoryAlignment = 0;
+ HighMemoryAlignment.Data = 0;
+ MemoryAlignment = 0;
+ Status = EFI_UNSUPPORTED;
+ VtdIndex = 0;
+ DmarHeader = NULL;
+ DrhdHeader = NULL;
+ AcpiDmarTable = NULL;
+
+ //
+ // Fatch the PEI DMAR ACPU Table that created and installed in
PlatformVTdInfoSamplePei.c
+ //
+ Status = PeiServicesLocatePpi (
+ &gEdkiiVTdInfoPpiGuid,
+ 0,
+ NULL,
+ (VOID **)&AcpiDmarTable
+ );
+ if (EFI_ERROR (Status)) {
+
+ DEBUG ((DEBUG_ERROR, "PeiServicesLocatePpi gEdkiiVTdInfoPpiGuid
failed\n"));
+ Status = EFI_NOT_FOUND;
+ MemoryAlignment = SIZE_1MB;
+
+ } else {
+
+ //
+ // Seatch the DRHD structure with INCLUDE_PCI_ALL flag Set -> Global
VT-d
+ //
+ DmarHeader = (EFI_ACPI_DMAR_STRUCTURE_HEADER
*)((UINTN)(AcpiDmarTable + 1));
+ while ((UINTN)DmarHeader < (UINTN)AcpiDmarTable +
AcpiDmarTable->Header.Length) {
+ switch (DmarHeader->Type) {
+ case EFI_ACPI_DMAR_TYPE_DRHD:
+ DrhdHeader = (EFI_ACPI_DMAR_DRHD_HEADER *) DmarHeader;
+ if ((DrhdHeader->Flags &
EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL) ==
EFI_ACPI_DMAR_DRHD_FLAGS_INCLUDE_PCI_ALL) {
+ GlobalVTdBaseAddress =
(UINT32)DrhdHeader->RegisterBaseAddress;
+ DEBUG ((DEBUG_INFO," GlobalVTdBaseAddress: %x\n",
GlobalVTdBaseAddress));
+ }
+ VtdIndex++;
+
+ break;
+
+ default:
+ break;
+ }
+ DmarHeader = (EFI_ACPI_DMAR_STRUCTURE_HEADER
*)((UINTN)DmarHeader + DmarHeader->Length);
+ }
+
+ if (GlobalVTdBaseAddress == 0xFFFFFFFF) {
+
+ DEBUG ((DEBUG_ERROR, "Error! Please set INCLUDE_PCI_ALL flag
to your Global VT-d\n"));
+ MemoryAlignment = SIZE_1MB;
+
+ } else {
+ //
+ // Get the alignment information from VT-d register
+ //
+ LowMemoryAlignment = GetGlobalVTdPlmrAlignment
(AcpiDmarTable->HostAddressWidth, GlobalVTdBaseAddress);
+ HighMemoryAlignment = GetGlobalVTdPhmrAlignment
(AcpiDmarTable->HostAddressWidth, GlobalVTdBaseAddress);
+ if (LowMemoryAlignment < HighMemoryAlignment.Data) {
+ MemoryAlignment = (UINTN)HighMemoryAlignment.Data;
+ } else {
+ MemoryAlignment = LowMemoryAlignment;
+ }
+ }
+ }
+
+ return MemoryAlignment;
+}
diff --git
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.i
nf
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.i
nf
index 39b914cd00..2f6599d818 100644
---
a/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.i
nf
+++
b/Silicon/Intel/IntelSiliconPkg/Feature/VTd/IntelVTdPmrPei/IntelVTdPmrPei.i
nf
@@ -4,7 +4,7 @@
# This driver initializes VTd engine based upon EDKII_VTD_INFO_PPI
# and provide DMA protection in PEI.
#
-# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -40,6 +40,9 @@
IoLib
CacheMaintenanceLib

+[Guids]
+ gSysMemInfoDataHobGuid ## CONSUMES
+
[Ppis]
gEdkiiIoMmuPpiGuid ## PRODUCES
gEdkiiVTdInfoPpiGuid ## CONSUMES
diff --git
a/Silicon/Intel/IntelSiliconPkg/Include/Library/PeiGetVtdPmrAlignmentLib.h
b/Silicon/Intel/IntelSiliconPkg/Include/Library/PeiGetVtdPmrAlignmentLib.h
new file mode 100644
index 0000000000..537d013783
--- /dev/null
+++
b/Silicon/Intel/IntelSiliconPkg/Include/Library/PeiGetVtdPmrAlignmentLib.h
@@ -0,0 +1,31 @@
+/** @file
+ Get Global VTd PMR alignment information library.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ This program and the accompanying materials
+ are licensed and made available under the terms and conditions of the
BSD License
+ which accompanies this distribution. The full text of the license may be
found at
+ http://opensource.org/licenses/bsd-license.php
+
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS"
BASIS,
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER
EXPRESS OR IMPLIED.
+
+**/
+
+
+#ifndef __GET_VTD_PMR_ALIGN_LIB_H__
+#define __GET_VTD_PMR_ALIGN_LIB_H__
+#include <Library/BaseLib.h>
+
+/**
+ Get Global VT-d Protected Memory alignment.
+
+
+ @return protected high memory alignment.
+**/
+
+UINTN
+GetGlobalVtdPmrAlignment (
+);
+
+#endif // __GET_VTD_PMR_ALIGN_LIB_H__
diff --git a/Silicon/Intel/IntelSiliconPkg/Include/SysMemInfoHob.h
b/Silicon/Intel/IntelSiliconPkg/Include/SysMemInfoHob.h
new file mode 100644
index 0000000000..10153ac372
--- /dev/null
+++ b/Silicon/Intel/IntelSiliconPkg/Include/SysMemInfoHob.h
@@ -0,0 +1,25 @@
+/** @file
+ The definition for VTD System information Hob.
+
+ Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+ SPDX-License-Identifier: BSD-2-Clause-Patent
+
+**/
+
+
+#ifndef _SYS_MEM_INFO_HOB_H_
+#define _SYS_MEM_INFO_HOB_H_
+
+// Platforms may request no overlap between PMR regions
+// and system reserve memory. Create an interface to control PLMR/PHMR
+// regions. It allows silicon code to adjust PLMR/PHMR region base on
+// the project needs.
+typedef struct {
+ UINT32 ProtectedLowBase;
+ UINT32 ProtectedLowLimit;
+ UINT64 ProtectedHighBase;
+ UINT64 ProtectedHighLimit;
+} SYSTEM_MEM_INFO_HOB;
+
+#endif // _SYS_MEM_INFO_HOB_H_
+
diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
index fe5bfa0dc6..f1473ac60a 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dec
@@ -3,7 +3,7 @@
#
# This package provides common open source Intel silicon modules.
#
-# Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
##
@@ -18,10 +18,14 @@
Include

[LibraryClasses.IA32, LibraryClasses.X64]
- ## @libraryclass Provides services to access Microcode region on flash
device.
+ ## @libraryclass Provides services to access Microcode region on flash
device.
#
MicrocodeFlashAccessLib|Include/Library/MicrocodeFlashAccessLib.h

+ ## @libraryclass Provides services to access VTd PMR information
+ #
+ PeiGetVtdPmrAlignmentLib|Include/Library/PeiGetVtdPmrAlignmentLib.h
+
[Guids]
## GUID for Package token space
# {A9F8D54E-1107-4F0A-ADD0-4587E7A4A735}
@@ -35,6 +39,9 @@
## Include/Guid/MicrocodeFmp.h
gMicrocodeFmpImageTypeIdGuid = { 0x96d4fdcd, 0x1502, 0x424d,
{ 0x9d, 0x4c, 0x9b, 0x12, 0xd2, 0xdc, 0xae, 0x5c } }

+ ## HOB GUID to get memory information after MRC is done. The hob
data will be used to set the PMR ranges
+ gSysMemInfoDataHobGuid = {0x6fb61645, 0xf168, 0x46be, { 0x80, 0xec,
0xb5, 0x02, 0x38, 0x5e, 0xe7, 0xe7 } }
+
[Ppis]
gEdkiiVTdInfoPpiGuid = { 0x8a59fcb3, 0xf191, 0x400c, { 0x97, 0x67, 0x67,
0xaf, 0x2b, 0x25, 0x68, 0x4a } }

diff --git a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
index 58b5b656ef..352d1e2b6d 100644
--- a/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
+++ b/Silicon/Intel/IntelSiliconPkg/IntelSiliconPkg.dsc
@@ -1,7 +1,7 @@
## @file
# This package provides common open source Intel silicon modules.
#
-# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
+# Copyright (c) 2017 - 2019, Intel Corporation. All rights reserved.<BR>
#
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
@@ -34,6 +34,7 @@

SerialPortLib|MdePkg/Library/BaseSerialPortLibNull/BaseSerialPortLibNull.in
f

CacheMaintenanceLib|MdePkg/Library/BaseCacheMaintenanceLib/BaseCac
heMaintenanceLib.inf

MicrocodeFlashAccessLib|IntelSiliconPkg/Feature/Capsule/Library/Microcod
eFlashAccessLibNull/MicrocodeFlashAccessLibNull.inf
+
PeiGetVtdPmrAlignmentLib|IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentL
ib/PeiGetVtdPmrAlignmentLib.inf

[LibraryClasses.common.PEIM]
PeimEntryPoint|MdePkg/Library/PeimEntryPoint/PeimEntryPoint.inf
diff --git
a/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.inf
b/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.inf
new file mode 100644
index 0000000000..ebb2cc2a7f
--- /dev/null
+++
b/Silicon/Intel/IntelSiliconPkg/Library/PeiGetVtdPmrAlignmentLib/PeiGetVtd
PmrAlignmentLib.inf
@@ -0,0 +1,32 @@
+## @file
+# Component INF file for the GetVtdPmrAlignment library.
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+##
+
+[Defines]
+INF_VERSION = 0x00010017
+BASE_NAME = PeiGetVtdPmrAlignmentLib
+FILE_GUID = 0332BE93-0547-4D87-A7FA-0D9D76C53187
+MODULE_TYPE = BASE
+LIBRARY_CLASS = PeiGetVtdPmrAlignmentLib
+
+[Packages]
+MdePkg/MdePkg.dec
+IntelSiliconPkg/IntelSiliconPkg.dec
+
+[Sources]
+PeiGetVtdPmrAlignmentLib.c
+
+[LibraryClasses]
+DebugLib
+BaseMemoryLib
+MemoryAllocationLib
+BaseLib
+PeiServicesLib
+
+[Ppis]
+gEdkiiVTdInfoPpiGuid ## CONSUMES
--
2.16.2.windows.1


Re: [Patch 1/1 V2] BaseTools: Move buildoptions.py to Common folder

Liming Gao
 

Reviewed-by: Liming Gao <liming.gao@...>

-----Original Message-----
From: Feng, Bob C
Sent: Tuesday, August 13, 2019 5:49 PM
To: edk2-devel@...; devel@edk2.groups.io
Cc: Gao, Liming <liming.gao@...>; Feng, Bob C <bob.c.feng@...>
Subject: [Patch 1/1 V2] BaseTools: Move buildoptions.py to Common folder

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

buildoptions is used by build.py and TargetTxtClassObj.py
Move buildoptions.py to Common folder so that
build tool and ECC tool work fine.

Cc: Liming Gao <liming.gao@...>
Signed-off-by: Bob Feng <bob.c.feng@...>
---
V2: Add BZ link.

BaseTools/Source/Python/Common/TargetTxtClassObject.py | 2 +-
BaseTools/Source/Python/{build => Common}/buildoptions.py | 0
BaseTools/Source/Python/build/build.py | 2 +-
3 files changed, 2 insertions(+), 2 deletions(-)
rename BaseTools/Source/Python/{build => Common}/buildoptions.py
(100%)

diff --git a/BaseTools/Source/Python/Common/TargetTxtClassObject.py
b/BaseTools/Source/Python/Common/TargetTxtClassObject.py
index 16cc75ccb7c8..723b9405bf8f 100644
--- a/BaseTools/Source/Python/Common/TargetTxtClassObject.py
+++ b/BaseTools/Source/Python/Common/TargetTxtClassObject.py
@@ -8,11 +8,11 @@
##
# Import Modules
#
from __future__ import print_function
from __future__ import absolute_import
-from buildoptions import BuildOption,BuildTarget
+from Common.buildoptions import BuildOption,BuildTarget
import Common.GlobalData as GlobalData
import Common.LongFilePathOs as os
from . import EdkLogger
from . import DataType
from .BuildToolError import *
diff --git a/BaseTools/Source/Python/build/buildoptions.py
b/BaseTools/Source/Python/Common/buildoptions.py
similarity index 100%
rename from BaseTools/Source/Python/build/buildoptions.py
rename to BaseTools/Source/Python/Common/buildoptions.py
diff --git a/BaseTools/Source/Python/build/build.py
b/BaseTools/Source/Python/build/build.py
index 4de3f43c2710..4bfa54666bd5 100644
--- a/BaseTools/Source/Python/build/build.py
+++ b/BaseTools/Source/Python/build/build.py
@@ -24,11 +24,11 @@ import traceback
import multiprocessing
from threading import Thread,Event,BoundedSemaphore
import threading
from subprocess import Popen,PIPE
from collections import OrderedDict, defaultdict
-from buildoptions import BuildOption,BuildTarget
+from Common.buildoptions import BuildOption,BuildTarget
from AutoGen.PlatformAutoGen import PlatformAutoGen
from AutoGen.ModuleAutoGen import ModuleAutoGen
from AutoGen.WorkspaceAutoGen import WorkspaceAutoGen
from AutoGen.AutoGenWorker import
AutoGenWorkerInProcess,AutoGenManager,\
LogAgent
--
2.18.0.windows.1

Re: [RFC] BZ 2067 BaseTools/Scripts: Add GetUtcDateTime.py for edk2-stable201908 stable tag.

Chiu, Chasel
 

Hi Leif,

Thanks for the valuable feedbacks and suggestions.
I will re-write script and re-send code review.

Regards,
Chasel

-----Original Message-----
From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of Leif
Lindholm
Sent: Wednesday, August 14, 2019 2:30 AM
To: Gao, Liming <liming.gao@...>
Cc: Chiu, Chasel <chasel.chiu@...>; rfc@edk2.groups.io; Feng, Bob C
<bob.c.feng@...>; devel@edk2.groups.io; Cetola, Stephano
<stephano.cetola@...>; Laszlo Ersek (lersek@...)
<lersek@...>; afish@...; Kinney, Michael D
<michael.d.kinney@...>
Subject: Re: [edk2-devel] [RFC] BZ 2067 BaseTools/Scripts: Add
GetUtcDateTime.py for edk2-stable201908 stable tag.

I am not fundamentally opposed to merging a simple script that does not affect
other code in the tree.

*But* the fact that we have multiple occurrences of this this time around *is*
a bit of a concern for me. Yes, they won't affect the workings of anything else
as part of the release. But they will not have had any chance to be actually used
by others.

For this particular script, I am also not very keen on the implementation. It
manually parses the command line and prints usage instead of using argparse.
And it contains the sys.exit(Main()) antipattern, which does not play well with
Python3 asynchronous i/o (and hence is a bad habit to get into).

Since this script is truly trivial, I am OK for it to be included *if* it is rewritten
using argparse and not calling sys.exit.

Best Regards,

Leif

On Tue, Aug 13, 2019 at 01:42:23PM +0000, Gao, Liming wrote:
This is a small helper script. I am OK to add it for edk2-stable201908 stable
tag.

Thanks
Liming
From: Chiu, Chasel
Sent: Monday, August 12, 2019 3:45 PM
To: rfc@edk2.groups.io
Cc: Gao, Liming <liming.gao@...>; Feng, Bob C
<bob.c.feng@...>; devel@edk2.groups.io
Subject: [RFC] BZ 2067 BaseTools/Scripts: Add GetUtcDateTime.py for
edk2-stable201908 stable tag.


Hello,

I would like to add below simple script to 201908 stable tag, review was sent
on August 8th:

A script that can return UTC date and time in ascii format which is convenient
for patching build time information in any binary.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2067
Patch: https://edk2.groups.io/g/devel/topic/32797962#45177

Thanks!
Chasel

Re: [PATCH 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Remove the variable "Index"

Gao, Zhichao
 

Reviewed-by: Zhichao Gao <zhichao.gao@...>

Thanks,
Zhichao

-----Original Message-----
From: Zhang, Shenglei
Sent: Wednesday, August 14, 2019 11:07 AM
To: devel@edk2.groups.io
Cc: Carsey, Jaben <jaben.carsey@...>; Ni, Ray <ray.ni@...>;
Gao, Zhichao <zhichao.gao@...>
Subject: [PATCH 1/1] ShellPkg/UefiShellAcpiViewCommandLib: Remove the
variable "Index"

In IortParser.c ,the variable Index is set but not used in function
DumpIortNodeNamedComponent. This will cause build failure when building
ShellPkg with GCC.

Cc: Jaben Carsey <jaben.carsey@...>
Cc: Ray Ni <ray.ni@...>
Cc: Zhichao Gao <zhichao.gao@...>
Signed-off-by: Shenglei Zhang <shenglei.zhang@...>
---
.../UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c | 2 --
1 file changed, 2 deletions(-)

diff --git
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
index 8912d415a755..f1cdb9ac01d8 100644
---
a/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortParser.c
+++ b/ShellPkg/Library/UefiShellAcpiViewCommandLib/Parsers/Iort/IortPars
+++ er.c
@@ -472,7 +472,6 @@ DumpIortNodeNamedComponent (
)
{
UINT32 Offset;
- UINT32 Index;

Offset = ParseAcpi (
TRUE,
@@ -485,7 +484,6 @@ DumpIortNodeNamedComponent (

// Estimate the Device Name length
PrintFieldName (2, L"Device Object Name");
- Index = 0;

while ((*(Ptr + Offset) != 0) &&
(Offset < Length)) {
--
2.18.0.windows.1

Re: [Patch] Vlb2TbltDevicePkg: Add acpiview and IPv6 shell commands

Gary Lin
 

On Tue, Aug 13, 2019 at 11:17:08AM -0700, Kinney, Michael D wrote:
Update the integrated UEFI Shell to include the acpiview,
ping6, and ifconfig6 commands.
Those commands are useful. Thanks for the patch.

Reviewed-by: Gary Lin <glin@...>

Cc: Zailiang Sun <zailiang.sun@...>
Cc: Gary Lin <glin@...>
Signed-off-by: Michael D Kinney <michael.d.kinney@...>
---
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc | 2 ++
Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc | 2 ++
2 files changed, 4 insertions(+)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 463b952e65..3991a91ae1 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -1145,6 +1145,8 @@ [Components.IA32]
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index ee18b45c97..e0ef98e4e3 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -1160,6 +1160,8 @@ [Components.X64]
NULL|ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellInstall1CommandsLib/UefiShellInstall1CommandsLib.inf
NULL|ShellPkg/Library/UefiShellNetwork1CommandsLib/UefiShellNetwork1CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellNetwork2CommandsLib/UefiShellNetwork2CommandsLib.inf
+ NULL|ShellPkg/Library/UefiShellAcpiViewCommandLib/UefiShellAcpiViewCommandLib.inf
HandleParsingLib|ShellPkg/Library/UefiHandleParsingLib/UefiHandleParsingLib.inf
PrintLib|MdePkg/Library/BasePrintLib/BasePrintLib.inf
BcfgCommandLib|ShellPkg/Library/UefiShellBcfgCommandLib/UefiShellBcfgCommandLib.inf
--
2.21.0.windows.1