mirror_edk2.git
4 years agoCryptoPkg: Add new TlsLib library
Jiaxin Wu [Wed, 14 Dec 2016 02:34:57 +0000 (10:34 +0800)]
CryptoPkg: Add new TlsLib library

v2:
* Code refine and Typo fix:
TlsHandeAlert -> TlsHandleAlert

This patch is used to add new TlsLib library, which is wrapped
over OpenSSL. The implementation provides TLS library functions
for EFI TLS protocol and EFI TLS Configuration Protocol.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoCryptoPkg: Enable ssl build in OpensslLib directly
Jiaxin Wu [Wed, 14 Dec 2016 02:30:32 +0000 (10:30 +0800)]
CryptoPkg: Enable ssl build in OpensslLib directly

This patch is used to enable ssl build in OpensslLib module
directly.

Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Long Qin <qin.long@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Tested-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoMdePkg: Add a header to standardize TLS definitions
Jiaxin Wu [Wed, 14 Dec 2016 02:21:16 +0000 (10:21 +0800)]
MdePkg: Add a header to standardize TLS definitions

This path is used to standardize TLS definitions from related
RFCs. Including TLS Cipher Suites, TLS Version, TLS Content Type
and TLS Record Header, etc.

Cc: Long Qin <qin.long@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoMdePkg: Add TLS related protocol definition
Jiaxin Wu [Wed, 14 Dec 2016 02:19:19 +0000 (10:19 +0800)]
MdePkg: Add TLS related protocol definition

This patch is used to add Tls.h and TlsConfig.h header
files to define EFI TLS Configuration Protocol,
EFI TLS Service Binding Protocol and
EFI TLS Configuration Protocol.

Cc: Long Qin <qin.long@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Thomas Palmer <thomas.palmer@hpe.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Qin Long <qin.long@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoNetworkPkg: Refine UintnToAscDecWithFormat functions logic
Hao Wu [Tue, 15 Nov 2016 08:25:22 +0000 (16:25 +0800)]
NetworkPkg: Refine UintnToAscDecWithFormat functions logic

This commit refines the logic for HttpBootUintnToAscDecWithFormat and
PxeBcUintnToAscDecWithFormat. It avoids using the decrement operator '--'
for array index to prevent possible mis-reports by static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoMdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic
Hao Wu [Tue, 15 Nov 2016 08:12:30 +0000 (16:12 +0800)]
MdeModulePkg/UefiPxeBcDxe: Refine the CvtNum function logic

This commit refines the logic for the CvtNum function. It avoids using the
decrement operator '--' for array index to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoMdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic
Hao Wu [Tue, 15 Nov 2016 07:39:44 +0000 (15:39 +0800)]
MdeModulePkg/DxeNetLib: Rewrite NetblockChecksum function logic

This commit rewrites the logic for NetblockChecksum. It processes the
checksum of the left-over byte first to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoMdePkg/MemoryLib: Refine InternalMemSetMem16|32|64 functions logic
Hao Wu [Tue, 15 Nov 2016 05:26:47 +0000 (13:26 +0800)]
MdePkg/MemoryLib: Refine InternalMemSetMem16|32|64 functions logic

This commit refines the logic for InternalMemSetMem16|32|64 functions. It
avoids using the decrement operator '--' for array index to prevent
possible mis-reports by static code checkers.

Please note that those modified functions are only consumed within
MemoryLib by APIs SetMem16|32|64, and those APIs will handle the case when
the input number of bytes to set is 0. Hence, the behavior of APIs
SetMem16|32|64 is not changed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoMdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp
Hao Wu [Wed, 7 Dec 2016 02:39:03 +0000 (10:39 +0800)]
MdePkg/BaseLib: Add an additional check within (Ascii)StrnCmp

This commit adds an addtional check in AsciiStrnCmp and StrnCmp. It
explicitly checks the end of the sting pointed by 'SecondString' to make
the code logic easier for reading and to prevent possible mis-reports by
static code checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoMdePkg/BaseLib: Refine (Ascii)StrnLenS functions logic
Hao Wu [Tue, 15 Nov 2016 01:59:37 +0000 (09:59 +0800)]
MdePkg/BaseLib: Refine (Ascii)StrnLenS functions logic

