]> git.proxmox.com Git - mirror_edk2.git/log
mirror_edk2.git
17 months agomv OvmfPkg: move fdf include snippets to Include/Fdf
Gerd Hoffmann [Fri, 9 Dec 2022 13:03:48 +0000 (21:03 +0800)]
mv OvmfPkg: move fdf include snippets to Include/Fdf

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoOvmfPkg: move dsc include snippet for Network support to Include/Dsc
Gerd Hoffmann [Fri, 9 Dec 2022 13:03:47 +0000 (21:03 +0800)]
OvmfPkg: move dsc include snippet for Network support to Include/Dsc

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoOvmfPkg: move dsc and fdf include snippets for TPM support to subdirs
Gerd Hoffmann [Fri, 9 Dec 2022 13:03:46 +0000 (21:03 +0800)]
OvmfPkg: move dsc and fdf include snippets for TPM support to subdirs

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoOvmfPkg: Add INVD case in #VE handler
Ryan Afranji [Thu, 8 Dec 2022 00:51:15 +0000 (08:51 +0800)]
OvmfPkg: Add INVD case in #VE handler

According to the Intel GHCI specification document section 2.4.1, the
goal for instructions that do not have a corresponding TDCALL is for the
handler to treat the instruction as a NOP.

INVD does not have a corresponding TDCALL. This patch makes the #VE
handler treat INVD as a NOP.

Signed-off-by: Ryan Afranji <afranji@google.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoMdeModulePkg/DxeCore: Use correct type for alignment mask
Ard Biesheuvel [Wed, 7 Dec 2022 17:49:45 +0000 (18:49 +0100)]
MdeModulePkg/DxeCore: Use correct type for alignment mask

The page allocator code in CoreFindFreePagesI() uses a mask derived from
its UINTN Alignment argument to align the descriptor end address of a
MEMORY_MAP entry to the requested alignment, in order to check whether
the descriptor covers enough sufficiently aligned area to satisfy the
request.

However, on 32-bit architectures, 'Alignment' is a 32-bit type, whereas
DescEnd is a 64-bit type, and so the resulting operation performed on
the end address comes down to masking with 0xfffff000 instead of the
intended 0xffffffff_fffff000. Given the -1 at the end of the expression,
the resulting address is 0xffffffff_fffffffff for any descriptor that
ends on a 4G aligned boundary, and this is certainly not what was
intended.

So cast Alignment to UINT64 to ensure that the mask has the right size.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reported-by: Nathan Chancellor <nathan@kernel.org>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
17 months agoEmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi
Liu, Zhiguang [Tue, 6 Dec 2022 05:41:36 +0000 (13:41 +0800)]
EmulatorPkg: Record Argc, Argv and Envp in EmuThunk Ppi

Record Argc, Argv and Envp in EmuThunk Ppi so that other modules
can use these fields to change behavior depends on boot parameters
or environment.

Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
17 months agoEmulatorPkg: Remove unnecessary dependency on EmbeddedPkg
Liu, Zhiguang [Tue, 6 Dec 2022 05:30:18 +0000 (13:30 +0800)]
EmulatorPkg: Remove unnecessary dependency on EmbeddedPkg

EmulatorPkg doesn't need depend on EmbeddedPkg, so remove the dependency.

Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
17 months agoEmulatorPkg: Add persistent memory in EmuThunkPpi
Liu, Zhiguang [Tue, 6 Dec 2022 05:40:52 +0000 (13:40 +0800)]
EmulatorPkg: Add persistent memory in EmuThunkPpi

The persistent memory is for PEIM to use, and won't lose during cold
or warm reset. PcdPersistentMemorySize is only used by WinHost.c,
other modules can check the persistent memory size using the field
PersistentMemorySize.

Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
17 months agoUefiCpuPkg: Bug fix in 5LPage handling
Robert Guenzel [Thu, 8 Dec 2022 08:44:15 +0000 (16:44 +0800)]
UefiCpuPkg: Bug fix in 5LPage handling

When build in DEBUG, the code asserts that 5LPage support is there
when the physical address width is larger than 48.
In a RELEASE build it will just force LA57 to 1 in CR4
even if CPUID(7).ECX[16] says it is not supported.

UefiCpuPkg: Bug fix in 5LPage handling

The hang (in the ASSERT) in DEBUG is not warranted as there are
legal configurations with CPUID(7).ECX[16](==LA57)=0
and with a physical address width of larger than 48 (like 52).

This is also supported by this code:
https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c#L221
There (as long as physical address width is smaller or equal to 52)
any address width above 48 will be reduced to 48 and the
system can and will work without 5LPaging.

The forced setting of LA57 in CR4 (in the absence of LA57 in CPUID(7).ECX)
is a spec violation and should not happen.

Hence the proposed fix
a) removes the assert.
b) only returns TRUE from Is5LevelPagingNeeded if 5LPaging is actually
   supported by HW.

Signed-off-by: Robert Guenzel <robert.guenzel@intel.com>
17 months agoUefiCpuPkg: Check SMM Delayed/Blocked AP Count
Wu, Jiaxin [Wed, 30 Nov 2022 05:13:56 +0000 (13:13 +0800)]
UefiCpuPkg: Check SMM Delayed/Blocked AP Count

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

Due to more core count increasement, it's hard to reflect all APs
state via AP bitvector support in the register. Actually, SMM CPU
driver doesn't need to check each AP state to know all CPUs in SMI
or not, one alternative method is to check the SMM Delayed & Blocked
AP Count number:

APs in SMI + Blocked Count + Disabled Count >= All supported Aps
(code comments explained why can be > All supported Aps)

With above change, the returned value of "SmmRegSmmEnable" &
"SmmRegSmmDelayed" & "SmmRegSmmBlocked" from SmmCpuFeaturesLib
should be the AP count number within the existing CPU package.

For register that return the bitvector state, require
SmmCpuFeaturesGetSmmRegister() returns count number of all bit per
logical processor within the same package.

For register that return the AP count, require
SmmCpuFeaturesGetSmmRegister() returns the register value directly.

v3:
- Refine the coding style

v2:
- Rename "mPackageBspInfo" to "mPackageFirstThreadIndex"
- Clarify the expected value of "SmmRegSmmEnable" & "SmmRegSmmDelayed" &
  "SmmRegSmmBlocked" returned from SmmCpuFeaturesLib.
- Thread: https://edk2.groups.io/g/devel/message/96722

v1:
- Thread: https://edk2.groups.io/g/devel/message/96671

Cc: Eric Dong <eric.dong@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
17 months agoEmulatorPkg/Win: Unload DLLs before reset
Ray Ni [Mon, 5 Dec 2022 06:51:18 +0000 (14:51 +0800)]
EmulatorPkg/Win: Unload DLLs before reset

EmulatorPkg/Win calls LoadLibraryEx() when the corresponding DLL file
is found for each PEIM or DXE driver. The module entry point is
changed to point to the entry point from the DLL. This helps to
notify Visual Studio that a new windows module is loaded and
corresponding symbol parsing is performed for source level debugging.

But entry point from the DLL is only executed when the module is not
loaded by AddModHandle().
When reset happens, we need to clear the DLL loading so that in next
boot the module can be loaded again by AddModHandle().

Without this patch, source level debugging doesn't work after reset.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Andrew Fish <afish@apple.com>
17 months agoUefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT
Jason Lou [Thu, 24 Nov 2022 12:11:58 +0000 (20:11 +0800)]
UefiCpuPkg/Test: develop UEFI App and dynamic cmd for MP services UT

