mirror_edk2.git
4 years agoedk2: Move TianoCore Contribution Agreement to root
Michael D Kinney [Tue, 18 Jul 2017 20:34:33 +0000 (13:34 -0700)]
edk2: Move TianoCore Contribution Agreement to root

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

Move Contributions.txt that contains the TianoCore
Contribution Agreement 1.0 to the root of the edk2
repository and remove the duplicate Contributions.txt
files from all packages.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoBaseTools/PatchCheck: Support Contribution Agreement 1.1
Michael D Kinney [Wed, 12 Jul 2017 20:11:07 +0000 (13:11 -0700)]
BaseTools/PatchCheck: Support Contribution Agreement 1.1

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

Update PatchCheck.py to support either
"Contributed-under: TianoCore Contribution Agreement 1.0"
or "Contributed-under: TianoCore Contribution Agreement 1.1"
in the commit message.

Temporarily continue to allow the TianoCore Contribution
Agreement 1.0 agreement.

Cc: Leif Lindholm <leif.lindholm@linaro.org>
Cc: Andrew Fish <afish@apple.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoNetworkPkg: Display HTTP redirection info to the screen if need.
Fu Siyuan [Wed, 26 Jul 2017 07:57:38 +0000 (15:57 +0800)]
NetworkPkg: Display HTTP redirection info to the screen if need.

HTTP defines a set of status code for redirecting a request to a different URI
in Section 6.4 of RFC7231 and also RFC7583. This patch updates the HTTP boot
driver to display the redirection info to the screen so the user would have
chance to know new URI address of the HTTP boot image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
4 years agoShellPkg/dblk: Honor the BlockIo alignment requirement.
HuajingLi [Tue, 1 Aug 2017 04:30:18 +0000 (12:30 +0800)]
ShellPkg/dblk: Honor the BlockIo alignment requirement.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoUefiCpuPkg/CpuCommonFeaturesLib: Fix the documentation of PpinSupport().
Marvin.Haeuser@outlook.com [Fri, 21 Jul 2017 10:20:22 +0000 (18:20 +0800)]
UefiCpuPkg/CpuCommonFeaturesLib: Fix the documentation of PpinSupport().

The documentation of PpinSupport() refers to 'Enhanced Intel
SpeedStep'. This patch fixes these referneces.

Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Marvin Haeuser <Marvin.Haeuser@outlook.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdeModulePkg/Ufs: Set 'Data Segment Length' field for Write Descriptor
Hao Wu [Thu, 15 Jun 2017 07:15:59 +0000 (15:15 +0800)]
MdeModulePkg/Ufs: Set 'Data Segment Length' field for Write Descriptor

According to the Universal Flash Storage (UFS) Version 2.1 (JESD220C) spec
Section 10.7.8.5, the DATA SEGMENT LENGTH field of the UPIU shall also be
set to number of descriptor bytes to write.

The origin codes miss the above operation.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoMdeModulePkg/UfsPassThruDxe: Add impl of UFS Device Config Protocol
Hao Wu [Mon, 19 Jun 2017 02:53:34 +0000 (10:53 +0800)]
MdeModulePkg/UfsPassThruDxe: Add impl of UFS Device Config Protocol

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoUefiCpuPkg SecCore: Fix operands of different size in bitwise operation
Star Zeng [Wed, 2 Aug 2017 02:07:31 +0000 (10:07 +0800)]
UefiCpuPkg SecCore: Fix operands of different size in bitwise operation

It is introduced by 9e9ca2100f22be29f1a53129d741f4305ff34a71.

Cc: Hao Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@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: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg/Ftp4: Fix wrong function pointer declaration
Alcantara, Paulo [Tue, 6 Jun 2017 00:33:36 +0000 (08:33 +0800)]
MdePkg/Ftp4: Fix wrong function pointer declaration

EFI_FTP4_DATA_CALLBACK is a function pointer and defined as follows:

> typedef
> EFI_STATUS
> (EFIAPI *EFI_FTP4_DATA_CALLBACK)(
>  IN EFI_FTP4_PROTOCOL           *This,
>  IN EFI_FTP4_COMMAND_TOKEN      *Token
>  );

And EFI_FTP4_COMMAND_TOKEN structure declared it as:

> EFI_FTP4_DATA_CALLBACK *DataCallback

Which ended up being a pointer to function pointer and clearly wrong.
This patch fixes it by removing the misleading '*' from declaration.
It's also fixed in new UEFI 2.7 spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Paulo Alcantara <paulo.alc.cavalcanti@hp.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoNetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child
Jiaxin Wu [Mon, 31 Jul 2017 05:36:37 +0000 (13:36 +0800)]
NetworkPkg/HttpDxe: Destroy the TLS instance when cleaning up the HTTP child

During clean up the HTTP child, all resources used by it should be cleaned. But
currently, TLS instance is not destroyed.

This patch is to fix this issue.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoCryptoPkg/TlsLib: Remove the redundant free of BIO objects
Jiaxin Wu [Mon, 31 Jul 2017 05:29:40 +0000 (13:29 +0800)]
CryptoPkg/TlsLib: Remove the redundant free of BIO objects

TLS BIO objects (InBio/OutBio) will be freed by SSL_free() function.
So, the following free operation (BIO_free) in TlsFree is redundant.
It can be removed directly.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Long Qin <qin.long@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoNetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue
Jiaxin Wu [Sun, 30 Jul 2017 13:52:02 +0000 (21:52 +0800)]
NetworkPkg/Ip6Dxe: Fix the IPv6 PXE boot option goes missing issue

This patch is to fix the potential issue recorded at Bugzilla 636:
https://bugzilla.tianocore.org/show_bug.cgi?id=636

