]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
13 months agoUefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm master
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:54 +0000 (14:09 +0800)]
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg: Rename AsmRelocateApLoopStart.
Yuanhao Xie [Wed, 1 Mar 2023 06:09:53 +0000 (14:09 +0800)]
UefiCpuPkg: Rename AsmRelocateApLoopStart.

Rename AsmRelocateApLoopStart to AsmRelocateApLoopStartAmdSev

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg: Put APs in 64 bit mode before handoff to OS.
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:52 +0000 (14:09 +0800)]
UefiCpuPkg: Put APs in 64 bit mode before handoff to OS.

Add the 'AsmRelocateApLoopStartGeneric' for X64 processors except 64-bit
 AMD processors with SEV-ES.

Remove the unused arguments of AsmRelocateApLoopStartGeneric, updated
the stack offset.

Create PageTable for the allocated reserved memory.

Only keep 4GB limitation of memory allocation for the case APs still
need to be transferred to 32-bit mode before OS.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiPayloadPkg: Add CpuPageTableLib required by MpInitLib.
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:51 +0000 (14:09 +0800)]
UefiPayloadPkg: Add CpuPageTableLib required by MpInitLib.

Add CpuPageTableLib required by MpInitLib in UefiPayloadPkg.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoOvmfPkg: Add CpuPageTableLib required by MpInitLib.
Yuanhao Xie [Wed, 1 Mar 2023 06:09:50 +0000 (14:09 +0800)]
OvmfPkg: Add CpuPageTableLib required by MpInitLib.

Add CpuPageTableLib required by MpInitLib in OvmfPkg.

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>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg: Allocate contiguous memory for stacks and APs loop.
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:49 +0000 (14:09 +0800)]
UefiCpuPkg: Allocate contiguous memory for stacks and APs loop.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg: Split the path in RelocateApLoop into two.
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:48 +0000 (14:09 +0800)]
UefiCpuPkg: Split the path in RelocateApLoop into two.

Add the union RELOCATE_AP_LOOP_ENTRY, split the path in RelocateApLoop
 into two:
 1. 64-bit AMD processors with SEV-ES
 2. Intel processors (32-bit or 64-bit), 32-bit AMD processors, or
 64-bit AMD processors without SEV-ES.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg: Check AP_SAFE_STACK_SIZE during build time.
Xie, Yuanhao [Wed, 1 Mar 2023 06:09:47 +0000 (14:09 +0800)]
UefiCpuPkg: Check AP_SAFE_STACK_SIZE during build time.

Check if AP_SAFE_STACK_SIZE is aligned with CPU_STACK_ALIGNMENT
during build time.

No functional or structural changes.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoMdeModulePkg: Improve formatting of DEBUG messages in UsbBusDxe
Rebecca Cran [Fri, 24 Feb 2023 00:18:01 +0000 (08:18 +0800)]
MdeModulePkg: Improve formatting of DEBUG messages in UsbBusDxe

Improve the formatting of DEBUG messages in UsbBusDxe by adding
a hyphen to separate the EFI_STATUS code.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
13 months agoOvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:33 +0000 (14:16 +0800)]
OvmfPkg/SmmCpuFeaturesLib: Check SmBase relocation supported or not

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

This patch is to check SmBase relocation supported or not.
If gSmmBaseHobGuid found, means SmBase info has been relocated
and recorded in the SmBase array. ASSERT it's not supported in OVMF.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:32 +0000 (14:16 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Skip SMBASE configuration

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

This patch is to avoid configure SMBASE if SmBase relocation has been
done. If gSmmBaseHobGuid found, means SmBase info has been relocated
and recorded in the SmBase array. No need to do the relocation in
SmmCpuFeaturesInitializeProcessor().

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:31 +0000 (14:16 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Consume SMM Base Hob for SmBase info

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

Existing SMBASE Relocation is in the PiSmmCpuDxeSmm driver, which
will relocate the SMBASE of each processor by setting the SMBASE
field in the saved state map (at offset 7EF8h) to a new value.
The RSM instruction reloads the internal SMBASE register with the
value in SMBASE field when each time it exits SMM. All subsequent
SMI requests will use the new SMBASE to find the starting address
for the SMI handler (at SMBASE + 8000h).

Due to the default SMBASE for all x86 processors is 0x30000, the
APs' 1st SMI for rebase has to be executed one by one to avoid
the processors over-writing each other's SMM Save State Area (see
existing SmmRelocateBases() function), which means the next AP has
to wait for the previous AP to finish its 1st SMI, then it can call
into its 1st SMI for rebase via Smi Ipi command, thus leading the
existing SMBASE Relocation has to be running in series. Besides, it
needs very complex code to handle the AP exit semaphore
(mRebased[Index]), which will hook return address of SMM Save State
so that semaphore code can be executed immediately after AP exits
SMM for SMBASE relocation (see existing SemaphoreHook() function).

With SMM Base Hob support, PiSmmCpuDxeSmm does not need the RSM
instruction to do the SMBASE Relocation. SMBASE Register for each
processors have already been programmed and all SMBASE address have
recorded in SMM Base Hob. So the same default SMBASE Address
(0x30000) will not be used, thus the processors over-writing each
other's SMM Save State Area will not happen in PiSmmCpuDxeSmm driver.
This way makes the first SMI init can be executed in parallel and
save boot time on multi-core system. Besides, Semaphore Hook code
logic is also not required, which will greatly simplify the SMBASE
Relocation flow.

Mainly changes as below:
* Assume the biggest possibility of tile size is 8k.
* Combine 2 SMIs (gcSmmInitTemplate & gcSmiHandlerTemplate) into one
(gcSmiHandlerTemplate), the new SMI handler needs to run to 2 paths:
one to SmmCpuFeaturesInitializeProcessor(), the other to SMM Core
Entry Point.
* Issue SMI IPI (All Excluding Self SMM IPI + BSP SMM IPI) for first
SMI init before normal SMI sources happen.
* Call SmmCpuFeaturesInitializeProcessor() in parallel.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
13 months agoUefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:30 +0000 (14:16 +0800)]
UefiCpuPkg/SmmBaseHob.h: Add SMM Base HOB Data

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

The default SMBASE for the x86 processor is 0x30000. When
SMI happens, processor runs the SMI handler at SMBASE+0x8000.
Also, the SMM save state area is within SMBASE+0x10000.

One of the SMM initialization from processor perspective is to
relocate and program the new SMBASE (in TSEG range) for each
processor. When the SMBASE relocation happens in a PEI module,
the PEI module shall produce the SMM_BASE_HOB in HOB database
which tells the PiSmmCpuDxeSmm driver (runs at a later phase)
about the new SMBASE for each processor. PiSmmCpuDxeSmm driver
installs the SMI handler at the SMM_BASE_HOB.SmBase[Index]+0x8000
for processor Index. When the HOB doesn't exist, PiSmmCpuDxeSmm
driver shall relocate and program the new SMBASE itself.

