]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
2 years agoIntelFsp2Pkg SplitFspBin.py: Correct file name in file header
Zeng, Star [Wed, 27 Oct 2021 11:59:51 +0000 (19:59 +0800)]
IntelFsp2Pkg SplitFspBin.py: Correct file name in file header

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
2 years agoSecurityPkg/FvReportPei: Remove the ASSERT to allow neither M nor V
Guomin Jiang [Fri, 15 Oct 2021 03:54:14 +0000 (11:54 +0800)]
SecurityPkg/FvReportPei: Remove the ASSERT to allow neither M nor V

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

M mean that Measured Boot, V mean that Verified Boot.

The FvReport do below:
1. Do nothing if neither M nor V
2. Allocate pages to save the firmware volume and use it to install
   firmware info Ppi
3. Install PreHashFv Ppi if the FV need measurement.
4. Verify the Hash if the FV need verification

Notes:
1. The component is used to verify the FV or measure the FV
2. Copy action is just for security purpose but not main purpose.
3. If you use this component, Doesn't need to copy in other compoent
   which result time consumption.

Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2 years agoRedfishPkg: Add more information to Readme.md
Abner Chang [Sat, 30 Oct 2021 03:20:53 +0000 (11:20 +0800)]
RedfishPkg: Add more information to Readme.md

Add more information of network settings for EDK2
Redfish service on EmulatorPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Nickle Wang <nickle.wang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Nickle Wang <nickle.wang@hpe.com>
2 years agoUefiPayloadPkg: Remove SystemTableInfo GUID.
Kesavan Balakrishnan, ThiyaguX [Wed, 20 Oct 2021 06:05:19 +0000 (23:05 -0700)]
UefiPayloadPkg: Remove SystemTableInfo GUID.

SystemTableInfo GUID is not a Spec defined GUID.
The latest SBL and CBL produces ACPI and SMBIOS table information.
So removing the SystemTableInfo GUID implementation.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: Thiyagu Kesavan Balakrishnan <thiyagux.kesavan.balakrishnan@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoRedfishPkg: Update link to staging/RedfishClientPkg in Readme.md
Nickle Wang [Fri, 29 Oct 2021 02:02:16 +0000 (10:02 +0800)]
RedfishPkg: Update link to staging/RedfishClientPkg in Readme.md

Redfish feature DXE drivers are contributed to staging/RedfishClientPkg.
Add link to Readme.md in staging/RedfishClientPkg.

Signed-off-by: Nickle Wang <nickle.wang@hpe.com>
Cc: Abner Chang <abner.chang@hpe.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Abner Chang <abner.chang@hpe.com>
2 years agoMdePkg Cpuid.h: Define CPUID.(EAX=7,ECX=0):EDX[30]
Zeng, Star [Thu, 21 Oct 2021 03:28:20 +0000 (11:28 +0800)]
MdePkg Cpuid.h: Define CPUID.(EAX=7,ECX=0):EDX[30]

This patch follows new Intel SDM to define CPUID.(EAX=7,ECX=0):EDX[30].

Signed-off-by: Star Zeng <star.zeng@intel.com>
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>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoIntelFsp2Pkg/SplitFspBin.py: adopt FSP 2.3 specification.
Chasel Chiu [Tue, 26 Oct 2021 07:53:37 +0000 (15:53 +0800)]
IntelFsp2Pkg/SplitFspBin.py: adopt FSP 2.3 specification.

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

FSP 2.3 has updated FSP_INFO_HEADER to support ExtendedImageRevision
and SplitFspBin.py needs to support it.

Also updated script to display integer value basing on length.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
2 years agoFmpDevicePkg/FmpDxe: Use new Variable Lock interface
Yang Jie [Tue, 19 Oct 2021 03:11:04 +0000 (11:11 +0800)]
FmpDevicePkg/FmpDxe: Use new Variable Lock interface

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3655
The code in FmpDevicePkg call the deprecated interface
VariableLockRequestToLockc. So I changed the code in
FmpDevicePkg using RegisterBasicVariablePolicy, instead
of the deprecated interface.

Signed-off-by: Yang Jie <jie.yang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Wei6 Xu <wei6.xu@intel.com>
2 years agoUefiPayloadPkg: Add SMM support and SMM variable support
Guo Dong [Fri, 24 Sep 2021 04:54:23 +0000 (21:54 -0700)]
UefiPayloadPkg: Add SMM support and SMM variable support

Add SMM variable support for universal UEFI payload.
By default they are disabled.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add a SMM dispatch module
Guo Dong [Wed, 22 Sep 2021 21:45:55 +0000 (14:45 -0700)]
UefiPayloadPkg: Add a SMM dispatch module

PCH SMM module would install SMM SW dispatch2 protocol.
And it supports to register SMI handlers based on SMI APM
interrupt from the bootloader information gSmmRegisterInfoGuid.
It is possible to extend bootloader HOB to pass other information
to support more SMI sources.
If this module is not required by bootloader for some reason, the
bootloader could skip this HOB or build a HOB without EOS info.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add a common FVB SMM module
Guo Dong [Wed, 22 Sep 2021 21:42:50 +0000 (14:42 -0700)]
UefiPayloadPkg: Add a common FVB SMM module

This FVB module is used to initialize NV variable region
and provide SMM FVB protocol to read/write SPI variable region.

This module consume HOB gNvVariableInfoGuid and depends on
FlashDeviceLib for the actual SPI device operate.

During FVB initialization, it will initialize the variable region
if the variable region is not valid. And it support to write initial
variable data from FFS file if it is found.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add FlashDeviceLib
Guo Dong [Wed, 22 Sep 2021 21:32:30 +0000 (14:32 -0700)]
UefiPayloadPkg: Add FlashDeviceLib

This library provides FlashDeviceLib APIs based on
SpiFlashLib and consumed by FVB driver.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add SpiFlashLib
Guo Dong [Wed, 22 Sep 2021 21:31:29 +0000 (14:31 -0700)]
UefiPayloadPkg: Add SpiFlashLib

This is a common SPI Flash library used for the Intel platform that
supports SPI hardware sequence. This library provides actual SPI flash
operation via Intel PCH SPI controller.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add bootloader SMM support module
Guo Dong [Wed, 22 Sep 2021 21:27:21 +0000 (14:27 -0700)]
UefiPayloadPkg: Add bootloader SMM support module

This module is only used for SMM S3 support for the bootloader that
doesn't support SMM.
The payload would save SMM rebase info to SMM communication area in
normal boot and expect the bootloader in S3 path to rebase the SMM
and trigger SMI by writing 0xB2 port with the given value from SMM
communication area. The payload SMM handler would get chance to
restore some registers in S3 path.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add a common SMM control Runtime DXE module
Guo Dong [Wed, 22 Sep 2021 21:22:42 +0000 (14:22 -0700)]
UefiPayloadPkg: Add a common SMM control Runtime DXE module

