Commit Graph

34713 Commits

Author SHA1 Message Date
Sherry Fan
8d984e6a57 MdeModulePkg: XhciDxe: Fix comment grammar in XhcMonitorAsyncRequests
Clarify wording of the comment before the callback in XhcMonitorAsyncRequests.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2025-08-11 18:15:25 +00:00
Sherry Fan
6d37ca427e MdeModulePkg: XhciDxe: Fix USB reset issue: callback / update order
As noted in the comment above the callback invocation,
the URB's callback may free the URB, so any
operations, including updates, must occur before the callback.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2025-08-11 18:15:25 +00:00
Sherry Fan
e69d7653b9 MdeModulePkg: XhciDxe: Fix USB reset issue: use after free
`XhcFreeUrb` attempts to unmap `Urb->DataMap` after
`FreePool(Urb->Data)` has already been called in some cases, causing a
use after free. Change the ordering so `Data` is freed after `Unmap`and
only freed when appropriate.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2025-08-11 18:15:25 +00:00
Bob Morgan
b58ce4c226 MdeModulePkg: Support conditional UFS initialization
Add SkipHceReenable and SkipLinkStartup flags to
the EDKII_UFS_HC_PLATFORM_PROTOCOL to support
using a UFS controller that has already been
initialized.

Signed-off-by: Bob Morgan <bobm@nvidia.com>
2025-08-08 09:06:56 +08:00
Arun Subramanian Baskaran
9baa6193c2 Update reviewer for SecurityPkg: Tcg related modules and UefiCpuPkg
Add arunsbaskaran as reviewer for SecurityPkg: Tcg related modules and
UefiCpuPkg.
Remove rahul1-kumar as reviewer from SecurityPkg: Tcg related modules
and UefiCpuPkg.

Signed-off-by: Arun Subramanian Baskaran <arun.subramanian.baskaran@intel.com>
2025-08-07 20:29:57 +00:00
Benjamin Doron
4488d4479a UefiPayloadPkg/BlSupportDxe: Drop manual reservations for APIC and HPET
The entrypoint module should do this programmatically using resources
passed by the bootloader. Under UPL, bootloaders are expected to pass
such ranges in the FDT.

Signed-off-by: Benjamin Doron <benjamin.doron@9elements.com>
2025-08-07 11:52:36 +00:00
Ard Biesheuvel
44d88d5d0c MdeModulePkg: Remove obsolete PEI_USB_HOST_CONTROLLER_PPI
This PPI is no longer used - the EHCI and XHCI host controller PEIMs
expose PEI_USB2_HOST_CONTROLLER_PPI instead.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-08-07 10:49:22 +00:00
Ard Biesheuvel
834586f316 MdeModulePkg/UsbBusPei: Drop support for obsolete host controller PPI
There are two versions of the USB host controller PPI, and only the
newer one, called PEI_USB2_HOST_CONTROLLER_PPI, is actually produced by
the EHCI and XHCI host controller PEIMs in EDK2. (The other PPI was only
produced by UhciPei which has been removed)

So remove all the conditionally executed code based on the distinction
between the two PPIs, and only support the newer one.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-08-07 10:49:22 +00:00
Ard Biesheuvel
4e950950a4 MdeModulePkg/Usb: Remove UhciPei
Remove the UHCI PEI module, which is unused (in edk2-platforms) and
obsolete. It also implements an older version of the USB host controller
PPI, which can be dropped from EDK2 entirely once this driver is gone.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2025-08-07 10:49:22 +00:00
Michael Kubacki
9688712f1d MdeModulePkg: Usb cumulative codeql issues.
Running Codeql on the MdeModulePkg\Bus\Usb drivers results in
codeql errors stemming for the following two checks.