This patch adds the SMM Base HOB for any PEI module to do
the SmBase relocation ahead of PiSmmCpuDxeSmm driver and
store the relocated SmBase address in array for each
processor.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
13 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId check
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:29 +0000 (14:16 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Replace mIsBsp by mBspApicId check

This patch is to replace mIsBsp by mBspApicId check.
mIsBsp becomes the local variable (IsBsp), then it can be
checked dynamically in the function. Instead, we define the
mBspApicId, which is to record the BSP ApicId used for
compare in SmmInitHandler. With this change, SmmInitHandler
can be run in parallel during SMM init.

Note:
This patch is the per-prepared work by refining the
SmmInitHandler, then, we can do the next step to
combine 2 SMIs (gcSmmInitTemplate & gcSmiHandlerTemplate)
into one (gcSmiHandlerTemplate), the new SMI handler
will call the SmmInitHandler in parallel to do the init.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
13 months agoUefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call
Wu, Jiaxin [Thu, 16 Feb 2023 06:16:28 +0000 (14:16 +0800)]
UefiCpuPkg/PiSmmCpuDxeSmm: Fix invalid InitializeMpSyncData call

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

No need call InitializeMpSyncData during normal boot SMI init,
because mSmmMpSyncData is NULL at that time. mSmmMpSyncData is
allocated in InitializeMpServiceData, which is invoked after
normal boot SMI init (SmmRelocateBases).

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Ray Ni <ray.ni@Intel.com>
13 months agoRedfishPkg/RedfishDebugLib: provide Redfish debug
Nickle Wang [Wed, 1 Mar 2023 08:44:57 +0000 (16:44 +0800)]
RedfishPkg/RedfishDebugLib: provide Redfish debug

Introduce RedfishDebugLib to RedfishPkg. This library provides several
debugging functions for Redfish application. Redfish drivers rely on
Rest Ex protocol to communicate with BMC and the communication data
may be big and complicated. Use RedfishDebugLib in RedfishRestExDxe to
simplify debugging process.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
13 months agoShellPkg: Improve "ping" output by adding equals sign after time
Rebecca Cran [Thu, 1 Dec 2022 21:49:35 +0000 (05:49 +0800)]
ShellPkg: Improve "ping" output by adding equals sign after time

The output of the "ping" command shows the time without a space between
the label and the value. e.g.:

20 bytes from 192.168.0.1 : icmp_seq=1 ttl=1 time1~2ms

Improve the readability and consistency by adding an equals sign for the
time value:

20 bytes from 192.168.0.1 : icmp_seq=1 ttl=1 time=1~2ms

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
13 months agoOvmfPkg/RiscVVirt: Add Stack HOB edk2-stable202302
Sunil V L [Sat, 25 Feb 2023 05:32:00 +0000 (13:32 +0800)]
OvmfPkg/RiscVVirt: Add Stack HOB

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

Currently, stack HOB is not created for the stack memory. This causes
stack memory to be treated as free memory and any memory allocation which
happens at this address causes random memory corruption. Fix this by
creating the stack HOB which marks the memory as BS data.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Andrei Warkentin <andrei.warkentin@intel.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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reported-by: Andrei Warkentin <andrei.warkentin@intel.com>
Tested-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
13 months agoUefiPayloadPkg: remove the change that get platform specific logic
MarsX Lin [Tue, 3 Jan 2023 06:55:20 +0000 (14:55 +0800)]
UefiPayloadPkg: remove the change that get platform specific logic

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

Since UefiPayloadPkg had supported multiple firmware volume,
remove the platform specific logic via protocol

Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: Gua Guo <gua.guo@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Guo Dong <guo.dong@intel.com>
Signed-off-by: MarsX Lin <marsx.lin@intel.com>
13 months agoOvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure
Sunil V L [Wed, 22 Feb 2023 02:36:59 +0000 (10:36 +0800)]
OvmfPkg/RiscVVirt: Fix SCT memory allocation test case failure

Fix the UEFI memory range calculation by including the correct
stack memory range. Without this fix, SCT hangs in MemoryAllocation
test cases which call AllocateAddress().

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: Andrei Warkentin <andrei.warkentin@intel.com>
Reported-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
13 months agoBaseTools/tools_def.template: Update -march parameter for RISC-V
Sunil V L [Wed, 22 Feb 2023 02:37:10 +0000 (10:37 +0800)]
BaseTools/tools_def.template: Update -march parameter for RISC-V

Replace rv64imafdc with rv64gc so that it works for gcc 12.

"g" means imafd in gcc < 12 and imafd_zifencei_zicsr in gcc >= 12.
So, replacing rv64imafdc with rv64gc will work for both gcc <12
and gcc >=12.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Andrei Warkentin <andrei.warkentin@intel.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoBaseTools: Update WindowsVsToolChain plugin
Joey Vagedes [Thu, 16 Feb 2023 05:54:16 +0000 (05:54 +0000)]
BaseTools: Update WindowsVsToolChain plugin

This patch updates edk2-pytool-library dependency to v0.14.0, which has
an interface change to FindWithVsWhere. The BaseTools plugin uses this
function, so it is being updated to account for the interface change.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Joey Vagedes <joeyvagedes@microsoft.com>
Acked-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMaintainers.txt: Add entry for OvmfPkg/RiscVVirt
Sunil V L [Sat, 28 Jan 2023 18:10:51 +0000 (23:40 +0530)]
Maintainers.txt: Add entry for OvmfPkg/RiscVVirt

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

RiscVVirt is created to support EDK2 for RISC-V qemu
virt machine platform. Add maintainer entries.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg/RiscVVirt: Add build files for Qemu Virt platform
Sunil V L [Sat, 28 Jan 2023 15:33:59 +0000 (21:03 +0530)]
OvmfPkg/RiscVVirt: Add build files for Qemu Virt platform

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

Add infrastructure files to build edk2 for RISC-V qemu virt machine.

- It follows PEI less design.
- EDK2 for qemu virt is booted in S-mode as a payload for M-mode FW
- Leveraged from ArmVirtQemu

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
14 months agoOvmfPkg/RiscVVirt: Add SEC module
Sunil V L [Sat, 28 Jan 2023 15:32:23 +0000 (21:02 +0530)]
OvmfPkg/RiscVVirt: Add SEC module

Add the SEC module for RISC-V Qemu virt machine support.
It uses the PEI less design.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg/RiscVVirt: Add PciCpuIo2Dxe module
Sunil V L [Sat, 28 Jan 2023 15:31:04 +0000 (21:01 +0530)]
OvmfPkg/RiscVVirt: Add PciCpuIo2Dxe module

Add PciCpuIo2Dxe driver to implement EFI_CPU_IO2_PROTOCOL
to add the translation for IO access. This is copied from
ArmPciCpuIo2Dxe driver.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
14 months agoOvmfPkg/RiscVVirt: Add VirtNorFlashPlatformLib library
Sunil V L [Sat, 28 Jan 2023 15:29:36 +0000 (20:59 +0530)]
OvmfPkg/RiscVVirt: Add VirtNorFlashPlatformLib library

Qemu NOR flash driver needs this library. Add this
library for RISC-V leveraged from SbsaQemu.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg/RiscVVirt: Add ResetSystemLib library
Sunil V L [Sat, 28 Jan 2023 18:01:13 +0000 (23:31 +0530)]
OvmfPkg/RiscVVirt: Add ResetSystemLib library

RISC-V Qemu virt uses SBI calls to implement the reset.
Add the base class library.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
14 months agoOvmfPkg/RiscVVirt: Add PrePiHobListPointerLib library
Sunil V L [Sat, 28 Jan 2023 15:26:15 +0000 (20:56 +0530)]
OvmfPkg/RiscVVirt: Add PrePiHobListPointerLib library

Add the PrePiHobListPointerLib required for RISC-V Qemu Virt machine
since it follows PEIless design.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg/RiscVVirt: Add PlatformBootManagerLib library
Sunil V L [Sat, 28 Jan 2023 15:22:02 +0000 (20:52 +0530)]
OvmfPkg/RiscVVirt: Add PlatformBootManagerLib library

RISC-V Qemu Virt platfform needs the PlatformBootManagerLib similar
to the one in ArmVirtPlatform. Add the library in OvmfPkg/RiscVVirt
leveraging the one from Arm.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Acked-by: Jiewen Yao <Jiewen.yao@intel.com>
14 months agoArmVirtPkg: Fix up the location of PlatformHasAcpiDtDxe
Sunil V L [Wed, 21 Sep 2022 01:08:18 +0000 (06:38 +0530)]
ArmVirtPkg: Fix up the location of PlatformHasAcpiDtDxe

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

PlatformHasAcpiDtDxe is required by other architectures also.
Hence, it is moved to OvmfPkg. So, update the consumers of this
module with the new location.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoArmVirtPkg/PlatformHasAcpiDtDxe: Move to OvmfPkg
Sunil V L [Wed, 21 Sep 2022 01:06:37 +0000 (06:36 +0530)]
ArmVirtPkg/PlatformHasAcpiDtDxe: Move to OvmfPkg

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

This module is required by other architectures like RISC-V.
Hence, move this to OvmfPkg.

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>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
14 months agoUefiCpuPkg/UefiCpuPkg.ci.yaml: Ignore RISC-V file
Sunil V L [Sun, 9 Oct 2022 12:51:29 +0000 (18:21 +0530)]
UefiCpuPkg/UefiCpuPkg.ci.yaml: Ignore RISC-V file

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

RISC-V register names do not follow the EDK2 formatting.
So, add it to ignore list for now.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Ray Ni <ray.ni@intel.com>
14 months agoUefiCpuPkg: Add CpuDxeRiscV64 module
Sunil V L [Thu, 15 Dec 2022 05:43:44 +0000 (11:13 +0530)]
UefiCpuPkg: Add CpuDxeRiscV64 module

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

This is copied from
edk2-platforms/Silicon/RISC-V/ProcessorPkg/Universal/CpuDxe
and added the RISCV_EFI_BOOT_PROTOCOL support.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
14 months agoUefiCpuPkg: Add CpuTimerDxeRiscV64 module
Sunil V L [Tue, 23 Aug 2022 16:52:20 +0000 (22:22 +0530)]
UefiCpuPkg: Add CpuTimerDxeRiscV64 module

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

This DXE module initializes the timer interrupt handler
and installs the Arch Timer protocol.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ray Ni <ray.ni@Intel.com>
14 months agoUefiCpuPkg: Add BaseRiscV64CpuTimerLib library
Sunil V L [Wed, 5 Oct 2022 06:02:50 +0000 (11:32 +0530)]
UefiCpuPkg: Add BaseRiscV64CpuTimerLib library

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

Add the RISC-V instance of the TimerLib.

This is mostly copied from
edk2-platforms/Silicon/RISC-V/ProcessorPkg/Library/RiscVTimerLib

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ray Ni <ray.ni@Intel.com>
14 months agoUefiCpuPkg: Add BaseRiscV64CpuExceptionHandlerLib
Sunil V L [Thu, 15 Dec 2022 05:32:43 +0000 (11:02 +0530)]
UefiCpuPkg: Add BaseRiscV64CpuExceptionHandlerLib

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

Add Cpu Exception Handler library for RISC-V. This is copied
from edk2-platforms/Silicon/RISC-V/ProcessorPkg/Library/RiscVExceptionLib

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ray Ni <ray.ni@Intel.com>
14 months agoUefiCpuPkg: Add RISCV_EFI_BOOT_PROTOCOL related definitions
Sunil V L [Fri, 27 Jan 2023 09:57:54 +0000 (15:27 +0530)]
UefiCpuPkg: Add RISCV_EFI_BOOT_PROTOCOL related definitions

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

RISC-V UEFI based platforms need to support RISCV_EFI_BOOT_PROTOCOL.
Add this protocol GUID definition and the header file required.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Acked-by: Ray Ni <ray.ni@intel.com>
14 months agoMdePkg: Add BaseRiscVSbiLib Library for RISC-V
Sunil V L [Wed, 7 Sep 2022 06:53:32 +0000 (12:23 +0530)]
MdePkg: Add BaseRiscVSbiLib Library for RISC-V

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

This library is required to make SBI ecalls from the S-mode EDK2.
This is mostly copied from
edk2-platforms/Silicon/RISC-V/ProcessorPkg/Library/RiscVEdk2SbiLib

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoMdePkg/BaseLib: RISC-V: Add few more helper functions
Sunil V L [Tue, 6 Sep 2022 05:18:12 +0000 (10:48 +0530)]
MdePkg/BaseLib: RISC-V: Add few more helper functions

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

Few of the basic helper functions required for any
RISC-V CPU were added in edk2-platforms. To support
qemu virt, they need to be added in BaseLib.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoMdePkg/Register: Add register definition header files for RISC-V
Sunil V L [Tue, 23 Aug 2022 16:44:08 +0000 (22:14 +0530)]
MdePkg/Register: Add register definition header files for RISC-V

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

Add register definitions and access routines for RISC-V. These
headers are leveraged from opensbi repo.

Cc: Daniel Schaefer <git@danielschaefer.me>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Acked-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Andrei Warkentin <andrei.warkentin@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoMdePkg: Added Call for AfterReadyToBoot Event
Robert Phelps [Wed, 21 Dec 2022 20:28:06 +0000 (04:28 +0800)]
MdePkg: Added Call for AfterReadyToBoot Event

In the function EfiSignalEventReadyToBoot, Code was added to also create,
signal, and close the AfterReadyToBoot event.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Robert Phelps <robert@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdePkg: Add After Ready To Boot Event Definition from UEFI 2.9
Robert Phelps [Wed, 9 Nov 2022 21:46:09 +0000 (05:46 +0800)]
MdePkg: Add After Ready To Boot Event Definition from UEFI 2.9

Add After Ready To Boot Event Definitions

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Robert Phelps <robert@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert
lijun10x [Thu, 2 Feb 2023 06:20:57 +0000 (14:20 +0800)]
MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert

Some platforms don't support S3 with PcdAcpiS3Enable set as False.
Debug mode bios will ASSERT at this time as Follows.
ASSERT_RETURN_ERROR (Status = Out of Resources)
DXE_ASSERT!: Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c
(61): !(((INTN)(RETURN_STATUS)(Status)) < 0)

Steps to reproduce the issue:
1.Set PcdAcpiS3Enable to FALSE.
2.Build the bios in debug mode.
3.Power on and Check the serial log.
Note: Prerequisite is that S3PciSegmentLib is Called and
the caller's code is run.

Root Cause:
S3PciSegmentLib call S3BootScriptLib controlled by PcdAcpiS3Enable.
If PcdAcpiS3Enable set as false, S3BootScriptLib will return error
status(Out of Resources).
S3PciSegmentLib will ASSERT if S3BootScriptLib return error.

Solution:
Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled,
which behave as a null S3BootScriptLib instance which just return success
for no action is required to do.

Signed-off-by: JunX1 Li <junx1.li@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sunny Wang <sunny.wang@arm.com>
Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Cc: G Edhaya Chandran <edhaya.chandran@arm.com>
Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdeModulePkg/Variable: Attribute combination should return EFI_UNSUPPORTED
Stuart Yoder [Thu, 9 Feb 2023 22:30:58 +0000 (06:30 +0800)]
MdeModulePkg/Variable: Attribute combination should return EFI_UNSUPPORTED

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

Commit 21320ef66989 broke some tests in the AuthVar_Conf test
in edk2-test.  There are 2 testcases that invoke SetVariable
with the following attribute value:

(EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS)

EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and the UEFI spec
says this should return EFI_UNSUPPORTED.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Sunny Wang <Sunny.Wang@arm.com>
Signed-off-by: Stuart Yoder <stuart.yoder@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Sunny Wang <sunny.wang@arm.com>
14 months agoMdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance
devel@edk2.groups.io [Mon, 12 Dec 2022 19:27:26 +0000 (11:27 -0800)]
MdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstance

Skip error check if HardwareInstance is 0 as this either means that
FmpVersion < 3 and not supported or,
"A zero means the FMP provider is not able to determine a
unique hardware instance number or a hardware instance number
is not needed." per UEFI specification.

As the FmpInstances are merged and HardwareInstance is not used
remove error check in this case.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoMdeModulePkg/Pci: Display more information of PCIe devices
Abner Chang [Thu, 12 Jan 2023 05:14:17 +0000 (21:14 -0800)]
MdeModulePkg/Pci: Display more information of PCIe devices

In V4: Update the copyright to 2023.
In V3: Add AMD copyright.
In V2: Remove the signed-off-by: Abner Chang

Display PCIe Vendor ID and Device ID in DEBUG message.

Signed-off-by: Jiangang He <jiangang.he@amd.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoOvmfPkg/AmdSevDxe: Close mAcceptAllMemoryEvent
Dionna Glaze [Tue, 14 Feb 2023 23:07:19 +0000 (23:07 +0000)]
OvmfPkg/AmdSevDxe: Close mAcceptAllMemoryEvent

This event should only trigger once. It should be idempotent, but the
allocation of the memory map itself is observable and can cause
ExitBootServices to fail with a modified map key.

Cc: Thomas Lendacky <Thomas.Lendacky@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg: Fix SevMemoryAcceptance memory attributes
Dionna Glaze [Tue, 31 Jan 2023 19:08:37 +0000 (19:08 +0000)]
OvmfPkg: Fix SevMemoryAcceptance memory attributes

The hard-coded attributes for the re-added memory space should instead
forward the replaced descriptor's capabilities.

Tested on Linux with efi=debug. Prior to this change, an 8GiB VM running
a kernel without unaccepted memory support shows this entry

efi: mem94: [Conventional|   |  |CC|  |  |  |  |  |  |   |  |  |  |  ]
range=[0x0000000100000000-0x000000023fffffff] (5120MB)

This does not have the cache capabilities one would expect for system
memory, UC|WC|WT|WB.

After this change, the same entry becomes

efi: mem94: [Conventional|   |  |CC|  |  |  |  |  |  |   |WB|WT|WC|UC]
range=[0x0000000100000000-0x000000023fffffff] (5120MB)

This has all the expected attributes.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
[ardb: drop the EFI_MEMORY_CPU_CRYPTO flag - it isn't used anywhere else
       in EDK2 or Linux so it doesn't actually do anything, and it is
       unclear whether it is intended for use by the guest in the first
       place]
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
14 months ago.devcontainer/devcontainer.json: Add devcontainer file
Michael Kubacki [Fri, 20 Jan 2023 17:07:22 +0000 (12:07 -0500)]
.devcontainer/devcontainer.json: Add devcontainer file

Tianocore maintains container images in the tianocore/containers repo
and stores container images within the GitHub container registry.

https://github.com/tianocore/containers

This change adds a devcontainer.json file to the edk2 repo. This
file's metadata and settings to configurate a development container
for a given well-defined tool and runtime stack.

More information about the devcontainer.json file is available here:
https://containers.dev/implementors/json_reference/

This file is recognized by popular tools such as GitHub Codespaces
and VS Code. In VS Code in particular, it makes it much easier for
a user to be aware a dev container exists (via UI notifications)
and to load the container.

A minimal number of VS Code extensions are specified that are useful
for edk2 development or to assist in complying with CI checks in
place in edk2.

Cc: Andrew Fish <afish@apple.com>
Cc: Chris Fernald <chris.fernald@outlook.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Oliver Steffen <osteffen@redhat.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months ago.mergify/config.yml: Remove rebase_fallback attribute (deprecated)
Michael Kubacki [Mon, 13 Feb 2023 16:04:41 +0000 (08:04 -0800)]
.mergify/config.yml: Remove rebase_fallback attribute (deprecated)

PR builds and CI are currently broken due to a mergify brownout
today because edk2 uses the `rebase_fallback` attribute of the
`queue` action.

Message from Mergify/Summary:

```
  The configuration uses the deprecated rebase_fallback attribute
  of the queue action.

  A brownout is planned on February 13th, 2023.

  This option will be removed on March 13th, 2023.
  For more information: https://docs.mergify.com/actions/queue/
```

Therefore, this change removes the attribute per the guidance in
the following changelog message to retain existing behavior.

https://changelog.mergify.com/changelog/rebasefallback-is-deprecated

```
  The option rebase_fallback is now deprecated and should not be
  used anymore.

  Mergify will always report errors in the future if a rebase merge
  is impossible.
```

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Rebecca Cran <rebecca@bsdio.com>
14 months agoMdePkg: Add NVMe boot partition header definition
Weipu Zhu [Thu, 2 Feb 2023 06:41:54 +0000 (22:41 -0800)]
MdePkg: Add NVMe boot partition header definition

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

Add NVMe boot partition header definition to NVMe.h
according to NVMe spec 2.0.

Cc: Hao Wu <hao.a.wu@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>
Signed-off-by: Weipu Zhu <weipu.zhu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoMdePkg: Add RPMB related commands and DCB definition for NVMe
Weipu Zhu [Thu, 2 Feb 2023 06:41:40 +0000 (22:41 -0800)]
MdePkg: Add RPMB related commands and DCB definition for NVMe

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

Add RPMB(Replay Protected Memory Block) access commands,
result and DCB(Device Configuration Block) definition for
NVMe according to the NVMe spec 2.0.

Cc: Hao Wu <hao.a.wu@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>
Signed-off-by: Weipu Zhu <weipu.zhu@intel.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoRedfishPkg/RedfishRestExDxe: Two PCDs for controlling the requests
Abner Chang [Thu, 9 Feb 2023 18:05:12 +0000 (02:05 +0800)]
RedfishPkg/RedfishRestExDxe: Two PCDs for controlling the requests

Since BIOS should work with different BMC implementation chunked requests
as well as Expect header should be optional.
 - One PCD is used to enable/disable Expect header.
 - Another PCD is used to enable/disable chunked requests.

Reviewed-by: Abner Chang <abner.chang@amd.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Signed-off-by: Igor Kulchytskyy <igork@ami.com>
14 months agoStandaloneMmPkg/StandaloneMmMemLib: Change max address computation
Girish Mahadevan [Mon, 30 Jan 2023 16:28:58 +0000 (16:28 +0000)]
StandaloneMmPkg/StandaloneMmMemLib: Change max address computation

Currently the standalonemmlibinternal assumes the max physical bits
to be 36 which is causing issues on v8 architectures.
Instead use the MAX_ALLOC_ADDRESS macro to determine the maximum
allowed address rather than recomputing it locally.

Signed-off-by: Girish Mahadevan <gmahadevan@nvidia.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
14 months agoOvmfPkg: Update build.sh to allow building OVMF then running QEMU
Rebecca Cran [Wed, 8 Feb 2023 18:01:38 +0000 (11:01 -0700)]
OvmfPkg: Update build.sh to allow building OVMF then running QEMU

Allow users to build OVMF then run QEMU by moving the build block above
the run block and removing the exit line.

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
14 months agoEmulatorPkg/PeiTimerLib: Bug fix in NanoSecondDelay
Deric Cole [Wed, 8 Feb 2023 16:41:03 +0000 (08:41 -0800)]
EmulatorPkg/PeiTimerLib: Bug fix in NanoSecondDelay

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

Thunk->Sleep is expecting nanoseconds, no need to multiply by 100.

Cc: Andrew Fish <afish@apple.com>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Deric Cole <deric.cole@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
14 months ago.pytool/Plugin/EccCheck: Add PACKAGES_PATH support
Marvin Ha?user [Wed, 1 Feb 2023 14:47:50 +0000 (06:47 -0800)]
.pytool/Plugin/EccCheck: Add PACKAGES_PATH support

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

EccBuild currently assumes all packages reside in WORKSPACE. However,
this is obviously not the case for many setups. Most notably, Ext4Pkg
is located in edk2-platforms/Features and thus cannot be in WORKSPACE
in any reasonable setup.

Use Edk2Path to locate the package in WORKSPACE and PACKAGES_PATH.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Pedro Falcato <pedro.falcato@gmail.com>
Signed-off-by: Marvin H?user <mhaeuser@posteo.de>
Acked-by: Pedro Falcato <pedro.falcato@gmail.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
14 months agoMdePkg:IORT header update for IORT Rev E.e spec
Swatisri Kantamsetti [Wed, 25 Jan 2023 18:40:54 +0000 (02:40 +0800)]
MdePkg:IORT header update for IORT Rev E.e spec

The IO Remapping Table, Platform Design Document, Revision E.e,
Sept 2022 (https://developer.arm.com/documentation/den0049/ee)
added flags in SMMUv3 node for validity of ID mappings for MSIs
related to control interrupts.

Therefore, update the IORT header file to:
- increment IORT table revision to 6
- add support for DeviceId valid flag

Signed-off-by: Swatisri Kantamsetti <swatisrik@nvidia.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdeModulePkg: EfiUnacceptedMemoryType is not allowed in AllocatePool
Min M Xu [Wed, 18 Jan 2023 08:41:58 +0000 (16:41 +0800)]
MdeModulePkg: EfiUnacceptedMemoryType is not allowed in AllocatePool

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

MemoryType of EfiUnacceptedMemoryType should not be allocated in
AllocatePool. Instead it should return EFI_INVALID_PARAMETER.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Dandan Bi <dandan.bi@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Reported-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdeModulePkg: Disambiguate the meaning of PcdDxeIplSwitchToLongMode
Zhiguang Liu [Mon, 9 Jan 2023 03:34:22 +0000 (11:34 +0800)]
MdeModulePkg: Disambiguate the meaning of PcdDxeIplSwitchToLongMode

Literally, the meaning of PcdDxeIplSwitchToLongMode is clear, indicating
whether need switch to long mode when loading DxeCore.
However, the comments in dec are confusing for the case where PEI core and
DXE core are both in 64-bit. This patch makes it clear.
PcdDxeIplSwitchToLongMode is true only when PEI core is 32-bit, and switch
to long mode to load 64-bit DXE core. In other cases, this PCD is false.
This also aligns with current usage in OvmfPkg.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Ray Ni <ray.ni@intel.com>
14 months agoBaseTools: remove useless dependency on libuuid
Thierry LARONDE [Tue, 31 Jan 2023 18:14:21 +0000 (19:14 +0100)]
BaseTools: remove useless dependency on libuuid

Signed-off-by: Thierry LARONDE <tlaronde@polynum.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoRedfishPkg: fix multiple SMBIOS type 42 version issue
Nickle Wang [Wed, 1 Feb 2023 02:26:45 +0000 (10:26 +0800)]
RedfishPkg: fix multiple SMBIOS type 42 version issue

RedfishHostInterfaceDxe does not close protocol notify event in
event callback function. This could cause multiple version of
type 42 records issue if the protocol is installed more than once.
Close the event in callback function so we only create one type 42
record.

Signed-off-by: Nickle Wang <nicklew@nvidia.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Cc: Nick Ramirez <nramirez@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
14 months agoArmPkg/ArmScmiDxe: Fix the calculation of RequiredArraySize
Sudeep Holla [Fri, 3 Feb 2023 14:23:38 +0000 (14:23 +0000)]
ArmPkg/ArmScmiDxe: Fix the calculation of RequiredArraySize

As per the SCMI specification, section CLOCK_DESCRIBE_RATES mentions
that the value of num_rates_flags[11:0] in the response must be 3 if
the return format is the triplet. Due to the buggy firmware, this was
not noticed for long time. The firmware is now fixed resulting in
ClockDescribeRates() to fail with "Buffer Too Small" error as the
RequiredArraySize gets miscalculated as 72 instead of 24.

Fix the issue by reusing the logic for both the return format which
must work if num_rates_flags has correct value as expected from the
specification.

Cc: Girish Pathak <girish.pathak@arm.com>
Cc: Jeff Brasen <jbrasen@nvidia.com>
Reviewed-by: Pierre Gondois <pierre.gondois@arm.com>
Tested-by: Pierre Gondois <pierre.gondois@arm.com>
Reported-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Sudeep Holla <sudeep.holla@arm.com>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
Tested-by: Sami Mujawar <sami.mujawar@arm.com>
14 months agoOvmfPkg/IntelTdx: Update README
Min M Xu [Fri, 3 Feb 2023 14:04:25 +0000 (22:04 +0800)]
OvmfPkg/IntelTdx: Update README

TDVF's README is updated based on the latest feature.
 - RTMR based measurement is supported in OvmfPkgX64 (Config-A)
 - Features of Config-B have all been implemented, such as removing
   unnecessary attack surfaces.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
14 months agoSecurityPkg/TdTcg2Dxe: td-guest shall halt when CcMeasurement install fail
Min M Xu [Thu, 2 Feb 2023 09:04:14 +0000 (17:04 +0800)]
SecurityPkg/TdTcg2Dxe: td-guest shall halt when CcMeasurement install fail

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

CcMeasurement protocol is installed when it is supported in a td-guest. If
the installation of the protocol failed, the guest shall go into
CpuDeadLoop. Because the measurement feature is crucial to a td-guest and
it shall stop running immediately at this situation.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
14 months agoSecurityPkg: don't require PK to be self-signed by default
Jan Bobek [Fri, 20 Jan 2023 22:58:35 +0000 (06:58 +0800)]
SecurityPkg: don't require PK to be self-signed by default

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

Change the default value of PcdRequireSelfSignedPk to FALSE in
accordance with UEFI spec, which states that PK need not be
self-signed when enrolling in setup mode.

Note that this relaxes the legacy behavior, which required the PK to
be self-signed in this case.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Jan Bobek <jbobek@nvidia.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
14 months agoOvmfPkg: require self-signed PK when secure boot is enabled
Jan Bobek [Fri, 20 Jan 2023 22:58:33 +0000 (06:58 +0800)]
OvmfPkg: require self-signed PK when secure boot is enabled

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

In all DSC files that define SECURE_BOOT_ENABLE, opt-in into requiring
self-signed PK when SECURE_BOOT_ENABLE is TRUE.

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: Rebecca Cran <rebecca@bsdio.com>
Cc: Peter Grehan <grehan@freebsd.org>
Cc: Sebastien Boeuf <sebastien.boeuf@intel.com>
Signed-off-by: Jan Bobek <jbobek@nvidia.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
14 months agoSecurityPkg: limit verification of enrolled PK in setup mode
Jan Bobek [Fri, 20 Jan 2023 22:58:32 +0000 (06:58 +0800)]
SecurityPkg: limit verification of enrolled PK in setup mode

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

Per UEFI spec, enrolling a new PK in setup mode should not require a
self-signature. Introduce a feature PCD called PcdRequireSelfSignedPk
to control this requirement. Default to TRUE in order to preserve the
legacy behavior.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Co-authored-by: Matthew Carlson <macarl@microsoft.com>
Signed-off-by: Jan Bobek <jbobek@nvidia.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
14 months agoEmbeddedPkg/PrePiLib: Drop unused PCD PcdPrePiCpuIoSize
Ard Biesheuvel [Fri, 3 Feb 2023 11:02:57 +0000 (12:02 +0100)]
EmbeddedPkg/PrePiLib: Drop unused PCD PcdPrePiCpuIoSize

The code never references the PCD so the INF should not reference it
either. The last reference was moved to PrePiHobLib in commit
05e48e00834b32e4bd2 (dated 2011!) and dropped from there as well in
commit 97106391955337155e7.

Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Abner Chang <abner.chang@amd.com>
Cc: Daniel Schaefer <git@danielschaefer.me>
Reported-by: Sunil V L <sunilvl@ventanamicro.com>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
14 months agoOvmfPkg: Support Tdx measurement in OvmfPkgX64
Min M Xu [Fri, 3 Feb 2023 03:31:47 +0000 (11:31 +0800)]
OvmfPkg: Support Tdx measurement in OvmfPkgX64

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

This patch enables Tdx measurement in OvmfPkgX64 with below changes:
1) CC_MEASUREMENT_ENABLE is introduced in OvmfPkgX64.dsc. This flag
   indicates if Intel TDX measurement is enabled in OvmfPkgX64. Its
   default value is FALSE.
2) Include TdTcg2Dxe in OvmfPkgX64 so that CC_MEASUREMENT_PROTOCOL
   is installed in a Td-guest. TdTcg2Dxe is controlled by
   TDX_MEASUREMENT_ENABLE because it is only valid when Intel TDX
   measurement is enabled.
