mirror_edk2.git
3 years agoBaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain
Liming Gao [Thu, 6 Apr 2017 00:45:32 +0000 (08:45 +0800)]
BaseTools: Update tools_def.template to add -fno-builtin in GCC tool chain

Now, -fno-builtin option is added for the specific GCC tool chain.
It is a generic option. It can be moved to common GCC option to keep
the consistent compiler option.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Liming Gao <liming.gao@intel.com>
Suggested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoSecurityPkg: SecureBootConfigDxe: Update CloseEnrolledFile comment
Zhang, Chao B [Thu, 6 Apr 2017 07:13:57 +0000 (15:13 +0800)]
SecurityPkg: SecureBootConfigDxe: Update CloseEnrolledFile comment

Update function CloseEnrolledFile comment introduced in
4de754e15fec9c94ce7677904efd0022c211721b

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Bi Dandan <dandan.bi@intel.com>
3 years agoNetworkPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:10:39 +0000 (10:10 +0800)]
NetworkPkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
3 years agoMdePkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:05:54 +0000 (10:05 +0800)]
MdePkg: Convert files to CRLF line ending

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>
3 years agoSignedCapsulePkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:03:57 +0000 (10:03 +0800)]
SignedCapsulePkg: Convert files to CRLF line ending

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>
3 years agoIntelFsp2WrapperPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:02:29 +0000 (10:02 +0800)]
IntelFsp2WrapperPkg: Convert files to CRLF line ending

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>
3 years agoIntelFsp2Pkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 02:01:09 +0000 (10:01 +0800)]
IntelFsp2Pkg: Convert files to CRLF line ending

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>
3 years agoCryptoPkg: Convert files to CRLF line ending
Hao Wu [Thu, 6 Apr 2017 01:53:07 +0000 (09:53 +0800)]
CryptoPkg: Convert files to CRLF line ending

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hao Wu <hao.a.wu@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoBaseTools: update error message for SKUID_IDENTIFIER format
Yonghong Zhu [Sat, 1 Apr 2017 05:57:16 +0000 (13:57 +0800)]
BaseTools: update error message for SKUID_IDENTIFIER format

Per DSC spec, the SkuUiName use '|' as separator, so this patch update
the error message to use '|' but not space as separator.

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>
3 years agoBaseTools: Add the missing copyrights in BrotliCompress.bat
Liming Gao [Wed, 5 Apr 2017 04:57:27 +0000 (12:57 +0800)]
BaseTools: Add the missing copyrights in BrotliCompress.bat

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>
3 years agoMdeModulePkg: Remove unsupported PcdExpression usage in module INF
Liming Gao [Fri, 31 Mar 2017 05:03:59 +0000 (13:03 +0800)]
MdeModulePkg: Remove unsupported PcdExpression usage in module INF

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

PcdExpression used in INF to control PCD and Source is unsupported feature.
Current sample usage in module INF brings confuse.

Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@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>
3 years agoSecurityPkg: SecureBootConfigDxe: Support AUTH_2 enrollment to DBX
Zhang, Chao B [Tue, 28 Feb 2017 02:23:19 +0000 (10:23 +0800)]
SecurityPkg: SecureBootConfigDxe: Support AUTH_2 enrollment to DBX

Update SecureBootConfigDxe to support AUTH_2 format data enrollment
to DBX.
Free opened file handle resource after exit PK/KEK/DB/DBX/DBT
enrollment page.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Chao Zhang <chao.b.zhang@intel.com>
Reviewed-by: Long Qin <qin.long@intel.com>
3 years agoUefiCpuPkg: Fix typos in UefiCpuPkg.dec
Dandan Bi [Wed, 5 Apr 2017 14:32:16 +0000 (22:32 +0800)]
UefiCpuPkg: Fix typos in UefiCpuPkg.dec

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>
3 years agoMdeModulePkg: move PlatformHasAcpiGuid from EmbeddedPkg
Ard Biesheuvel [Wed, 5 Apr 2017 09:35:06 +0000 (10:35 +0100)]
MdeModulePkg: move PlatformHasAcpiGuid from EmbeddedPkg

Given the agreement on the edk2-devel regarding the fact that the
notion whether or not a 'platform has ACPI' is a universal one, move
the PlatformHasAcpi GUID to MdeModulePkg.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: "Zeng, Star" <star.zeng@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmJunoDxe: simplify ACPI table installation
Ard Biesheuvel [Thu, 30 Mar 2017 13:03:54 +0000 (14:03 +0100)]
ArmPlatformPkg/ArmJunoDxe: simplify ACPI table installation

Having a three way conditional with callbacks would make sense if the
callbacks weren't (a) identical and (b) didn't return TRUE all the
time. So get rid of the kludge.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmJunoPkg: remove PCI host bridge driver
Ard Biesheuvel [Thu, 30 Mar 2017 10:38:09 +0000 (11:38 +0100)]
ArmPlatformPkg/ArmJunoPkg: remove PCI host bridge driver

We are switching the Juno platform to the generic host bridge driver,
which involves implementing PciHostBridgeLib for this platform, and
plugging it into MdeModulePkg's PciHostBridgeDxe.inf.

Since the platform descriptions no longer live in upstream EDK2, the
PciHostBridgeLib implementation (which reuses some of the code removed
here) will live there as well. But this PciHostBridgeDxe driver is no
longer used, so remove it.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmJunoDxe: don't register OnEndOfDxe event on rev R0
Ard Biesheuvel [Tue, 4 Apr 2017 11:58:58 +0000 (12:58 +0100)]
ArmPlatformPkg/ArmJunoDxe: don't register OnEndOfDxe event on rev R0

The ArmJunoDxe driver code registers a callback for the EndOfDxe event,
at which time it does some manipulation of the PCI peripherals on the
board. Given that R0 has no working PCIe, instead of conditionally
performing these operations, omit the registration of the
callback altogether on that platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmJunoDxe: use the generic non-discoverable device support
Ard Biesheuvel [Thu, 30 Mar 2017 09:31:44 +0000 (10:31 +0100)]
ArmPlatformPkg/ArmJunoDxe: use the generic non-discoverable device support