This module consumes SMM Registers HOB (SMI_GBL_EN and SMI_APM_EN) to
install SMM control 2 protocol gEfiSmmControl2ProtocolGuid.
The protocol activate() would set SMI_GBL_EN and SMI_APM_EN and trigger
SMI by writing to IO port 0xB3 and 0xB2.

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoUefiPayloadPkg: Add a common SmmAccessDxe module
Guo Dong [Wed, 22 Sep 2021 21:16:41 +0000 (14:16 -0700)]
UefiPayloadPkg: Add a common SmmAccessDxe module

SmmAccessDxe module would consume EFI_SMRAM_HOB_DESCRIPTOR_BLOCK HOB to
produce SMM access protocol gEfiSmmAccess2ProtocolGuid (open, close, lock,
and GetCapabilities.)

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: Ray Ni <ray.ni@intel.com>
Reviewed-by: Benjamin You <benjamin.you@intel.com>
2 years agoOvmfPkg: Enable TDX in ResetVector
Min Xu [Tue, 28 Sep 2021 02:55:59 +0000 (10:55 +0800)]
OvmfPkg: Enable TDX in ResetVector

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

Intel's Trust Domain Extensions (Intel TDX) refers to an Intel technology
that extends Virtual Machines Extensions (VMX) and Multi-Key Total Memory
Encryption (MKTME) with a new kind of virutal machines guest called a
Trust Domain (TD). A TD is desinged to run in a CPU mode that protects the
confidentiality of TD memory contents and the TD's CPU state from other
software, including the hosting Virtual-Machine Monitor (VMM), unless
explicitly shared by the TD itself.

Note: Intel TDX is only available on X64, so the Tdx related changes are
in X64 path. In IA32 path, there may be null stub to make the build
success.

This patch includes below major changes.

1. Ia32/IntelTdx.asm
IntelTdx.asm includes below routines used in ResetVector
 - IsTdx
   Check if the running system is Tdx guest.

 - InitTdxWorkarea
   It initialize the TDX_WORK_AREA. Because it is called by both BSP and
   APs and to avoid the race condition, only BSP can initialize the
   WORK_AREA. AP will wait until the field of TDX_WORK_AREA_PGTBL_READY
   is set.

 - ReloadFlat32
   After reset all CPUs in TDX are initialized to 32-bit protected mode.
   But GDT register is not set. So this routine loads the GDT then jump
   to Flat 32 protected mode again.

 - InitTdx
   This routine wrap above 3 routines together to do Tdx initialization
   in ResetVector phase.

 - IsTdxEnabled
   It is a OneTimeCall to probe if TDX is enabled by checking the
   CC_WORK_AREA.

 - CheckTdxFeaturesBeforeBuildPagetables
   This routine is called to check if it is Non-TDX guest, TDX-Bsp or
   TDX-APs. Because in TDX guest all the initialization is done by BSP
   (including the page tables). APs should not build the tables.

 - TdxPostBuildPageTables
   It is called after Page Tables are built by BSP.
   byte[TDX_WORK_AREA_PGTBL_READY] is set by BSP to indicate APs can
   leave spin and go.

2. Ia32/PageTables64.asm
As described above only the TDX BSP build the page tables. So
PageTables64.asm is updated to make sure only TDX BSP build the
PageTables. TDX APs will skip the page table building and set Cr3
directly.

3. Ia16/ResetVectorVtf0.asm
In Tdx all CPUs "reset" to run on 32-bit protected mode with flat
descriptor (paging disabled). But in Non-Td guest the initial state of
CPUs is 16-bit real mode. To resolve this conflict, BITS 16/32 is used
in the ResetVectorVtf0.asm. It checks the 32-bit protected mode or 16-bit
real mode, then jump to the corresponding entry point.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Add IntelTdxMetadata.asm
Min Xu [Tue, 28 Sep 2021 02:47:29 +0000 (10:47 +0800)]
OvmfPkg: Add IntelTdxMetadata.asm

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

In TDX when host VMM creates a new guest TD, some initial set of
TD-private pages are added using the TDH.MEM.PAGE.ADD function. These
pages typically contain Virtual BIOS code and data along with some clear
pages for stacks and heap. In the meanwhile, some configuration data
need be measured by host VMM. Tdx Metadata is designed for this purpose
to indicate host VMM how to do the above tasks.

More detailed information of Metadata is in [TDVF] Section 11.

Tdx Metadata describes the information about the image for VMM use.
For example, the base address and length of the TdHob, Bfv, Cfv, etc.
The offset of the Metadata is stored in a GUID-ed structure which is
appended in the GUID-ed chain from a fixed GPA (0xffffffd0).

In this commit there are 2 new definitions of BFV & CFV.
Tdx Virtual Firmware (TDVF) includes one Firmware Volume (FV) known
as the Boot Firmware Volume (BFV). The FV format is defined in the
UEFI Platform Initialization (PI) spec. BFV includes all TDVF
components required during boot.

TDVF also include a configuration firmware volume (CFV) that is
separated from the BFV. The reason is because the CFV is measured in
RTMR, while the BFV is measured in MRTD.

In practice BFV is the code part of Ovmf image (OVMF_CODE.fd). CFV is
the vars part of Ovmf image (OVMF_VARS.fd).

Since AMD SEV has already defined some SEV specific memory region in
MEMFD. TDX re-uses some of the memory regions defined by SEV.
 - MailBox : PcdOvmfSecGhcbBackupBase|PcdOvmfSecGhcbBackupSize
 - TdHob   : PcdOvmfSecGhcbBase|PcdOvmfSecGhcbSize

[TDVF] https://software.intel.com/content/dam/develop/external/us/en/
documents/tdx-virtual-firmware-design-guide-rev-1.pdf

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Clear WORK_AREA_GUEST_TYPE in Main.asm
Min Xu [Mon, 27 Sep 2021 00:29:01 +0000 (08:29 +0800)]
OvmfPkg: Clear WORK_AREA_GUEST_TYPE in Main.asm

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

Previously WORK_AREA_GUEST_TYPE was cleared in SetCr3ForPageTables64.
This is workable for Legacy guest and SEV guest. But it doesn't work
after Intel TDX is introduced. It is because all TDX CPUs (BSP and APs)
start to run from 0xfffffff0, thus WORK_AREA_GUEST_TYPE will be cleared
multi-times if it is TDX guest. So the clearance of WORK_AREA_GUEST_TYPE
is moved to Main16 entry point in Main.asm.
Note: WORK_AREA_GUEST_TYPE is only defined for ARCH_X64.