The code changes develop UEFI application and dynamic command for
EfiMpServiceProtocol unit tests based on current UnitTestFramework.

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>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Dun Tan <dun.tan@intel.com>
17 months agoUefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function
Jason Lou [Thu, 24 Nov 2022 12:11:57 +0000 (20:11 +0800)]
UefiCpuPkg/Test: Move EfiMpServiceProtocol UT in a separate function

Move the implementation of EfiMpServiceProtocol unit tests in a separate
function in preparation for developing the UEFI application and dynamic
command for the same unit tests.

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>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Reviewed-by: Dun Tan <dun.tan@intel.com>
17 months agoMdeModulePkg: Put USB DEBUGs that occur for bulk timeouts under VERBOSE
Rebecca Cran [Tue, 6 Dec 2022 14:30:39 +0000 (22:30 +0800)]
MdeModulePkg: Put USB DEBUGs that occur for bulk timeouts under VERBOSE

With the pending commit of UsbNetworkPkg, it will become common for
UsbBulkTransfer calls to timeout, given that the drivers are called from
MnpSystemPoll every MNP_SYS_POLL_INTERVAL milliseconds: the drivers
check for network packets by calling UsbBulkTransfer with a timeout of
1ms.

Avoid console spam by moving DEBUG messages that occur each time a bulk
transfer request times out from DEBUG_ERROR to DEBUG_VERBOSE, for both
EHCI and XHCI drivers.

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
17 months agoRedfishPkg: Remove overlapping private include path in DEC file
Michael D Kinney [Mon, 5 Dec 2022 19:49:45 +0000 (11:49 -0800)]
RedfishPkg: Remove overlapping private include path in DEC file

Update ReadfishPkg.dec to remove PrivateInclude from the
[Includes.Common.Private] section.  The PrivateInclude directory
does not contain any include files, and the PrivateInclude/Crt
include path remaining in the [Includes.Common.Private] section
providing the include path required to access the CRT related
include files by components within the RedfishPkg.

Without this update, there are two forms of #include statements
that can be used to include the CRT related include files.
Include files should only be available using one form of
#include statements.

Cc: Abner Chang <abner.chang@amd.com>
Cc: Nickle Wang <nicklew@nvidia.com>
Cc: Igor Kulchytskyy <igork@ami.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
Reviewed-by: Igor Kulchytskyy <igork@ami.com>
17 months agoUefiPayloadPkg: Support multiple firmware volume
MarsX Lin [Wed, 23 Nov 2022 07:50:06 +0000 (15:50 +0800)]
UefiPayloadPkg: Support multiple firmware volume

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

To support multiple FVs provided by UPL

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: MarsX Lin <marsx.lin@intel.com>
17 months agoEmulatorPkg/WinHost: Add Reset2 PPI
Ni, Ray [Sat, 12 Nov 2022 04:00:42 +0000 (12:00 +0800)]
EmulatorPkg/WinHost: Add Reset2 PPI

When shutdown is requested, WinHost exits.
Otherwise, WinHost re-runs from SEC.
Tested no extra memory consumption with multiple resets in PEI.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
17 months agoEmulatorPkg/WinHost: XIP for SEC and PEI_CORE
Ni, Ray [Sat, 12 Nov 2022 04:00:41 +0000 (12:00 +0800)]
EmulatorPkg/WinHost: XIP for SEC and PEI_CORE

In EmulatorPkg/Win, SEC and PEI_CORE are loaded to memory allocated
through VirtualAlloc. Though the corresponding DLL files are loaded
and the entry points in DLL files are executed. The loading to memory
allocated through VirtualAlloc is for the case when the DLL files can
not be loaded.

Actually some PEIMs like PcdPeim which are loaded before
"physical" RAM is discovered, they are executing in the original
location (FV) like XIP module in real platform.

The SEC and PEI_CORE can follow the same mechanism.
So, the VirtualAlloc call is removed.

This is to prepare the "reset" support to avoid additional OS memory
consumption when reset happens.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Andrew Fish <afish@apple.com
17 months agoEmulatorPkg/WinHost: pre-allocate "physical" RAM
Ni, Ray [Sat, 12 Nov 2022 04:00:40 +0000 (12:00 +0800)]
EmulatorPkg/WinHost: pre-allocate "physical" RAM

Move the "physical" RAM allocation from WinPeiAutoScan
to main() entrypoint.

This is to prepare the changes for "reset" support.

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Andrew Fish <afish@apple.com>
Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
17 months agoRedfishPkg: Fix typos of the .inc filenames
Rebecca Cran [Thu, 1 Dec 2022 15:20:53 +0000 (08:20 -0700)]
RedfishPkg: Fix typos of the .inc filenames

Fix a typo of "RedfishLibs.dsc.inc" in RedfishLibs.dsc.inc, and correct
the name of the .fdf.inc filename in Redfish.fdf.inc.

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Nickle Wang <nicklew@nvidia.com>
Reviewed-by: Abner Chang <abner.chang@amd.com>
17 months agoCryptoPkg/BaseCryptLib:time overflow
Zihong Yi [Fri, 2 Dec 2022 05:51:50 +0000 (13:51 +0800)]
CryptoPkg/BaseCryptLib:time overflow

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

In CrtLibSupport.h, time_t is defined as INT32, and its maximum value
is 2147483647. That is, the corresponding maximum timestamp is
2038-01-19 11:14:07. Therefore, overflow occurs when the test time
exceeds 2038-01-19 11:14:07. So change the type of time_t to INT64 and
also change the type of variables in function gmtime which calculated
with time_t.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Zihong Yi <yizihong@huawei.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoCryptPkg: Enable CryptoPkg BaseCryptLib ParallelHash for PEI and DXE
Zhihao Li [Wed, 30 Nov 2022 14:21:02 +0000 (22:21 +0800)]
CryptPkg: Enable CryptoPkg BaseCryptLib ParallelHash for PEI and DXE

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

The BaseCryptLib in the CryptoPkg currently supports ParallelHash
algorithm for SMM. The MP Services PPI and MP Services Protocol
could be used to enable ParallelHash in PEI and DXE
versions of the BaseCryptLib.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Zhihao Li <zhihao.li@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoOvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength
Min M Xu [Sun, 27 Nov 2022 07:00:14 +0000 (15:00 +0800)]
OvmfPkg/PlatformInitLib: Add check to NvVarStoreFV HeaderLength

There should be a check that the FV HeaderLength cannot be an odd
number. Otherwise in the following CalculateSum16 there would be an
ASSERT.

In ValidateFvHeader@QemuFlashFvbServicesRuntimeDxe/FwBlockServices.c
there a is similar check to the FwVolHeader->HeaderLength.

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>
Signed-off-by: Min Xu <min.m.xu@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoUnitTestFrameworkPkg: Library classes private to public
Michael D Kinney [Wed, 30 Nov 2022 21:14:09 +0000 (13:14 -0800)]
UnitTestFrameworkPkg: Library classes private to public

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

* Change GoogleTestLib class from private to public.
* Change UnitTestPersistenceLib class from private to public.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
17 months agoCryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1s
Gang Chen [Thu, 17 Nov 2022 08:39:37 +0000 (16:39 +0800)]
CryptoPkg/OpensslLib: Upgrade OpenSSL to 1.1.1s

Upgrade openssl to 1.1.1s.

