summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Library
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg BmDriverHealth.c: Support dump the driver nameYang Gang2 days1-15/+145
| | | | | | | 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>
* DeviceManagerUiLib:Update DeviceManager form data when the form opens.Gao Qihang3 days2-6/+22
| | | | | | | | | | | | | 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>
* MdeModulePkg/ArmFfaLib: Add depex on gEfiPeiMemoryDiscoveredPpiGuidAnubhav Raina4 days1-1/+4
| | | | | | | | | | | | | | | | | 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>
* MdeModulePkg: Add two new APIs in BaseHobLibNullDun Tan10 days1-0/+55
| | | | | | | | | | | | | | | | | 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>
* MdeModulePkg/BootManagerUiLib: hide UiApp from boot entriesLuigi Leonardi2025-04-111-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>
* MdeModulePkg: ArmFfaLib: Move Rx/Tx hob definition to Include/Guid folderKun Qin2025-04-103-17/+4
| | | | | | | | | | | | 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>
* ArmPkg: ArmFfaLib: Move ArmFfaLib implementation to MdeModulePkgKun Qin2025-04-1011-0/+1738
| | | | | | | | | | | | | | 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>
* MdeModulePkg/CustomizedDisplayLib:Fix wrong ColumnIndexWidth special case.Gao Qihang2025-04-021-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>
* StandaloneMmCorePerformanceLib.inf: Add gEfiEventExitBootServicesGuidMichael Kubacki2025-03-311-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>
* MdeModulePkg/DxeCorePerformanceLib: Fix incorrect size calculationWei6 Xu2025-03-261-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>
* MdeModulePkg: Add Standalone MM perf library supportMichael Kubacki2025-03-217-488/+724
| | | | | | | | | | | | | 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>
* MdeModulePkg: Add Standalone MM Core performance supportMichael Kubacki2025-03-217-1360/+1841
| | | | | | | | | | | | | | | | | | | 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>
* MdeModulePkg/DxeCorePerformanceLib: Use EFI_MM_COMMUNICATE_HEADERMichael Kubacki2025-03-211-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>
* MdeModulePkg/VarCheckHiiLib: clean up VarCheckHiiLibReceiveHiiBinHandlerLeif Lindholm2025-03-191-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>
* MdeModulePkg/VarCheckHiiLib: don't return success for invalid inputLeif Lindholm2025-03-191-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>
* MdeModulePkg: Move TdxMeasurementLib from UefiCpuPkgCeping Sun2025-03-182-0/+117
| | | | | | | | | | | | | | | | | | | 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>
* MdeModulePkg/UefiBootManagerLib: Handle device path with Proxy URI.Saloni Kasbekar2025-03-132-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>
* MdeModulePkg/DxeCapsuleLibFmp: Check for NULL in IsValidCapsuleHeaderChristopher Zurcher2025-03-031-0/+4
| | | | Signed-off-by: Christopher Zurcher <christopher.zurcher@microsoft.com>
* MdeModulePkg/UefiBootManagerLib: Apply var policy to HDDPMichael Kubacki2025-02-274-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>
* MdeModulePkg/BrotliCustomDecompressLib: Make the library buildablePhil Noh2024-12-114-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>
* MdeModulePkg HobPrintLib: Add Guid to Guids section.Aaron Pop2024-11-221-0/+1
| | | | | | | | gEfiHobMemoryAllocModuleGuid is referenced in the HobPrintLib, but it is not defined in the INF file, causing an unresolved external error when the module is consumed by code. Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
* MdeModulePkg/UefiBootManagerLib: Build proper SD/MMC boot descriptionsMario Bălănică2024-10-032-2/+239
| | | | | | | | | | | | This generates boot descriptions for SD/MMC devices in the form of: - "UEFI SanDisk SC128 2A2B1E4F SD Device" - "UEFI Samsung BJTD4R 7AB3A8DE eMMC User Data" The manufacturer ID tables are a best-effort, collected from various places and personal testing. They're not complete and may be inaccurate for rebranded cards. Signed-off-by: Mario Bălănică <mariobalanica02@gmail.com>
* MdeModulePkg/VariablePolicyLib: Fix extraneous parenthesesMike Beaton2024-09-271-1/+1
| | | | | | | | | | Without this change we get: error: equality comparison with extraneous parentheses when building on XCODE5. Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
* MdeModulePkg/DxeCapsuleLibFmp: Check BootService Status to Use ESRT CacheJason1 Lin2024-09-113-31/+23
| | | | | | | | | | | | | | | | | - In c36414b131dfd0a1ca51f10f87a18955bc110ff2 change, it was introduced the ReadyToBoot event check to prevent the boot service got called in runtime to cause the issue. - In this patch introduced the ExitBootService event to replace it. It would be better to base on the BootService status to decide the source of ESRT table. - Based on the BootService availability to decide, - Exit : Use cache ESRT table in IF-condition - Not Exit: Use boot service to locate protocol in ELSE-condition Co-authored-by: Dakota Chiang <dakota.chiang@intel.com> Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
* MdeModulePkg/DxeCapsuleLibFmp: Change the Event Notify to Cache ESRT TableJason1 Lin2024-09-111-8/+52
| | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4831 In this patch introduced the below changes, [1] Add the event of system resource table installed callback. - Register the event in DxeRuntimeCapsuleLibConstructor () - Unregister the event in DxeRuntimeCapsuleLibDestructor () [2] Migrate the event to update the module variable to cache ESRT table from ReadyToBoot to system resource table installed. [3] Add the condition to free the pool of buffer when the "mEsrtTable" is not NULL. Co-authored-by: Dakota Chiang <dakota.chiang@intel.com> Signed-off-by: Jason1 Lin <jason1.lin@intel.com>
* MdeModulePkg: UefiBootManagerLib: Update assert conditionKen Lautner2024-09-051-0/+6
| | | | | | | | | | In BmFindBootOptionInVariable() we prevent passing a NULL pointer to EfiBootManagerFindLoadOption(). However, it can accept a NULL pointer as the second argument as long as count is zero. This change updates the assert condtion to only assert if the pointer is NULL and the count is non-zero. Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
* MdeModulePkg: Add VarCheckHiiLibStandaloneMm.xieyuanh2024-09-023-0/+214
| | | | | | | | | | | | | | | | | | This library is designed for handling variable HII checks within the Standalone MMm environment. It includes the functions dedicated to registering handlers that process information received from VarCheckHiiLibMmDependency. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Move DUMP_VAR_CHECK_HII in common filexieyuanh2024-09-022-251/+251
| | | | | | | | | | | | | | | | No functional changes. Move DUMP_VAR_CHECK_HII in common file Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Relocate VarCheckHiiInternalDumpHex, VarCheckHiiQuestionxieyuanh2024-09-022-250/+245
| | | | | | | | | | | | | | | | Move VarCheckHiiInternalDumpHex and VarCheckHiiQuestion to the common file. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Wrap SetVariableCheckHandlerHii as a common APIxieyuanh2024-09-024-78/+158
| | | | | | | | | | | | | | | | Rename SetVariableCheckHandlerHii and wrap it as a common API to facilitate the usage in the following patches. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Rename VarCheckHiiLibNullClass as VarCheckHiiLib.xieyuanh2024-09-022-4/+4
| | | | | | | | | | | | | | | No functional changes. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Modified BuildVarCheckHiiBin parameter to IN OUT.xieyuanh2024-09-021-1/+1
| | | | | | | | | | | | | | | | Change the Size parameter of BuildVarCheckHiiBin from OUT to an input-output parameter. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Add VarCheckHiiLibMmDependency library.xieyuanh2024-09-024-0/+199
| | | | | | | | | | | | | | | | | VarCheckHiiLibMmDependency retrieve data (mVarCheckHiiBin) at the end of the DXE phase, and pass the acquired data to the VarCheckHiiLibStandaloneMm through a communication protocol. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg: Relocation of mVarCheckHiiBin declarationxieyuanh2024-09-024-11/+9
| | | | | | | | | | | | | | | | Relocate the declaration of mVarCheckHiiBin to support for standalone MM modules utilizing the same mVarCheckHiiBin. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Rahul Kumar <rahul1.kumar@intel.com> Cc: Gerd Hoffmann <kraxel@redhat.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg/VariablePolicyLib: Use wildcard character constantMichael Kubacki2024-07-221-2/+2
| | | | | | | | Makes the `#` character used for comparison against wildcard characters in `CHAR16` strings to be prefixed with `L` so the character is treated as a wide character constant. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdeModulePkg/RuntimeResetSystemLib: Make global staticMichael Kubacki2024-07-121-2/+2
| | | | | | | | Makes the `mInternalRT` global static in this library instance to avoid conflicting with other code such as a global variable with the same name in MdePkg/Library/UefiRuntimeLib. Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com>
* MdeModulePkg: Add HobPrintLib instanceWei6 Xu2024-07-072-0/+503
| | | | | | | | | | | | The HobPrintLib prints all HOB info from the HOB list. The code is abstracted from UefiPayloadPkg/UefiPayloadEntry/PrintHob.c. Cc: Guo Dong <guo.dong@intel.com> Cc: Sean Rhodes <sean@starlabs.systems> Cc: James Lu <james.lu@intel.com> Cc: Gua Guo <gua.guo@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
* MdeModulePkg/VarCheckPolicyLib: Fix buffer valid check for MMJiaxin Wu2024-07-071-1/+1
| | | | | | | | | | | | | | | | For MM, the MM Handlers do not need to validate the buffer if it is the CommBuffer passed from MmCore through the MmiHandler() parameter. Return TRUE directly in this case. Fix buffer valid check for MM in this patch. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg/VarCheckPolicyLib: Update buffer valid check func nameJiaxin Wu2024-07-074-13/+19
| | | | | | | | | | | | | | | | | | | | | | | | In the MdeModulePkg/VarCheckPolicyLib, the Primary Buffer (CommBuffer) check function has been updated to match the buffer validation behavior. For SMM, the SMM Handlers is to validate the buffer outside MMRAM. For MM, the MM Handlers do not need to validate the buffer if it is the CommBuffer passed from MmCore through the MmiHandler() parameter. Return TRUE directly in this case. Existing code is incorrect for the MM check. This will be fixed in the following patch. There is no function impact. Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com> Cc: Wei6 Xu <wei6.xu@intel.com> Cc: Dun Tan <dun.tan@intel.com> Cc: Yuanhao Xie <yuanhao.xie@intel.com>
* MdeModulePkg/StandaloneMmReportStatusCodeLib: Support MM_CORE_STANDALONEJiaxin Wu2024-07-051-1/+1
| | | | | | Support the module type for MM_CORE_STANDALONE Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
* MdeModulePkg/ImagePropertiesRecordLib: Reduce debug levelNhi Pham2024-06-261-1/+1
| | | | | | | | | | | The presense of PdbPointer (PDB file name) is not an error. Hence, the debug message should be categorized as VERBOSE or INFO. However, the DEBUG_VERBOSE is more appropriate since the PDB file name is already output by the PeCoffLoaderRelocateImageExtraAction() function with the inline "add-symbol-file" when a platform uses the library instance DebugPeCoffExtraActionLib. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* MdeModulePkg/DxeCapsuleLibFmp: Fix compilation errorNhi Pham2024-06-192-2/+2
| | | | | | | | | | | | | | The commit "MdeModulePkg/DxeCapsuleLibFmp: Fix crash if no ESRT is found" leads to a compilation error in MdeModulePkg/Library/DxeCapsuleLibFmp/DxeCapsuleLib.inf. The issue occurs because the variable mDxeCapsuleLibReadyToBootEvent which is declared as extern does not exist, while it is defined in DxeCapsuleRuntime.c, a file not included in DxeCapsuleLib.inf. This patch is to fix this by moving the variable defintion to DxeCapsuleLib.c and declare it as extern in DxeCapsuleRuntime.c. Reported-by: Gua Guo <gua.guo@intel.com> Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* MdeModulePkg/DxeCapsuleLibFmp: Fix crash if no ESRT is foundNhi Pham2024-06-072-0/+17
| | | | | | | | | | | | The ESRT table is not required in UEFI firmware. In such cases, the table may not be present in the UEFI Configuration Table. The mEsrtTable is to check if the IsNestedFmpCapsule() function is invoked at runtime to determine whether to use gEsrtManagementProtocolGuid or the ESRT table from the Configuration Table. Unfortunately, the check does not cover situations where the ESRT is not present, potentially resulting in a kernel crash. This patch is intended to fix this issue. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com>
* MdeModulePkg:BaseSpiHcPlatformLib: Adding NULL lib instanceBrit Chesley2024-05-083-0/+189
| | | | | | | | | | | | | | | | | | Adding NULL SpiHcPlatformLib instance. This library is responsible for handling the low level details of the SPI host controller. Since this is platform specific this library will be dependent on OEM SPI implementation. The SPI host controller layer will utilize this library for SPI bus transactions. Bugzilla #4753 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Cc: Abner Chang <abner.chang@amd.com> Cc: Abdul Lateef Attar <AbdulLateef.Attar@amd.com> Signed-off-by: Brit Chesley <brit.chesley@amd.com> Acked-by: Abner Chang <abner.chang@amd.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: ImagePropertiesRecordLib: Consolidate UsageOliver Smith-Denny2024-03-291-19/+63
| | | | | | | | | | | | | | | Currently, there are multiple instances of code create image records. ImagePropertiesRecordLib was created to only have this code in one place. Update the lib to use additional logic from the copy in MemoryProtection.c before converging that code to use the lib. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Taylor Beebe <taylor.d.beebe@gmail.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdeModulePkg: ImagePropertiesRecordLib: Use SectionAlignment for CodeSizeOliver Smith-Denny2024-03-291-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When an ImageRecord is stored by ImagePropertiesRecordLib, it reports the CodeSegmentSize as the SizeOfRawData from the image. However, the image as loaded into memory is aligned to the SectionAlignment, so SizeOfRawData is under the actual size in memory. This is important, because the memory attributes table uses these image records to create its entries and it will report that the alignment of an image is incorrect, even though the actual image is correct. This was discovered on ARM64, which has a 64k runtime page granularity alignment, which is backed by a 64k section alignment for DXE_RUNTIME_DRIVERs. The runtime code and data was correctly being loaded into memory, however the memory attribute table was incorrectly reporting misaligned ranges to the OS, causing attributes to be ignored for these sections for OSes using greater than 4k pages. This patch correctly aligns the CodeSegmentSize to the SectionAlignment and the corresponding memory attribute table entries are now correctly aligned and pointing to the right places in memory. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Leif Lindholm <quic_llindhol@quicinc.com> Cc: Ard Biesheuvel <ardb+tianocore@kernel.org> Cc: Sami Mujawar <sami.mujawar@arm.com> Cc: Taylor Beebe <taylor.d.beebe@gmail.com> Acked-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Marvin H?user <mhaeuser@posteo.de> Signed-off-by: Oliver Smith-Denny <osde@linux.microsoft.com>
* MdeModulePkg/TraceHubDebugSysTLib: Use wider type for loop comparisonsMichael Kubacki2024-02-263-4/+4
| | | | | | | | | | | | | | | | | | | | | | Resolves a new CodeQL error due to the value being incremented in the loop being a narrower type than the variable it is being compared against. The variable is changed to a UINT32 type so it has the same width as the type it is being compared against. Issue explanation: In a loop condition, comparison of a value of a narrow type with a value of a wide type may result in unexpected behavior if the wider value is sufficiently large (or small). This is because the narrower value may overflow. This can lead to an infinite loop. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Gua Guo <gua.guo@intel.com> Cc: Prakashan Krishnadas Veliyathuparambil <krishnadas.veliyathuparambil.prakashan@intel.com> Cc: K N Karthik <karthik.k.n@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Gua Guo <gua.guo@intel.com>
* MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or notJiaxin Wu2023-12-261-0/+12
| | | | | | | | | | | This patch is to use the Context to indicate SMM Debug Agent support or not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must point to a BOOLEAN if it's not NULL. Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com> Reviewed-by: Ray Ni <ray.ni@Intel.com>
* MdeModulePkg/UefiBootManagerLib: Signal ReadyToBoot on platform recoveryNeal Gompa2023-12-191-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, the ReadyToBoot event is only signaled when a formal Boot Manager option is executed (in BmBoot.c -> EfiBootManagerBoot ()). However, the introduction of Platform Recovery in UEFI 2.5 makes it necessary to signal ReadyToBoot when a Platform Recovery boot loader runs because otherwise it may lead to the execution of a boot loader that has similar requirements to a regular one that is not launched as a Boot Manager option. This is especially critical to ensuring that the graphical console is actually usable during platform recovery, as some platforms do rely on the ConsolePrefDxe driver, which only performs console initialization after ReadyToBoot is triggered. This patch fixes that behavior by calling EfiSignalEventReadyToBoot () in EfiBootManagerProcessLoadOption () when invoking platform recovery, which is the function that sets up the platform recovery boot process. The expected behavior has been clarified in the UEFI 2.10 specification to explicitly indicate this behavior is required for correct operation. This is a rebased version of the patch originally written by Pete Batard. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2831 Co-authored-by: Pete Batard <pete@akeo.ie> Signed-off-by: Neal Gompa <ngompa@fedoraproject.org> Reviewed-by: Jeremy Linton <jeremy.linton@arm.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Leif Lindholm <quic_llindhol@quicinc.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/DxeCapsuleLibFmp: Fix crash with VirtualAddressMap omittedNhi Pham2023-11-282-12/+7
| | | | | | | | | | | | | If the SetVirtualAddressMap() is not called, mIsVirtualAddrConverted is FALSE and the kernel crash occurs in IsNestedFmpCapsule() when executing gBS->LocateProtocol () in the else case. To serve the omitted SetVirtualAddressMap() call, we could just check mEsrtTable presence instead of relying on mIsVirtualAddrConverted. Signed-off-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>