For Intel TDX, its corresponding entry point is Main32 (which will be
introduced in next commit in this patch-set). WORK_AREA_GUEST_TYPE will
be cleared there.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg: Copy Main.asm from UefiCpuPkg to OvmfPkg's ResetVector
Min Xu [Thu, 23 Sep 2021 03:09:00 +0000 (11:09 +0800)]
OvmfPkg: Copy Main.asm from UefiCpuPkg to OvmfPkg's ResetVector

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

Previously OvmfPkg/ResetVector uses the Main.asm in
UefiCpuPkg/ReseteVector/Vtf0. In this Main.asm there is only Main16
entry point.

This patch-set is to introduce Intel TDX into Ovmf. Main32 entry point
is needed in Main.asm by Intel TDX. To reduce the complexity of Main.asm
in UefiCpuPkg, OvmfPkg create its own Main.asm to meet the requirement
of Intel TDX. This Main.asm is an unmodified copy (so no functional
change) and the actual changes for tdx come as incremental patches.

UefiCpuPkg/ResetVector/Vtf0/main.asm -> OvmfPkg/ResetVector/Main.asm

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmPkg: Implement PlatformBootManagerLib for LinuxBoot
Nhi Pham [Sat, 23 Oct 2021 07:32:41 +0000 (14:32 +0700)]
ArmPkg: Implement PlatformBootManagerLib for LinuxBoot

LinuxBoot is a firmware that replaces specific firmware functionality
like the UEFI DXE phase with a Linux kernel and runtime. It is built-in
UEFI image like an application, which is executed at the end of DXE
phase.