Pick up bugfixes from the latest openssl release, which include
some GCC build warnings cleaning up.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Signed-off-by: Gang Chen <gang.c.chen@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
17 months agoMdeModulePkg: Disable PciDegrade support for LoongArch64
Dongyan Qian [Thu, 17 Nov 2022 02:57:11 +0000 (10:57 +0800)]
MdeModulePkg: Disable PciDegrade support for LoongArch64

LoongArch64: Pcie devices that come with OPROM may require large Mem Space,
and downgrading all 64 Bit Bars may result in insufficient space.

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

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Chao Li <lichao@loongson.cn>
Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
Co-authored-by: Bo Zhu <zhubo@loongson.cn>
Reviewed-by: Chao Li <lichao@loongson.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
17 months ago.github/ISSUE_TEMPLATE/config.yml: Add initial issue template
Michael Kubacki [Thu, 10 Nov 2022 15:03:08 +0000 (10:03 -0500)]
.github/ISSUE_TEMPLATE/config.yml: Add initial issue template

Adds a GitHub issue template to direct contributors familiar with
GitHub's issue tracker to the external resources used by TianoCore.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
17 months agoEmbeddedPkg/MetronomeDxe: Update outdated lower bound comment
Rebecca Cran [Tue, 29 Nov 2022 12:40:56 +0000 (05:40 -0700)]
EmbeddedPkg/MetronomeDxe: Update outdated lower bound comment

There was previously a lower bound on the value of TickPeriod such that
it couldn't be less than 10 us. However, that was removed from the PI
Specification in the 1.0 errata released in 2007. From the revision
history:

"M171 Remove 10 us lower bound restriction for the TickPeriod in the
Metronome"

Update the documentation of TickPeriod in MetronomeDxe/Metronome.c to
remove mention of the lower bound.

Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
17 months agoBaseSynchronizationLib: Fix RISC-V helper name
Sunil V L [Fri, 11 Nov 2022 11:21:06 +0000 (19:21 +0800)]
BaseSynchronizationLib: Fix RISC-V helper name

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

Fix the name of InternalSyncCompareExchange64() function.

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
Reported-by: Zhihao Li <zhihao.li@intel.com>
Tested-by: Zhihao Li <zhihao.li@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: Daniel Schaefer <git@danielschaefer.me>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
17 months agoShellPkg/DpDynamicCommand: Add ResetEnd support in DP command
zhenhuay [Mon, 21 Nov 2022 09:34:56 +0000 (17:34 +0800)]
ShellPkg/DpDynamicCommand: Add ResetEnd support in DP command

DP command should be able to parse the FPDT ACPI table and dump
the ResetEnd which was logged at the beginning of the firmware
image execution. So that DP can calculate SEC phase time duration
start from the beginning of firmware image execution.

Cc: Ray Ni <ray.ni@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: zhenhuay <zhenhua.yang@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
17 months ago.github/dependabot.yml: Enable dependabot
Michael Kubacki [Thu, 10 Nov 2022 12:26:23 +0000 (07:26 -0500)]
.github/dependabot.yml: Enable dependabot

Enables dependabot in this repo so we can better alerted when
dependency updates are available.

This GitHub action will automatically create pull requests and
summarize the dependency details. Because it is a pull request,
the CI system will validate the dependency update in the pull
request.

Configures dependabot for:

1. PIP module updates
2. GitHub action updates

The maintainers/reviewers of the .github directory were added as
pull request reviewers so they can be notified when the pull request
is available.

Note to Maintainers:
  After this change is committed, PRs from dependabot will be
  automatically created in the edk2 repo.  Never set the 'push' label
  directly on these PRs. If a dependency identified by dependedabot
  looks like one that should be updated in the edk2 repo, then copy
  the PR generated by dependabot to your personal fork and update the
  commit message to follow the edk2 commit message requirements and
  send as a normal code review.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
17 months agoShellPkg/SmbiosView: Update ProcessorUpgradeTable
Zhang, JuX [Wed, 16 Nov 2022 07:12:57 +0000 (15:12 +0800)]
ShellPkg/SmbiosView: Update ProcessorUpgradeTable

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

Refer to the latest SMBIOS v3.6, SMBIOS Socket not completely defined.

SMBIOS v3.6:
https://www.dmtf.org/sites/default/files/standards/documents/
DSP0134_3.6.0.pdf

Signed-off-by: JuX Zhang <jux.zhang@intel.com>
Cc: Zhichao Gao <zhichao.gao@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
Reviewed-by: Jiaxin Wu <jiaxin.wu@intel.com>
17 months agoUefiPayloadPkg: The UPL info section is not aligned at 4-byte boundary
VictorX Hsu [Tue, 15 Nov 2022 09:55:16 +0000 (17:55 +0800)]
UefiPayloadPkg: The UPL info section is not aligned at 4-byte boundary

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

1.Upgrade spec revision to 0.9
2.Align .upld_info with 4-byte boundary by spec

Reviewed-by: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Signed-off-by: VictorX Hsu <victorx.hsu@intel.com>
17 months agoArmPkg/ArmTrngLib: Remove ASSERTs in ArmTrngLibConstructor()
Pierre Gondois [Thu, 24 Nov 2022 16:17:53 +0000 (17:17 +0100)]
ArmPkg/ArmTrngLib: Remove ASSERTs in ArmTrngLibConstructor()

Remove ASSERTs in ArmTrngLibConstructor() that prevent from
booting on DEBUG builds.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
17 months agopip-requirements.txt: Update to edk2-pytool-extensions 0.20.0 edk2-stable202211
Michael Kubacki [Fri, 11 Nov 2022 21:04:39 +0000 (16:04 -0500)]
pip-requirements.txt: Update to edk2-pytool-extensions 0.20.0

Updates edk2-pytool-extensions to pick up a major version release:

0.19.1 to 0.20.0 changes:

- .vscode/settings.json: Enable flake8 linting
- Add Pydocstyle
- Move dependabot.yml location
- Fix typos in robot files
- Pydocstyle Updates
- Plugin Loader Updates
- edk2_stuart_pr_eval: Improve robustness of path comparisons
- edk2_pr_eval.py: Build all packages on file change outside package
- Allow build wrappers

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
17 months agopip-requirements.txt: Update to edk2-pytool-library 0.12.1
Michael Kubacki [Fri, 11 Nov 2022 21:01:09 +0000 (16:01 -0500)]
pip-requirements.txt: Update to edk2-pytool-library 0.12.1

Updates edk2-pytool-library to pick up a minor bug fix release:

0.12.0 to 0.12.1 changes:

  - path_utilities.py: Prevent path case modification in
    GetContainingModules()

That change prevents the case of paths from being set to lower case
when returned from the function to avoid impacting case-sensitive
callers.

Release notes:

https://github.com/tianocore/edk2-pytool-library/releases/tag/v0.12.1

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
17 months agoArmPkg/ArmTrngLib: Remove ASSERT in GetArmTrngVersion()
Pierre Gondois [Mon, 14 Nov 2022 14:43:47 +0000 (22:43 +0800)]
ArmPkg/ArmTrngLib: Remove ASSERT in GetArmTrngVersion()

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

GetArmTrngVersion() is used to check the presence of an Arm
Trng. If not found, an ASSERT prevents from booting in DEBUG
builds.
Remove this ASSERT.

Reported-by: Sami Mujawar <sami.mujawar@arm.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
17 months agoMaintainers: Update the VmgExitLib to CcExitLib
Min M Xu [Fri, 28 Oct 2022 00:57:41 +0000 (08:57 +0800)]
Maintainers: Update the VmgExitLib to CcExitLib

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

