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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Replaced all instances of PcdGet64 (PcdFfaTxRxPageCount) *
EFI_PAGE_SIZE, with EFI_PAGES_TO_SIZE macro.
Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
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>
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>
Added ArmFfaLibIsFfaSupported to ArmFfaCommon to allow for
queries of FF-A support outside of ArmFfaCommonInit.
Signed-off-by: Raymond Diaz <raymonddiaz@microsoft.com>
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>
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>
`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>
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>
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>