]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
3 years agoShellPkg/AcpiView: Fix field validator invocation
Sami Mujawar [Thu, 24 Sep 2020 09:51:34 +0000 (10:51 +0100)]
ShellPkg/AcpiView: Fix field validator invocation

Bugzilla: 3046 (https://bugzilla.tianocore.org/show_bug.cgi?id=3046)

The field validator function provides means to validate fields
in the ACPI table structures. To print complex field types a
print formatter function is provided.

The field validator was being invoked for simple data fields
for which the default print format is used. However, the field
validator function was not invoked if a print formatter function
was provided.

This problem is noticed when a Generic Address Structure (GAS)
is printed using DumpGas() and a field validator is present
to validate the GAS structure.

To fix this move the invocation of the field validator after
the field is printed such that the validation function is
called even when a print formatter function is present.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
3 years agoRedfishPkg/RedfishRestExDxe: Implementation of EFI REST EX Protocol
Abner Chang [Fri, 16 Oct 2020 08:24:04 +0000 (16:24 +0800)]
RedfishPkg/RedfishRestExDxe: Implementation of EFI REST EX Protocol

BZ#: 2908
https://bugzilla.tianocore.org/show_bug.cgi?id=2908

Implementation of EFI EX Protocol according to UEFI spec
2.8 Section 29.7.2 EFI REST EX Protocol.
This is the network stack based EFI REST EX protocol instance.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Fan Wang <fan.wang@intel.com>
Signed-off-by: Ting Ye <ting.ye@intel.com>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
3 years agoMdePkg,ShellPkg: Fix typo in SMBIOS_TABLE_TYPE17 field FirmwareVersion
Rebecca Cran [Fri, 4 Dec 2020 05:11:27 +0000 (13:11 +0800)]
MdePkg,ShellPkg: Fix typo in SMBIOS_TABLE_TYPE17 field FirmwareVersion

"FirmwareVersion" was misspelled "FirwareVersion".
Also, update SmbiosView PrintInfo.c to use the new field name.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoMdePkg,ShellPkg: Fix typo in SMBIOS_TABLE_TYPE4 field ProcessorManufacturer
Rebecca Cran [Fri, 4 Dec 2020 05:11:26 +0000 (13:11 +0800)]
MdePkg,ShellPkg: Fix typo in SMBIOS_TABLE_TYPE4 field ProcessorManufacturer

In SmBios.h, the SMBIOS_TABLE_TYPE4 field "ProcessorManufacture"
should be "ProcessorManufacturer".

Also, update SmbiosView PrintInfo.c to use the new field name.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoMdePkg: Fix typos in SmBios.h PROCESSOR_CHARACTERISTIC_FLAGS struct
Rebecca Cran [Fri, 4 Dec 2020 05:11:25 +0000 (13:11 +0800)]
MdePkg: Fix typos in SmBios.h PROCESSOR_CHARACTERISTIC_FLAGS struct

Fix typos of "Processor64BitCapable", "ProcessorEnhancedVirtualization",
and Processor128BitCapable.

Signed-off-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoArmPlatformPkg: Fix cspell reported spelling/wording
Pierre Gondois [Fri, 13 Nov 2020 11:31:01 +0000 (11:31 +0000)]
ArmPlatformPkg: Fix cspell reported spelling/wording

The edk2 CI runs the "cspell" spell checker tool. Some words
are not recognized by the tool, triggering errors.
This patch modifies some spelling/wording detected by cspell.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 8001 in PrePi
Pierre Gondois [Fri, 20 Nov 2020 10:01:13 +0000 (10:01 +0000)]
ArmPlatformPkg: Fix Ecc error 8001 in PrePi

This patch fixes the following Ecc reported error:
Only capital letters are allowed to be used for #define
declarations

The "SerialPrint" macro is definied for the PrePi module
residing in the ArmPlatformPkg. It is never used in the module.
The macro is thus removed.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10006 in ArmPlatformPkg.dsc
Pierre Gondois [Fri, 6 Nov 2020 09:47:47 +0000 (09:47 +0000)]
ArmPlatformPkg: Fix Ecc error 10006 in ArmPlatformPkg.dsc

This patch fixes the following Ecc reported error:
There should be no unnecessary inclusion of library
classes in the INF file

This comes with the additional information:
"The Library Class [TimeBaseLib] is not used
in any platform"
"The Library Class [PL011UartClockLib] is not used
in any platform"
"The Library Class [PL011UartLib] is not used
in any platform"

Indeed, the PL011SerialPortLib module requires the
PL011UartClockLib and PL011UartLib libraries.
The PL031RealTimeClockLib module requires the TimeBaseLib
library.
ArmPlatformPkg/ArmPlatformPkg.dsc builds the two modules,
but doesn't build the required libraries. This patch adds
the missing libraries to the [LibraryClasses.common] section.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10014 in SP805WatchdogDxe
Pierre Gondois [Fri, 23 Oct 2020 14:33:12 +0000 (15:33 +0100)]
ArmPlatformPkg: Fix Ecc error 10014 in SP805WatchdogDxe

This patch fixes the following Ecc reported error:
No used module files found

The source file
[ArmPlatformPkg/Drivers/SP805WatchdogDxe/SP805Watchdog.h]
is existing in module directory but it is not described
in INF file.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10014 in PL061GpioDxe
Pierre Gondois [Fri, 23 Oct 2020 14:32:42 +0000 (15:32 +0100)]
ArmPlatformPkg: Fix Ecc error 10014 in PL061GpioDxe

This patch fixes the following Ecc reported error:
No used module files found

The source file
[ArmPlatformPkg/Drivers/PL061GpioDxe/PL061Gpio.h]
is existing in module directory but it is not described
in INF file.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10014 in LcdGraphicsOutputDxe
Pierre Gondois [Fri, 23 Oct 2020 14:32:26 +0000 (15:32 +0100)]
ArmPlatformPkg: Fix Ecc error 10014 in LcdGraphicsOutputDxe

This patch fixes the following Ecc reported error:
No used module files found

The source file
[ArmPlatformPkg/Drivers/LcdGraphicsOutputDxe/LcdGraphicsOutputDxe.h]
is existing in module directory but it is not described
in INF file.

Files in [Sources.common] are also alphabetically re-ordered.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10016 in LcdPlatformNullLib
Pierre Gondois [Fri, 23 Oct 2020 14:18:04 +0000 (15:18 +0100)]
ArmPlatformPkg: Fix Ecc error 10016 in LcdPlatformNullLib

This patch fixes the following Ecc reported error:
Module file has FILE_GUID collision with other
module file

The two .inf files with clashing GUID are:
edk2\ArmPlatformPkg\PrePeiCore\PrePeiCoreMPCore.inf
edk2\ArmPlatformPkg\Library\LcdPlatformNullLib\LcdPlatformNullLib.inf

The PrePeiCoreMPCore module has been imported in 2011 and the
LcdPlatformNullLib module has been created in 2017. The
PrePeiCoreMPCore has the precedence.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 10016 in PrePi
Pierre Gondois [Fri, 23 Oct 2020 13:37:14 +0000 (14:37 +0100)]
ArmPlatformPkg: Fix Ecc error 10016 in PrePi

This patch fixes the following Ecc reported error:
Module file has FILE_GUID collision with other
module file

The two .inf files with clashing GUID are:
edk2\ArmPlatformPkg\PrePi\PeiUniCore.inf
edk2\ArmPlatformPkg\PrePi\PeiMPCore.inf

Both files seem to have been imported from the previous
svn repository as the same time.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 5007 in PL031RealTimeClockLib
Pierre Gondois [Fri, 23 Oct 2020 13:36:19 +0000 (14:36 +0100)]
ArmPlatformPkg: Fix Ecc error 5007 in PL031RealTimeClockLib

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 5007 in PL061GpioDxe
Pierre Gondois [Fri, 23 Oct 2020 13:36:01 +0000 (14:36 +0100)]
ArmPlatformPkg: Fix Ecc error 5007 in PL061GpioDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 5007 in NorFlashDxe
Pierre Gondois [Fri, 23 Oct 2020 13:35:36 +0000 (14:35 +0100)]
ArmPlatformPkg: Fix Ecc error 5007 in NorFlashDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 5007 in LcdGraphicsOutputDxe
Pierre Gondois [Fri, 23 Oct 2020 13:35:07 +0000 (14:35 +0100)]
ArmPlatformPkg: Fix Ecc error 5007 in LcdGraphicsOutputDxe

This patch fixes the following Ecc reported error:
There should be no initialization of a variable as
part of its declaration

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 3002 in PL061GpioDxe
Pierre Gondois [Fri, 23 Oct 2020 13:32:40 +0000 (14:32 +0100)]
ArmPlatformPkg: Fix Ecc error 3002 in PL061GpioDxe

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 3002 in PL011UartLib
Pierre Gondois [Fri, 23 Oct 2020 13:31:50 +0000 (14:31 +0100)]
ArmPlatformPkg: Fix Ecc error 3002 in PL011UartLib

This patch fixes the following Ecc reported error:
Non-Boolean comparisons should use a compare operator
(==, !=, >, < >=, <=)

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoArmPlatformPkg: Fix Ecc error 3001 in NorFlashDxe
Pierre Gondois [Fri, 23 Oct 2020 12:31:40 +0000 (13:31 +0100)]
ArmPlatformPkg: Fix Ecc error 3001 in NorFlashDxe

This patch fixes the following Ecc reported error:
Boolean values and variable type BOOLEAN should not use
explicit comparisons to TRUE or FALSE

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
3 years agoIntelFsp2Pkg/GenCfgOpt.py: Incremental build with UPD in sub DSC.
Chasel Chiu [Mon, 7 Dec 2020 10:13:52 +0000 (18:13 +0800)]
IntelFsp2Pkg/GenCfgOpt.py: Incremental build with UPD in sub DSC.

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

Current script only compares main DSC and output file datetime
to determine if re-generation required or not.
When UPD defined in sub DSC and was modified current script cannot
detect and will not re-generate output files which caused incremental
build issue.

Since UPD can be defined in any sub DSC the script has been updated
to compare all DSC datetime with output files to determine re-generation
is needed or not.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Tested-by: Yuwei Chen <yuwei.chen@intel.com>
3 years agoUefiCpuPkg/SmmCpuFeaturesLib: Add Tiger Lake support
Guo Dong [Wed, 2 Dec 2020 21:36:27 +0000 (14:36 -0700)]
UefiCpuPkg/SmmCpuFeaturesLib: Add Tiger Lake support

Add Tiger Lake ModelId support in the SMM CPU feature lib.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoUefiCpuPkg/CpuDxe: Fix boot error
Guo Dong [Wed, 2 Dec 2020 21:18:18 +0000 (14:18 -0700)]
UefiCpuPkg/CpuDxe: Fix boot error

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

When DXE drivers are dispatched above 4GB memory and
the system is already in 64bit mode, the address
setCodeSelectorLongJump in stack will be override
by parameter. so change to use 64bit address and
jump to qword address.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoArmPkg/ArmDisassemblerLib: fix incorrect comparison
wenyi,xie via groups.io [Tue, 8 Dec 2020 13:07:49 +0000 (21:07 +0800)]
ArmPkg/ArmDisassemblerLib: fix incorrect comparison

As shift = (OpCode >> 5) & 0x3, shift will never be larger than 0x3,
so the comparison between shift and 0x12 will always be false. The right
shift type of ASR is 0x2.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
3 years agoEmulatorPkg: Define default value of NETWORK_HTTP_ENABLE
Abner Chang [Fri, 4 Dec 2020 01:41:33 +0000 (09:41 +0800)]
EmulatorPkg: Define default value of NETWORK_HTTP_ENABLE

BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=3104
Incorporate with commit 126115a9, set default NETWORK_HTTP_ENABLE
to FALSE.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
3 years agoUnitTestFrameworkPg: Fix build failure of MdeModulePkg with UnitTestLib
Divneil Rai Wadhawan [Fri, 4 Dec 2020 18:11:48 +0000 (10:11 -0800)]
UnitTestFrameworkPg: Fix build failure of MdeModulePkg with UnitTestLib

o LIBRARY_CLASS for UnitTestLib has been extended to support the classes
  required in building of MdeModulePkg

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Divneil Rai Wadhawan <divneil.r.wadhawan@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
3 years agoNetworkPkg/HttpBootDxe: Utilize HttpIoLib
Abner Chang [Tue, 3 Nov 2020 05:26:51 +0000 (13:26 +0800)]
NetworkPkg/HttpBootDxe: Utilize HttpIoLib

Remove HTTP IO realted funcitons from HttpBootDxe
and use HttpIoLib instead.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
3 years agoNetworkPkg: Add Http IO Helper Library to NetworkPkg
Abner Chang [Tue, 3 Nov 2020 05:26:50 +0000 (13:26 +0800)]
NetworkPkg: Add Http IO Helper Library to NetworkPkg

This library provides HTTP IO helper functions.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
3 years agoNetworkPkg/Library: Implementation of Http IO Helper Library
Abner Chang [Tue, 3 Nov 2020 05:26:49 +0000 (13:26 +0800)]
NetworkPkg/Library: Implementation of Http IO Helper Library

Add HTTP IO helper library which could be used by HTTP applications
such as HTTP Boot, Redfish HTTP REST EX driver instance and etc.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
3 years agoMdeModulePkg/FileExplorerLib: remove redundant null pointer check
wenyi xie [Thu, 26 Nov 2020 01:50:33 +0000 (09:50 +0800)]
MdeModulePkg/FileExplorerLib: remove redundant null pointer check

If "Info" is a valid pointer to an EFI_FILE_SYSTEM_VOLUME_LABEL
structure, then "Info->VolumeLabel" denotes a valid array object.
When the "Info->VolumeLabel" expression is evaluated, as seen in
the LibFindFileSystem(), it is implicitly converted to
(&Info->VolumeLabel[0]). Because the object described by the
expression (Info->VolumeLabel[0]) is a valid CHAR16 object, its
address can never compare equal to NULL. Therefore, the condition
(Info->VolumeLabel == NULL) will always evaluate to FALSE.
Substitute the constant FALSE into the "if" statement, and
simplify the resultant code (eliminate the dead branch).

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoMdeModulePkg: Fix undefined reference to memcpy with XCODE5
Vitaly Cheptsov [Tue, 1 Dec 2020 18:26:51 +0000 (02:26 +0800)]
MdeModulePkg: Fix undefined reference to memcpy with XCODE5

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

XCODE5 toolchain in NOOPT mode generates memcpy when trying
to copy PEI_CORE_FV_HANDLE structure. This breaks OVMF
compilation with XCODE5.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Vitaly Cheptsov <cheptsov@ispras.ru>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
3 years agoUefiCpuPkg/Feature: Support different thread count per core
Ray Ni [Wed, 2 Dec 2020 01:51:31 +0000 (09:51 +0800)]
UefiCpuPkg/Feature: Support different thread count per core

Today's code assumes every core contains the same number of threads.
It's not always TRUE for certain model.
Such assumption causes system hang when thread count per core
is different and there is core or package dependency between CPU
features (using CPU_FEATURE_CORE_BEFORE/AFTER,
CPU_FEATURE_PACKAGE_BEFORE/AFTER).

The change removes such assumption by calculating the actual thread
count per package and per core.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
Cc: Yun Lou <yun.lou@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
3 years agoNetworkPkg: Add NETWORK_HTTP_ENABLE macro
Abner Chang [Thu, 19 Nov 2020 01:58:10 +0000 (09:58 +0800)]
NetworkPkg: Add NETWORK_HTTP_ENABLE macro

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

Add NETWORK_HTTP_ENABLE macro and separate HttpDxe
and HttpUtilitiesDxe drivers from
HTTP_NETWORK_HTTP_BOOT_ENABLE macro.

Current NETWORK_HTTP_BOOT_ENABLE macro is defined to enable HTTP
boot feature in POST, this macro is not only enabling HTTP Boot
related modules but also enabling other generic HTTP modules
such as HttpDxe, HttpUtilitiesDxe and DnsDxe.
These HTTP base drivers would not be only used by HTTP boot
when we introduce the use case of Redfish implementation over
HTTP to edk2.
We should have a dedicate macro to enable generic HTTP functions
on Network stack and additionally provide NETWORK_HTTP_BOOT_ENABLE
for HTTP boot functionality for the use case that platform doesn't
require HTTP boot.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoUefiPayloadPkg: Fix master by adding SafeIntLib
Guo Dong [Thu, 3 Dec 2020 15:43:47 +0000 (08:43 -0700)]
UefiPayloadPkg: Fix master by adding SafeIntLib

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
3 years agoEmulatorPkg: Redfish related changes on EmulatorPkg
Abner Chang [Thu, 3 Dec 2020 05:08:40 +0000 (13:08 +0800)]
EmulatorPkg: Redfish related changes on EmulatorPkg

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

- REDFISH_ENABLE definition to control EFI Redfish support
- Add Redfish platform host interface library to
  EmulatorPkg build.
- Set RestExServiceDevicePath PCD value.
- Add Redfish host interface config EFI application
  to EmulatorPkg build.
- Use Redfish DSC/FDF include file.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
3 years agoEmulatorPkg: Add allowable dependency
Abner Chang [Thu, 3 Dec 2020 05:06:49 +0000 (13:06 +0800)]
EmulatorPkg: Add allowable dependency

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

Add RedfishPkg to DependencyCheck section in
yaml file.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
3 years agoEmulatorPkg/Application: Publish Redfish Host Interface Record
Abner Chang [Thu, 3 Dec 2020 05:05:27 +0000 (13:05 +0800)]
EmulatorPkg/Application: Publish Redfish Host Interface Record

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

The EFI application to configure the network information of
Redfish service.
The configurations are stored in EFI variables.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Ting Ye <ting.ye@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Fan Wang <fan.wang@intel.com>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
3 years agoEmulatorPkg/RedfishPlatformHostInterfaceLib library
Abner Chang [Thu, 3 Dec 2020 05:00:14 +0000 (13:00 +0800)]
EmulatorPkg/RedfishPlatformHostInterfaceLib library

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

Platform specific implementation of providing
Redfish host interface information.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Ting Ye <ting.ye@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Fan Wang <fan.wang@intel.com>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Acked-by: Ray Ni <ray.ni@intel.com>
3 years agoUefiPayloadPkg: Remove PEI phase from Payload
Guo Dong [Sat, 12 Sep 2020 23:31:14 +0000 (16:31 -0700)]
UefiPayloadPkg: Remove PEI phase from Payload

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

It is not necessary to have a PEI phase in the UEFI payload since no
specific PEI task is required. This patch adds a UefiPayloadEntry
driver to get UEFI Payload required information from the bootloaders,
convert them into a HOB list, load DXE core and transfer control to it.

Here is the change details:
1) Removed PEI phase, including Peicore, BlSupportPei, SecCore, etc.
2) Added UefiPayloadEntry driver. this is the only driver before DXE core.
3) Added Pure X64 support, dropped Pure IA32 (Could add later if required)
   64bit payload with 32bit entry point is still supported.
