Commit Graph

6539 Commits

Author SHA1 Message Date
Dongyan Qian
58d3345d8c MdeModulePkg/SpiBus: Free handle buffers after LocateHandleBuffer
Fix memory leaks by adding missing FreePool calls:
release SpiHcHandles in SpiBusEntry exit path.

REF: https://uefi.org/sites/default/files/resources/UEFI_Spec_Final_2.11.pdf
Chapter 7.3.15: "Services - Boot Services.LocateHandleBuffer":
It is the caller's responsibility to call the Boot Service.FreePool when
the caller no longer requires the contents of Buffer.

Signed-off-by: Dongyan Qian <qiandongyan@loongson.cn>
2025-06-12 14:09:13 +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
DeepakX Singh
c87ea47519 MdeModulePkg/HiiDatabaseDxe: Fix NULL Pointer access from EfiVarStore
Issue : When user access "Boot Maintenance Manager Menu/Secure Boot
 Configuration Menu" with PcdNullPointerDetectionPropertyMask|0x03 and
 PcdHeapGuardPageType|0x7FFF protection policy set,
 we get X64 Exception Type - 0E(#PF - Page-Fault)

Root cause : When user access "Boot Maintenance Manager Menu/Secure Boot
 Configuration Menu", BIOS calls FindQuestionDefaultSetting function and
 send EFI VarStore header pointer to AuthFindVariableData function.
 When header pointer is NULL, it send NULL pointer to AuthFindVariableData
 function and causes the page fault.

Fix : Database.c: In function FindQuestionDefaultSetting, added
 NULL pointers check, so that when EFI VarStore header argument is passed
 to AuthFindVariableData function, NULL pointer access will not happen.

Test: Cross verified while accessing the "Boot Maintenance Manager Menu/
 Secure Boot Configuration Menu" page.

Signed-off-by: DeepakX Singh <deepakx.singh@intel.com>
2025-06-09 14:38:29 +08:00
Michael Kubacki
a9d304f858 MdeModulePkg: Prevent memcpy intrinsics in VS22 (17.14.2)
The latest VS2022 update replaces some code patterns with struct
assignments with `memcpy`. This change convert the code to
explicitly use `CopyMem`.

Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-08 18:07:56 +00:00
Rebecca Cran
a55d933064 MdeModule: Update oniguruma to v6.9.10
Update MdeModulePkg/Universal/RegularExpressionDxe/oniguruma to
the last upstream version, v6.9.10.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-06-07 16:05:57 +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
Bret Barkelew
d81e4121b1 MdeModulePkg/PciBusDxe: Free descriptor buffer in GetResourcePadding()
- Updated the PciGetBusRange function signature to use IN OUT for
  the Descriptors parameter.

- Introduced a new DescriptorsBuffer variable in PciLib.c to
  temporarily hold descriptor data.

- Clean up DescriptorsBuffer and set Descriptors to NULL after use.

Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-06-05 10:05:11 +08:00
Rebecca Cran
81f75c41f9 MdeModulePkg: Typedef ptrdiff_t to fix building with gcc 15.1
When building with gcc 15.1, building RegularExpressionDxe fails
because it can't find the type ptrdiff_t. Therefore, add a typedef
for it in OniguramaUefiPort.h.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2025-05-29 23:15:20 +00:00
Michael Turner
3260988830 MdeModulePkg: Enable PciBus to handle CRS responses by ignoring the device.
If there is a slow device on the PCI Bus, and the HostBridge is
programmed to allow CRS, the slow device may return 0x0001 to inform the
config space reader of the Vendor Id that pci device is not ready. The
current PciBus enumerator will treat 0001 as a valid Vendor Id, but it
is not. It indicates that all other config space is invalid. This code
changes that operation to skip slow devices.

PCI EXPRESS BASE SPECIFICATION, REV. 3.1 section
2.3.1 Request Handling Rules.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-28 20:44:57 +00: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
Bhavani Subramanian
20cd31ea83 MdeModulePkg: Removed Pei, Dxe, Smm and mm header files
Signed-off-by: Bhavani Subramanian <v-bhavanisu@microsoft.com>
2025-05-28 08:01:10 +00:00
Bhavani Subramanian
3d9de5d046 MdeModulePkg: Added MockHiiLib
Signed-off-by: Bhavani Subramanian <v-bhavanisu@microsoft.com>
2025-05-28 08:01:10 +00:00
PaddyDeng
93aeaa0812 MdeModulePkg/Spi: Allow NULL WriteBuffer in FillWriteBuffer()
Fix false positive assert added in #10924
Functon `FillWriteBuffer()` should able to accept NULL WriteBuffer when
WriteBytes equals 0.

Use case:
```
  // Read Status register
  TransactionBufferLength = FillWriteBuffer (
                              Instance,
                              SPI_FLASH_RDSR,
                              SPI_FLASH_RDSR_DUMMY,
                              SPI_FLASH_RDSR_ADDR_BYTES,
                              FALSE,
                              0,
                              0, // WriteBytes = 0
                              NULL // WriteBuffer can be NULL
                              );

```

Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-26 05:45:37 +00:00
Gao Qihang
3e2c650da5 MdeModulePkg: Fix typos in Protocol/DisplayProtocol.h
`diemenstion`->`dimension`

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-05-26 09:04:17 +08: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
Page Chen
a8f0e70dbf MdeModulePkg-SdMmcPciHcDxe: Add missing defines in SD_MMC_HC_SLOT_CAP
Add missing bit defines from 2.2.26 Capabilities Register (Cat.C Offset 040h)

Signed-off-by: Page Chen <paiching_chen@apple.com>
2025-05-26 09:01:47 +08:00
Maximilian Brune
5ea30a061c MdeModulePkg/HiiDatabaseDxe: Fix BlockSize length
The BlockSize calculation was missing the 0 terminator which caused the
string block to shrink by 1 every time the string was processed.
Therefore causing memory corruptions, because the string took more
memory space as was allocated for the string block therefore corrupting
the memory pool at the end (which caused an ASSERT upon trying to free
it).

Signed-off-by: Maximilian Brune <maximilian.brune@9elements.com>
2025-05-16 09:04:53 +08:00
Bret Barkelew
b2db39cefe MdeModulePkg: Correct Usb Mouse Z for absolute pointer.
https://www.usb.org/sites/default/files/hid1_11.pdf
Appendix B, B.2 Protocol 2 (Mouse) details the information
returned by a usb mouse HID.

bytes 3..n are specific to the device, but are used by absolute
pointer devices to return a z axis.

Prior to this change, the existing code was reusing the X value for
the Z axis, which was incorrect.

For usb devices which do not return enough data for a z axis,
this change will be a no-op.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2025-05-09 16:01:42 +08:00
Oliver Smith-Denny
5bc52de687 MdeModulePkg: DebugImageInfoTable: Fix Array Maintenance
The DebugImageInfoTable contains an array of image info
structures. The current implementation removes an entry by
freeing the info structure and putting NULL in that entry of
the array. It then decrements the table size tracked in the table.
However, the array is invalid at this point, it contains a NULL
entry, which the UEFI spec does not envision and it contains a valid
entry past the end of the array as tracked in the spec defined config
table. If the table is consumed at this point it can lead to an
invalid assessment of the image state, which defeats the purpose of
the table.

When a new info structure is added, it then scans for the first NULL
entry adds a pointer to the new info structure there and increments
the table size to cover the entrythat was formerly past the end of
the array.

The current implementation requires that once an unload happens,
more loads happen than unloads and that the last operation is not
an unload (which won't be true in the shell, e.g.). This is
needlessly complex, as the order of the table doesn't matter
(and in fact this implementation doesn't preserve image loading
order either).

This patch updates the removal function to free the desired
info structure, move the last entry of the array to this freed
spot, mark the last entry as NULL, and decrement the table count.
The entry addition function then just always puts a new entry at
the end of the array, expanding it as necessary. This simplifies
the logic and covers the gaps that were present.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-07 11:27:35 +08:00
Oliver Smith-Denny
867fad874a MdeModulePkg: Fix Image Memory Protection Applying
Commit 5ccb5fff02 updated the
image memory protection code to set the protection
attributes through the GCD instead of directly to the page
table. However, this code had an implicit assumption that
each base address passed to it was the beginning of a GCD
descriptor. On the virtual platforms tested, this was the case.
However, on a physical platform, a scenario was encountered
where the base address was not the beginning of a GCD
descriptor, thus causing memory attributes to be applied
incorrectly.

This assumption does not need to be made and this patch
updates the code to handle the case where the base address
is not the beginning of a GCD descriptor.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-07 11:27:20 +08:00
Oliver Smith-Denny
d6101acb08 MdeModulePkg: Shortcircuit GCD Dumping Logic if Not Printing
CoreDumpGcdMemorySpaceMap() gets called on every update to
the GCD, but it only prints if DEBUG_GCD is set. However,
the compiler is not smart enough to remove all of this logic
if we are not printing anything, so we end up needlessly
allocating memory for the copy of the map and spending many
cycles looping through each entry, only to not print anything.

This code is compiled out on release builds, but slows down
debug builds that aren't printing at DEBUG_GCD level.

This patch updates CoreDumpGcdMemorySpaceMap() to shortcircuit
and immediately exit if DEBUG_GCD is not set. It also adds
the same logic to CoreDumpGcdIoSpaceMap(), which is called
less frequently, but has the same issue.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-05-05 20:51:44 +00:00
PaddyDeng
2cff8743ce MdeModulePkg/Spi: Solving potential null ptr deref. in SpiNorFlashJedecSfdp
The pointer `Instance->SfdpBasicFlash` can be used before initializing.

Example code flow:
- CreateSpiNorFlashSfdpInstance: Allocate pool for `Instance`
    - InitialSpiNorFlashSfdpInstance
        - ReadSfdp
            - ReadSfdpHeader
                - FillWriteBuffer: Dereferencing
`Instance->SfdpBasicFlash`
            - ReadSfdpBasicParameterTable: Allocate pool for
`Instance->SfdpBasicFlash`

Check both `Instance` and `Instance->SfdpBasicFlash` should have
a non null value before dereferencing it. Otherwise use the defaut
value 0.

Also terminate the function if `Instance` or `WriteBuffer` is NULL.

Signed-off-by: Paddy Deng <v-paddydeng@microsoft.com>
2025-05-05 14:26:16 +08:00
George Liao
dd8c272555 MdeModulePkg/AcpiTableDxe: Add function for extract ACPI table from HOB.
1. Got RSDP table which installed during the FSP phase from Hob,
   then pass it to the DXE AcpiTableInstance.
2. Got XSDT from RSDP and extract necessary data from XSDT,
   according to the old XSDT to Initialize a new XSDT.
3. Re-install ACPI table from old XSDT to the new XSDT.
   a. If Hob has DSDT table then re-install DSDT table in the new XSDT.
      If not, then skip it.
   b. If Hob has FACS table then re-install FACS table in the new XSDT.
      If not, then skip it.

Signed-off-by: George Liao <george.liao@intel.com>
2025-05-02 09:35:02 +00: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
Jack Hsieh
e1dee2bcfa MdeModulePkg SpiBus: Use correct GUID
Fix incorrect guid in SpiBusDxe and add null checking for AllocateZeroPool in the SpiBus driver.

Signed-off-by: Jack Hsieh <v-chhsieh@microsoft.com>
2025-04-30 14:55:42 +08:00
Oliver Smith-Denny
5ccb5fff02 MdeModulePkg: DxeCore: Set Image Protections Through GCD
Today, SetUefiImageMemoryAttributes calls directly to the
CPU Arch protocol to set EFI_MEMORY_XP or EFI_MEMORY_RO on
image memory. However, this bypasses the GCD and so the GCD
is out of sync with the actual state of memory.

This can cause an issue in the scenario where a new attribute
is being set (whether a virtual attribute or a real HW attribute),
if the GCD attributes are queried for a region and the new attribute
is appended to the existing GCD attributes (which are incorrect),
then the incorrect attributes can get applied. This can result in
setting EFI_MEMORY_XP on code sections of images and causing an
execution fault.

This patch updates SetUefiImageMemoryAttributes to call into the
GCD to update the attributes there and let the GCD code call into
the CPU Arch protocol to update the page table.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-04-27 05:52:11 +00:00
Oliver Smith-Denny
6c6d6f42db MdeModulePkg: DxeCore: Lower Image Protection Print to Verbose Log Level
The print that describes memory attributes being applied to image
memory sections is currently at info level and very noisy, being
printed multiple times per image.

Reduce this to the verbose logging level.

Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-04-27 05:52:11 +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
Gao Qihang
864cc900ab DisplayEngineDxe: Fix length when displaying menu string
Function `PrintStringAt` returns the count of Unicode character, which
is not correct for computing column offset when display empty string if
wide character is introduced. `GetStringWidth (String) / 2 - 1` is
suitable option which is compatible with wide and narrow characters.

Cc: Lichao <lichao@loongson.cn>
Cc: Qian Dongyan <qiandongyan@loongson.cn>
Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-25 03:31:33 +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
Kun Qin
003873db21 MdeModulePkg: PiSmmIpl: Fix physical address dereferencing
With current implemenation, all 3 SmmCommunication* functions go through
the same routine, which will dereference the incoming pointer to inspect
whether this is a V3 buffer or not.

However, the caller always pass in the physical addresses, which could
cause the system to page fault after OS take over the runtime control.

This change reverted the common routine to its previous form to handle MM
communicate v1 and v2. Additionally, a specific communicate function for
v3 was created to support MM communicate v3.

Co-authored-by: Michael D Kinney <michael.d.kinney@intel.com>
Signed-off-by: Kun Qin <kun.qin@microsoft.com>
2025-04-21 06:07:39 +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
Gao Qihang
2e81eb8f05 MdeModulePkg/PlatformDriOverrideDxe:Fix typos
`dynamicly`->`dynamically`

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-17 11:14:09 +08:00
Gao Qihang
1968afafb0 MdeModulePkg/DriverHealthManagerDxe:Fix typo
`dynamicly`->`dynamically`

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-17 11:14:09 +08:00
Pohan Wu
948d4ba0be MdeModulePkg/UsbMassStorageDxe: Remove excessive logging
When a USB mass storage device is not ready (e.g., still powering up
or the hard disk has not reached the desired RPM), the ExecCommand
function fails.This failure is not a true error. Logging it as
DEBUG_ERROR will generate logs for properly functioning devices as
well, potentially flooding logs for older devices.

As mentioned in the command, proper error information retrieval
should occur in the sense request. The solution is to downgrade
the log level from DEBUG_ERROR to DEBUG_INFO.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-04-16 01:27:39 +00:00
Pohan Wu
b917a5b7b3 MdeModulePkg/UsbMassStorageDxe: Remove Port Reset
During USB mass storage enumeration, if a USB transfer fails due to any
other reason, UsbMassStorageDxe will attempt to reset the device.
With the commit ed07a2bb11 ("MdeModulePkg/UsbBusDxe: USB issue fix when
the port reset"), UsbIoPortReset now tears down the USB device context
and reinstalls it (via DisconnectController & ConnectController).

This process is not handled by the UsbMassDriver, causing the upper
layer to access an old pointer that has been freed during the teardown,
leading to a crash.

Example:

UsbMassReadBlocks (Failed)
 -> UsbMassReset
   -> UsbBotResetDevice
     -> UsbIoPortReset (teardown + reinstall and return)
Now the UsbBot context pointer is invalidated and pointing to freed
memory.
     -> UsbBot->UsbIo->UsbControlTransfer() therefore accesses a invalid
pointer and crashes.

The fix is to ignore the ExtendedVerification, which is supposed to
perform a more exhaustive verification operation during the reset.  In
MassStorageDxe, ExtendedVerification perform the parent port reset
(UsbIoPortReset).  Ultimately, the MassStorage device should not reset
the parent port due to a transfer error.  By not performing any extended
verification, the teardown is prevented, thereby avoiding the crash.

Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-04-16 01:27:39 +00:00
Dhaval
fdede2e1ea MdeModulePkg: Update MM buffer structs alignment
In general, for all HOB related content, the HOB structures must be designed so that natural alignment across all execution modes and byte-packed alignment are the same. Ensure ReturnStatus is aligned on 64 bit to achieve the same.

Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com>
2025-04-14 08:44:05 +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
ec91ff2451 MdeModulePkg/DisplayEngineDxe:Fix typos in comments.
opton            -> option
attribut         -> attribute
mwnu             -> menu
highlith/hilight -> highlight
repain           -> repaint

Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-10 15:40:00 +00:00
Kun Qin
05f47b8486 MdeModulePkg: PiSmmIpl: Update MessageLength calculation for MmCommunicate
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3398
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3430

This change added support of installing `EFI_MM_COMMUNICATION3_PROTOCOL`.

MmCommunicate v3 routine that calculates message length is also updated
to remove ambiguity in contrast to v1 routine.

Signed-off-by: Kun Qin <kuqin12@gmail.com>
2025-04-07 07:42:13 +00:00
Kun Qin
9dec81092b MdeModulePkg: PiSmmCore: Added parser of new MM communicate header
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3398
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3430

MM communicate protocols are expanded with EFI_MM_COMMUNICATE_HEADER_V3
structure that cooperates with updated field types and flexible array.
The PiSmmCore implementation is updated to detect and process incoming
data accordingly.

Two checks are also performed to prevent legacy communicate data or
unsupported data is fed into MM core under agreed header guid.

Cc: Jian J Wang <jian.j.wang@intel.com>
Cc: Hao A Wu <hao.a.wu@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>

Signed-off-by: Kun Qin <kuqin12@gmail.com>
2025-04-07 07:42:13 +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
INDIA\sachinganesh
5d3314d0bf MdeModulePkg/Core: Add Hot Pluggable type to Attribute Conversion Table
Hot Pluggable resource attribute was introduced in UEFI 2.11 and PI 1.9
specifications.
This type should have an entry in the Attribute Conversion Table.

Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2025-03-31 07:49:33 +00:00
Jiaxin Wu
14b730cde8 MdeModulePkg/Universal: Remove dynamic PcdStatusCodeUseSerial usage in MM
This patch is to replace dynamic PcdStatusCodeUseSerial by the
gMmStatusCodeUseSerialHobGuid.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
2025-03-27 02:28:30 +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