- cpp/comparison-with-wider-type
- cpp/overflow-buffer

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Co-authored-by: Taylor Beebe <tabeebe@microsoft.com>
Co-authored-by: pohanch <125842322+pohanch@users.noreply.github.com>
Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com>
Co-authored-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Co-authored-by: Sean Brogan <sean.brogan@microsoft.com>
Co-authored-by: Aaron <aaronpop@microsoft>
2025-08-07 09:10:24 +00:00
Michael Kubacki
d68f418300 MdeModulePkg: Variable cumulative codeql issues.
Running Codeql on MdeModulePkg/Universal/Variable drivers results
in codeql errors stemming for the following two checks.

- cpp/comparison-with-wider-type
- cpp/overflow-buffer
- cpp/missing-null-test

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Co-authored-by: Taylor Beebe <tabeebe@microsoft.com>
Co-authored-by: pohanch <125842322+pohanch@users.noreply.github.com>
Co-authored-by: kenlautner <85201046+kenlautner@users.noreply.github.com>
Co-authored-by: Oliver Smith-Denny <osde@linux.microsoft.com>
Co-authored-by: Sean Brogan <sean.brogan@microsoft.com>
Co-authored-by: Aaron <aaronpop@microsoft>
2025-08-07 07:57:31 +00:00
Hunter Chang
504a80c151 SecurityPkg/Tcg/OpalPasswordDxe: Fix logic for RemoveDevice()
First, If there are multiple devices in DeviceList and are going to
remove the first device in the DeviceList, the DeviceList will be
cleared up with setting to NULL.
This is not the expected behavior, as it should keep the rest of the
devices in the DeviceList. DeviceList should point to the next device,
Dev->Next.

Second, there is a potential infinite while loop if TmpDev->Next not
equal to Dev. TmpDev should point to next device.

Signed-off-by: Hunter Chang <hunter.chang@intel.com>
2025-08-07 06:40:28 +00:00
Star Zeng
bd785cedc3 StandaloneMmPkg/MmCore: Correct EndOfDxe to EndOfPei in MmEndOfPeiHandler
Signed-off-by: Star Zeng <star.zeng@intel.com>
2025-08-07 03:55:18 +00:00
Star Zeng
d192e7ea75 StandaloneMmPkg/MmIpl: Correct CreatMmHobList to CreateMmHobList
Signed-off-by: Star Zeng <star.zeng@intel.com>
2025-08-07 03:55:18 +00:00
Oliver Steffen
9418a9f1e7 .azurepipelines: Use Fedora 41 image for Linux CI jobs
Fedora 40, which is currently used as the base image for
the Linux jobs in the CI, is EOL.
Switch over to the Fedora 41 image (gcc 14).

Signed-off-by: Oliver Steffen <osteffen@redhat.com>
2025-08-07 03:06:01 +00:00
Alexander Gryanko
057a611ae6 SecurityPkg: Added basic DxeImageVerificationLib tests
Add initial unit test for DxeImageVerificationHandler to
validate signature verification bypass for selected image types.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-08-07 01:18:26 +00:00
Alexander Gryanko
5125e2d6b1 CryptoPkg: workaround for MSVC linking tolower
Currently when building NOOPT tests in MSVC, the linker cannot
pick the correct tolower for the host runtime. A small
workaround to make the build work in MSVC.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-08-07 01:18:26 +00:00
Alexander Gryanko
d55642f537 MdePkg: added mocks for DevicePathLib and OpenProtocol
Added Google Mock test support for DevicePathLib.
Added OpenProtocol and CloseProtocol for UefiBootServicesTableLib
mock library.

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-08-07 01:18:26 +00:00
Alexander Gryanko
1c3a22059b MdeModulePkg: added SecurityManagementLib mock
Added Google Mock test support for SecurityManagementLib

Signed-off-by: Alexander Gryanko <xpahos@gmail.com>
2025-08-07 01:18:26 +00:00
Poncho Figueroa
3f453cd7aa Add Poncho Figueroa as BaseTools reviewer
Signed-off-by: Poncho Figueroa <poncho.figueroa.esqueda@intel.com>
2025-08-06 23:13:20 +00:00
Star Zeng
d1c1f7e354 StandaloneMmPkg/MmIpl: Call CreatMmHobList() with page aligned size
MmCore ImageSize may be not page aligned, it will be converted to page
aligned for allocating MMRAM to hold MmCore image.