VmgExitLib is renamed as CcExitLib. The related section in
Maintainers.txt should be updated as well.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
17 months agoOvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib
Min M Xu [Mon, 7 Nov 2022 07:50:11 +0000 (15:50 +0800)]
OvmfPkg/UefiCpuPkg: Add CcExit prefix to the APIs of CcExitLib

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

APIs which are defined in CcExitLib.h are added with the CcExit prefix.
This is to make the APIs' name more meaningful.

This change impacts OvmfPkg/UefiCpuPkg.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
17 months agoOvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib
Min M Xu [Mon, 7 Nov 2022 06:30:26 +0000 (14:30 +0800)]
OvmfPkg/UefiCpuPkg/UefiPayloadPkg: Rename VmgExitLib to CcExitLib

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

VmgExitLib once was designed to provide interfaces to support #VC handler
and issue VMGEXIT instruction. After TDVF (enable TDX feature in OVMF) is
introduced, this library is updated to support #VE as well. Now the name
of VmgExitLib cannot reflect what the lib does.

This patch renames VmgExitLib to CcExitLib (Cc means Confidential
Computing). This is a simple renaming and there is no logic changes.
After renaming all the VmgExitLib related codes are updated with
CcExitLib. These changes are in OvmfPkg/UefiCpuPkg/UefiPayloadPkg.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Sean Rhodes <sean@starlabs.systems>
Cc: James Lu <james.lu@intel.com>
Cc: Gua Guo <gua.guo@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Brijesh Singh <brijesh.singh@amd.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: James Bottomley <jejb@linux.ibm.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Tom Lendacky <thomas.lendacky@amd.com>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>
18 months agoUefiCpuPkg/ResetVector:Add Option to reserve 4K region at 4GB
Duggapu, Chinni B [Mon, 7 Nov 2022 06:47:31 +0000 (14:47 +0800)]
UefiCpuPkg/ResetVector:Add Option to reserve 4K region at 4GB

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

Some implementations may need to keep the initial Reset code to be
separated out from rest of the code.This request is to add padding at
lower 4K region below 4 GB which will result having only few jmp
instructions and data at that region.

Reviewed-by: Ray Ni <ray.ni@intel.com>
Signed-off-by: Duggapu Chinni B <chinni.b.duggapu@intel.com>
18 months agoMdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTest
Michael D Kinney [Tue, 21 Jun 2022 02:52:31 +0000 (19:52 -0700)]
MdePkg/Test: Add port of BaseSafeIntLib unit tests to GoogleTest

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

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoBaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output
Michael D Kinney [Mon, 31 Oct 2022 17:09:09 +0000 (10:09 -0700)]
BaseTools/Plugin/HostBaseUnitTestRunner: Enable gtest xml output

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

Set environment variable GTEST_OUTPUT to specify the output
format of XML and the output file name.  Both CMOCKA_XML_FILE
and GTEST_OUTPUT are set for each host based unit test to
support both cmocka unit tests and gtest unit tests.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
18 months ago.pytool: Add googletest submodule to CISettings.py
Michael D Kinney [Tue, 28 Jun 2022 17:33:02 +0000 (10:33 -0700)]
.pytool: Add googletest submodule to CISettings.py

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

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
18 months agoUnitTestFrameworkPkg/Library/CmockaLib: Generate symbol information
Michael D Kinney [Thu, 3 Nov 2022 22:38:25 +0000 (15:38 -0700)]
UnitTestFrameworkPkg/Library/CmockaLib: Generate symbol information

Add /Zi to CC_FLAGS in CmockaLib.inf to enable symbol information

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
18 months agoUnitTestFrameworkPkg: Add googletest submodule and GoogleTestLib
Michael D Kinney [Tue, 21 Jun 2022 02:52:03 +0000 (19:52 -0700)]
UnitTestFrameworkPkg: Add googletest submodule and GoogleTestLib

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

Add submodule for googletest and add GoogleTestLib that is
required for GoogleTest based unit tests. Add GoogleTest
documentation to Readme.md along with a port of the sample
unit test to the GoogleTest style.

A few typos in Readme.md are also fixed.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
18 months agoMdePkg/Include/Library: Undefine _ASSERT() if already defined
Michael D Kinney [Tue, 11 Oct 2022 19:03:48 +0000 (12:03 -0700)]
MdePkg/Include/Library: Undefine _ASSERT() if already defined

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

When unit testing is enabled, make sure _ASSERT() is not already
defined by the host environment before defining _ASSERT().  This
avoids conflicts with VS20xx builds of GoogleTest based unit tests.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoMdePkg/Include: Update Base.h to improve C++ compatibility
Michael D Kinney [Tue, 21 Jun 2022 19:30:07 +0000 (12:30 -0700)]
MdePkg/Include: Update Base.h to improve C++ compatibility

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

* Map NULL to nullptr or __null when c++ compiler is used.
* Map STATIC_ASSERT to static_assert when a c++ compiler is used.
* Typecast RETURN_SUCCESS to type RETURN_STATUS to match type used
  by all return error/warning status codes.  C++ has stricter type
  checking and found this inconsistency.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoIntelFsp2Pkg: Improvement of supporting null UPD pointer in FSP-T
Kuo, Ted [Wed, 9 Nov 2022 11:30:57 +0000 (03:30 -0800)]
IntelFsp2Pkg: Improvement of supporting null UPD pointer in FSP-T

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

1.Use xmm5 slot 1 and xmm6 slot 3 to save ucode status and UPD pointer
  respectively in TempRamInitApi in IA32 FspSecCoreT.
2.Correct inappropriate description in the return value of
  AsmGetFspInfoHeader.
3.Replace hardcoded offset value 0x1C with FSP_HEADER_IMGBASE_OFFSET in
  FspHeler.nasm.

Cc: Chasel Chiu <chasel.chiu@intel.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Ashraf Ali S <ashraf.ali.s@intel.com>
Cc: Chinni B Duggapu <chinni.b.duggapu@intel.com>
Signed-off-by: Ted Kuo <ted.kuo@intel.com>
Reviewed-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
18 months agoArmPkg/ArmTrngLib: Fix incorrect GUID reference in DEBUG() output
Ard Biesheuvel [Thu, 10 Nov 2022 13:47:36 +0000 (21:47 +0800)]
ArmPkg/ArmTrngLib: Fix incorrect GUID reference in DEBUG() output

ArmTrngLib crashes when run in DEBUG mode due to the fact that it passed
the [truncated] GUID value to a DEBUG() print statement instead of a
pointer to the GUID which is what the %g conversion expects.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
18 months ago.github/workflows: Update CodeQL to install Python 3.10.6
Michael D Kinney [Fri, 11 Nov 2022 01:44:53 +0000 (17:44 -0800)]
.github/workflows: Update CodeQL to install Python 3.10.6

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
18 months agoShellPkg:Improved Smbios Type9 data under smbiosview
Sainadh Nagolu [Fri, 4 Nov 2022 10:53:08 +0000 (16:23 +0530)]
ShellPkg:Improved Smbios Type9 data under smbiosview

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

Added spec version check while publishing new Type9 fields,
added Slot Pitch field which was missing and
corrected the publishing order as per Smbios spec.

