]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
21 months agoOvmfPkg: Add BUILD_SHELL flag for IA32, IA32X64, X64
Oliver Steffen [Tue, 30 Aug 2022 16:13:54 +0000 (18:13 +0200)]
OvmfPkg: Add BUILD_SHELL flag for IA32, IA32X64, X64

Add BUILD_SHELL flag, similar to the one in OvmfPkg/AmdSev,
to enable/disable building of the UefiShell as part of
the firmware image. The UefiShell should not be included for
secure production systems (e.g. SecureBoot) because it can be
used to circumvent security features.

The default value for BUILD_SHELL is TRUE to keep the default
behavior of the Ovmf build.
Note: the default for AmdSev is FALSE.

The BUILD_SHELL flag for AmdSev was introduced in b261a30c900a8.

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
21 months agoUefiPayloadPkg: To replace the libraries for the capsule driver.
KasimX Liu [Thu, 25 Aug 2022 02:32:46 +0000 (10:32 +0800)]
UefiPayloadPkg: To replace the libraries for the capsule driver.

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

For the system support the Capsule function in UPL,
we replace the libraries for the Capsule driver.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
21 months agoIntelFsp2WrapperPkg: Rename PlatformMultiPhaseLibSample.
Chasel Chiu [Thu, 1 Sep 2022 05:45:37 +0000 (22:45 -0700)]
IntelFsp2WrapperPkg: Rename PlatformMultiPhaseLibSample.

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

Basing on offline feedbacks to rename
FspWrapperPlatformMultiPhaseLibSample to
FspWrapperPlatformMultiPhaseLibNull.

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>
21 months agoIntelFsp2WrapperPkg: Remove duplicated words
Pierre Gondois [Tue, 23 Aug 2022 16:00:18 +0000 (09:00 -0700)]
IntelFsp2WrapperPkg: Remove duplicated words

In an effort to clean the documentation of the above
package, remove duplicated words.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
21 months agoDynamicTablesPkg: Fix typo in AmlCodeGenRdMemory32Fixed doxygen comment
Rebecca Cran [Wed, 31 Aug 2022 16:20:29 +0000 (10:20 -0600)]
DynamicTablesPkg: Fix typo in AmlCodeGenRdMemory32Fixed doxygen comment

Fix typo of "Address".

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: Fix nested processor containers
Jeff Brasen [Thu, 18 Aug 2022 16:47:55 +0000 (10:47 -0600)]
DynamicTablesPkg: Fix nested processor containers

Current code will generate duplicate UID if there are nested processor
containers in the topology. For example if there is a
socket/cluster/core layout.

Change references to processor container from cluster to be more
accurate on what is being created.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: AcpiSsdtPcieLibArm : Add UID to slot creation
Jeff Brasen [Wed, 24 Aug 2022 04:35:53 +0000 (22:35 -0600)]
DynamicTablesPkg: AcpiSsdtPcieLibArm : Add UID to slot creation

Expose the UID value to GeneratePciSlots().
This is needed for some cases for example:
https://docs.microsoft.com/en-us/windows-hardware/drivers/pci/dsd-for-pcie-root-ports#identifying-externally-exposed-pcie-root-ports

Name (_DSD, Package () {
  ToUUID("EFCC06CC-73AC-4BC3-BFF0-76143807C389"),
  Package () {
    Package (2) {"ExternalFacingPort", 1},
    Package (2) {"UID", 0},
  }
})

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: Add support to build _DSD
Jeff Brasen [Wed, 17 Aug 2022 16:39:39 +0000 (10:39 -0600)]
DynamicTablesPkg: Add support to build _DSD

Add APIs needed to build _DSD with different UUIDs.
This is per ACPI specification 6.4 s6.2.5.

Adds support for building data packages with format
Package {"Name", Integer}

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM space
Kun Qin [Wed, 20 Jul 2022 17:39:27 +0000 (10:39 -0700)]
DynamicTablesPkg: AcpiSsdtPcieLibArm: Added function to reserve ECAM space

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

Certain OSes will complain if the ECAM config space is not reserved in
the ACPI namespace.

This change adds a function to reserve PNP motherboard resources for a
given PCI node.

Co-authored-by: Joe Lopez <joelopez@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: DynamicTableManagerDxe: Added check for installed tables
Kun Qin [Tue, 5 Jul 2022 19:31:07 +0000 (12:31 -0700)]
DynamicTablesPkg: DynamicTableManagerDxe: Added check for installed tables

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

This change added an extra step to allow check for installed ACPI tables.

For FADT, MADT, GTDT, DSDT, DBG2 and SPCR tables, either pre-installed or
supplied through AcpiTableInfo can be accepted.

An extra check for FADT ACPI table existence during installation step is
also added.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Co-authored-by: Joe Lopez <joelopez@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@Arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: DynamicPlatRepoLib: Adding more token fixers
Kun Qin [Fri, 1 Jul 2022 01:00:17 +0000 (18:00 -0700)]
DynamicTablesPkg: DynamicPlatRepoLib: Adding more token fixers

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

This change added more token fixers for other node types, including
NamedComponentNode, RootComplexNode, and SmmuV3Node.

The corresponding entries for tokenFixer functions table is also updated.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Co-authored-by: Joe Lopez <joelopez@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: DynamicPlatRepoLib: Fix incorrect dereferencing
Kun Qin [Fri, 1 Jul 2022 00:38:50 +0000 (17:38 -0700)]
DynamicTablesPkg: DynamicPlatRepoLib: Fix incorrect dereferencing

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

The content of token should be derived from the data section of the
`CmObject` instead of the object itself.

This change fixed the issue by dereferencing the token value from the
data buffer of input CmObject.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Co-authored-by: Joe Lopez <joelopez@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoDynamicTablesPkg: DynamicPlatRepoLib: Added MemoryAllocationLib to inf
Kun Qin [Fri, 1 Jul 2022 00:32:36 +0000 (17:32 -0700)]
DynamicTablesPkg: DynamicPlatRepoLib: Added MemoryAllocationLib to inf

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

The DynamicPlatRepoLib has multiple reference to MemoryAllocationLib,
such as DynamicPlatRepo.c and TokenMapper.c. Not including it in the
library inf file could lead to potential build break.

This change added the MemoryAllocationLib into this inf file.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Co-authored-by: Joe Lopez <joelopez@microsoft.com>
Signed-off-by: Kun Qin <kuqin12@gmail.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
21 months agoMdeModulePkg/NvmExpressPei: Use PCI_DEVICE_PPI to manage Nvme device
Chen, Xiao X [Tue, 30 Aug 2022 05:46:48 +0000 (13:46 +0800)]
MdeModulePkg/NvmExpressPei: Use PCI_DEVICE_PPI to manage Nvme device

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

This change modifies NvmExpressPei library
to allow usage both EDKII_PCI_DEVICE_PPI and
EDKII_NVM_EXPRESS_HOST_CONTROLLER_PPI to manage Nvme device.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Xiao X Chen <xiao.x.chen@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
21 months agoIntelFsp2WrapperPkg: Add FSP 2.4 MultiPhase interface.
Chasel Chiu [Wed, 10 Aug 2022 00:31:52 +0000 (17:31 -0700)]
IntelFsp2WrapperPkg: Add FSP 2.4 MultiPhase interface.

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