3) OvmfTpmLibs.dsc.inc and OvmfTpmSecurityStub.dsc.inc are updated
   because DxeTpm2MeasureBootLib.inf and DxeTpmMeasurementLib.inf
   should be included to support CC_MEASUREMENT_PROTOCOL.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/PlatformPei: Build GuidHob for Tdx measurement
Min M Xu [Fri, 3 Feb 2023 03:31:46 +0000 (11:31 +0800)]
OvmfPkg/PlatformPei: Build GuidHob for Tdx measurement

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

TdxHelperBuildGuidHobForTdxMeasurement is called in PlatformPei to build
GuidHob for Tdx measurement.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/OvmfPkgX64: Measure TdHob and Configuration FV in SecMain
Min M Xu [Fri, 3 Feb 2023 03:31:45 +0000 (11:31 +0800)]
OvmfPkg/OvmfPkgX64: Measure TdHob and Configuration FV in SecMain

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

TdHob and Configuration FV (Cfv) are external inputs from VMM. From the
security perspective, they should be measured before they're consumed.
This patch measures TdHob and Cfv and stores the measurement values in
WorkArea.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/IntelTdx: Add PeiTdxHelperLib
Min M Xu [Fri, 3 Feb 2023 03:31:44 +0000 (11:31 +0800)]
OvmfPkg/IntelTdx: Add PeiTdxHelperLib

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