This patch is to call CreatMmHobList() with page aligned size of ImageSize,
otherwise ASSERT (IS_ALIGNED (Length, EFI_PAGE_SIZE)) in
MmIplBuildMmCoreModuleHob() will happen if the input MmCore  ImageSize is
not page aligned.

Signed-off-by: Star Zeng <star.zeng@intel.com>
2025-08-06 20:36:39 +00:00
Gowtham M
0662754134 MdePkg/Library: Remove MM_STANDALONE LibraryClass in UefiDevicePathLib.inf
UefiDevicePathLib.inf consumes Boot Services in
MdePkg/Library/UefiDevicePathLib/DevicePathUtilitiesDxeSmm.c
- DevicePathFromHandle().
And so cannot be used by MM_STANDALONE drivers.

Instead, MM_STANDALONE drivers can use UefiDevicePathLibBase.inf
as the DevicePathLib of choice.

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2025-08-06 17:43:56 +00:00
Gowtham M
fdd6796d08 MdePkg/Library: Remove UefiDevicePathLibStandaloneMm.inf
The file UefiDevicePathLibStandaloneMm.inf was reintroduced in [#3187] to
give downstream platforms time to transition to UefiDevicePathLibBase.inf
As nearly three years have passed since that change,
and downstream consumers have had sufficient time to migrate,
this library can now be safely removed.

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2025-08-06 17:43:56 +00:00
Gowtham M
80f9e3aa2f OvmfPkg/OvmfPkg.dsc:Update DevicePathLib mapping for MM_STANDALONE drivers
As part of this PR [#3187],
MM_STANDALONE drivers should now map DevicePathLib to
UefiDevicePathLibBase.inf instead of UefiDevicePathLibStandaloneMm.inf,
as latter is being deprecated.

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Gowtham M <gowthamm@ami.com>
2025-08-06 17:43:56 +00:00
Michael D Kinney
6e4bf7f934 .mergify: Set max parallel checks to 1
Set max parallel checks to 1 to disable speculative checks.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-08-06 08:16:23 -07:00
ddeptford
5c7ef27b96 MdeModulePkg: UefiBootManagerLib Change default alignment for ramdisk boot.
The ramdisk is modelled as an NVDIMM which have a naturally higher
alignment than 4K. Operating systems may wish to map NVDIMMs using large
pages, so force the allocation alignment to 2MB.

This change was tested using HTTP ramdisk boot, targeting a flat windows
image.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-08-06 08:59:25 +08:00
HemaAnmisha
686f1e3ea8 CryptoPkg/BaseCryptLibMbedTls : Add strpbrk() support to MbedTls
Mbedtls requires the use of strpbrk(), but it is currently
included in BaseCryptLib, which is not part of
BaseCryptLibMbedTls. To resolve this, add strpbrk() to
CrtWrapper.c, as BaseCryptLibMbedTls is not dependent
on OpensslLib.

Signed-off-by: HemaAnmisha <hema.anmisha.kalavakolanu@intel.com>
2025-08-05 13:57:26 +08:00
John Mathews
d2d8d38ee0 UefiCpuPkg/PiSmmCpuDxeSmm: Safe handling of IDT register on SMM entry
Mitigates CVE-2025-3770

Do not assume that IDT.limit is loaded with a zero value upon SMM entry.
Delay enabling Machine Check Exceptions in SMM until after the SMM IDT
has been reloaded.

Signed-off-by: John Mathews <john.mathews@intel.com>
2025-08-04 08:15:19 -07:00
Abdul Lateef Attar
7fe3609022 DynamicTablesPkg: Add alias for EArchCommonObjPciConfigSpaceInfo
Introduce EArchCommonObjMcfgPciConfigSpaceInfo as an alias for
EArchCommonObjPciConfigSpaceInfo.

The CM_ARCH_COMMON_PCI_CONFIG_SPACE_INFO object is utilized by both
the MCFG and ACPI SSDT PCIE generators. Assigning a unique configuration
object ID ensures the platform configuration driver supplies the correct data.

Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-08-01 15:45:06 +02:00
Yuwei Chen
a60334ad59 BaseTools: Fix FMMT FvHandler Padding operation issue
When using the FMMT FvHandler function, new padding size
should be calculated correctly comparing with origin ffs
and new ffs, else it will cause the binary size changes.
This patch is used to fix the bug.

Signed-off-by: Yuwei Chen <yuwei.chen@intel.com>
2025-07-30 02:44:25 +00:00
Pranav V V
491530abaa MdeModulePkg: Change PCD type to support dynamic
Move PcdSerialRegisterBase from [PcdsFixedAtBuild, PcdsPatchableInModule]
section to [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic,
PcdsDynamicEx] section to enable dynamic configuration.

Signed-off-by: Pranav V V <pranav.v.v@intel.com>
2025-07-30 08:48:49 +08:00
Guo Dong
3b48f8ccab UefiPayloadPkg: Fix calling convention
When register a root SMI handler, it is expected to use windows calling
convention for the SMI handler. This patch adds missing EFIAPI for the
SMI handler SmmSwDispatcher to avoid potential issue from Linux build.

Signed-off-by: Guo Dong <guo.dong@intel.com>
2025-07-29 17:50:45 +00:00
Levi Yun
0d82e48221 DynamicTablesPkg: add Tpm2DeviceTableLib to generate Tpm2 device table
Introduce Tpm2DeviceTableLib to generate SSDT table which describes
Tpm2 devices.

This dynamic table generation is controlled by PcdGenTpm2DeviceTable
which default value is FALSE.
When it is TRUE, the TPM2 device ssdt table is generated when TPM2 ACPI
table is generated.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-29 08:07:39 +00:00
Levi Yun
faeedaa54b DynamicTablesPkg: add ArchCommonObjTpm2DeviceInfo
To generate SSDT for TPM2 device using DynamicTablePkg,
add TPM2 Device information

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-29 08:07:39 +00:00
Nanjinmoorthyj
47e818016a ShellPkg/Library: Remove unecessary error check
Remove the error handling from the connect.c file as it is redundant.

Signed-off-by: Nanjinmoorthy <nanjinmoorthyj@ami.com>
2025-07-25 09:57:50 +00:00
Thomas Prescher
97b0f1ea3b OvmfPkg/CloudHv: bump PcdCpuMaxLogicalProcessorNumber to 254
Signed-off-by: Thomas Prescher <thomas.prescher@cyberus-technology.de>
On-behalf-of: SAP thomas.prescher@sap.com
2025-07-24 21:49:41 +00:00
Revathy V
be6342d64f ShellPkg: Fixed Deadcode and Null field Coverity warnings.
Updated fixes for all Deadcode and Null field Coverity fixes in ShellPkg

Signed-off-by: Revathy <revathyv@ami.com>
2025-07-24 07:57:29 +00:00
Prachotan Reddy Bathi
01295fd25b ShellPkg: DtbTableAddress via config in dmem
DTB address can be modified through the config table. Use
this address in dmem output.
EmbeddedPkg dependency added to
ShellPkg/Library/UefiShellDebug1CommandsLib/UefiShellDebug1CommandsLib.inf
and ShellPkg/ShellPkg.ci.yaml

Adds to: 42b0443599
("ShellPkg: UefiShellDebug1CommandsLib: Uefi Config Tables in Dmem.c")

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
f41cc8ac79 ArmVirtPkg: Introduce ArmTransferListLib to ArmVirtPkg
Add ArmTransferListLib as a library to platforms using
ArmVirtCloudHv.dsc and ArmVirtQemu.dsc.

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
adf345e27b ArmPlatformPkg: Introduce TransferList Guid Hob for SEC
ArmTransferListHobGuid holds TransferList base address
If there's no valid TransferList found, or if a Guid HOB
is already present Guid HOB is not built, boot progresses
as usual.

https://firmwarehandoff.github.io/firmware_handoff

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
c1e3e71643 ArmPlatformPkg: Introduce gArmTransferListPpiGuid
Populate the gArmTransferListPpiGuid with the TransferList
base address.
Place the Ppi at the end of the PpiList
For platforms with no TransferList support,
boot continues without any errors.
https://firmwarehandoff.github.io/firmware_handoff

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
0bad279bd4 ArmPkg: Add gArmTransferListPpiGuid
ArmTransferListHobGuid will hold the TransferList base address
https://firmwarehandoff.github.io/firmware_handoff
SEC platforms can utilise this PPI to build the TransferList HOB

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
6a329eb853 ArmPlatformPkg: Capture TransferList Information for SEC
Capture TransferList address from register x3
Refer to section 3 of the FW Handoff Specification
https://firmwarehandoff.github.io/firmware_handoff
The TransferList header is present at the base address
captured by this variable.
For platforms with no TransferList support,
boot continues without any errors.

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
078414f045 ArmPlatformPkg: Introduce TransferList Guid Hob for PeilessSec
ArmTransferListHobGuid holds TransferList base address
If there's no valid TransferList found, Guid HOB is not built,
boot progresses as usual.

Signed-off-by: Prachotan Bathi <prachotan.bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Reddy Bathi
78d17ce5d2 ArmPkg: Add ArmTransferListHob Guid
ArmTransferListHobGuid will hold the TransferList base address
https://firmwarehandoff.github.io/firmware_handoff

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Bathi
b1096651d8 ArmPlatformPkg: Capture TransferList information for PeilessSec
Capture TransferList address from register x3
Refer to section 3 of the FW Handoff Specification
https://firmwarehandoff.github.io/firmware_handoff
The TransferList header is present at the base address
captured by this variable.
For platforms with no TransferList support,
boot continues without any errors.

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
Prachotan Reddy Bathi
e841099600 ArmPkg/ArmTransferListLib: Add utility functions
Added functionality TransferList Library

TransferListVerifyChecksum - Verify TransferList CheckSum
TransferListCheckHeader - Check if TransferList header is valid,
 return suitable opcodes validating the header
TransferListFindEntry - Find a specific entry on the TransferList
 using the TagId
TransferListDump - Dump the contents of the TransferList header
 and the entry headers

Signed-off-by: Prachotan Reddy Bathi <Prachotan.Bathi@arm.com>
2025-07-24 05:59:45 +00:00
Levi Yun
5fc1ba3f25 SecurityPkg/Tcg2Config: add Tcg2ConfigFfaPei
To support TPM2 devices that operate over the FF-A specification using CRB
in the Tcg2Pei PEIM, add the Tcg2ConfigFfaPei PEIM to
detect the presence of such TPM2 devices.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-24 04:48:50 +00:00
Levi Yun
f47216f159 SecurityPkg/Library: Tpm2DeviceSecLibFfa for PeilessSec
To support measurement and extend PCR in PeilessSec with
TPM device using FF-A over CRB, add Tpm2DeviceSecLibFfa for PeilessSec.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-24 03:54:43 +00:00
Levi Yun
ee9950d3fb SecurityPkg/Library: separate logics geting TPM2 information with FF-A
This is preparation patch to add Tpm2DeviceSecLibFfa for SEC
used in PeilessSec.
In SEC phase, DynamicPcd used for cacahing TPM2 information
couldn't be used.
To resolve this, writes wrapper functions to get TPM2 information
so that in the wrapper functions used in SEC wouldn't use the
related DyanmicPcd.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-24 03:54:43 +00:00