summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS versionHoraceX Lien2023-09-261-8/+12
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4544 These value of Major/Minor version are updated from SMBIOS memory data, but BCD Revision is updated from PCD PcdSmbiosVersion. We should also update BCD Revision from SMBIOS memory data, to ensure that get consistent version value. Cc: Zhiguang Liu <zhiguang.liu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: HoraceX Lien <horacex.lien@intel.com>
* MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool sizeMike Beaton2023-09-111-1/+1
| | | | | | | | | | | | | | | | | | The immediately preceding call, GetBestLanguage, plus the implementation of HiiGetString, which is called immediately afterwards, make it clear that BestLanguage is a null-terminated ASCII string, and not just a five byte, non-null terminated buffer. Therefore AsciiStrLen is one byte too short, meaning that whether the space allocated is really sufficient and whether the resultant string is really null-terminated becomes implementation-dependent. Rather than switching to AsciiStrSize, we use an explicitly compile-time string length calculation (both compile-time and run-time approaches are currently used elsewhere in the codebase for copying static strings). Signed-off-by: Mike Beaton <mjsbeaton@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStoreDandan Bi2023-08-031-22/+32
| | | | | | | | | | | | | | For EfiVarStore (EFI_HII_VARSTORE_EFI_VARIABLE_BUFFER), it will call ExtractConfig-GetVariable-HiiBlockToConfig-ConfigToBlock when load storage value in LoadStorage function. It's not necessary and costs lots of time to do the conversion between config and block. So now enhance it to call GetVariable directly. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Eric Dong <eric.dong@intel.com>
* MdeModulePkg/Variable: TcgMorLockSmm Key Mismatch changes lock stateAbhi Singh2023-07-101-0/+5
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4410 Inside TcgMorLockSmm.c, the SetVariableCheckHandlerMorLock() function contains a scenario to prevent a possible dictionary attack on the MorLock Key in accordance with the TCG Platform Reset Mitigation Spec v1.10. The mechanism to prevent this attack must also change the MorLock Variable Value to 0x01 to indicate Locked Without Key. ASSERT_EFI_ERROR is added for error visibility since SetMorLockVariable returns a status code Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Abhi Singh <Abhi.Singh@arm.com> Acked-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Variable: Introduce MM based variable read service in PEIKun Qin2023-06-283-0/+555
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4464 This change introduced the Standalone MM based variable read capability in PEI phase for applicable platforms (such as ARM platforms). Similar to the x86 counterpart, MM communicate PPI is used to request variable information from Standalone MM environment. Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Co-authored-by: Ronny Hansen <hansen.ronny@microsoft.com> Co-authored-by: Shriram Masanamuthu Chinnathurai <shriramma@microsoft.com> Co-authored-by: Preshit Harlikar <pharlikar@microsoft.com> Signed-off-by: Kun Qin <kuqin@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/RegularExpressionDxe: Fix Arm build errorNickle Wang2023-04-282-4/+11
| | | | | | | | | | | | | | | | | | | | | | | Arm CI build error: - ArmPkg/Library/CompilerIntrinsicsLib/memset.c:39:1: warning: type of ‘memset’ does not match original declaration [-Wlto-type-mismatch] MdeModulePkg/Universal/RegularExpressionDxe/OnigurumaUefiPort.c:123:1: note: type ‘char’ should match type ‘int’ - multiple definition of `memcpy'; OnigurumaUefiPort.obj (symbol from plugin):(.text+0x0): first defined here Fix: - Update memset() implementation to match memset() definition in ArmPkg/Library/CompilerIntrinsicsLib. - memcpy() is supported by ArmPkg/Library/CompilerIntrinsicsLib. Exclude it in OnigurumaUefiPort.c. Signed-off-by: Nickle Wang <nicklew@nvidia.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Nick Ramirez <nramirez@nvidia.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/RegularExpressionDxe: Fix GCC build errordevel@edk2.groups.io2023-04-131-4/+3
| | | | | | | | | | | Fix GCC build error on AARCH64 system. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Nick Ramirez <nramirez@nvidia.com> Signed-off-by: Nickle Wang <nicklew@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg: Update code to be more C11 compliant by using __func__Rebecca Cran2023-04-1014-40/+40
| | | | | | | | | | | | __FUNCTION__ is a pre-standard extension that gcc and Visual C++ among others support, while __func__ was standardized in C99. Since it's more standard, replace __FUNCTION__ with __func__ throughout MdeModulePkg. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* MdeModulePkg: HOST_APPLICATION IA32/X64 onlyMichael D Kinney2023-04-101-1/+1
| | | | | | | | | | | | | | Update MdeModulePkg host-based unit test INF files to only list VALID_ARCHITECTURES of IA32 and X64 to align with all other host-based unit test INF files. The UnitTestFrameworkPkg only provides build support of host-based unit tests to OS applications for IA32 and X64. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Oliver Smith-Denny <osde@linux.microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Fix conditionally uninitialized variablesMichael Kubacki2023-04-034-26/+34
| | | | | | | | | | | | | | | | | | | Fixes CodeQL alerts for CWE-457: https://cwe.mitre.org/data/definitions/457.html Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Cc: Erich McMillan <emcmillan@microsoft.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Co-authored-by: Erich McMillan <emcmillan@microsoft.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
* MdeModulePkg/SmbiosDxe: Fix pointer and buffer overflow CodeQL alertsErich McMillan2023-04-031-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Details for these CodeQL alerts can be found here: - Pointer overflow check (cpp/pointer-overflow-check): - https://cwe.mitre.org/data/definitions/758.html - Potential buffer overflow check (cpp/potential-buffer-overflow): - https://cwe.mitre.org/data/definitions/676.html CodeQL alert: - Line 1612 in MdeModulePkg/Universal/SmbiosDxe/SmbiosDxe.c - Type: Pointer overflow check - Severity: Low - Problem: Range check relying on pointer overflow Cc: Dandan Bi <dandan.bi@intel.com> Cc: Erich McMillan <emcmillan@microsoft.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael Kubacki <mikuback@linux.microsoft.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Erich McMillan <emcmillan@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Oliver Smith-Denny <osd@smith-denny.com>
* MdeModulePkg: Consume new alignment-related macrosMarvin Häuser2023-04-012-20/+19
| | | | | | | | | | | | | | This patch substitutes the macros that were renamed in the first patch with the new, shared alignment macros. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg: Rename IS_ALIGNED macros to avoid name collisionsMarvin Häuser2023-04-012-20/+20
| | | | | | | | | | | | | | | | This patch is a preparation for the patches that follow. The subsequent patches will introduce and integrate new alignment-related macros, which collide with existing definitions in MdeModulePkg. Temporarily rename them to avoid build failure, till they can be substituted with the new, shared definitions. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Marvin Häuser <mhaeuser@posteo.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg/Variable: Attribute combination should return EFI_UNSUPPORTEDStuart Yoder2023-02-151-1/+5
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4341 Commit 21320ef66989 broke some tests in the AuthVar_Conf test in edk2-test. There are 2 testcases that invoke SetVariable with the following attribute value: (EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS) EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS is deprecated and the UEFI spec says this should return EFI_UNSUPPORTED. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Sunny Wang <Sunny.Wang@arm.com> Signed-off-by: Stuart Yoder <stuart.yoder@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sunny Wang <sunny.wang@arm.com>
* MdeModulePkg/EsrtFmpDxe: Support multiple devices with 0 HardwareInstancedevel@edk2.groups.io2023-02-151-9/+13
| | | | | | | | | | | | | | Skip error check if HardwareInstance is 0 as this either means that FmpVersion < 3 and not supported or, "A zero means the FMP provider is not able to determine a unique hardware instance number or a hardware instance number is not needed." per UEFI specification. As the FmpInstances are merged and HardwareInstance is not used remove error check in this case. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg: remove garbage pixels in LaffStd glyphsdevel@edk2.groups.io2023-01-201-5/+5
| | | | | Signed-off-by: Jan Engelhardt <jengelh@inai.de> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg: Supporting S3 in 64bit PEIKuo, Ted2022-12-193-13/+22
| | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=4195 Transfer from DXE to OS waking vector by calling SwitchStack() when both are in the same execution mode. Reviewed-by: Ray Ni <ray.ni@intel.com> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Chasel Chiu <chasel.chiu@intel.com> Cc: Nate DeSimone <nathaniel.l.desimone@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Ashraf Ali S <ashraf.ali.s@intel.com> Cc: Chinni B Duggapu <chinni.b.duggapu@intel.com> Signed-off-by: Ted Kuo <ted.kuo@intel.com>
* MdeModulePkg/CapsuleRuntimeDxe: Add LoongArch64 architecture.Chao Li2022-10-141-4/+5
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053 Add LoongArch in INF for building CapsuleRuntimeDxe LoongArch64 image. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Guomin Jiang <guomin.jiang@intel.com> Signed-off-by: Chao Li <lichao@loongson.cn> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
* MdeModulePkg SmbiosMeasurementDxe: Add Type4 CurrentSpeed to filter tableHeng Luo2022-09-141-1/+2
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4051 The Type4 CurrentSpeed field may be various. So this patch adds it into the filter table. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Heng Luo <heng.luo@intel.com> Reviewed-by: Jiewen Yao <Jiewen.yao@intel.com> Reviewed-by: James Lu <james.lu@intel.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* MdeModulePkg: Fix imbalanced debug macrosMichael Kubacki2022-09-091-1/+1
| | | | | | | | | | | | | | | | | | | Updates debug macros in the package that have an imbalanced number of print specifiers to arguments. These changes try to preserve what was likely intended by the author. In cases information was missing due to the bug, the specifier may be removed since it was not previously accurately printing the expected value. Cc: Dandan Bi <dandan.bi@intel.com> Cc: Guomin Jiang <guomin.jiang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Update the SMBIOS version by UPLKasimX Liu2022-08-152-8/+34
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4013 For the SMBIOS version can be update by UPL,we create the gUniversalPayloadSmbios3TableGuid HOB to store the value then updated version. Cc: Guo Dong <guo.dong@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: James Lu <james.lu@intel.com> Reviewed-by: Gua Guo <gua.guo@intel.com> Signed-off-by: KasimX Liu <kasimx.liu@intel.com>
* MdeModulePkg/SetupBrowserDxe:Follow spec'd way to reconnect driverWalon Li2022-07-222-9/+4
| | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3952 In UEFI spec, it defines reconnect timing that will be activated upon exiting of the formset or the browser. However, we did't use this kind of way to check reconnect conditioncode. Code only blocks reconnect if page is updated dynamically. That's not matched spec'd way. We should check current formset whether is exiting, then reconnect driver. Signed-off-by: Walon Li <walon.li@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/FaultTolerantWrite: Consume Variable Flash InfoMichael Kubacki2022-05-198-60/+63
| | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Adds support to the UEFI variable fault tolerant write (FTW) drivers to receive FTW base and size information dynamically via the Variable Flash Information library. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg/Variable: Consume Variable Flash InfoMichael Kubacki2022-05-1910-34/+56
| | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479 Updates VariableRuntimeDxe, VariableSmm, and VariableStandaloneMm to acquire variable flash information from the Variable Flash Information library. Note: This introduces a dependency on VariableFlashInfoLib in these modules. Therefore, a platform building the variable modules must specify an instance of VariableFlashInfoLib in their platform build. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Acked-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>
* MdeModulePkg/PCD: Pcd initialize DXE have assertGua Guo2022-05-091-0/+5
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3917 When PlatformPkg.dsc has multiple SKU IDs but didn't exist delta PCD, System will hang on BuildPcdDxeDataBase. Ideally, if didn't exist delta PCD by different SKU ID, UpdatePcdDatabase () shouldn't return EFI_NOT_FOUND. Signed-off-by: Gua Guo <gua.guo@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/GraphicsConsoleDxe: add modesGerd Hoffmann2022-04-221-1/+4
| | | | | | | | | | | | | | Add modes for a few common display resolutions higher than 800x600, specifically 1024x768, 1280x800 and 1920x1080, so ConSplitterDxe has more options available. The mode list is not use as-is, InitializeGraphicsConsoleTextMode() will check the list and filter out any modes which don't fit to the screen, so this will also work fine for small displays. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Ard Biesheuvel <ardb@kernel.org>
* MdeModulePkg/HiiDatabase: Fix Setup numeric default value incorrect issueChen, Lin Z2022-04-082-0/+47
| | | | | | | | | | | | When default/manufacturing flag get removed from numeric varid, it can't get default value from StructurePcd in 'UpdateDefaultSettingInFormPackage' function since there is no EFI_IFR_DEFAULT_OP opcode in IFR file. Add a chance to get numeric default value from StructurePcd in the case that numeric minimum value will be used as default value. Signed-off-by: Chen Lin Z <lin.z.chen@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/GraphicsConsoleDxe: Check status to make sure no errorGuomin Jiang2022-03-031-2/+2
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2668 SetMode will fail in some case. for example, without XServer. Should handle these case when SetMode fail. If we don't handle it, it will Segmentation fault. Reviewed-by: Ray Ni <ray.ni@intel.com> Signed-off-by: Guomin Jiang <guomin.jiang@intel.com>
* MdeModulePkg: Replace Opcode with the corresponding instructions.Jason2022-03-012-35/+6
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3790 Replace Opcode with the corresponding instructions. The code changes have been verified with CompareBuild.py tool, which can be used to compare the results of two different EDK II builds to determine if they generate the same binaries. (tool link: https://github.com/mdkinney/edk2/tree/sandbox/CompareBuild) Signed-off-by: Jason Lou <yun.lou@intel.com> Reviewed-by: Ray Ni <ray.ni@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: VariableSmmRuntimeDxe: Fix Variable Policy Message LengthKun Qin2022-01-271-5/+5
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3709 In EDKII implementation of variable policy, the DXE runtime agent would communicate to MM to disable, register or query policies. However, these operations populate the value of MessageLength that includes communicate header to include MM communicate header, which mismatches with the description of PI specification. This fix will correct the MessageLength field calculation to exclude the size of MM_COMMUNICATE_HEADER. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Kun Qin <kuqin12@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Variable: Make only EFI_VARIABLE_NON_VOLATILE invalidSunny Wang2022-01-211-1/+15
| | | | | | | | | | | | | | | | | | | | | | Only EFI_VARIABLE_NON_VOLATILE attribute is an invalid combination of attribute bits, so update the variable driver to return EFI_INVALID_PARAMETER so that we can prevent the invalid variable being created. This change also fixes the SCT failure below: - RT.QueryVariableInfo - With being an invalid combination -- FAILURE For details, please check the threads below: - https://edk2.groups.io/g/devel/topic/86486174 - https://edk2.groups.io/g/devel/message/82466 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Heinrich Schuchardt <heinrich.schuchardt@canonical.com> Cc: G Edhaya Chandran <edhaya.chandran@arm.com> Cc: Samer El-Haj-Mahmoud <samer.el-haj-mahmoud@arm.com> Signed-off-by: Sunny Wang <sunny.wang@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/PartitionDxe: Add break to handle invalid LBA0 in MBREdwards, Craig2022-01-101-0/+7
| | | | | | | | | | | | | | | | | | | | Read Disk does a modification of ExtMbrStartingLba with the code MultU64x32 (ExtMbrStartingLba, BlockSize) Error detection to see if ExtMbrStartingLBA has a value of 0. This is invalid as LBA 0 = MBR. After modification, the next time ExtMbrStartingLba is in this function if ExtMbrStartingLba is set to 0 in the MBR it never passes the while/do evaluation It is multiplied by 0 by read disk , set to 0 by an invalid MBR and goes back to evaluation This condition will also cause Ws19 and WS22 to hang, however Microsoft has developed a hotfix patch that will be released in 2022 Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Craig Edwards <craig.edwards@dell.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Apply uncrustify changesMichael Kubacki2021-12-07283-38181/+40978
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737 Apply uncrustify changes to .c/.h files in the MdeModulePkg package Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()Michael D Kinney2021-12-079-22/+20
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3767 Update use of DEBUG_CODE(Expression) if Expression is a complex code block with if/while/for/case statements that use {}. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Change OPTIONAL keyword usage styleMichael D Kinney2021-12-0727-93/+84
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760 Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Change use of EFI_D_* to DEBUG_*Michael D Kinney2021-12-0743-334/+321
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3739 Update all use of EFI_D_* defines in DEBUG() macros to DEBUG_* defines. Cc: Andrew Fish <afish@apple.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael Kubacki <michael.kubacki@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/FPDT: Lock boot performance table address variable at EndOfDxeedk2-stable202111-rc1Dandan Bi2021-11-128-225/+88
| | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2957 1. Allocate performance data table at EndOfDxe and then lock the varible which store the table address at EndOfDxe. 2. Enlarge PCD gEfiMdeModulePkgTokenSpaceGuid.PcdExtFpdtBootRecordPadSize from 0x20000 to 0x30000 in order to hold the Delta performance data between EndOfDxe and ReadyToBoot. 3. SMM performance data is collected by DXE modules through SMM communication at ReadyToBoot before. Now to do SMM communication twice, one for allocating the performance size at EndOfDxe, another is at ReadyToBoot to get SMM performance data. 4. Make SmmCorePerformanceLib rather than FirmwarePerformanceSmm to communicate with DxeCorePerformanceLib for SMM performance data and size. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Signed-off-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/Variable/RuntimeDxeUnitTest: Fix 32-bit GCC buildsMichael D Kinney2021-11-051-3/+3
| | | | | | | | | | | | | | | | When using will_return() on a pointer value, it must be cast to UINTN to be compatible with 32-bit GCC builds. This uses the same approach in samples provided in the UnitTestFramworkPkg when passing pointer values to UT_ASSERT_EQUAL(). Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com> Reviewed-by: Bret Barkelew <bret.barkelew@microsoft.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg: Fix typo of "memory" in RamDiskDxe debug messageRebecca Cran2021-09-031-1/+1
| | | | | | | | Fix a typo of "memory" in a debug message in RamDiskProtocol.c. Signed-off-by: Rebecca Cran <rebecca@bsdio.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* MdeModulePkg/HiiDatabaseDxe:remove dead code blockWenyi Xie2021-09-021-3/+0
| | | | | | | | | | | | | As the if statement outside has confirmed that BlockData->Name == NULL, so the if statement inside is always false. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Eric Dong <eric.dong@intel.com> Signed-off-by: Wenyi Xie <xiewenyi2@huawei.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com>
* MdeModulePkg/EbcDxe: Mitigate memcpy intrinsicsMarvin H?user2021-08-303-3/+15
| | | | | | | | | | | | Assignments of structure values cause the emission of memcpy() intrinsics by the CLANG38 toolchain. Substitute the assignments with calls to CopyMem() to mitigate the issue. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Vitaly Cheptsov <vit9696@protonmail.com> Signed-off-by: Marvin H?user <mhaeuser@posteo.de> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg PCD: Reinstall PCD service PPIS when memory availableedk2-stable202108-rc1Yeh, GregX2021-08-131-1/+70
| | | | | | | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=3525 After PciSegmentLib using Dynamic PCD for Pcie base address such long delay found in FSP. The root cause is some of the PCD service PPIs not shadowed to memory and flash cache may have been disabled in NotifyPhase stage. Solution is to shadow all PCD service PPIs to memory. Signed-off-by: GregX Yeh <gregx.yeh@intel.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
* MdeModulePkg PCD: Print which PCD was unable to be foundDaniel Schaefer2021-07-211-1/+2
| | | | | | | | | | | | When reaching the assert, it can't be debugged because the PCD is unknown. Therefore the PCD's GUID and token number should be printed. Signed-off-by: Daniel Schaefer <daniel.schaefer@hpe.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/RamDiskDxe: Init list head before registering RamDisk protocolTrammell Hudson2021-07-141-5/+6
| | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3483 This patch initializes the linked list RegisteredRamDisks in RamDiskDxeEntryPoint before the registration of gEfiRamDiskProtocolGuid with InstallMultipleProtocolInterfaces, allowing ramdisks to be created via a callback installed with RegisterProtocolNotify as soon as the protocol is registered. Without this, calling RamDisk->Register() in the callback causes a crash: ASSERT [RamDiskDxe] MdePkg/Library/BaseLib/LinkedList.c(75): List->ForwardLink != ((void *) 0) Signed-off-by: Trammell Hudson <hudson@trmm.net> Cc: Daniel Schaefer <daniel.schaefer@hpe.com> Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/RegularExpressionDxe: Fix memory assert in FreePool()Nickle Wang2021-07-072-13/+20
| | | | | | | | | | | Memory buffer that is allocated by malloc() and realloc() will be shifted by 8 bytes because Oniguruma keeps its memory signature. This 8 bytes shift is not handled while calling free() to release memory. Add free() function to check Oniguruma signature before release memory because memory buffer is not touched when using calloc(). Signed-off-by: Nickle Wang <nickle.wang@hpe.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/PartitionDxe: Ignore PMBR BootIndicator per UEFI specNeal Gompa2021-07-061-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Per UEFI Spec 2.8 (UEFI_Spec_2_8_final.pdf, page 114) 5.2.3 Protective MBR Table 20. Protective MBR Partition Record protecting the entire disk The description for BootIndicator states the following: > Set to 0x00 to indicate a non-bootable partition. If set to any > value other than 0x00 the behavior of this flag on non-UEFI > systems is undefined. Must be ignored by UEFI implementations. Unfortunately, we have been incorrectly assuming that the BootIndicator value must be 0x00, which leads to problems when the 'pmbr_boot' flag is set on a disk containing a GPT (such as with GNU parted). When the flag is set, the value changes to 0x01, causing this check to fail and the system is rendered unbootable despite it being valid from the perspective of the UEFI spec. To resolve this, we drop the check for the BootIndicator so that we stop caring about the value set there, which restores the capability to boot such disks. Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3474 Cc: Chris Murphy <chrismurphy@fedoraproject.org> Cc: David Duncan <davdunc@amazon.com> Cc: Lazlo Ersek <lersek@redhat.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Signed-off-by: Neal Gompa <ngompa@fedoraproject.org> Message-Id: <20210705093603.575707-1-ngompa@fedoraproject.org> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com>
* MdeModulePkg/BdsDxe: Update BdsEntry to use Variable PolicyKen Lautner2021-06-223-7/+17
| | | | | | | | | | | | | | Changed BdsEntry.c to use Variable Policy instead of Variable Lock as Variable Lock will be Deprecated eventually Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/ACPI: Install ACPI table from HOB.Zhiguang Liu2021-06-164-38/+271
| | | | | | | | | | | | | | | | | | | | If HOB contains APCI table information, entry point of AcpiTableDxe.inf should parse the APCI table from HOB, and install these tables. We assume the whole ACPI table (starting with EFI_ACPI_2_0_ROOT_SYSTEM_DESCRIPTION_POINTER) is contained by a single gEfiAcpiTableGuid HOB. If error happens when installing ACPI table, stop installing and removing all the tables that are already added. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Ray Ni <ray.ni@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg/Universal/SmbiosDxe: Scan for existing tablesZhiguang Liu2021-06-163-3/+360
| | | | | | | | | | | | | | | | | | | | | | The default EfiSmbiosProtocol operates on an empty SMBIOS table. The SMBIOS tables are provided by the bootloader on UefiPayloadPkg. Scan for existing tables in SmbiosDxe and load them if they seem valid. This fixes the settings menu not showing any hardware information, instead only "0 MB RAM" was displayed. Tests showed that the OS can still see the SMBIOS tables. SmbiosDxe will get the SMBIOS from a guid Hob. Also will keep the SmbiosHandle if it is available. Cc: Jian J Wang <jian.j.wang@intel.com> Cc: Hao A Wu <hao.a.wu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Star Zeng <star.zeng@intel.com> Cc: Zhichao Gao <zhichao.gao@intel.com> Reviewed-by: Hao A Wu <hao.a.wu@intel.com> Tested-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Patrick Rudolph <patrick.rudolph@9elements.com> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdePkg/MdeModulePkg: Move AML_NAME_SEG_SIZE definitionPierre Gondois2021-06-021-1/+0
| | | | | | | | | | | | | | | | | | | | A NameSeg is made 4 chars. Cf. ACPI 6.4 s20.2.2 "Name Objects Encoding": NameSeg := <leadnamechar namechar namechar namechar> Notice that NameSegs shorter than 4 characters are filled with trailing underscores (‘_’s). AML_NAME_SEG_SIZE is currently defined in: - DynamicTablesPkg/Library/Common/AmlLib/AmlDefines.h - MdeModulePkg/Universal/Acpi/AcpiTableDxe/AcpiSdt.h Since the value can be inferred from the ACPI specification and to avoid multiple definitions, move it to MdePkg/Include/IndustryStandard/ Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Star Zeng <star.zeng@intel.com> Reviewed-by: Sami Mujawar <sami.mujawar@arm.com>