1201 Commits

Author SHA1 Message Date
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
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
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
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
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
0f451f6e1f MdeModulePkg/CustomizedDisplayLib: fix gcc 16 warning
MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c: In function ‘CreateDialog’:
MdeModulePkg/Library/CustomizedDisplayLib/CustomizedDisplayLib.c:435:18: error: variable ‘Count’ set but not used [-Werror=unused-but-set-variable=]
  435 |   UINTN          Count;
      |                  ^~~~~

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2026-02-01 20:30:31 +00:00
Qihang Gao
491262f431 MdeModulePkg/Library: Fix property typos
The word property is misspelled as propery, so fix it.

Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-01-26 08:44:12 +00:00
Joey Vagedes
0ab766c6b6 MdeModulePkg: Add unit tests for DxeReportStatusCodeLib
This commit adds a host based unit test for DxeReportStatusCodeLib
that ensures that the platform cannot invert the TPL on an initial
call to ReportStatusCode functionality.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2026-01-14 04:00:20 +00:00
Joey Vagedes
3fe8cad23c MdeModulePkg: RuntimeDxeReportStatusCodeLib: Do not query protocol
This commit stops the library from querying the protocol database for
the status code protocol at the time of library function use. This logic
can result in a TPL inversion if the protocol has not yet been cached
and the caller is calling the library function when the TPL is higher
then TPL_NOTIFY.

Instead, the protocol is now located during the constructor of the
library. If the protocol is not found, then an on-protocol install event
is registered which will cache the protocol. A destructor is also added
to close the event in the scenario that the driver is unloaded before
the protocol is installed.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2026-01-14 04:00:20 +00:00
Joey Vagedes
ce61d5f327 MdeModulePkg: DxeReportStatusCodeLib: Do not query protocol
This commit stops the library from querying the protocol database for
the status code protocol at the time of library function use. This logic
can result in a TPL inversion if the protocol has not yet been cached
and the caller is calling the library function when the TPL is higher
then TPL_NOTIFY.

Instead, the protocol is now located during the constructor of the
library. If the protocol is not found, then an on-protocol install event
is registered which will cache the protocol. A destructor is also added
to close the event in the scenario that the driver is unloaded before
the protocol is installed.

Signed-off-by: Joey Vagedes <joey.vagedes@gmail.com>
2026-01-14 04:00:20 +00:00
Levi Yun
c16f1cc684 MdePkg,MdeModulePkg/ArmFfaLib: introduce ArmFfaGetPartitionInfo()
Introduce ArmFfaGetPartitionInfo(), which retrieves the first partition
associated with the service GUID. This allows us to remove duplicated
code previously used to obtain the partition ID.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Continuous-integration-options: PatchCheck.ignore-multi-package
2026-01-08 12:07:46 +00:00
Levi Yun
898ae481d9 MdeModulePkg/ArmFfaLib: support ArmFfaLib wihtout Rx/Tx buffer
In the normal world, it is possible to communicate with
a secure partition using the ARM_FFA_PARTITION_INFO_GET_REGS ABI,
even when the Rx/Tx buffer ABI is not supported.

Therefore, treat the EFI_UNSUPPORTED error returned
during Rx/Tx buffer mapping as a valid result
when the ARM_FFA_PARTITION_INFO_GET_REGS ABI is supported.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-01-08 12:07:46 +00:00
Levi Yun
eea64c7fcd MdePkg, MdeModulePkg/ArmFfaLib: add funcs to get partition info via regs
Starting from FF-A v1.2 [0], the FFA_PARTITION_INFO_GET_REGS
interface was added to retrieve partition information
through registers.

This ABI is useful in environments where the Rx/Tx buffer
does not need to be mapped, or where buffer mapping
is not supported for retrieving partition information.

To support this, two new APIs are introduced:
ArmFfaLibPartitionInfoGetRegs() and ArmFfaLibPartitionCountGetRegs().

Link: https://developer.arm.com/documentation/den0077/latest [0]
Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2026-01-08 12:07:46 +00:00
Michael D Kinney
17cb2f90b6 MdeModulePkg/BrotliCustomDecompressLib: Undefine _MSC_VER for GCC
Update GCC Family to undefined _MSC_VER to match settings used
by other compilers. This addresses clang compatibility issues
for host-based unit test builds.

Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
2025-12-24 03:36:31 +00:00
Mike Beaton
6bb2423a6f MdeModulePkg/BrotliCustomDecompressLib: Correct BrotliDecompress
DestSize should have been received and passed as a pointer in order to
successfully pass the output value.

The existence of this error was spotted by XCODE5 toolchain, which gave:
BrotliDecompress.c:85:18: error: parameter 'DestSize' set but not used

As discussed in https://github.com/tianocore/edk2/pull/11729, since the
method is in fact internal and only called in one place, and since the
DestSize return value is in fact unused, instead of fixing the parameter
and method call we instead remove the parameter, also marking the method
STATIC and renaming it to ...Internal.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2025-11-22 05:12:54 +00:00
Philipp Schuster
04398aa4b3 MdeModulePkg: fix various typos
Signed-off-by: Philipp Schuster <philipp.schuster@cyberus-technology.de>
2025-11-21 21:49:59 +00:00
Dongyan Qian
46548b1ada MdeModulePkg: Update brotli submodule
Update the brotli submodule to the commit (e230f474).
to avoid build failures in the IA64/LoongArch architecture's
native compiler.

The fundamental reason is that GCC does not support the
__attribute__((model("small"))).
REF:https://github.com/google/brotli/pull/1369

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-11-19 02:06:00 +00:00