To achieve the LinuxBoot boot flow "SEC->PEI->DXE->BDS->LinuxBoot",
today we use the common well-known GUID of UEFI Shell for LinuxBoot
payload, so LinuxBoot developers can effortlessly find the UEFI Shell
Application and replace it with the LinuxBoot payload without
recompiling platform EDK2 (There might be an issue with a few systems
that don't have a UEFI Shell). Also, we have a hard requirement to force
the BDS to boot into the LinuxBoot as it is essentially required that
only the LinuxBoot boot option is permissible and UEFI is an
intermediate bootstrap phase. Considering all the above, it is
reasonable to just have a new GUID for LinuxBoot and require a LinuxBoot
specific BDS implementation. In addition, with making the BDS
implementation simpler, we can reduce many DXE drivers which we think it
is not necessary for LinuxBoot booting.

This patch adds a new PlatformBootManagerLib implementation which
registers only the gArmTokenSpaceGuid.PcdLinuxBootFileGuid for LinuxBoot
payload as an active boot option. It allows BDS to jump to the LinuxBoot
quickly by skipping the UiApp and UEFI Shell.

The PlatformBootManagerLib library derived from
ArmPkg/Library/PlatformBootManagerLib.

Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Samer El-Haj-Mahmoud <Samer.El-Haj-Mahmoud@arm.com>
Acked-by: Moritz Fischer <moritzf@google.com>
2 years agoNetworkPkg/HttpBootDxe: make file extension check case-insensitive
Lin, Gary (HPS OE-Linux) [Mon, 18 Oct 2021 07:21:43 +0000 (15:21 +0800)]
NetworkPkg/HttpBootDxe: make file extension check case-insensitive

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

HttpBootCheckImageType() was using the case-sensitive AsciiStrCmp() to
check the file extensions and this could reject the images with
upper-case file names. Using the case-insensitive AsciiStriCmp() to
avoid the issue.

Cc: Maciej Rabeda <maciej.rabeda@linux.intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Siyuan Fu <siyuan.fu@intel.com>
Signed-off-by: Gary Lin <gary.lin@hpe.com>
Reviewed-by: Maciej Rabeda <maciej.rabeda@linux.intel.com>
2 years agoShellPkg: Parse I/O APIC and x2APIC structure
Abdul Lateef Attar [Tue, 24 Aug 2021 15:30:13 +0000 (23:30 +0800)]
ShellPkg: Parse I/O APIC and x2APIC structure

Parse and print the below interrupt structures
  - I/O APIC Structure
  - Interrupt Source Override Structure
  - Processor Local x2APIC Structure
  - Local x2APIC NMI Structure

Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
2 years agoUefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib
IanX Kuo [Sat, 16 Oct 2021 22:30:46 +0000 (06:30 +0800)]
UefiCpuPkg/CpuCacheInfoLib: Add QuickSort function on BaseLib

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

Remove MdeModulePkg dependency

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: IanX Kuo <ianx.kuo@intel.com>
2 years agoMdeModulePkg/SortLib: Add QuickSort function on BaseLib
IanX Kuo [Fri, 15 Oct 2021 22:52:31 +0000 (06:52 +0800)]
MdeModulePkg/SortLib: Add QuickSort function on BaseLib

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

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
2 years agoDynamicTablesPkg: Fix void pointer arithmetic
Pierre Gondois [Thu, 14 Oct 2021 14:59:22 +0000 (15:59 +0100)]
DynamicTablesPkg: Fix void pointer arithmetic

Building the DynamicTablesPkg with the additional
-Wpointer-arith flag triggers the following error:
  "pointer of type ‘void *’ used in arithmetic
  [-Werror=pointer-arith]"

Cast the void pointer to fix the error.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Fix unitialized variable use
Moritz Fischer [Wed, 20 Oct 2021 05:21:18 +0000 (22:21 -0700)]
DynamicTablesPkg: Fix unitialized variable use

In the success case we should return EFI_SUCCESS rather than returning
a potentially unitialized value of Status.

Cc: Sami Mujawar <Sami.Mujawar@arm.com>
Cc: Alexei Fedorov <Alexei.Fedorov@arm.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
2 years agoUefiCpuPkg: Cpu feature data stored in memory may be migrated
Lou, Yun [Thu, 30 Sep 2021 06:26:24 +0000 (14:26 +0800)]
UefiCpuPkg: Cpu feature data stored in memory may be migrated

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

The memory allocated through "PeiAllocatePool" is located in HOB, and
in DXE phase, the HOB will be migrated to a different location.
After the migration, the data stored in the HOB stays the same, but the
address of pointer to the memory(such as the pointers in ACPI_CPU_DATA
structure) changes, which may cause "PiSmmCpuDxeSmm" driver can't find
the memory(the pointers in ACPI_CPU_DATA structure) that allocated in
"PeiRegisterCpuFeaturesLib", so use "PeiAllocatePages" to allocate
memory instead.

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 agoUefiPayloadPkg: Fix the build failure for non-universal payload
Guo Dong [Tue, 19 Oct 2021 06:05:09 +0000 (23:05 -0700)]
UefiPayloadPkg: Fix the build failure for non-universal payload

Applied an old patch which caused non-universal payload build failed
since that code was added after the old patch.
This patch fixed the build failure.

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: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoUefiPayloadPkg: Fix ECC reported issues
Guo Dong [Fri, 15 Oct 2021 19:10:11 +0000 (12:10 -0700)]
UefiPayloadPkg: Fix ECC reported issues

V2: Fix more header files on #ifdef variable

ECC reported some issues on UefiPayloadPkg, this patch fixed
most of them except several files including ElfLib\Elf32.h,
coreboot.h, CbParseLib.c, etc.
It also removed unused functions in ResetSystemLib and Hob.c.

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: Maurice Ma <maurice.ma@intel.com>
2 years agoUefiPayloadPkg: Replace MEMROY_ENTRY by MEMORY_ENTRY
Guo Dong [Tue, 19 Oct 2021 03:34:38 +0000 (20:34 -0700)]
UefiPayloadPkg: Replace MEMROY_ENTRY by MEMORY_ENTRY

Fixes simple typo, no behavioral change.

Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Moritz Fischer <moritzf@google.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoOvmfPkg/AmdSev: update the fdf to use new workarea PCD
Brijesh Singh [Thu, 14 Oct 2021 18:17:11 +0000 (02:17 +0800)]
OvmfPkg/AmdSev: update the fdf to use new workarea PCD

The commit 80e67af9afca added support for the generic work area concept
used mainly by the encrypted VMs but missed update the AmdSev package.

Fixes: 80e67af9afca ("OvmfPkg: introduce a common work area")
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>
Reported-by: Dov Murik <dovmurik@linux.ibm.com>
Signed-off-by: Brijesh Singh <brijesh.singh@amd.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dov Murik <dovmurik@linux.ibm.com>
Tested-by: Dov Murik <dovmurik@linux.ibm.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfpkg: update Ia32 build to use new work area
Brijesh Singh [Thu, 14 Oct 2021 18:17:10 +0000 (02:17 +0800)]
Ovmfpkg: update Ia32 build to use new work area

The commit 80e67af9afca added support for the generic work area concept
used mainly by the encrypted VMs. In the past, the work area was
preliminary used by the SEV-ES VMs. The SEV-ES support is available for
the X64 builds only. But now, that work area header contains fields that
nonencrypted VMs and SEV VMs can use. They can be built for IA32. So,
moving the work area defines outside of X64.

Fixes: 80e67af9afca ("OvmfPkg: introduce a common work area")
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>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoStandaloneMmPkg: Support CLANGPDB builds
Marvin Häuser [Thu, 14 Oct 2021 19:05:48 +0000 (19:05 +0000)]
StandaloneMmPkg: Support CLANGPDB builds

Currently, the flag "-fpie" is passed for all builds with a GCC
family toolchain, including CLANGPDB. CLANGPDB however does not
support this flag as it generates PE/COFF files directly.

As the flag is mostly required for ARM-specific self-relocation, drop
it for other architectures and document the limitation to enable e.g.
X64 CLANGPDB builds of StandaloneMmCore.

Signed-off-by: Marvin Häuser <mhaeuser@posteo.de>
Acked-by: Shi Steven <steven.shi@intel.com>
2 years agoUefiPayloadPkg: Fix the build issue for coreboot
Guo Dong [Fri, 15 Oct 2021 00:18:43 +0000 (17:18 -0700)]
UefiPayloadPkg: Fix the build issue for coreboot

V2: Fix GCC build issue.
There is typo in previous change caused coreboot build failure.
This patch fixed the build issue.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Guo Dong <guo.dong@intel.com>
Reviewed-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
2 years agoArmPkg/Smbios: Fix max cache size 2 wrong issue
Ming Huang [Thu, 14 Oct 2021 07:23:14 +0000 (15:23 +0800)]
ArmPkg/Smbios: Fix max cache size 2 wrong issue

As SMBIOS spec, bit-31 of maximum cache size 2 should be 1
for 64K granularity.

Signed-off-by: Ming Huang <huangming@linux.alibaba.com>
Reviewed-by: Rebecca Cran <rebecca@nuviainc.com>
Acked-by: Leif Lindholm <leif@nuviainc.com>
2 years agoUefiPayloadPkg: Use SECURITY_STUB_ENABLE to control the SecurityStubDxe
Liu, Zhiguang [Wed, 13 Oct 2021 09:08:22 +0000 (17:08 +0800)]
UefiPayloadPkg: Use SECURITY_STUB_ENABLE to control the SecurityStubDxe

The SecurityStubDxe driver may be provided by platform payload.
In UefiPayloadPkg\UefiPayloadPkg.fdf file, SecurityStubDxe should only
be included if SECURITY_STUB_ENABLE is TRUE

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoBaseTools: add edk2-test repo to SetupGit.py
Heinrich Schuchardt [Mon, 9 Nov 2020 23:16:08 +0000 (07:16 +0800)]
BaseTools: add edk2-test repo to SetupGit.py

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

The SctPkg is managed in repository
https://github.com/tianocore/edk2-test.

Make SetupGit.py usable for this repository.

Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
2 years agoArmVirtPkg/VirtioFdtDxe: Relocate VirtioFdtDxe to OvmfPkg/Fdt
Abner Chang [Mon, 11 Oct 2021 13:39:13 +0000 (21:39 +0800)]
ArmVirtPkg/VirtioFdtDxe: Relocate VirtioFdtDxe to OvmfPkg/Fdt

Relocate VirtioFdtDxe to OvmfPkg/Fdt, this driver is leverage by
both ARM and RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/FdtPciHostBridgeLib: Add RISC-V in the supported arch.
Abner Chang [Mon, 11 Oct 2021 13:38:30 +0000 (21:38 +0800)]
OvmfPkg/FdtPciHostBridgeLib: Add RISC-V in the supported arch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/FdtPciHostBridgeLib: Relocate FdtPciHostBridgeLib to OvmfPkg/Fdt
Abner Chang [Mon, 11 Oct 2021 13:36:28 +0000 (21:36 +0800)]
ArmVirtPkg/FdtPciHostBridgeLib: Relocate FdtPciHostBridgeLib to OvmfPkg/Fdt

Relocate FdtPciHostBridgeLib to OvmfPkg/Fdt, this library is
leverage by both ARM and RISC-V archs. Also use
PcdPciMmio32Translation and PcdPciMmio64Translation
PCDs provided by MdePkg instead of ArmPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoMdePkg: Add PcdPciMmio32(64)Translation PCDs
Abner Chang [Mon, 11 Oct 2021 13:35:49 +0000 (21:35 +0800)]
MdePkg: Add PcdPciMmio32(64)Translation PCDs

PcdPciMmio32Translation and PcdPciMmio64Translation PCDs are added
to MdePkg as the common PCDs for ARM and RSIC-V archs.

The one under ArmPkg is removed in the next patch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoOvmfPkg/QemuFwCfgLibMmio: Add RISC-V arch support
Abner Chang [Mon, 11 Oct 2021 13:35:06 +0000 (21:35 +0800)]
OvmfPkg/QemuFwCfgLibMmio: Add RISC-V arch support

Signed-off-by: Abner Chang <abner.chang@hpe.com>
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: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg
Abner Chang [Mon, 11 Oct 2021 13:33:59 +0000 (21:33 +0800)]
ArmVirtPkg/QemuFwCfgLib: Relocate QemuFwCfgLib to OvmfPkg

Relocate QemuFwCfgLib to OvmfPkg/Library/QemuFwCfgLib and rename
it to QemuFwCfgLibMmio, this library is leverage by both ARM and
RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoOvmfPkg/HighMemDxe: Add RISC-V in the supported arch.
Abner Chang [Mon, 11 Oct 2021 13:30:17 +0000 (21:30 +0800)]
OvmfPkg/HighMemDxe: Add RISC-V in the supported arch.

Add RISC-V VM in the file header.
Add RISC-V to the supported arch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/HighMemDxe: Relocate HighMemDxe to OvmfPkg
Abner Chang [Mon, 11 Oct 2021 13:27:33 +0000 (21:27 +0800)]
ArmVirtPkg/HighMemDxe: Relocate HighMemDxe to OvmfPkg

Relocate HighMemDxe to OvmfPkg/Fdt, this library is leverage by
both ARM and RISC-V archs.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmVirtPkg/FdtPciPcdProducerLib: Relocate PciPcdProducerLib to OvmfPkg
Abner Chang [Mon, 11 Oct 2021 13:27:00 +0000 (21:27 +0800)]
ArmVirtPkg/FdtPciPcdProducerLib: Relocate PciPcdProducerLib to OvmfPkg

Relocate PciPcdProducerLib to OvmfPkg/Fdt, this library is
leverage by both ARM and RISC-V archs.

Add OvmfPkg/Fdt maintainers in Maintainers.txt

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jordan Justen <jordan.l.justen@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
2 years agoArmPkg: Use PcdPciIoTranslation PCD from MdePkg
Abner Chang [Mon, 11 Oct 2021 13:26:23 +0000 (21:26 +0800)]
ArmPkg: Use PcdPciIoTranslation PCD from MdePkg

PcdPciIoTranslation PCD is relocated to MdePkg and leveraged by
both ARM and RISC-V arch. This patch removes the one from ArmPkg
and address the corresponding changes required for other modules
under ArmVirtPkg.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMdePkg: Add PcdPciIoTranslation PCD
Abner Chang [Mon, 11 Oct 2021 13:25:49 +0000 (21:25 +0800)]
MdePkg: Add PcdPciIoTranslation PCD

This PCD is moved from ArmPkg that is used to set the base address
of PCI MMIO window that provides I/O access. We relocate this PCD
because this PCD is common to ARM and RSIC-V arch.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoArmVirtPkg/FdtClintDxe: Move FdtClientDxe to EmbeddedPkg
Abner Chang [Mon, 11 Oct 2021 13:24:08 +0000 (21:24 +0800)]
ArmVirtPkg/FdtClintDxe: Move FdtClientDxe to EmbeddedPkg

This is one of the series patches to restructure the location of modules under
ArmVirtPkg for RiscVVirtPkg. RiscVVirtPkg leverage FDT Client protocol to
parse FDT nodes.

Signed-off-by: Abner Chang <abner.chang@hpe.com>
Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Daniel Schaefer <daniel.schaefer@hpe.com>
Cc: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Daniel Schaefer <daniel.schaefer@hpe.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
2 years agoMdeModulePkg/Core/Dxe: Acquire a lock when iterating gHandleList
Hua Ma [Mon, 11 Oct 2021 03:43:12 +0000 (11:43 +0800)]
MdeModulePkg/Core/Dxe: Acquire a lock when iterating gHandleList

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

This patch fixes the following issue:

The global variable gHandleList is a linked list.
This list is locked when a entry is added or removed from the list,
but there is no lock when iterating this list in function
CoreValidateHandle().
It can lead to "Handle.c (76): CR has Bad Signature" assertion if the
iterated entry in the list is just removed by other task during iterating.

Currently some caller functions of CoreValidateHandle() have
CoreAcquireProtocolLock(), but some caller functions of
CoreValidateHandle() do not CoreAcquireProtocolLock().
Add CoreAcquireProtocolLock() always when CoreValidateHandle() is called,
Also, A lock check is added in the CoreValidateHandle().

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Dandan Bi <dandan.bi@intel.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
2 years agoMdeModulePkg/Sd: Corrections for Extra.uni files
Konstantin Aladyshev [Mon, 11 Oct 2021 17:00:41 +0000 (01:00 +0800)]
MdeModulePkg/Sd: Corrections for Extra.uni files

Add correct content to the 'SdDxeExtra.uni' file.
Include 'EmmcDxeExtra.uni' and 'SdDxeExtra.uni' files to their
appropriate INF files.

Signed-off-by: Konstantin Aladyshev <aladyshev22@gmail.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
2 years agoUefiPayloadPkg: Add PCI root bridge info hob support for SBL
Ma, Maurice [Thu, 30 Sep 2021 16:59:07 +0000 (09:59 -0700)]
UefiPayloadPkg: Add PCI root bridge info hob support for SBL

Current UefiPayloadPkg can suport PCI root bridge info HOB
provided by bootloader. For UniversalPayload, bootloader can
directly provide this HOB for payload consumption. However,
for legacy UEFI payload, it is required to migrate the HOB
information from bootloader HOB space to UEFI payload HOB
space. This patch added the missing part for the bootloader
ParseLib in order to support both legacy and universal UEFI
payload.

This patch was tested on Slim Bootloader with latest UEFI
payload, and it worked as expected.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Guo Dong <guo.dong@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Maurice Ma <maurice.ma@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
2 years agoBaseTools: Change RealPath to AbsPath
Chen, Christine [Tue, 12 Oct 2021 04:07:38 +0000 (12:07 +0800)]
BaseTools: Change RealPath to AbsPath

Currently the realpath is used when parse modules, which shows the
path with a drive letter in build log. In Windows 'subst' comand is
used to associates a path with a drive letter, when use the mapped
drive letter for build, with realpath function the build log will
have different disk letter info which will cause confusion. In this
situation, if use adspath function to show the path info, it will keep
same letter with the mapped drive letter, which avoids confusion.
This patch modifies the realpath to abspath.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@Intel.com>
2 years agoMdePkg/BaseLib: Add QuickSort function on BaseLib
IanX Kuo [Tue, 12 Oct 2021 00:05:31 +0000 (08:05 +0800)]
MdePkg/BaseLib: Add QuickSort function on BaseLib

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

Add QuickSort function into BaseLib

Reviewed-by: Ray Ni <ray.ni@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>
Signed-off-by: IanX Kuo <ianx.kuo@intel.com>
2 years agoCryptoPkg/BaseCryptLib: Eliminate extra buffer copy in Pkcs7Verify()
Bob Morgan [Fri, 10 Sep 2021 21:34:14 +0000 (05:34 +0800)]
CryptoPkg/BaseCryptLib: Eliminate extra buffer copy in Pkcs7Verify()

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

Create a read-only openSSL BIO wrapper for the existing input
buffer passed to Pkcs7Verify() instead of copying the buffer
into an empty writable BIO which causes memory allocations
within openSSL.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Bob Morgan <bobm@nvidia.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
2 years agoShellPkg: Support ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0
Star Zeng [Tue, 28 Sep 2021 02:27:28 +0000 (10:27 +0800)]
ShellPkg: Support ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0

The patch adds entry into QueryTable.c for ProcessorUpgradeSocketLGA4677
from SMBIOS 3.5.0.
It also adds entries into QueryTable.c for ProcessorUpgradeSocketLGA4189
and ProcessorUpgradeSocketLGA1200 from SMBIOS 3.4.0.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoMdePkg: Add ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0
Zeng, Star [Tue, 28 Sep 2021 02:36:16 +0000 (10:36 +0800)]
MdePkg: Add ProcessorUpgradeSocketLGA4677 from SMBIOS 3.5.0

This patch adds ProcessorUpgradeSocketLGA4677 definition into Smbios.h
from SMBIOS 3.5.0.
It also adds ProcessorUpgradeSocketLGA4189 and ProcessorUpgradeSocketLGA1200
definitions into from SMBIOS 3.4.0.

Signed-off-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
2 years agoUefiPayloadPkg: Add a macro to select the SecurityStubDxe driver.
Liu, Zhiguang [Mon, 27 Sep 2021 01:59:59 +0000 (09:59 +0800)]
UefiPayloadPkg: Add a macro to select the SecurityStubDxe driver.

The SecurityStubDxe driver may be provided by platform payload.

Cc: Guo Dong <guo.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Maurice Ma <maurice.ma@intel.com>
Cc: Benjamin You <benjamin.you@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
2 years agoDynamicTablesPkg: SSDT CPU topology and LPI state generator
Pierre Gondois [Fri, 8 Oct 2021 14:46:32 +0000 (15:46 +0100)]
DynamicTablesPkg: SSDT CPU topology and LPI state generator

In the GIC interrupt model, logical processors are required to
have a Processor Device object in the DSDT and must convey each
processor's GIC information to the OS using the GICC structure.
Additionally, _LPI objects may be needed as they provide a method
to describe Low Power Idle states that defines the local power
states for each node in a hierarchical processor topology.

Therefore, add support to generate the CPU topology and the LPI
state information in an SSDT table.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Add CM_ARM_LPI_INFO object
Pierre Gondois [Fri, 8 Oct 2021 14:46:31 +0000 (15:46 +0100)]
DynamicTablesPkg: Add CM_ARM_LPI_INFO object

Introduce the CM_ARM_LPI_INFO CmObj in the ArmNameSpaceObjects.
This allows to describe LPI state information, as described in
ACPI 6.4, s8.4.4.3 "_LPI (Low Power Idle States)".

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation to add an _LPI state
Pierre Gondois [Fri, 8 Oct 2021 14:46:30 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation to add an _LPI state

Add AmlAddLpiState() to generates AML code to add an _LPI state
to an _LPI object created using AmlCreateLpiNode().

AmlAddLpiState increments the count of LPI states in the LPI
node by one, and adds the following package:
  Package() {
    MinResidency,
    WorstCaseWakeLatency,
    Flags,
    ArchFlags,
    ResCntFreq,
    EnableParentState,
    (GenericRegisterDescriptor != NULL) ?           // Entry method. If a
      ResourceTemplate(GenericRegisterDescriptor) : // Register is given,
      Integer,                                      // use it. Use the
                                                    // Integer otherwise
    ResourceTemplate() {                            // NULL Residency
      Register (SystemMemory, 0, 0, 0, 0)           // Counter
    },
    ResourceTemplate() {                            // NULL Usage Counter
      Register (SystemMemory, 0, 0, 0, 0)
    },
    ""                                              // NULL State Name
  },

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation for a _LPI object
Pierre Gondois [Fri, 8 Oct 2021 14:46:29 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation for a _LPI object

_LPI object provides a method to describe Low Power Idle
states that define the local power states for each node
in a hierarchical processor topology.

Therefore, add AmlCreateLpiNode() to generate code for a
_LPI object.

AmlCreateLpiNode ("_LPI", 0, 1, ParentNode, &LpiNode) is
equivalent of the following ASL code:
  Name (_LPI, Package (
0,  // Revision
1,  // LevelId
0   // Count
))

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation for a Method returning a NS
Pierre Gondois [Fri, 8 Oct 2021 14:46:28 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation for a Method returning a NS

Add AmlCodeGenMethodRetNameString() to generate AML code to create
a Method returning a NameString (NS).

AmlCodeGenMethodRetNameString (
  "MET0", "_CRS", 1, TRUE, 3, ParentNode, NewObjectNode
  );
is equivalent of the following ASL code:
Method(MET0, 1, Serialized, 3) {
  Return (_CRS)
}

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation to Return a NameString
Pierre Gondois [Fri, 8 Oct 2021 14:46:27 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation to Return a NameString

Add AmlCodeGenReturnNameString() to generate AML code for a
Return object node, returning the object as a NameString.

AmlCodeGenReturn ("NAM1", ParentNode, NewObjectNode) is
equivalent of the following ASL code:
  Return(NAM1)

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation for a Method
Pierre Gondois [Fri, 8 Oct 2021 14:46:26 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation for a Method

Add AmlCodeGenMethod() to generate code for a control method.

AmlCodeGenMethod ("MET0", 1, TRUE, 3, ParentNode, NewObjectNode)
is equivalent of the following ASL code:
    Method(MET0, 1, Serialized, 3) {}

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation for a ResourceTemplate
Pierre Gondois [Fri, 8 Oct 2021 14:46:25 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation for a ResourceTemplate

ASL provides a ResourceTemplate macro that creates a Buffer in which
resource descriptor macros can be listed. The ResourceTemplate macro
automatically generates an End descriptor and calculates the checksum
for the resource template.

Therefore, add AmlCodeGenResourceTemplate() to generate AML code for
the ResourceTemplate() macro. This function generates a Buffer node
with an EndTag resource data descriptor, which is similar to the ASL
ResourceTemplate() macro.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Helper function to compute package length
Pierre Gondois [Fri, 8 Oct 2021 14:46:24 +0000 (15:46 +0100)]
DynamicTablesPkg: Helper function to compute package length

Some AML object have a PkgLen which indicates the size of the
AML object. The package length can be encoded in 1 to 4 bytes.
The bytes used to encode the PkgLen is itself counted in the
PkgLen value. So, if an AML object's size increments/decrements,
the number of bytes used to encode the PkgLen value can itself
increment/decrement.

Therefore, a helper function AmlComputePkgLength() is introduced
to simply computation of the PkgLen.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML code generation for a Package
Pierre Gondois [Fri, 8 Oct 2021 14:46:23 +0000 (15:46 +0100)]
DynamicTablesPkg: AML code generation for a Package

Add AmlCodeGenPackage() to generate AML code for declaring
a Package() object. This function generates an empty package
node. New elements can then be added to the package's variable
argument list.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML Code generation for Resource data EndTag
Pierre Gondois [Fri, 8 Oct 2021 14:46:22 +0000 (15:46 +0100)]
DynamicTablesPkg: AML Code generation for Resource data EndTag

Add a helper function AmlCodeGenEndTag() to generate AML Resource Data
EndTag. The EndTag resource data is automatically generated by the ASL
compiler at the end of a list of resource data elements. Therefore, an
equivalent function is not present in ASL.

However, AmlCodeGenEndTag() is useful when generating AML code for the
ResourceTemplate() macro.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: AML Code generation for Register()
Pierre Gondois [Fri, 8 Oct 2021 14:46:21 +0000 (15:46 +0100)]
DynamicTablesPkg: AML Code generation for Register()

Add AmlCodeGenRegister() to generate AML code for the
Generic Register Resource Descriptor. This function is
equivalent to the ASL macro Register().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Make AmlNodeGetIntegerValue public
Pierre Gondois [Fri, 8 Oct 2021 14:46:20 +0000 (15:46 +0100)]
DynamicTablesPkg: Make AmlNodeGetIntegerValue public

Remove the STATIC qualifier for the AmlUtility function
AmlNodeGetIntegerValue() and add the definition to the
header file so that it can be used by other AmlLib
sub-modules.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Update error handling for node creation
Pierre Gondois [Fri, 8 Oct 2021 14:46:19 +0000 (15:46 +0100)]
DynamicTablesPkg: Update error handling for node creation

The node creation functions:
- AmlCreateRootNode()
- AmlCreateObjectNode()
- AmlCreateDataNode()
are now resetting the input pointer where the created node is stored.
Thus, it is not necessary to set some local variables to NULL or
check a node value before trying to delete it.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Clear pointer in node creation fcts
Pierre Gondois [Fri, 8 Oct 2021 14:46:18 +0000 (15:46 +0100)]
DynamicTablesPkg: Clear pointer in node creation fcts

The following functions:
- AmlCreateRootNode()
- AmlCreateObjectNode()
- AmlCreateDataNode()
create a node and return it by populating a pointer. This pointer
should only be considered/used if the function returns successfully.
Otherwise, the value stored in this pointer should be ignored.

For their error handling, some other functions assume that this
pointer is reset to NULL if an error occurs during a node creation.
To make this assumption correct, explicitly clear this input pointer.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Set EndTag's Checksum if RdList is modified
Pierre Gondois [Fri, 8 Oct 2021 14:46:17 +0000 (15:46 +0100)]
DynamicTablesPkg: Set EndTag's Checksum if RdList is modified

ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

To avoid re-computing checksums, if a new resource data elements is
added/removed/modified in a list of resource data elements, the AmlLib
resets the checksum to 0.

This patch also refactors the AmlAppendRdNode() function by getting the
last Resource Data node directly instead of iterating over all the
elements of the list of Resource Data node.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Add AmlSetRdListCheckSum()
Pierre Gondois [Fri, 8 Oct 2021 14:46:16 +0000 (15:46 +0100)]
DynamicTablesPkg: Add AmlSetRdListCheckSum()

Lists of Resource Data elements end with an EndTag (most of the time).
This function finds the EndTag (if present) in a list of Resource Data
elements and sets the checksum.

ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the data
bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Add AmlRdSetEndTagChecksum()
Pierre Gondois [Fri, 8 Oct 2021 14:46:15 +0000 (15:46 +0100)]
DynamicTablesPkg: Add AmlRdSetEndTagChecksum()

Add AmlRdSetEndTagChecksum(), setting the CheckSum value contained in a
Resource Data element.

ACPI 6.4, s6.4.2.9 "End Tag":
"This checksum is generated such that adding it to the sum of all the
data bytes will produce a zero sum."
"If the checksum field is zero, the resource data is treated as if the
checksum operation succeeded. Configuration proceeds normally."

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Add AddSsdtAcpiHeader()
Pierre Gondois [Fri, 8 Oct 2021 14:46:14 +0000 (15:46 +0100)]
DynamicTablesPkg: Add AddSsdtAcpiHeader()

To fetch the Oem information from the ConfigurationManagerProtocol
and the AcpiTableInfo, and populate the SSDT ACPI header when
creating a RootNode via the AmlLib, create AddSsdtAcpiHeader().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Add missing parameter check
Pierre Gondois [Fri, 8 Oct 2021 14:46:13 +0000 (15:46 +0100)]
DynamicTablesPkg: Add missing parameter check

Add missing check of 'AcpiTableInfo' in AddAcpiHeader().

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoDynamicTablesPkg: Remove unnecessary includes
Pierre Gondois [Fri, 8 Oct 2021 14:46:12 +0000 (15:46 +0100)]
DynamicTablesPkg: Remove unnecessary includes

Some includes are not necessary. Remove them.

Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
2 years agoShellPkg: Update Acpiview HMAT parser to ACPI spec version 6.4
Chris Jones [Wed, 14 Jul 2021 11:45:12 +0000 (12:45 +0100)]
ShellPkg: Update Acpiview HMAT parser to ACPI spec version 6.4

Add parser support for the new "MinTransferSize" field of the System
Locality, Latency and Bandwidth structure, introduced by the ACPI
specification version 6.4.

Also update the HMAT parser to use the newer ACPI version 6.4
definitions.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhcihao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoMdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()
Hua Ma [Wed, 29 Sep 2021 05:08:14 +0000 (13:08 +0800)]
MdeModulePkg/Core/Dxe: Add lock protection in CoreLocateHandleBuffer()

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

Currently, CoreLocateHandleBuffer() follows three steps:
1) get the size of protocol database firstly
2) allocate the buffer based on the size
3) get the protocol database into the buffer
There is no lock protection for the whole three steps. If a new protocol
added in step 2) by other task, e.g. (event timer handle USB device
hotplug). The size of protocol database may be increased and cannot fit
into the previous buffer in step 3). The protocol database cannot be
returned successfully, EFI_BUFFER_TOO_SMALL error will be returned.

This patch adds the lock to protect the whole three steps.
It can make sure the correct protocol database be returned.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Signed-off-by: Hua Ma <hua.ma@intel.com>
Reviewed-by: Dandan Bi dandan.bi@intel.com
Reviewed-by: Liming Gao gaoliming@byosoft.com.cn
2 years agoShellPkg: Add Type 5 PCC Subspace Structure parser
Chris Jones [Fri, 13 Aug 2021 17:02:45 +0000 (18:02 +0100)]
ShellPkg: Add Type 5 PCC Subspace Structure parser

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

Update the Acpiview PCCT parser with the HW Registers based
Communications Subspace Structure (Type 5) as defined in Section 14.1.7
of the ACPI 6.4 specification.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar <sami.mujawar@arm.com>
2 years agoShellPkg: Update Acpiview PCCT parser to ACPI 6.4
Chris Jones [Fri, 13 Aug 2021 17:02:44 +0000 (18:02 +0100)]
ShellPkg: Update Acpiview PCCT parser to ACPI 6.4

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

Update the Acpiview PCCT parser to use Acpi64.h.

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar <sami.mujawar@arm.com>
2 years agoShellPkg: Update Acpiview GTDT parser to ACPI 6.4
Chris Jones [Mon, 16 Aug 2021 14:52:18 +0000 (15:52 +0100)]
ShellPkg: Update Acpiview GTDT parser to ACPI 6.4

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

Update the Acpiview GTDT parser to use Acpi64.h and as such rename all
occurences of "SBSA Generic Watchdog" to "Arm Generic Watchdog".

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Rename SBSA generic watchdog
Chris Jones [Mon, 16 Aug 2021 14:52:17 +0000 (15:52 +0100)]
DynamicTablesPkg: Rename SBSA generic watchdog

Buzilla: 3565 (https://bugzilla.tianocore.org/show_bug.cgi?id=3565)

As part of the updates to ACPI 6.4 the "SBSA Generic Watchdog" was
renamed to the "Arm Generic Watchdog". This patch implements that
change by updating the GTDT generator to use Acpi64.h and renames
any occurence of "SBSA Generic Watchdog" to "Arm Generic Watchdog".

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoDynamicTablesPkg: Update FADT generator to ACPI 6.4
Chris Jones [Tue, 17 Aug 2021 13:50:58 +0000 (14:50 +0100)]
DynamicTablesPkg: Update FADT generator to ACPI 6.4

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

Update the FADT generator to use Acpi64.h. As the FADT revision tracks
the ACPI revision this updates the minor revision value generated.

Mantis ID for change: https://mantis.uefi.org/mantis/view.php?id=2105

Signed-off-by: Chris Jones <christopher.jones@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
2 years agoOvmfPkg/Microvm: add Maintainers.txt entry
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:19 +0000 (11:01 +0200)]
OvmfPkg/Microvm: add Maintainers.txt entry

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Leif Lindholm <leif@nuviainc.com>
2 years agoOvmfPkg/Microvm: wire up serial console, drop super-io
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:17 +0000 (11:01 +0200)]
OvmfPkg/Microvm: wire up serial console, drop super-io

Microvm has no LPC bridge, so drop the PciSioSerialDxe driver.
Use SerialDxe instead, with ioport hardcoded to 0x3f8 aka com1 aka ttyS0.

With this tianocore boots to uefi shell prompt on the serial console.
Direct kernel boot can be used too.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: use PciHostBridgeLibNull
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:16 +0000 (11:01 +0200)]
OvmfPkg/Microvm: use PciHostBridgeLibNull

