Commit graph

6691 commits

Author SHA1 Message Date
“Shabab
c8833afa7a MdeModulePkg/NvmExpressDxe: Mark CDW10/CDW11 valid for Format and Sanitize
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-29 06:33:41 +00:00
Yeoreum Yun
ae2d2d76c1 ArmPkg,MdePkg,MdeModulePkg: change ArmFfaLibGetVersion() with whole version
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-28 19:19:44 +02:00
Mohamed Gamal Morsy
ddc7ed1dee MdeModulePkg/Library: introduce ArmFfaConsoleDebugLib
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-24 10:43:53 +00:00
Yeoreum Yun
87cfc60f20 MdeModulePkg/Library: ArmFfaLib: add mapping ARM_FFA_RET_RETRY
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-23 08:22:22 +00:00
Oliver Smith-Denny
0f2dc75587 MdeModulePkg: Don't Allow Guard Pages to Cross Bin Boundaries
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-23 02:42:12 +00:00
Abdul Lateef Attar
c31b880bd2 MdeModulePkg/NetworkCommon: Add PCD for USB network periodic timer
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-21 13:29:12 +00:00
Shabab Alam
3971a4dba9 MdeModulePkg/NvmExpressDxe: Clear NSID to 0 for sanitize command
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-15 02:50:05 +00:00
PaddyDeng
d68752de91 MdeModulePkg: Added several mock libraries for google test
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-04-02 03:27:19 +00:00
Liqi Qi
0049ac1793 MdeModulePkg: VariableSmmRuntimeDxe: Fix MM communicate v3 buffer sizing
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-25 17:47:59 +00:00
Michael D Kinney
defbd14d63 Revert "MdeModulePkg/PciBusDxe: Degrade MEM64 to PMEM64..."
This reverts commit f6489621b8.

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-24 02:11:23 +00:00
Khalid Ali
260b91a352 MdeModulePkg/Core: Validate DXE event signature before usage
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-23 18:43:11 +00:00
Abdul Lateef Attar
1bd61a9409 MdeModulePkg/SpiNorFlashJedecSfdp: Limit debug output
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-23 16:30:18 +00:00
Yeoreum Yun
8c50e656c0 MdeModulePkg: : revert EndofDxeEvent TPLs to TPL_NOTIFY for FPDT
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-19 03:39:15 +00:00
Ray Ni
fc13220238 MdeModulePkg/PeiCore: Accept MemoryDiscoveredPpi from SecCore
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-19 02:02:47 +00:00
Sherry Fan
aa02571f36 MdeModulePkg: Change EndofDxeEvent TPLs to TPL_CALLBACK
Change FPDT events at EndOfDxe to TPL_CALLBACK as TPL_NOTIFY is not
necessary.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-17 02:38:07 +00:00
Sherry Fan
03e7c8c44f MdeModulePkg: Update performance measurements to use new perf macros
Updates BmBoot and dispatcher to use new perf macros.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-17 02:38:07 +00:00
Ashish Singhal
b074eb78b4 MdeModulePkg/PciBusDxe: Add optional CRS retry for enumeration
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-17 02:03:32 +00:00
Brit Chesley
17cb2be383 MdeModulePkg: IpmiCommandLib: Add IPMI mailbox declarations
Added IPMI boot initiator mailbox function declarations.

Signed-off-by: Brit Chesley <brit.chesley@amd.com>
2026-03-13 15:02:28 +00:00
Khalid Ali
8f28978843 MdeModulePkg/Core: Increment handle key outside if block
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-09 09:19:06 +00:00
Mike Beaton
1f5c9f2a5c MdeModulePkg: Add library class SafeIntLib where ArmFfaCommon.c is used
Required by implementation of ArmFfaLibYield.