4) Use one DSC file UefiPayloadPkg.dsc to support X64 and IA32X64 build.
   Removed UefiPayloadIa32.dsc and UefiPayloadIa32X64.dsc

Tested with SBL and coreboot on QEMU.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
3 years agoOvmfPkg/Bhyve: Fix various style issues
Rebecca Cran [Mon, 30 Nov 2020 05:34:12 +0000 (22:34 -0700)]
OvmfPkg/Bhyve: Fix various style issues

Fix ordering of includes, sources, libraries etc.
Remove leading/trailing underscores from include guards.
Change INF and DSC version numbers to be decimal.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-6-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg: Improve style and formatting in BhyveFwCtlLib.h
Rebecca Cran [Mon, 30 Nov 2020 05:34:11 +0000 (22:34 -0700)]
OvmfPkg: Improve style and formatting in BhyveFwCtlLib.h

There were some problems with the formatting and style that made the
file difficult to read.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-5-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg: Fix style of BhyveFwCtlLib.inf
Rebecca Cran [Mon, 30 Nov 2020 05:34:10 +0000 (22:34 -0700)]
OvmfPkg: Fix style of BhyveFwCtlLib.inf

Fix the order of libraries and update INF_VERSION to 1.29.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-4-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg: Improve code style/formatting in BhyveFwCtlLib.c
Rebecca Cran [Mon, 30 Nov 2020 05:34:09 +0000 (22:34 -0700)]
OvmfPkg: Improve code style/formatting in BhyveFwCtlLib.c

