Commit graph

1177 commits

Author SHA1 Message Date
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
Vineel Kovvuri[MSFT]
a3a180e2bc MdeModulePkg: Update Brotli Compress to 1.2.0
# Description

Update brotli from v1.0.9 to v1.2.0
https://github.com/google/brotli/releases/tag/v1.2.0

- [ ] Breaking change?
  - **Breaking change** - Does this PR cause a
    break in build or boot behavior?
  - Examples: Does it add a new library class
    or move a module to a different repo.
- [x] Impacts security?
  - **Security** - Does this PR have a direct security impact?
  - Fixes CVE-2025-6176 reported in brotli < 1.2.0.
- [ ] Includes tests?
  - **Tests** - Does this PR include any explicit test code?
  - Examples: Unit tests or integration tests.

## How This Was Tested

Verified booting on a virtual platform by
compressing/decompressing PEI/DXE sections.

## Integration Instructions
NA

Signed-off-by: Vineel Kovvuri[MSFT] <vineelko@microsoft.com>
2025-11-05 04:12:21 +00:00
kuqin12
94065db3dc MdeModulePkg: ArmFfaLib: Add FFA_YIELD handling
If a secure partition on AArch64 platforms would consume extended time
to operate with peripherals, it might elect to yield the control back to
normal world and expect the normal world to callback after hinted period
of time.

This change adds the FFA_YIELD handling from ArmFfaLib to support long
operations from secure partitions. Timeout arguments are ignored because
systems in this context cannot benefit from the timeout period. Treating
FFA_YIELD like FFA_INTERRUPT and expecting the caller to invoke FFA_RUN
is the least disruptive approach while achieving the intended behavior.

This was tested on proprietary hardware platforms and booted to Windows.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-10-31 07:26:12 +00:00
Sathya Ravichandran
147e9a053e MdeModulePkg: Remove DXE_SAL_DRIVER
The DXE_SAL_DRIVER module type was introduced to support
Itanium (IPF) platforms. Since support for Itanium processors
has been dropped, the instances of DXE_SAL_DRIVER
have been removed.

Ref: [3cb0a311cb]

Cc: Sachin Ganesh <sachinganesh@ami.com>
Signed-off-by: Sathya Ravichandran <sathyar@ami.com>
2025-10-30 10:00:32 +00:00
Oliver Smith-Denny
1d6f2f0d8d MdeModulePkg: CpuExceptionHandlerLibNull: Return Success On Null Func
Currently, CpuExceptionHandlerLibNull returns EFI_UNSUPPORTED for
InitializeSeparateExceptionStacks. However, CpuMpPei, CpuDxe, and
DXE Core are all moving to call this function unconditionally and
expect it returns success. As such, the null lib is updated to
return success.

This fixes a hang on EmulatorPkg where DXE Core asserts if this
function returns an error.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-10-23 00:57:59 +00:00
Pavithra Gurulingappa
597d061e09 MdeModulePkg/DxeCapsuleLibFmp:Added PCD for EmbeddedDriver Support
Currently, there is no mechanism for platforms to enable or disable
support for EmbeddedDrivers in capsule updates. This patch introduces
a new PCD, PcdEmbeddedDriverSupport, allowing platforms to explicitly
control whether capsules containing EmbeddedDrivers are supported.
This ensures capsules with embedded drivers are rejected on platforms
that do not support them.

This is a breaking change.By default, PcdEmbeddedDriverSupport
is set to FALSE which disables embedded driver support in capsule updates
across all platforms unless explicitly enabled.

Platforms must opt-in by setting the PcdEmbeddedDriverSupport to TRUE
in order to enable support for capsules containing embedded drivers.

Signed-off-by: Pavithra Gurulingappa <gpavithr@qti.qualcomm.com>
2025-10-14 17:45:19 +00:00
Oliver Smith-Denny
ef79d58427 MdeModulePkg: Remove ARM32 Support
edk2 is dropping support for the ARM32 architecture. This
commit removes ARM32 support from MdeModulePkg. This also
drops irrelevant VALID_ARCHITECTURE comments from infs that
are not arch specific.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-09-25 22:04:10 +00:00
Michael Kubacki
282a324bf4 MdeModulePkg/ArmFfaLib: Add MemoryAllocationLib
ArmFfaRxTxMap.c is built by both ArmFfaPeiLib and ArmFfaDxeLib.

