This change adds a few preprocessors to build AArch64 host based unit
tests properly.
An AArch64 specific instance of `gUnitTestHostBaseLib` is created to
abstract the reference of arch specific special instructions.
Signed-off-by: Kun Qin <kuqin12@gmail.com>
This change updates the iasl binary to the 20230628 release.
The updated release also adds support for execution on ARM host machines.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
When edk2 runs as a kvmtool guest with nested virtualization enabled,
the Arm architectural timer DT node contains five interrupt specifiers.
The fifth interrupt describes the EL2 virtual timer.
ArmGenericTimerParser currently expects exactly four timer interrupts.
It therefore asserts when parsing the timer node generated for a nested
virtualization guest.
Determine the number of interrupt specifiers present in the DT and
populate each architectural timer entry only when it is available.
Add support for the EL2 virtual timer and use it to populate the
VirtualPL2Timer fields in the generated GTDT information.
Tested as a KVM guest at EL1 and EL2, with both E2H==0 and E2H==1.
Signed-off-by: Marc Zyngier <maz@kernel.org>
[Varshit Pandya: Rewrite commit message for clarity.]
Ref: https://edk2.groups.io/g/devel/message/122008
Signed-off-by: Varshit Pandya <varshit.pandya@arm.com>
In AmlCodeGenRdInterrupt(), the IRQ list was copied directly into an
EFI_ACPI_EXTENDED_INTERRUPT_DESCRIPTOR structure allocated on the stack.
Since the structure only contains storage for the first interrupt entry,
copying multiple IRQs would write beyond the allocated buffer and corrupt
the stack.
Fix this issue by allocating the descriptor dynamically with sufficient
space to accommodate the entire IRQ list. This ensures all interrupt entries
are copied safely without overwriting adjacent stack memory.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
Add support for generating AML methods that return a buffer through the
new AmlCodeGenMethodRetBuffer() API.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
There is currently no API available for generating AML methods without
a return value. This change exports the AmlCodeGenMethod API so it can
be used to create non-returning methods when required.
Signed-off-by: Tuan Phan <tuan.phan@oss.qualcomm.com>
UsbSelectConfig will introduce the UsbConnectDriver call.
If this UsbPortReset is happened in the Usb device driver Start() routine and the device FW can not be recovered by PortReset, the UsbSelectConfig will introduce the recursive loop.
[Suggested solution]
Since UsbPortReset should not change the Bus Topology, the Reset flow should only SetAddress and reconfigure the device.
Signed-off-by: Marlboro Chuang <marlboro.chuang@dell.com>
Signed-off-by: Jared Pan <jared.pan@dell.com>
Register a variable policy for L"RTCALARM" and L"RTC".
The policy will enforce strict requiremnts for the variable
size and attributes, and will block updates to the variables
unless those requirements are met.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Now the logic of the function is less convoluted, drop some redundant
casts, variable initialisations and move the MiddleCount definition
into the only block where it's used.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
A multi-part request can consist of a Start, zero-to-several Middle,
and an End packet. For what I can only assume was an attempt to
confuse the enemy, SsifWriteRequest () handled this by setting up
three separate loops.
Rewrite this as a single loop in order to reduce confusion for
revewers and compilers.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
From the IPMI v2.0 (April 21, 2015 E7 Markup) specification,
Table 22-12, Get System Interface Capabilities Command:
"Input message size in bytes. (1 based.)"
...
"A BMC that supports multi-part Start and End would return
a value from 33 to 64. A BMC that supports multi-part with Middle
transactions would return a value from 65 to 255."
Yet the comment in the existing code describes this as being a
counter of the number of middle packets, with Start and End packets
counting outside of that. This seems very incorrect to me.
Address this, and simplify the code, by using the already existing
global variable mMaxRequestSize. Update the debug error message
text to reflect the functional change.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
For some reason this module was created "backwards", with .inf files
in subdirectories, as well as identical apart from failes to keep in
sync source files for Dxe and Pei drivers.
Flip the thing the right way around and delete the duplicated files.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
While reviewing PR #12035, I found this function a bit overcomplicated,
with a bunch of live-coded integers, so I reworked it for improved
human and compiler readability.
Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
Fixing all markdown lint errors found by running markdownlint-cli.
Verified that rendering still shows valid information.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
Today's implementation used a hardcoded value for the I/O Port
Base Address. This creates a problem for platform configurability.
If a platform needs to use a different I/O port address, then
it requires modification of a source file.
Create gPcAtChipsetPkgTokenSpaceGuid.PcdUartIoPortBaseAddress
as a FixedAtBuild pcd scoped to PcAtChipsetPkg, with default
value for 0x3f8 to match existing value, and update
code to use PCD.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
In some VS22 versions, these code patterns (assiging the scalar in
a loop) have been found to be converted into calls to the `memcpy`
intrinsic. This change updates them to use CopyMem to avoid the
potential error.
Previous:
- MSVC version: 14.31.31103
New:
- MSVC version: 14.32.31326
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
https://codeql.github.com/codeql-query-help/cpp/cpp-comparison-with-wider-type
If the narrow type (smaller range) is compared against a wide type
(larger range), the narrow value may overflow before reaching the wide
value. This can cause unexpected behavior, such as:
Infinite loops (loop condition never becomes false).
Incorrect logic (comparison results are misleading).
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
This adds the ability to pass PATH_TO_OS to the
PlatformBuild.py scripts in the PlatformCI folder.
This allows easy booting to an OS (or generically adding a
drive) while using the standard PlatformBuild.py for OvmfPkg.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This adds the ability to pass PATH_TO_OS to the
PlatformBuild.py scripts in the PlatformCI folder.
This allows easy booting to an OS (or generically adding a
drive) while using the standard PlatformBuild.py for ArmVirtPkg.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
The misc MM communicate buffer now stores the FF-A direct message
registers in an ARM_FFA_ARGS layout that preserves the native register
indices. The TCG physical presence callback must therefore locate the
TCG_NVS payload at the correct register offset instead of the start of
the communication buffer.
Point LocalTcgNvs at CommBuffer + OFFSET_OF (ARM_FFA_ARGS, Arg4) and
validate the buffer size against sizeof (ARM_FFA_ARGS). Add a
STATIC_ASSERT to guarantee TCG_NVS fits within the register space
available for the direct message payload, and include ArmFfaLib.h for
the ARM_FFA_ARGS definition.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
The MISC_MM_COMMUNICATE_BUFFER stored the FF-A direct message
registers in a DIRECT_MSG_ARGS structure. Populating and reading it
required manually re-indexing every register (EventSvcArgs->Arg4..Arg17
into DirectMsgArgs.Arg0..Arg13). This shifted the register positions and
left the buffer layout inconsistent with the raw FF-A argument register
file, making it error prone to correlate a slot with its architectural
register.
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
`TlsNew()` explicitly sets the default security level to 3. The current
default in OpenSSL is security level 2 which is inherited by Linux
distributions like Ubuntu 26.04. This is also the security level that
was announced in https://edk2.groups.io/g/devel/topic/115039926.
Signed-off-by: Jean-Tiare Le Bigot <jt@yadutaf.fr>
This plugin runs markdownlint against all markdown files in a given
package to report linter errors.
See the following readme for me details:
.pytool/Plugin/MarkdownLintCheck/Readme.md
Co-authored-by: Sean Brogan <sean.brogan@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
In preparation for the MarkdownLintCheck plugin being added to the
repo, this change defaults the plugin to `AuditOnly` mode in each
package. This allows package maintainers to enable the plugin as they
see fit.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
1. To provide greater clarity and consistency, the file instructions
are updated to indicate that entries should be added after existing
entries within a given section so that they are in chronological
merge order within the section.
2. Existing entries are sorted accordingly.
3. Existing entries are updated to have consistent style and some
section header levels are adjusted to properly reflect the level
of the section.
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
Add EFI_MEMORY_XP to all MapMmioMemory() calls in ProcessPciHost() for:
- ECAM space
- Translated I/O window
- 32-bit MMIO window
- 64-bit MMIO window
These regions are data/MMIO only and should not be executable. Marking them
with EFI_MEMORY_XP improves memory protection hardening without changing
intended runtime behavior.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
PlatformPeiLib consumes QemuFwCfgSimpleParserLib, but ArmVirtXen.dsc
provided no resolution for it or its dependency QemuFwCfgLib, causing:
error 4000: Instance of library class [QemuFwCfgSimpleParserLib]
is not found for module [ArmVirtPrePiUniCoreRelocatable.inf],
consumed by PlatformPeiLib.inf
Wire up QemuFwCfgLibNull and QemuFwCfgSimpleParserLib in the common
ArmVirt.dsc.inc so all platforms without fw_cfg fail gracefully.
ArmVirtCloudHv.dsc already carried the same null pair; both per-DSC
copies are removed now that the common default covers them.
ArmVirtQemu and ArmVirtQemuKernel continue to override with their
real MMIO implementations.
Fixes: f4bbef1dd7 ("ArmVirtPkg: introduce compile and runtime control of serial debug log level")
Reported-by: Pierre Gondois <pierre.gondois@arm.com>
Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
This updates all GitHub Actions using VS2022 to
VS2026.
Note, windows-2025 is the VM image that contains
VS2026. 2025 refers to the Windows Server version,
not the VS version. GitHub runners have updated the
windows-2025 VM version to include VS2026, so no
additional migration is required.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This upgrades the Azure Pipelines CI to use
VS2026 instead of VS2022.
The Windows VM image is updated to windows-2025-vs2026 which
has been updated to use VS2026. Note, 2025 references
the Windows Server release, not the VS version. Azure pipelines
has not migrated its windows-2025 VM image to use VS2026 yet,
it will do so after that feature is GA'd, at which point edk2
will have time to update to that VM image.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
edk2 is moving to VS2026 for the MSVC toolchain.
Update the building instructions and DSC conditionals.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
edk2 is moving to VS2026 for the MSVC toolchain,
as such, upgrade the Windows BaseTools build default
from VS2022 -> VS2026.
Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Updated the ACPI code to fix an issue where the template was
outdated and the revision was reporting V5 but the template was still
using the V4 version of the Start Method specific parameters.
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
Update SmbiosSmcLib to use ArmSmcccSocIdLib for retrieving the JEP106
identification code and SoC revision.
Remove the duplicated SMCCC feature detection and SoC ID calls while
retaining the SMBIOS-specific formatting of the Type 4 Processor ID.
Signed-off-by: Varshit Pandya <Varshit.Pandya@arm.com>
Add ArmSmcccSocIdLib to provide a shared interface for checking support
for the SMCCC Architecture SoC ID service and retrieving the JEP106
identification code and SoC revision.
Move the existing SMCCC SoC ID handling out of ProcessorSubClassDxe and
update the driver to use the new library. Continue to use the MIDR value
for the SMBIOS Processor ID when the SMCCC SoC ID service is unavailable.
This allows other SMBIOS implementations to reuse the SMCCC handling
without duplicating it or depending on the legacy ProcessorSubClassDxe
driver.
Signed-off-by: Varshit Pandya <Varshit.Pandya@arm.com>
Fixing all markdown lint errors found by running markdownlint-cli.
Verified that rendering still shows valid information.
Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
In MmiHandlerRegister(), the MmiHandler structure is currently
allocated before looking up the target MmiEntry. If the lookup
fails, the function returns an error but the allocated MmiHandler
is never freed, causing a memory leak.
This patch moves the allocation of MmiHandler and its initialization
to after the MmiEntry lookup and validation. This ensures that memory
is only allocated when the operation can succeed, eliminating the need
for a FreePool() on the error path and simplifying the error handling
logic.
Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
Suggested-by: Ray Ni <ray.ni@intel.com>