The code style in Library/BhyveFwCtlLib/BhyveFwCtlLib.c was very
inconsistent. Fix it to pass the ECC tool checks by typedef'ing
structs, and improve indentation.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-3-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg: Fix BhyveFwCtlLib build with VS2019
Rebecca Cran [Mon, 30 Nov 2020 05:34:08 +0000 (22:34 -0700)]
OvmfPkg: Fix BhyveFwCtlLib build with VS2019

Update BhyveFwCtlLib.c to fix problems with UINT32/UINTN types that
prevented Bhyve from building with VS2019.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201130053412.2-2-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoBaseTools: Collect full Header files for struct finding.
Chen, Christine [Tue, 24 Nov 2020 08:40:23 +0000 (16:40 +0800)]
BaseTools: Collect full Header files for struct finding.

Currently, only parts of the Header files can be collected which
caused some struct definition can not be found. To solve this issue,
Header files full collection has been added in this file to support
the struct finding.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
3 years agoOvmfPkg/XenPvBlkDxe: add return value if allocting fail
Wenyi Xie [Tue, 24 Nov 2020 02:06:32 +0000 (10:06 +0800)]
OvmfPkg/XenPvBlkDxe: add return value if allocting fail

return EFI_OUT_OF_RESOURCES if pool allocating fail.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Anthony Perard <anthony.perard@citrix.com>
Cc: Julien Grall <julien@xen.org>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Message-Id: <1606183592-81879-2-git-send-email-xiewenyi2@huawei.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/Bhyve: Copy Real16ToFlat32.asm and enable cache in CR0
Rebecca Cran [Tue, 24 Nov 2020 00:57:33 +0000 (17:57 -0700)]
OvmfPkg/Bhyve: Copy Real16ToFlat32.asm and enable cache in CR0

