]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
2 years agoUefiPayloadPkg: Make Boot Timeout configurable
Guo Dong [Tue, 29 Mar 2022 17:55:53 +0000 (10:55 -0700)]
UefiPayloadPkg: Make Boot Timeout configurable

Signed-off-by: Sean Rhodes sean@starlabs.systems
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg/Library/PlatformBootManagerLib: Remove broken VGA detection
Patrick Rudolph [Thu, 10 Feb 2022 21:27:51 +0000 (14:27 -0700)]
UefiPayloadPkg/Library/PlatformBootManagerLib: Remove broken VGA detection

This fixes an issue where the framebuffer provided by coreboot or
slimbootloader will only work on the primary VGA device. If the
framebuffer corresponds to a different device the screen will stay black.
In addition, the code doesn't work for multiple graphic cards, has
reference to non existing functions, and is a duplication of common code.

Call EfiBootManagerConnectVideoController on every display device found,
not only the legacy VGA device. This is the same as OvmfPkg does.

Allows to display output on the framebuffer set up by firmware, which might
not be the VGA device.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg: Fix PciHostBridgeLib
Patrick Rudolph [Wed, 16 Feb 2022 14:54:25 +0000 (07:54 -0700)]
UefiPayloadPkg: Fix PciHostBridgeLib

On modern platforms with TBT devices the coreboot resource allocator
opens large PCI bridge MMIO windows above 4GiB to place hotplugable
PCI BARs there as they won't fit below 4GiB. In addition modern
GPGPU devices have very big PCI bars that doesn't fit below 4GiB.

The PciHostBridgeLib made lots of assumptions about the coreboot
resource allocator that were not verified at runtime and are no
longer true.

Remove all of the 'coreboot specific' code and implement the same
logic as OvmfPkg's ScanForRootBridges.

Fixes assertion
"ASSERT [PciHostBridgeDxe] Bridge->Mem.Limit < 0x0000000100000000ULL".

Tested with coreboot as bootloader on platforms that have PCI resources
above 4GiB and on platforms that don't have resources above 4GiB.

Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
2 years agoUefiPayloadPkg: Fix architecture in the build instruction
Akihiko Odaki [Sat, 19 Mar 2022 09:07:01 +0000 (02:07 -0700)]
UefiPayloadPkg: Fix architecture in the build instruction

Signed-off-by: Akihiko Odaki <akihiko.odaki@gmail.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoUefiPayloadPkg: Fix build error
Guo Dong [Tue, 8 Feb 2022 22:51:55 +0000 (15:51 -0700)]
UefiPayloadPkg: Fix build error

On windows build, need add "-DPLATFORMX64_ENABLE=TRUE" in the build
command line beside -DNETWORK_DRIVER_ENABLE=TRUE in order build
network features. So update DSC to set PLATFORMX64_ENABLE to TRUE
when building network feature.
On Linux build, DSC file should not have PcdAllowHttpConnections
without building network feature, else it would cause build error.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Reviewed-by Sean Rhodes <sean@starlabs.systems>

2 years agoUefiPayloadPkg/UefiPayloadPkg.ci.yaml: Remove duplicated entry
Patrick Rudolph [Mon, 21 Mar 2022 09:10:09 +0000 (02:10 -0700)]
UefiPayloadPkg/UefiPayloadPkg.ci.yaml: Remove duplicated entry

Remove a duplicated entry to fix a CI error.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Acked-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Dun Tan <dun.tan@intel.com>
2 years agoMdeModulePkg/Ufs: bRefClkFreq attribute be programmed after fDeviceInit
Bandaru, Purna Chandra Rao [Fri, 25 Mar 2022 12:18:00 +0000 (20:18 +0800)]
MdeModulePkg/Ufs: bRefClkFreq attribute be programmed after fDeviceInit

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

bRefClkFreq UFS card attribute need to be read and written after successful
fDeviceInit and NOP response so that link will be stable.

Cc: Wu Hao A <hao.a.wu@intel.com>
Cc: Albecki Mateusz <mateusz.albecki@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Purna Chandra Rao Bandaru <purna.chandra.rao.bandaru@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoShellPkg/AcpiView: PrintFormatter for FADT Flags field
Abdul Lateef Attar [Fri, 18 Mar 2022 12:59:00 +0000 (20:59 +0800)]
ShellPkg/AcpiView: PrintFormatter for FADT Flags field

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

Adds PrintFormatter function to the FADT flags field.
Prints indivisual flag name along with flag value.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2 years agoShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser
Abdul Lateef Attar [Fri, 18 Mar 2022 12:58:59 +0000 (20:58 +0800)]
ShellPkg/AcpiView: Adds ACPI_PARSER bitfield parser

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

Adds ParseAcpiBitFields() which is based on
ParseAcpi() and capable of parsing the bit fields.
Supports parsing of UINT8, UINT16, UINT32 and UINT64 byte data.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2 years agoUefiCpuPkg: Update BFV searching algorithm in VTF0
Kuo, Ted [Thu, 17 Mar 2022 08:38:32 +0000 (16:38 +0800)]
UefiCpuPkg: Update BFV searching algorithm in VTF0

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3870
The new algorithm searches FFS3 GUID first and then FFS2 GUID at
every 4KB address in the top 16MB just below 4GB.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
2 years agoBaseTools:Support decimal version number in ECC check
wenyi,xie via groups.io [Fri, 18 Mar 2022 06:09:24 +0000 (14:09 +0800)]
BaseTools:Support decimal version number in ECC check

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

When doing ecc inf version check, the decimal type version number
like 1.27 is treated as invalid version.
So the code should be updated to support decimal type version number.

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: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoBasetools: turn off gcc12 warning
Gerd Hoffmann [Thu, 24 Mar 2022 12:04:36 +0000 (20:04 +0800)]
Basetools: turn off gcc12 warning

In function ?SetDevicePathEndNode?,
    inlined from ?FileDevicePath? at DevicePathUtilities.c:857:5:
DevicePathUtilities.c:321:3: error: writing 4 bytes into a region of size 1 [-Werror=stringop-overflow=]
  321 |   memcpy (Node, &mUefiDevicePathLibEndDevicePath, sizeof (mUefiDevicePathLibEndDevicePath));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from UefiDevicePathLib.h:22,
                 from DevicePathUtilities.c:16:
../Include/Protocol/DevicePath.h: In function ?FileDevicePath?:
../Include/Protocol/DevicePath.h:51:9: note: destination object ?Type? of size 1
   51 |   UINT8 Type;       ///< 0x01 Hardware Device Path.
      |         ^~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoBaseTools: fix gcc12 warning