The issue is caused by the IPv6 policy switching after PXEv6 boot. When IP
policy is changing, the IPv6 children used by PXE.UdpRead() will be destroyed.
Then, PXE Stop() function is called to uninstall the devicePath protocol,
which leads to the IPv6 PXE boot option goes missing.

Through the above analysis, the IP driver should take the responsibility for
the upper layer network stacks recovery by using ConnectController().

Cc: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Cc: Subramanian Sriram <sriram-s@hpe.com>
Cc: Ni Ruiyu <ruiyu.ni@intel.com>
Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
Reviewed-by: Subramanian Sriram <sriram-s@hpe.com>
Tested-by: Hegde Nagaraj P <nagaraj-p.hegde@hpe.com>
4 years agoNetworkPkg/HttpBootDxe: Fix spelling typo in EFI_HTTP_STATUS_CODE
Jiaxin Wu [Tue, 25 Jul 2017 12:49:27 +0000 (20:49 +0800)]
NetworkPkg/HttpBootDxe: Fix spelling typo in EFI_HTTP_STATUS_CODE

"HTTP_STATUS_300_MULTIPLE_CHIOCES"
This should instead be:
"HTTP_STATUS_300_MULTIPLE_CHOICES"

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoMdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODE
Jiaxin Wu [Tue, 25 Jul 2017 12:48:12 +0000 (20:48 +0800)]
MdeModulePkg/DxeHttpLib: Fix spelling typo in EFI_HTTP_STATUS_CODE

"HTTP_STATUS_300_MULTIPLE_CHIOCES"
This should instead be:
"HTTP_STATUS_300_MULTIPLE_CHOICES"

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoMdePkg/Http.h: Fix spelling typo in EFI_HTTP_STATUS_CODE
Jiaxin Wu [Tue, 25 Jul 2017 12:47:09 +0000 (20:47 +0800)]
MdePkg/Http.h: Fix spelling typo in EFI_HTTP_STATUS_CODE

"HTTP_STATUS_300_MULTIPLE_CHIOCES"
This should instead be:
"HTTP_STATUS_300_MULTIPLE_CHOICES"

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoNetworkPkg/HttpDxe: Refine the coding style.
Jiaxin Wu [Tue, 25 Jul 2017 12:32:35 +0000 (20:32 +0800)]
NetworkPkg/HttpDxe: Refine the coding style.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoMdePkg/Http.h: Refine the coding style.
Jiaxin Wu [Tue, 25 Jul 2017 12:31:58 +0000 (20:31 +0800)]
MdePkg/Http.h: Refine the coding style.

Cc: Ye Ting <ting.ye@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
4 years agoIntelSiliconPkg/IntelVTdDxe: Add explicit NULL pointer checks
Hao Wu [Tue, 1 Aug 2017 03:50:39 +0000 (11:50 +0800)]
IntelSiliconPkg/IntelVTdDxe: Add explicit NULL pointer checks

Add explicit NULL pointer check to make the codes more straight-forward.

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 agoIntelSiliconPkg/IntelVTdDxe: Fix typo for VTd IOTLB domain ID
Hao Wu [Tue, 1 Aug 2017 03:45:33 +0000 (11:45 +0800)]
IntelSiliconPkg/IntelVTdDxe: Fix typo for VTd IOTLB domain ID

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 agoArmPkg: Move IS_DEVICE_PATH_NODE for sharing
Jun Nie [Tue, 1 Aug 2017 09:28:58 +0000 (17:28 +0800)]
ArmPkg: Move IS_DEVICE_PATH_NODE for sharing

Move IS_DEVICE_PATH_NODE into header to share it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoMdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code
Star Zeng [Fri, 28 Jul 2017 02:05:19 +0000 (10:05 +0800)]
MdeModulePkg FirmwarePerfPei: Remove SEC performance data getting code

Current SEC performance data getting code in FirmwarePerformancePei
may get wrong SEC performance data if FirmwarePerformancePei executes
after memory discovered.

And as SecCore has added SecPerformancePpiCallBack to get SEC performance
data and build HOB to convey the SEC performance data to DXE phase.

This patch is to remove the SEC performance data getting code in
FirmwarePerformancePei.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg SecCore: Add SecPerformancePpiCallBack
Star Zeng [Fri, 28 Jul 2017 02:05:08 +0000 (10:05 +0800)]
UefiCpuPkg SecCore: Add SecPerformancePpiCallBack

Add SecPerformancePpiCallBack to get SEC performance data and
build HOB to convey the SEC performance data to DXE phase.

Cc: Liming Gao <liming.gao@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: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned
Star Zeng [Fri, 28 Jul 2017 14:13:00 +0000 (22:13 +0800)]
UefiCpuPkg SecCore: Adjust PeiTemporaryRamBase&Size to be 8byte aligned

As HOB which has 8byte aligned requirement will be built based on them
in PEI phase.

Cc: Liming Gao <liming.gao@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: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg PeiCore: Handle notification PPI from SEC
Star Zeng [Wed, 26 Jul 2017 07:55:26 +0000 (15:55 +0800)]
MdeModulePkg PeiCore: Handle notification PPI from SEC

InstallPpi() will be used for normal PPI in PPI list from SEC,
and NotifyPpi() will be used for notification PPI in PPI list from SEC.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg PiPeiCis.h: Add description for notification PPI from SEC
Star Zeng [Wed, 26 Jul 2017 03:19:22 +0000 (11:19 +0800)]
MdePkg PiPeiCis.h: Add description for notification PPI from SEC

This patch is to follow latest (>= 1.5) PI spec to add description
for notification PPI from SEC

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue
Star Zeng [Fri, 28 Jul 2017 03:44:54 +0000 (11:44 +0800)]
MdeModulePkg PiSmmCoreMemoryAllocLib: Fix a FreePool() assertion issue