TdxHelperLib provides below helper functions for a td-guest.
 - TdxHelperProcessTdHob
 - TdxHelperMeasureTdHob
 - TdxHelperMeasureCfvImage
 - TdxHelperBuildGuidHobForTdxMeasurement

PeiTdxHelperLib is the PEI instance of TdxHelperLib. It implements 1
function for tdx in PEI phase. Other functions are not supported in
PEI phase.
  - TdxHelperBuildGuidHobForTdxMeasurement builds GuidHob for tdx
    measurement in PEI phase.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/IntelTdx: Measure TdHob and Configuration FV in SecMain
Min M Xu [Fri, 3 Feb 2023 03:31:43 +0000 (11:31 +0800)]
OvmfPkg/IntelTdx: Measure TdHob and Configuration FV in SecMain

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

TdHob and Configuration FV (Cfv) are external inputs from VMM. From the
security perspective, they should be measured before they're consumed.
This patch measures TdHob and Cfv and stores the measurement values in
WorkArea.

After TdHob and Configuration FV (Cfv) are measured in SecMain, the
same measurements in PeilessStartupLib are deleted.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
14 months agoOvmfPkg: Refactor ProcessHobList
Min M Xu [Fri, 3 Feb 2023 03:31:42 +0000 (11:31 +0800)]
OvmfPkg: Refactor ProcessHobList

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

