summaryrefslogtreecommitdiff
path: root/MdeModulePkg
AgeCommit message (Collapse)AuthorFilesLines
2026-05-08MdePkg,MdeModulePkg: Fix Spelling Error in Udf DefinitionsOliver Smith-Denny1-1/+1
Fix spelling error in definition in Udf.h. Update consumer in MdeModulePkg. A temporary backward-compatible alias is provided for the old misspelled enum name. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-08Global: Fix Spelling Errors in PCI/PCIe DefinitionsOliver Smith-Denny2-2/+2
Fix spelling errors in definitions in Pci22.h. Update consumers in MdeModulePkg, OvmfPkg, ShellPkg, and SourceLevelDebugPkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-08MdePkg,MdeModulePkg: Fix Spelling Errors in Atapi DefinitionsOliver Smith-Denny2-4/+4
Fix spelling errors in definitions in Atapi.h. Update consumers in MdeModulePkg. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-05-06MdeModulePkg: Cleanup debug print readabilityBenjamin Doron4-4/+4
All debug prints should end in a newline character. Signed-off-by: Benjamin Doron <benjamin.doron00@gmail.com>
2026-05-06MdeModulePkg,MdePkg: Send I/O without FUA if necessaryAnnie Li1-2/+4
Commit 8c654bb3ec sets FUA bit forcefully in SCSI sync I/O to avoid possible data loss. However, it may cause issues for the storage without the support FUA and WCE. For example, Windows Server 2025 guest fails to boot from vhost-scsi block device in such scenario. The booting Error code is 0xc0000185, the SCSI command fails with the following, Mode Sense Key: EFI_SCSI_SK_ILLEGAL_REQUEST Additional Sense Code: EFI_SCSI_ASC_INVALID_FIELD This patch gets the FUA and WCE support of the storage and sets FUA conditionally. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Annie Li <annie.li@oracle.com>
2026-05-06MdeModulePkg/ScsiDiskDxe: Check Write Caching and FUA supportAnnie Li2-0/+125
Check Write Caching and FUA support of the storage, then save the result if both are disabled. Signed-off-by: Annie Li <annie.li@oracle.com>
2026-05-06Revert "ArmPlatformPkg,EmbeddedPkg,MdeModulePkg: Move RealTimeClockLib ..."Ard Biesheuvel2-124/+0
This reverts commit 57230fff6b39a665485be1bd43ec608d412ba6fb. RealTimeClockLib is not a generic library class that is intended to be used widely to get access to the RTC when the associated runtime services are not available in the calling context. The purpose of RealTimeClockLib is to abstract the underlying hardware access from the generic RealTimeClockRuntimeDxe driver, which backs the runtime services. This means it does not belong in a different package; it belongs in the same package as the driver. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
2026-05-01MdeModulePkg: Add CxlDxe driverOleksandr Tymoshenko4-0/+1946
Add CxlDxe driver that provides CxlIo protocol. Co-authored-by: Abhishek Narvaria <abhi.n@samsung.com> Co-authored-by: Alok Rathore <alok.rathore@samsung.com> Co-authored-by: Nick Graves <nicholasgraves@google.com> Co-authored-by: Ryan Heise <heiserya@google.com> Co-authored-by: Sayanta Pattanayak <sayanta.pattanayak@arm.com> Co-authored-by: Sweta Kumari <s5.kumari@samsung.com> Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
2026-05-01MdeModulePkg: Add CxlIo.h protocolNick Graves2-0/+157
Create a CXL protocol for interacting with CXL endpoint devices. CXL devices are necessarily also PCI devices, so the PCI IO protocol is also provided as part of the CXL protocol. The protocol provides access to the following operations for CXL devices: - Read from a DVSEC register block - Write to a DVSEC register block - Perform DOE transaction This set of operation is sufficient to implement BIOS-level CXL functionality. Signed-off-by: Nick Graves <nicholasgraves@google.com> Signed-off-by: Oleksandr Tymoshenko <ovt@google.com>
2026-04-30MdeModulePkg: Remove duplicate library class in dsc fileQihang Gao1-1/+0
In MdeModulePkg.dsc, CapsuleLib appears twice in [LibraryClasses] section, so remove the duplicate one. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-04-30MdeModulePkg/DxeCapsuleLibFmp: Tolerate EFI_ALREADY_STARTED in LockVariableAnandh Krishna U1-1/+1
When multiple DXE drivers link DxeCapsuleLib, each driver's constructor calls InitCapsuleVariable() which attempts to lock capsule-related variables. The second instance fails with EFI_ALREADY_STARTED because the policy is already registered, triggering a false ASSERT. EFI_ALREADY_STARTED from RegisterBasicVariablePolicy means the variable is already locked, which is the desired state. Treat it as success. Signed-off-by: default avatarAnandh krishna U <anandhkrishnau@ami.com>
2026-04-29MdeModulePkg: Remove duplicate procotols guid in INF filesQihang Gao4-8/+2
In PciSioSerialDxe driver, gEfiDevicePathProtocolGuid appears twice in [Procotols] section. In PiSmmCore driver, gEfiSmmSxDispatch2ProtocolGuid appears twice in [Procotols] section. In PiSmmIpl driver, gEfiEventReadyToBootGuid appears twice in [Procotols] section. In DxeCapsuleLib driver, gEfiCapsuleVendorGuid appears twice in [Guids] section. The duplicate ones should be removed. Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-04-29MdeModulePkg/NvmExpressDxe: Mark CDW10/CDW11 valid for Format and Sanitize“Shabab1-0/+2
NVMe Format and Sanitize admin commands correctly populate CDW10 (and CDW11 for Sanitize), but these codewords are not marked as valid in the passthru command packet. As a result, the passthru layer does not include the populated codewords in the command payload, causing the commands to fail. Set the appropriate CDW validity flags in the passthru command packet: - Format NVM: CDW10_VALID - Sanitize: CDW10_VALID | CDW11_VALID This ensures the populated codewords are included in the passthru command payload and the commands are issued correctly. Signed-off-by: Shabab Alam <shabalam@qti.qualcomm.com>
2026-04-28ArmPkg,MdePkg,MdeModulePkg: change ArmFfaLibGetVersion() with whole versionYeoreum Yun1-30/+14
Current ArmFfaLibGetVersion()'s arguments receive two arguments -- major version and minor version. However, This gives some impression treating major and minor version of the ABI as two unrelated 16-bit variables as opposed to the upper and lower 16-bits of a 32-bit version variable. Therefore, change the arguments with whole version and let user to get major/minor version via ARM_FFA_MAJOR/MINOR_VERSION_GET macros. Also, add some useful helper to check version compatibility and mimimum require ABI version. Continuous-integration-options: PatchCheck.ignore-multi-package Suggested-by: Leif Lindholm <quic_llindhol@quicinc.com> Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-04-24MdeModulePkg/Library: introduce ArmFfaConsoleDebugLibMohamed Gamal Morsy4-0/+576
This patch adds ArmFfaConsoleDebugLib. A debug library that utilizes FF-A Console Log API to print debug messages to the console. This is useful in context of running the StandaloneMm payload as a S-EL0 SP on top of SPMC where StandaloneMm isn't allowed to access console device or no console device (e.x) Hafnium. NOTE: FFA_CONSOLE_LOG* could be used by secure partition only. Signed-off-by: Mohamed Gamal Morsy <mohamed.morsy@arm.com>
2026-04-23MdeModulePkg/Library: ArmFfaLib: add mapping ARM_FFA_RET_RETRYYeoreum Yun1-0/+4
There is no mapping ARM_FFA_RET_RETRY with EFI_STATUS but it falls to EFI_UNSUPPORTED. Map ARM_FFA_RET_RETRY with EFI_TIMEOUT so that don't make it fall to EFI_UNSUPPORTED. Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-04-23MdeModulePkg: Don't Allow Guard Pages to Cross Bin BoundariesOliver Smith-Denny4-32/+83
Currently, the DXE page allocator does not ensure that guard page allocations stay within the bin that it is attempting to allocate within. As a result, S4 resume is jeopardized by bins expanding due to guard pages, either into other bins or out of bins. This is caught by a new assert in CoreGetMemoryMap() to ensure the bins are correct. This fixes this by changing the internal heap guard API to return the adjusted size and start address of a proposed allocation. The page allocator then can ensure that the adjusted allocation still fits within the bin it is attempting to allocate within; if not, it will search for another descriptor. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-04-21MdeModulePkg/NetworkCommon: Add PCD for USB network periodic timerAbdul Lateef Attar4-7/+23
Replace the hardcoded NETWORK_COMMON_POLLING_INTERVAL (0x10 = 16ms) with a new PCD PcdUsbNetworkPeriodicalTimer, allowing platforms to configure the asynchronous transfer interval for USB network devices. The default value of 16ms preserves existing behaviour. EFI_USB_IO_PROTOCOL.UsbAsyncInterruptTransfer(), the PollingInterval parameter must be between 1 and 255 milliseconds; a value of 0 returns EFI_INVALID_PARAMETER. The PCD is declared with a @ValidRange of 1-255 and an ASSERT guards against a zero value at runtime. Co-authored-by: Abner Chang <abner.chang@amd.com> Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2026-04-15MdeModulePkg/NvmExpressDxe: Clear NSID to 0 for sanitize commandShabab Alam1-1/+7
A purge erase operation on NVMe devices using the MediaSanitize (MediaPurge) protocol fails with Status Code 02h (Invalid Field in Command). According to NVMe specification revision 1.4c, the Sanitize command (OpCode 84h) does not use the NSID field (Section 5, Figure 142). For commands that do not use NSID, the field must be cleared to 0 as defined in Section 4.2, Figure 106. Clear NSID to 0 before issuing the Sanitize command to ensure spec compliance and prevent command failure. Signed-off-by: Shabab Alam <shabalam@qti.qualcomm.com>
2026-04-02MdeModulePkg: Added several mock libraries for google testPaddyDeng5-0/+116
Added several mock libraries for google test so one can make google test drives consuming those libraries: - MockTpmMeasurementLib - MockFirmwareVolumeShadowPpi Signed-off-by: Paddy Deng <PaddyDeng@ami.com>
2026-03-25MdeModulePkg: VariableSmmRuntimeDxe: Fix MM communicate v3 buffer sizingLiqi Qi1-2/+7
This change updates `VariableSmmRuntimeDxe` to correctly size its runtime communication buffer when `EFI_MM_COMMUNICATION3_PROTOCOL` is present. In the current flow, the runtime variable path may use MM communication v3, but the input size is first validated against the global variable `mVariableBufferPayloadSize`. The size is then validated a second time during communication buffer initialization using the v3 header size, which results in `GetVariable` calls with sufficiently large buffers consistently failing. This update makes the allocation logic v3‑aware so that the runtime variable communication buffer matches the header format actually in use, avoiding failures for larger variable transactions. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-03-24Revert "MdeModulePkg/PciBusDxe: Degrade MEM64 to PMEM64..."Michael D Kinney1-39/+6
This reverts commit f6489621b8ae1164c5e4930902988ba7c86847ba. MdeModulePkg/PciBusDxe: Degrade MEM64 to PMEM64 when bridge lacks MEM64 A number of compatibility issues have been reported with this change to the PciBusDxe behavior. Revert this change at this time to give time for all the issues to be reviewed and options for supporting this new behavior to be evaluated and fully validated. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-03-23MdeModulePkg/Core: Validate DXE event signature before usageKhalid Ali1-1/+5
fixes: #11112 Currently, function RegisterProtocolNotify() doesn't check the validity of event and it accepts any event pointer as long as pointer isn't NULL. However event could be closed and freed which could lead to use after free. Always check event signature before usage and return EFI_INVALID_PARAMTER for events with invalid signature. Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
2026-03-23MdeModulePkg/SpiNorFlashJedecSfdp: Limit debug outputAbdul Lateef Attar1-6/+6
Change debug print level from DEBUG_INFO to DEBUG_VERBOSE to limit excessive output. Since Spinor Sfdp operations can generate a large number of debug messages due to frequent read/write/erase actions, this change reduces log verbosity at the INFO level. Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2026-03-19MdeModulePkg: : revert EndofDxeEvent TPLs to TPL_NOTIFY for FPDTYeoreum Yun2-2/+2
commit aa02571 ("MdeModulePkg: Change EndofDxeEvent TPLs to TPL_CALLBACK") changed EndOfDxeEvent TPLs from TPL_NOFIY to TPL_CALLBACK. However this commit makes a boot failure on the FVP platform when FPDT ACPI table generation is enabled: [FirmwarePerformanceDxe] Error when lock variable FirmwarePerformance, Status = Write Protected ASSERT_EFI_ERROR (Status = Write Protected) ASSERT [FirmwarePerformanceDxe] FirmwarePerformanceDxe.c(405): !(((RETURN_STATUS)(Status)) >= 0x8000000000000000ULL) Currently, EVT_NOTIFY_SIGNAL events are managed in FILO order, as new events are inserted using InsertHeadList(). The sequence is as follows: 1. DxeCore initializes DxeCorePerformanceLib, whose constructor creates an EndOfDxe event (gEfiEndOfDxeEventGroupGuid) with the ReportFpdtRecordBuffer() callback. 2. MmCommunicationDxe (in ArmPkg) creates another EndOfDxe event to notify StandaloneMm. This event is inserted ahead of the one created in (1). 3. PlatformBootManagerBeforeConsole() signals EndOfDxe, which triggers the event created in (2) first. 4. When the callback from (2) runs, StandaloneMm calls LockVariablePolicy(). 5. The callback from (1) is then invoked and attempts to update FPDT via InstallFirmwarePerformanceDataTable(). During this process, it tries to register a variable policy for the FirmwarePerformance variable. However, since the Variable Policy interface was locked in (4), the operation fails with EFI_WRITE_PROTECTED. To resolve this issue, revert EndofDxeEvent TPLs to TPL_NOTIFY for FPDT. Fixes: aa02571 ("MdeModulePkg: Change EndofDxeEvent TPLs to TPL_CALLBACK") Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-03-19MdeModulePkg/PeiCore: Accept MemoryDiscoveredPpi from SecCoreRay Ni1-0/+10
PeiCore assumes that it runs initially from the temporary memory and switches to physical memory after PS::InstallPeiMemory() reports the physical memory range for PEI. This change enables PeiCore to run initially from the physical memory when MemoryDiscoveredPpi is passed from SEC. Signed-off-by: Ray Ni <ray.ni@intel.com>
2026-03-17MdeModulePkg: Change EndofDxeEvent TPLs to TPL_CALLBACKSherry Fan2-2/+2
Change FPDT events at EndOfDxe to TPL_CALLBACK as TPL_NOTIFY is not necessary. Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-17MdeModulePkg: Update performance measurements to use new perf macrosSherry Fan4-3/+6
Updates BmBoot and dispatcher to use new perf macros. Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-17MdeModulePkg/PciBusDxe: Add optional CRS retry for enumerationAshish Singhal3-11/+162
The current PciDevicePresent() implementation skips PCIe devices that return Configuration Request Retry Status (CRS) during enumeration. This causes devices that are slow to initialize (e.g., after power-on or reset) to be missed entirely. Per PCIe Base Specification Rev 3.1 Section 2.3.1, when CRS Software Visibility is enabled and a device returns CRS, the Root Complex reports Vendor ID as 0x0001. The specification recommends software retry the configuration read until the device becomes ready. This patch adds optional CRS retry support controlled by PCDs: - PcdPciCrsRetryIntervalUs: Retry interval in microseconds (default 10000) - PcdPciCrsTimeoutSeconds: Total timeout in seconds (default 0) By default (PcdPciCrsTimeoutSeconds=0), CRS retry is disabled and devices returning CRS are skipped during enumeration. Platforms requiring CRS retry support should set PcdPciCrsTimeoutSeconds to a non-zero value. Additional improvements: - Add PCI_VENDOR_ID_NONE and PCI_VENDOR_ID_CRS macros for readability - Handle invalid PCD configurations (e.g., zero retry interval) - Add DEBUG output for CRS detection, successful retry, and timeout Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com>
2026-03-13MdeModulePkg: IpmiCommandLib: Add IPMI mailbox declarationsBrit Chesley1-1/+40
Added IPMI boot initiator mailbox function declarations. Signed-off-by: Brit Chesley <brit.chesley@amd.com>
2026-03-09MdeModulePkg/Core: Increment handle key outside if blockKhalid Ali1-6/+6
Fixes: #11113 Currently, the global handle key and key inside handle structure is incremented only when a new handle is allocated for protocol interface to be installed. However, when caller already supplies a handle gHandleDatabaseKey never get incremented. Move handle key incremental outside if block, just below the else statement which allows gHandleDatabaseKey to always incremented whether handle is supplied or not. Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
2026-03-09MdeModulePkg: Add library class SafeIntLib where ArmFfaCommon.c is usedMike Beaton5-0/+5
Required by implementation of ArmFfaLibYield. Fixes: 6479778e6b3890f65580bfbd50426046533b85a8 Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2026-03-07MdePkg,MdeModulePkg: Add FFA_YIELD commandRaymond-MS1-0/+41
Add the FF-A YIELD command to the FF-A library. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-03-07MdeModulePkg: DxeIpl IA32: Use 256 IDT EntriesOliver Smith-Denny2-6/+5
When IA32 DxeIpl is setting up the IDT, it should populate 256 entries, the architectural size, so that exceptions are handled in a defined way, going to the common exception handler. This includes the stack cookie exception. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-03-07MdeModulePkg: CpuExceptionHandlerLib: Define X86_CPU_INTERRUPT_NUMOliver Smith-Denny1-0/+2
There are currently many definitions for the number of interrupts for X86 processors. Centralize this definition in CpuExceptionHandlerLib. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2026-03-05MdeModulePkg: fix mdlint issuesSherry Fan2-86/+94
Fix markdownlint formatting issues in READMEs. Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-04MdeModulePkg: Add FFA_NS_RES_INFO_GET to ArmFfaCommonrdiaz2-0/+68
Add FFA_NS_RES_INFO_GET implementation to ArmFfaCommon Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-28MdeModulePkg/TerminalDxe: Fix Backspace key for VT-UTF8 terminal typeDamien-Chen1-1/+8
When QEMU is launched with -nographic, the Backspace key (DEL, 0x7f) doesn't work in the UEFI Shell because the VT-UTF8 terminal type interprets DEL as SCAN_DELETE instead of CHAR_BACKSPACE. Modern terminal emulators (xterm, gnome-terminal, etc.) send DEL (0x7f) for Backspace and are UTF-8 compatible. This patch updates TerminalTypeVtUtf8 to interpret DEL as CHAR_BACKSPACE, consistent with how TerminalTypeTtyTerm already handles it. This approach preserves VT-UTF8 as the default terminal type (which supports full Unicode), while fixing the Backspace functionality for modern terminal environments. Signed-off-by: Damien Chen <inkfan130924783@gmail.com>
2026-02-28MdeModulePkg: DxeMain: Check memory type overlap inside CoreGetMemoryMapKun Qin1-0/+115
This change adds validation to CoreGetMemoryMap to ensure that special memory bins are fully respected. Specifically, any memory map entry that falls within a special bin must be entirely contained within that bin, and its memory type must match the bin's designated type. This check helps preventing unintended changes that could cause the system memory map to cross bin boundaries unexpectedly. Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-02-28MdeModulePkg HobPrintLib: Also print EFI_HOB_TYPE_UNUSED type HOBStar Zeng1-3/+6
EFI_HOB_TYPE_UNUSED is not unknown HOB type, instead of printing "Unknown Hob type, ...", this patch updates code to also print EFI_HOB_TYPE_UNUSED type HOB. Signed-off-by: Star Zeng <star.zeng@intel.com>
2026-02-28MdeModulePkg: Fix PreferMode selection for same-width text modesAshraf Ali S1-2/+2
The current PreferMode selection logic requires both Columns AND Rows to be strictly greater (>) than the current maximum, which fails when a text mode has the same column count but more rows. Example failure case (1920x1200 display): - Mode 5: 240x56 - Selected as PreferMode - Mode 6: 240x63 - Rejected because 240 is not > 240 This mismatch causes ConsplitterSetConsoleOutMode to later request Mode 6, triggering an unnecessary text mode change and clearing the screen during console init. Root Cause: GraphicsConsole used: if ((Col > Max) && (Row > Max)) This fails when only rows increase while columns stay the same. Solution: Change to: if ((Col >= Max) && (Row >= Max)) This aligns with ConSplitter mode selection logic and correctly selects the mode with the highest column and row counts. After fix (1920x1200 display): - Mode 5: 240x56 - Mode 6: 240x63 - Correctly selected as PreferMode This ensures GraphicsConsole and ConSplitter match on the preferred mode preventing unnecessary screen clears during console initialization. Signed-off-by: Ashraf Ali S <ashraf.ali.s@intel.com>
2026-02-27MdeModulePkg/Include/Guid: Add back include guardMichael D Kinney1-5/+10
Add include guards back to include files that use the same include guard macro in BaseTools/Source/C/Include/Common and MdePkg or MdeModulePkg. Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2026-02-27MdeModulePkg/Core: Move SMI depth tracker below SMI presence checkKhalid Ali1-1/+1
Fixes: #11764 Currently, mSmiManageCallingDepth is incremented always whether SMI handler is present or not. However get decremented only when SMI handler is found. This causes mSmiManageCallingDepth to grow infinitely as long as SMI handler isn't present. Increment mSmiManageCallingDepth only when SMI handler presence is confirmed. Signed-off-by: Khalid Ali <khaliidcaliy@gmail.com>
2026-02-27MdeModulePkg/PeiDxeDebugLibReportStatusCode: Fix comma parsingRay Ni1-1/+1
The DebugPrintMarker function in PeiDxeDebugLibReportStatusCode/DebugLib.c does not recognize the comma (`,`) flag in printf-style format strings. When a driver uses format strings with thousand separators like "%,ld" to format large numbers (e.g., 1234567 as "1,234,567"), the DebugPrintMarker parser fails to recognize the comma flag and causes incorrect argument extraction when building the BASE_LIST for status code reporting, leading to unexpected or corrupted debug output in status code reports. The change is to add the missing comma flag check to align with BasePrintLib's format parsing logic, ensuring consistent behavior across all print library implementations. Signed-off-by: Ray Ni <ray.ni@intel.com>
2026-02-27MdeModulePkg/PeiDebugLibDebugPpi: Fix comma parsing in VaListToBaseListRay Ni1-1/+1
The VaListToBaseList function in PeiDebugLibDebugPpi/DebugLib.c does not recognize the comma (`,`) flag in printf-style format strings. When a driver uses format strings with thousand separators like "%,ld" to format large numbers (e.g., 1234567 as "1,234,567"), the VaListToBaseList parser fails to recognize the comma flag and causes incorrect argument extraction from the VA_LIST, leading to unexpected or corrupted debug output. The change is to add a check for the comma character in the format string parsing logic to align with BasePrintLib's format parsing logic, ensuring consistent behavior across all print library implementations. Signed-off-by: Ray Ni <ray.ni@intel.com>
2026-02-25MdeModulePkg: Mark PcdMrIovSupport obsolete - deprecated in PCIe 6.0Jacek Kolakowski4-17/+1
MR-IOV was actually not used in MdeModulePkg and it has been deprecated in PCIe 6.0 specification. Remove code references, but keep PcdMrIovSupport with just a comment that it is deprecated. Signed-off-by: Jacek Kolakowski <Jacek.Kolakowski@intel.com>
2026-02-25MdeModulePkg: Add platform limit for size in Resizable BARJacek Kolakowski4-18/+89
Resizable BAR driver selects max available BAR size to configure for use. It may happen that some PCIe device declare support for size that exceeds processor address width. Platform needs a way to define the max size it can accept. This change introduce PCD called PcdPcieResizableBarMaxSize. It is dynamic PCD where platform can provide its limit for BAR size. Such PCD can be also controlled with a configuration knob. Signed-off-by: Jacek Kolakowski <Jacek.Kolakowski@intel.com>
2026-02-24MdeModulePkg: Replace include guards with #pragma onceMichael Kubacki466-1858/+472
Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2026-02-13MdeModulePkg: Add Unmap Callbackedk2-stable202602rdiaz7-0/+103
Add Unmap callback for when PEI and SEC need to invalidate the Rx/Tx buffer HOB on a call to Unmap. Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-13MdeModulePkg: Code/Comment cleanuprdiaz6-29/+21
Cleaned various comments and debug messages as well as headers to either fix typos or for readability. Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>