When PiSmmCore links against PeiDxeDebugLibReportStatusCode, the code
flow below will cause a FreePool() assertion issue.

PiSmmCoreMemoryAllocationLibConstructor() ->
SmmInitializeMemoryServices() ->
DEBUG ((DEBUG_INFO, "SmmAddMemoryRegion\n")) in SmmAddMemoryRegion() ->
DebugPrint() -> REPORT_STATUS_CODE_EX() -> ReportStatusCodeEx() ->
AllocatePool()/FreePool(PiSmmCoreMemoryAllocLib) ->
ASSERT() at Head = CR (Buffer, POOL_HEAD, Data, POOL_HEAD_SIGNATURE)
  in CoreFreePoolI() of DxeCore Pool.c

It is because at the point of FreePool() in the code flow above,
mSmmCoreMemoryAllocLibSmramRanges/mSmmCoreMemoryAllocLibSmramRangeCount
are not been initialized yet, the FreePool() will be directed to
gBS->FreePool(), that is wrong.

This patch is to temporarily use BootServicesData to hold the
SmramRanges data before calling SmmInitializeMemoryServices().

Cc: Liming Gao <liming.gao@intel.com>
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: Liming Gao <liming.gao@intel.com>
4 years agoBaseTools/GenCrc32: Fix a bug to hand empty file for decode
Yonghong Zhu [Wed, 19 Jul 2017 02:59:37 +0000 (10:59 +0800)]
BaseTools/GenCrc32: Fix a bug to hand empty file for decode

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=535
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 agoBaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf()
Yonghong Zhu [Wed, 19 Jul 2017 02:58:34 +0000 (10:58 +0800)]
BaseTools/EfiLdrImage: Fix a segmentation fault from vfprintf()

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=533
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 agoBaseTools/EfiRom: Fix a segmentation fault from vsprintf()/vfprintf()
Yonghong Zhu [Wed, 19 Jul 2017 02:57:11 +0000 (10:57 +0800)]
BaseTools/EfiRom: Fix a segmentation fault from vsprintf()/vfprintf()

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=534
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 agoBaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf()
Yonghong Zhu [Wed, 19 Jul 2017 02:55:47 +0000 (10:55 +0800)]
BaseTools/GenFfs: Fix a segmentation fault from vsprintf()/vfprintf()

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=536
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 agoBaseTools/GenSec: Fix a segmentation fault in main()
Yonghong Zhu [Wed, 19 Jul 2017 02:54:39 +0000 (10:54 +0800)]
BaseTools/GenSec: Fix a segmentation fault in main()

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=537
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 agoBaseTools/Split: Fix the segmentation fault in GetSplitValue()
Yonghong Zhu [Wed, 19 Jul 2017 02:53:06 +0000 (10:53 +0800)]
BaseTools/Split: Fix the segmentation fault in GetSplitValue()

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=538
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 agoBaseTools: Fix the bug to correctly check Pcd type that in FDF file
Yonghong Zhu [Thu, 27 Jul 2017 03:20:26 +0000 (11:20 +0800)]
BaseTools: Fix the bug to correctly check Pcd type that in FDF file

We set Pcd value in FDF and used this Pcd as PatchableInModule type in
module, it cause build report generate failure. because we incorrectly
set the Pcd type during check whether the Pcd is used.

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 agoMdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in top
Ruiyu Ni [Thu, 27 Jul 2017 03:05:16 +0000 (11:05 +0800)]
MdeModulePkg/PciBus: Avoid hang when BUS pad resource is not in top

PciScanBus() assumes the GetResourcePadding() puts BUS descriptor
in the very beginning, if it's not, the Descriptors will be updated
to point to middle of the pool buffer, which can cause
FreePool(Descriptors) hang in DEBUG image.
No functionality impact to RELEASE image.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoShellPkg: Avoid buffer out-of-bound access
Ruiyu Ni [Wed, 26 Jul 2017 08:21:54 +0000 (16:21 +0800)]
ShellPkg: Avoid buffer out-of-bound access

PathSize is the number of bytes in PathForReturn buffer so
PathForReturn[PathSize - 1] incorrectly accesses the last
character in the buffer,
PathForReturn[PathSize / sizeof (CHAR16) - 1] should be used.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Steven Shi <steven.shi@intel.com>
4 years agoShellPkg/setvar: Check the duplicate flag
Huajing Li [Thu, 27 Jul 2017 04:33:43 +0000 (12:33 +0800)]
ShellPkg/setvar: Check the duplicate flag

Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoShellPkg/ShellLib: Remove unused macros
Ruiyu Ni [Wed, 26 Jul 2017 09:34:01 +0000 (17:34 +0800)]
ShellPkg/ShellLib: Remove unused macros

MAX_FILE_NAME_LEN and FIND_XXXXX_FILE_BUFFER_SIZE are not used
by ShellLib so remove them.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdePkg: Follow UEFI 2.7 spec to deprecate SMM Communication ACPI Table
Star Zeng [Thu, 20 Jul 2017 06:47:28 +0000 (14:47 +0800)]
MdePkg: Follow UEFI 2.7 spec to deprecate SMM Communication ACPI Table

Delete PiSmmCommunicationAcpiTable.h and delete SMM Communication ACPI
Table definition in UefiAcpiDataTable.h.
As EFI_SMM_COMMUNICATE_HEADER is defined in both PI spec vol 4
and UEFI spec, move its definition to SmmCommunication.h.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Liming Gao <liming.gao@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 agoUefiCpuPkg PiSmmCommunicationSmm: Deprecate SMM Communication ACPI Table
Star Zeng [Thu, 20 Jul 2017 06:57:12 +0000 (14:57 +0800)]
UefiCpuPkg PiSmmCommunicationSmm: Deprecate SMM Communication ACPI Table