ProcessHobList once was implemented in PlatformInitLib and it walks thru
TdHob list and accept un-accepted memories.

This patch moves the codes to SecTdxHelperLib and rename ProcessHobList
as TdxHelperProcessTdHob

After TdxHelperProcessTdHob is introduced, below changes are applied:
 - Call TdxHelperProcessTdHob instead of ProcessHobList in SecMain.c
   (in both OvmfPkgX64/Sec and IntelTdx/Sec).
 - Delete the duplicated codes in PlatformInitLib

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg: Refactor MeaureFvImage
Min M Xu [Fri, 3 Feb 2023 03:31:41 +0000 (11:31 +0800)]
OvmfPkg: Refactor MeaureFvImage

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

MeasureFvImage once was implemented in PeilessStartupLib and it does
measurement and logging for Configuration FV (Cfv) image in one go,
using TpmMeasureAndLogData(). But it doesn't work in SEC.

This patch splits MeasureFvImage into 2 functions and implement them in
SecTdxHelperLib.
 - TdxHelperMeasureCfvImage
 - TdxHelperBuildGuidHobForTdxMeasurement

TdxHelperMeasureCfvImage measures the Cfv image and stores the hash value
in WorkArea. TdxHelperBuildGuidHobForTdxMeasurement builds GuidHob for the
measurement based on the hash value in WorkArea.