Fixes: 6479778e6b

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2026-03-09 03:35:31 +00:00
Raymond-MS
6479778e6b MdePkg,MdeModulePkg: Add FFA_YIELD command
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-07 09:34:09 +00:00
Oliver Smith-Denny
4512733ac8 MdeModulePkg: DxeIpl IA32: Use 256 IDT Entries
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-07 03:58:40 +00:00
Oliver Smith-Denny
3ed9aceeb8 MdeModulePkg: CpuExceptionHandlerLib: Define X86_CPU_INTERRUPT_NUM
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-07 03:58:40 +00:00
Sherry Fan
7e5cc68f1e MdeModulePkg: fix mdlint issues
Fix markdownlint formatting issues in READMEs.

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-03-04 22:02:33 +00:00
rdiaz
a39c3835aa MdeModulePkg: Add FFA_NS_RES_INFO_GET to ArmFfaCommon
Add FFA_NS_RES_INFO_GET implementation to ArmFfaCommon

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-03-04 01:22:07 +00:00
Damien-Chen
58c9ba24d4 MdeModulePkg/TerminalDxe: Fix Backspace key for VT-UTF8 terminal type
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-28 04:43:49 +00:00
Kun Qin
5b9430b72b MdeModulePkg: DxeMain: Check memory type overlap inside CoreGetMemoryMap
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-28 04:20:00 +00:00
Star Zeng
02d5363679 MdeModulePkg HobPrintLib: Also print EFI_HOB_TYPE_UNUSED type HOB
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-28 03:56:45 +00:00
Ashraf Ali S
41b32312c4 MdeModulePkg: Fix PreferMode selection for same-width text modes
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-28 03:35:35 +00:00
Michael D Kinney
935518abbb MdeModulePkg/Include/Guid: Add back include guard
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-27 07:15:11 +00:00
Khalid Ali
bd8667a7fd MdeModulePkg/Core: Move SMI depth tracker below SMI presence check
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-27 06:09:41 +00:00
Ray Ni
4d0946c082 MdeModulePkg/PeiDxeDebugLibReportStatusCode: Fix comma parsing
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-27 03:30:57 +00:00
Ray Ni
a7c119589f MdeModulePkg/PeiDebugLibDebugPpi: Fix comma parsing in VaListToBaseList
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-27 03:30:57 +00:00
Jacek Kolakowski
2e92a908e7 MdeModulePkg: Mark PcdMrIovSupport obsolete - deprecated in PCIe 6.0
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-25 05:03:02 +00:00
Jacek Kolakowski
24eddc65b3 MdeModulePkg: Add platform limit for size in Resizable BAR
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-25 03:40:14 +00:00
Michael Kubacki
7a934d0bef MdeModulePkg: Replace include guards with #pragma once
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-23 21:01:28 +00:00
rdiaz
b7a715f7c0 MdeModulePkg: Add Unmap Callback
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-13 11:55:46 +00:00
rdiaz
0e8dc1693d MdeModulePkg: Code/Comment cleanup
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>
2026-02-13 11:55:46 +00:00
rdiaz
3457388b7c MdeModulePkg: Use EFI_PAGES_TO_SIZE macro in ArmFfaSecRxTxMap
Replaced all instances of PcdGet64 (PcdFfaTxRxPageCount) *
EFI_PAGE_SIZE, with EFI_PAGES_TO_SIZE macro.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-13 11:55:46 +00:00
rdiaz
ea8447eec7 MdeModulePkg: Remove global usage from ArmFfaSecRxTxMap
Removed the global variables in ArmFfaSecRxTxMap. Rx/Tx
buffer HOB is now created within the Map function rather
than in the constructor of ArmFfaSecLib. This allows for
the use of the HOB to find the Rx/Tx buffer information.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-13 11:55:46 +00:00
rdiaz
7416ebda09 MdeModulePkg: Remove global usage in ArmFfaCommon
Removed global variables in ArmFfaCommon. Moved the globals to
locals in each phase's ArmFfaLib implementation. SEC and PEI
will query when necessary to avoid setting globals when memory
is unavailable.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-13 11:55:46 +00:00
rdiaz
16d9ba7275 MdeModulePkg: Add helper to check if FF-A is supported
Added ArmFfaLibIsFfaSupported to ArmFfaCommon to allow for
queries of FF-A support outside of ArmFfaCommonInit.

Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
2026-02-13 11:55:46 +00:00
Yang Gang
be6ff0f289 MdeModulePkg/HiiDatabaseDxe: Fix parser issue in GetNameElement()
This commit removes an wrong goto statement which may cause DXE_ASSERT!