Copy UefiCpuPkg/ResetVector/Vtf0/Ia16/Real16ToFlat32.asm to
OvmfPkg/Bhyve/ResetVector/Ia16, with one change, as has also been
made in XenResetVector:

  - SEC_DEFAULT_CR0: enable cache (bit 30 or CD set to 0)

With the CD bit set to 1, this has the downside on AMD systems of
actually running with the cache disabled, which slows the entire system
to a crawl.
There's no need for this bit to be set in virtualized
environments.

This patch reapplies the change from the freebsd uefi-edk2 repo at
https://github.com/freebsd/uefi-edk2/commit/08c00f4e8d9e3e469bdc2ce92d3aa839cae7cf17

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201124005733.18107-4-rebecca@bsdio.com>

3 years agoOvmfPkg/Bhyve: Add support for the AMD host bridge
Rebecca Cran [Tue, 24 Nov 2020 00:57:32 +0000 (17:57 -0700)]
OvmfPkg/Bhyve: Add support for the AMD host bridge

On bhyve, either an Intel or AMD host bridge can be specified, with the
default being Intel.
Both are identical, except the AMD one uses a PCI vendor ID of AMD.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Peter Grehan <grehan@freebsd.org>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201124005733.18107-3-rebecca@bsdio.com>

3 years agoOvmfPkg/Bhyve: Add VariablePolicy engine to Bhyve
Rebecca Cran [Tue, 24 Nov 2020 00:57:31 +0000 (17:57 -0700)]
OvmfPkg/Bhyve: Add VariablePolicy engine to Bhyve

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

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Message-Id: <20201124005733.18107-2-rebecca@bsdio.com>

3 years agoMdeModulePkg/VariablePolicyLib: Fix runtime panic in ValidateSetVariable() edk2-stable202011
James Bottomley [Wed, 25 Nov 2020 20:13:48 +0000 (04:13 +0800)]
MdeModulePkg/VariablePolicyLib: Fix runtime panic in ValidateSetVariable()

The current variable policy is allocated by AllocatePool(), which is
boot time only.  This means that if you do any variable setting in the
runtime, the policy has been freed.  Ordinarily this isn't detected
because freed memory is still there, but when you boot the Linux
kernel, it's been remapped so the actual memory no longer exists in
the memory map causing a page fault.

Fix this by making it AllocateRuntimePool().  For SMM drivers, the
platform DSC is responsible for resolving the MemoryAllocationLib
class to the SmmMemoryAllocationLib instance. In the
SmmMemoryAllocationLib instance, AllocatePool() and
AllocateRuntimePool() are implemented identically. Therefore this
change is a no-op when the RegisterVariablePolicy() function is built
into an SMM driver. The fix affects runtime DXE drivers only.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3092
Signed-off-by: James Bottomley <jejb@linux.ibm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Tested-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoCryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku
Kun Qin [Fri, 20 Nov 2020 22:24:32 +0000 (06:24 +0800)]
CryptoPkg: BaseCryptLib: Fix buffer double free in CryptPkcs7VerifyEku

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