After these 2 functions are introduced, PeilessStartupLib should also be
updated:
 - Call these 2 functions instead of the MeasureFvImage
 - Delete the duplicated codes in PeilessStartupLib

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg: Refactor MeasureHobList
Min M Xu [Fri, 3 Feb 2023 03:31:40 +0000 (11:31 +0800)]
OvmfPkg: Refactor MeasureHobList

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

MeasureHobList once was implemented in PeilessStartupLib and it does
measurement and logging for TdHob in one go, using TpmMeasureAndLogData().
But it doesn't work in SEC.

This patch splits MeasureHobList into 2 functions and implement them in
SecTdxHelperLib.
 - TdxHelperMeasureTdHob
 - TdxHelperBuildGuidHobForTdxMeasurement

TdxHelperMeasureTdHob measures the TdHob and stores the hash value in
WorkArea. TdxHelperBuildGuidHobForTdxMeasurement builds GuidHob for the
measurement based on the hash value in WorkArea.

After these 2 functions are introduced, PeilessStartupLib should also be
updated:
 - Call these 2 functions instead of the MeasureHobList
 - Delete the duplicated codes in PeilessStartupLib

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/PeilessStartupLib: Update the define of FV_HANDOFF_TABLE_POINTERS2
Min M Xu [Fri, 3 Feb 2023 03:31:39 +0000 (11:31 +0800)]
OvmfPkg/PeilessStartupLib: Update the define of FV_HANDOFF_TABLE_POINTERS2

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