This commit refines the logic for AsciiStrnLenS and StrnLenS. It makes the
logic more straightforward to prevent possible mis-reports by static code
checkers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg/SmmCpuFeaturesLib: Fix coding style issues
Dandan Bi [Tue, 20 Dec 2016 07:12:56 +0000 (15:12 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Fix coding style issues

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoUefiCpuPkg: Add Pcd info to uni file
Dandan Bi [Tue, 20 Dec 2016 07:10:29 +0000 (15:10 +0800)]
UefiCpuPkg: Add Pcd info to uni file

Add PcdCpuSmmStmExceptionStackSize/PcdCpuMsegSize prompt and help
string to uni file.

Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoSecurityPkg Tcg2ConfigDxe: Force reset when PCR Allocation changed.
Eric Dong [Tue, 20 Dec 2016 07:54:37 +0000 (15:54 +0800)]
SecurityPkg Tcg2ConfigDxe: Force reset when PCR Allocation changed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference
Hao Wu [Tue, 20 Dec 2016 01:13:23 +0000 (09:13 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add check to avoid NULL ptr dereference

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoBaseTools GCC makefile: disable unused-result warning for CPP file
Liming Gao [Fri, 16 Dec 2016 05:07:10 +0000 (13:07 +0800)]
BaseTools GCC makefile: disable unused-result warning for CPP file

This warning has been disabled for C file. To be same, it is also disabled
for CPP file.

Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
4 years agoBaseTools: fix write-strings build warnings
Heyi Guo [Thu, 15 Dec 2016 06:49:47 +0000 (14:49 +0800)]
BaseTools: fix write-strings build warnings

Fix build warnings of "deprecated conversion from string constant to
?CHAR8* {aka char*}? [-Wwrite-strings]" for BaseTools, while using
"gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: fix format type build warnings
Heyi Guo [Thu, 15 Dec 2016 06:49:46 +0000 (14:49 +0800)]
BaseTools: fix format type build warnings

Fix build warnings of "format ?%d? expects argument of type ?int?, but
argument 5 has type ?long unsigned int? [-Wformat=]" for BaseTools,
while using "gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools: fix format-security build warnings
Heyi Guo [Thu, 15 Dec 2016 06:49:45 +0000 (14:49 +0800)]
BaseTools: fix format-security build warnings

Fix build warnings of "format not a string literal and no format
arguments [-Wformat-security]" for BaseTools, while using "gcc version
4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04.3)".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Heyi Guo <heyi.guo@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/NonDiscoverableDeviceRegistrationLib: Fix coding style issues
Dandan Bi [Mon, 19 Dec 2016 07:02:24 +0000 (15:02 +0800)]
MdeModulePkg/NonDiscoverableDeviceRegistrationLib: Fix coding style issues

1. Fix issues in comments
2. Fix Guid/protocol format

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
4 years agoMdeModulePkg/SataControllerDxe: Fix coding style issue
Dandan Bi [Mon, 19 Dec 2016 03:37:51 +0000 (11:37 +0800)]
MdeModulePkg/SataControllerDxe: Fix coding style issue

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/TerminalDxe: Initialize variable after declaration
Dandan Bi [Mon, 19 Dec 2016 03:18:46 +0000 (11:18 +0800)]
MdeModulePkg/TerminalDxe: Initialize variable after declaration

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/EmmcDxe: Avoid Non-Boolean type used as Boolean
Dandan Bi [Mon, 19 Dec 2016 03:16:19 +0000 (11:16 +0800)]
MdeModulePkg/EmmcDxe: Avoid Non-Boolean type used as Boolean

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoMdeModulePkg/EbcDxe: Make variable name follow rules
Dandan Bi [Mon, 19 Dec 2016 03:11:15 +0000 (11:11 +0800)]
MdeModulePkg/EbcDxe: Make variable name follow rules

For variable name, it should contain lower case characters.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg/CapsuleApp: Fix Guid format issues
Dandan Bi [Mon, 19 Dec 2016 03:03:57 +0000 (11:03 +0800)]
MdeModulePkg/CapsuleApp: Fix Guid format issues

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoIntelSiliconPkg: Fix format issues
Dandan Bi [Mon, 19 Dec 2016 01:46:01 +0000 (09:46 +0800)]
IntelSiliconPkg: Fix format issues

1. Fix doxygen formt
2. Fix Guid format

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg/FmpAuthenticationLib: Fix Guid format issues
Dandan Bi [Mon, 19 Dec 2016 01:38:22 +0000 (09:38 +0800)]
SecurityPkg/FmpAuthenticationLib: Fix Guid format issues

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoIntelSiliconPkg: 0468303 caused to breaking the SMBIOS tables generation code
Chan, Amy [Fri, 16 Dec 2016 07:10:45 +0000 (15:10 +0800)]
IntelSiliconPkg: 0468303 caused to breaking the SMBIOS tables generation code

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Chiu, Chasel <chasel.chiu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chan, Amy <amy.chan@intel.com>
System test:
Smbios tables are correctly published on an intel internal platform.

 .../DxeSmbiosDataHobLib/DxeSmbiosDataHobLib.c      | 134 +++------------------
 1 file changed, 14 insertions(+), 120 deletions(-)

4 years agoUefiCpuPkg/ArchitecturalMsr.h: Remove non-Ascii characters
Hao Wu [Tue, 20 Dec 2016 01:42:53 +0000 (09:42 +0800)]
UefiCpuPkg/ArchitecturalMsr.h: Remove non-Ascii characters

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoBaseTools: Correct bin wrappers for GenDepex.py path
Yonghong Zhu [Mon, 19 Dec 2016 02:52:20 +0000 (10:52 +0800)]
BaseTools: Correct bin wrappers for GenDepex.py path

The WindowsLike and PosixLike bin wrappers for GenDepex.py do not use
correct path. GenDepex.py is not in a GenDepex directory. Instead, it is
in the AutoGen directory.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=292
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoShellBinPkg: New Shell binaries for IA32 and X64
Ruiyu Ni [Mon, 19 Dec 2016 07:27:38 +0000 (15:27 +0800)]
ShellBinPkg: New Shell binaries for IA32 and X64

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF
Ruiyu Ni [Mon, 19 Dec 2016 06:52:38 +0000 (14:52 +0800)]
FatBinPkg: New EnhancedFatDxe binaries for IA32, X64, EBC and IPF

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoUefiCpuPkg/PiSmmCpu: Add SMM Comm Buffer Paging Protection.
Jiewen Yao [Thu, 24 Nov 2016 05:36:56 +0000 (13:36 +0800)]
UefiCpuPkg/PiSmmCpu: Add SMM Comm Buffer Paging Protection.

This patch sets the normal OS buffer EfiLoaderCode/Data,
EfiBootServicesCode/Data, EfiConventionalMemory, EfiACPIReclaimMemory
to be not present after SmmReadyToLock.

To access these region in OS runtime phase is not a good solution.

Previously, we did similar check in SmmMemLib to help SMI handler
do the check. But if SMI handler forgets the check, it can still
access these OS region and bring risk.

So here we enforce the policy to prevent it happening.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg/SmmCpuFeaturesLibStm: Add STM library instance
Michael Kinney [Mon, 28 Nov 2016 22:36:51 +0000 (06:36 +0800)]
UefiCpuPkg/SmmCpuFeaturesLibStm: Add STM library instance

Add a new instances of the SmmCpuFeaturesLib that is used by
platforms to enable the SMI Transfer Monitor(STM) feature.
This new instance is in the same directory as the default
SmmCpuFeaturesLib instance in order to share source files.

The DSC file is updated to build both SmmCpuFeatureLib
instances and to build two versions of the PiSmmCpuDxeSmm
module using each of the SmmCpuFeatureLib instances.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg/SmmCpuFeaturesLib: Split into two files
Michael Kinney [Fri, 18 Nov 2016 04:54:19 +0000 (20:54 -0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Split into two files

Split the default implementation of the SmmCpuFeaturesLib
into two files to prepare for the addition of the STM
specific SmmCpuFeaturesLib implementation.  The STM
specific implementation installs a different SMI entry
handler and initialize the MSEG specific MSR at the end
of SmmCpuFeaturesInitializeProcessor().

This patch does not introduce any functional changes
to the default implementation of the SmmCpuFeaturesLib.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg: Add STM GUIDs, Protocols, and PCDs
Michael Kinney [Mon, 28 Nov 2016 21:52:57 +0000 (13:52 -0800)]
UefiCpuPkg: Add STM GUIDs, Protocols, and PCDs

* Add GUIDed HOB that described MSEG region in SMRAM
* Add SM Monitor Init Protocol
* Add PCD to configure size of SMM exception stack
* Add PCD to configure MSEG region size if it is not
  described by the gMsegSmramGuid GUIDed HOB.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg/Include: Update MSEG structure comments
Michael Kinney [Wed, 7 Dec 2016 07:22:24 +0000 (23:22 -0800)]
UefiCpuPkg/Include: Update MSEG structure comments

Add comments to describe fields of MSEG_HEADER and
add define values for the MonitorFeatures field.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDevice: Make variable definition follow rule
Dandan Bi [Thu, 15 Dec 2016 06:15:21 +0000 (14:15 +0800)]
MdeModulePkg/NonDiscoverablePciDevice: Make variable definition follow rule

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDeviceDxe: Add comments for functions
Dandan Bi [Thu, 15 Dec 2016 12:52:52 +0000 (20:52 +0800)]
MdeModulePkg/NonDiscoverablePciDeviceDxe: Add comments for functions

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDeviceDxe: Fix VS2010/2012 build failure
Dandan Bi [Fri, 16 Dec 2016 01:53:03 +0000 (09:53 +0800)]
MdeModulePkg/NonDiscoverablePciDeviceDxe: Fix VS2010/2012 build failure

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoNetworkPkg: Replace ASSERT with error return code in PXE and HTTP boot driver.
Fu Siyuan [Fri, 16 Dec 2016 07:56:42 +0000 (15:56 +0800)]
NetworkPkg: Replace ASSERT with error return code in PXE and HTTP boot driver.

This patch remove the ASSERT when receive a DHCP packet large than the maximum
cache buffer size.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoMdeModulePkg: Replace ASSERT with error return code in PXE driver.
Fu Siyuan [Fri, 16 Dec 2016 06:03:07 +0000 (14:03 +0800)]
MdeModulePkg: Replace ASSERT with error return code in PXE driver.

This patch remove the ASSERT when receive a DHCP packet large than the maximum
cache buffer size.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoOmap35xxPkg/PciEmulation: port to new non-discoverable device infrastructure
Ard Biesheuvel [Fri, 9 Dec 2016 15:04:35 +0000 (15:04 +0000)]
Omap35xxPkg/PciEmulation: port to new non-discoverable device infrastructure

Move to the new non-discoverable device protocols for wiring the PCI based
EHCI controller driver to the non-discoverable EHCI controller found on the
OMAP 3530.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoSecurityPkg: Tcg2Dxe: Report correct FinalEventLog size
Zhang, Chao B [Fri, 16 Dec 2016 05:09:44 +0000 (13:09 +0800)]
SecurityPkg: Tcg2Dxe: Report correct FinalEventLog size

Update debug log to report correct FinalEventLog size.

Cc: Yao Jiewen <jiewen.yao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Yao Jiewen <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg/Cpuid.h: Update CPUID definitions with SDM (Sep.2016)
Hao Wu [Fri, 4 Nov 2016 04:41:18 +0000 (12:41 +0800)]
UefiCpuPkg/Cpuid.h: Update CPUID definitions with SDM (Sep.2016)

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

Update CPUID leaf and sub-leaf indexes and structures as described by
Intel(R) 64 and IA-32 Architectures Software Developer's Manual,
Volume 2A, September 2016, CPUID instruction.

Summary of incompatible changes:
1. Field name changes in CPUID_STRUCTURED_EXTENDED_FEATURE_FLAGS_EBX
Bit 12 has been renamed from 'PQM' to 'RDT_M' and bit 15 has been renamed
from 'PQE' to 'RDT_A'.

2. Stucture and filed name changes for 'CPUID Platform QoS Monitoring
Information' related definitions
Definition 'CPUID_PLATFORM_QOS_MONITORING' has been renamed to
'CPUID_INTEL_RDT_MONITORING'.
Definition 'CPUID_PLATFORM_QOS_MONITORING_ENUMERATION_SUB_LEAF' has been
renamed to 'CPUID_INTEL_RDT_MONITORING_ENUMERATION_SUB_LEAF'.
Definition 'CPUID_PLATFORM_QOS_MONITORING_CAPABILITY_SUB_LEAF' has been
renamed to 'CPUID_INTEL_RDT_MONITORING_L3_CACHE_SUB_LEAF'.

3. Stucture and filed name changes for 'CPUID Platform QoS Enforcement
Information' related definitions
Definition 'CPUID_PLATFORM_QOS_ENFORCEMENT' has been renamed to
'CPUID_INTEL_RDT_ALLOCATION'.
Definition 'CPUID_PLATFORM_QOS_ENFORCEMENT_MAIN_LEAF' has been renamed to
'CPUID_INTEL_RDT_ALLOCATION_ENUMERATION_SUB_LEAF'.
Definition 'CPUID_PLATFORM_QOS_ENFORCEMENT_RESID_SUB_LEAF' has been
renamed to 'CPUID_INTEL_RDT_ALLOCATION_L3_CACHE_SUB_LEAF'.

This commit also updates the relating codes in
UefiCpuPkg/Application/Cpuid to reflect the changes.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoUefiCpuPkg/Include: Add Goldmont MSR header file with SDM (Sep.2016)
Hao Wu [Thu, 8 Dec 2016 08:35:49 +0000 (16:35 +0800)]
UefiCpuPkg/Include: Add Goldmont MSR header file with SDM (Sep.2016)

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

Add the MSR header file of Goldmont processor according to Intel(R) 64 and
IA-32 Architectures Software Developer's Manual, Volume 3, September 2016,
Chapter 35 Model-Specific-Registers (MSR), Section 35.5.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoUefiCpuPkg/Include: Update Skylake MSR header file with SDM (Sep.2016)
Hao Wu [Thu, 8 Dec 2016 08:35:56 +0000 (16:35 +0800)]
UefiCpuPkg/Include: Update Skylake MSR header file with SDM (Sep.2016)

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

Update the MSR header file of Skylake processor according to Intel(R) 64
and IA-32 Architectures Software Developer's Manual, Volume 3, September
2016, Chapter 35 Model-Specific-Registers (MSR), Section 35.15.

Summary of incompatible changes:
1. MSR (address 38EH) IA32_PERF_GLOBAL_STAUS has been renamed to
IA32_PERF_GLOBAL_STATUS
Typo 'STAUS' has been fixed in SDM.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoUefiCpuPkg/Include: Update MSR header files with SDM (Sep.2016)
Hao Wu [Tue, 25 Oct 2016 05:35:54 +0000 (13:35 +0800)]
UefiCpuPkg/Include: Update MSR header files with SDM (Sep.2016)

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

Update MSR header files of processors (excluding Goldmont and Skylake
processors) according to Intel(R) 64 and IA-32 Architectures Software
Developer's Manual, Volume 3, September 2016, Chapter 35
Model-Specific-Registers (MSR).

Summary of incompatible changes:
General:
1. MSR (address 38EH) IA32_PERF_GLOBAL_STAUS in processor-specific header
files has been removed or renamed to IA32_PERF_GLOBAL_STATUS
Typo 'STAUS' has been fixed in SDM.
If the MSR definition is the same with architectural MSR, we remove it.
Otherwise, we rename the MSR.

2. MSRs (address starting from 400H) MSR_MC{X}_{XXX} (like MSR_MC4_STATUS)
in processor-specific header files have been removed or renamed to
IA32_MC{X}_{XXX} (like IA32_MC4_STATUS)
Register name change from 'MSR_MC{X}_{XXX}' to 'IA32_MC{X}_{XXX}' in SDM.
If the MSR definition is the same with architectural MSR, we remove it.
Otherwise, we rename the MSR.
Please note that for those MSRs still have name like 'MSR_MC{X}_{XXX}' in
SDM are still kept in processor-specific header files.

HaswellMsr.h:
1. MSR (address C80H) IA32_DEBUG_FEATURE has been removed
Register name change from 'IA32_DEBUG_FEATURE' to 'IA32_DEBUG_INTERFACE'
in SDM.
Since the MSR definition is the same with architectural MSR, we remove it.

SandyBridgeMsr.h:
1. MSR (address 391H) MSR_UNC_PERF_GLOBAL_CTRL, name change for bit fields
0:3
Bit description change from 'Core {X} select' to 'Slice {X} select' for
bit 0:3 in SDM.

SilvermontMsr.h:
1. MSR (address 2AH) MSR_EBL_CR_POWERON, structure definition changed
Bit description for this MSR is totally changed in SDM, we modify the
structure definition to align with it.

XeonDMsr.h:
1. MSRs (address 630H to 632H) MSR_PKG_C8_RESIDENCY, MSR_PKG_C9_RESIDENCY
and MSR_PKG_C10_RESIDENCY have been removed
Those 3 MSRs are not defined for this processor in SDM, we remove them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Michael Kinney <michael.d.kinney@intel.com>
4 years agoShellPkg/setvar: Correct typo in setvar help message
Ruiyu Ni [Thu, 15 Dec 2016 07:28:45 +0000 (15:28 +0800)]
ShellPkg/setvar: Correct typo in setvar help message

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix .S & .asm build failure
Feng Tian [Thu, 15 Dec 2016 05:25:30 +0000 (13:25 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix .S & .asm build failure

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA
Ard Biesheuvel [Fri, 9 Dec 2016 15:04:34 +0000 (15:04 +0000)]
MdeModulePkg/NonDiscoverablePciDeviceDxe: add support for non-coherent DMA

Add support for non-coherent DMA, either by performing explicit cache
maintenance when DMA mappings are aligned to the CPU's DMA buffer alignment,
or by bounce buffering via uncached mappings otherwise.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Marcin Wojtas <mw@semihalf.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg/CapsuleApp: Fix GUID/protocol format issues
Dandan Bi [Mon, 12 Dec 2016 02:26:54 +0000 (10:26 +0800)]
MdeModulePkg/CapsuleApp: Fix GUID/protocol format issues

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg: Add missing info string for PCDs
Dandan Bi [Thu, 24 Nov 2016 07:33:28 +0000 (15:33 +0800)]
MdeModulePkg: Add missing info string for PCDs

Some Pcds are added to the dec file, but miss to add the
prompt&&help info to the uni file, now add them.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg: Make the comments align with the function
Dandan Bi [Tue, 22 Nov 2016 07:38:10 +0000 (15:38 +0800)]
MdeModulePkg: Make the comments align with the function

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoUefiCpuPkg/Capsule: Fix coding style issues
Dandan Bi [Tue, 13 Dec 2016 08:08:01 +0000 (16:08 +0800)]
UefiCpuPkg/Capsule: Fix coding style issues

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoUefiCpuPkg/MicrocodeUpdateDxe: Fix coding style issues in INF file
Dandan Bi [Tue, 13 Dec 2016 02:54:25 +0000 (10:54 +0800)]
UefiCpuPkg/MicrocodeUpdateDxe: Fix coding style issues in INF file

1. Add MicrocodeUpdate.h to the [Sources] section.
2. Fix the incorrect Guid/Protocol format issues.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoUefiCpuPkg: Add info string to UNI file for PcdCpuSmmStaticPageTable
Dandan Bi [Tue, 13 Dec 2016 02:49:08 +0000 (10:49 +0800)]
UefiCpuPkg: Add info string to UNI file for PcdCpuSmmStaticPageTable

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoUefiCpuPkg: Make the comments align with the functions
Dandan Bi [Tue, 13 Dec 2016 02:46:28 +0000 (10:46 +0800)]
UefiCpuPkg: Make the comments align with the functions

Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoSignedCapsulePkg/IniParsingLib: Update struct name
Dandan Bi [Tue, 13 Dec 2016 02:43:53 +0000 (10:43 +0800)]
SignedCapsulePkg/IniParsingLib: Update struct name

1. Change _SECTION_ITEM to _INI_SECTION_ITEM
2. Change _COMMENT_LINE to _INI_COMMENT_LINE
Because _SECTION_ITEM  and _COMMENT_LINE are duplicated with
the one defined in IntelFrameworkModulePkg\Universal\
FirmwareVolume\UpdateDriverDxe\UpdateDriver.h

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSignedCapsulePkg/SystemFirmwareUpdate: Add source file to INF file
Dandan Bi [Tue, 13 Dec 2016 01:40:04 +0000 (09:40 +0800)]
SignedCapsulePkg/SystemFirmwareUpdate: Add source file to INF file

Add SystemFirmwareDxe.h to [Sources] section of INF file.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSignedCapsulePkg/RecoveryModuleLoadPei: Add source file to INF file
Dandan Bi [Tue, 13 Dec 2016 01:38:44 +0000 (09:38 +0800)]
SignedCapsulePkg/RecoveryModuleLoadPei: Add source file to INF file

Add RecoveryModuleLoadPei.h to [Sources] section of INF file.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSignedCapsulePkg/EdkiiSystemCapsuleLib: Fix coding style issues in INF file
Dandan Bi [Tue, 13 Dec 2016 01:35:36 +0000 (09:35 +0800)]
SignedCapsulePkg/EdkiiSystemCapsuleLib: Fix coding style issues in INF file

Fix incorrect Guid/Pcd format issues in INF file.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg/OpalPasswordDxe: Make comments align with the function
Dandan Bi [Mon, 12 Dec 2016 05:55:44 +0000 (13:55 +0800)]
SecurityPkg/OpalPasswordDxe: Make comments align with the function

Cc: Eric Dong <eric.dong@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
4 years agoSecurityPkg/FmpAuthenticationLibRsa2048Sha256: Fix Guid/pcd format issues
Dandan Bi [Mon, 12 Dec 2016 05:38:15 +0000 (13:38 +0800)]
SecurityPkg/FmpAuthenticationLibRsa2048Sha256: Fix Guid/pcd format issues

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg/FmpAuthenticationLibPkcs7: Fix incorrect Guid format
Dandan Bi [Mon, 12 Dec 2016 05:35:56 +0000 (13:35 +0800)]
SecurityPkg/FmpAuthenticationLibPkcs7: Fix incorrect Guid format

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurity:Add info string to UNI file for PcdPkcs7CertBuffer
Dandan Bi [Mon, 12 Dec 2016 05:25:52 +0000 (13:25 +0800)]
Security:Add info string to UNI file for PcdPkcs7CertBuffer

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoShellPkg/UefiShellNetwork2CommandsLib: Fix incorrect Protocol format
Dandan Bi [Mon, 12 Dec 2016 06:22:03 +0000 (14:22 +0800)]
ShellPkg/UefiShellNetwork2CommandsLib: Fix incorrect Protocol format

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/UefiShellNetwork1CommandsLib: Fix incorrect Protocol format
Dandan Bi [Mon, 12 Dec 2016 06:21:29 +0000 (14:21 +0800)]
ShellPkg/UefiShellNetwork1CommandsLib: Fix incorrect Protocol format

Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/UefiShellDebug1CommandsLib: Fix coding style issues
Dandan Bi [Mon, 12 Dec 2016 06:11:14 +0000 (14:11 +0800)]
ShellPkg/UefiShellDebug1CommandsLib: Fix coding style issues

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Remove the file which is not used
Dandan Bi [Mon, 12 Dec 2016 03:08:39 +0000 (11:08 +0800)]
FatPkg/EnhancedFatDxe: Remove the file which is not used

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg EbcDxe: Fix CLANG38 build failure
Liming Gao [Wed, 14 Dec 2016 05:16:34 +0000 (13:16 +0800)]
MdeModulePkg EbcDxe: Fix CLANG38 build failure

Change structure value assignment with CopyMem() API.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoSecurityPkg:/Tcg2Dxe: remove 4G limitation
Jiewen Yao [Mon, 12 Dec 2016 06:35:05 +0000 (14:35 +0800)]
SecurityPkg:/Tcg2Dxe: remove 4G limitation

Tcg2Dxe allocates event log below 4G. It is unnecessary.

Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chao Zhang <chao.b.zhang@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDev: Fix type mismatch in switch/case
Hao Wu [Mon, 12 Dec 2016 01:07:52 +0000 (09:07 +0800)]
MdeModulePkg/NonDiscoverablePciDev: Fix type mismatch in switch/case

Fix switch/case statement type mismatch in functions PciIoMemRead &
PciIoMemWrite.

Parameter 'Width' is of enum type EFI_PCI_IO_PROTOCOL_WIDTH, but the enum
type provided in 'switch (Width)' block is of type
EFI_PCI_ROOT_BRIDGE_IO_PROTOCOL_WIDTH.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg/CapsuleLib: Correct debug message.
Jiewen Yao [Sat, 10 Dec 2016 07:08:16 +0000 (15:08 +0800)]
MdeModulePkg/CapsuleLib: Correct debug message.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg PiSmmCore: Retrieve Smram base address from system table
Liming Gao [Mon, 12 Dec 2016 02:09:51 +0000 (10:09 +0800)]
MdeModulePkg PiSmmCore: Retrieve Smram base address from system table

PiSmmIpl records LoadModuleAtFixAddressSmramBase in LMFAConfigurationTable.
Update PiSmmCore to directly get the address from this system table.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg SmmIpl: Fill Smram range for SMM driver when LMFA enable
Liming Gao [Thu, 1 Dec 2016 06:49:33 +0000 (14:49 +0800)]
MdeModulePkg SmmIpl: Fill Smram range for SMM driver when LMFA enable

Allocate the additional Smram range to describe the reserved smram for
SMM core and driver when LMFA feature is enabled.

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages
Liming Gao [Thu, 1 Dec 2016 06:47:55 +0000 (14:47 +0800)]
MdeModulePkg PiSmmCore: Update FreePages to handle zero address and pages

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

Zero memory address or zero number pages are invalid to SmmFreePages().

Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg VariableSmm: Check InfoSize correctly
Star Zeng [Thu, 8 Dec 2016 10:16:05 +0000 (18:16 +0800)]
MdeModulePkg VariableSmm: Check InfoSize correctly

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

Current SmmVariableGetStatistics() in VariableSmm.c is always
checking input InfoSize against the first variable info,
it is incorrect.

For instance, there are three variables.
BootOrder
Boot0000
Boot0001

If the input InfoEntry is holding the second variable info (Boot0000)
and InfoSize is sizeof (VARIABLE_INFO_ENTRY) + StrSize (L"Boot0000"),
current code will return EFI_BUFFER_TOO_SMALL, but it should return
the third variable info (Boot0001).

This patch is to refine the code logic.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg VariableSmm: Do not need check CommBufferSize buffer
Star Zeng [Fri, 9 Dec 2016 06:47:03 +0000 (14:47 +0800)]
MdeModulePkg VariableSmm: Do not need check CommBufferSize buffer

Current code in SmmVariableHandler() checks CommBufferSize
buffer to make sure it points to outside SMRAM in
"case SMM_VARIABLE_FUNCTION_GET_STATISTICS".

But after eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd,
CommBufferSize buffer points to SMRAM that was used by
SMM core to cache CommSize from SmmCommunication protocol,
then the check will fail definitely and GET_STATISTICS
feature breaks.

In fact, do not need check CommBufferSize buffer at all
even before eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd.
Before eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd,
CommBufferSize buffer pointed to gSmmCorePrivate->BufferSize
that is outside SMRAM, the check will success definitely;
after eaae7b33b1cf6b9f21db1636f219c2b6a8d88afd,
CommBufferSize buffer points to local variable BufferSize
(in SMRAM) in SmmEntryPoint(), the check is not needed
definitely.

The patch is to remove the check.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg/NonDiscoverablePciDevice: add missing cast and EFIAPI modifiers
Ard Biesheuvel [Thu, 8 Dec 2016 08:17:22 +0000 (08:17 +0000)]
MdeModulePkg/NonDiscoverablePciDevice: add missing cast and EFIAPI modifiers

Add missing EFIAPI modifiers to the functions that are exposed via the
PCI I/O protocol.

At the same time, add a missing UINT8 cast which breaks the build on
Visual Studio.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
4 years agoFatPkg: Fix format issues in dec/inf/dsc files
Dandan Bi [Thu, 8 Dec 2016 09:09:59 +0000 (17:09 +0800)]
FatPkg: Fix format issues in dec/inf/dsc files

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Add comments for functions
Dandan Bi [Thu, 8 Dec 2016 08:01:15 +0000 (16:01 +0800)]
FatPkg/EnhancedFatDxe: Add comments for functions

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding style
Dandan Bi [Fri, 9 Dec 2016 02:07:49 +0000 (10:07 +0800)]
FatPkg/EnhancedFatDxe: Make the comments align with EDKIIcoding style

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Use typedef for complex type
Dandan Bi [Thu, 8 Dec 2016 06:38:26 +0000 (14:38 +0800)]
FatPkg/EnhancedFatDxe: Use typedef for complex type

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Make the variable name follow rule
Dandan Bi [Thu, 8 Dec 2016 05:18:08 +0000 (13:18 +0800)]
FatPkg/EnhancedFatDxe: Make the variable name follow rule

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Make function prototype align with definition
Dandan Bi [Thu, 8 Dec 2016 05:15:22 +0000 (13:15 +0800)]
FatPkg/EnhancedFatDxe: Make function prototype align with definition

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Use global variable replace static local variable
Dandan Bi [Fri, 9 Dec 2016 01:55:15 +0000 (09:55 +0800)]
FatPkg/EnhancedFatDxe: Use global variable replace static local variable

Create global variable "mMonthDays" to replace static local
variable "MonthDays" in FatIsValidTime() function in Misc.c.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoFatPkg/EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean
Dandan Bi [Thu, 8 Dec 2016 05:10:29 +0000 (13:10 +0800)]
FatPkg/EnhancedFatDxe: Avoid Non-Boolean type uses as Boolean

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg/EbcDxe: Fix incorrect Copyright format
Dandan Bi [Thu, 8 Dec 2016 02:21:16 +0000 (10:21 +0800)]
MdeModulePkg/EbcDxe: Fix incorrect Copyright format

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
4 years agoShellPkg: Assign the correct value to ShellStatus
Gary Lin [Wed, 7 Dec 2016 03:40:51 +0000 (11:40 +0800)]
ShellPkg: Assign the correct value to ShellStatus

Since the type of ShellStatus is SHELL_STATUS, we should use
SHELL_INVALID_PARAMETER instead of EFI_INVALID_PARAMETER.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Gary Lin <glin@suse.com>
Cc: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Zhang Lubo <lubo.zhang@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoShellPkg: Add missing header line for SFO flag in 'cls' command
Tapan Shah [Thu, 8 Dec 2016 17:21:11 +0000 (01:21 +0800)]
ShellPkg: Add missing header line for SFO flag in 'cls' command

Adding a missing header line for 'cls -sfo' command

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Tapan Shah <tapandshah@hpe.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
4 years agoShellPkg/Application: Fix ">v" cannot update environment variable
Chen A Chen [Tue, 6 Dec 2016 05:56:46 +0000 (13:56 +0800)]
ShellPkg/Application: Fix ">v" cannot update environment variable

When ">v" is used to redirect the command output to environment
variable (e.g.: "echo xxx >v yyy"), we only called SetVariable()
to update the variable storage but forgot to update the cached
environment variables in gShellEnvVarList.
When updating the variable storage, the existing code unnecessary
saved the ending NULL character into variable storage.

The patch fixes all the above issues.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chen A Chen <chen.a.chen@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Tapan Shah <tapandshah@hpe.com>
4 years agoMdeModulePkg/BdsDxe: Initialize gConnectConInEvent earlier
Ruiyu Ni [Mon, 5 Dec 2016 01:49:24 +0000 (09:49 +0800)]
MdeModulePkg/BdsDxe: Initialize gConnectConInEvent earlier

PlatformBootManagerBeforeConsole() might want to trigger this event
to connect ConIn so BdsDxe initializes this event before
PlatformBootManagerBeforeConsole().

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Sunny Wang <sunnywang@hpe.com>
Cc: Chao B Zhang <chao.b.zhang@intel.com>
4 years agoVlv2TbltDevicePkg/PlatformInitPei: Better SMRAM size alignment
Michael Kinney [Fri, 2 Dec 2016 16:40:20 +0000 (08:40 -0800)]
Vlv2TbltDevicePkg/PlatformInitPei: Better SMRAM size alignment

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

Update workaround to be more generic.

* Search for the largest region between 1MB and 4GB
* Find all adjacent regions to compute total size
* Minimum aligned size if 4KB
* Mark extended region to align size as EFI_ALLOCATED
* If an adjacent EFI_ALLOCATED region is present, then
  increase the size of the adjacent region.
* If adjacent EFI_ALLOCATED region is not present, then
  allocate a new HOB with one extra entry to describe
  the extended region to align the total size.  Preserve
  the last entry in the descriptor list for compatibility.

This is a workaround until the binary module that produces the
gEfiSmmPeiSmramMemoryReserveGuid HOB is updated

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: David Wei <david.wei@intel.com>
Cc: Mang Guo <mang.guo@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
4 years agoMdeModulePkg: implement generic PCI I/O driver for non-discoverable devices
Ard Biesheuvel [Mon, 31 Oct 2016 15:36:50 +0000 (15:36 +0000)]
MdeModulePkg: implement generic PCI I/O driver for non-discoverable devices

This implements support for non-discoverable PCI compatible devices, i.e,
devices that are not on a PCI bus but that can be controlled by generic PCI
drivers in EDK2.

This is implemented as a UEFI driver, which means we take full advantage
of the UEFI driver model, and only instantiate those devices that are
necessary for booting.

Care is taken to deal with DMA addressing limitations: DMA mappings and
allocations are moved below 4 GB if the PCI driver has not informed us
that the device being driven is 64-bit DMA capable. DMA is implemented as
coherent, support for non-coherent DMA is implemented by a subsequent patch.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg: introduce helper library to register non-discoverable devices
Ard Biesheuvel [Mon, 31 Oct 2016 14:58:18 +0000 (14:58 +0000)]
MdeModulePkg: introduce helper library to register non-discoverable devices

Non-discoverable devices need to be registered explicitly by the platform.
Introduce a helper library that takes care of this.

This implementation currently only supports registering devices that are
covered by one or more MMIO resources. The underlying protocol allows for
more flexibility than that, but this is currently sufficient for the use
cases that we know about.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg: introduce non-discoverable device protocol
Ard Biesheuvel [Mon, 31 Oct 2016 14:54:56 +0000 (14:54 +0000)]
MdeModulePkg: introduce non-discoverable device protocol

Introduce a protocol that can be exposed by a platform for devices that
are not discoverable, usually because they are wired straight to the
memory bus rather than to an enumerable bus like PCI or USB.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
Tested-by: Marcin Wojtas <mw@semihalf.com>
4 years agoMdeModulePkg: Fix assert in iSCSI.
Zhang Lubo [Thu, 1 Dec 2016 06:57:38 +0000 (14:57 +0800)]
MdeModulePkg: Fix assert in iSCSI.

The bug is caused by using already freed memory.
If there is already an attempt and execute
'reconnect -r' command, all the ConfigFormEntry structure
will be freed in IScsiDriverBindingStop, but the
mCallbackInfo->Current is not configured as null and
this pointer will be used again in IScsiFormExtractConfig.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Zhang Lubo <lubo.zhang@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove MTRR field from PSD
Michael Kinney [Tue, 6 Dec 2016 04:39:01 +0000 (20:39 -0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove MTRR field from PSD

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

The MTRR field was removed from PROCESS_SMM_DESCRIPTOR
structure in commit:

https://github.com/tianocore/edk2/commit/26ab5ac3621bdefe96987f8c1512ca79e1bb7ac0

However, the references to the MTRR field in assembly
files were not removed.  Remove the extern reference
to gSmiMtrr and set the Reserved14 field
of PROCESS_SMM_DESCRIPTOR to 0.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Always initialze PSD
Michael Kinney [Tue, 6 Dec 2016 00:53:33 +0000 (16:53 -0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Always initialze PSD

The following commit moved the initialization of the
default PROCESSOR_SMM_DESCRIPTOR from MpService.c to
SmramSaveState.c and made this initialization
conditional on the value returned by the
SmmCpuFeaturesGetSmiHandlerSize() library function.

https://github.com/tianocore/edk2/commit/f12367a0b1de7838f1cb8e0839e168ed7b862333

This changed the behavior of the PiSmmCpuDxeSmm module.
The initialization of the PROCESSOR_SMM_DESCRIPTOR is
moved before the call to SmmCpuFeaturesGetSmiHandlerSize()
to preserve the previous behavior.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Feng Tian <feng.tian@intel.com>
4 years agoUefiCpuPkg/PiSmmCpu: Fixed #double fault on #page fault.
Jiewen Yao [Wed, 23 Nov 2016 13:24:32 +0000 (21:24 +0800)]
UefiCpuPkg/PiSmmCpu: Fixed #double fault on #page fault.

This patch fixes https://bugzilla.tianocore.org/show_bug.cgi?id=246

Previously, when SMM exception happens after EndOfDxe,
with StackGuard enabled on IA32, the #double fault exception
is reported instead of #page fault.

Root cause is below:

Current EDKII SMM page protection will lock GDT.
If IA32 stack guard is enabled, the page fault handler will do task switch.
This task switch need write busy flag in GDT, and write TSS.

However, the GDT and TSS is locked at that time, so the
double fault happens.

We decide to not lock GDT for IA32 StackGuard enabled.

This issue does not exist on X64, or IA32 without StackGuard.

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Regression-tested-by: Laszlo Ersek <lersek@redhat.com>