SignerCert is part of Pkcs7 instance when both have valid content. OpenSLL
PKCS7_free function will release the memory of SignerCert when applicable.
Freeing SignerCert with X509_free again might cause page fault if use-
after-free guard is enabled.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Kun Qin <kun.q@outlook.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
3 years agoRevert "SecurityPkg: Add RPMC Index to the RpmcLib"
gaoliming [Tue, 24 Nov 2020 01:22:31 +0000 (09:22 +0800)]
Revert "SecurityPkg: Add RPMC Index to the RpmcLib"

This reverts commit 6c8dd15c4ae42501438a525ec41299f365f223cb.

Based on the discussion https://edk2.groups.io/g/devel/message/67764,
this change is regarded as the feature request. But, it doesn't pass
reviewed before 202011 stable tag soft feature freeze. So, it should
not be merged into 202011 stable tag.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Nishant C Mistry <nishant.c.mistry@intel.com>
Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
3 years agoCryptoPkg/Test/UnitTest/Library/BaseCryptLib: Fix MD5 Hash tests
Michael D Kinney [Wed, 25 Nov 2020 04:27:23 +0000 (20:27 -0800)]
CryptoPkg/Test/UnitTest/Library/BaseCryptLib: Fix MD5 Hash tests

Only include MD5 unit tests if ENABLE_MD5_DEPRECATED_INTERFACES
is defined and define ENABLE_MD5_DEPRECATED_INTERFACES for host
based unit tests so MD5 services are always tested.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
3 years agoOvmfPkg/PlatformCI/.azurepiplines: Use stable release of QEMU
Michael D Kinney [Wed, 25 Nov 2020 01:17:12 +0000 (17:17 -0800)]
OvmfPkg/PlatformCI/.azurepiplines: Use stable release of QEMU

Install the 2020.08.14 release of QEMU for Windows.

The QEMU release from 2020.11.20 is installed into the incorrect
directory and is causing EDK II CI failures in the run to shell
step.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
3 years ago.azurepipelines/templates/platform-build-run-steps.yml: Fetch target branch
Sean Brogan [Tue, 24 Nov 2020 21:12:30 +0000 (13:12 -0800)]
.azurepipelines/templates/platform-build-run-steps.yml: Fetch target branch

Update Platform build steps process to fetch target branch

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
3 years ago.azurepipelines/templates/pr-gate-steps.yml: Fetch target branch
Sean Brogan [Tue, 24 Nov 2020 19:43:04 +0000 (11:43 -0800)]
.azurepipelines/templates/pr-gate-steps.yml: Fetch target branch

Add step to fetch target branch so that PR_EVAL can resolve diff

Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
3 years agoMdeModulePkg/LzmaCustomDecompressLib: catch 4GB+ uncompressed buffer sizes
Laszlo Ersek [Thu, 19 Nov 2020 11:50:34 +0000 (12:50 +0100)]
MdeModulePkg/LzmaCustomDecompressLib: catch 4GB+ uncompressed buffer sizes

The LzmaUefiDecompressGetInfo() function
[MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c] currently
silently truncates the UINT64 "DecodedSize" property of the compressed
blob to the UINT32 "DestinationSize" output parameter.

If "DecodedSize" is 0x1_0000_0100, for example, then the subsequent memory
allocation (for decompression) will likely succeed (allocating 0x100 bytes
only), but then the LzmaUefiDecompress() function (which re-fetches the
uncompressed buffer size from the same LZMA header into a "SizeT"
variable) will overwrite the buffer.

Catch (DecodedSize > MAX_UINT32) in LzmaUefiDecompressGetInfo() at once.
This should not be a practical limitation. (The issue cannot be fixed for
32-bit systems without spec modifications anyway, given that the
"OutputSize" output parameter of
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL.ExtractSection() has type UINTN,
not UINT64.)

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1816
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201119115034.12897-2-lersek@redhat.com>

3 years agoMdeModulePkg/Core/Dxe: limit FwVol encapsulation section recursion
Laszlo Ersek [Thu, 19 Nov 2020 10:53:40 +0000 (11:53 +0100)]
MdeModulePkg/Core/Dxe: limit FwVol encapsulation section recursion

The DXE Core sets up a protocol notify function in its entry point, for
instances of the Firmware Volume Block2 Protocol:

  DxeMain()           [DxeMain/DxeMain.c]
    FwVolDriverInit() [FwVol/FwVol.c]

Assume that a 3rd party UEFI driver or application installs an FVB
instance, with crafted contents. The notification function runs:

  NotifyFwVolBlock() [FwVol/FwVol.c]

installing an instance of the Firmware Volume 2 Protocol on the handle.

(Alternatively, assume that a 3rd party application calls
gDS->ProcessFirmwareVolume(), which may also produce a Firmware Volume 2
Protocol instance.)

The EFI_FIRMWARE_VOLUME2_PROTOCOL.ReadSection() member performs "a
depth-first, left-to-right search algorithm through all sections found in
the specified file" (quoting the PI spec), as follows:

  FvReadFileSection()   [FwVol/FwVolRead.c]
    GetSection()        [SectionExtraction/CoreSectionExtraction.c]
      FindChildNode()   [SectionExtraction/CoreSectionExtraction.c]
        FindChildNode() // recursive call

FindChildNode() is called recursively for encapsulation sections.

Currently this recursion is not limited. Introduce a new PCD
(fixed-at-build, or patchable-in-module), and make FindChildNode() track
the section nesting depth against that PCD.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1743
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201119105340.16225-3-lersek@redhat.com>

3 years agoMdeModulePkg/Core/Dxe: assert SectionInstance invariant in FindChildNode()
Laszlo Ersek [Thu, 19 Nov 2020 10:53:39 +0000 (11:53 +0100)]
MdeModulePkg/Core/Dxe: assert SectionInstance invariant in FindChildNode()

FindChildNode() has two callers: GetSection(), and FindChildNode() itself.

- At the GetSection() call site, a positive (i.e., nonzero)
  SectionInstance is passed. This is because GetSection() takes a
  zero-based (UINTN) SectionInstance, and then passes
  Instance=(SectionInstance+1) to FindChildNode().