`ConfigRequest` example: `&NameValueVar0&NameValueVar1&NameValueVar2`.

When `*Progress` is `&NameValueVar2`, code will run to `goto Done;`,
then return NULL.

Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2026-02-10 01:31:21 +00:00
Kun Qin
25462a6ab2 MdeModulePkg: MmVariablePei: Populate correct v3 header
When using MM communicate v3 to fetch variable, the header calculation
was incorrect, causing the variable driver on the secure environment to
have random behavior.

This change refactored the original routine by following the current
DXE instance (mostly).

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2026-02-03 21:56:48 +00:00
Yang Gang
f5f4e9b764 MdeModulePkg/SetupBrowserDxe: Check Form parameter in RuleIdToExpression()
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2026-02-02 04:35:29 +00:00
Yang Gang
5a414b5ef7 MdeModulePkg/SetupBrowserDxe: Fix code issue in ParseOpCodes()
`if (CurrentForm != NULL)` and
`if (InScopeDisable && (CurrentForm == NULL))`conflict.

`if (CurrentForm != NULL)` should be `if (CurrentExpression != NULL)`.

Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2026-02-02 04:35:29 +00:00
Sherry Fan
64ad6f20d8 MdeModulePkg: BdsDxe: Introduce infinite boot retries
This PR introduces a new feature to enable infinite boot retries based on a newly created PCD.
When true, the system will continuously loop over all boot options.

PCD default is FALSE to match existing functionality.

This change is tested on QEMU based virtual platforms and physical
platforms.

This change is useful for certain server cases. Infinite retries allows
a server to continuously attempt boot in case of network failure and
recovery, and for such attempts to be accurately recorded in the TCG
logs.

Co-authored-by: Kun Qin <kun.qin@microsoft.com>
Co-authored-by: Aaron Pop <aaron.pop@microsoft.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>

Signed-off-by: Sherry Fan <sherryfan@microsoft.com>
2026-02-02 02:24:18 +00:00
Gerd Hoffmann
ff69be3519 MdeModulePkg/CapsuleOnDiskLoadPei: fix gcc 16 warning
MdeModulePkg/Universal/CapsuleOnDiskLoadPei/CapsuleOnDiskLoadPei.c:176:11: error: variable ‘Index’ set but not used [-Werror=unused-but-set-variable=]
  176 |   UINTN   Index;
      |           ^~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-02-01 20:30:31 +00:00
Gerd Hoffmann
e01df52281 MdeModulePkg/VarCheckHiiLib: fix gcc 16 warning
MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c: In function ‘ParseFv’:
MdeModulePkg/Library/VarCheckHiiLib/VarCheckHiiGenFromFv.c:263:34: error: variable ‘FfsIndex’ set but not used [-Werror=unused-but-set-variable=]
  263 |   UINTN                          FfsIndex;
      |                                  ^~~~~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-02-01 20:30:31 +00:00
Gerd Hoffmann
8992abde26 MdeModulePkg/DisplayEngineDxe: fix gcc 16 warning
MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c: In function ‘CreateSharedPopUp’:
MdeModulePkg/Universal/DisplayEngineDxe/ProcessOptions.c:590:11: error: variable ‘Count’ set but not used [-Werror=unused-but-set-variable=]
  590 |   UINTN   Count;
      |           ^~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-02-01 20:30:31 +00:00