ArmFfaSecRxTxMap.c is built by ArmFfaSecLib.

ArmFfaStandaloneMmRxTxMap.c is built by ArmFfaStandaloneMm*Lib.

The files depend on `MemoryAllocationLib` APIs such as
`AllocateAlignedPages()`. This change adds `MemoryAllocationLib` to
those library INF files.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-09-12 07:31:53 +00:00
Michael Kubacki
2558af552d MdeModulePkg/ArmFfaLib: Add HobLib to StMm instances
ArmFfaCommon.c is built by both ArmFfaStandaloneMmCoreLib and
ArmFfaStandaloneMmLib. It links against HobLiib APIs such as
`GetFirstHob()`. Right now, the symbols fail to link:

```
lld-link: error: undefined symbol: GetFirstHob
          ArmFfaStandaloneMmCoreLib.lib(ArmFfaCommon.obj)
```

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-09-12 07:31:53 +00:00
Levi Yun
d7832b4800 MdeModulePkg: consider UNSUPPORTED return as valid in ArmFfaStandaloneMmLib
commit b534cabbda ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition")
makes ArmFfaStandlaoneMm(Core)Lib map Rx/Tx buffer in its constructor.

This makes a failure of loading StandaloneMm in legacy platform
which doesn't implements Rx/Tx buffer related API since it doesn't need to.

StandaloneMm could be only service provider not cosumer in some platform
where doesn't need to map RxTx buffer.
Therefore, Considier EFI_UNSUPPORTED return in ArmFfaStandaloneMmLib's
constructor.

Fixes: b534cabbda ("ArmFfaLib: Add Rx/Tx support for Stmm secure partition")
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-09-09 01:09:48 +10:00
Levi Yun
d8e875e625 Global: fix ArmFfaLibRun() caller couldn't get ret-args
When ArmFfaLibDirectMsgReq(2) is preempted, caller of these functions
should resume it works via ArmFfaLibRun() and the secure partition
will be return with FFA_DIRECT_MSG_RESP(2) with return arguments.

However, since ArmFfaLibRun() gets its return in its stack variable,
So caller of ArmFfaLibRun() doesn't get the return arguments from
secure partition.

To resolve this, add output parameter to ArmFfaLibRun() to
receive return arguments.

Continuous-integration-options: PatchCheck.ignore-multi-package
Fixes: 5d1b38dd07 ("ArmPkg: Add ArmFfaLib used in Dxe driver")
Reported-by: Mariam Elshakfy <Mariam.Elshakfy@arm.com>
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-09-08 13:14:00 +00:00
Gao Qihang
296c2e7edb MdeModulePkg: Simplify PrintInternal function to fit wide character
According to UEFI Spec, only Bit0...6 is valid in mode attribute, other
bits are undefined and must be 0. So attribute with EFI_WIDE_ATTRIBUTE
is unacceptable as EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.SetAttribute() input
parameter. In current PrintInternal function, wide character removed
WIDE_CHAR, and is used as EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString()
input parameter. So, wide character is mistakenly be treated as narrow
character.

Because EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL.OutputString() can handle unicode
string with NARROW_CHAR and WIDE_CHAR, we can directly invoke
OutputString() with whole unicode string in PrintInternal function instead
of separated wide/narrow string. And then, the logic of computing unicode
string width is also simplified.

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-08-22 10:32:40 +00: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
Levi Yun
f85c718167 MdeModulePkg/Include: change type of buffer address in ArmFfaRxTxBufferInfo
Change type of buffer address type in ArmFfaRxTxBufferInfo
so that reduce the type casting.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-14 11:59:38 +00:00
Levi Yun
5a2713ec2b MdeModulePkg/Library: commonize some duplicate code in ArmFfaLib
Some of code for handling Rx/Tx buffer is duplicate.
This patch commonize some of duplication routine used in
Rx/Tx buffer related functions.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-14 11:59:38 +00:00
Levi Yun
a7e27682cf MdeModulePkg/Library: add ArmFfaSecLib
To use Arm-FFA intereface in PeilessSec, implments
ArmFfaSecLib used by PeilessSec.
For example, communicate with TPM service using CRB over ARM-FFA
(via Tpm2DeviceLibFfa), PeilessSec need to use Arm-FFA interface.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
2025-07-14 11:59:38 +00:00
Levi Yun
b336d9b87a MdeModulePkg/Library: fix memory leak Rx/Tx Buffer in ArmFfaPeiLib
The commit e15fe06603
("MdeModulePkg/Library: make ArmFfaPeiLib available early PEIM stage")
uses ArmFfaPeiLib in the early PEIM stage.