Follow UEFI 2.7 spec to deprecate SMM Communication ACPI Table,
PiSmmCommunicationSmm will not install SMM Communication ACPI Table
anymore.

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 agoSecurityPkg OpalPasswordSupportLib: Remove include to UefiAcpiDataTable.h
Star Zeng [Thu, 20 Jul 2017 07:56:29 +0000 (15:56 +0800)]
SecurityPkg OpalPasswordSupportLib: Remove include to UefiAcpiDataTable.h

Remove redundant include to UefiAcpiDataTable.h as
SmmCommunication.h will help to include it.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@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/BMMUiLib: Check reset requirement before exiting UiApp
Bi, Dandan [Fri, 21 Jul 2017 08:56:03 +0000 (16:56 +0800)]
MdeModulePkg/BMMUiLib: Check reset requirement before exiting UiApp

V2: Refine the comments.

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp
Bi, Dandan [Fri, 21 Jul 2017 08:56:02 +0000 (16:56 +0800)]
MdeModulePkg/BMUiLib: Check reset requirement before exiting UiApp

V2: Refine the comments.

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg/SetupBrowser: Record the reset status in all SendForm
Bi, Dandan [Fri, 21 Jul 2017 08:56:01 +0000 (16:56 +0800)]
MdeModulePkg/SetupBrowser: Record the reset status in all SendForm

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

Cc: Eric Dong <eric.dong@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoNt32Pkg: Always use 0x2000 for maxim variable size
Ruiyu Ni [Wed, 26 Jul 2017 09:26:41 +0000 (17:26 +0800)]
Nt32Pkg: Always use 0x2000 for maxim variable size

Currently the PcdMaxVariableSize is controlled by the below condition
check:

!if $(SECURE_BOOT_ENABLE) == TRUE || $(TLS_ENABLE) == TRUE
  gEfiMdeModulePkgTokenSpaceGuid.PcdMaxVariableSize|0x2000
!endif

But for other case, PcdMaxVariableSize is also required with the value
of 0x2000 (e,g. NetworkPkg/IScsiDxe), so remove the condition of
PcdMaxVariableSize for NT32 platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
4 years agoIntelSiliconPkg/dsc: Add PlatformVtd sample driver.
Jiewen Yao [Tue, 18 Jul 2017 03:52:35 +0000 (11:52 +0800)]
IntelSiliconPkg/dsc: Add PlatformVtd sample driver.

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 agoIntelSiliconPkg: Add PlatformVTdSample driver.
Jiewen Yao [Mon, 17 Jul 2017 08:24:09 +0000 (16:24 +0800)]
IntelSiliconPkg: Add PlatformVTdSample driver.

It provides sample on Platform VTd policy protocol.
This protocol is optional.

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 agoIntelSiliconPkg/dsc: Add Vtd driver.
Jiewen Yao [Mon, 26 Jun 2017 06:02:36 +0000 (14:02 +0800)]
IntelSiliconPkg/dsc: Add Vtd driver.

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 agoIntelSiliconPkg: Add VTd driver.
Jiewen Yao [Sat, 25 Mar 2017 08:59:36 +0000 (16:59 +0800)]
IntelSiliconPkg: Add VTd driver.

It provides AllocateBuffer/FreeBuffer/Map/Unmap function.
It also provides VTd capability yet.

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 agoIntelSiliconPkg/Dec: Add ProtocolGuid.
Jiewen Yao [Mon, 26 Jun 2017 05:53:07 +0000 (13:53 +0800)]
IntelSiliconPkg/Dec: Add ProtocolGuid.

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 agoIntelSiliconPkg/Include: Add PlatformVtdPolicy Protocol
Jiewen Yao [Mon, 26 Jun 2017 05:51:40 +0000 (13:51 +0800)]
IntelSiliconPkg/Include: Add PlatformVtdPolicy Protocol

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 agoIntelSiliconPkg/Include: Add VTD industry standard.
Jiewen Yao [Wed, 21 Jun 2017 06:24:50 +0000 (14:24 +0800)]
IntelSiliconPkg/Include: Add VTD industry standard.

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 agoShellPkg/map: Recognize CDROM change
Ruiyu Ni [Tue, 25 Jul 2017 07:30:23 +0000 (15:30 +0800)]
ShellPkg/map: Recognize CDROM change

The patch adds logic to probe the media change for physical
block devices. So that when media change happens, the BlockIo
is re-installed again.

It fixes the issue when CDROM is removed UEFI Shell still shows
the BlockIo in the output of "map -r".

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoMdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR
Star Zeng [Tue, 25 Jul 2017 03:24:01 +0000 (11:24 +0800)]
MdeModulePkg Xhci: Also RecoverHaltedEndpoint for BABBLE_ERROR

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

According to XHCI spec:
4.10.2.1 Stall Error

4.10.2.4 Babble Detected Error
When a device transmits more data on the USB than the host controller
is expecting for a transaction, it is defined to be babbling.
In general, this is called a Babble Error. When a device sends more
data than the TD Transfer Size bytes (TD Babble), unexpected activity
that persists beyond a specified point in a (micro)frame (Frame Babble),
or a packet greater than Max Packet Size (Packet Babble), the host
controller shall set the Babble Detected Error in the Completion Code
field of the TRB, generate an Error Event, and halt the endpoint
(refer to Section 4.10.2.1).

This patch is to also check for EFI_USB_ERR_BABBLE error returned as
a TransferResult and then proceed to XhcRecoverhaltedEndPoint.