Provide FSP 2.4 MultiPhase wrapper support library.

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>
21 months agoIntelFsp2Pkg: Add FSP 2.4 MultiPhase interface.
Chasel Chiu [Mon, 25 Jul 2022 19:03:51 +0000 (12:03 -0700)]
IntelFsp2Pkg: Add FSP 2.4 MultiPhase interface.

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

Provide FSP 2.4 MultiPhase interface and scripts
support.

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>
21 months agoUefiCpuPkg: Enhance logic in InitializeMpExceptionStackSwitchHandlers
Liu, Zhiguang [Fri, 26 Aug 2022 07:39:01 +0000 (15:39 +0800)]
UefiCpuPkg: Enhance logic in InitializeMpExceptionStackSwitchHandlers

Parallelly run the function to SeparateExceptionStacks for all CPUs and
allocate buffers together for better performance.

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: Zhiguang Liu <zhiguang.liu@intel.com>
21 months agoUefiCpuPkg: Use Top of each AP's stack to save CpuMpData
Yuanhao Xie [Fri, 19 Aug 2022 06:17:28 +0000 (14:17 +0800)]
UefiCpuPkg: Use Top of each AP's stack to save CpuMpData

To remove the dependency of CPU register, 4/8 byte at the top of the
stack is occupied for CpuMpData. BIST information is also taken care
here. This modification is only for PEI phase, since in DXE phase
CpuMpData is accessed via global variable.

Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
21 months agoUefiCpuPkg: Simplify the implementation when separate exception stacks
Liu, Zhiguang [Fri, 26 Aug 2022 07:04:47 +0000 (15:04 +0800)]
UefiCpuPkg: Simplify the implementation when separate exception stacks

The API of InitializeSeparateExceptionStacks is just changed before, and
makes the struct CPU_EXCEPTION_INIT_DATA an internal definition.
Furthermore, we can even remove the struct to make core simpler.

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: Zhiguang Liu <zhiguang.liu@intel.com>
21 months agoUefiCpuPkg/MpInitLib: Simplify logic in SwitchBsp
Liu, Zhiguang [Fri, 26 Aug 2022 07:04:46 +0000 (15:04 +0800)]
UefiCpuPkg/MpInitLib: Simplify logic in SwitchBsp

When switch bsp, old bsp and new bsp put CR0/CR4 into stack, and put IDT
and GDT register into a structure. After they exchange their stack, they
restore these registers. This logic is now implemented by assembly code.
This patch aims to reuse (Save/Restore)VolatileRegisters function to
replace such assembly code for better code readability.

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: Zhiguang Liu <zhiguang.liu@intel.com>
21 months agoUefiCpuPkg: Add PCD to control SMRR enable & SmmFeatureControl support
Wu, Jiaxin [Fri, 29 Jul 2022 06:25:55 +0000 (14:25 +0800)]
UefiCpuPkg: Add PCD to control SMRR enable & SmmFeatureControl support

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

Two SMM variables (mSmrrSupported & mSmmFeatureControlSupported) are global
variables, they control whether the SMRR and SMM Feature Control MSR will
be restored respectively.
To avoid the TOCTOU, add PCD to control SMRR & SmmFeatureControl enable.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
21 months agoUefiCpuPkg/MpInitLib: Fix potential issue when IDT table is at above 4G
Liu, Zhiguang [Thu, 25 Aug 2022 02:55:04 +0000 (10:55 +0800)]
UefiCpuPkg/MpInitLib: Fix potential issue when IDT table is at above 4G

Currently, when waking up AP, IDT table of AP will be set in 16 bit code,
and assume the IDT table base is 32 bit. However, the IDT table is created
by BSP. Issue will happen if the BSP allocates memory above 4G for BSP's
IDT table. Moreover, even the IDT table location is below 4G, the handler
function inside the IDT table is 64 bit, and it won't take effect until
CPU transfers to 64 bit long mode. There is no benefit to set IDT table in
such an early phase.
To avoid such issue, this patch moves the LIDT instruction into 64 bit
code.

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: Zhiguang Liu <zhiguang.liu@intel.com>
21 months agoShellPkg: Adds Local APIC parser to AcpiView
Abdul Lateef Attar [Tue, 9 Aug 2022 06:49:10 +0000 (14:49 +0800)]
ShellPkg: Adds Local APIC parser to AcpiView

Parse Type 0 or Local APIC structure.
Also parse the Local APIC Flags as bitfields.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
21 months agoUefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test
Zhiguang Liu [Mon, 27 Jun 2022 08:58:48 +0000 (16:58 +0800)]
UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test

Add host based unit tests for the CpuPageTableLib services.

Unit test focuses on PageTableMap function, containing two kinds of test
cases: manual test case and random test case.
Manual test case creates some corner case to test function PageTableMap.
Random test case generates multiple random memory entries (with random
attribute) as the input of function PageTableMap to get the output
pagetable. Output pagetable will be validated and be parsed to get output
memory entries, and then the input and output memory entries will be
compared to verify the functionality.

The unit test is not perfect yet. There are options for random test, and
some of them control the test coverage, and some option are not ready.
Will enhance in the future.

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: Zhiguang Liu <zhiguang.liu@intel.com>
21 months ago.azurepipelines: Use Python 3.10.6+
Michael Kubacki [Thu, 25 Aug 2022 15:03:29 +0000 (11:03 -0400)]
.azurepipelines: Use Python 3.10.6+

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

Changes the Python version used in pipelines to 3.10.6 or greater
since that version introduces a fix (bp0-47231) for inconsistent
trailing slashes in tarfile longname directories.

This is required for stuart_update to succeed when handling a
web_dependency (e.g. GCC ARM compilers).

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: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
21 months agoMaintainers.txt: Update Maintainers/reviewers for universal payload
Guo Dong [Mon, 22 Aug 2022 23:58:00 +0000 (16:58 -0700)]
Maintainers.txt: Update Maintainers/reviewers for universal payload

Add James Lu as UefiPayloadPkg maintainer.
Add Gua Guo as universal payload reviewer.

Signed-off-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
21 months agoBaseTools: Fix DevicePath GNUmakefile for macOS edk2-stable202208
Rebecca Cran [Fri, 26 Aug 2022 01:31:46 +0000 (09:31 +0800)]
BaseTools: Fix DevicePath GNUmakefile for macOS

On macOS, /usr/bin/gcc is clang, and so doesn't have
the -Wno-error=stringop-overflow flag that was added
for gcc 12.
Update the GNUmakefile for DevicePath to skip setting
that on macOS.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
21 months agoRevert "BaseTools: Fix DSC LibraryClass precedence rule"
Liming Gao [Fri, 26 Aug 2022 02:06:20 +0000 (10:06 +0800)]
Revert "BaseTools: Fix DSC LibraryClass precedence rule"