Cc: Vasudevan S <vasudevans@ami.com>
Cc: Sundaresan S <sundaresans@ami.com>
Signed-off-by: Sainadh Nagolu <sainadhn@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agopip-requirements.txt: Update edk2-pytool-library to 0.12.0
Michael D Kinney [Thu, 10 Nov 2022 04:21:16 +0000 (20:21 -0800)]
pip-requirements.txt: Update edk2-pytool-library to 0.12.0

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

Update edk2-pytool-library to version 0.12.0 that adds support for
the environment variable PYTOOL_TEMPORARILY_IGNORE_NESTED_EDK_PACKAGES
that can be set to true to ignore nested packages instead of breaking
the build with an exception. Nested packages are not allowed by the
edk2 specifications.  This environment variable allows pytools to run
with reduced functionality if nested packages are present giving
downstream consumers of edk2 that use pytools time to resolve the use
of nested packages and restore all features of pytools.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
18 months agoedk2.qls: Allow error severity results and add new queries
Michael Kubacki [Tue, 8 Nov 2022 15:19:17 +0000 (10:19 -0500)]
edk2.qls: Allow error severity results and add new queries

The query cpp/conditionallyuninitializedvariable was initially
enabled with the CodeQL code because work was in progress on those
changes. The results were filtered out so CodeQL passed so we could
verify the CodeQL workflow without impacting CI results.

This change allows error severity messages and substitutes that query
with two queries that do not return failures. This allows these
queries to find future problems and prepares the CodeQL workflow to
catch future failures as queries are enabled.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
18 months agoBaseTools: Fix wrong type of arguments to formatting functions
Michael Kubacki [Tue, 8 Nov 2022 17:17:59 +0000 (12:17 -0500)]
BaseTools: Fix wrong type of arguments to formatting functions

Fixes issues found with the cpp/wrong-type-format-argument CodeQL
rule in BaseTools.

Reference:
https://cwe.mitre.org/data/definitions/686.html

The following CodeQL errors are resolved:

1. Check failure on line 1115 in
   BaseTools/Source/C/EfiRom/EfiRom.c

   - This argument should be of type 'int' but is of type 'char *'.
   - This argument should be of type 'int' but is of type 'signed
     char *'.

2. Check failure on line 359 in
   BaseTools/Source/C/GenFw/Elf32Convert.c

   - This argument should be of type 'CHAR8 *' but is of type
     'unsigned int'.

3. Check failure on line 1841 in
   BaseTools/Source/C/GenFw/Elf64Convert.c

   - This argument should be of type 'unsigned int' but is of type
     'unsigned long long'.

4. Check failure on line 1871 in
   BaseTools/Source/C/GenFw/Elf64Convert.c

   - This argument should be of type 'unsigned int' but is of type
     'unsigned long long'.

5. Check failure on line 2400 in
   BaseTools/Source/C/GenFv/GenFvInternalLib.c

   - This argument should be of type 'unsigned long long' but is of
     type 'unsigned int'.

6. Check failure on line 1099 in
   BaseTools/Source/C/GenFw/Elf64Convert.c

   - This argument should be of type 'CHAR8 *' but is of type
     'unsigned int'.

7. Check failure on line 1098 in
   BaseTools/Source/C/GenSec/GenSec.c

   - This argument should be of type 'CHAR8 *' but is of type
     'char **'.

8. Check failure on line 911 in
   BaseTools/Source/C/GenSec/GenSec.c

  - This argument should be of type 'CHAR8 *' but is of type
    'char **'.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
18 months agoBaseTools/Source/C: Use /Z7 instead of /Zi for host tools
Michael D Kinney [Sat, 5 Nov 2022 19:43:24 +0000 (12:43 -0700)]
BaseTools/Source/C: Use /Z7 instead of /Zi for host tools

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

Update ms.common and *.mak files to use /Z7 instead of /Zi to embed
symbol information in obj files for host tools built with VS compilers.
This prevents vcxxx.pdb files from being generated in the root of
the local edk2 repository or in BaseTools directories.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoPrmPkg/PrmSsdtInstallDxe: Update PRMT Device CID to PNP0C02.
Wei6 Xu [Mon, 7 Nov 2022 08:29:39 +0000 (16:29 +0800)]
PrmPkg/PrmSsdtInstallDxe: Update PRMT Device CID to PNP0C02.

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

PRMT device is an unknown device in Device Manager if there is no
Windows Driver installed for it. It will cause WHQL Signed Driver
test failure.

To complete WHQL certification, update PRMT Device CID to PNP0C02.

In this way, PRMT Device will be a Motherboard Resources when no
real driver is loaded (default), but will be shown as the actual
device name when a legitimate Windows Driver is loaded.

Cc: Michael Kubacki <michael.kubacki@microsoft.com>
Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Ankit Sinha <ankit.sinha@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
Reviewed-by: Ankit Sinha <ankit.sinha@intel.com>
Reviewed-by: Michael Kubacki <michael.kubacki@microsoft.com>
18 months ago.github: Add initial CodeQL config and workflow files
Michael Kubacki [Wed, 3 Aug 2022 20:19:02 +0000 (16:19 -0400)]
.github: Add initial CodeQL config and workflow files

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

Adds initial support for enabling CodeQL Code Scanning in this
repository per the RFC:

  https://github.com/tianocore/edk2/discussions/3258

Adds the following new files:
  - .github/workflows/codql-analysis.yml - The main GitHub workflow
    file used to setup CodeQL in the repo.
  - .github/codeql/codeql-config.yml - The main CodeQL configuration
    file used to customize the queries and other resources the repo
    is using for CodeQL.
  - edk2.qls - A query set of queries to run for CodeQL.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
18 months agoMaintainers.txt: Add .github maintainers and reviewers
Michael Kubacki [Wed, 3 Aug 2022 20:28:38 +0000 (16:28 -0400)]
Maintainers.txt: Add .github maintainers and reviewers

Adds the maintainers and reviewers for the new .github directory
being added to hold GitHub workflows files.

Cc: Andrew Fish <afish@apple.com>
Cc: Leif Lindholm <quic_llindhol@quicinc.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
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>
18 months agoCryptoPkg: Sha1 functions causing build errors
Judah Vang [Mon, 7 Nov 2022 20:02:25 +0000 (04:02 +0800)]
CryptoPkg: Sha1 functions causing build errors

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

Fix build issue when DiSABLE_SHA1_DEPRECATED_INTERFACES
is defined. Percolate the #ifndef DiSABLE_SHA1_DEPRECATED_INTERFACES
to all the Sha1 functions.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Nishant C Mistry <nishant.c.mistry@intel.com>
Signed-off-by: Jian J Wang <jian.j.wang@intel.com>
Signed-off-by: Nishant C Mistry <nishant.c.mistry@intel.com>
Signed-off-by: Judah Vang <judah.vang@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoPrmPkg: Use UnitTestFrameworkPkg UEFI BS library
Michael Kubacki [Fri, 4 Nov 2022 00:11:39 +0000 (20:11 -0400)]
PrmPkg: Use UnitTestFrameworkPkg UEFI BS library

Updates PrmPkg to use UnitTestUefiBootServicesTableLib from
UnitTestFrameworkPkg instead of UefiBootServicesTableLibUnitTest
in PrmPkg.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
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>
18 months agoUnitTestFrameworkPkg: Add UnitTestUefiBootServicesTableLib
Michael Kubacki [Fri, 4 Nov 2022 00:07:49 +0000 (20:07 -0400)]
UnitTestFrameworkPkg: Add UnitTestUefiBootServicesTableLib

