This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Lower the indentation level in the newly created MainCmdXXX()
functions.
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- HexEdit/HexEdit.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Extract a MainCmdXXX() function for each shell command.
This command contains the possible operations the command aims
to operate. The ShellCommandRunXXX() function from which it
is extracted is only responsible of:
- initializing the shell/command environment
- parsing the command parameter and creating a Package
- freeing the Package
For the MemMap and SetVar commands, ShellCommandLineFreeVarList()
calls are removed as the Package is now freed in the caller
function: ShellCommandRunXXX().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
If ShellCommandLineParse() fails, there is no need to free:
- InputStr
- Package
Remove the goto statement.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Package is sometimes initialized to NULL and only
freed if not NULL. Remove these as:
- Package is initialized in ShellCommandLineParse().
- If ShellCommandLineFreeVarList() is reached,
Package cannot be NULL.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- SerMode.c
- SetSize.c
- SetVar.c
- SmbiosView/SmbiosView.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- MemMap.c
- Mm.c
- Mode.c
- Pci.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Edit/Edit.c
- EfiCompress.c
- EfiDecompress.c
- HexEdit/HexEdit.c
- LoadPciRom.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
This patch aims to help breaking down the long functions present in
the ShellPkg and reduce complexity/nested code and conditions.
Return directly if ShellCommandLineParse() returned an error Status.
In such case, the "Package" that should be allocated by
ShellCommandLineParse() is already freed in:
ShellCommandLineParse()
\-ShellCommandLineParseEx()
\-InternalCommandLineParse()
so there is no need to free it with ShellCommandLineFreeVarList().
To avoid having one large commit updating all the UefiShellDebug1
commands, only update these files:
- Comp.c
- Cxl.c
- Dblk.c
- Dmem.c
- DmpStore.c
No functional change should be induced by this patch.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Package is always freed in ShellCommandRunLs().
Remove calls to ShellCommandLineFreeVarList() in MainCmdLs().
This double-free was introduced in:
commit 531b0aa002 ("ShellPkg/UefiShellLevel2:
Extract MainCmdXXX() function")
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
The commented out code snippet seems to try to create a new file
with the user input filename. FileBufferRead() seems to have replaced
this code snippet in a better wrapper:
- if the file exists, open it
- otherwise, create the file
Remove the commented-out code snippet.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Updated Tpm2DeviceLibFfa to no longer use globals. Updated the
SEC version of Tpm2DeviceLibFfaBase to no longer use globals
when including TPM libraries in the SEC phase. Includes various
cleanup regarding the updated files.
Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
The TcpDxe driver requires the Hash2 protocol to be available for its
dispatch. On the LoongArchVirt QEMU platform, this protocol was not
previously included, leading to failures when the network stack attempted
to initialize.
Add SecurityPkg/Hash2DxeCrypto to both the DSC and FDF files, ensuring
that the Hash2 protocol is installed and can be consumed by TcpDxe.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Use TPM 1.2 and TPM 2.0 in setup titles instead of the
implementation-facing TCG and TCG2 names.
Signed-off-by: Herve ELTER <rvnvv74@gmail.com>
Signed-off-by: Matt DeVillier <matt.devillier@gmail.com>
Signed-off-by: Sean Rhodes <sean@starlabs.systems>
The libspdm submodule was pinned at 3.7.0 (2025-04-03), three releases behind
upstream 3.8.2 (2026-04-03). libspdm processes untrusted responder (device)
data in the SPDM device attestation path, so tracking upstream keeps that
parsing current with fixes and hardening.
Two responder-side advisories were resolved between 3.7.0 and 3.8.2:
- GHSA-j54w-759w-xj3m: out-of-bounds write in GET_CSR handling.
- GHSA-m4wc-xmvg-369f: integer overflow / out-of-bounds read in
GET_MEASUREMENT_EXTENSION_LOG handling.
Both are responder-side. edk2 links SpdmRequesterLib (it acts as the SPDM
Requester that verifies an untrusted device Responder), so these responder
handlers are not built into edk2 images; this update is defense-in-depth
rather than a fix for a path reachable in edk2 today.
The libspdm sources referenced by the SpdmLib INFs are unchanged in 3.8.2
(the only additions are the optional ENDPOINT_INFO capability sources, which
edk2 does not enable), so no INF change is required.
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Chris Fernald <chfernal@microsoft.com>
Signed-off-by: Mikey Strauss <mdstrauss91@gmail.com>
For each structured-PCD field copied via memcpy, DscBuildData.py
emits the clamp expression, '(FieldSize > 0 && FieldSize < ValueSize) ?
FieldSize : ValueSize'. When ValueSize == 1 and FieldSize is unsigned,
it reduces to (FieldSize > 0 && FieldSize < 1) - always-false comparison.
Clang flags it under -Wtautological-overlap-compare, and because
PcdValueInit builds with -Werror, autogen fails and the build aborts with
'PcdValueInit.c: error: overlapping comparisons always evaluate to false
[-Werror,-Wtautological-overlap-compare]'. This is specific to Clang host.
To fix it, this update changes '<' to '<=' at all five generator sites in
DscBuildData.py (GenerateDefaultValueAssignFunction,
GenerateInitValueFunction, GenerateCommandLineValue,
GenerateModuleScopeValue, GenerateFdfValue). Behavior is unchanged:
both branches copy the same byte count when FieldSize == ValueSize.
GCC and MSVC builds are unaffected.
Signed-off-by: Phil Noh <Phil.Noh@amd.com>
In TDX mode MmioRead* functions can not access memory, so avoid that.
See added source code comments for details.
Fixes: 0917ddad25 ("OvmfPkg/EmuVariableFvbRuntimeDxe: avoid accessing varstore header with cmp")
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
TcpDxe depends on gEfiHash2ServiceBindingProtocolGuid, which nothing on
the platform produces, so it is built into the FV but never dispatched.
Add Hash2DxeCrypto, as ArmVirtQemu does. The rest of NetworkPkg depends
on gEfiRngProtocolGuid, produced by VirtioRngDxe when the VM is given a
virtio-rng device.
Signed-off-by: Nick Owens <mischief@offblast.org>
Fix CpuGetInterruptState() to read the actual hardware interrupt flag
(sstatus.SIE) via BaseLib's GetInterruptState() instead of returning a cached
boolean variable. The cached variable becomes stale in interrupt context
where hardware disables interrupts without going through the protocol's
DisableInterrupt() call.
This is a PI Spec conformance fix: EFI_CPU_ARCH_PROTOCOL.GetInterruptState()
is specified to return the current processor interrupt state.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
Fix CpuGetInterruptState() to read the actual hardware interrupt flag
(RFLAGS.IF) via BaseLib's GetInterruptState() instead of returning a cached
boolean variable. The cached variable becomes stale in interrupt context
where hardware disables interrupts without going through the protocol's
DisableInterrupt() call.
This is a PI Spec conformance fix: EFI_CPU_ARCH_PROTOCOL.GetInterruptState()
is specified to return the current processor interrupt state.
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
In case EntryPointStructure does not exist yet use a length of zero instead of
skipping the check altogether. Fixes a heap overflow in the following code
flow in case the first smbios table installed is larger than
SMBIOS_TABLE_MAX_LENGTH.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Dispatch Shutdown Notification to every NVMe first, then polling
every NVMe t omaake sure all NVMe's shutdown processing is
completed.This will help to save a lot time when BIOS trigger
reset for Servers whose have many NVMes. Tested on a platform
with AMD EPYC cpu with 26 NVMes, this method reduce reset time
from 3 minutes to 10 seconds.
Signed-off-by: Theo <theo.tao@foxmail.com>
Remove the ACPI_AML_STA_PROC_SUPPORTED macro to make use
of the new MdePkg macro: ACPI_AML_STA_BASE_SUPPORTED.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Make use of the previously introduced StaToken field to
generate a _STA method describing the status of a processor
or processor container.
staSupp
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Add a new StaToken field to CM_ARCH_COMMON_PROC_HIERARCHY_INFO
CmObj, allowing to describe the ASL "_STA" value the processor
or processor container should return.
CM_X64_LOCAL_APIC_X2APIC_INFO.StaToken already allows to reference
a StaToken from a X2APIC CmObj. If ProcHierarchy objects are used,
the SSDT CPU topology table will be generated using the X2APIC
objects, so the new field should not collide with the new one.
Add a note to CM_X64_LOCAL_APIC_X2APIC_INFO.StaToken
to handle this case.
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
Add a ACPI_AML_STA_DEVICE_STATUS_PRESENT macro without typo,
the previous one should be removed ultimately.
Introduce macros for _STA supported bits:
- STA_BASE_SUPPORTED
- STA_SUPPORTED
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
MemoryBinGoogleTest.PopulatesFromValidHob asserted fixed page counts for
each memory type. PopulateMemoryTypeInformation, however, rounds the
runtime memory types (EfiReservedMemoryType, EfiACPIMemoryNVS,
EfiRuntimeServicesCode, EfiRuntimeServicesData) up to
RUNTIME_PAGE_ALLOCATION_GRANULARITY. That granularity equals EFI_PAGE_SIZE
on IA32/X64, so the hard-coded values happened to match, but it is 64 KiB
on AArch64, where the same inputs round up to different page counts and the
test failed.
Compute the expected page counts with the same granularity rounding the
production code uses, so the test passes on all host architectures instead
of only x86.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
Add AARCH64 to SUPPORTED_ARCHITECTURES so the SecurityPkg
host-based unit tests build and run on an AARCH64 host. Depends
on the AARCH64 host-test framework enablement
(UnitTestFrameworkPkg/MdePkg).
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
BaseRngLib's AARCH64 backend uses an RNDR instruction path that does not
link in the host environment. Map RngLib to BaseRngLibNull for AARCH64
host builds (IA32/X64 keep BaseRngLib) and hoist the common RngLib mapping
so the per-component override can be dropped.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
The host-based BaseCryptLib instance (UnitTestHostBaseCryptLib.inf) built
Rand/CryptRandTsc.c only for IA32/X64. Add Rand/CryptRand.c for AARCH64 so
the openssl-backed RandomSeed() is available when linking AARCH64 host
tests, and advertise AARCH64 in VALID_ARCHITECTURES.
Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
The current instance does not support host based test on AArch64 host
system due to its dependency on hardware UART library.
This change created a new instance that does not initialize the serial
port for host based test applications.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
Current FunctionMockLib is relying on the subhoob module to support the
backend operation by bitbanging the binary post-disassembly.
However subhook module is a x64 centric module and does not support
AArch64 usage.
This change removes the mock function support for AArch64. The
functionality will need other solutions to be properly supported.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
This change adds the support of float operations for AArch64 host based
unit tests by overriding the compiler flags.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
AArch64 does not generate divide-by-zero exceptions like x86. Yet the
current generate exception test is using this operation to attempt
triggering exceptions.
This change abstracted the exception generation logic into per-arch
files and use undefined instruction to trigger AArch64 exceptions.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
The SampleGoogleTestGenerateException GoogleTest sample previously
generated a CPU exception by performing an integer divide by zero. That
mechanism is X86-specific: the AArch64 architecture defines SDIV/UDIV by
zero to return zero rather than raising a synchronous abort, so the
sample produced no exception when built and run on AArch64 hosts and the
test failed due to the test assert instead of triggering an exception
through the framework.
This change replaces the divide-by-zero with a NULL pointer write
performed through a small volatile helper, which is expected to work on
all host systems.
The MSVC '/wd4723' build option is no longer needed because it was added
to silence the divide-by-zero compile-time warning.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
AArch64 does not have divide-by-zero exception.
This change modifies the corresponding test to work with AArch64.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
The existing UnitTestHostBaseLib has some source entries that are either
redundant or for unsupported architectures.
This change consolidated the redundant entries and removed the entries
for unsupported architectures.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>