This reverts commit 039bdb4d3e96f9c9264abf135b8a0eef2e2b4860 for tag202208.
This brings the behavior changes, and needs more discussion.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Bob Feng <bob.c.feng@intel.com>
21 months agoRevert "ShellPkg: Adds Local APIC parser to AcpiView"
Liming Gao [Fri, 26 Aug 2022 02:06:01 +0000 (10:06 +0800)]
Revert "ShellPkg: Adds Local APIC parser to AcpiView"

This reverts commit d5fd86f256b9ab5b4e3aff70d3c177c18faea892 for tag202208.
This feature will be merged after stable tag 202208 is created.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
21 months agoRevert "UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test"
Liming Gao [Fri, 26 Aug 2022 02:05:50 +0000 (10:05 +0800)]
Revert "UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test"

This reverts commit 2812668bfc121ee792cf3302195176ef4a2ad0bc for tag202208.
This feature will be merged after stable tag 202208 is created.

Signed-off-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
21 months agoMaintainers.txt: Update maintainers list
Abner Chang [Thu, 25 Aug 2022 10:33:36 +0000 (18:33 +0800)]
Maintainers.txt: Update maintainers list

Update package maintainers for below package/arch,

1. RISCV64 Architecture:
   Abner is stepping out from RISC-V stuff for now and hand over edk2 RISC-V
   responsibilities to Sunil.
   Daniel Schaefer is no longer with HPE. Update his email address for
   RISCV64 arch. He will keep helping on RISC-V stuff with his personal
   email.

2. EmbeddedPkg:
   Daniel Schaefer is no longer with HPE. Update his email address for
   EmbeddedPkg.

3. EmulatorPkg and RedfishPkg:
   Nickle Wang is no longer with HPE. Update his email address for
   EmulatorPkg and RedfishPkg packages. He will use the personal email for
   the time being until he gets ready with his next journey.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Cc: Nickle Wang <nickle@csie.io>
Reviewed-by: Daniel Schaefer <git@danielschaefer.me>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Nickle Wang <nickle@csie.io>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
21 months agoShellPkg: Add revision check for DSDT Header on Arm
Edward Pickup [Wed, 20 Jul 2022 08:59:49 +0000 (16:59 +0800)]
ShellPkg: Add revision check for DSDT Header on Arm

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

ACPI 6.4 spec states that if the revision field in the DSDT header is less
than 2, then all integers are restricted in width to 32 bits, including in
SSDTs.

Arm Base boot requirements state that platforms must conform to ACPI 6.3
or later, and that legacy tables are not supported.

Adds a check for this field and raise warning if revision is less
than 2 on arm.

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
21 months agoUefiPayloadPkg: Fix Coverity report defect
James Lu [Tue, 23 Aug 2022 03:13:55 +0000 (11:13 +0800)]
UefiPayloadPkg: Fix Coverity report defect

https://bugzilla.tianocore.org/show_bug.cgi?id=4018
Coverity report FORWARD_NULL and OVERFLOW_BEFORE_WIDEN potential defect
in UefiPayloadPkg.

Signed-off-by: Gregx Yeh <gregx.yeh@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
21 months agoRedfishPkg: Redfish functions for REST requests are not fully spec complied
Abner Chang [Tue, 23 Aug 2022 02:09:37 +0000 (10:09 +0800)]
RedfishPkg: Redfish functions for REST requests are not fully spec complied

There is no function to send POST request with the
ContentType different from "application\json".
There is no function to send DELETE request with the body.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
21 months agoRedfishPkg: Redfish modules may need to use the functions which are private
Abner Chang [Wed, 17 Aug 2022 03:28:25 +0000 (11:28 +0800)]
RedfishPkg: Redfish modules may need to use the functions which are private

Definitions of the required functions to send requests to BMC
are in the PrivateInclude folder. So they cannot be used by
the other Redfish packages.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
21 months agoRedfishPkg/RedfishDiscoverDxe: USB Redfish host interface is not supported
Abner Chang [Mon, 15 Aug 2022 01:47:30 +0000 (09:47 +0800)]
RedfishPkg/RedfishDiscoverDxe: USB Redfish host interface is not supported

Host Interface details are described by the SMBIOS Type 42
table. The table is published by the RedfishHostInterfaceDxe
driver. That driver supports PCI-E and USB host interface
types.The table is consumed by the edfishGetHostInterfaceProtocolData
function in the RedfishDiscoverDxe driver. The function only supports
PCI-E host interface type.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
21 months agoUefiPayloadPkg: Add macro to control NvmExpressDxe
Kavya [Mon, 22 Aug 2022 13:50:15 +0000 (19:20 +0530)]
UefiPayloadPkg: Add macro to control NvmExpressDxe

Add NVME_ENABLE macro to control NvmExpressDxe driver.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: Kavya <k.kavyax.sravanthi@intel.com>
21 months agoUefiPayloadPkg: Return PciRootBridges instead of NULL
Kavya [Mon, 22 Aug 2022 13:19:30 +0000 (18:49 +0530)]
UefiPayloadPkg: Return PciRootBridges instead of NULL

Return PciRootBridges instead of NULL and set
PcdPciDisableBusEnumeration to FALSE when
root bridge count is zero.

Reviewed-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: Kavya <k.kavyax.sravanthi@intel.com>
21 months agoShellPkg: Adds Local APIC parser to AcpiView
Abdul Lateef Attar [Tue, 9 Aug 2022 06:49:10 +0000 (14:49 +0800)]
ShellPkg: Adds Local APIC parser to AcpiView

Parse Type 0 or Local APIC structure.
Also parse the Local APIC Flags as bitfields.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Signed-off-by: Abdul Lateef Attar <abdattar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
21 months agoBaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header
Michael D Kinney [Tue, 16 Aug 2022 01:15:24 +0000 (18:15 -0700)]
BaseTools/Source/C/GenSec: Fix EFI_SECTION_FREEFORM_SUBTYPE_GUID header

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

When the size of a EFI_SECTION_FREEFORM_SUBTYPE_GUID section required
the use of EFI_FREEFORM_SUBTYPE_GUID_SECTION2 header, set the section
type to EFI_SECTION_FREEFORM_SUBTYPE_GUID.

Cc: Leif Lindholm <llindhol@qti.qualcomm.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Konstantin Aladyshev <aladyshev22@gmail.com>
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: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Leif Lindholm <llindhol@qti.qualcomm.com>
21 months agoMdePkg: Added support for SMBIOS spec v3.6.0 to Smbios.h
Sainadh Nagolu [Wed, 17 Aug 2022 07:38:28 +0000 (13:08 +0530)]
MdePkg: Added support for SMBIOS spec v3.6.0 to Smbios.h

Updated SmBios.h with new fields added as part of SMBIOS 3.6.0 spec update.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Reviewed-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
21 months agoShellPkg: Improved Smbios Type 9 table changes in PrintInfo.c
Sainadh Nagolu [Wed, 17 Aug 2022 07:35:23 +0000 (15:35 +0800)]
ShellPkg: Improved Smbios Type 9 table changes in PrintInfo.c