However, the Rx/Tx buffer allocated in the early PEIM stage uses
temporary memory. This results in a memory leak when the temporary
memory's heap is relocated to permanent memory.

For example, if the Rx/Tx buffer memory is allocated at 0x20006000
in temporary memory, and if offset between temporary memory and
permanent is 0x40000000, then:

 - Once permanent memory installed the temporary memory at 0x20006000
   is migrated to 0x60006000.
 - However, ArmFfaPeiLib allocates new Rx/Tx buffer without freeing
   the migrated Rx/Tx buffers, i.e. the buffers at 0x60006000.

This results in a memory leak as the migrated Rx/Tx buffer area is
lost.
To address this memory leak, use the MemoryAllocationHob's name, so
that the migrated memory area will be reused as Rx/Tx buffer.

This patch also includes rename ArmFfaRxTxStmm.c to
ArmFfaStandaloneMmRxTxMap.c to keep the file name convention in
ArmFfaLib with ArmFfa{Phase}{...}.c

Fixes: e15fe06603 ("MdeModulePkg/Library: ...")
Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Continuous-integration-options: PatchCheck.ignore-multi-package
2025-07-14 11:59:38 +00:00
GuoMinJ
0fe2520aad MdeModulePkg: Remove UGA support
The Universal Graphics Adapter (UGA) is a graphic abstraction.
The UGA I/O and Draw protocols are deprecated since UEFI 2.0 was
introduced. Cf. the UEFI spec v2.9:
"Appendix L - EFI 1.10 Protocol Changes and Deprecation List"
section L.2 "Deprecated Protocols"

Remove the UGA support.

Signed-off-by: GuoMinJ <newexplorerj@gmail.com>
Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
2025-07-08 15:42:03 +00:00
Abdul Lateef Attar
25b1754ae5 MdeModulePkg: Correct spelling errors and typos
Signed-off-by: Abdul Lateef Attar <AbdulLateef.Attar@amd.com>
2025-07-04 09:41:47 +08:00
Kun Qin
22142b4f4a MdePkg, MdeModulePkg: ArmFfaLib: Expose FFA_ARGS and ArmCallFfa
FFA is a framework that supports various protocols built on top. i.e.
memory protocol, which is nothing that can be done through existing
interfaces.

Instead of requiring protocol authors to check conduit PCD in every
implementation, exposing the ArmCallFfa is a unified way to allow other
protocols to leverage FFA interfaces.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26 17:38:28 +00:00
Kun Qin
b534cabbda MdeModulePkg: ArmFfaLib: Add Rx/Tx support for Stmm secure partition
This change adds the support for mapping Rx/Tx buffer through the library
constructor. The first mapper will produce an MM protocol instance with
Rx/Tx information, which allows subsequent consumers to query the
information.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-26 17:38:28 +00:00
Jeff Brasen
07425903d3 MdeModulePkg/UefiBootManagerLib: Fix crash when no load options are found
Do not attempt to sort the load options when there
are none.

Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
2025-06-25 18:26:11 +00:00
Michael Kubacki
1b26c4b73b MdeModulePkg: Refactor MM Services Tables linked in MM Core Perf Lib
The code used a `MmServicesTableLib` dependency for both the
Standalone MM and Traditional MM instances and shared code between
those. There is not a readily available `MmServicesTable` lib
instance for Traditional SMM (that can link to `PiSmmCore`). To ease
integration and prevent creating an instance just for this case, this
change uses `SmmServicesTableLib` in the Traditional SMM instance and
`MmServicesTableLib` in the Standalone MM instance and moves code as
necessary to accommodate this.

For general reference, there are two available instances of
`MmServicesTableLib`:

- MdePkg/MmServicesTableLib - only supports DXE_SMM drivers.
- MdePkg/StandaloneMmServicesTableLib - supports both MM drivers and
  MM cores.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-13 06:44:38 +00:00