This library supports a Boot Services table library implementation
that allows code dependent upon UefiBootServicesTableLib to operate
in an isolated execution environment such as within
the context of a host-based unit test framework.

The unit test should initialize the Boot Services database with any
required elements (e.g. protocols, events, handles, etc.) prior to
the services being invoked by code under test.

It is strongly recommended to clean any global databases (e.g.
protocol, event, handles, etc.) after every unit test so the tests
execute in a predictable manner from a clean state.

This library is being moved here from PrmPkg so it can be made more
generally available to other packages and improved upon for others
use.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
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>
18 months agoCryptoPkg/Readme.md: typo and grammar fixes
Laszlo Ersek [Fri, 4 Nov 2022 12:02:14 +0000 (20:02 +0800)]
CryptoPkg/Readme.md: typo and grammar fixes

Commit 244ce33bdd2f ("CryptoPkg: Add Readme.md", 2022-10-24) had added the
long-awaited documentation on the dynamic crypto services. Fix some of the
typos and arguable grammar errors in "Readme.md". A few light
clarifications are also snuck in.

Cc: Christopher Zurcher <christopher.zurcher@microsoft.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Reviewed-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoMdePkg/BaseLib: Fix out-of-bounds reads in SafeString
Pedro Falcato [Thu, 3 Nov 2022 01:11:49 +0000 (09:11 +0800)]
MdePkg/BaseLib: Fix out-of-bounds reads in SafeString

There was a OOB access in *StrHexTo* functions, when passed strings like
"XDEADBEEF".

OpenCore folks established an ASAN-equipped project to fuzz Ext4Dxe,
which was able to catch these (mostly harmless) issues.

Cc: Vitaly Cheptsov <vit9696@protonmail.com>
Cc: Marvin H?user <mhaeuser@posteo.de>
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: Pedro Falcato <pedro.falcato@gmail.com>
Acked-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <Jiewen.yao@Intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interface
Sami Mujawar [Fri, 28 Oct 2022 15:32:59 +0000 (17:32 +0200)]
ArmVirtPkg: Kvmtool: Add RNG support using Arm TRNG interface

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

The EFI_RNG_PROTOCOL published by RngDxe has been updated to
implement the EFI_RNG_ALGORITHM_RAW using the Arm TRNG interface
to provide access to entropy.