Gerd Hoffmann [Thu, 24 Mar 2022 12:04:35 +0000 (20:04 +0800)]
BaseTools: fix gcc12 warning

Sdk/C/LzmaEnc.c: In function ?LzmaEnc_CodeOneMemBlock?:
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ?outStream? in ?*p.rc.outStream? [-Werror=dangling-pointer=]
 2828 |   p->rc.outStream = &outStream.vt;
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ?outStream? declared here
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
      |                            ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ?pp? declared here
Sdk/C/LzmaEnc.c:2828:19: error: storing the address of local variable ?outStream? in ?*(CLzmaEnc *)pp.rc.outStream? [-Werror=dangling-pointer=]
 2828 |   p->rc.outStream = &outStream.vt;
      |   ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ?outStream? declared here
 2811 |   CLzmaEnc_SeqOutStreamBuf outStream;
      |                            ^~~~~~~~~
Sdk/C/LzmaEnc.c:2811:28: note: ?pp? declared here
cc1: all warnings being treated as errors

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoBaseTools: fix gcc12 warning
Gerd Hoffmann [Thu, 24 Mar 2022 12:04:34 +0000 (20:04 +0800)]
BaseTools: fix gcc12 warning

GenFfs.c:545:5: error: pointer ?InFileHandle? used after ?fclose? [-Werror=use-after-free]
  545 |     Error(NULL, 0, 4001, "Resource", "memory cannot be allocated  of %s", InFileHandle);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
GenFfs.c:544:5: note: call to ?fclose? here
  544 |     fclose (InFileHandle);
      |     ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoCryptoPkg? Redefinition bug in CrtLibSupport.h.
Li, Zhihao [Fri, 25 Mar 2022 07:40:46 +0000 (15:40 +0800)]
CryptoPkg? Redefinition bug in CrtLibSupport.h.

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

Parallel hash patch redefines uint_64 type in CrtLibSupport.h
which has been defined in openssl/include/openssl/e_os2.h.
CryptMd5.c including e_os2.h cause redefinition bug.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoCryptoPkg: update openssl submodule to 1.1.1n
Gerd Hoffmann [Fri, 25 Mar 2022 08:06:11 +0000 (16:06 +0800)]
CryptoPkg: update openssl submodule to 1.1.1n

Pick up bugfixes from latest openssl release.  Includes CVE-2022-0778
fix (I don't think edk2 is affected though due to EC being disabled).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoBaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.c
Bob Feng [Tue, 15 Mar 2022 12:16:54 +0000 (20:16 +0800)]
BaseTools: Remove the redundant __FLEXIBLE_SIZE from PcdValueInit.c

For the multiple SKU case, basetools generates multiple redundant
__FLEXIBLE_SIZE statement that is from the same line in dsc file.

This behavior causes the generated PcdValueInit.c file to have huge size,
and the compilation time is very long.

This patch is going to fix this issue.

Signed-off-by: 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>
2 years agoBaseTools: Add the FeatureFlagExpression usage to the Source Section
Yi Li [Tue, 22 Mar 2022 07:26:11 +0000 (15:26 +0800)]
BaseTools: Add the FeatureFlagExpression usage to the Source Section

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

FeatureFlagExpression Support in Source section of INF file. The Pcd
value in the expression is from INF or DEC.
When a FeatureFlagExpression is present,if the expression evaluates
to TRUE,then the entry is valid. If the expression evaluates to FALSE,
then the EDK II build tools must ignore the entry.

This patch is going to add this feature.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Heng Luo <heng.luo@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Yi Li <yi1.li@intel.com>
2 years agoMdeModulePkg/NvmExpressPei: fix check for NVM command set
Mara Sophie Grosch via groups.io [Wed, 23 Mar 2022 10:22:34 +0000 (18:22 +0800)]
MdeModulePkg/NvmExpressPei: fix check for NVM command set

Previous commit fixed that check in DXE, this one now for PEI.

Signed-off-by: Mara Sophie Grosch <littlefox@lf-net.org>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoMdeModulePkg/NvmExpressDxe: fix check for Cap.Css
Mara Sophie Grosch via groups.io [Wed, 23 Mar 2022 10:22:33 +0000 (18:22 +0800)]
MdeModulePkg/NvmExpressDxe: fix check for Cap.Css

Fix the check for NVMe command set being supported by the controller.

Was problematic with qemu (6.2.0, Debian 1:6.2+dfsg-3), which sets 0xC1
in that register, making the OVMF think the NVMe controller does not
support NVMe.

Uncovered by commit 9dd14fc91c174eae87fd122c7ac70073a363527f, which
changed the number of bits included in the Css register from 4 to 8.

Signed-off-by: Mara Sophie Grosch <littlefox@lf-net.org>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoIntelFsp2Pkg: BaseFspCommonLib Support for X64
Kuo, Ted [Mon, 14 Mar 2022 04:22:38 +0000 (12:22 +0800)]
IntelFsp2Pkg: BaseFspCommonLib Support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3867
Add BaseFspCommonLib Support for X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2 years agoMdePkg/AcpiXX.h: Update Error Severity type for Generic Error Status Block
Hao A Wu [Mon, 7 Mar 2022 08:19:58 +0000 (16:19 +0800)]
MdePkg/AcpiXX.h: Update Error Severity type for Generic Error Status Block

Starting from ACPI Specification Version 5.1 Errata B, the term
'Correctable' is no longer being used as an error severity of the
reported error in Chapter 18 APEI.

This commit will
a) For Acpi40.h & Acpi50.h
Add new macro EFI_ACPI_X_X_ERROR_SEVERITY_RECOVERABLE, since both the
terms 'Correctable' and 'Recoverable' are used to denote the same error
severity.

b) Header files starting from Acpi51.h to Acpi64.h
Add new macro EFI_ACPI_X_X_ERROR_SEVERITY_RECOVERABLE.
Keeps the origin EFI_ACPI_X_X_ERROR_SEVERITY_CORRECTABLE for compatibility
consideration, but add comments to mark it as deprecated and should no
longer be used.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Hao A Wu <hao.a.wu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoCryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib.
Zhihao Li [Fri, 18 Mar 2022 04:22:09 +0000 (12:22 +0800)]
CryptoPkg: Add new hash algorithm ParallelHash256HashAll in BaseCryptLib.

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

Parallel hash function ParallelHash256HashAll, as defined in NIST's
Special Publication 800-185, published December 2016. It utilizes
multi-process to calculate the digest.