FV_HANDOFF_TABLE_POINTERS2 once was defined in IntelTdx.c. Its structure
is same as PLATFORM_FIRMWARE_BLOB2_STRUCT which is defined in
Library/TcgEventLogRecordLib.h. So this patch reuse the define of
PLATFORM_FIRMWARE_BLOB2_STRUCT as FV_HANDOFF_TABLE_POINTERS2. Furthermore
FV_HANDOFF_TABLE_POINTERS2 is renamed as CFV_HANDOFF_TABLE_POINTERS2
so that the name is more meaningful.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/IntelTdx: Add SecTdxHelperLib
Min M Xu [Fri, 3 Feb 2023 03:31:38 +0000 (11:31 +0800)]
OvmfPkg/IntelTdx: Add SecTdxHelperLib

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

TdxHelperLib provides below helper functions for a td-guest.
 - TdxHelperProcessTdHob
 - TdxHelperMeasureTdHob
 - TdxHelperMeasureCfvImage
 - TdxHelperBuildGuidHobForTdxMeasurement

SecTdxHelperLib is the SEC instance of TdxHelperLib. It implements 4
functions for tdx in SEC phase:
 - TdxHelperProcessTdHob consumes TdHob to accept un-accepted memories.
   Before the TdHob is consumed, it is first validated.

 - TdxHelperMeasureTdHob measure/extend TdHob and store the measurement
   value in workarea.

 - TdxHelperMeasureCfvImage measure/extend the Configuration FV image and
   store the measurement value in workarea.

 - TdxHelperBuildGuidHobForTdxMeasurement builds GuidHob for tdx
   measurement.

This patch implements the stubs of the functions. The actual
implementations are in the following patches. Because they are moved from
other files.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/IntelTdx: Add TdxHelperLibNull
Min M Xu [Fri, 3 Feb 2023 03:31:37 +0000 (11:31 +0800)]
OvmfPkg/IntelTdx: Add TdxHelperLibNull

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

TdxHelperLib provides below helper functions for a td-guest.
 - TdxHelperProcessTdHob
 - TdxHelperMeasureTdHob
 - TdxHelperMeasureCfvImage
 - TdxHelperBuildGuidHobForTdxMeasurement

TdxHelperLibNull is the NULL instance of TdxHelperLib.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg: Add Tdx measurement data structure in WorkArea
Min M Xu [Fri, 3 Feb 2023 03:31:36 +0000 (11:31 +0800)]
OvmfPkg: Add Tdx measurement data structure in WorkArea

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

From the perspective of security any external input should be measured
and extended to some registers (TPM PCRs or TDX RTMR registers).

There are below 2 external input in a Td guest:
 - TdHob
 - Configuration FV (CFV)

TdHob contains the resource information passed from VMM, such as
unaccepted memory region. CFV contains the configurations, such as
secure boot variables.

TdHob and CFV should be measured and extended to RTMRs before they're
consumed. TdHob is consumed in the very early stage of boot process.
At that moment the memory service is not ready. Cfv is consumed in
PlatformPei to initialize the EmuVariableNvStore. To make the
implementation simple and clean, these 2 external input are measured
and extended to RTMRs in SEC phase. That is to say the tdx measurement
is only supported in SEC phase.

After the measurement the hash values are stored in WorkArea. Then after
the Hob service is available, these 2 measurement values are retrieved
and GuidHobs for these 2 tdx measurements are generated.

This patch defines the structure of TDX_MEASUREMENTS_DATA in
SEC_TDX_WORK_AREA to store above 2 tdx measurements. It can be extended
to store more tdx measurements if needed in the future.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
14 months agoOvmfPkg/AcpiPlatformDxe: Measure ACPI table from QEMU in TDVF
Min M Xu [Thu, 2 Feb 2023 09:03:14 +0000 (17:03 +0800)]
OvmfPkg/AcpiPlatformDxe: Measure ACPI table from QEMU in TDVF

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

QEMU provides the following three files for guest to install the ACPI
tables:
 - etc/acpi/rsdp
 - etc/acpi/tables
 - etc/table-loader

"etc/acpi/rsdp" and "etc/acpi/tables" are similar, they are only kept
separate because they have different allocation requirements in SeaBIOS.

Both of these fw_cfg files contain preformatted ACPI payload.
"etc/acpi/rsdp" contains only the RSDP table, while "etc/acpi/tables"
contains all other tables, concatenated. To be noted, the tables in these
two files have been filled in by qemu, but two kinds of fields are
incomplete: pointers to other tables and checksums (which depend on the
pointers).

"/etc/table-loader" is a linker/loader which provides the commands to
"patch" the tables in "etc/acpi/tables" and then install them. "Patch"
means to fill the pointers and compute the checksum.

From the security perspective these 3 files are the raw data downloaded
from qemu. They should be measured and extended before they're consumed.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Cc: Michael Roth <michael.roth@amd.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
14 months agoMdeModulePkg: ScsiDiskDxe: clean up comment in ScsiDisk.c
Yuan Yu [Wed, 1 Feb 2023 06:31:17 +0000 (14:31 +0800)]
MdeModulePkg: ScsiDiskDxe: clean up comment in ScsiDisk.c

Comment of MdeModulePkg/Bus/Scsi/ScsiDiskDxe/ScsiDisk.c was polluted by
some previous merge. This patch clean it up.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sivaparvathi chellaiah <sivaparvathic@ami.com>
Signed-off-by: Yuan Yu <yuanyu@google.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
14 months agoUefiCpuPkg: Fix SMM code hangs when InitPaging
Zhiguang Liu [Wed, 4 Jan 2023 03:42:43 +0000 (11:42 +0800)]
UefiCpuPkg: Fix SMM code hangs when InitPaging

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

In function InitPaging, NumberOfPml5Entries is calculated by below code
NumberOfPml5Entries = (UINTN)LShiftU64 (1, SizeOfMemorySpace - 48);
If the SizeOfMemorySpace is larger than 48, NumberOfPml5Entries will be
larger than 1. However, this doesn't make sense if the hardware doesn't
support 5 level page table.

Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Star Zeng <star.zeng@intel.com>
Reviewed-by: Wu, Jiaxin <jiaxin.wu@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Acked-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Eric Dong <eric.dong@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
14 months agoMdePkg: Label CreateEvent NotifyFunction and NotifyContext optional
Rebecca Cran [Fri, 23 Dec 2022 23:48:12 +0000 (07:48 +0800)]
MdePkg: Label CreateEvent NotifyFunction and NotifyContext optional

According to the UEFI 2.10 Specification, the EFI_BOOT_SERVICES_TABLE
CreateEvent function has the following signature:

typedef
EFI_STATUS
(EFIAPI *EFI_CREATE_EVENT) (
  IN UINT32           Type,
  IN EFI_TPL          NotifyTpl,
  IN EFI_EVENT_NOTIFY NotifyFunction, OPTIONAL
  IN VOID             *NotifyContext, OPTIONAL
  OUT EFI_EVENT       *Event
);

Fix the prototype in UefiSpec.h to match, by labeling the NotifyFunction
and NotifyContext parameters as OPTIONAL.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdeModulePkg/Bus/Ata/AhciPei: Fix DEADCODE Coverity issue
Ranbir Singh [Thu, 22 Dec 2022 08:12:39 +0000 (13:42 +0530)]
MdeModulePkg/Bus/Ata/AhciPei: Fix DEADCODE Coverity issue

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