Replace the open coded reimplementation of 'PCI emulation' with a pair
of calls into NonDiscoverableDeviceRegistrationLib to register the OHCI
and EHCI controllers. These will be picked up by the generic driver instead.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmJunoDxe: remove BdsLib dependency
Ard Biesheuvel [Thu, 30 Mar 2017 12:57:00 +0000 (13:57 +0100)]
ArmPlatformPkg/ArmJunoDxe: remove BdsLib dependency

The ArmJunoDxe driver does not actually depend on the deprecated BdsLib
so remove the dependency declaration from the INF file.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency
Ard Biesheuvel [Wed, 29 Mar 2017 12:13:26 +0000 (13:13 +0100)]
ArmPlatformPkg/ArmShellCmdRunAxf: remove BdsLib dependency

Remove ArmShellCmdRunAxf's dependency on the deprecated BdsLib by
cloning the ShutdownUefiBootServices() routine into a local source
file; this is the only BdsLib feature 'runaxf' depends on.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Ryan Harkin <ryan.harkin@linaro.org>
Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>
3 years agoUefiCpuPkg/CpuFeatures: Change files format to DOS
Jeff Fan [Wed, 5 Apr 2017 08:33:16 +0000 (16:33 +0800)]
UefiCpuPkg/CpuFeatures: Change files format to DOS

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
3 years agoShellPkg/setvar: Add assertion indicating TempData shouldn't be NULL
Ruiyu Ni [Wed, 5 Apr 2017 05:56:30 +0000 (13:56 +0800)]
ShellPkg/setvar: Add assertion indicating TempData shouldn't be NULL

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoUefiCpuPkg/MtrrLib:Fix VS2012 build failure
Dandan Bi [Wed, 5 Apr 2017 01:00:01 +0000 (09:00 +0800)]
UefiCpuPkg/MtrrLib:Fix VS2012 build failure

Cc: Ruiyu Ni <ruiyu.ni@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: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoMdeModulePkg/UefiHiiLib:Fix incorrect comparison expression
Dandan Bi [Sat, 1 Apr 2017 02:31:14 +0000 (10:31 +0800)]
MdeModulePkg/UefiHiiLib:Fix incorrect comparison expression

Fix the incorrect comparison between pointer and constant zero character.

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

V2: The pointer StringPtr points to a string returned
by ExtractConfig/ExportConfig, if it is NULL, function
InternalHiiIfrValueAction will return FALSE. So in
current usage model, the StringPtr can not be NULL before
using it, so we can add ASSERT here.

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: Eric Dong <eric.dong@intel.com>
3 years agoBaseTools/UPT: Fix a parser issue
Hess Chen [Sat, 1 Apr 2017 05:33:05 +0000 (13:33 +0800)]
BaseTools/UPT: Fix a parser issue

Update the method to get PCD information and support empty section.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools/UPT: Support Unicode path
Hess Chen [Sat, 1 Apr 2017 05:33:04 +0000 (13:33 +0800)]
BaseTools/UPT: Support Unicode path

Update the IpiDb.py to support Unicode path for localization

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoBaseTools/UPT: Use a simple way to get package path
Hess Chen [Sat, 1 Apr 2017 05:33:03 +0000 (13:33 +0800)]
BaseTools/UPT: Use a simple way to get package path

Instead of parsing all content of DEC file, just get the package
path only to save time.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Hess Chen <hesheng.chen@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
3 years agoArmVirtPkg/ArmVirtQemuKernel: increase slack space for DTB
Ard Biesheuvel [Tue, 4 Apr 2017 14:40:01 +0000 (15:40 +0100)]
ArmVirtPkg/ArmVirtQemuKernel: increase slack space for DTB

The relocatable build of ArmVirtQemuKernel is designed to be executed
from RAM, and contains some scratch memory at the start of the image
to use as a stack very early on, and to preserve the DTB image received
from QEMU while it discovers and initializes memory.

It turns out that 8 KB is a bit on the small side here, especially when
executing with secure world emulation enabled, in which case there are
additional nodes present.

So increase the slack space to 32 KB.

While at it, remove a stale Xen reference that was copy/pasted when this
file was created.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/PlatformPeiLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:20:12 +0000 (14:20 +0100)]
ArmVirtPkg/PlatformPeiLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 13:07:16 +0000 (14:07 +0100)]
ArmVirtPkg/FdtPL011SerialPortLib: honor DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain DT nodes whose status is set to 'secure'. Similarly, the
status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property
Ard Biesheuvel [Tue, 4 Apr 2017 12:55:44 +0000 (13:55 +0100)]
ArmVirtPkg/FdtClientDxe: honor memory DT node 'status' property

In some cases, (e.g., when running QEMU with TrustZone emulation), the
DT may contain memory nodes whose status is set to 'secure'. Similarly,
the status may be set to 'disabled' if the consumer of the DT image is
expected to treat it as if it weren't there.

So check whether a 'status' property is present, and if so, ignore the
node if the status is not 'okay'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoNetworkPkg: Fix some bugs related to iSCSI keyword configuration.
Zhang, Lubo [Fri, 24 Mar 2017 08:43:04 +0000 (16:43 +0800)]
NetworkPkg: Fix some bugs related to iSCSI keyword configuration.

Add check logic and error message for some keywords validity.
show target address in URL format and MAC address correctly.

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: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero
Jiaxin Wu [Sat, 1 Apr 2017 00:21:03 +0000 (08:21 +0800)]
MdeModulePkg/DxeHttpLib: Avoid the pointless comparison of UINTN with zero

UINTN is unsigned integer, so it's pointless to compare it with zero.

