summaryrefslogtreecommitdiffstats
path: root/MdeModulePkg/Universal
Commit message (Collapse)AuthorAgeFilesLines
* MdeModulePkg: In RemoveTableFromRsdt don't read from unallocated memoryRebecca Cran6 days1-4/+4
| | | | | | | Instead of copying from unallocated memory in RemoveTableFromRsdt, do a CopyMem followed by ZeroMem. Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
* MdeModulePkg: Warn if out of flash space when writing variablesOliver Steffen6 days1-0/+2
| | | | | | | | | | | | Emit a DEBUG_WARN message if there is not enough flash space left to write/update a variable. This condition is currently not logged appropriately in all cases, given that full variable store can easily render the system unbootable. This new message helps identifying this condition. Signed-off-by: Oliver Steffen <osteffen@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
* MdeModulePkg/HiiDatabaseDxe: Remove assert for VarStoreId = 0Jeff Brasen7 days1-2/+3
| | | | | | | | | | | | | | It is legal for the VarStoreId of a question to be 0 per the UEFI spec: "Specifies the identifier of a previously declared variable store to use when storing the question’s value. A value of zero indicates no associated variable store." Instead of hitting an assert just skip this question as there is no value to return. Signed-off-by: Jeff Brasen <jbrasen@nvidia.com>
* MdeModulePkg/HiiDatabaseDxe: Avoid struct assignmentArd Biesheuvel8 days1-4/+5
| | | | | | | | | | | | Struct assignments are not permitted in EDK2, as they may be converted by the compiler into calls to the 'memcpy' intrinsic, which is not guaranteed to be available in EDK2. So replace the assignment with a call to CopyMem (), and -while at it- replace the loop with a single CopyMem () call, as the loop operates on items that are contiguous in memory. Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
* MdeModulePkg: Potential UINT32 overflow in S3 ResumeCountShanmugavel Pakkirisamy2024-05-171-4/+8
| | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4677 Attacker able to modify physical memory and ResumeCount. System will crash/DoS when ResumeCount reaches its MAX_UINT32. Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Pakkirisamy ShanmugavelX <shanmugavelx.pakkirisamy@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/Variable: Add TCG SPDM device measurement updateWenxing Hou2024-04-303-6/+38
| | | | | | | | | Add EV_EFI_SPDM_DEVICE_POLICY support for MeasureVariable. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Jiewen Yao <jiewen.yao@intel.com> Signed-off-by: Wenxing Hou <wenxing.hou@intel.com> Reviewed-by: Jiewen Yao <jiewen.yao@intel.com>
* MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tablesDhaval2024-04-111-7/+17
| | | | | | | | | | | | | | | | | As per ACPI Spec 6.5+ Table 5-9 if xDSDT is available, it should be used first. Handle required flow when xDSDT is absent or present. Test: Tested on RISCV64 Qemu platform with xDSDT and booted to linux kernel. Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Pedro Falcato <pedro.falcato@gmail.com> Signed-off-by: Dhaval Sharma <dhaval@rivosinc.com> Acked-by: Chasel Chiu <chasel.chiu@...> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memoryAaron Li2024-04-092-8/+30
| | | | | | | | | | | | | | | | | | | | | | UEFI spec defined ACPI Tables at boot time can be contained in memory of type EfiACPIReclaimMemory or EfiAcpiMemoryNVS, although InstallAcpiTable with AcpiTableProtocol will only allocate memory with type EfiACPIReclaimMemory (Except FACS). This patch provides an optional method controlled by PCD to avoid using EfiACPIReclaimMemory, by setting the PCD PcdNoACPIReclaimMemory to TRUE, all ACPI allocated memory will use EfiAcpiMemoryNVS instead. Cc: Zhiguang Liu <zhiguang.liu@intel.com> Cc: Dandan Bi <dandan.bi@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Liu Yun <yun.y.liu@intel.com> Cc: Jiewen Yao <jiewen.yao@intel.com> Cc: Ray Ni <ray.ni@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Aaron Li <aaron.li@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Zhiguang Liu <zhiguang.liu@intel.com>
* MdeModulePkg: Update the comments of ReadKeyStroke and ReadKeyStrokeExQingyu2024-04-034-0/+20
| | | | | | | | | | | Refer to Uefi spec 2.10 section 12.3.3, Add a new retval EFI_UNSUPPORTED to EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL.ReadKeyStrokeEx and EFI_SIMPLE_TEXT_INPUT_PROTOCOL.ReadKeyStroke(). Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Qingyu <qingyu.shang@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg: Align RuntimeDxe function headers with UEFI return valuesSuqiang Ren2024-02-095-39/+156
| | | | | | | | | | | | | RuntimeDxe is used to back the runtime services time functions, so align the description of the function return values with the defined values for these services as described in UEFI Spec 2.10. REF: UEFI spec 2.10 section 8 Services ? Runtime Services Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Suqiang Ren <suqiangx.ren@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/DriverSampleDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLYMing Tan2024-01-244-0/+28
| | | | | | | | | | | | | | | | | REF: UEFI_Spec_2_10_Aug29.pdf page 1695. In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack(): If the callback function returns with the ActionRequest set to _QUESTION_APPLY, then the Forms Browser will write the current modified question value on the selected form to storage. Update the DriverSampleDxe, add a new question "Question apply test". Signed-off-by: Ming Tan <ming.tan@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/SetupBrowserDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLYMing Tan2024-01-241-0/+9
| | | | | | | | | | | | | | | | | | | REF: UEFI_Spec_2_10_Aug29.pdf page 1695. In 35.5.4 EFI_HII_CONFIG_ACCESS_PROTOCOL.CallBack(): If the callback function returns with the ActionRequest set to _QUESTION_APPLY, then the Forms Browser will write the current modified question value on the selected form to storage. Update the SetupBrowserDxe, if callback function return EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY, then call SetQuestionValue with GetSetValueWithHiiDriver to apply the change immediately. Signed-off-by: Ming Tan <ming.tan@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Dandan Bi <dandan.bi@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/ResetSystemRuntimeDxe: Print Reset DataAshish Singhal2024-01-241-0/+8
| | | | | | | | | ResetSystem runtime call allows for sending reset data that starts with a NULL terminated string. Add support to print that string on console. Signed-off-by: Ashish Singhal <ashishsingha@nvidia.com> Reviewed-by: Zhichao Gao <zhichao.gao@intel.com>
* MdeModulePkg/Variable: Merge variable header + data update into one stepGao Cheng2023-11-291-41/+4
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4597 When creating a new variable, skip marking VAR_HEADER_VALID_ONLY so that variable header + data update can be merged into one flash write. This will greatly reduce the time taken for updating a variable and thus increase performance. Removing VAR_HEADER_VALID_ONLY marking doesn't have any function impact since it's not used by current code to detect variable header + data corruption. Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Gao Cheng <gao.cheng@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/RegularExpressinoDxe: Fix clang errorJake Garver via groups.io2023-11-131-0/+1
| | | | | | | | | | Ignore old style declaration warnings in oniguruma/src/st.c. This was already ignored for MSFT, but newer versions of clang complain as well. Signed-off-by: Jake Garver <jake@nvidia.com> Reviewed-by: Nhi Pham <nhi@os.amperecomputing.com> Tested-by: Nhi Pham <nhi@os.amperecomputing.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* MdeModulePkg/VariablePolicy: Add more granular variable policy queryingMichael Kubacki2023-10-312-7/+343
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduces two new APIs to EDKII_VARIABLE_POLICY_PROTOCOL: 1. GetVariablePolicyInfo() 2. GetLockOnVariableStateVariablePolicyInfo() These allow a caller to retrieve policy information associated with a UEFI variable given the variable name and vendor GUID. GetVariablePolicyInfo() - Returns the variable policy applied to the UEFI variable. If the variable policy is applied toward an individual UEFI variable, that name can optionally be returned. GetLockOnVariableStateVariablePolicyInfo() - Returns the Lock on Variable State policy applied to the UEFI variable. If the Lock on Variable State policy is applied to a specific variable name, that name can optionally be returned. These functions can be useful for a variety of purposes such as auditing, testing, and functional flows. Also fixed some variable name typos in code touched by the changes. Cc: Dandan Bi <dandan.bi@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> Signed-off-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Message-Id: <20231030203112.736-2-mikuback@linux.microsoft.com>
* 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>