Passed CI test.
Onprotocol version code passed test.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdePkg/Include: Smbios Specification 3.5.0 changes
Abdul Lateef Attar via groups.io [Thu, 24 Feb 2022 15:50:03 +0000 (23:50 +0800)]
MdePkg/Include: Smbios Specification 3.5.0 changes

Adds following changes
1) Added support for manufacturing mode in
   BIOS Characteristics Extension Byte 2.
2) Added support for slot height in
   System Slot Table (type 9).
3) Updated Built-in pointing device interface with
   USB, I2C and SPI.
4) Updates Onboard Devices Extended Information with
   wireless LAN, bluetooth, WWAN, eMMC, NVMe and UFC.
5) Added new table Firmware Inventory Information (Type 45)
   and its corresponding enum values.
6) Added new table String Property Table (Type 46)
   and its corresponding enum values.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoUefiPayloadPkg: Hookup SD/MMC timeout
Sean Rhodes [Fri, 18 Feb 2022 14:52:25 +0000 (07:52 -0700)]
UefiPayloadPkg: Hookup SD/MMC timeout

Hook SD_MMC_TIMEOUT build option to SdMmcGenericTimeoutValue PCD.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoMdeModulePkg/SdMmcPciHcDxe: Make timeout for SD card configurable
Sean Rhodes [Thu, 24 Feb 2022 07:58:51 +0000 (00:58 -0700)]
MdeModulePkg/SdMmcPciHcDxe: Make timeout for SD card configurable

The default 1s timeout can delay boot splash on some hardware with no
benefit.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoIntelFsp2Pkg: BaseFspSwitchStackLib Support for X64
Kuo, Ted [Mon, 14 Mar 2022 02:48:00 +0000 (10:48 +0800)]
IntelFsp2Pkg: BaseFspSwitchStackLib Support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3832
Add BaseFspSwitchStackLib Support for X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2 years agoIntelFsp2Pkg: BaseFspDebugLibSerialPort Support for X64
Kuo, Ted [Mon, 14 Mar 2022 02:32:42 +0000 (10:32 +0800)]
IntelFsp2Pkg: BaseFspDebugLibSerialPort Support for X64

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3833
Add BaseFspDebugLibSerialPort Support for X64.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Ted Kuo <ted.kuo@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
2 years agoEmulatorPkg/RedfishPlatformCredentialLib: Don't stop Redfish service
Abner Chang [Wed, 16 Mar 2022 08:02:49 +0000 (16:02 +0800)]
EmulatorPkg/RedfishPlatformCredentialLib: Don't stop Redfish service

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

Platform Redfish credential library shouldn't stop the service at either EndOfDXE or ExitBootService notification. RedfishConfigureHandler UEFI driver is responsible to stop the Redfish service when EndOfDXE or ExitBootService event is triggered.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2 years agoEmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME
Abner Chang [Fri, 4 Mar 2022 08:45:05 +0000 (16:45 +0800)]
EmulatorPkg/RedfishPlatformCredentialLib: Check EFI_SECURE_BOOT_MODE_NAME

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

Check EFI_SECURE_BOOT_MODE_NAME before setting the flags to
prohibit acquiring Redfish service credential and using Redfish
service.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2 years agoBaseTools/GenFw: Enhance GenFw to support PRM GCC build
Huang, Li-Xia [Mon, 14 Mar 2022 05:27:21 +0000 (13:27 +0800)]
BaseTools/GenFw: Enhance GenFw to support PRM GCC build

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

Since PRM module needs to support export table in PE-COFF, we'll
enhance GenFw tool to support this.

Add one export flag in GenFw tool. If export flag is set:
Step1: Scan ELF symbol table based on PRM module descriptor to get
descriptor offset address;
Step2: Find PRM handlers number and name in COFF file based on the
address from step1;
Step3: Write PRM info such as handler name and export RVA into COFF
export table.

PRM option currently only supports DXE RUNTIME driver and X64 arch.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Lixia Huang <lisa.huang@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoDynamicTablesPkg: Fix serial port namespace path in DBG2
Sami Mujawar [Thu, 10 Mar 2022 17:39:27 +0000 (17:39 +0000)]
DynamicTablesPkg: Fix serial port namespace path in DBG2

According to the Debug Port Table 2 (DBG2) specification,
February 17, 2021, the NamespaceString is a NULL terminated
ASCII string that consists of a fully qualified reference
to the object that represents the serial port device in the
ACPI namespace.

The DBG2 table generator did not populate the full device
path for the serial port device, and this results in a FWTS
test failure.

Therefore, populate the full namespace device path for the
serial port in DBG2 table.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Tested-by: Jagadeesh Ujja <Jagadeesh.Ujja@arm.com>
Tested-by: Sunny Wang <sunny.wang@arm.com>
2 years agoMdeModulePkg/DxeIpl: Create 5-level page table for long mode
Lou, Yun [Fri, 11 Mar 2022 15:58:51 +0000 (23:58 +0800)]
MdeModulePkg/DxeIpl: Create 5-level page table for long mode

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

Correct the logic about whether 5-level paging is supported.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoUefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm
Kuo, Ted [Fri, 11 Mar 2022 07:28:34 +0000 (15:28 +0800)]
UefiCpuPkg: Support FFS3 GUID in SearchForBfvBase.asm

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3862
The new algorithm searches BFV address with FFS3 GUID first.
If not found, it will search BFV address with FFS2 GUID.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Debkumar De <debkumar.de@intel.com>
Cc: Harry Han <harry.han@intel.com>
Cc: Catharine West <catharine.west@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
2 years agoUefiCpuPkg/MpInitLib:remove optional in declaration
wenyi,xie via groups.io [Thu, 10 Mar 2022 08:06:25 +0000 (16:06 +0800)]
UefiCpuPkg/MpInitLib:remove optional in declaration

To keep the declaration same with definition, remove the last optional
in declaration of WakeUpAP.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
2 years agoMaintainers: Update Maintainers.txt for edk2 Redfish modules
Abner Chang [Mon, 14 Mar 2022 01:24:01 +0000 (09:24 +0800)]
Maintainers: Update Maintainers.txt for edk2 Redfish modules

Add maintainer and reviewer for the edk2 Redfish-related modules
under EmulatorPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoRedfishPkg: fix memory leak issue
Wenyi Xie [Thu, 10 Mar 2022 09:02:14 +0000 (17:02 +0800)]
RedfishPkg: fix memory leak issue

The calloc memory is not free when function collectionEvalOp
return in the halfway.