Cc: Bi Dandan <dandan.bi@intel.com>
Cc: Zhang Lubo <lubo.zhang@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: Zhang Lubo <lubo.zhang@intel.com>
3 years agoBaseTools: Enhance StrDefs.h to include ImageDefs.h
Yonghong Zhu [Fri, 31 Mar 2017 14:05:28 +0000 (22:05 +0800)]
BaseTools: Enhance StrDefs.h to include ImageDefs.h

Enhance StrDefs.h to include ImageDefs.h for VfrCompiler to support
IMAGE_TOKEN usage.

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>
3 years agoBaseTools: Enhance expression to support some more operation
Yonghong Zhu [Fri, 31 Mar 2017 13:47:59 +0000 (21:47 +0800)]
BaseTools: Enhance expression to support some more operation

Enhance expression to support some more operation that allowed in the
spec, eg: *, /, %, <<, >>, ~.

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>
3 years agoVlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib
Ruiyu Ni [Sat, 1 Apr 2017 05:14:57 +0000 (13:14 +0800)]
Vlv2TbltDevicePkg: Fix build failure by adding UefiBootManagerLib

Recent ConPlatformDxe driver change depends on UefiBootManagerLib.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoMdePkg/Shell.h: Update Shell version from 2.1 to 2.2
Ruiyu Ni [Fri, 31 Mar 2017 14:23:13 +0000 (22:23 +0800)]
MdePkg/Shell.h: Update Shell version from 2.1 to 2.2