- For reaching the recursive FindChildNode() call site, a section type
  mismatch, or a section instance mismatch, is necessary. This means,
  respectively, that SectionInstance will either not have been decreased,
  or not to zero anyway, at the recursive FindChildNode() call site.

Add two ASSERT()s to FindChildNode(), for expressing the (SectionSize>0)
invariant.

In turn, the invariant provides the explanation why, after the recursive
call, a zero SectionInstance implies success. Capture it in a comment.

Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-Id: <20201119105340.16225-2-lersek@redhat.com>

3 years agoSecurityPkg: Add RPMC Index to the RpmcLib
Nishant Mistry [Thu, 12 Nov 2020 02:49:09 +0000 (02:49 +0000)]
SecurityPkg: Add RPMC Index to the RpmcLib

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

The re-design requires multiple RPMC counter usages.
The consumer will be capable of selecting amongst multiple counters.

Signed-off-by: Nishant C Mistry <nishant.c.mistry@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoIntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format
Bob Feng [Fri, 13 Nov 2020 10:32:08 +0000 (18:32 +0800)]
IntelFsp2Pkg/Tools: Fixed PatchFv.py to parse new Fv map file format

The commit 76e8aac158b0717fa27f12e4d008f79161ddb050 changed Fv map format.
It added the image type to better support source level debug. But it broke
the function of PatchFv.py because PatchFv.py also consume Fv map file.

This patch is to update PatchFv.py to make it work again.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Yunhua Feng <fengyunhua@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoBaseTools: Resolve index out of range errors.
Mingyue Liang [Fri, 13 Nov 2020 07:33:01 +0000 (15:33 +0800)]
BaseTools: Resolve index out of range errors.

This problem is generated by solving bz2972's
patch, and the commit ID is
0af7f8e6a9253960ba820cd6ddfd8c36543d30cb.

This is a problem when updating the DEPs file.
The code does not consider that there is only
one line of content in the file, so the filter
condition is added to prevent the index from
exceeding the range.

Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address
Sheng Wei [Mon, 9 Nov 2020 05:16:57 +0000 (13:16 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Reflect page table depth with page table address

When trying to get page table base, if mInternalCr3 is zero, it will use
 the page table from CR3, and reflect the page table depth by CR4 LA57 bit.
If mInternalCr3 is non zero, it will use the page table from mInternalCr3
 and reflect the page table depth of mInternalCr3 at same time.
In the case of X64, we use m5LevelPagingNeeded to reflect the depth of
 the page table. And in the case of IA32, it will not the page table depth
 information.

This patch is a bug fix when enable CET feature with 5 level paging.
The SMM page tables are allocated / initialized in PiCpuSmmEntry().
When CET is enabled, PiCpuSmmEntry() must further modify the attribute of
 shadow stack pages. This page table is not set to CR3 in PiCpuSmmEntry().
 So the page table base address is set to mInternalCr3 for modifty the
 page table attribute. It could not use CR4 LA57 bit to reflect the
 page table depth for mInternalCr3.
So we create a architecture-specific implementation GetPageTable() with
 2 output parameters. One parameter is used to output the page table
 address. Another parameter is used to reflect if it is 5 level paging
 or not.

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

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoUefiCpuPkg/PiSmmCpuDxeSmm: Correct the Cr3 typo
Sheng Wei [Tue, 27 Oct 2020 07:59:41 +0000 (15:59 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Correct the Cr3 typo

Change the variable name from mInternalGr3 to mInternalCr3.

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

Signed-off-by: Sheng Wei <w.sheng@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
3 years agoCryptoPkg: Make the MD5 disable as default for security
Gao, Zhichao [Thu, 12 Nov 2020 05:55:58 +0000 (13:55 +0800)]
CryptoPkg: Make the MD5 disable as default for security

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

Make the deprecated MD5 disable as default setting for
security.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Message-Id: <20201112055558.2348-14-zhichao.gao@intel.com>

3 years agoNetworkPkg/Defines: Make iSCSI disable as default
Gao, Zhichao [Thu, 12 Nov 2020 05:55:57 +0000 (13:55 +0800)]
NetworkPkg/Defines: Make iSCSI disable as default

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

iSCSI is using the deprecated function MD5. It is
better to make the default setting secure. If the platforms
want to use the iSCSI, they should enable it in the platforms'
dsc file and be aware they are using an function with weak
cryptography.

Enable iSCSI in NetworkPkg.dsc for build.

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Kelly Steele <kelly.steele@intel.com>
Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Message-Id: <20201112055558.2348-13-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
3 years agoOvmfPkg/BhyveX64.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:56 +0000 (13:55 +0800)]
OvmfPkg/BhyveX64.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-12-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/OvmfXen.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:55 +0000 (13:55 +0800)]
OvmfPkg/OvmfXen.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-11-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/OvmfPkgX64.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:54 +0000 (13:55 +0800)]
OvmfPkg/OvmfPkgX64.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-10-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/OvmfPkgIa32X64.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:53 +0000 (13:55 +0800)]
OvmfPkg/OvmfPkgIa32X64.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-9-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/OvmfPkgIa32.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:52 +0000 (13:55 +0800)]
OvmfPkg/OvmfPkgIa32.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-8-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/ArmVirtQemuKernel.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:51 +0000 (13:55 +0800)]
ArmVirtPkg/ArmVirtQemuKernel.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-7-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoArmVirtPkg/ArmVirtQemu.dsc: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:50 +0000 (13:55 +0800)]
ArmVirtPkg/ArmVirtQemu.dsc: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.

Enable iSCSI.

Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Message-Id: <20201112055558.2348-6-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Build-tested-by: Laszlo Ersek <lersek@redhat.com>
3 years agoNetworkPkg: Enable MD5 while enable iSCSI
Gao, Zhichao [Thu, 12 Nov 2020 05:55:49 +0000 (13:55 +0800)]
NetworkPkg: Enable MD5 while enable iSCSI

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