Cc: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
2 years agoMdeModulePkg: Add bRefClkFreq card attribute programming support
Bandaru, Purna Chandra Rao [Tue, 8 Mar 2022 12:19:35 +0000 (20:19 +0800)]
MdeModulePkg: Add bRefClkFreq card attribute programming support

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

When the UFS card comes out of Manufacturer, bRefClkFreq attribute is set
to 1h on the UFS card as per the Manufacturer Default Value
specified by the spec JESD220*. However, depends on the UFS host system
environment, it need to be set to the correct value.

Reference Clock Frequency value
0h:19.2 MHz
1h: 26 MHz
2h: 38.4 MHz
3h: Obsolete
Others: Reserved

Cc: Wu Hao A <hao.a.wu@intel.com>
Cc: Albecki Mateusz <mateusz.albecki@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Purna Chandra Rao Bandaru <purna.chandra.rao.bandaru@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years ago.azurepipelines: Updated python version
Ken Lautner [Tue, 8 Mar 2022 22:49:15 +0000 (14:49 -0800)]
.azurepipelines: Updated python version

Updated .azurepipelines to use newest python version

Cc: Sean Brogan <sean.brogan@microsoft.com>
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: Kenneth Lautner <kenlautner3@gmail.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
2 years ago.pytool: Update to newest pytools
Ken Lautner [Tue, 8 Mar 2022 22:42:08 +0000 (14:42 -0800)]
.pytool: Update to newest pytools

Update to the newest pytools and resolves the API change for
GetAbsolutePathOnThisSytemFromEdk2RelativePath

Cc: Sean Brogan <sean.brogan@microsoft.com>
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: Kenneth Lautner <kenlautner3@gmail.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
2 years ago.pytool/Plugin/UncrustifyCheck: Output file diffs by default
Michael Kubacki [Thu, 10 Feb 2022 15:58:03 +0000 (10:58 -0500)]
.pytool/Plugin/UncrustifyCheck: Output file diffs by default

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

Changes the default for the "OutputFileDiffs" configuration option
to "True" so the formatting suggestions detected by Uncrustify
will be output in the test case log. The diff is printed in unified
diff format.

This was disabled by default during the initial enabling of
Uncrustify to reduce overall execution time of the plugin against
the codebase due to the large number of changes detected.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoBlSupportSmm: fix definition of SetSmrr()
Sean Rhodes [Wed, 23 Feb 2022 22:55:19 +0000 (15:55 -0700)]
BlSupportSmm: fix definition of SetSmrr()

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg: Make Boot Manager Key configurable
Sean Rhodes [Sat, 5 Mar 2022 10:14:34 +0000 (03:14 -0700)]
UefiPayloadPkg: Make Boot Manager Key configurable

Provide a build option to use [Esc] instead of [F2] for devices
such as Chromebooks that don't have F-keys.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoMdeModulePkg: Add a check for metadata size in NvmExpress Driver
Ma, Hua [Thu, 3 Mar 2022 05:06:04 +0000 (13:06 +0800)]
MdeModulePkg: Add a check for metadata size in NvmExpress Driver

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

Currently this NvmeExpress Driver do not support metadata handling.
According to the NVME specs, metadata may be transferred to the host after
the logical block data. It can overrun the input buffer which may only
be the size of logical block data.

Add a check to return not support for the namespaces formatted with
metadata.

v2 changes:
 - Change debug log level from INFO to ERROR
 - Change to if (NamespaceData->LbaFormat[LbaFmtIdx].Ms != 0)

v1: https://edk2.groups.io/g/devel/message/87242

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoUefiPayloadPkg: Fix case of protocol
Sean Rhodes [Fri, 4 Mar 2022 23:05:11 +0000 (16:05 -0700)]
UefiPayloadPkg: Fix case of protocol

Fix case match in <Protocol/MpService.h> to avoid build failure on
Linux.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoUefiPayloadPkg: Add build option for Above 4G Memory
Sean Rhodes [Wed, 23 Feb 2022 22:59:33 +0000 (15:59 -0700)]
UefiPayloadPkg: Add build option for Above 4G Memory

When build option ABOVE_4G_MEMORY is set to true, nothing will change
and EDKII will use all available memory.

Setting it to false will create memory type information HOB in
payload entry, so that EDKII will reserve enough memory below 4G
for EDKII modules. This option is useful for bootloaders that are not
fully 64-bit aware such as Qubes R4.0.4 bootloader, Zorin and Proxmox.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoMaintainers.txt: Add new reviewer for UefiPayloadPkg
Guo Dong [Wed, 23 Feb 2022 23:19:01 +0000 (16:19 -0700)]
Maintainers.txt: Add new reviewer for UefiPayloadPkg

Add Sean Rhodes as UefiPayload reviewer mainly focus on
UEFI payload for coreboot support.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Sean Rhodes <sean@starlabs.systems>
2 years agoUefiCpuPkg: Extend SMM CPU Service with rendezvous support.
Li, Zhihao [Tue, 1 Mar 2022 11:22:19 +0000 (19:22 +0800)]
UefiCpuPkg: Extend SMM CPU Service with rendezvous support.

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

This patch define a new Protocol with the new services
SmmWaitForAllProcessor(), which can be used by SMI handler
to optionally wait for other APs to complete SMM rendezvous in
relaxed AP mode.

A new library SmmCpuRendezvousLib is provided to abstract the service
into library API to simple SMI handler code.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Cc: Zhihao Li <zhihao.li@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
2 years agoOvmfPkg: CloudHv: Add README
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:37 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Add README

Add some documentation to the CloudHv target in order to clarify how to
use it and what to expect from it.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Rely on PVH memmap instead of CMOS
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:36 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Rely on PVH memmap instead of CMOS

Instead of using the CMOS, the CloudHv platform relies on the list of
memmap entries provided through the PVH boot protocol to determine the
last RAM address below 4G.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Retrieve RSDP address from PVH
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:35 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Retrieve RSDP address from PVH

Instead of hardcoding the address of the RSDP in the firmware, let's
rely on the PVH structure hvm_start_info to retrieve this information.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Generate CloudHv as a PVH ELF binary
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:34 +0000 (21:31 +0800)]
OvmfPkg: Generate CloudHv as a PVH ELF binary

Following the model from the Xen target, CloudHv is generated as a PVH
ELF binary to take advantage of the PVH specification, which requires
less emulation from the VMM.

The fdf include file CloudHvElfHeader.fdf.inc has been generated from
the following commands:

$ gcc -D PVH64 -o elf_gen OvmfPkg/OvmfXenElfHeaderGenerator.c
$ ./elf_gen 4194304 OvmfPkg/CloudHv/CloudHvElfHeader.fdf.inc

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: CloudHv: Remove VARS and CODE sections
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:33 +0000 (21:31 +0800)]
OvmfPkg: CloudHv: Remove VARS and CODE sections

CloudHv doesn't need any VARS store, and it doesn't need the CODE
section to be generated separately either. The only thing needed is to
generate a firmware binary that can be used by Cloud Hypervisor.

Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Xen: Generate fdf include file from ELF header generator
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:32 +0000 (21:31 +0800)]
OvmfPkg: Xen: Generate fdf include file from ELF header generator

Updating the fdf include file based on the run of the ELF header
generator. The diff from this patch is the result of:

$ gcc -o elf_gen OvmfPkg/OvmfXenElfHeaderGenerator.c
$ ./elf_gen 2097152 OvmfPkg/XenElfHeader.fdf.inc

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Xen: Use a new fdf include for the PVH ELF header
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:31 +0000 (21:31 +0800)]
OvmfPkg: Xen: Use a new fdf include for the PVH ELF header

Instead of having the PVH ELF header part of the fdf file directly, we
move it to a dedicated include file. This is the first step in
automating the generation of the header.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Make the Xen ELF header generator more flexible
Sebastien Boeuf [Wed, 2 Mar 2022 13:31:30 +0000 (21:31 +0800)]
OvmfPkg: Make the Xen ELF header generator more flexible

Adding some flexibility to the program through optional parameters and
global define, so that other targets can use the generator.

* A global define is added so that we can choose at build time if we
  want to use 32-bit or 64-bit base structures.
* A first optional parameter is added so the user can provide the
  expected blob size of the generated binary.
* A second optional parameter is added so the user can specify an output
  file to which the generated output will be printed.

The default behavior isn't modified.

Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sebastien Boeuf <sebastien.boeuf@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting
Sean Rhodes [Thu, 24 Feb 2022 11:38:18 +0000 (19:38 +0800)]
MdeModulePkg/Usb/Keyboard.c: Don't request protocol before setting

No need to check the interface protocol then conditionally setting,
just set it to BOOT_PROTOCOL and check for error.

This is what Linux does for HID devices as some don't follow the USB spec.
One example is the Aspeed BMC HID keyboard device, which adds a massive
boot delay without this patch as it doesn't respond to
'GetProtocolRequest'.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoEmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully
Guomin Jiang [Tue, 22 Feb 2022 03:29:23 +0000 (11:29 +0800)]
EmulatorPkg/EmuGopDxe: Set ModeInfo after Open successfully

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

WindowOpen will fail in some case. for example, without XServer.

Shouldn't set ModeInfo in this case to avoid the caller use it
incorrectly

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoMdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error
Guomin Jiang [Sun, 20 Feb 2022 06:53:01 +0000 (14:53 +0800)]
MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no error

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

SetMode will fail in some case. for example, without XServer.
Should handle these case when SetMode fail.

If we don't handle it, it will Segmentation fault.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoedk2/MdeModulePkg/Debuglib: Add Standalone MM support
Xiaolu.Jiang [Tue, 22 Feb 2022 14:14:05 +0000 (22:14 +0800)]
edk2/MdeModulePkg/Debuglib: Add Standalone MM support

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

This change added Standalone MM instance of DebugLib.

Reviewd-by: Jian J Wang <jian.j.wang@intel.com>
Reviewd-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Xiaolu.Jiang <xiaolu.jiang@intel.com>
2 years agoUefiPayloadPkg/PayloadLoaderPeim: Use INT64 as input parameter
Guomin Jiang [Sat, 29 Jan 2022 08:28:02 +0000 (16:28 +0800)]
UefiPayloadPkg/PayloadLoaderPeim: Use INT64 as input parameter

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

It will have some potential issue when memory larger than 2G because
the high memory address will be fill with 0xFFFFFFFF when do the
operation of INTN + INT64 but it is 32 bit normal data in fact.

Should use same data type INT64 + INT64.

V3:
1. Use INT64 as input parameter because all date type is 64 bit
V2:
1. Force the data type to UINTN to avoid high dword be filled with
0xFFFFFFFF
2. Keep INTN because the offset may postive or negative.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
2 years agoBaseTools: Upgrade the version of NASM tool
Jason [Mon, 10 Jan 2022 14:30:29 +0000 (22:30 +0800)]
BaseTools: Upgrade the version of NASM tool

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

Upgrade the version of NASM tool to avoid compilation errors when
compiling NASM code change.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
2 years agoMdePkg: Remove the macro definitions regarding Opcode.
Jason [Mon, 10 Jan 2022 14:05:47 +0000 (22:05 +0800)]
MdePkg: Remove the macro definitions regarding Opcode.

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

Remove the macro definitions regarding Opcode because new version of
NASM tool(e.g. v2.15.05) supports the corresponding instructions.
Note: This patch need to be merged after other NASM code change to avoid
compilation errors.

Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoUefiCpuPkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 14:01:18 +0000 (22:01 +0800)]
UefiCpuPkg: Replace Opcode with the corresponding instructions.

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

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
2 years agoSourceLevelDebugPkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:52:52 +0000 (21:52 +0800)]
SourceLevelDebugPkg: Replace Opcode with the corresponding instructions.

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

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoMdePkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:46:27 +0000 (21:46 +0800)]
MdePkg: Replace Opcode with the corresponding instructions.

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

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoMdeModulePkg: Replace Opcode with the corresponding instructions.
Jason [Mon, 10 Jan 2022 13:04:09 +0000 (21:04 +0800)]
MdeModulePkg: Replace Opcode with the corresponding instructions.

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

Replace Opcode with the corresponding instructions.
The code changes have been verified with CompareBuild.py tool, which
can be used to compare the results of two different EDK II builds to
determine if they generate the same binaries.
link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild)
Signed-off-by: Jason Lou <yun.lou@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg: Correct high-memory use in NvmExpressDxe
Tomas Pilar [Thu, 24 Feb 2022 16:22:19 +0000 (16:22 +0000)]
MdeModulePkg: Correct high-memory use in NvmExpressDxe

Move the logic that stores starting PCI attributes and sets the
EFI_PCI_IO_ATTRIBUTE_DUAL_ADDRESS_CYCLE attribute to
DriverBindingStart() before the memory that backs the
DMA engine is allocated.