Since PeerGroups has a variable number of entries, new fields added
after PeerGroups are defined in a extended structure.
Done changes in PrintInfo.c to access those fields using
SMBIOS_TABLE_TYPE9_EXTENDED structure from SmBios.h.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
21 months agoMdePkg: Improved Smbios Type9 table and Smbios spec v3.5.0 Changes
Sainadh Nagolu [Wed, 17 Aug 2022 07:35:23 +0000 (15:35 +0800)]
MdePkg: Improved Smbios Type9 table and Smbios spec v3.5.0 Changes

In Type9 structure since PeerGroups has a variable
number of entries, must not define new fields in the structure.So added an
extended structure and defined new fields added after PeerGroups. Also done
some improvements to Smbios 3.5.0 spec changes.

Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
22 months agoMdeModulePkg/DumpDynPcd: Remove unsupported format specifiers
Konstantin Aladyshev [Wed, 27 Jul 2022 08:45:03 +0000 (16:45 +0800)]
MdeModulePkg/DumpDynPcd: Remove unsupported format specifiers

Some print statements use format specifiers like %N/%H/%E/%B that are
only supported in the shell print functions. In the ordinary 'Print'
function they are just displayed as letters N/H/E/B.
Remove these unsupported format specifiers from the 'Print' statements
to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
22 months agoOvmfPkg/VirtioFsDxe: Check GetDriverName arguments
Dimitrije Pavlov [Mon, 15 Aug 2022 16:31:19 +0000 (11:31 -0500)]
OvmfPkg/VirtioFsDxe: Check GetDriverName arguments

The current implementation does not check if Language or DriverName
are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
22 months agoOvmfPkg/VirtioGpuDxe: Check QueryMode arguments
Dimitrije Pavlov [Tue, 16 Aug 2022 20:28:36 +0000 (15:28 -0500)]
OvmfPkg/VirtioGpuDxe: Check QueryMode arguments

The current implementation does not check if Info or SizeInfo
pointers are NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these
pointers are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
22 months agoOvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments
Dimitrije Pavlov [Tue, 16 Aug 2022 20:28:35 +0000 (15:28 -0500)]
OvmfPkg/PlatformDxe: Check ExtractConfig and RouteConfig arguments

The current implementation does not check if Progress or Results
pointers in ExtractConfig are NULL, or if Progress pointer in
RouteConfig is NULL. This causes the SCT test suite to crash.

Add a check to return EFI_INVALID_PARAMETER if any of these pointers
are NULL.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
22 months agoUefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test
Zhiguang Liu [Mon, 27 Jun 2022 08:58:48 +0000 (16:58 +0800)]
UefiCpuPkg/CpuPageTableLib/UnitTest: Add host based unit test

Add host based unit tests for the CpuPageTableLib services.

Unit test focuses on PageTableMap function, containing two kinds of test
cases: manual test case and random test case.
Manual test case creates some corner case to test function PageTableMap.
Random test case generates multiple random memory entries (with random
attribute) as the input of function PageTableMap to get the output
pagetable. Output pagetable will be validated and be parsed to get output
memory entries, and then the input and output memory entries will be
compared to verify the functionality.

The unit test is not perfect yet. There are options for random test, and
some of them control the test coverage, and some option are not ready.
Will enhance in the future.

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: Zhiguang Liu <zhiguang.liu@intel.com>
22 months agoMdeModulePkg: Update the SMBIOS version by UPL
KasimX Liu [Fri, 5 Aug 2022 08:17:21 +0000 (16:17 +0800)]
MdeModulePkg: Update the SMBIOS version by UPL

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

For the SMBIOS version can be update by UPL,we create
the gUniversalPayloadSmbios3TableGuid HOB to store
the value then updated version.

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
22 months agoIntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.
Chasel Chiu [Mon, 15 Aug 2022 06:13:01 +0000 (23:13 -0700)]
IntelFsp2Pkg: FSPM_ARCH2_UPD mismatching bug.

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

FSPM_ARCH2_UPD in FspApiEntryM.nasm was not up-to-date and
should be fixed for both IA32 and X64 builds.

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: Star Zeng <star.zeng@intel.com>
22 months agoUefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable
Dun Tan [Wed, 10 Aug 2022 03:31:57 +0000 (11:31 +0800)]
UefiPayloadPkg: Remove clearing CR0.WP when protecting pagetable

Remove clearing CR0.WP when marking the memory used for page table
as read-only in the page table itself created by UefiPayloadEntry.
This page table address is written to Cr3 after these protection
steps. Till this, the memory used for page table is always RW.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: Ray Ni <ray.ni@intel.com>
22 months agoMdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable
Dun Tan [Tue, 26 Jul 2022 14:13:40 +0000 (22:13 +0800)]
MdeModulePkg/DxeIpl: Remove clearing CR0.WP when protecting pagetable