Cc: Vladimir Olovyannikov <vladimir.olovyannikov@broadcom.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM buffer
Star Zeng [Fri, 21 Jul 2017 03:36:29 +0000 (11:36 +0800)]
MdeModulePkg SmmLockBoxDxeLib: Get SmmCommRegion for COMM buffer

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

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

This patch is to get SmmCommRegion by
gEdkiiPiSmmCommunicationRegionTableGuid for COMM buffer

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Baraneedharan Anbazhagan <anbazhagan@hp.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 agoMdePkg/ResetNotification: Rename to UnregisterResetNotify
Ruiyu Ni [Wed, 19 Jul 2017 09:14:28 +0000 (17:14 +0800)]
MdePkg/ResetNotification: Rename to UnregisterResetNotify

UEFI Spec uses UnRegisterResetNotify in protocol structure
definition but uses UnregisterResetNotify in the function
prototype definition.

By searching the entire spec, Unregister* is used for
SIMPLE_TEXT_INPUT_EX_PROTOCOL.UnregisterKeyNotify(). So choose
to use UnregisterResetNotify for consistency.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoNt32Pkg: Add the ResetSystemLib in Nt32 Platform.
HuajingLi [Sat, 22 Jul 2017 07:40:53 +0000 (15:40 +0800)]
Nt32Pkg: Add the ResetSystemLib in Nt32 Platform.

Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdePkg: Add UEFI 2.7 defined GUID and structure for KMS protocol.
Fu Siyuan [Wed, 19 Jul 2017 06:24:22 +0000 (14:24 +0800)]
MdePkg: Add UEFI 2.7 defined GUID and structure for KMS protocol.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Fu Siyuan <siyuan.fu@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
4 years agoShellPkg/ls: Display the file time in local time.
Li Huajing [Mon, 24 Jul 2017 07:46:03 +0000 (15:46 +0800)]
ShellPkg/ls: Display the file time in local time.

Signed-off-by: Li Huajing <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoNt32Pkg/WinNtSimpleFileSystemDxe: Change GetInfo() to get TimeZone.
Li Huajing [Mon, 24 Jul 2017 07:31:42 +0000 (15:31 +0800)]
Nt32Pkg/WinNtSimpleFileSystemDxe: Change GetInfo() to get TimeZone.

Signed-off-by: Huajing Li <huajing.li@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoBaseTools: Fix the bug that warn() function with only 1 argument
Yonghong Zhu [Tue, 25 Jul 2017 05:38:30 +0000 (13:38 +0800)]
BaseTools: Fix the bug that warn() function with only 1 argument

In the definition, the warn() function takes at least 2 arguments.

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 agoBaseTools: add some comment for .PrebuildEnv file's usage
Yonghong Zhu [Tue, 25 Jul 2017 05:56:53 +0000 (13:56 +0800)]
BaseTools: add some comment for .PrebuildEnv file's usage

This patch add some comments to explain why we use .PrebuildEnv file to
save environment variable settings set by the prebuild script.

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 agoUefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN
Liming Gao [Tue, 11 Jul 2017 03:33:58 +0000 (11:33 +0800)]
UefiCpuPkg: Update RegisterCpuFeaturesLib to consume PcdGetSize with UINTN

PcdGetSize() returns UINTN data type. The consumer code should use UINTN data
to get its size.

This issue is found when PcdCpuFeaturesSupport is configured as patchable.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg: Update RegisterCpuFeaturesLib module UNI to match it
Liming Gao [Tue, 11 Jul 2017 03:32:40 +0000 (11:32 +0800)]
UefiCpuPkg: Update RegisterCpuFeaturesLib module UNI to match it

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdeModulePkg: Update NonDiscoverableDeviceRegistrationLib file header format
Liming Gao [Tue, 11 Jul 2017 03:32:12 +0000 (11:32 +0800)]
MdeModulePkg: Update NonDiscoverableDeviceRegistrationLib file header format

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 agoMdePkg UsbFunctionIo.h: Update comments for GetDeviceInfo return status
Star Zeng [Wed, 19 Jul 2017 10:16:31 +0000 (18:16 +0800)]
MdePkg UsbFunctionIo.h: Update comments for GetDeviceInfo return status

UEFI spec 2.6 errata B update Status Codes Returned table of the
EFI_USBFN_IO_PROTOCOL.GetDeviceInfo function as follows:

1. Update EFI_INVALID_PARAMETER description:
Original text:
A parameter is invalid.
New text:
One or more of the following conditions is TRUE:
BufferSize is NULL.
*BufferSize is not 0 and Buffer is NULL.
Id in invalid.

2. Update EFI_BUFFER_TOO_SMALL description:
Original text:
Supplied buffer isn’t large enough to hold the request string.
New text:
The buffer is too small to hold the buffer.
*BufferSize has been updated with the size needed to hold the
request string.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
4 years agoUefiCpuPkg: Remove deprecated CPU feature.
Eric Dong [Thu, 20 Jul 2017 05:46:12 +0000 (13:46 +0800)]
UefiCpuPkg: Remove deprecated CPU feature.

Senter feature could not be a single feature,
it has been merge to Smx feature, so remove it.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdeModulePkg SmmAccess: Update comments to follow PI spec.
Eric Dong [Wed, 19 Jul 2017 02:34:59 +0000 (10:34 +0800)]
MdeModulePkg SmmAccess: Update comments to follow PI spec.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoMdePkg SmmAccess2: Update comments to follow PI spec.
Eric Dong [Wed, 19 Jul 2017 02:32:38 +0000 (10:32 +0800)]
MdePkg SmmAccess2: Update comments to follow PI spec.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Ruiyu Ni <ruiyu.ni@intel.com>
4 years agoUefiCpuPkg CpuCommonFeaturesLib: Enable Ppin feature.
Eric Dong [Fri, 14 Jul 2017 02:22:04 +0000 (10:22 +0800)]
UefiCpuPkg CpuCommonFeaturesLib: Enable Ppin feature.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg: Add feature definition for PPIN.
Eric Dong [Fri, 14 Jul 2017 02:15:01 +0000 (10:15 +0800)]
UefiCpuPkg: Add feature definition for PPIN.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoUefiCpuPkg RegisterCpuFeaturesLib: Add error handling.
Eric Dong [Fri, 14 Jul 2017 02:23:48 +0000 (10:23 +0800)]
UefiCpuPkg RegisterCpuFeaturesLib: Add error handling.