The code can reach line 69 only through the else path above at line 57.
The else path already has the same NULL check at line 59 and hence the
duplicate code lines are totally redundant which can be deleted.

Signed-off-by: Ranbir Singh <Ranbir.Singh3@Dell.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoShellPkg/AcpiView: ERST Parser
Jeshua Smith [Thu, 3 Nov 2022 18:14:26 +0000 (18:14 +0000)]
ShellPkg/AcpiView: ERST Parser

Add a new parser for the Error Record Serialization Table.
The ERST table describes how an OS can save and retrieve
hardware error information to and from a persistent store.

Signed-off-by: Jeshua Smith <jeshuas@nvidia.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
14 months agoMdeModulePkg: ScsiBusDxe: Refactor DiscoverScsiDevice()
Yuan Yu [Tue, 31 Jan 2023 06:03:47 +0000 (14:03 +0800)]
MdeModulePkg: ScsiBusDxe: Refactor DiscoverScsiDevice()

Currently DiscoverScsiDevice() returns a boolean which cannot
distinguish a "not found" situation from a real problem like
memory allocation failures.

This patch changes the return value to an EFI_STATUS so that when
memory allocation fails, it will return EFI_OUT_OF_RESOURCES.

Without this change, any FALSE returned by DiscoverScsiDevice()
will result in EFI_OUT_OF_RESOURCES being returned by
ScsiScanCreateDevice(), which will cause a while loop in
SCSIBusDriverBindingStart() to abort before other possible Puns in
the SCSI channel are scanned, which means good devices may not have
a chance to be discovered.  If this good device is the boot device,
boot will fail.

Cc: Ard Biesheuvel <ardb+tianocore@kernel.org>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sivaparvathi chellaiah <sivaparvathic@ami.com>
Signed-off-by: Yuan Yu <yuanyu@google.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
14 months agoMdePkg: Fix UINT64 and INT64 word length for LoongArch64
Chao Li [Tue, 31 Jan 2023 10:27:40 +0000 (18:27 +0800)]
MdePkg: Fix UINT64 and INT64 word length for LoongArch64

The UINT64 and INT64 should be defined as unsigned long long and long long
in the linux64 bit environment, but now defined as unsigned long and long,
so fix it.

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
14 months agoUefiPayloadPkg: Set RTC dynamic PCD to PeiPCDdatabase
KasimX Liu [Tue, 17 Jan 2023 09:09:11 +0000 (17:09 +0800)]
UefiPayloadPkg: Set RTC dynamic PCD to PeiPCDdatabase

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

In order to remove RTC_INDEX/RTC_TARGET from
the UplBuild macro list,change the RTC_INDEX
/RTC_TARGET type from PcdsFixedAtBuild to PcdsDynamicEx

Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: 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>
14 months agoMdePkg: Added serveral tables to MATD used by LoongArch64
Chao Li [Tue, 17 Jan 2023 08:39:11 +0000 (16:39 +0800)]
MdePkg: Added serveral tables to MATD used by LoongArch64

Add CORE_PIC, LIO_PIC, HT_PIC, EIO_PIC, MSI_PIC, BIO_PIC and LPC_PIC
tables for LoongArch64 as defined in ACPI SPEC 6.5.

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdePkg: Add ACPI 6.5 header
Chao Li [Tue, 17 Jan 2023 08:05:52 +0000 (16:05 +0800)]
MdePkg: Add ACPI 6.5 header

Create Acpi65.h, which is copied from Acpi64.h, and make the following
changes:

1. Replace all occurences of "6.4/6_4" with "6.5/6_5".
2. Incremented FADT minor revision.
3. Make Acpi65.h the latest ACPI definitions that Acpi.h contains.

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoMdePkg: Add Acpi65.h to IgnoreFiles area
Chao Li [Sun, 29 Jan 2023 10:04:11 +0000 (18:04 +0800)]
MdePkg: Add Acpi65.h to IgnoreFiles area

Acpi65.h will causes ECC errors when CI uses Ubuntu GCC5 PR, add it
to MdePkg.ci.yaml in "IgnreFiles" area to fix the ECC errors.

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

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agoArmVirtPkg: Remove RealView Debugger lines from ArmVirtPkg.dsc.inc
Rebecca Cran [Fri, 27 Jan 2023 16:42:51 +0000 (09:42 -0700)]
ArmVirtPkg: Remove RealView Debugger lines from ArmVirtPkg.dsc.inc

Since RvdPeCoffExtraActionLib has been deleted, remove lines referencing
it and the RealView Debugger from ArmVirtPkg.dsc.inc.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Bob Feng <bob.c.feng@intel.com>
14 months agoArmPkg: Remove RealView Debugger support
Rebecca Cran [Fri, 27 Jan 2023 16:42:50 +0000 (09:42 -0700)]
ArmPkg: Remove RealView Debugger support

The RealView Debugger is related to RVCT, which is no longer supported.
Given that, remove RvdPeCoffExtraActionLib and code from
RvdPeCoffExtraActionLib which prints lines for use with the RealView
Debugger.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Bob Feng <bob.c.feng@intel.com>
14 months agoBaseTools: Remove CYGWIN_NT-5.1-i686 ref from Scripts/PatchCheck.py
Rebecca Cran [Fri, 27 Jan 2023 16:42:49 +0000 (09:42 -0700)]
BaseTools: Remove CYGWIN_NT-5.1-i686 ref from Scripts/PatchCheck.py

With the removal of RVCT support and the related Bin/CYGWIN_NT-5.1-i686
and Darwin-i386 directories, remove a leftover reference to
CYGWIN_NT-5.1-i686 from Scripts/PatchCheck.py.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Bob Feng <bob.c.feng@intel.com>
14 months agoBaseTools: Delete Bin/{CYGWIN_NT-5.1-i686,Darwin-i386} directories
Rebecca Cran [Fri, 27 Jan 2023 16:42:48 +0000 (09:42 -0700)]
BaseTools: Delete Bin/{CYGWIN_NT-5.1-i686,Darwin-i386} directories

The Bin/CYGWIN_NT-5.1-i686 and Bin/Darwin-i386 directories contained
files needed for RVCT support.

Since EDK2 no longer supports RVCT, delete those directories.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Acked-by: Bob Feng <bob.c.feng@intel.com>
14 months agoMdeModulePkg: Correct memory type in PrePiDxeCis.h
Dionna Glaze via groups.io [Fri, 27 Jan 2023 19:21:16 +0000 (19:21 +0000)]
MdeModulePkg: Correct memory type in PrePiDxeCis.h

The enumeration in MdePkg/Include/Pi/PiDxeCis.h has a duplicated entry,
so the 8th position in the list doesn't count as index 7. The value
EfiGcdMemoryTypeUnaccepted will have when added before
EfiGcdMemoryTypeMaximum will be 6.

Cc: Min M Xu <min.m.xu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
Reviewed-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
14 months agotools_def: Remove duplicated -Os
Pierre Gondois [Wed, 25 Jan 2023 09:20:59 +0000 (17:20 +0800)]
tools_def: Remove duplicated -Os

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

commit 17bd834eb5fd ("BaseTools: Factorize GCC flags")
makes GCC48_ALL_CC_FLAGS inherit from GCC_ALL_CC_FLAGS.
GCC_ALL_CC_FLAGS contains the '-Os' flag.
The latest flag in a command line overrides the previous
optimization option. This allows more specific build
configuration to override the inherited '-Os' flag.

If a build configuration includes GCC48_ALL_CC_FLAGS,
hard-coded '-Os' options are not necessary anymore.
Remove them.

Reported-by: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>