All the Shell 2.2 features are implemented except DMEM/MM
changes which are pending on spec change.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Kinney D Michael <kinney.d.michael@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile
Jeff Fan [Tue, 28 Mar 2017 06:01:24 +0000 (14:01 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Update saved SMM ranges check in SmmProfile

SmmProfile feature required to protect all SMM ranges by structure
mProtectionMemRangeTemplate. This update is to add additonal save SMM ranges
into mProtectionMemRangeTemplate besides the range specified by
mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range
Jeff Fan [Tue, 28 Mar 2017 05:51:52 +0000 (13:51 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add IsInSmmRanges() to check SMM range

Internal function IsInSmmRanges() is added t check SMM range by saved SMM ranges
beside by mCpuHotPlugData.SmrrBase/mCpuHotPlugData.SmrrSiz.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables
Jeff Fan [Tue, 28 Mar 2017 00:48:17 +0000 (08:48 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Save SMM ranges info into global variables

v2:
  Add #define SMRR_MAX_ADDRESS to clarify SMRR requirement.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael Kinney <michael.d.kinney@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jeff Fan <jeff.fan@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Fix GCC build failure
Ruiyu Ni [Fri, 31 Mar 2017 14:04:17 +0000 (22:04 +0800)]
UefiCpuPkg/MtrrLib: Fix GCC build failure

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
3 years agoShellPkg/setvar: Support data format in Shell 2.2 spec
Chen A Chen [Wed, 29 Mar 2017 02:23:09 +0000 (10:23 +0800)]
ShellPkg/setvar: Support data format in Shell 2.2 spec

Shell 2.2 spec defines =0x/=0X, =H/=h, =S, =L and =P for
hex number, hex array, ascii string, unicode string and
device path data.
The patch adds such support.

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>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jaben Carsey <jaben.carsey@intel.com>
Cc: Jeff Fan <jeff.fan@intel.com>
3 years agoEmbeddedPkg/DtPlatformDxe: load platform DTB via new library
Ard Biesheuvel [Wed, 29 Mar 2017 11:05:01 +0000 (12:05 +0100)]
EmbeddedPkg/DtPlatformDxe: load platform DTB via new library

To give platforms some room to decide which DTB is suitable and where
to load it from, load the DTB image indirectly via the new
DtPlatformDtbLoaderLib library class.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoEmbeddedPkg: add base DtPlatformDtbLoaderLib implementation
Ard Biesheuvel [Fri, 31 Mar 2017 10:35:13 +0000 (11:35 +0100)]
EmbeddedPkg: add base DtPlatformDtbLoaderLib implementation

Introduce an implementation of the new DtPlatformDtbLoaderLib library
class that simply retrieves the first raw section of an FV file named
'gDtPlatformDefaultDtbFileGuid'.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoEmbeddedPkg: add DtPlatformDtbLoaderLib library class
Ard Biesheuvel [Fri, 31 Mar 2017 10:32:36 +0000 (11:32 +0100)]
EmbeddedPkg: add DtPlatformDtbLoaderLib library class

To abstract the way a platform reasons about which DTB is appropriate,
and the way it ultimately supplies the DTB image, introduce a new library
class to encapsulate this functionality.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoEmbeddedPkg: add DtPlatformDxe to .dsc file
Ard Biesheuvel [Fri, 31 Mar 2017 12:16:40 +0000 (13:16 +0100)]
EmbeddedPkg: add DtPlatformDxe to .dsc file

Add the new DtPlatformDxe driver to EmbeddedPkg's .dsc file so that
we can build it outside the context of a platform.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override
Ard Biesheuvel [Wed, 29 Mar 2017 17:50:39 +0000 (18:50 +0100)]
ArmVirtPkg/PlatformHasAcpiDtDxe: allow guest level ACPI disable override

In general, we should not present two separate (and inevitably different)
hardware descriptions to the OS, in the form of ACPI tables and a device
tree blob. For this reason, we recently added the logic to ArmVirtQemu to
only expose the ACPI 2.0 entry point if no DT binary is being passed, and
vice versa.

However, this is arguably a regression for those who relied on DT
descriptions being available, even if the former behavior can be
restored by passing the -no-acpi switch to QEMU.

So allow a secret handshake with the UEFI Shell, to set a variable that
will result in ACPI to be disabled on subsequent boots even if -no-acpi
was not passed on the QEMU command line.

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =01

To delete the variable and revert to the old situation, simply omit the
value after the =

  setvar -nv -bs -guid 50bea1e5-a2c5-46e9-9b3a-59596516b00a ForceNoAcpi =

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Marc Zyngier <marc.zyngier@arm.com>
Acked-by: Marc Zyngier <marc.zyngier@arm.com>
3 years agoBeagleBoardPkg: add missing BootLogoLib resolution
Ard Biesheuvel [Fri, 31 Mar 2017 09:44:32 +0000 (10:44 +0100)]
BeagleBoardPkg: add missing BootLogoLib resolution

Recent changes to the PlatformBootManagerLib implementation in ArmPkg
require its users to define a resolution for BootLogoLib. So add this
missing resolution to Beagle.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoBeagleBoardPkg: remove ArmCpuLib reference
Ard Biesheuvel [Fri, 31 Mar 2017 08:44:02 +0000 (09:44 +0100)]
BeagleBoardPkg: remove ArmCpuLib reference

ArmCpuLib is not used, and will be removed. So drop the reference from
our .DSC

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg: remove ArmCpuLib references
Ard Biesheuvel [Fri, 31 Mar 2017 08:43:14 +0000 (09:43 +0100)]
ArmVirtPkg: remove ArmCpuLib references

ArmCpuLib is never used anywhere, and is about to be removed. So remove
any references from our .DSC files.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoBaseTools/GCC AARCH64: force disable PIC code generation
Ard Biesheuvel [Fri, 31 Mar 2017 08:22:56 +0000 (09:22 +0100)]
BaseTools/GCC AARCH64: force disable PIC code generation

As a security measure, some distro toolchains now default to PIC code
generation, allowing executables (as opposed to shared libraries) using
the objects to be built as PIE binaries, which can be loaded at a random
virtual offset.

However, our ELF to PE/COFF generation code does not deal with the
resulting relocation types (i.e., GOT based), and so the use of PIC code
leads to GenFw errors.

Given that
a) our non-PIC PE/COFF executables are already relocatable,
b) PIC code leads to all symbol references to be indirected via GOT
   entries containing absolute addresses, each requiring an entry in the
   relocation table,
c) the AArch64 ISA makes it perfectly feasible to built PIE executables
   from non-PIC code,

there is absolutely no upside to using PIC code for building EDK2 modules,
and so we're better off simply disabling it unconditionally.

Note that when running under the OS, the GOT has an additional advantage,
i.e., that all .text/.rodata pages remain clean and so can be shared between
processes. This does not apply to the UEFI environment, however.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
3 years agoUefiCpuPkg/MtrrLib: All functions use definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 11:48:29 +0000 (19:48 +0800)]
UefiCpuPkg/MtrrLib: All functions use definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker
Ruiyu Ni [Fri, 2 Sep 2016 10:10:45 +0000 (18:10 +0800)]
UefiCpuPkg/MtrrLib: Refine MtrrGetMemoryAttributeByAddressWorker

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR
Ruiyu Ni [Fri, 2 Sep 2016 04:09:54 +0000 (12:09 +0800)]
UefiCpuPkg/MtrrLib: Use a better algorithm to calculate MTRR

The new algorithm finds out the more optimal MTRR solution for
current memory type settings.
Compare against the original algorithm, the new one guarantees
to find the correct MTRR solution, but doesn't guarantee to
find the most optimal MTRR solution.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h
Ruiyu Ni [Fri, 2 Sep 2016 12:23:35 +0000 (20:23 +0800)]
UefiCpuPkg/MtrrLib: MtrrLibInitializeMtrrMask() uses definitions in CpuId.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions
Ruiyu Ni [Fri, 2 Sep 2016 02:45:53 +0000 (10:45 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to several internal functions

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr
Ruiyu Ni [Fri, 2 Sep 2016 02:41:28 +0000 (10:41 +0800)]
UefiCpuPkg/MtrrLib: Add MtrrLib prefix to ProgramFixedMtrr

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:35:45 +0000 (10:35 +0800)]
UefiCpuPkg/MtrrLib: GetVariableMtrrCountWorker uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h
Ruiyu Ni [Fri, 2 Sep 2016 02:27:29 +0000 (10:27 +0800)]
UefiCpuPkg/MtrrLib: IsMtrrSupported uses definitions in Msr.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h
Ruiyu Ni [Tue, 23 Aug 2016 02:38:02 +0000 (10:38 +0800)]
UefiCpuPkg/MtrrLib: Add CacheInvalid enum type to MtrrLib.h

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoUefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs
Ruiyu Ni [Thu, 18 Aug 2016 07:34:54 +0000 (15:34 +0800)]
UefiCpuPkg/MtrrLib: Correct typo in comments and remove TABs

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Jeff Fan <jeff.fan@intel.com>
3 years agoBaseTools: Update Brotli and BrotliCompress mode and format
Song, BinX [Thu, 30 Mar 2017 08:23:10 +0000 (16:23 +0800)]
BaseTools: Update Brotli and BrotliCompress mode and format

V2:
- Update correct patch info

V1:
- Add x mode for Brotli and BrotliCompress
- Change Brotli and BrotliCompress format from DOS to UNIX

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.
Jiewen Yao [Mon, 27 Mar 2017 15:01:02 +0000 (23:01 +0800)]
MdeModulePkg/SmmCore: Fix memory leak on Profile unregistered.

Issue reported at bugzillar 445.

Cc: Jeff Fan <jeff.fan@intel.com>
Cc: Feng Tian <feng.tian@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.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>
3 years agoOvmfPkg: Allow multiple add-pointer linker commands to same ACPI table
Phil Dennis-Jordan [Thu, 30 Mar 2017 10:40:57 +0000 (23:40 +1300)]
OvmfPkg: Allow multiple add-pointer linker commands to same ACPI table

ACPI tables may contain multiple fields which point to the same
destination table. For example, in some revisions, the FADT contains
both DSDT and X_DSDT fields, and they may both point to the DSDT.

Previously, if Qemu created QEMU_LOADER_ADD_POINTER linker commands for
such instances, the linking process would attempt to install the same
pointed-to table repeatedly. For tables of which there must only be one
instance, the call to AcpiProtocol->InstallAcpiTable() would fail during
the second linker command pointing to the same table, thus entirely
aborting the ACPI table linking process. In the case of tables of which
there may be multiple instances, the table would end up duplicated.

This change adds a memoisation data structure which tracks the table
pointers that have already been processed; even if the same pointer is
encountered multiple times, it is only processed once.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Phil Dennis-Jordan <phil@philjordan.eu>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
[lersek@redhat.com: DSDT<->XSDT typo, debug msg, and coding style fixups]
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=368
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
3 years agoCryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module
Qin Long [Thu, 30 Mar 2017 07:53:21 +0000 (15:53 +0800)]
CryptoPkg/BaseCryptLib: Fix Build Warning issue in PEI Module

The memory free operation is empty function in PEI. The compiler
optimization will bring the build warning in openssl/crypto/mem.c:
      warning C4718: 'CRYPTO_free': recursive call has no side
                     effects, deleting
This patch uses '/wd4718' to silence the build warning for PEI
module building.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Hao Wu <hao.a.wu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ye Ting <ting.ye@intel.com>
3 years agoMdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid
Jiaxin Wu [Mon, 27 Mar 2017 06:45:50 +0000 (14:45 +0800)]
MdeModulePkg/DxeHttpLib: Fix the incorrect return status if URI port is invalid

Cc: Zhang Lubo <lubo.zhang@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: Zhang Lubo <lubo.zhang@intel.com>
3 years agoMdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing
Jiaxin Wu [Fri, 24 Mar 2017 01:53:50 +0000 (09:53 +0800)]
MdePkg/UefiDevicePathLib: Refine the DevPathFromTextiSCSI protocol parsing

For current iSCSI protocol parsing, UINT16 truncation may be happened. Since
the Spec already have declaimed that 0 is TCP Protocol and 1+ is reserved, the
parsing can be refined as below:

  if (StrCmp (ProtocolStr, L"TCP") == 0) {
    ISCSIDevPath->NetworkProtocol = 0;
  } else {
    //
    // Undefined and reserved.
    //
    ISCSIDevPath->NetworkProtocol = 1;
  }

Cc: Warner Losh <imp@bsdimp.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: Warner Losh <imp@bsdimp.com>
3 years agoNetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6
Jiaxin Wu [Thu, 23 Mar 2017 03:35:14 +0000 (11:35 +0800)]
NetworkPkg/DnsDxe: Fix zero StationIp configuration failure of DNSv6

According UEFI Spec, set to zero StationIp means to let the underlying
IPv6 driver choose a source address. But currently, DNSv6 always return
EFI_NO_MAPPING. The issue is caused by below bugs in DnsDxe:
* Incorrect TPL(TPL_CALLBACK) usage during UDP configuration.
* Failed to create the timer used to get IPv6 mapping
* Doesn't check the Ip6Mode.IsStarted flag.

Cc: Zhang Lubo <lubo.zhang@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: Zhang Lubo <lubo.zhang@intel.com>
3 years agoMdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch
Ard Biesheuvel [Mon, 27 Mar 2017 12:22:16 +0000 (13:22 +0100)]
MdeModulePkg/PeiCore: avoid EFI_IMAGE_MACHINE_TYPE_SUPPORTED to check arch

The EFI_IMAGE_MACHINE_TYPE_SUPPORTED() macro is abused in the PeiCore
code to decide whether the system we are compiling for can deal with
executable code being copied elsewhere and executed from there.

As stated in the comment, this is fundamentally a property of the compiler
target, and so this should be made dependent on MDE_CPU_xxx preprocessor
defines, and not on whether or not the runtime target can deal with
PE/COFF images of a certain machine type.

On X86/IA32, this mostly boils down to the same thing, but not on other
architectures, so let's clean this up.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64
Ard Biesheuvel [Mon, 27 Mar 2017 11:19:53 +0000 (12:19 +0100)]
MdeModulePkg/DxeCore: add missing id-to-string mapping for AARCH64

Add a mapping for EFI_IMAGE_MACHINE_AARCH64 to mMachineTypeInfo[]

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Update Pkcs7 and RSA2048 tool with shell=True
Yonghong Zhu [Tue, 28 Mar 2017 07:04:13 +0000 (15:04 +0800)]
BaseTools: Update Pkcs7 and RSA2048 tool with shell=True

Pkcs7Sign, Rsa2048Sha256Sign and Rsa2048Sha256GenerateKeys doesn't work
on Linux. It needs to be changed with shell=True.

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>
3 years agoCryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.
Qin Long [Thu, 23 Mar 2017 12:53:45 +0000 (20:53 +0800)]
CryptoPkg/TlsLib: Update TLS Wrapper to align with OpenSSL changes.

This patch update the wrapper implementation in TlsLib to align
with the latest OpenSSL-1.1.0xx API changes.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Palmer Thomas <thomas.palmer@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Wu Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
3 years agoCryptoPkg: Update PK Cipher Wrappers work with opaque objects.
Qin Long [Tue, 21 Mar 2017 14:58:07 +0000 (22:58 +0800)]
CryptoPkg: Update PK Cipher Wrappers work with opaque objects.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updates Public Key Cipher Wrapper implementations in
BaseCryptLib to use the accessor APIs for opaque object access.
The impacted interfaces includes RSA, DH, X509, PKCS7, etc.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
3 years agoCryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.
Qin Long [Thu, 23 Mar 2017 12:47:34 +0000 (20:47 +0800)]
CryptoPkg: Update HMAC Wrapper with opaque HMAC_CTX object.

OpenSSL-1.1.xx makes most data structures opaque.
This patch updated HMAC Wrapper implementation with opaque
HMAC_CTX object.
The HmacXXGetContextSize() is marked as deprecated, and updated
to use the fixed HMAC_CTX size, which is just kept for compatibility.
New APIs (HmacXXNew(), HmacXXFree()) were added  as the recommended
HMAC_CTX usage interfaces for HMAC-XXXX operations.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoCryptoPkg: Add extra build option to disable VS build warning
Qin Long [Thu, 23 Mar 2017 12:26:45 +0000 (20:26 +0800)]
CryptoPkg: Add extra build option to disable VS build warning

openssl/include/openssl/lhash.h will bring C4090 build warning
issue, which is one known issue for OpenSSL under Visual Studio
toolchain.
Refer to https://github.com/openssl/openssl/issues/2214 for more
discussions against this.
Use /wd4090 to silence this build warning until OpenSSL fix this.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
3 years agoCryptoPkg: Clean-up CRT Library Wrapper.
Qin Long [Thu, 23 Mar 2017 12:19:39 +0000 (20:19 +0800)]
CryptoPkg: Clean-up CRT Library Wrapper.

Cleaning-up CRT Library Wrapper for the third-party cryptography
library building. The changes includes
1. Rename OpenSslSupport.h to CrtLibSupport.h for future alternative
   crypto provider support.
2. Remove all un-referenced CRT APIs and headers.

(NOTE: More cleans-up could be possible after OpenSSL integrate the
      extra PR request: https://github.com/openssl/openssl/pull/2961)

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
3 years agoCryptoPkg: Fix handling of &strcmp function pointers
Qin Long [Thu, 23 Mar 2017 12:09:17 +0000 (20:09 +0800)]
CryptoPkg: Fix handling of &strcmp function pointers

In a couple of places, OpenSSL code uses the address of the
strcmp() function, and assigns it to another comparator function
pointer.

Unfortunately, this falls foul of the inconsistent function ABI
that we use in EDKII. We '#define strcmp AsciiStrCmp' but AsciiStrCmp
is an EFIAPI function with the Microsoft ABI. And we're assigning its
address to a non-EFIAPI function, which may well have a different ABI.

Fix this by providing an actual strcmp() function in the default ABI.
We already *had* a prototype for it in OpenSslSupport.h, which was
then superseded by the #define strcmp AsciiStrCmp.

Now, OpenSSL code *can* use &strcmp without problems.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
3 years agoCryptoPkg/OpensslLib: Add new OpenSSL-HOWTO document.
Qin Long [Thu, 23 Mar 2017 12:06:00 +0000 (20:06 +0800)]
CryptoPkg/OpensslLib: Add new OpenSSL-HOWTO document.

Add one new OpenSSL-HOWTO.txt to introduce how to clone / download
the latest OpenSSL release source for build.
ALso update buildinf.h to reflect the latest update time.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gary Lin <glin@suse.com>
Tested-by: Gary Lin <glin@suse.com>
3 years agoCryptoPkg/OpensslLib: Add new Perl script for file list generation.
Qin Long [Thu, 23 Mar 2017 11:37:00 +0000 (19:37 +0800)]
CryptoPkg/OpensslLib: Add new Perl script for file list generation.

OpenSSL-1.1.0xx configure mechanism was updated with new configdata.
This patch update process_file.sh script to new Perl-based script for
auto generation of file list and openssl config file (opensslconf.h).

This only needs to be done once by a developer when updating to a new
version of OpenSSL (or changing options, etc.). Normal users do not
need to do this, since the results are already stored in the EDK2 git
repository.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
3 years agoCryptoPkg/OpensslLib: Remove patch file and installation scripts.
Qin Long [Thu, 23 Mar 2017 08:27:46 +0000 (16:27 +0800)]
CryptoPkg/OpensslLib: Remove patch file and installation scripts.

This patch removes the EDKII-openssl-xxxx.patch, installation scripts,
and Patch-HOWTO.txt which were used for old OpenSSL-1.0.2xx enabling.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoCryptoPkg: Update .gitignore for OpenSSL source masking
Qin Long [Thu, 23 Mar 2017 08:21:31 +0000 (16:21 +0800)]
CryptoPkg: Update .gitignore for OpenSSL source masking

Updates .gitignore that masks the OpenSSL source:
1. Remove "Include/openssl" from .gitignore since we needn't duplicate
   openssl headers now
2. Update "openssl-*" to "openssl*", since we use "openssl" instead of
   "openssl-x.x.xx" as main source directory.

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoCryptoPkg/OpensslLib: Update INF files to support OpenSSL-1.1.0x build
Qin Long [Thu, 23 Mar 2017 08:14:16 +0000 (16:14 +0800)]
CryptoPkg/OpensslLib: Update INF files to support OpenSSL-1.1.0x build

Update OpensslLib INF files to support OpenSSL-1.1.0x source build.
The file list was generated from the latest OpenSSL-1.1.0e release.

Main changes to support OpensslLib build in this patch include:
1. Use "openssl" instead of "openssl-x.x.xx" as main source directory,
   Also update include path in CryptoPkg.dec
2. Enable warnings in GCC builds;
3. Update Visual Studio build options to silence current possible build
   warnings.
4. Move the default opensslconf.h to Include/openssl, and add one dummy
   dso_conf.h for native UEFI build.

The OpensslLib module build was validated as
  build -t VSXXXX -a XX -p CryptoPkg/CryptoPkg.dsc
        -m CryptoPkg/Library/OpensslLib/OpensslLib.inf

(NOTE: The extra build options for ARM/RVCT/XCODE were kept, which expect
       further optimizations from community)

Cc: Ting Ye <ting.ye@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Gary Lin <glin@suse.com>
Cc: Ronald Cron <ronald.cron@arm.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Signed-off-by: Qin Long <qin.long@intel.com>
Reviewed-by: Ting Ye <ting.ye@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Gary Lin <glin@suse.com>
3 years agoSignedCapsulePkg: Update RecoveryModuleLoadPei to report the correct FvInfo
Liming Gao [Tue, 28 Mar 2017 06:11:24 +0000 (14:11 +0800)]
SignedCapsulePkg: Update RecoveryModuleLoadPei to report the correct FvInfo

Update logic to install FvInfo PPI with its file system guid.

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>
3 years agoBaseTools: Add Brotli algorithm tool
Song, BinX [Thu, 23 Mar 2017 02:16:16 +0000 (10:16 +0800)]
BaseTools: Add Brotli algorithm tool

- Add Brotli algorithm tool support

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoBaseTools: Copy Brotli algorithm 3rd party source code for tool
Song, BinX [Thu, 23 Mar 2017 02:16:15 +0000 (10:16 +0800)]
BaseTools: Copy Brotli algorithm 3rd party source code for tool

- Copy Brotli algorithm 3rd party source code for tool

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg: Add Brotli algorithm decompression library
Song, BinX [Thu, 23 Mar 2017 02:16:02 +0000 (10:16 +0800)]
MdeModulePkg: Add Brotli algorithm decompression library

- Add Brotli algorithm decompression library support

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoMdeModulePkg: Copy Brotli algorithm 3rd party source code for library
Song, BinX [Thu, 23 Mar 2017 02:15:58 +0000 (10:15 +0800)]
MdeModulePkg: Copy Brotli algorithm 3rd party source code for library

- Copy Brotli algorithm 3rd party source code for library

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Bell Song <binx.song@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
3 years agoShellPkg/Shell: Avoid potential null pointer deference
Ruiyu Ni [Tue, 28 Mar 2017 02:26:07 +0000 (10:26 +0800)]
ShellPkg/Shell: Avoid potential null pointer deference

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
3 years agoEmbeddedPkg: add DT platform driver to select between DT and ACPI
Ard Biesheuvel [Mon, 27 Mar 2017 09:57:31 +0000 (10:57 +0100)]
EmbeddedPkg: add DT platform driver to select between DT and ACPI

As a follow up to the changes proposed by Laszlo to make ACPI and DT
mutually exclusive on ArmVirtQemu, this patch proposes a DT platform
DXE driver that either installs the NULL protocol PlatformHasAcpiGuid,
or installs the FV embedded DTB binary as a configuration table under
the appropriate GUID, depending on a preference setting recorded as
a UEFI variable, and configurable via a HII screen.

The DTB binary can be embedded in the firmware image by adding the
following to the platform .fdf file:

  FILE FREEFORM = 25462CDA-221F-47DF-AC1D-259CFAA4E326 {
    SECTION RAW = SomePkg/path/to/foo.dtb
  }

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot
Laszlo Ersek [Fri, 17 Mar 2017 16:54:50 +0000 (17:54 +0100)]
ArmVirtPkg: remove PURE_ACPI_BOOT_ENABLE and PcdPureAcpiBoot

The build flag and the FeaturePCD have no effect any longer, remove them.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI
Laszlo Ersek [Fri, 17 Mar 2017 16:50:24 +0000 (17:50 +0100)]
ArmVirtPkg/PlatformHasAcpiDtDxe: don't expose DT if QEMU provides ACPI

This will let QEMU's "-no-acpi" option exclusively expose DT vs. ACPI to
the guest. Showing both is never needed (it is actually detrimental to the
adoption of standards, such as SBSA / SBBR).

* Without "-no-acpi", the firmware logs (from PlatformHasAcpiDtDxe)

> Found FwCfg @ 0x9020008/0x9020000
> Found FwCfg DMA @ 0x9020010
> InstallProtocolInterface: [EdkiiPlatformHasAcpi] 0

plus the usual messages. Later the guest kernel logs

> [    0.000000] efi:  SMBIOS 3.0=0x13bdb0000  ACPI 2.0=0x138440000
>                      MEMATTR=0x13a675018

before it lists the ACPI tables one by one.

In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches no files, while the "/sys/firmware/acpi/tables/*" pattern matches
the ACPI tables.

* With "-no-acpi", the firmware logs:

> PlatformHasAcpiDtDxe | Found FwCfg @ 0x9020008/0x9020000
> PlatformHasAcpiDtDxe | Found FwCfg DMA @ 0x9020010
> PlatformHasAcpiDtDxe | InstallProtocolInterface:
> PlatformHasAcpiDtDxe | [EdkiiPlatformHasDeviceTree] 0
> FdtClientDxe         | OnPlatformHasDeviceTree: exposing DTB @
> FdtClientDxe         | 0x13FFBF000 to OS
> ...
> DXE_CORE             | Driver [AcpiTableDxe] was discovered but not
> DXE_CORE             | loaded!!
> DXE_CORE             | Driver [QemuFwCfgAcpiPlatform] was discovered but
> DXE_CORE             | not loaded!!
> ...
> RamDiskDxe           | RamDiskAcpiCheck: Cannot locate the EFI ACPI
> RamDiskDxe           | Table Protocol, unable to publish RAM disks to
> RamDiskDxe           | NFIT.

(BootGraphicsResourceTableDxe's ReadyToBoot callback --
InstallBootGraphicsResourceTable() -- handles the lack of
EFI_ACPI_TABLE_PROTOCOL silently.) Later the guest kernel logs

> [    0.000000] efi:  SMBIOS 3.0=0x13bdb0000  MEMATTR=0x138caa018

In addition, in the guest, the "/sys/firmware/devicetree/*" shell pattern
matches the directory "/sys/firmware/devicetree/base", which contains a
large number of DT nodes, while the "/sys/firmware/acpi/tables/*" pattern
matches no files.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1430262
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify
Laszlo Ersek [Fri, 17 Mar 2017 15:56:04 +0000 (16:56 +0100)]
ArmVirtPkg/FdtClientDxe: install DT as sysconfig table in protocol notify

Replace the dependency on PcdPureAcpiBoot with a Platform Has Device Tree
notification callback. Move the sysconfig table installation from the
entry point function to the callback.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically
Laszlo Ersek [Fri, 17 Mar 2017 14:46:40 +0000 (15:46 +0100)]
ArmVirtPkg: enable AcpiTableDxe and EFI_ACPI_TABLE_PROTOCOL dynamically

In this patch, the ACPI protocol / driver chain is enabled dynamically,
when appropriate. This is being done in one larger patch, because
ArmVirt.dsc.inc, where AcpiTableDxe is built, is used by all the platform
DSCs.

No change in behavior should be observable after this patch on any
ArmVirtPkg platform.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg: add XenPlatformHasAcpiDtDxe
Laszlo Ersek [Fri, 17 Mar 2017 14:12:28 +0000 (15:12 +0100)]
ArmVirtPkg: add XenPlatformHasAcpiDtDxe

This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on Xen,
according to ARM vs. AARCH64. At this point it differs from the QEMU
driver PlatformHasAcpiDtDxe in that this one always installs the DT.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg: add PlatformHasAcpiDtDxe
Laszlo Ersek [Fri, 17 Mar 2017 14:12:28 +0000 (15:12 +0100)]
ArmVirtPkg: add PlatformHasAcpiDtDxe

This driver produces the EDKII Platform Has ACPI and Platform Has Device
Tree protocols, exactly matching the current ACPI / DT exposure on QEMU,
according to ARM vs. AARCH64, and (in the latter case) to PcdPureAcpiBoot.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoEmbeddedPkg: introduce EDKII Platform Has Device Tree GUID
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce EDKII Platform Has Device Tree GUID

The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with a Device
Tree-based hardware description. This is not necessarily exclusive with
other types of hardware description (for example, an ACPI-based one).

A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.

In the DXE phase, the protocol is meant to be consumed by the platform
driver that
- owns the Device Tree description of the hardware, and
- is responsible for installing it as a system configuration table.

Said FDT-owner driver can wait for the protocol via DEPEX or protocol
notify.

Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere (for example in MdeModulePkg and SecurityPkg).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoEmbeddedPkg: introduce PlatformHasAcpiLib
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce PlatformHasAcpiLib

Add the shorter-term library instance outlined in the previous patch to
EmbeddedPkg, so that we can imbue AcpiTableDxe with a protocol dependency
on EDKII_PLATFORM_HAS_ACPI_GUID.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoEmbeddedPkg: introduce EDKII Platform Has ACPI GUID
Laszlo Ersek [Fri, 17 Mar 2017 12:47:35 +0000 (13:47 +0100)]
EmbeddedPkg: introduce EDKII Platform Has ACPI GUID

The presence of this GUID in the PPI database, and/or in the DXE protocol
database (as dictated by the platform's needs in these firmware phases)
implies that the platform provides the operating system with an ACPI-based
hardware description. This is not necessarily exclusive with other types
of hardware description (for example, a Device Tree-based one).

A platform PEIM and/or DXE driver is supposed to produce a single instance
of the PPI and/or protocol (with NULL contents), if appropriate. The
decision to produce the PPI and/or protocol is platform specific; for
example, in the DXE phase, it could depend on an HII checkbox / underlying
non-volatile UEFI variable.

In the DXE phase, the protocol is meant to be depended-upon by
"MdeModulePkg/Universal/Acpi/AcpiTableDxe", indirectly:

* In the long term, interested platforms will establish this dependency by
  hooking an (upcoming) NULL-class DepexLib instance into AcpiTableDxe in
  their DSC files, pointing DepexLib's DEPEX through a FixedAtBuild PCD to
  the GUID introduced here. (For the prerequisite BaseTools feature, refer
  to <https://bugzilla.tianocore.org/show_bug.cgi?id=443>).

* In the short term, an interested platform may hook a private NULL-class
  library instance (called e.g. "PlatformHasAcpiLib") into AcpiTableDxe.
  Such a library instance would be a specialization of the above described
  generic DepexLib, with the DEPEX open-coded on the GUID introduced here.

Either way, the platform makes EFI_ACPI_TABLE_PROTOCOL and (if enabled)
EFI_ACPI_SDT_PROTOCOL dependent on the platform's dynamic decision to
produce or not to produce a NULL protocol instance with this GUID.

In turn, other (platform and universal) DXE drivers that produce ACPI
tables will wait for EFI_ACPI_TABLE_PROTOCOL / EFI_ACPI_SDT_PROTOCOL, via
DEPEX, protocol notify, or a simple gBS->LocateProtocol() in a "late
enough" callback (such as Ready To Boot).

Because this GUID is not standard, it is prefixed with EDKII / Edkii, as
seen elsewhere in MdeModulePkg and SecurityPkg. In addition, an effort is
made to avoid the phrase "AcpiPlatform", as that belongs to drivers /
libraries that produce platform specific ACPI content (as opposed to
deciding whether the entire firmware will have access to
EFI_ACPI_TABLE_PROTOCOL, or any similar facilities in the PEI phase).

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly
Laszlo Ersek [Fri, 17 Mar 2017 15:07:53 +0000 (16:07 +0100)]
ArmVirtPkg/XenAcpiPlatformDxe: don't cast UINT64 to pointer directly

Because that breaks the (potential) 32-bit build of the driver.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
3 years agoRevert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"
Laszlo Ersek [Fri, 17 Mar 2017 12:44:41 +0000 (13:44 +0100)]
Revert "ArmVirtPkg/FdtClientDxe: install DT configuration table at ReadyToBoot"

This reverts commit 18f6d4df9ece8b91b86511bcdd1cf7da478c3627.

We realized that DXE drivers that are independent of AcpiPlatformDxe (that
is, independent of QEMU's ACPI generation), such as RamDiskDxe and
BootGraphicsResourceTableDxe, may produce and/or manipulate ACPI tables,
at driver dispatch or even at Ready To Boot.

This makes it unsafe for us to check for ACPI presence in the UEFI system
config table in a Ready To Boot callback, in order to decide about
exposing the DT.

Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: Leif Lindholm <leif.lindholm@linaro.org>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>