There is a plan to make MD5 disable as default.
The new MACRO ENABLE_MD5_DEPRECATED_INTERFACES
would be introduced to enable MD5. Make the
definition ahead of the change to avoid build
error after the MACRO changed.
1. Add the NetworkBuildOptions.dsc.inc to define
the MACRO for build (support: GCC, INTEL, MSFT and
RVCT)
2. Add the BuildOption file to Network.dsc.inc

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Message-Id: <20201112055558.2348-5-zhichao.gao@intel.com>
[lersek@redhat.com: clean up comments in "NetworkBuildOptions.dsc.inc"]
[lersek@redhat.com: hoist "BuildOptions" above "Components" in
 "Network.dsc.inc" for bug compat with edk2-platforms]
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Siyuan Fu <siyuan.fu@intel.com>
3 years agoCryptoPkg/dsc: Enable MD5 when CRYPTO_SERVICES enable MD5
Gao, Zhichao [Thu, 12 Nov 2020 05:55:48 +0000 (13:55 +0800)]
CryptoPkg/dsc: Enable MD5 when CRYPTO_SERVICES enable MD5

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

CRYPTO_SERVICES PACKAGES and ALL config would enable MD5
function. So explicitly enable MD5 while CRYPTO_SERVICES
are set PACKAGES and ALL.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Message-Id: <20201112055558.2348-4-zhichao.gao@intel.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoSecurityPkg/Hash2DxeCrypto: Remove SHA1 support
Gao, Zhichao [Thu, 12 Nov 2020 05:55:47 +0000 (13:55 +0800)]
SecurityPkg/Hash2DxeCrypto: Remove SHA1 support

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

Remove the deprecated SHA1 support of Hash2DxeCrypto
driver.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Message-Id: <20201112055558.2348-3-zhichao.gao@intel.com>

3 years agoSecurityPkg/Hash2DxeCrypto: Remove MD5 support
Gao, Zhichao [Thu, 12 Nov 2020 05:55:46 +0000 (13:55 +0800)]
SecurityPkg/Hash2DxeCrypto: Remove MD5 support

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

Remove the deprecated MD5 support of Hash2DxeCrypto
driver.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Message-Id: <20201112055558.2348-2-zhichao.gao@intel.com>

3 years agoMdePkg/IndustryStandard: Fix CXL 1.1 structure layout issues
Michael D Kinney [Wed, 11 Nov 2020 01:29:33 +0000 (17:29 -0800)]
MdePkg/IndustryStandard: Fix CXL 1.1 structure layout issues

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

* Fix offset of LinkLayerControlAndStatus in the
  CXL_1_1_LINK_CAPABILITY_STRUCTURE structure
* Fix offset of LinkLayerAckTimerControl in the
  CXL_1_1_LINK_CAPABILITY_STRUCTURE structure
* Fix offset of LinkLayerDefeature in
  the CXL_1_1_LINK_CAPABILITY_STRUCTURE structure
* Add CXL_11_SIZE_ASSERT() macro to verify the size of
  a register layout structure at compile time and use
  it to verify the sizes of the CXL 1.1 register structures.
* Add CXL_11_OFFSET_ASSERT() macro to verify the offset of
  fields in a register layout structure at compiler time and
  use it to verify the offset of fields in CXL 1.1
  register structures.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ashraf Javeed <ashraf.javeed@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ashraf Javeed <ashraf.javeed@intel.com>
3 years agoMdeModulePkg: Drop VarLock from RuntimeDxe variable driver
Bret Barkelew [Mon, 9 Nov 2020 06:45:22 +0000 (14:45 +0800)]
MdeModulePkg: Drop VarLock from RuntimeDxe variable driver

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

Now that everything should be moved to
VariablePolicy, drop support for the
deprecated VarLock SMI interface and
associated functions from variable RuntimeDxe.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Change TCG MOR variables to use VariablePolicy
Bret Barkelew [Mon, 9 Nov 2020 06:45:21 +0000 (14:45 +0800)]
MdeModulePkg: Change TCG MOR variables to use VariablePolicy

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

These were previously using VarLock, which is
being deprecated.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoSecurityPkg: Allow VariablePolicy state to delete authenticated variables
Bret Barkelew [Mon, 9 Nov 2020 06:45:20 +0000 (14:45 +0800)]
SecurityPkg: Allow VariablePolicy state to delete authenticated variables

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

Causes AuthService to check
IsVariablePolicyEnabled() before enforcing
write protections to allow variable deletion
when policy engine is disabled.

Only allows deletion, not modification.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Chao Zhang <chao.b.zhang@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Allow VariablePolicy state to delete protected variables
Bret Barkelew [Mon, 9 Nov 2020 06:45:19 +0000 (14:45 +0800)]
MdeModulePkg: Allow VariablePolicy state to delete protected variables

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

TcgMorLockSmm provides special protections for
the TCG MOR variables. This will check
IsVariablePolicyEnabled() before enforcing
them to allow variable deletion when policy
engine is disabled.

Only allows deletion, not modification.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Connect VariablePolicy business logic to VariableServices
Bret Barkelew [Mon, 9 Nov 2020 06:45:18 +0000 (14:45 +0800)]
MdeModulePkg: Connect VariablePolicy business logic to VariableServices

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

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

Add connective code to publish the VariablePolicy protocol
and wire it to either the SMM communication interface
or directly into the VariablePolicyLib business logic.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoUefiPayloadPkg: Add VariablePolicy engine to UefiPayloadPkg platform
Bret Barkelew [Mon, 9 Nov 2020 06:45:17 +0000 (14:45 +0800)]
UefiPayloadPkg: Add VariablePolicy engine to UefiPayloadPkg platform

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

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
3 years agoArmVirtPkg: Add VariablePolicy engine to ArmVirtPkg platform
Bret Barkelew [Mon, 9 Nov 2020 06:45:16 +0000 (14:45 +0800)]
ArmVirtPkg: Add VariablePolicy engine to ArmVirtPkg platform

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

Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoEmulatorPkg: Add VariablePolicy engine to EmulatorPkg platform
Bret Barkelew [Mon, 9 Nov 2020 06:45:15 +0000 (14:45 +0800)]
EmulatorPkg: Add VariablePolicy engine to EmulatorPkg platform

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

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
3 years agoOvmfPkg: Add VariablePolicy engine to OvmfPkg platform
Bret Barkelew [Mon, 9 Nov 2020 06:45:14 +0000 (14:45 +0800)]
OvmfPkg: Add VariablePolicy engine to OvmfPkg platform

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

Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoMdeModulePkg: Define the VarCheckPolicyLib and SMM interface
Bret Barkelew [Mon, 9 Nov 2020 06:45:13 +0000 (14:45 +0800)]
MdeModulePkg: Define the VarCheckPolicyLib and SMM interface

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

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