Remove clearing CR0.WP when marking the memory used for page table
as read-only in the page table itself created by DxeIpl. This page
table address is written to Cr3 after these protection steps. Till
this, the memory used for page table is always RW.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
22 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm
Dun Tan [Tue, 9 Aug 2022 07:58:28 +0000 (15:58 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Remove mInternalCr3 in PiSmmCpuDxeSmm

This patch is code refactoring and doesn't change any functionality.
Remove mInternalCr3 in PiSmmCpuDxe pagetable related code. In previous
code, mInternalCr3 is used to pass address of page table which is
different from Cr3 register in different level of SetMemoryAttributes
function. Now remove it and pass the page table base address from the
root function parameter to simplify the code logic.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
22 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Add a new mIsShadowStack flag
Dun Tan [Tue, 9 Aug 2022 07:22:07 +0000 (15:22 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Add a new mIsShadowStack flag

This patch is code refactoring and doesn't change any functionality.
Add a new mIsShadowStack flag to identify whether current memory is
shadow stack. Previous smm code logic regards a RO range as shadow
stack and set the dirty bit in corresponding page table entry if
mInternalCr3 is not 0, which may be confusing.

Signed-off-by: Dun Tan <dun.tan@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
22 months agoShellPkg/SmbiosView: Display extended memory info in smbiosview -t 17
Shengfengx Xue [Sat, 6 Aug 2022 02:02:13 +0000 (10:02 +0800)]
ShellPkg/SmbiosView: Display extended memory info in smbiosview -t 17

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

If Configured Memory Speed is 65,535 MT/s or greater,
and the actual speed is stored in the Extended Configured Memory Speed
field. but current Smbiosview have no this logic.

Signed-off-by: Shengfengx Xue <shengfengx.xue@intel.com>
22 months agoMdeModulePkg: Enhance bus scan for all root bridge instances
Foster Nong [Fri, 22 Jul 2022 09:10:26 +0000 (17:10 +0800)]
MdeModulePkg: Enhance bus scan for all root bridge instances

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

Change flow to bus scan all root bridge instances even when any
one root bridge meet bus resource OUT_OF_RESOURCE case.
thus platform handler  of "EfiPciHostBridgeEndBusAllocation" has
an chance to do relative pci bus rebalance to handle this case.

Signed-off-by: Foster Nong <foster.nong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
22 months agoMdePkg/Library/UefiDevicePathLib: Add back StandaloneMm INF file
Michael D Kinney [Wed, 10 Aug 2022 04:22:54 +0000 (21:22 -0700)]
MdePkg/Library/UefiDevicePathLib: Add back StandaloneMm INF file

REF: https://github.com/tianocore/edk2/pull/3130

The above PR removed UefiDevicePathLibStandaloneMm.inf, which is
a non-backwards compatible change and does not provide time for
downstream platforms to use the UefiDevicePathLibBase.inf.

Add UefiDevicePathLibStandaloneMm.inf back, but add comments that
it is deprecated and that UefiDevicePathLibBase.inf should be used
instead.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Mateusz Albecki <mateusz.albecki@intel.com>
Cc: Yanbo Huang <yanbo.huang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
22 months agoCpuPageTableLib: define IA32_PAGE_LEVEL enum type internally
Ray Ni [Mon, 18 Jul 2022 09:00:29 +0000 (17:00 +0800)]
CpuPageTableLib: define IA32_PAGE_LEVEL enum type internally

The change doesn't change functionality behavior.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Fix bug that wrongly requires extra size for mapping
Ray Ni [Mon, 18 Jul 2022 08:41:37 +0000 (16:41 +0800)]
CpuPageTableLib: Fix bug that wrongly requires extra size for mapping

With following paging structure to map
  [2M-4K, 2M] as P = 1, RW = 0,
  [2M, 4M]    as P = 1, RW = 1:

PML4[0] -> PDPTE[0] -> PDE[0](RW = 0) -> PTE[255](P = 0, RW = 0)
                    -> PDE[1](RW = 1)

When a new request to map [2M-4K, 2M+4K] as P = 1, RW = 1,
CpuPageTableMap() wrongly requests 4K buffer size for the new mapping
request.

But in fact, for [2M-4K, 2M] request, PTE[255] can be changed in place,
for [2M, 2M+4K], no change is needed because PDE[1].RW = 1 already.

The change fixes the bug.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Fix a bug to avoid unnecessary changing to page table
Ray Ni [Fri, 15 Jul 2022 12:40:29 +0000 (20:40 +0800)]
CpuPageTableLib: Fix a bug to avoid unnecessary changing to page table

With the following paging structure that maps [0, 2G] with ReadWrite
bit set.
PML4[0] --> PDPTE[0] --> PDE[0-255]
              \-> PDPTE[1] --> PDE[0-255]

If ReadWrite bit is cleared in PML4[0] and PageTableMap() is called
to change [0, 2M] as read-only, today's logic unnecessarily changes
the paging structure in 2 aspects:
1. When setting PageTableBaseAddress in the entry, the code clears
    all attributes.
2. Even the ReadWrite bit in parent entry is not set, the code clears
    the ReadWrite bit in the leaf entry.

First change is wrong. It should not change other attributes when
setting the PA.
Second change is unnecessary. Because the parent entry already
declares the whole region as read-only, there is no need to clear
ReadWrite bit in the leaf entry again.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Fix parent attributes are not inherited properly
Ray Ni [Fri, 15 Jul 2022 12:10:08 +0000 (20:10 +0800)]
CpuPageTableLib: Fix parent attributes are not inherited properly

With the following paging structure that maps [0, 2G] with ReadWrite
bit set.
PML4[0] --> PDPTE[0] --> PDE[0-255]
              \-> PDPTE[1] --> PDE[0-255]

If ReadWrite bit is cleared in PML4[0] and PageTableMap() is called
to change [0, 2M] as writable, today's logic doesn't inherit the
parent entry's attributes when determining the child entry's
attributes. It just sets the PDPTE[0].PDE[0].ReadWrite bit.
But since the PML4[0].ReadWrite is 0, [0, 2M] is still read-only.

The change fixes the bug.
If the inheritable attributes in ParentPagingEntry conflicts with the
requested attributes, let the child entries take the parent attributes
and loosen the attribute in the parent entry.

E.g.: when PDPTE[0].ReadWrite = 0 but caller wants to map [0-2MB as
ReadWrite = 1 (PDE[0].ReadWrite = 1), we need to change
PDPTE[0].ReadWrite = 1 and let all PDE[0-255].ReadWrite = 0 first.
Then change PDE[0].ReadWrite = 1.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Avoid treating non-leaf entry as leaf one
Ray Ni [Fri, 15 Jul 2022 07:22:57 +0000 (15:22 +0800)]
CpuPageTableLib: Avoid treating non-leaf entry as leaf one

Today's logic wrongly treats the non-leaf entry as leaf entry and
updates its paging attributes.

The patch fixes the bug to only update paging attributes for
non-present entries or leaf entries.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Split the page entry when LA is aligned but PA is not
Ray Ni [Thu, 14 Jul 2022 12:08:29 +0000 (20:08 +0800)]
CpuPageTableLib: Split the page entry when LA is aligned but PA is not

When PageTableMap() is called to create non 1:1 mapping
such as [0, 1G) to [8K, 1G+8K), it should split the page entry to the
4K page level, but old logic has a bug that it just uses 1G page
entry.

The patch fixes the bug.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Refactor the logic
Ray Ni [Thu, 14 Jul 2022 10:00:47 +0000 (18:00 +0800)]
CpuPageTableLib: Refactor the logic

The patch replaces
  LinearAddress + Offset == RegionStart
with
  ((LinearAddress + Offset) & RegionMask) == 0

The replace should not cause any behavior change.

Because:
1. In first loop of while when LinearAddress + Offset == RegionStart,
  because the lower "BitStart" bits of RegionStart are all-zero,
  all lower "BitStart" bits of (LinearAddress + Offset) are all-zero.
  Because all lower "BitStart" bits of RegionMask is all-one and
  bits are all-zero, ((LinearAddress + Offset) & RegionMask) == 0.

2. In following loops of the while, even RegionStart is increased
  by RegionLength, the lower "BitStart" bits are still all-zero.
  So the two expressions still semantically equal to each other.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoCpuPageTableLib: Fix a bug when a bit is 1 in Attribute, 0 in Mask
Ray Ni [Thu, 14 Jul 2022 08:03:11 +0000 (16:03 +0800)]
CpuPageTableLib: Fix a bug when a bit is 1 in Attribute, 0 in Mask

To reproduce the issue:
  UINTN               PageTable;
  VOID                *Buffer;
  UINTN               PageTableBufferSize;
  IA32_MAP_ATTRIBUTE  Attribute;
  IA32_MAP_ATTRIBUTE  Mask;
  RETURN_STATUS       Status;

  Attribute.Uint64       = 0;
  Mask.Uint64            = 0;
  PageTableBufferSize    = 0;
  PageTable              = 0;
  Buffer                 = NULL;
  Attribute.Bits.Present = 1;
  Attribute.Bits.Nx      = 1;
  Mask.Bits.Present      = 1;
  Mask.Uint64            = MAX_UINT64;

  //
  // Create page table to cover [0, 10M)
  //
  Status = PageTableMap (
             &PageTable, PagingMode, Buffer, &PageTableBufferSize,
             0, (UINT64)SIZE_2MB * 5, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_BUFFER_TOO_SMALL);
  Buffer = AllocatePages (EFI_SIZE_TO_PAGES (PageTableBufferSize));
  Status = PageTableMap (
             &PageTable, PagingMode, Buffer, &PageTableBufferSize,
             0, (UINT64)SIZE_2MB * 5, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_SUCCESS);

  //
  // Change the mapping for [0, 4KB)
  // No change actually. Just clear Nx bit in Mask.
  //
  Mask.Bits.Nx        = 0;
  PageTableBufferSize = 0;

  Status = PageTableMap (
             &PageTable, PagingMode, NULL, &PageTableBufferSize,
             0, (UINT64)SIZE_4KB, &Attribute, &Mask
             );
  ASSERT (Status == RETURN_SUCCESS); // FAIL!!

The root cause is when comparing the existing mapping attributes
against the requested one, Mask is not used but it should be used.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoUefiCpuPkg/CpuPageTableLib: Return error on invalid parameters
Ray Ni [Thu, 14 Jul 2022 07:36:09 +0000 (15:36 +0800)]
UefiCpuPkg/CpuPageTableLib: Return error on invalid parameters

When LinearAddress or Length is not aligned on 4KB, PageTableMap()
should return Invalid Parameter.

Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoUefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs
Ray Ni [Thu, 14 Jul 2022 06:33:18 +0000 (14:33 +0800)]
UefiCpuPkg: Create CpuPageTableLib for manipulating X86 paging structs

The lib includes two APIs:
* PageTableMap
  It creates/updates mapping from LA to PA.
  The implementation only supports paging structures used in 64bit
  mode now. PAE paging structure support will be added in future.

* PageTableParse
   It parses the page table and returns the mapping relations in an
  array of IA32_MAP_ENTRY.

It passed some stress tests. These test code will be upstreamed in
other patches following edk2 Unit Test framework.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
22 months agoUefiCpuPkg: Simplify the struct definition of CPU_EXCEPTION_INIT_DATA
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:37 +0000 (09:25 +0800)]
UefiCpuPkg: Simplify the struct definition of CPU_EXCEPTION_INIT_DATA

CPU_EXCEPTION_INIT_DATA is now an internal implementation of
CpuExceptionHandlerLib. Union can be removed since Ia32 and X64 have the
same definition. Also, two fields (Revision and InitDefaultHandlers)are
useless, can be removed.

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: Zhiguang Liu <zhiguang.liu@intel.com>
22 months agoMdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:36 +0000 (09:25 +0800)]
MdeModulePkg: Move CPU_EXCEPTION_INIT_DATA to UefiCpuPkg

Since the API InitializeSeparateExceptionStacks is simplified and does't
use the struct CPU_EXCEPTION_INIT_DATA, CPU_EXCEPTION_INIT_DATA become
a inner implementation of CpuExcetionHandlerLib.

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
22 months agoUefiCpuPkg: Simplify InitializeSeparateExceptionStacks
Liu, Zhiguang [Tue, 9 Aug 2022 01:25:35 +0000 (09:25 +0800)]
UefiCpuPkg: Simplify InitializeSeparateExceptionStacks

Hide the Exception implementation details in CpuExcetionHandlerLib and
caller only need to provide buffer

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
22 months agoPrmPkg: Add details on AArch64 build to the Readme.
Jose Marinho [Tue, 26 Jul 2022 16:54:42 +0000 (17:54 +0100)]
PrmPkg: Add details on AArch64 build to the Readme.

Specify how to build the PrmPkg for the AArch64 architecture.
Make the 2 following notes:
 - the PrmPkg has only been tested on AArch64 using the GCC5
toolchain.
 - All symbols to be listed in the PRMT as well as the
PrmModuleExportDescriptor must be explicitly preserved by resorting to
the --require-defined linker flag.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoPrmPkg: Support AArch64 builds using GCC
Jose Marinho [Fri, 18 Dec 2020 14:01:55 +0000 (14:01 +0000)]
PrmPkg: Support AArch64 builds using GCC

Add support to build PrmPkg for AArch64 using the GCC compiler.

Add AARCH64 architecture to the list of supported architectures.
Add BaseStackCheck library to allow for Prm module builds on AARCH64.

Also update the CI to add dependency on ArmPkg.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoPrmPkg: Build Prm Samples with GCC for AARCH64
Jose Marinho [Tue, 5 Apr 2022 17:57:23 +0000 (18:57 +0100)]
PrmPkg: Build Prm Samples with GCC for AARCH64

- Add the --prm flag to the GENFW_FLAGS
- Add the --no-gc-section to the linker flags so that apparently
unreferenced symbols are not prematurely removed from the .dll which
is used to generate the Prm module .efi.
- Force the linker to maintain the PrmModuleExportDescriptor symbol.
- Force the linker to maintain the PRM handler funtion's symbol.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoPrmPkg: Enable external visibility on PRM symbols
Jose Marinho [Tue, 5 Apr 2022 17:53:25 +0000 (18:53 +0100)]
PrmPkg: Enable external visibility on PRM symbols

Enable GCC compilations to keep external symbols when generating a PRM
module.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoBasetools/GenFw: Allow AARCH64 builds to use the --prm flag
Jose Marinho [Fri, 29 Oct 2021 16:48:26 +0000 (17:48 +0100)]
Basetools/GenFw: Allow AARCH64 builds to use the --prm flag

The GenFw invocation with the --prm flag was previously reserved for
X64.
AArch64 platforms, built with GCC5, can also deploy PRM modules, hence
the --prm flag is also applicable in builds targeting the AARCH64
architecture.

This commit enables the --prm flag to be used for EDK2 builds targeting
AARCH64.

Signed-off-by: Jose Marinho <jose.marinho@arm.com>
Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoBaseTools/GenSec: Support EFI_SECTION_FREEFORM_SUBTYPE_GUID sections
Konstantin Aladyshev [Wed, 20 Jul 2022 14:08:12 +0000 (22:08 +0800)]
BaseTools/GenSec: Support EFI_SECTION_FREEFORM_SUBTYPE_GUID sections

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
22 months agoBaseTools/VolInfo: Parse EFI_SECTION_FREEFORM_SUBTYPE_GUID header
Konstantin Aladyshev [Wed, 20 Jul 2022 12:00:39 +0000 (20:00 +0800)]
BaseTools/VolInfo: Parse EFI_SECTION_FREEFORM_SUBTYPE_GUID header

Print 'SubtypeGuid' field from the EFI_FREEFORM_SUBTYPE_GUID_SECTION
structure.
This value describes the raw data inside the section.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng<bob.c.feng@intel.com>
22 months agoBaseTools/VolInfo: Show FV section boundaries
Konstantin Aladyshev [Tue, 19 Jul 2022 15:45:52 +0000 (23:45 +0800)]
BaseTools/VolInfo: Show FV section boundaries

Currently there is no labels for start and end of the
EFI_SECTION_FIRMWARE_VOLUME_IMAGE type section. Therefore it is not
possible to see where the FV section ends and another section starts.
Add labels for start and end of the FV sections to fix the issue.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
22 months agoBaseTools/GenSec: Fix typo
Konstantin Aladyshev [Tue, 19 Jul 2022 14:27:10 +0000 (22:27 +0800)]
BaseTools/GenSec: Fix typo

Fix typo in the help message.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
22 months agoDynamicTablesPkg: Fix using RmrNodeCount unitlitialised
Edward Pickup [Thu, 4 Aug 2022 09:20:50 +0000 (10:20 +0100)]
DynamicTablesPkg: Fix using RmrNodeCount unitlitialised

Fix using RmrNodeCount uninitliased by initliasing it to zero. Also, add
an additional check for ACPI version. This fixes a crash running on
kvmtool.

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
22 months agoMdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device
Czajkowski, Maciej [Mon, 1 Aug 2022 17:00:09 +0000 (01:00 +0800)]
MdeModulePkg/AhciPei: Use PCI_DEVICE_PPI to manage AHCI device

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

This change modifies AhciPei library to allow usage both EDKII_PCI_DEVICE_PPI
and EDKII_PEI_ATA_AHCI_HOST_CONTROLLER_PPI to manage ATA HDD working under
AHCI mode.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
22 months agoMdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition
Czajkowski, Maciej [Mon, 1 Aug 2022 17:00:08 +0000 (01:00 +0800)]
MdeModulePkg: Add EDKII_PCI_DEVICE_PPI definition

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

This commit introduces EDKII_PCI_DEVICE_PPI. The purpose of this PPI is
to provide a way of accessing PCI devices to drvice drivers such as
NvmExpressPei or AhciPei.

Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Maciej Czajkowski <maciej.czajkowski@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
22 months agoUefiPayloadPkg: Load Boot Logo into ACPI table
Sean Rhodes [Sun, 10 Jul 2022 18:27:46 +0000 (19:27 +0100)]
UefiPayloadPkg: Load Boot Logo into ACPI table

If the boot logo is enabled, this will allow edk2 to pass the logo
to the OS via ACPI.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
22 months agoUefiPayloadPkg: Add a Macro to enable Boot Logo
Sean Rhodes [Sun, 10 Jul 2022 18:20:40 +0000 (19:20 +0100)]
UefiPayloadPkg: Add a Macro to enable Boot Logo

Add a macro called BOOTSPLASH_IMAGE, which when enabled, will
display a logo at boot time.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
22 months agoUefiPayloadPkg/PlatformBootManagerLib: Correct spacing in boot prompt
Sean Rhodes [Mon, 4 Jul 2022 19:36:31 +0000 (20:36 +0100)]
UefiPayloadPkg/PlatformBootManagerLib: Correct spacing in boot prompt

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>
22 months agoMaintainers.txt: Add missing Github IDs for OvmfPkg TPM/TGC modules
Michael D Kinney [Thu, 28 Jul 2022 00:48:30 +0000 (17:48 -0700)]
Maintainers.txt: Add missing Github IDs for OvmfPkg TPM/TGC modules

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
Cc: Stefan Berger <stefanb@linux.ibm.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ard Biesheuvel <ardb+tianocore@kernel.org>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
22 months agoArmVirtPkg: Fix KVM Guest Firmware
Edward Pickup [Tue, 2 Aug 2022 16:27:27 +0000 (17:27 +0100)]
ArmVirtPkg: Fix KVM Guest Firmware

Fix build of KVM Guest Firmware, broken by commit

  4c55f6394faf ("MdePkg: IORT header update for IORT Rev E.d spec")

Signed-off-by: Edward Pickup <edward.pickup@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
22 months agoOvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode
Dimitrije Pavlov [Thu, 28 Jul 2022 21:30:42 +0000 (16:30 -0500)]
OvmfPkg/QemuVideoDxe: Zero out PixelInformation in QueryMode

Ensure that the PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is zeroed out in
EFI_GRAPHICS_OUTPUT_PROTOCOL.QueryMode() and
EFI_GRAPHICS_OUTPUT_PROTOCOL.SetMode() when PixelFormat is
PixelBlueGreenRedReserved8BitPerColor.

According to UEFI 2.9 Section 12.9, PixelInformation field of the
EFI_GRAPHICS_OUTPUT_MODE_INFORMATION structure is valid only if
PixelFormat is PixelBitMask. This means that firmware is not required
to fill out the PixelInformation field for other PixelFormat types,
which implies that the QemuVideoDxe implementation is technically
correct.

However, not zeroing out those fields will leak the contents of the
memory returned by the memory allocator, so it is better to explicitly
set them to zero.

In addition, the SCT test suite relies on PixelInformation always
having a consistent value, which causes failures.

Signed-off-by: Dimitrije Pavlov <Dimitrije.Pavlov@arm.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
22 months agoSecurityPkg: Add retry mechanism for tpm command
Qi Zhang [Fri, 29 Jul 2022 01:02:21 +0000 (09:02 +0800)]
SecurityPkg: Add retry mechanism for tpm command

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

As per TCG PC Client Device Driver Design Principle document,
if tpm commands fails due to timeout condition, then it should
have retry mechanism (3 retry attempts).
Existing implementation of PtpCrbTpmCommand does not have retry
mechanism if it fails with EFI_TIMEOUT.

See TCG PC Client Device Driver Design Principles for TPM 2.0
https://trustedcomputinggroup.org/wp-content/uploads/TCG_PCClient_Device_Driver_Design_Principles_TPM2p0_v1p1_r4_211104_final.pdf
Vision 1.1, Revision 0.04
Section 7.2.1

Signed-off-by: Qi Zhang <qi1.zhang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Tested-by: Swapnil Patil <S.Keshavrao.Patil@dell.com>
22 months agoDynamicTablesPkg: IORT generator updates for Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:31 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT generator updates for Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
 - increments the IORT table revision to 5.
 - updates the node definition to add an 'Identifier' field.
 - adds definition of node type 6 - Reserved Memory Range node.
 - adds definition for Memory Range Descriptors.
 - adds flag to indicate PRI support for root complexes.
 - adds flag to indicate if the root complex supports forwarding
   of PASID information on translated transactions to the SMMU.
 - adds flag to indicate if the root complex supports PASID.
 - adds flags to define access privilege and attributes for the
   memory ranges.

Therefore, update the IORT generator to:
  - increment IORT table revision count to 5.
  - populate Identifier filed if revision is greater than 4.
  - add support to populate Reserved Memory Range nodes and
    the Memory range descriptors.
  - add validation to check that the Identifier field is
    unique.
  - Populate the PASID capabilities and Flags field of the
    Root complex node.
 - Added checks to not generate IORT Rev E, Rev E.<a,b,c>.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoDynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.d
Sami Mujawar [Thu, 14 Jul 2022 16:50:30 +0000 (17:50 +0100)]
DynamicTablesPkg: Update ArmNameSpaceObjects for IORT Rev E.d

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
    Feb 2022 (https://developer.arm.com/documentation/den0049/)
    introduces the following updates, collectively including the
    updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
     - increments the IORT table revision to 5.
     - updates the node definition to add an 'Identifier' field.
     - adds definition of node type 6 - Reserved Memory Range node.
     - adds definition for Memory Range Descriptors.
     - adds flag to indicate PRI support for root complexes.
     - adds flag to indicate if the root complex supports forwarding
       of PASID information on translated transactions to the SMMU.
     - adds flag to indicate if the root complex supports PASID.
     - adds flags to define access privilege and attributes for the
       memory ranges.

Therefore, update the Arm namespace objects to:
  - add Identifier field to IORT nodes.
  - introduce enums to represent RMR nodes and Memory Range
    descriptors.
  - add definition of node type 6 - Reserved Memory Range node.
  - add definition for Memory Range Descriptors.
  - add PASID capabilities and flags field to Root Complex node.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:29 +0000 (17:50 +0100)]
ShellPkg: Acpiview: IORT parser update for IORT Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
 - increments the IORT table revision to 5.
 - updates the node definition to add an 'Identifier' field.
 - adds definition of node type 6 - Reserved Memory Range node.
 - adds definition for Memory Range Descriptors.
 - adds flag to indicate PRI support for root complexes.
 - adds flag to indicate if the root complex supports forwarding
   of PASID information on translated transactions to the SMMU.
 - adds flag to indicate if the root complex supports PASID.
 - adds flags to define access privilege and attributes for the
   memory ranges.

Therefore, update the IORT parser to:
  - parse the Identifier field.
  - parse Reserved Memory Range node.
  - parse Memory Range Descriptors.
  - add validations to check that the physical range base
    and size of the Memory Range Descriptor is 64KB aligned.
  - add validation to check that the IORT Table Revision is
    not 4 as IORT Rev E.c is deprecated.
  - add validation to check that the IORT RMR node revision
    is not 2 as it breaks backward compatibility and was
    deprecated as part of IORT Rev E.c.
  - skip parsing of IORT Rev E, Rev E.a, Rev E.b, Rev E.c as
    some fields were deprecated in these revisions.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoMdePkg: IORT header update for IORT Rev E.d spec
Sami Mujawar [Thu, 14 Jul 2022 16:50:28 +0000 (17:50 +0100)]
MdePkg: IORT header update for IORT Rev E.d spec

Bugzilla: 3458 - Add support IORT Rev E.d specification updates
          (https://bugzilla.tianocore.org/show_bug.cgi?id=3458)

The IO Remapping Table, Platform Design Document, Revision E.d,
Feb 2022 (https://developer.arm.com/documentation/den0049/)
introduces the following updates, collectively including the
updates and errata fixes to Rev E, Rev E.a, Rev E.b, Rev E.c:
  - increments the IORT table revision to 5.
  - updates the node definition to add an 'Identifier' field.
  - adds definition of node type 6 - Reserved Memory Range node.
  - adds definition for Memory Range Descriptors.
  - adds flag to indicate PRI support for root complexes.
  - adds flag to indicate if the root complex supports forwarding
    of PASID information on translated transactions to the SMMU.
  - adds flag to indicate if the root complex supports PASID.
  - adds flags to define access privilege and attributes for the
    memory ranges.

Therefore, update the IORT header file to reflect these changes,
and also rename the EFI_ACPI_IO_REMAPPING_TABLE_REVISION macro to
EFI_ACPI_IO_REMAPPING_TABLE_REVISION_00.

Also update the IORT generator in DynamicTablesPkg to fix the
compilation errors so that Git Bisect can work.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
22 months agoDynamicTablesPkg: IORT set reference to interrupt array if present
Sami Mujawar [Thu, 14 Jul 2022 16:50:27 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT set reference to interrupt array if present

The IORT generator is populating the reference field for Context and
PMU interrupts even if their count is zero.

Update the IORT generator to set the references only if the interrupt
count is not 0. Also add checks to ensure a valid reference token has
been provided.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoDynamicTablesPkg: IORT set reference to Id array only if present
Sami Mujawar [Thu, 14 Jul 2022 16:50:26 +0000 (17:50 +0100)]
DynamicTablesPkg: IORT set reference to Id array only if present

The IORT table generator is setting up a reference to ID array for
nodes even when the ID Mapping count is zero. This is not an issue as an
OS would only access the ID Reference if the ID mapping count is not zero.

However, it would be good to set the reference to ID array to zero when
the ID Mapping count is zero rather than populating it with an incorrect
value.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoDynamicTablesPkg: Handle error when IdMappingToken is NULL
Sami Mujawar [Thu, 14 Jul 2022 16:50:25 +0000 (17:50 +0100)]
DynamicTablesPkg: Handle error when IdMappingToken is NULL

Add error handling when the IdMappingCount is not zero and the
IdMappingToken is NULL.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoShellPkg: Acpiview: Abbreviate field names to preserve alignment
Sami Mujawar [Thu, 14 Jul 2022 16:50:24 +0000 (17:50 +0100)]
ShellPkg: Acpiview: Abbreviate field names to preserve alignment

Some field names in the IORT table parser were longer than the
OUTPUT_FIELD_COLUMN_WIDTH plus indentation, resulting in loss of
the output print alignment. Therefore, abbreviate the field names.

Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
22 months agoIntelFsp2Pkg: Fix GenCfgOpt bug for FSPI_UPD support.
Chasel Chiu [Fri, 29 Jul 2022 02:52:49 +0000 (19:52 -0700)]
IntelFsp2Pkg: Fix GenCfgOpt bug for FSPI_UPD support.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
Fixed a logic bug in GenCfgOpt.py to skip FSPI_UPD when platforms
do not support.

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: Star Zeng <star.zeng@intel.com>
22 months agoIntelFsp2Pkg: FSPI_UPD is not mandatory.
Chasel Chiu [Mon, 25 Jul 2022 19:03:51 +0000 (12:03 -0700)]
IntelFsp2Pkg: FSPI_UPD is not mandatory.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3993
FSPI_UPD is required only When platforms implemented FSP_I component.
Updated the scripts to allow FSPI_UPD not present scenario.
Also fixed FSP_GLOBAL_DATA structure alignment issue and unnecessary
non-backward compatibility change in previous FSP_I patch.

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: Star Zeng <star.zeng@intel.com>
22 months agoOvmfPkg/XenHypercallLib: Fix naming of AArch64
Anthony PERARD [Wed, 20 Jul 2022 13:17:10 +0000 (06:17 -0700)]
OvmfPkg/XenHypercallLib: Fix naming of AArch64

Fix path to follow naming convention of "AArch64", and allow the path
in "Maintainers.txt" to work as expected.

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3982
Signed-off-by: Anthony PERARD <anthony.perard@citrix.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>