This ensures that the DMA-backing memory is not forcibly allocated
below 4G in system address map. Otherwise the allocation fails on
platforms that do not have any memory below the 4G mark and the drive
initialisation fails.

Leave the PCI device enabling attribute logic in NvmeControllerInit()
to ensure that the device is re-enabled on reset in case it was
disabled via PCI attributes.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Tomas Pilar <quic_tpilar@quicinc.com>
Acked-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoOvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea
Brijesh Singh [Mon, 21 Feb 2022 14:59:14 +0000 (22:59 +0800)]
OvmfPkg/BaseMemEncryptLib: use the SEV_STATUS MSR value from workarea

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

Improve the MemEncryptSev{Es,Snp}IsEnabled() to use the SEV_STATUS MSR
value saved in the workarea. Since workarea is valid until the PEI phase,
so, for the Dxe phase use the PcdConfidentialComputingGuestAttr to
determine which SEV technology is enabled.

Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/ResetVector: cache the SEV status MSR value in workarea
Brijesh Singh [Mon, 21 Feb 2022 14:59:13 +0000 (22:59 +0800)]
OvmfPkg/ResetVector: cache the SEV status MSR value in workarea

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

In order to probe the SEV feature the BaseMemEncryptLib and Reset vector
reads the SEV_STATUS MSR. Cache the value on the first read in the
workarea. In the next patches the value saved in the workarea will
be used by the BaseMemEncryptLib. This not only eliminates the extra
MSR reads it also helps cleaning up the code in BaseMemEncryptLib.

Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/AmdSev: reserve snp pages
Gerd Hoffmann [Wed, 16 Feb 2022 07:00:57 +0000 (15:00 +0800)]
OvmfPkg/AmdSev: reserve snp pages

The SNP patch series updated the OvmfPkgX64 build but forgot the AmdSev
variant, resulting in a broken OvmfSevMetadata table.

Fixes: cca9cd3dd6bf ("OvmfPkg: reserve CPUID page")
Fixes: 707c71a01b9d ("OvmfPkg: reserve SNP secrets page")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Brijesh Singh <brijesh.singh@amd.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/ArmVirtKvmTool: wire up configurable timeout
Ard Biesheuvel [Tue, 1 Feb 2022 18:00:47 +0000 (19:00 +0100)]
ArmVirtPkg/ArmVirtKvmTool: wire up configurable timeout

Use the correct PCD type for PcdPlatformBootTimeOut so it gets wired up
to the Timeout EFI variable automatically, which is how the boot manager
stores the timeout preference.

Note that this changes the default to 5 seconds, which appears to be
common across platforms.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmVirtPkg/ArmVirtMemoryInitPeiLib: avoid redundant cache invalidation
Ard Biesheuvel [Sat, 29 Jan 2022 14:58:26 +0000 (15:58 +0100)]
ArmVirtPkg/ArmVirtMemoryInitPeiLib: avoid redundant cache invalidation

Alex reports that the cache invalidation performed by
ArmVirtMemoryInitPeiLib takes a non-negligible amount of time at boot.
This cache invalidation used to be necessary to avoid inconsistencies
between the CPU's cached and uncached views of the permanent PEI memory
region, given that the PEI phase is where the MMU gets enabled.