This is an instance of a VarCheckLib that is backed by the
VariablePolicyLib business logic. It also publishes the SMM
calling interface for messages from the DXE protocol.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Define the VariablePolicyHelperLib
Bret Barkelew [Mon, 9 Nov 2020 06:45:12 +0000 (14:45 +0800)]
MdeModulePkg: Define the VariablePolicyHelperLib

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

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

Add the VariablePolicyHelperLib library, containing
several functions to help with the repetitive process
of creating a correctly structured and packed
VariablePolicy entry.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Define the VariablePolicyLib
Bret Barkelew [Mon, 9 Nov 2020 06:45:11 +0000 (14:45 +0800)]
MdeModulePkg: Define the VariablePolicyLib

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

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

Add the VariablePolicyLib library that implements
the portable business logic for the VariablePolicy
engine.

Also add host-based CI test cases for the lib.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoMdeModulePkg: Define the VariablePolicy protocol interface
Bret Barkelew [Mon, 9 Nov 2020 06:45:10 +0000 (14:45 +0800)]
MdeModulePkg: Define the VariablePolicy protocol interface

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

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

Add the VariablePolicy protocol interface
header and add to the MdeModulePkg.dec file.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Liming Gao <liming.gao@intel.com>
Cc: Bret Barkelew <brbarkel@microsoft.com>
Signed-off-by: Bret Barkelew <brbarkel@microsoft.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Acked-by: Jian J Wang <jian.j.wang@intel.com>
3 years agoIntelFsp2Pkg: Fix FSP binary rebasing issue for PE32+ image
Maurice Ma [Thu, 12 Nov 2020 00:10:32 +0000 (16:10 -0800)]
IntelFsp2Pkg: Fix FSP binary rebasing issue for PE32+ image

Current FSP rebasing script SplitFspBin.py has support for both
PE32 and PE32+ image formats. However, while updating the ImageBase
field in the image header, it always assumed the ImageBase field is
32bit long. Since PE32+ image format defined ImageBase as 64bit,
the current script will only update the lower 32bit value and leave
the upper 32bit untouched. It does not work well for PE32+ image
that requires update in the upper 32bit ImageBase field. The
expected behavior is to update the full 64bit field. This patch
implemented this fix.

Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
3 years agoOvmfPkg/Bhyve: fix build breakage after SEV-ES changes
Rebecca Cran [Thu, 12 Nov 2020 05:31:53 +0000 (22:31 -0700)]
OvmfPkg/Bhyve: fix build breakage after SEV-ES changes

Consume the SEV-ES-independent reset vector restored in the previous
patch. Use the Null instance of VmgExitLib.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201112053153.22038-3-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoOvmfPkg/Bhyve: detach ResetVector from before the SEV-ES changes
Rebecca Cran [Thu, 12 Nov 2020 05:31:52 +0000 (22:31 -0700)]
OvmfPkg/Bhyve: detach ResetVector from before the SEV-ES changes

Commits 6995a1b79bab8a2732186a53 and 30937f2f98c4 modified all four
regular files under "OvmfPkg/ResetVector" with SEV-ES dependencies.
These are not relevant for Bhyve. Detach the pre-SEV-ES version of
ResetVector for Bhyve.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Message-Id: <20201112053153.22038-2-rebecca@bsdio.com>
Acked-by: Peter Grehan <grehan@freebsd.org>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
3 years agoBaseTools: Fix BrotliCompress tool issue
Yunhua Feng [Tue, 10 Nov 2020 02:41:08 +0000 (10:41 +0800)]
BaseTools: Fix BrotliCompress tool issue

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

This is the regression issue in BaseTools BrotliCompress after Brotli
is changed to submodule. BrotliCompress should store the source size
and scratch buffer size into the header of the compressed binary data.
But now, BrotliCompress doesn't store them. So, BrotliDecompress
can't work.

To fix this issue, BrotliCompress tool main() function should be provided.
It needs to support the options of -e, -d, -o file, -g gap, -q level.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoMdePkg/BaseRngLibDxe: Add DXE_RUNTIME_DRIVER class to RngLib
Pete Batard [Wed, 4 Nov 2020 19:03:46 +0000 (03:03 +0800)]
MdePkg/BaseRngLibDxe: Add DXE_RUNTIME_DRIVER class to RngLib

The Raspberry Pi platform with Secure Boot enabled currently fails to build
with error:

  Module type [DXE_RUNTIME_DRIVER] is not supported by library instance
  [/home/appveyor/projects/rpi4/edk2/MdePkg/Library/DxeRngLib/DxeRngLib.inf]

Add the missing class to fix this issue.

Signed-off-by: Pete Batard <pete@akeo.ie>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Andrei Warkentin <awarkentin@vmware.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoMdeModulePkg DisplayEngineDxe: Correct the local variable name.
gechao [Thu, 12 Nov 2020 01:33:58 +0000 (09:33 +0800)]
MdeModulePkg DisplayEngineDxe: Correct the local variable name.

Signed-off-by: gechao <gechao@greatwall.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
3 years agoRedfishPkg: Use DSC include file
Abner Chang [Thu, 12 Nov 2020 00:37:31 +0000 (08:37 +0800)]
RedfishPkg: Use DSC include file

- Include Redfish.dsc.inc in RedfishPkg.dsc. which
  consolidates the necessary components in Redfish.dsc.inc.
- Remove unnecessary library instances from RedfishPkg.dsc.
- Add build option in RedfishPkg.yaml.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
3 years agoRedfishPkg: DSC and FDF include files for enabling EFI Redfish support
Abner Chang [Wed, 4 Nov 2020 13:26:10 +0000 (21:26 +0800)]
RedfishPkg: DSC and FDF include files for enabling EFI Redfish support

Provide the DSC/FDF include files of edk2 Redfish related
modules and definitions which can be included in platform's
DSC/FDF.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Fan Wang <fan.wang@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
3 years agoRedfishPkg: Add PCD definition to RedfishPkg
Abner Chang [Wed, 4 Nov 2020 08:17:14 +0000 (16:17 +0800)]
RedfishPkg: Add PCD definition to RedfishPkg

This PCD is the UEFI device path which is used as the Redfish
host interface.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Signed-off-by: Ting Ye <ting.ye@intel.com>
Signed-off-by: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Fan Wang <fan.wang@intel.com>
Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Peter O'Hanley <peter.ohanley@hpe.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>