Gao Qihang
a808062890 MdeModulePkg: Fix function typos
functin -> function

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-06-12 17:50:45 +00:00
Gao Qihang
c4bc60b2b7 MdeModulePkg: Fix EFI_SUCCESS typos
EFI_SUCESS -> EFI_SUCCESS
EFI_SUCESSS -> EFI_SUCCESS

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-06-12 17:50:45 +00:00
Dongyan Qian
51a8869907 MdeModulePkg: Fix definition typos
`defintion`->`definition`

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-11 17:20:20 +00:00
Kun Qin
1d0c037b54 MdeModulePkg: ArmFfaLib: Support UUID-GUID conversion interfaces
This change moves the existing ConvertEfiGuidToUuid function to public
interface to support newly defined functions prototypes.

This change also adds the `ArmConvertUuidToEfiGuid` function
implementation, which is an inverse of the original conversion.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-06-05 05:01:57 +00:00
Michael Kubacki
e10edfe71e MdeModulePkg/TpmMeasurementLibNull: Allow broader linking
This is needed in a MM_CORE_STANDALONE module. Since this null
instance is so simple, remove individual module types to allow
it be integrated more easily.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-05 10:05:24 +08:00
Levi Yun
e15fe06603 MdeModulePkg/Library: make ArmFfaPeiLib available early PEIM stage
commit 26fb5edff3
("MdeModulePkg/ArmFfaLib: Add depex on gEfiPeiMemoryDiscoveredPpiGuid")
restricts ArmFfaPeiLib usage only after PEI phase can be used
permanent memory. However, This would be problem for PEIM
which runs before gEfiPeiMemoryDiscoveredPpiGuid Ppi installed.
(i.e) Tcg2Pei PEIM.

To resolve this, remove dependency on gEfiPeiMemoryDiscoveredPpiGuid
and let ArmFfaPeiLib remap the Rx/Tx buffer after
gEfiPeiMemoryDiscoveredPpiGuid is installed so that ArmFfaPeiLib can be
used with temporary memory.

