summaryrefslogtreecommitdiff
path: root/MdeModulePkg
AgeCommit message (Collapse)AuthorFilesLines
2025-04-14MdeModulePkg: Update MM buffer structs alignmentDhaval1-0/+3
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-11MdeModulePkg/BootManagerUiLib: hide UiApp from boot entriesLuigi Leonardi1-0/+30
After d433b4c8e4a6 ("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-10MdeModulePkg: ArmFfaLib: Move Rx/Tx hob definition to Include/Guid folderKun Qin5-17/+36
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-10ArmPkg: ArmFfaLib: Move ArmFfaLib implementation to MdeModulePkgKun Qin13-0/+1770
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-10MdeModulePkg/DisplayEngineDxe:Fix typos in comments.Gao Qihang2-14/+14
opton -> option attribut -> attribute mwnu -> menu highlith/hilight -> highlight repain -> repaint Signed-off-by: Gao Qihang <gaoqihang@loongson.cn>
2025-04-07MdeModulePkg: PiSmmIpl: Update MessageLength calculation for MmCommunicateKun Qin2-14/+114
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-07MdeModulePkg: PiSmmCore: Added parser of new MM communicate headerKun Qin2-19/+46
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-02MdeModulePkg/CustomizedDisplayLib:Fix wrong ColumnIndexWidth special case.Gao Qihang1-2/+2
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-03-31StandaloneMmCorePerformanceLib.inf: Add gEfiEventExitBootServicesGuidMichael Kubacki1-1/+1
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-31MdeModulePkg/Core: Add Hot Pluggable type to Attribute Conversion TableINDIA\sachinganesh1-0/+1
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-27MdeModulePkg/Universal: Remove dynamic PcdStatusCodeUseSerial usage in MMJiaxin Wu5-3/+63
This patch is to replace dynamic PcdStatusCodeUseSerial by the gMmStatusCodeUseSerialHobGuid. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
2025-03-26MdeModulePkg/DxeCorePerformanceLib: Fix incorrect size calculationWei6 Xu1-2/+3
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-21MdeModulePkg: Add Standalone MM perf library supportMichael Kubacki8-488/+725
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-21MdeModulePkg: Add Standalone MM Core performance supportMichael Kubacki8-1360/+1842
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-21MdeModulePkg/DxeCorePerformanceLib: Use EFI_MM_COMMUNICATE_HEADERMichael Kubacki1-7/+7
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-19MdeModulePkg/VarCheckHiiLib: clean up VarCheckHiiLibReceiveHiiBinHandlerLeif Lindholm1-6/+6
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-19MdeModulePkg/VarCheckHiiLib: don't return success for invalid inputLeif Lindholm1-1/+1
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-18MdeModulePkg/XhciDxe: Adjust out-of-range bInterval valuesJack Pham1-2/+22
When a USB device is enumerated it will report one or more endpoint descriptors which contains a bInterval field which specifies the interval a host should periodically poll for that particular endpoint when scheduling transfers. But the units this value is expressed in (in whole ms, a power of 2 x 1ms, or a power of 2 x 125us) may differ depending on the speed of the device and whether the endpoint is isochronous or interrupt. Some high/super-speed devices, which are supposed to report isoc/int bInterval as a power of 2 x 125us, incorrectly report full-speed bInterval values (that is, in whole units of ms) in their interrupt endpoint descriptors which results in an assertion error due to being out of range of the spec-expected values. Rather than asserting, try to adjust those assuming they were expressed in units of ms with an upper limit of 128ms. Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-03-18MdeModulePkg/XhciDxe: Refactor endpoint interval calculationJack Pham1-62/+43
Currently the bInterval value must be calculated differently based on whether the endpoint type is isochronous or interrupt, and whether the device is low, full, high or super speed. Plus, this is duplicated for both XhcInitializeEndpointContext() and XhcInitializeEndpointContext64(). To reduce code complexity and duplication, and for future ease of maintenance, factor this logic out to a separate CalculateInterval() helper function. Signed-off-by: Jack Pham <jackp@qti.qualcomm.com>
2025-03-18MdeModulePkg: Move TdxMeasurementLib from UefiCpuPkgCeping Sun5-0/+207
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-13CapsuleApp: Fix proper return after capsule updateJavier Tia1-0/+1
After a failed capsule updated it returns 0 and not Status failure. Tested-by: Ilias Apalodimas <ilias.apalodimas@linaro.org> Signed-off-by: Javier Tia <javier.tia@linaro.org>
2025-03-13MdeModulePkg/UefiBootManagerLib: Handle device path with Proxy URI.Saloni Kasbekar2-2/+46
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-06MdeModulePkg/UhciDxe: drop unused UsbHcProtocol referencesLeif Lindholm2-5/+2
Protocol/UsbHostController.h described an ancient protocol never part of a public specification ... and was in fact not needed. So drop the reference. Also drop some text from a function documentation header incorrectly implying use of the UsbHcProtocol. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-06MdeModulePkg/UsbBusDxe: drop support for obsolete EFI_USB_HC_PROTOCOLLeif Lindholm4-259/+93
EFI_USB_HC_PROTOCOL was never defined in a released UEFI specification, so drop use of it in UsbBusDxe in preparation of deleting the definitions based on something allegedly supported in confidential EFI 1.10. Signed-off-by: Leif Lindholm <leif.lindholm@oss.qualcomm.com>
2025-03-06MdeModulePkg: Add duplicate exception for gUiAppFileGuidLuigi Leonardi1-0/+1
gUiAppFileGuid, which is used to register EFI Firmware Config as a boot option, has the same value as UiApp guid. This would trigger a duplicate guid error from the CI pipeline, but because these two guids are necessary, this commit adds a duplicate exception. Signed-off-by: Luigi Leonardi <leonardi@redhat.com>
2025-03-03MdeModulePkg/DxeCapsuleLibFmp: Check for NULL in IsValidCapsuleHeaderChristopher Zurcher1-0/+4
Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
2025-03-03MdeModulePkg/TerminalDxe: Support multiple modes for SetMode functionPhil Noh3-4/+34
When the terminal driver is active, currently terminals available through SetMode function are limited to mode 0 (80x25) despite multiple modes are configured as MaxMode value (e.g. 3 modes in mTerminalConsoleModeData list). Improve the function to support multiple modes based on the value. Additionally add more modes that match with the GraphicsConsoleDxe driver. This update is expected to help the symptom that the Setup or Shell screen becomes smaller due to the text mode. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-02-28MdeModulePkg/HiiDatabaseDxe: Prevent linker errorMichael Kubacki1-55/+60
Prevent an issue where `memcpy()` instrinsic is being used after recent MSVC linker update in windows-2022 VM image from 14.31.31103 to 14.32.31326. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-02-27MdeModulePkg/UefiBootManagerLib: Apply var policy to HDDPMichael Kubacki4-3/+80
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-25MdeModulePkg/Variable: Init var policy after SMM variable is readyMichael Kubacki2-9/+14
On a MM system, the main UEFI variable logic resides in MMRAM. In that case, the variable policy logic in `VarCheckPolicyLib`, such as `VarCheckPolicyLibStandaloneMm` is linked against the MM driver also in that case `VariableStandaloneMm`. The MM variable driver indicates its presence to the RT DXE driver via `gEfiSmmVariableProtocolGuid` to indicate variable read support is available from MM. This triggers installation of the variable architectural protocol in DXE. Today, variable policy is initialized by calling `VariablePolicySmmDxeMain()` in `VariableSmmRuntimeInitialize()`. In turn, this installs `gEdkiiVariablePolicyProtocolGuid`. Functions in `gEdkiiVariablePolicyProtocolGuid` may trigger MMIs. However, it is possible that the MM variable driver which is linked against the code with the variable policy MMI handlers (i.e. `VarCheckPolicyLib`) is not loaded yet. Therefore, this change moves invocation of `VariablePolicySmmDxeMain()` to `SmmVariableReady()` which is called on installation of `gEfiSmmVariableProtocolGuid` indicating variable MM services are ready. `gEdkiiVariablePolicyProtocolGuid` is still installed prior to the variable architectural protocol being installed. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-02-25MdeModulePkg: Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE attributePatrick Payne1-1/+8
Add the EFI_RESOURCE_ATTRIBUTE_SPECIAL_PURPOSE resource attribute as per the PI 1.8 spec. This flag is used to indicate that the memory should be treated as special purpose memory (SPM). Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
2025-02-21MdeModulePkg/HiiDatabaseDxe: Remove buffer error for string default.edk2-stable202502Longhaox Lee1-5/+4
Remove efivarstore IFR buffer error when string load default. In the case of varstore type IFR, it will be NULL, just break into next opcode process. Resolve issue from commit cbe8a09dbac5c39d24ce5c4b9e7d44607f6c23da varstore type IFR string might return status error while execute ExtractConfig function. Signed-off-by: Longhao Lee <longhaox.lee@intel.com>
2025-02-19MdeModulePkg/UsbBusPei: Improve PEI USB enumerationPhil Noh1-161/+170
Unlike DXE USB enumeration that enumerates all changed ports on timer interrupt, PEI USB Enumeration runs once at the driver entry point. USB3.x devices initially appear in USB2.0 ports. When the USB2.0 port is reset, the USB3.x device disappears from the USB2.0 port and appears on the USB3.0 port. The USB3.x device won't be enumerated if the USB2.0 port number is greater than the USB3.0 port number. Re-enumerate USB to make sure USB3.x devices in this case. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2025-02-07Add MockVariablePolicyHelperLibKane Chen4-0/+129
Signed-off-by: Kane Chen <kane.chen@microsoft.com>
2025-02-07MdePkg: Move StackCheckLibStaticInit to StackCheckLibOliver Smith-Denny1-0/+3
This commit oves StackCheckLib from a NULL lib to an instance of StackCheckLib. This requires every entry point to add a library dependency on StackCheckLib. It also requires every SEC module to have a dependency on StackCheckLib because there is no standard SEC entry point. It allows for greater flexibility for a platform to apply stack cookies and simplifies DSC logic. Continuous-integration-options: PatchCheck.ignore-multi-package Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
2025-01-29MdeModulePkg: NvmExpressDxe: fix warning about uninitialized variableMike Maslenkin1-0/+2
NvmExpressMediaSanitize.c: In function 'NvmExpressMediaClear': NvmExpressMediaSanitize.c:337:29: error: 'Status' may be used uninitialized in this function [-Werror=maybe-uninitialized] EFI_STATUS Status; ^~~~~~ cc1: all warnings being treated as errors Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-29MdeModulePkg: fix warning about uninitialized variableMike Maslenkin1-0/+2
Handle.c:1302:24: error: 'Prot' may be used uninitialized in this function [-Werror=maybe-uninitialized] *Interface = Prot->Interface; ~~~~^~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-29MdeModulePkg: PeiMain: fix warning about uninitialized variableMike Maslenkin1-5/+5
Dispatcher.c:1639:34: error: 'FvMigrationFlags' may be used uninitialized in this function [-Werror=maybe-uninitialized] (((FvMigrationFlags & FLAGS_FV_MIGRATE_BEFORE_PEI_CORE_REENTRY) == 0) || ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ cc1: all warnings being treated as errors Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2025-01-26MdeModulePkg PeiMain: Remove return for PeiCoreBuildHobHandoffInfoTable()Star Zeng2-10/+4
PeiCoreBuildHobHandoffInfoTable() always returns EFI_SUCCESS, and also its return is not consumed at all, so this patch removes return for PeiCoreBuildHobHandoffInfoTable(). Signed-off-by: Star Zeng <star.zeng@intel.com>
2025-01-15MdeModulePkg: Make noisy log DEBUG_VERBOSEDionna Glaze1-6/+6
For bootup of VMs with multiple accelerators, these logging instructions flood the logs for a good 30 seconds. Originally found by Gary Zibrat. Signed-off-by: Dionna Glaze <dionnaglaze@google.com>
2025-01-14MdeModulePkg/HiiDatabaseDxe: Add string question load default support.Longhaox Lee1-0/+173
Add string question load default support. load default data from PCD PcdNvStoreDefaultValueBuffer. Signed-off-by: Longhao Lee <longhaox.lee@intel.com>
2025-01-09MdeModulePkg: Update AtaPassThru to UEFI 2.10AINDIA\sachinganesh3-0/+12
UEFI 2.10A Specification has added a new error case to EFI_ATA_PASS_THRU_PROTOCOL.GetNextDevice API which handles port multiplier not being connected to the Port. Signed-off-by: Sachin Ganesh <sachinganesh@ami.com>
2024-12-22MdeModulePkg/XhciDxe: Non-zero start/stop values in XhcGetElapsedTicksHenz, Patrick1-2/+2
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4578 The implementation of XhcGetElapsedTicks did not account for non-zero start and stop values for the performance counter timer, potentially resulting in an incorrect elapsed tick count getting returned to the caller. Account for non-zero start and stop values when calculating the elapsed tick count. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Patrick Henz <patrick.henz@hpe.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Acked-by: Hao A Wu <hao.a.wu@intel.com> Message-ID: <c3038878c4d30c54e60cce7192cf1aa60c30ad2e.1698770394.git.patrick.henz@hpe.com> Resolve rebase conflict from commit ff4c49a5ee38 ("MdeModulePkg/Bus: Fix XhciDxe Linker Issues", 2023-12-06): rename "mPerformanceCounter*" to "mXhciPerformanceCounter*". Signed-off-by: Laszlo Ersek <laszlo.ersek@posteo.net>
2024-12-16MdeModulePkg DxeMain: Add late initialization for Debug Agent.Chris Fernald2-0/+7
Add a late initialize in DxeMain for the debug agent. This is required for the debug agent to be able to setup events to handle image loads, exit boot services, and other important callbacks. Define a reinitialize debug agent. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-12-16MdeModulePkg/Bus/Ufs: Use IndustryStandard headersChristopher Zurcher6-2676/+4
Remove duplicate private header files and reference UFS spec definitions from the IndustryStandard folder. Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
2024-12-11MdeModulePkg SmbiosMeasurementDxe: Release TableAddress after useYang Gang1-0/+4
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2024-12-11MdeModulePkg DriverHealthManagerDxe: Display HealthStatus as TextTwoYang Gang1-2/+4
When PcdBrowserGrayOutTextStatement is TRUE, TextOpCode will be GrayOut. HealthStatus cannot be displayed in help area, use TextTwo to display it. Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2024-12-11MdeModulePkg/BrotliCustomDecompressLib: Make the library buildablePhil Noh4-1/+33
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4877 Brotli decompression library is supported in EDK2 core. Currently it is not buildable when linking it to DxeIpl driver. The result is also checked on edk2 master branch. It could be related to updating Brotli submodule (v1.0.9) on the previous commit (1193aa2). The update makes the library buildable. It was verified for the functional status. Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2024-12-06MdeModulePkg/PlatformDriOverrideDxe: fix HiiOpCodeHandle leakMike Maslenkin1-0/+4
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06MdeModulePkg/UiApp: fix HiiOpCodeHandle leakMike Maslenkin1-0/+2
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>