The only allocations done from permanent PEI memory with the MMU off are
pages used for page tables, and since commit 748fea6279ef
("ArmPkg/ArmMmuLib AARCH64: invalidate page tables before populating
them"), each of those is invalidated in the caches explicitly, for
reasons described in the patch's commit log. All other allocations done
in PEI are either from temporary PEI memory, which includes the stack,
or from permanent PEI memory but after the MMU has been enabled.

This means that the cache invalidation in ArmVirtMemoryInitPeiLib is no
longer necessary, and can simply be dropped.

Reported-by: Alexander Graf <graf@amazon.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Alexander Graf <graf@amazon.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoNetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite edk2-stable202202
Heng Luo [Wed, 26 Jan 2022 05:12:21 +0000 (13:12 +0800)]
NetworkPkg: Fix incorrect unicode string of the AKM/Cipher Suite

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

The size of buffer should be 3 CHAR16 for Null-terminated Unicode
string.
The first char is the AKM/Cipher Suite number, the second char is ' ',
the third char is '\0'.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Cc: Wu Jiaxin <jiaxin.wu@intel.com>
Signed-off-by: Heng Luo <heng.luo@intel.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2 years agoShellPkg: Fix Ping GetTimerPeriod API failure
Rehan, MohammedX [Tue, 15 Feb 2022 08:07:03 +0000 (16:07 +0800)]
ShellPkg: Fix Ping GetTimerPeriod API failure

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

Ping GetTimerPeriod API returns sometime zero value when
StallCounter has smaller value than RttTimerTick (divide by zero)
which results some failure at ping UEFI shell command

Signed-off-by: MohammedX Rehan <mohammedx.rehan@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoOvmfPkg/FvbServicesSmm: use the VmgExitLibNull
Brijesh Singh [Tue, 15 Feb 2022 15:16:38 +0000 (23:16 +0800)]
OvmfPkg/FvbServicesSmm: use the VmgExitLibNull

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

The commit ade62c18f4742301bbef474ac10518bde5972fba caused a boot failure
when OVMF is build with SECURE_BOOT/SMM enabled.

This happen because the above commit extended the BaseMemEncryptSevLib.inf
to include VmgExitLib. The FvbServicesSmm uses the functions provided
by the MemEncryptSevLib to clear the memory encryption mask from the
page table. It created a dependency, as shown below

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "OvmfPkg/VmgExitLib"    instance
 ---> LocalApicLib                       class
 ---> UefiCpuPkg/BaseXApicX2ApicLib/BaseXApicX2ApicLib.inf    instance
 ---> TimerLib                           class
 ---> "OvmfPkg/AcpiTimerLib/DxeAcpiTimerLib.inf"              instance
 ---> PciLib                             class
 ---> "OvmfPkg/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf"     instance

The LocalApicLib provides a constructor, execution of the constructor
causes an exception. The SEV-ES and SEV-SNP do not support the SMM, so
skip including the VmgExitLib chain. Use the module override to use the
VmgExitLibNull to avoid the inclusion of unneeded LocalApicLib dependency
chain in FvbServicesSmm. We ran similar issue for AmdSevDxe driver,
see commit 19914edc5a0202cc7830f819ffac7e7b2368166a

After the patch, the dependency look like this:

OvmfPkg/FvbServicesSmm.inf
 ---> MemEncryptSevLib                   class
 ---> "OvmfPkg/BaseMemEncryptSevLib/DxeMemEncryptSevLib.inf"  instance
 ---> VmgExitLib
 ---> "UefiCpuPkg/Library/VmgExitLibNull"    instance

Fixes: ade62c18f4742301bbef474ac10518bde5972fba
Reported-by: Aaron Young <aaron.young@oracle.com>
Cc: Dann Frazier <dann.frazier@canonical.com>
Cc: Michael Roth <michael.roth@amd.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Tested-by: dann frazier <dann.frazier@canonical.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/VmgExitLib: Fix uninitialized variable warning with XCODE5
Rebecca Cran [Fri, 4 Feb 2022 20:13:02 +0000 (13:13 -0700)]
OvmfPkg/VmgExitLib: Fix uninitialized variable warning with XCODE5

XCODE5 reported the following warning:

OvmfPkg/Library/VmgExitLib/VmgExitVcHandler.c:1895:12: note:
uninitialized use occurs here
           Compacted
           ^^^^^^^^^

Initialize the 'Compacted' variable to fix the warning.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoMdeModulePkg: update brotli submodule
Bob Feng [Wed, 26 Jan 2022 08:29:18 +0000 (16:29 +0800)]
MdeModulePkg: update brotli submodule

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417
Update the brotli submodule to the latest commit (f4153a0)
so that the build isn't broken in GCC 11 compilers.

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: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Update brotli submodule
Bob Feng [Wed, 26 Jan 2022 08:30:14 +0000 (16:30 +0800)]
BaseTools: Update brotli submodule

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417
Update the brotli submodule to the latest commit (f4153a0)
so that the build isn't broken in GCC 11 compilers.

Signed-off-by: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Update CLANG{35,38}_WARNING_OVERRIDES to ignore unused vars
Rebecca Cran [Fri, 4 Feb 2022 19:50:41 +0000 (03:50 +0800)]
BaseTools: Update CLANG{35,38}_WARNING_OVERRIDES to ignore unused vars

Building with the CLANG35 and CLANG38 toolset fails because of variables
which are set but not otherwise used in the RELEASE build.

GCC added -Wno-unused-but-set-variable back in 2016, and later added
-Wno-unused-const-variable. Add those to CLANG35_WARNING_OVERRIDES and
CLANG38_WARNING_OVERRIDES.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoMaintainers.txt: Update email address
Xiaoyu Lu [Mon, 7 Feb 2022 11:50:15 +0000 (19:50 +0800)]
Maintainers.txt: Update email address

Update Email address for Xiaoyu Lu.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMaintainers.txt: update email for Leif Lindholm
Leif Lindholm [Mon, 31 Jan 2022 11:14:35 +0000 (11:14 +0000)]
Maintainers.txt: update email for Leif Lindholm

NUVIA inc. was acquired by Qualcomm in March 2021, but we continued
contributions under the existing IDs until the start of this year.
We are now switching to use Qualcomm Innovation Center email, so
update Maintainers.txt to reflect this.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
2 years agoMaintainers.txt: add missing github IDs to OvmfPkf/Fdt reviewers
Leif Lindholm [Mon, 31 Jan 2022 11:11:57 +0000 (11:11 +0000)]
Maintainers.txt: add missing github IDs to OvmfPkf/Fdt reviewers

This section seems to have been missed when introducing github IDs,
so add them.

Cc: Andrew Fish <afish@apple.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Leif Lindholm <leif@nuviainc.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMdeModulePkg/UiApp: Fix spelling of 'FRONTPAGE'
Matt DeVillier [Fri, 28 Jan 2022 21:36:39 +0000 (05:36 +0800)]
MdeModulePkg/UiApp: Fix spelling of 'FRONTPAGE'

Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex
Gerd Hoffmann [Fri, 21 Jan 2022 12:58:48 +0000 (20:58 +0800)]
MdeModulePkg/RuntimeDxe: clear mVirtualMapMaxIndex

When setting mVirtualMap to NULL also set mVirtualMapMaxIndex to 0.
Without that RuntimeDriverConvertPointer() will go search the ZeroPage
for EFI_MEMORY_DESCRIPTOR entries.

In case mVirtualMapMaxIndex happens to be small small enough that'll go
unnoticed, the search will not find anything and EFI_NOT_FOUND will be
returned.

In case mVirtualMapMaxIndex is big enough the search will reach the end
of the ZeroPage and trigger a page fault.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools: Fix error leg in DscBuildData.py
Jake Garver via groups.io [Thu, 20 Jan 2022 23:58:24 +0000 (07:58 +0800)]
BaseTools: Fix error leg in DscBuildData.py

Fix a Edk2Logger.warn() message format to match the arguments.

We ran into this after a failure in PcdValueInit.  The failure was
masked by a new exception, "TypeError: not all arguments converted
during string formatting".

Signed-off-by: Jake Garver <jake@nvidia.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoBaseTools/Conf: Add new macro for customizing dll file reduction.
Wei6 Xu [Thu, 20 Jan 2022 14:59:56 +0000 (22:59 +0800)]
BaseTools/Conf: Add new macro for customizing dll file reduction.

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

New macro OBJCOPY_STRIPFLAG is added in build_rule.template to replace
'--strip-unneeded -R .eh_frame', so that module can have some unique
objcopy flags for its own purpose.
In tools_def.template, set '--strip-unneeded -R .eh_frame' as default
value of OBJCOPY_STRIPFLAG.

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: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoShellPkg: Fix incorrect PPTT FlagName dereference
Chris Jones [Tue, 14 Dec 2021 12:37:36 +0000 (20:37 +0800)]
ShellPkg: Fix incorrect PPTT FlagName dereference

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

The PPTT parser in AcpiView incorrectly dereferences a pointer to
FlagName when trying to log an error with the PPTT cache flags, which
can lead to random crashes and other errors.

Also fix some spacing in the error message to ensure the message is
printed cleanly.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoMdeModulePkg/Bus/Pci/PciBusDxe: Support platform PCI ROM override
Michael D Kinney [Sat, 22 Jan 2022 00:48:47 +0000 (16:48 -0800)]
MdeModulePkg/Bus/Pci/PciBusDxe: Support platform PCI ROM override

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

Remove ASSERT() statements that are triggered if a platform provides
an override of PCI ROM attached to a PCI Controller.  The PCI Platform
Protocol allows the platform to provide a PCI ROM image for a PCI
Controller.  This works for PCI Controllers that do not have an attached
PCI ROM, but the platform is not allowed to replace the PCI ROM for a
PCI Controller that has its own PCI ROM.  Removing these ASSERT()
statements enables this additional use case.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: Add AmlCodeGenMethodRetInteger function
Rebecca Cran [Thu, 13 Jan 2022 16:40:52 +0000 (09:40 -0700)]
DynamicTablesPkg: Add AmlCodeGenMethodRetInteger function

Add AmlCodeGenMethodRetInteger function to generate AML code for
a Method returning an Integer.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Remove redundant cast in AmlCodeGenReturn
Rebecca Cran [Thu, 13 Jan 2022 16:40:51 +0000 (09:40 -0700)]
DynamicTablesPkg: Remove redundant cast in AmlCodeGenReturn

In AmlCodeGenReturn, the cast to AML_NODE_HEADER* in the call to
AmlSetFixedArgument is redundant because ReturnNode is already a
AML_NODE_HEADER* .

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Add Memory32Fixed function
Rebecca Cran [Thu, 13 Jan 2022 16:40:50 +0000 (09:40 -0700)]
DynamicTablesPkg: Add Memory32Fixed function

Add a Memory32Fixed function to generate code for the corresponding
Memory32Fixed macro in AML.

Signed-off-by: Rebecca Cran <quic_rcran@quicinc.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings
Ard Biesheuvel [Wed, 22 Sep 2021 16:12:20 +0000 (18:12 +0200)]
ArmPkg/ArmMmuLib AARCH64: avoid EL0 accessible mappings

We never run any code at EL0, and so it would seem that any access
permissions set for EL0 (via the AP[1] attribute in the page tables) are
irrelevant. We currently set EL0 and EL1 permissions to the same value
arbitrarily.

However, this causes problems on hardware like the Apple M1 running the
MacOS hypervisor framework, which enters EL1 with SCTLR_EL1.SPAN
enabled, causing the Privileged Access Never (PAN) feature to be enabled
on any exception taken to EL1, including the IRQ exceptions that handle
our timer interrupt. When PAN is enabled, EL1 has no access to any
mappings that are also accessible to EL0, causing the firmware to crash
if it attempts to access such a mapping.

Even though it is debatable whether or not SCTLR_EL1.SPAN should be
disabled at entry or whether the firmware should put all UNKNOWN bits in
all system registers in a consistent state (which it should), using EL0
permissions serves no purpose whatsoever so let's fix that regardless.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Tested-by: Alexander Graf <agraf@csgraf.de>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2 years agoArmVirtPkg/Kvmtool: Enable Acpiview
Sami Mujawar [Fri, 4 Jun 2021 16:43:37 +0000 (17:43 +0100)]
ArmVirtPkg/Kvmtool: Enable Acpiview

Acpiview is a command line tool allowing to display, dump, or check
installed ACPI tables. Add a 'ACPIVIEW_ENABLE' switch to enable it
on an ArmVirt platform.

The switch is set for the ArmVirtKvmTool platform.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Enable ACPI support
Sami Mujawar [Tue, 20 Apr 2021 12:53:10 +0000 (13:53 +0100)]
ArmVirtPkg/Kvmtool: Enable ACPI support

A Configuration Manager that uses the Dynamic Tables framework
to generate ACPI tables for Kvmtool Guests has been provided.
This Configuration Manager uses the FdtHwInfoParser module to
parse the Kvmtool Device Tree and generate the required
Configuration Manager objects for generating the ACPI tables.

Therefore, enable ACPI table generation for Kvmtool.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3742
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Add Configuration Manager
Sami Mujawar [Tue, 20 Apr 2021 12:37:47 +0000 (13:37 +0100)]
ArmVirtPkg/Kvmtool: Add Configuration Manager

Add Configuration Manager to enable ACPI tables for Kvmtool
firmware. The Configuration Manager for Kvmtool uses the DT
Hardware Information Parser module (FdtHwInfoParser) to parse
the DT provided by Kvmtool. The FdtHwInfoParser parses the DT
and invokes the callback function HW_INFO_ADD_OBJECT to add
the Configuration Manager objects to the Platform Information
repository.

The information for some Configuration Manager objects may not
be available in the DT. Such objects are initialised locally
by the Configuration Manager.

Support for the following ACPI tables is provided:
 - DBG2
 - DSDT (Empty stub)
 - FADT
 - GTDT
 - MADT
 - SPCR
 - SSDT (Cpu Hierarchy)
 - SSDT (Pcie bus)

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg/Kvmtool: Add DSDT ACPI table
Sami Mujawar [Tue, 20 Apr 2021 11:59:42 +0000 (12:59 +0100)]
ArmVirtPkg/Kvmtool: Add DSDT ACPI table

Most ACPI tables for Kvmtool firmware are dynamically
generated. The AML code is also generated at runtime
for most components in appropriate SSDTs.

Although there may not be much to describe in the DSDT,
the DSDT table is mandatory.

Therefore, add an empty stub for DSDT.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoArmVirtPkg: Add cspell exceptions
Pierre Gondois [Mon, 14 Jun 2021 15:37:01 +0000 (16:37 +0100)]
ArmVirtPkg: Add cspell exceptions

The cpsell tool checks for unknown words in the upstream CI.
Add some new words to the list of exceptions.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation
Pierre Gondois [Tue, 1 Feb 2022 15:31:53 +0000 (16:31 +0100)]
DynamicTablesPkg: AcpiSsdtPcieLibArm: Remove link device generation

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbder are described in the _PRT entry.
The interrupt type is then assumed by the OS.

The Arm BSA, sE.6 "Legacy interrupts" states that PCI legacy
interrupts must be converted to SPIs, and programmed level-sensitive,
active high. Thus any OS must configure interrupts as such and there
is no need to specify the interrupt type.
Plus it is not possible to dynamically configure PCI interrupts.

Thus remove the link device generation and use the second model
for _PRT.

Suggested-by: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
2 years agoDynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI
Pierre Gondois [Tue, 1 Feb 2022 15:30:13 +0000 (16:30 +0100)]
DynamicTablesPkg: AmlLib: AmlAddPrtEntry() to handle GSI

In ACPI 6.4, s6.2.13, _PRT objects describing PCI legacy interrupts
can be defined following 2 models.
In the first model, _PRT entries reference link devices. Link devices
then describe interrupts. This allows to dynamically modify
interrupts through _SRS and _PRS objects and to choose exactly the
interrupt type (level/edge triggered, active high/low).
In the second model, interrupt numbers are described in the _PRT entry.
The interrupt type is then assumed by the OS.

AmlAddPrtEntry() currently only handles the first model. Make
changes to also handle the second model.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>