Disable CPU feature may return error, add error handling
code to handle it instead of assert it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoMdeModulePkg/DxeCore: Avoid accessing non-owned memory
Ruiyu Ni [Wed, 5 Jul 2017 10:45:56 +0000 (18:45 +0800)]
MdeModulePkg/DxeCore: Avoid accessing non-owned memory

The patch fixes two kinds of bugs in DxeCore that accesses memory
which might be freed or owned by other modules.
The two bugs don't cause functionality issue.

1. CoreValidateHandle() checks whether the handle is valid by
   validating its signature. The proper way is to check whether
   the handle is in the handle database.
2. CoreDisconnectControllersUsingProtocolInterface() and
   CoreOpenProtocol() de-reference Link pointer which is
   already freed. The proper way is to not de-reference the pointer.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
4 years agoMdePkg DxeHstiLib: Fix memory leak issue
Star Zeng [Fri, 14 Jul 2017 08:47:59 +0000 (16:47 +0800)]
MdePkg DxeHstiLib: Fix memory leak issue

The Hsti returned from InternalHstiFindAip() and temporally
allocated NewHsti need to be freed after used.

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 agoMdePkg Hsti.h: Update version info to 1.1a
Star Zeng [Fri, 14 Jul 2017 08:43:45 +0000 (16:43 +0800)]
MdePkg Hsti.h: Update version info to 1.1a

The definition for 1.1a has no difference with 1.0.

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 agoEmbeddedPkg/DwEmmc: Adjust FIFO threshold
Jun Nie [Fri, 7 Jul 2017 09:21:37 +0000 (17:21 +0800)]
EmbeddedPkg/DwEmmc: Adjust FIFO threshold

Adjust FIFO threshold according to FIFO depth. Skip
the adjustment if we do not have FIFO depth info.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Acked-by: Haojian Zhuang <haojian.zhuang@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoEmbeddedPkg/DwEmmcDxe: limit max clock for platform
Jun Nie [Wed, 5 Jul 2017 08:27:07 +0000 (16:27 +0800)]
EmbeddedPkg/DwEmmcDxe: limit max clock for platform

Some boards may have max clock limitation. Add a Pcd to notify
driver.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoArmPlatformPkg: Support different PL011 reg offset
Jun Nie [Fri, 7 Jul 2017 09:18:45 +0000 (17:18 +0800)]
ArmPlatformPkg: Support different PL011 reg offset

ZTE/SanChip version pl011 has different reg offset and bit offset
for some registers.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jun Nie <jun.nie@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
4 years agoCryptoPkg/OpensslLib AARCH64: clear XIP CC flags
Ard Biesheuvel [Fri, 14 Jul 2017 17:09:03 +0000 (18:09 +0100)]
CryptoPkg/OpensslLib AARCH64: clear XIP CC flags