Shortcut PCI support for now (proper PCIe
support will be wired up later).

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: BdsPlatform: PciAcpiInitialization tweak.
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:15 +0000 (11:01 +0200)]
OvmfPkg/Microvm: BdsPlatform: PciAcpiInitialization tweak.

Nothing to do here ;)

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/ResetSystemLib: add driver for microvm
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:14 +0000 (11:01 +0200)]
OvmfPkg/ResetSystemLib: add driver for microvm

Uses the generic event device to reset and poweroff.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: PlatformPei/Platform: add id.
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:13 +0000 (11:01 +0200)]
OvmfPkg/Microvm: PlatformPei/Platform: add id.

Add + set microvm id for PcdOvmfHostBridgePciDevId.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: PlatformPei/Platform memory map tweaks
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:12 +0000 (11:01 +0200)]
OvmfPkg/Microvm: PlatformPei/Platform memory map tweaks

Microvm needs ioapic hobs only.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: PlatformPei/MemDetect tweaks
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:11 +0000 (11:01 +0200)]
OvmfPkg/Microvm: PlatformPei/MemDetect tweaks

Skip host bridge setup on microvm.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: use XenTimerDxe (lapic timer)
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:10 +0000 (11:01 +0200)]
OvmfPkg/Microvm: use XenTimerDxe (lapic timer)

Microvm has no acpi timer, so go use XenTimerDxe
which uses the local apic instead.

Set PcdFSBClock to 1000 MHz, which is the lapic
timer frequency used by KVM.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: use MdePkg/Library/SecPeiDxeTimerLibCpu
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:09 +0000 (11:01 +0200)]
OvmfPkg/Microvm: use MdePkg/Library/SecPeiDxeTimerLibCpu

Microvm has no acpi timer, so use the generic lib instead.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: no emulated scsi
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:08 +0000 (11:01 +0200)]
OvmfPkg/Microvm: no emulated scsi

Microvm focus is virtio, so go drop support
for emulated scsi host adapters.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: no csm
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:07 +0000 (11:01 +0200)]
OvmfPkg/Microvm: no csm

Guests depending on BIOS will probably not work that well with microvm
due to legacy hardware being not available.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
2 years agoOvmfPkg/Microvm: no sev
Gerd Hoffmann [Wed, 8 Sep 2021 09:01:06 +0000 (11:01 +0200)]
OvmfPkg/Microvm: no sev

Microvm has no SEV support.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3599
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>