Signed-off-by: Yeoreum Yun <yeoreum.yun@arm.com>
Fixes: 26fb5edff3 ("MdeModulePkg/ArmFfaLib: ...")
2025-05-28 13:56:02 +00:00
Gao Qihang
fc1b9c828d MdeModulePkg: Fix typos in CustomizedDisplayLib
`diemenstion/diemension`->`dimension`

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-05-26 09:04:17 +08:00
Mohamed Gamal Morsy
31fc56c70a ArmFfaLib: Replace SMCCC_VERSION check with FF-A version check
Patch 8d03c42d38 ("ArmPkg: ArmFfaLib: Update FF-A direct message
to support 18 registers") calls SMCCC_VERSION by default during
FF-A initialization even if the SMC conduit is not enabled. This
leads to sending malformed FF-A versions if the SVC conduit is
used instead.

This is observed for example when using an SPMC@EL-1 (e.g. rust-spmc)
which receives the FF-A message via an SVC call and interprets
SMCCC_VERSION as an FF-A Function ID and subsequently fails to
handle it.

Since 18-register support is only support with FF-A >= 1.2, replace
SMCCC_VERSION check with FF-A version check

Signed-off-by: Mohamed Gamal Morsy <mohamed.morsy@arm.com>
2025-05-01 11:51:16 +00:00
Yang Gang
c6db76402c MdeModulePkg BmDriverHealth.c: Support dump the driver name
Sometimes the controller name is not present, add BmGetDriverName
to retrieve the driver name.(Like DriverHealthManagerDxe)

Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2025-04-25 07:54:34 +00:00
Gao Qihang
135e07c6e5 DeviceManagerUiLib:Update DeviceManager form data when the form opens.
Issue link:https://github.com/tianocore/edk2/issues/10925

If new HII resource is installed, show it in DeviceManager form. If HII
resource is uninstalled, remove it from DeviceManager form. So once we
enter DeviceManager form, form data should be refreshed to display
dynamically.

Cc: Li Chao <lichao@loongson.cn>
Cc: Qian Dongyan <qiandongyan@loongson.cn>
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-25 05:39:16 +00:00
Anubhav Raina
26fb5edff3 MdeModulePkg/ArmFfaLib: Add depex on gEfiPeiMemoryDiscoveredPpiGuid
If ArmFfaLibRxTxMap is called before permanent memory is installed the
memory allocated for the FF-A buffers will be migrated to the permanent
memory after it is installed without updating gArmFfaRxTxBufferInfoGuid
or unmapping the old buffers and mapping the updated buffers.

An ASSERT in MemoryServices at ExitBootServices is triggered when
ArmFfaDxeLib tries to call FreeAlignedPages on the original buffer
reference.

Add depex on gEfiPeiMemoryDiscoveredPpiGuid for ArmFfaPeiLib so any
Peims that use FF-A are only dispatched after permanent memory is
available.

Signed-off-by: Anubhav Raina <anubhav.raina@arm.com>
2025-04-23 10:08:20 +00:00
Dun Tan
a9cf419ed9 MdeModulePkg: Add two new APIs in BaseHobLibNull
This commit is to add two new APIs in MdeModulePkg
BaseHobLibNull:

1.The GetNextMemoryAllocationGuidHob () returns the next
instance of the Memory Allocation HOB with the matched
GUID from a starting HOB pointer.

2.The TagMemoryAllocationHobWithGuid () searchs the HOB
list for the Memory Allocation HOB with a matching base
address and set the Name GUID. Then the instance of the
tagged Memory Allocation HOB with matched base address is
returned.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2025-04-18 03:48:07 +00:00
Luigi Leonardi
6ddfd378e5 MdeModulePkg/BootManagerUiLib: hide UiApp from boot entries
After d433b4c8e4 ("OvmfPkg/PlatformBootManagerLib: Register UiApp as
an optional boot option") UiApp can be found among the boot options
without the LOAD_OPTION_HIDDEN flag set. This means that it can appear
in the list of available entries. This can be confusing.

Starting from the UiApp guid, add a check on the Device Path on all the
available entries, if it matches, skip the entry.

Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2025-04-11 10:42:01 +08:00
Kun Qin
18988ea3e6 MdeModulePkg: ArmFfaLib: Move Rx/Tx hob definition to Include/Guid folder
Currently, ArmFfaLib uses an internally defined Guided HOB to pass
information about the Rx/Tx buffer set up by the first executing agent.

However, the GUID definition is solely specified in the DEC file, which
is inconsistent with other GUID definitions in MdeModulePkg. This change
relocates the GUID definition to the Include/Guid folder to ensure
consistency across the package.

Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
Kun Qin
be03ceb117 ArmPkg: ArmFfaLib: Move ArmFfaLib implementation to MdeModulePkg
ArmFfaLib is an implementation of an industry specification-defined
interface with UEFI specific method of handling Rx/Tx buffer sharing
across multiple boot phases, which is more appropriately placed in
MdeModulePkg.

This update relocates the implementation of ArmFfaLib to MdeModulePkg,
thereby supporting the FFA call primitives for all other packages that
depend on this interface.

Continuous-integration-options: PatchCheck.ignore-multi-package
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-10 17:52:48 +00:00
Gao Qihang
e0b2187754 MdeModulePkg/CustomizedDisplayLib:Fix wrong ColumnIndexWidth special case.
If the column width of screen cannot be divisible by three, one or two
rows will be superfluous in the 3rd column. so, Optimize calculation method
of 3rd cloumn to fill entire row.

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-02 19:10:04 +00:00
Michael Kubacki
30f3fa0af7 StandaloneMmCorePerformanceLib.inf: Add gEfiEventExitBootServicesGuid
Adds `gEfiEventExitBootServicesGuid` to the `[Guids]` section and
removes `gEdkiiSmmExitBootServicesProtocolGuid` from the
`[Protocols]` section for the current implementation.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-03-31 17:03:01 +00:00
Wei6 Xu
95bf74fac1 MdeModulePkg/DxeCorePerformanceLib: Fix incorrect size calculation
The values of BootRecordDataPayloadSize and CommSize are incorrect.
BootRecordDataPayloadSize should equal to
  SmmBootRecordDataSize - SmmBootRecordDataRetrieved
CommSize should equal to
  OFFSET_OF (EFI_MM_COMMUNICATE_HEADER,Data) \
  + (UINTN)MmCommBufferHeader->MessageLength
SmmCommData->BootRecordSize should be set to BootRecordDataPayloadSize,
instead of the total size of entire Smm boot record data.

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2025-03-26 09:59:01 +08:00
Michael Kubacki
1c51a268b7 MdeModulePkg: Add Standalone MM perf library support
Adds a new library instance to support logging performance data in
Standalone MM.

- Add StandaloneMmPerformanceLib instance
- Move common MM logic to a new file `SmmPerformanceLibInternal.c`
- Since the library largely defers most logic to the performance
  measurement protocol a large degree of code can be shared between
  Standalone MM and Traditional MM.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-03-21 15:23:11 +00:00
Michael Kubacki
11b44c5cd1 MdeModulePkg: Add Standalone MM Core performance support
Adds a new library instance to support MM core functionality for
performance in Standalone MM.

- Add StandaloneMmCorePerformanceLib instance
- Move common MM logic to a new file `MmCorePerformanceLib.c`
- Define interfaces with implementation specific to MM environment
  type in `SmmCorePerformanceLibInternal.h` and implement those
  functions in the Standalone MM and Traditional MM specific C files

Note: StandaloneMmCorePerformanceLib supports both
      `MM_CORE_STANDALONE` and `MM_STANDALONE` as some Standalone MM
	  environments have privilege separation and need to link this
	  functionality in a ring 3 Standalone MM driver that is outside
	  the ring 0 Standalone MM core driver.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-03-21 15:23:11 +00:00
Michael Kubacki
874c24baae MdeModulePkg/DxeCorePerformanceLib: Use EFI_MM_COMMUNICATE_HEADER
Refactor the file to use the new type name EFI_MM_COMMUNICATE_HEADER.

This is the same type but follows the new name and is more clear
with upcoming Standalone MM support being added.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-03-21 15:23:11 +00:00
Leif Lindholm
22919e560b MdeModulePkg/VarCheckHiiLib: clean up VarCheckHiiLibReceiveHiiBinHandler
Building VarCheckHiiLib fails on my clang 19.1.6 setup with the error
 variable 'Status' is used uninitialized whenever 'if' condition is false
due to the DispatchHandle != NULL test.

Calling this function with a NULL handle makes no sense, so move the test
to the function entry and return failure if appropriate.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-19 14:18:12 +00:00
Leif Lindholm
f6aba88ac8 MdeModulePkg/VarCheckHiiLib: don't return success for invalid input
The doxygen comment for VarCheckHiiLibReceiveHiiBinHandler says that
EFI_INVALID_PARAMETER should be returned if either of CommBuffer or
CommBufferSize is NULL, but the test results in an early return of
EFI_SUCCESS.

Update the code to match the documentation.

Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-19 14:18:12 +00:00
Ceping Sun
f919709c86 MdeModulePkg: Move TdxMeasurementLib from UefiCpuPkg
There are 2 reasons to move TdxMeasurementLib LibraryClass from
UefiCpuPkg to MdeModulePkg:
1. TpmMeasurementLib.h is located at MdeModulePkg/Include/Library.
   It is similiar as TdxMeasurementLib.h.
2. TdxMeasurementLib is designed for TDX Measurement, it can be called
   from SecurityPkg. And it is not much related to UefiCpuPkg.

Based upon above consideration, it's better to move TdxMeasurementLib
LibraryClass from UefiCpuPkg to MdeModulePkg.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Min Xu <min.m.xu@intel.com>
Signed-off-by: Ceping Sun <cepingx.sun@intel.com>
2025-03-18 17:57:40 +00:00
Saloni Kasbekar
592ff1e98f MdeModulePkg/UefiBootManagerLib: Handle device path with Proxy URI.
Update library to handle HTTP Boot device paths with Proxy URI

Implementation based on UEFI Specification v2.11 Section 24.7.3.1

Signed-off-by: Saloni Kasbekar <saloni.kasbekar@intel.com>
2025-03-13 00:34:01 +00:00
Christopher Zurcher
b509393160 MdeModulePkg/DxeCapsuleLibFmp: Check for NULL in IsValidCapsuleHeader
Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
2025-03-03 23:00:33 +00:00
Michael Kubacki
67fe6b41b2 MdeModulePkg/UefiBootManagerLib: Apply var policy to HDDP
Applies variable policy to the "HDDP" UEFI variable in the
mBmHardDriveBootVariableGuid vendor namespace to ensure a minimum
allowed size and expected attributes are present.

A protocol notify is used to handle different platform scenarios
where this instance of UefiBootManagerLib may be linked.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-02-27 15:41:04 +00:00