Therefore, enable EFI_RNG_PROTOCOL for the Kvmtool guest/virtual
firmware.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
18 months agoSecurityPkg/RngDxe: Add Arm support of RngDxe
Pierre Gondois [Fri, 28 Oct 2022 15:32:58 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Add Arm support of RngDxe

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

Add RngDxe support for Arm. This implementation uses the ArmTrngLib
to support the RawAlgorithm and doens't support the RNDR instruction.

To re-use the RngGetRNG(), RngGetInfo() and FreeAvailableAlgorithms()
functions, create Arm/AArch64 files which implement the arch specific
function GetAvailableAlgorithms(). Indeed, FEAT_RNG instruction is not
supported on Arm.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Rename AArch64/RngDxe.c
Pierre Gondois [Fri, 28 Oct 2022 15:32:57 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Rename AArch64/RngDxe.c

To re-use the AArch64/RngDxe.c for an Arm implementation,
rename AArch64/RngDxe.c to ArmRngDxe.c.

Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm
Pierre Gondois [Fri, 28 Oct 2022 15:32:56 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Add debug warning for NULL PcdCpuRngSupportedAlgorithm

PcdCpuRngSupportedAlgorithm should allow to identify the the algorithm
used by the RNDR CPU instruction to generate a random number.
Add a debug warning if the Pcd is not set.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through ArmTrngLib
Sami Mujawar [Fri, 28 Oct 2022 15:32:55 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Add AArch64 RawAlgorithm support through ArmTrngLib

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

RawAlgorithm is used to provide access to entropy that is suitable
for cryptographic applications. Therefore, add RawAlgorithm support
that provides access to entropy using the ArmTrngLib.

Also remove unused UefiBootServicesTableLib library inclusion
and Status variable.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Check before advertising Cpu Rng algo
Pierre Gondois [Fri, 28 Oct 2022 15:32:54 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Check before advertising Cpu Rng algo

RngGetBytes() relies on the RngLib. The RngLib might use the RNDR
instruction if the FEAT_RNG feature is present. RngGetInfo and
RngGetRNG both must check that RngGetBytes() is working before
advertising/using it.

To do so, allocate an array storing the available algorithms.
The Rng algorithm at the lowest index will be the default Rng
algorithm. The array is shared between RngGetInfo and RngGetRNG.

This array is allocated when the driver is loaded, and freed
when unloaded.

This patch also prevents from having PcdCpuRngSupportedAlgorithm
let to a zero GUID, but let the possibility to have no valid Rng
algorithm in such case.

Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Documentation/include/parameter cleanup
Pierre Gondois [Fri, 28 Oct 2022 15:32:53 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Documentation/include/parameter cleanup

This patch:
-Update RngGetBytes() documentation to align the function
 definition and declaration.
-Improve input parameter checking. Even though 'This'
 it is not used, the parameter should always point to the
 current EFI_RNG_PROTOCOL.
-Removes TimerLib inclusion as unused.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms()
Pierre Gondois [Fri, 28 Oct 2022 15:32:52 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Remove ArchGetSupportedRngAlgorithms()

RngGetInfo() is one of the 2 functions of the EFI_RNG_PROTOCOL.
RngGetInfo() is currently a mere wrapper around
ArchGetSupportedRngAlgorithms() which is implemented differently
depending on the architecture used.

RngGetInfo() does nothing more than calling
ArchGetSupportedRngAlgorithms(). So remove it, and let RngGetInfo()
be implemented differently according to the architecture.

This follows the implementation of the other function of the
EFI_RNG_PROTOCOL, RngGetRNG().

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid
Pierre Gondois [Fri, 28 Oct 2022 15:32:51 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Replace Pcd with Sp80090Ctr256Guid

gEfiRngAlgorithmSp80090Ctr256Guid was used as the default algorithm
in RngGetRNG(). The commit below set the default algorithm to
PcdCpuRngSupportedAlgorithm, which is a zero GUID by default.

As the Pcd value is not defined for any platform in the edk2-platfoms
repository, assume it was an error and go back to the first version,
using gEfiRngAlgorithmSp80090Ctr256Guid.

Fixes: 4e5ecdbac8bd ("SecurityPkg: Add support for RngDxe on AARCH64")
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoSecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name
Sami Mujawar [Fri, 28 Oct 2022 15:32:50 +0000 (17:32 +0200)]
SecurityPkg/RngDxe: Rename RdRandGenerateEntropy to generic name

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

Rename RdRandGenerateEntropy() to GenerateEntropy() to provide a
common interface to generate entropy on other architectures.
GenerateEntropy() is intended to generate high quality entropy.

Also move the definition to RngDxeInternals.h

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Acked-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agoArmPkg/ArmTrngLib: Add Arm TRNG library
Sami Mujawar [Fri, 28 Oct 2022 15:32:49 +0000 (17:32 +0200)]
ArmPkg/ArmTrngLib: Add Arm TRNG library

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

The Arm True Random Number Generator Firmware, Interface 1.0,
Platform Design Document
(https://developer.arm.com/documentation/den0098/latest/)
defines an interface between an Operating System (OS) executing
at EL1 and Firmware (FW) exposing a conditioned entropy source
that is provided by a TRNG back end.

The conditioned entropy, that is provided by the Arm TRNG interface,
is commonly used to seed deterministic random number generators.

This patch adds an ArmTrngLib library that implements the Arm TRNG
interface.

Acked-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
18 months agoArmPkg: Add FID definitions for Arm TRNG
Sami Mujawar [Fri, 28 Oct 2022 15:32:48 +0000 (17:32 +0200)]
ArmPkg: Add FID definitions for Arm TRNG

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

The Arm True Random Number Generator Firmware, Interface 1.0,
Platform Design Document
(https://developer.arm.com/documentation/den0098/latest/)
defines an interface between an Operating System (OS) executing
at EL1 and Firmware (FW) exposing a conditioned entropy source
that is provided by a TRNG back end.

New function IDs have been defined by the specification for
accessing the TRNG services. Therefore, add these definitions
to the Arm standard SMC header.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
18 months agoMdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library
Sami Mujawar [Fri, 28 Oct 2022 15:32:47 +0000 (17:32 +0200)]
MdePkg/ArmTrngLib: Add NULL instance of Arm TRNG Library

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

The Arm True Random Number Generator (TRNG) library defines an
interface to access the entropy source on a platform. On platforms
that do not have access to an entropy source, a NULL instance of
the TRNG library may be useful to satisfy the build dependency.

Therefore, add a NULL instance of the Arm TRNG library.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoMdePkg/ArmTrngLib: Definition for Arm TRNG library class interface
Sami Mujawar [Fri, 28 Oct 2022 15:32:46 +0000 (17:32 +0200)]
MdePkg/ArmTrngLib: Definition for Arm TRNG library class interface

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

The NIST Special Publications 800-90A, 800-90B and 800-90C
provide recommendations for random number generation. The
NIST 800-90C, Recommendation for Random Bit Generator (RBG)
Constructions, defines the GetEntropy() interface that is
used to access the entropy source. The GetEntropy() interface
is further used by Deterministic Random Bit Generators (DRBG)
to generate random numbers.

The Arm True Random Number Generator (TRNG) library defines an
interface to access the entropy source on a platform, following
the 'Arm True Random Number Generator Firmware Interface'
specification.

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLib
Pierre Gondois [Fri, 28 Oct 2022 15:32:45 +0000 (17:32 +0200)]
ArmPkg/ArmHvcLibNull: Add NULL instance of ArmHvcLib

Add a Null instance of ArmHvcLib in case of library dependencies.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
18 months agoArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc
Pierre Gondois [Fri, 28 Oct 2022 15:32:44 +0000 (17:32 +0200)]
ArmPkg: Sort HVC/SMC section alphbetically in ArmPkg.dsc

Sort the section containing HVC/SMC libraries prior to
adding new libraries in this specific section.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com>
18 months agoArmPkg/ArmMonitorLib: Add ArmMonitorLib
Pierre Gondois [Fri, 28 Oct 2022 15:32:43 +0000 (17:32 +0200)]
ArmPkg/ArmMonitorLib: Add ArmMonitorLib

The ArmMonitorLib provides an abstract interface to issue
an HyperVisor Call (HVC) or System Monitor Call (SMC) depending
on the default conduit.
The PcdMonitorConduitHvc PCD allows to select the default conduit.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
18 months agoArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class
Pierre Gondois [Fri, 28 Oct 2022 15:32:42 +0000 (17:32 +0200)]
ArmPkg/ArmMonitorLib: Definition for ArmMonitorLib library class

The ArmMonitorLib provides an abstract interface to issue
an HyperVisor Call (HVC) or System Monitor Call (SMC) depending
on the default conduit.
The PcdMonitorConduitHvc PCD allows to select the default conduit.

The new library relies on the ArmHvcLib and ArmSmcLib libraries.
A Null instance of these libraries can be used for the unused conduit.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
18 months agoArmPkg: PCD to select conduit for monitor calls
Sami Mujawar [Fri, 28 Oct 2022 15:32:41 +0000 (17:32 +0200)]
ArmPkg: PCD to select conduit for monitor calls

Define a PCD 'PcdMonitorConduitHvc' to select the conduit to use for
monitor calls. PcdMonitorConduitHvc is defined as FALSE by default,
meaning the SMC conduit is enabled as default.

Adding PcdMonitorConduitHvc allows selection of HVC conduit to be used
by virtual firmware implementations.

Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
18 months agoArmPlatformPkg: Retire NorFlashDxe driver
Ard Biesheuvel [Mon, 24 Oct 2022 16:53:35 +0000 (18:53 +0200)]
ArmPlatformPkg: Retire NorFlashDxe driver

The NorFlashDxe driver in ArmPlatformPkg was shared between development
platforms built by ARM Ltd, and virtual platforms that were once modeled
after Versatile Express, but have very little in common with actual bare
metal implementations.

Both sides have migrated to a domain specific version of the driver, so
we can retire the old one.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com>
Reviewed-by: Sunil V L <sunilvl@ventanamicro.com>
18 months agoOvmfPkg/VmgExitLig: HALT on #VE when access to private memory
Min M Xu [Fri, 28 Oct 2022 08:24:01 +0000 (16:24 +0800)]
OvmfPkg/VmgExitLig: HALT on #VE when access to private memory

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

EPT-violation #VE should be always on shared memory, which means the
shared bit of the GuestPA should be set. But in current #VE Handler
it is not checked. When it occurs, stop TD immediately and log out
the error.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.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>
Reviewed-by: Guorui Yu <ruogui.ygr@alibaba-inc.com>
Tested-by: Guorui Yu <ruogui.ygr@alibaba-inc.com>
18 months agoUefiPayloadPkg: Boot mode in PHIT HOB will not be updated
VictorX Hsu [Thu, 3 Nov 2022 10:52:41 +0000 (18:52 +0800)]
UefiPayloadPkg: Boot mode in PHIT HOB will not be updated

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

System will depend on Boot Mode value to do different behavior
Update during Capsule Update process. So UPL need to support
update boot mode.

Cc: Guo Dong <guo.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Reviewed-by: James Lu <james.lu@intel.com>
Reviewed-by: Gua Guo <gua.guo@intel.com>
Signed-off-by: VictorX Hsu <victorx.hsu@intel.com>
18 months agoMdeModulePkg/Ufs :Coverity scan flags multiple issues in edk2-stable202205
Sivaparvathi C [Fri, 28 Oct 2022 07:18:32 +0000 (12:48 +0530)]
MdeModulePkg/Ufs :Coverity scan flags multiple issues in edk2-stable202205

BugZilla ID:https://bugzilla.tianocore.org/show_bug.cgi?id=3989

Added changes to resolve the Coverity Issues in UFS driver

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi Chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoMdeModulePkg/scsi :Coverity scan flags multiple issues in edk2-stable202205
Sivaparvathi C [Thu, 27 Oct 2022 11:06:59 +0000 (16:36 +0530)]
MdeModulePkg/scsi :Coverity scan flags multiple issues in edk2-stable202205

Added changes to resolve the SCSI driver Coverity issues.

Cc: Vasudevan Sambandan <vasudevans@ami.com>
Cc: Sundaresan Selvaraj <sundaresans@ami.com>
Signed-off-by: Sivaparvathi chellaiah <sivaparvathic@ami.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoIntelFsp2Pkg: FSP should support input UPD as NULL.
Chasel Chiu [Mon, 24 Oct 2022 03:00:57 +0000 (20:00 -0700)]
IntelFsp2Pkg: FSP should support input UPD as NULL.

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

FSP specification supports input UPD as NULL cases which FSP will
use built-in UPD region instead.
FSP should not return INVALID_PARAMETER in such cases.

In FSP-T entry point case, the valid FSP-T UPD region pointer will be
passed to platform FSP code to consume.
In FSP-M and FSP-S cases, valid UPD pointer will be decided when
updating corresponding pointer field in FspGlobalData.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
Reviewed-by: Ted Kuo <ted.kuo@intel.com>
18 months agoMdeModulePkg/PiSmmCore: SmmEntryPoint underflow (CVE-2021-38578)
Miki Demeter [Thu, 27 Oct 2022 23:20:54 +0000 (16:20 -0700)]
MdeModulePkg/PiSmmCore: SmmEntryPoint underflow (CVE-2021-38578)

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

Added use of SafeIntLib to validate values are not causing overflows or
underflows in user controlled values when calculating buffer sizes.

Signed-off-by: Miki Demeter <miki.demeter@intel.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoIntelFsp2Pkg: Update Function header to support IA32/X64.
Chasel Chiu [Fri, 28 Oct 2022 02:37:27 +0000 (19:37 -0700)]
IntelFsp2Pkg: Update Function header to support IA32/X64.

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

Common functions will have either 32bit or 64bit instances which
having different return code size. Function header should support both
scenarios.

Cc: Nate DeSimone <nathaniel.l.desimone@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Signed-off-by: Chasel Chiu <chasel.chiu@intel.com>
Reviewed-by: Nate DeSimone <nathaniel.l.desimone@intel.com>
18 months agoUefiCpuPkg/SmmCpuFeaturesLib: Clean up header file inclusion in SmmStm.c
Abner Chang [Mon, 31 Oct 2022 07:59:36 +0000 (15:59 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Clean up header file inclusion in SmmStm.c

BZ# 4093: Abstract SmmCpuFeaturesLib for sharing common code

Remove the header files those are already included in
CpuFeatureLib.h.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Paul Grimes <paul.grimes@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
18 months agoUefiCpuPkg/SmmCpuFeaturesLib: Abstract arch dependent code
Abner Chang [Mon, 31 Oct 2022 02:37:49 +0000 (10:37 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Abstract arch dependent code

BZ# 4093: Abstract SmmCpuFeaturesLib for sharing common code

This change stripped away the code that can be
shared with other archs or vendors from Intel
implementation and put in to the common file,
leaves the Intel X86 implementation in the
IntelSmmCpuFeatureLib. Also updates the header
file and INF file.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Paul Grimes <paul.grimes@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
18 months agoUefiCpuPkg/SmmCpuFeaturesLib: Rename the common C file
Abner Chang [Sat, 1 Oct 2022 15:09:54 +0000 (23:09 +0800)]
UefiCpuPkg/SmmCpuFeaturesLib: Rename the common C file

BZ# 4093: Abstract SmmCpuFeaturesLib for sharing common code

Rename SmmCpuFeaturesLiCommon.c to
IntelSmmCpuFeaturesLib, because it was developed
specifically for Intel implementation. The code
that can be shared by other archs or vendors
will be stripped away and put in the common
file in the next patch.

Signed-off-by: Abner Chang <abner.chang@amd.com>
Cc: Abdul Lateef Attar <abdattar@amd.com>
Cc: Garrett Kirkendall <garrett.kirkendall@amd.com>
Cc: Paul Grimes <paul.grimes@amd.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Reviewed-by: Ray Ni <ray.ni@intel.com>
18 months agoCryptoPkg/Test: Simplify BaseCryptLib host based unit tests
Michael D Kinney [Fri, 28 Oct 2022 18:58:24 +0000 (11:58 -0700)]
CryptoPkg/Test: Simplify BaseCryptLib host based unit tests

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

Remove TestBaseCryptLibHostAccel.inf and instead use FILE_GUID
override in DSC file to run the same unit test INF against
OpensslLibFull.inf and OpensslLibFullAccel.inf

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Xiaoyu Lu <xiaoyu1.lu@intel.com>
Cc: Guomin Jiang <guomin.jiang@intel.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
18 months agopip-requirements.txt: Bump pytool extensions and library
Michael Kubacki [Tue, 1 Nov 2022 23:40:14 +0000 (07:40 +0800)]
pip-requirements.txt: Bump pytool extensions and library

Fixes edk2 CI failure due to VM images being updated to Python 3.11
and the old pip modules not being compatible with Python 3.11.

Updates the following pip modules:

  - edk2-pytool-library from 0.11.2 to 0.11.6
  - edk2-pytool-extensions from 0.16 to 0.19.1

Needed to fix an issue with Python 3.11 compatibility.

Cc: Sean Brogan <sean.brogan@microsoft.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Chasel Chiu <chasel.chiu@intel.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
18 months agoUnitTestFrameworkPkg: Support FILE_GUID override in host based unit tests
Michael D Kinney [Fri, 28 Oct 2022 15:41:34 +0000 (08:41 -0700)]
UnitTestFrameworkPkg: Support FILE_GUID override in host based unit tests

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

Always use the module name with FILE_GUID to generate the host-based
unit test executable image and symbol files.  This allows the same
host-based unit test INF file to be used more than once in a single
DSC file with FILE_GUID override.  This is valuable when there is a
requirement to run the same host-based unit test with different PCD
settings, library mappings, or build options.

Cc: Michael Kubacki <mikuback@linux.microsoft.com>
Cc: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Reviewed-by: Michael Kubacki <mikuback@linux.microsoft.com>
Reviewed-by: Sean Brogan <sean.brogan@microsoft.com>
18 months agoOvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages
Min M Xu [Tue, 1 Nov 2022 05:13:49 +0000 (13:13 +0800)]
OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages

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

After EdkiiMemoryAcceptProtocol is implemented in TdxDxe driver, we can
call it to accept pages in DXE 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>
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>
18 months agoOvmfPkg: Realize EdkiiMemoryAcceptProtocol in TdxDxe
Min M Xu [Tue, 1 Nov 2022 05:13:48 +0000 (13:13 +0800)]
OvmfPkg: Realize EdkiiMemoryAcceptProtocol in TdxDxe

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

Memory usage may exceed the amount accepted at the begining (SEC), TDVF
needs to accept memory dynamically when OUT_OF_RESOURCE occurs.

Another usage is in SetOrClearSharedBit. If a memory region is changed from
shared to private, it must be accepted again.

EdkiiMemoryAcceptProtocol is defined in MdePkg and is implementated /
installed in TdxDxe for Intel TDX memory acceptance.

Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.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>
18 months agoMdePkg: The prototype definition of EdkiiMemoryAcceptProtocol
Jiaqi Gao [Tue, 1 Nov 2022 05:13:47 +0000 (13:13 +0800)]
MdePkg: The prototype definition of EdkiiMemoryAcceptProtocol

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

EdkiiMemoryAcceptProtocol is defined in MdePkg, the method AcceptMemory()
can be called when memory needs to be accepted.

EdkiiMemoryAcceptProtocol can be installed by architecture-specific
drivers such as TdxDxe. This allows different isolation architectures
to realize their own low-level methods to accept memory.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Erdem Aktas <erdemaktas@google.com>
Cc: Gerd Hoffmann <kraxel@redhat.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>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
Signed-off-by: Min Xu <min.m.xu@intel.com>