Commit 0df6c8c157af ("BaseTools/tools_def AARCH64: avoid SIMD registers
in XIP code") updated the compiler flags used by AARCH64 when building
modules (including BASE libraries) that may execute before the MMU is
enabled.

This broke the build for OpensslLib/OpensslLibCrypto because the SIMD
register file is shared with the FPU, and since OpenSSL contains some
references to float/double types (which are mostly unused for UEFI btw),
disabling floating point prevents the compiler from building OpenSSL
at all. So for OpensslLib[Crypto], we need to override the XIP CC flags,
to remove the -mgeneral-regs-only compiler flag again.

When introducing the support for XIP CC flags, we were aware that this
would affect BASE libraries as well, but were not expecting this to
have any performance impact. However, in the case of software crypto,
it makes sense not to needlessly inhibit the compiler's ability to
generate fast code, and even if OpenssLib is a BASE library, it is
guaranteed not to run with the MMU off. So omit -mstrict-align from the
local XIP CC flags override as well.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Long Qin <qin.long@intel.com>
4 years agoBaseTools/tools_def AARCH64: avoid SIMD registers in XIP code
Ard Biesheuvel [Thu, 13 Jul 2017 12:44:27 +0000 (13:44 +0100)]
BaseTools/tools_def AARCH64: avoid SIMD registers in XIP code

XIP code may execute with the MMU off, in which case all memory accesses
should be strictly aligned to their size. Some versions of GCC violate
this restriction even when -mstrict-align is passed, when performing
loads and stores that involve SIMD registers. This is clearly a bug in
the compiler, but we can easily work around it by avoiding SIMD registers
altogether when building code that may execute in such a context. So add
-mgeneral-regs-only to the AARCH64 XIP CC flags.

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 agoBaseTools/tools_def AARCH64: mark register x18 as reserved
Ard Biesheuvel [Thu, 13 Jul 2017 12:41:12 +0000 (13:41 +0100)]
BaseTools/tools_def AARCH64: mark register x18 as reserved

The AArch64 ABI classifies register x18 as a platform register, which
means it should not be used unless the code is guaranteed to run on a
platform that doesn't use it in such a capacity.

GCC does not honour this requirement by default, and so we need to tell
it not to touch it explicitly, by passing the -ffixed-x18 command line
option.

Link: https://bugzilla.tianocore.org/show_bug.cgi?id=625
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 agoBaseTools/Build: Support python scripts in PREBUILD/POSTBUILD
Michael Kinney [Tue, 31 Jan 2017 17:21:20 +0000 (09:21 -0800)]
BaseTools/Build: Support python scripts in PREBUILD/POSTBUILD

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

Add shell=True in Popen() calls to support direct execution of
python scripts

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
4 years agoUefiCpuPkg CpuCommonFeaturesLib: Fix smx/vmx enable logic error.
Eric Dong [Tue, 11 Jul 2017 02:07:36 +0000 (10:07 +0800)]
UefiCpuPkg CpuCommonFeaturesLib: Fix smx/vmx enable logic error.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed: Jeff Fan <jeff.fan@intel.com>

4 years agoUefiCpuPkg RegisterCpuFeaturesLib: Add error handling code.
Eric Dong [Tue, 11 Jul 2017 02:06:56 +0000 (10:06 +0800)]
UefiCpuPkg RegisterCpuFeaturesLib: Add error handling code.

Add error handling code when initialize the CPU feature failed.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Suppress GCC49 IA32 build failure
Brijesh Singh [Tue, 11 Jul 2017 18:38:13 +0000 (14:38 -0400)]
OvmfPkg/QemuFwCfgLib: Suppress GCC49 IA32 build failure

NumPages variable was introduced in commit 66c548be509d. In this commit
we allocate an intermediate buffer when SEV is enabled. The 'BounceBuffer'
variable points to the intermediate buffer pointer and NumPages variables
stores the number of pages. Later in the code, 'BounceBuffer' variable is
checked to see if we need to free the intermediate buffers. The code looks
correct, suppress the warning.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Reported-by: Gerd Hoffmann <kraxel@redhat.com>
Reported-by: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: s/warnigns/warnings/ in the code comment]
[lersek@redhat.com: add Gerd's Reported-by]
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
4 years agoMdePkg: Declare _ReturnAddress() in Base.h for MSFT tool chain
Liming Gao [Wed, 5 Jul 2017 05:57:07 +0000 (13:57 +0800)]
MdePkg: Declare _ReturnAddress() in Base.h for MSFT tool chain

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

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
4 years agoOvmfPkg: update PciHostBridgeDxe to use PlatformHasIoMmuLib
Brijesh Singh [Thu, 6 Jul 2017 13:29:24 +0000 (09:29 -0400)]
OvmfPkg: update PciHostBridgeDxe to use PlatformHasIoMmuLib

This patch enables PciHostBridgeDxe driver to use Platform IoMMU detection
library to ensure that PciHostBridgeDxe is run after platform IoMmuDxe
driver has checked whether platform need to install IOMMU protocol provider.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Add SEV support
Brijesh Singh [Thu, 6 Jul 2017 13:29:19 +0000 (09:29 -0400)]
OvmfPkg/QemuFwCfgLib: Add SEV support

When SEV is enabled, use a bounce buffer to perform the DMA operation.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Add option to dynamic alloc FW_CFG_DMA Access
Brijesh Singh [Thu, 6 Jul 2017 13:29:13 +0000 (09:29 -0400)]
OvmfPkg/QemuFwCfgLib: Add option to dynamic alloc FW_CFG_DMA Access

Update InternalQemuFwCfgDmaBytes() to work with DMA Access pointer.
The change provides the flexibility to dynamically allocate the "Access"
when SEV is enabled.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Implement SEV internal function for Dxe phase
Brijesh Singh [Thu, 6 Jul 2017 13:29:08 +0000 (09:29 -0400)]
OvmfPkg/QemuFwCfgLib: Implement SEV internal function for Dxe phase

When SEV is enabled, the DMA must be performed on unencrypted pages.
So when get asked to perfom FWCFG DMA read or write, we allocate a
intermediate (bounce buffer) unencrypted buffer and use this buffer
for DMA read or write.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
4 years agoOvmfPkg/QemuFwCfgLib: Implement SEV internal functions for PEI phase
Brijesh Singh [Thu, 6 Jul 2017 13:29:03 +0000 (09:29 -0400)]
OvmfPkg/QemuFwCfgLib: Implement SEV internal functions for PEI phase

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Implement SEV internal function for SEC phase
Brijesh Singh [Thu, 6 Jul 2017 13:28:58 +0000 (09:28 -0400)]
OvmfPkg/QemuFwCfgLib: Implement SEV internal function for SEC phase

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Prepare for SEV support
Brijesh Singh [Thu, 6 Jul 2017 13:28:53 +0000 (09:28 -0400)]
OvmfPkg/QemuFwCfgLib: Prepare for SEV support

Add SEV specific internal functions which will be used while intergrating
the SEV support into QemuFwCfgLib.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/QemuFwCfgLib: Provide Pei and Dxe specific library
Brijesh Singh [Thu, 6 Jul 2017 13:28:47 +0000 (09:28 -0400)]
OvmfPkg/QemuFwCfgLib: Provide Pei and Dxe specific library

Current QemuFwCfgLib.inf is used in both Pei and Dxe phases. Add Pei
and Dxe inf file to provide a seperate QemuFwCfgLib instances for Pei
and Dxe phases.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg: Add IoMmuDxe driver
Brijesh Singh [Thu, 6 Jul 2017 13:28:40 +0000 (09:28 -0400)]
OvmfPkg: Add IoMmuDxe driver

The IOMMU protocol driver provides capabilities to set a DMA access
attribute and methods to allocate, free, map and unmap the DMA memory
for the PCI Bus devices.

Due to security reasons all DMA operations inside the SEV guest must
be performed on shared (i.e unencrypted) pages. The IOMMU protocol
driver for the SEV guest uses a bounce buffer to map guest DMA buffer
to shared pages inorder to provide the support for DMA operations inside
SEV guest.

IoMmuDxe driver looks for SEV capabilities, if present then it installs
the real IOMMU protocol otherwise it installs placeholder protocol.
Currently, PciHostBridgeDxe and QemuFWCfgLib need to know the existance
of IOMMU protocol. The modules needing to know the existance of IOMMU
support should add

  gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid

in their depex to ensure that platform IOMMU detection has been performed.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leo Duran <leo.duran@amd.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg: Add PlatformHasIoMmuLib
Brijesh Singh [Thu, 6 Jul 2017 13:27:58 +0000 (09:27 -0400)]
OvmfPkg: Add PlatformHasIoMmuLib

Add the shorter-term library instance outlined in the previous patch to
OvmfPkg, so that we can imbue PciHostBridgeDxe with a protocol dependency
on gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg: Introduce IoMmuAbsent Protocol GUID
Brijesh Singh [Thu, 6 Jul 2017 13:26:50 +0000 (09:26 -0400)]
OvmfPkg: Introduce IoMmuAbsent Protocol GUID

Platforms that optionally provide an IOMMU protocol should do so by
including a DXE driver (usually called IoMmuDxe) that produces either
the IOMMU protocol -- if the underlying capabilities are available --,
or gIoMmuAbsentProtocolGuid, to signal that the IOMMU capability
detection completed with negative result (i.e., no IOMMU will be
available in the system).

In turn, DXE drivers (and library instances) that are supposed to use
the IOMMU protocol if it is available should add the following to
their DEPEX:

gEdkiiIoMmuProtocolGuid OR gIoMmuAbsentProtocolGuid

This ensures these client modules will only be dispatched after IOMMU
detection completes (with positive or negative result).

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leo Duran <leo.duran@amd.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Jordan Justen <jordan.l.justen@intel.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg: Add AmdSevDxe driver
Brijesh Singh [Thu, 6 Jul 2017 13:26:45 +0000 (09:26 -0400)]
OvmfPkg: Add AmdSevDxe driver

When SEV is enabled, the MMIO memory range must be mapped as unencrypted
(i.e C-bit cleared).

We need to clear the C-bit for MMIO GCD entries in order to cover the
ranges that were added during the PEI phase (through memory resource
descriptor HOBs). Additionally, the NonExistent ranges are processed
in order to cover, in advance, MMIO ranges added later in the DXE phase
by various device drivers, via the appropriate DXE memory space services.

The approach is not transparent for later addition of system memory ranges
to the GCD memory space map. (Such ranges should be encrypted.) OVMF does
not do such a thing at the moment, so this approach should be OK.

The driver is being added to the APRIORI DXE file so that, we clear the
C-bit from MMIO regions before any driver accesses it.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Leo Duran <leo.duran@amd.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Suggested-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled
Brijesh Singh [Thu, 6 Jul 2017 13:25:48 +0000 (09:25 -0400)]
OvmfPkg/PlatformPei: Set memory encryption PCD when SEV is enabled

Secure Encrypted Virtualization (SEV) guest VMs have the concept of
private and shared memory. Private memory is encrypted with the
guest-specific key, while shared memory may be encrypted with hypervisor
key.  Certain types of memory (namely instruction pages and guest page
tables) are always treated as private memory by the hardware.
For data memory, SEV guest VMs can choose which pages they would like
to be private. The choice is done using the standard CPU page tables
using the C-bit. When building the initial page table we mark all the
memory as private.

The patch sets the memory encryption PCD. The PCD is consumed by the
following edk2 modules, which manipulate page tables:

- PEI phase modules: CapsulePei, DxeIplPeim, S3Resume2Pei.

CapsulePei is not used by OVMF. DxeIplPeim consumes the PCD at the
end of the PEI phase, when it builds the initial page tables for the
DXE core / DXE phase. S3Resume2Pei does not consume the PCD in its
entry point function, only when DxeIplPeim branches to the S3 resume
path at the end of the PEI phase, and calls S3Resume2Pei's
EFI_PEI_S3_RESUME2_PPI.S3RestoreConfig2() member function.

Therefore it is safe to set the PCD for these modules in PlatformPei.

- DXE phase modules: BootScriptExecutorDxe, CpuDxe, PiSmmCpuDxeSmm.

They are all dispatched after the PEI phase, so setting the PCD for
them in PlatformPei is safe. (BootScriptExecutorDxe is launched "for
real" in the PEI phase during S3 resume, but it caches the PCD into a
static variable when its entry point is originally invoked in DXE.)

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg/BaseMemcryptSevLib: Add SEV helper library
Brijesh Singh [Thu, 6 Jul 2017 13:21:12 +0000 (09:21 -0400)]
OvmfPkg/BaseMemcryptSevLib: Add SEV helper library

Add Secure Encrypted Virtualization (SEV) helper library.
The library provides the routines to:
-  set or clear memory encryption bit for a given memory region.
-  query whether SEV is enabled.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Jordan Justen <jordan.l.justen@intel.com>
4 years agoOvmfPkg: Update dsc to use IoLib from BaseIoLibIntrinsicSev.inf
Brijesh Singh [Thu, 6 Jul 2017 13:21:12 +0000 (09:21 -0400)]
OvmfPkg: Update dsc to use IoLib from BaseIoLibIntrinsicSev.inf

When SEV is enabled then we must unroll the rep String I/O instructions.

The patch updates dsc file to use SEV version of IoLib inf. The main
difference between BaseIoLibIntrinsic.inf and BaseIoLibIntrinsicSev.inf
is, SEV version checks if its running under SEV enabled guest, If so
then it unroll the String I/O (REP INS/OUTS) otherwise fallbacks to
rep ins/outs.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>