1075 Commits
Author SHA1 Message Date
Gua Guo 0f0422cedc MdeModulePkg: Add TraceHubDebugSysTLib library
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4144

This Library provides API to dump Trace Hub message.

Cc: Michael D Kinney <[email protected]>
Cc: Guo Gua <[email protected]>
Cc: Chan Laura <[email protected]>
Cc: Prakashan Krishnadas Veliyathuparambil <[email protected]>
Cc: K N Karthik <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Guo Gua <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Reviewed-by: K N Karthik <[email protected]>
Reviewed-by: Chan Laura <[email protected]>
Acked-by: Liming Gao <[email protected]>
2023-05-11 07:26:38 +00:00
Rebecca Cran 7b82da70ed MdeModulePkg: Update code to be more C11 compliant by using __func__
__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 <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Reviewed-by: Ard Biesheuvel <[email protected]>
2023-04-10 14:19:57 +00:00
Michael D Kinney b27b897369 MdeModulePkg: HOST_APPLICATION IA32/X64 only
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 <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Oliver Smith-Denny <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2023-04-10 05:59:02 +00:00
Chris Johnson 1a24843ecb MdeModulePkg/Library/UefiSortLib: Add GoogleTestLib example
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4389

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Chris Johnson <[email protected]>
Reviewed-by: Oliver Smith-Denny <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
2023-04-10 05:59:02 +00:00
Michael KubackiandErich McMillan 07251f3c6a MdeModulePkg: Fix conditionally uninitialized variables
Fixes CodeQL alerts for CWE-457:
https://cwe.mitre.org/data/definitions/457.html

Cc: Dandan Bi <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Erich McMillan <[email protected]>
Cc: Guomin Jiang <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Michael Kubacki <[email protected]>
Cc: Ray Ni <[email protected]>
Cc: Zhichao Gao <[email protected]>
Co-authored-by: Erich McMillan <[email protected]>
Signed-off-by: Michael Kubacki <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Oliver Smith-Denny <[email protected]>
2023-04-03 15:29:08 +00:00
Matt DeVillier 0e57170097 MdeModulePkg/BmBoot: Skip removable media if it is not present
Only enumerate devices that have media present.

Cc: Hao A Wu <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Zhichao Gao <[email protected]>
Cc: Ray Ni <[email protected]>
Reviewed-by: Sean Rhodes <[email protected]>
Signed-off-by: Matt DeVillier <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
2023-03-17 03:47:36 +00:00
lijun10x 77d6772708 MdeModulePkg/Library: PcdAcpiS3Enable set FALSE cause Assert
Some platforms don't support S3 with PcdAcpiS3Enable set as False.
Debug mode bios will ASSERT at this time as Follows.
ASSERT_RETURN_ERROR (Status = Out of Resources)
DXE_ASSERT!: Edk2\MdePkg\Library\BaseS3PciSegmentLib\S3PciSegmentLib.c
(61): !(((INTN)(RETURN_STATUS)(Status)) < 0)

Steps to reproduce the issue:
1.Set PcdAcpiS3Enable to FALSE.
2.Build the bios in debug mode.
3.Power on and Check the serial log.
Note: Prerequisite is that S3PciSegmentLib is Called and
the caller's code is run.

Root Cause:
S3PciSegmentLib call S3BootScriptLib controlled by PcdAcpiS3Enable.
If PcdAcpiS3Enable set as false, S3BootScriptLib will return error
status(Out of Resources).
S3PciSegmentLib will ASSERT if S3BootScriptLib return error.

Solution:
Make S3BootScriptLib return success if PcdAcpiS3Enable was disabled,
which behave as a null S3BootScriptLib instance which just return success
for no action is required to do.

Signed-off-by: JunX1 Li <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Sunny Wang <[email protected]>
Cc: Heinrich Schuchardt <[email protected]>
Cc: G Edhaya Chandran <[email protected]>
Cc: Samer El-Haj-Mahmoud <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2023-02-15 06:42:12 +00:00
Abner Chang ae55e9fca6 MdeModulePkg/IpmiCommandLib: Add NULL instance library
The NULL instance of IpmiCommandLib library under
MdeModulePkg as the default IpmiCommandLib instance
used by the modules under edk2.

Signed-off-by: Abner Chang <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Nickle Wang <[email protected]>
Cc: Igor Kulchytskyy <[email protected]>
Cc: Isaac Oram <[email protected]>
Cc: Nate DeSimone <[email protected]>
Reviewed-by: Isaac Oram <[email protected]>
Reviewed-by: Igor Kulchytskyy <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2023-01-19 03:57:32 +00:00
Jeff Brasen 5ff7d712d4 MdeModulePkg/UefiBootManagerLib: Add Disk Info support for Ufs
Add support for getting disk info from UFS devices.

Signed-off-by: Jeff Brasen <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
2022-10-06 17:38:41 +00:00
Michael Kubacki 1096a9b04b MdeModulePkg: Fix imbalanced debug macros
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 <[email protected]>
Cc: Guomin Jiang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Ray Ni <[email protected]>
Signed-off-by: Michael Kubacki <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2022-09-09 01:42:39 +00:00
Liu, Zhiguang 0f7bccf584 UefiCpuPkg: Simplify InitializeSeparateExceptionStacks
Hide the Exception implementation details in CpuExcetionHandlerLib and
caller only need to provide buffer

Cc: Eric Dong <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Cc: Rahul Kumar <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
2022-08-09 04:12:28 +00:00
Cosmo Lai 6964b5c48c MdeModulePkg/Include: Long debug string is truncated to 104 char
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3986

The EFI_STATUS_CODE_DATA_MAX_SIZE is defined as 200 in MdeModulePkg.
After reducing 96byte buffer for variable parameters it is limited to
only 104 char debug string. This is a non-necessary limitation.
This change sets EFI_STATUS_CODE_DATA_MAX_SIZE to 0x200, and moves
MAX_EXTENDED_DATA_SIZE definition to the same header file with value
of EFI_STATUS_CODE_DATA_MAX_SIZE + sizeof (EFI_STATUS_CODE_DATA)
which is used in ReportStatusCodeLib to support longer debug string.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>

Signed-off-by: Cosmo Lai <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Dandan Bi <[email protected]>
2022-07-23 03:12:49 +00:00
Ray Ni e7abb94d1f CpuException: Add InitializeSeparateExceptionStacks
Today InitializeCpuExceptionHandlersEx is called from three modules:
1. DxeCore (links to DxeCpuExceptionHandlerLib)
    DxeCore expects it initializes the IDT entries as well as
    assigning separate stacks for #DF and #PF.
2. CpuMpPei (links to PeiCpuExceptionHandlerLib)
   and CpuDxe (links to DxeCpuExceptionHandlerLib)
    It's called for each thread for only assigning separate stacks for
    #DF and #PF. The IDT entries initialization is skipped because
    caller sets InitData->X64.InitDefaultHandlers to FALSE.

Additionally, SecPeiCpuExceptionHandlerLib, SmmCpuExceptionHandlerLib
also implement such API and the behavior of the API is simply to initialize
IDT entries only.

Because it mixes the IDT entries initialization and separate stacks
assignment for certain exception handlers together, in order to know
whether the function call only initializes IDT entries, or assigns stacks,
we need to check:
1. value of InitData->X64.InitDefaultHandlers
2. library instance

This patch cleans up the code to separate the stack assignment to a new API:
InitializeSeparateExceptionStacks().

Only when caller calls the new API, the separate stacks are assigned.
With this change, the SecPei and Smm instance can return unsupported which
gives caller a very clear status.

The old API InitializeCpuExceptionHandlersEx() is removed in this patch.
Because no platform module is consuming the old API, the impact is none.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Jian J Wang <[email protected]>
2022-06-10 07:54:48 +00:00
Ray Ni 2a09527ebc CpuException: Remove InitializeCpuInterruptHandlers
InitializeCpuExceptionHandlers() expects caller allocates IDT while
InitializeCpuInterruptHandlers() allocates 256 IDT entries itself.

InitializeCpuExceptionHandlers() fills max 32 IDT entries allocated
by caller. If caller allocates 10 entries, the API just fills 10 IDT
entries.

The inconsistency between the two APIs makes code hard to
unerstand and hard to share.

Because there is only one caller (CpuDxe) for
InitializeCpuInterruptHandler(), this patch updates CpuDxe driver
to allocates 256 IDT entries then call
InitializeCpuExceptionHandlers().

This is also a backward compatible change.

With this change, InitializeCpuInterruptHandlers() is removed
completely.

And InitializeCpuExceptionHandlers() fills max 32 entries for PEI
and SMM instance, max 256 entries for DXE instance.
Such behavior matches to the original one.

Signed-off-by: Ray Ni <[email protected]>
Cc: Eric Dong <[email protected]>
2022-06-10 07:54:48 +00:00
Michael Kubacki 60b519456c MdeModulePkg/VariableFlashInfoLib: Add initial library
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3479

Adds a new library class VariableFlashInfoLib that abstracts access
to variable flash information. The instance provided first attempts
to retrieve information from the Variable Flash Info HOB. If that
HOB is not present, it falls back to the PCDs defined in
MdeModulePkg.

This fall back behavior provides backward compatibility for platforms
that only provide PCDs but also allows platforms that need to
dynamically provide the information using the Variable Flash Info HOB
to do so at runtime.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Michael Kubacki <[email protected]>
Acked-by: Ard Biesheuvel <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Sami Mujawar <[email protected]>
2022-05-19 06:11:20 +00:00
Xiaolu.Jiang dc39554d58 edk2/MdeModulePkg/Debuglib: Add Standalone MM support
https://bugzilla.tianocore.org/show_bug.cgi?id=3844

This change added Standalone MM instance of DebugLib.

Reviewd-by: Jian J Wang <[email protected]>
Reviewd-by: Liming Gao <[email protected]>

Signed-off-by: Xiaolu.Jiang <[email protected]>
2022-03-02 02:34:00 +00:00
Bob Feng 1193aa2dfb MdeModulePkg: update brotli submodule
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3417
Update the brotli submodule to the latest commit (f4153a0)
so that the build isn't broken in GCC 11 compilers.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Pedro Falcato <[email protected]>

Signed-off-by: Bob Feng <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2022-02-15 02:13:32 +00:00
Rebecca Cran f4b7b473b4 MdeModulePkg/UefiBootManagerLib: Convert BmLoadOption to Variable Policy
Since the Variable Lock protocol is deprecated, convert locking of
PlatformRecovery#### in EfiBootManagerLoadOptionToVariable to use the
Variable Policy protocol.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Zhichao Gao <[email protected]>
Cc: Ray Ni <[email protected]>

Signed-off-by: Rebecca Cran <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2022-01-28 06:08:45 +00:00
Michael Kubacki 1436aea4d5 MdeModulePkg: Apply uncrustify changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3737

Apply uncrustify changes to .c/.h files in the MdeModulePkg package

Cc: Andrew Fish <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Michael D Kinney <[email protected]>
Signed-off-by: Michael Kubacki <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-12-07 17:24:28 +00:00
Michael D Kinney db52c7f755 MdeModulePkg: Change complex DEBUG_CODE() to DEBUG_CODE_BEGIN/END()
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 <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Michael Kubacki <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-12-07 17:24:28 +00:00
Michael D Kinney e3917e22e7 MdeModulePkg: Change OPTIONAL keyword usage style
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3760

Update all use of ', OPTIONAL' to ' OPTIONAL,' for function params.

Cc: Andrew Fish <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Michael Kubacki <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-12-07 17:24:28 +00:00
Michael D Kinney 87000d7708 MdeModulePkg: Change use of EFI_D_* to DEBUG_*
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 <[email protected]>
Cc: Leif Lindholm <[email protected]>
Cc: Michael Kubacki <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-12-07 17:24:28 +00:00
wenyi,xie via groups.io dfafa8e453 MdeModulePkg/DxeCorePerformanceLib:Variable Initial
SmmBootRecordDataSize is initialized in InternalGetSmmPerData,
but this function may fail. so to avoid using SmmBootRecordDataSize
without intialization, set it to 0 at first.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Dandan Bi <[email protected]>
Signed-off-by: Wenyi Xie <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Dandan Bi <[email protected]>
2021-12-03 09:57:17 +00:00
Dandan Bi 466ebdd2e0 MdeModulePkg/FPDT: Lock boot performance table address variable at EndOfDxe
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 <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Jian J Wang <[email protected]>
Signed-off-by: Dandan Bi <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-11-12 07:36:23 +00:00
Yang Jie 8c8867c5da MdeModulePkg/DxeCapsuleLibFmp: Use new Variable Lock interface
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3D3699
The code in MdeModulePkg\Library\DxeCapsuleLibFmp call the deprecated=20
interface VariableLockRequestToLock.c. So I changed the code in
FmpDevicePkg using RegisterBasicVariablePolicy, instead of the=20
deprecated interface.

Signed-off-by: Yang Jie <[email protected]>
Cc: Guomin Jiang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Jian J Wang <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Jian J Wang <[email protected]>
2021-11-10 09:27:33 +00:00
Bob Morgan aab6bb3d32 MdeModulePkg/DxeCapsuleLibFmp: Capsule on Disk file name capsule
Enhance RelocateCapsuleToRam() to skip creation of the Capsule on Disk
file name capsule if PcdSupportUpdateCapsuleReset feature is not enabled.
This avoids an EFI_UNSUPPORTED return status from UpdateCapsule() when the
file name capsule is encountered and PcdSupportUpdateCapsuleReset is FALSE.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Guomin Jiang <[email protected]>
Signed-off-by: Bob Morgan <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-11-10 02:21:50 +00:00
Michael D Kinney 77dcd03ecf MdeModulePkg: Reproduce builds across source format changes
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3688

Use DEBUG_LINE_NUMBER instead of __LINE__.

Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Michael Kubacki <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Tested-by: Michael Kubacki <[email protected]>
2021-11-08 18:01:35 +00:00
IanX Kuo 99325a8b65 MdeModulePkg/SortLib: Add QuickSort function on BaseLib
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3675

Use QuickSort instead of QuickSortWorker

Cc: Ray Ni <[email protected]>
Reviewed-by: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: IanX Kuo <[email protected]>
2021-10-21 03:23:04 +00:00
Wenyi Xie ac826886c9 MdeModulePkg/UefiSortLib:Add UefiSortLib unit test
Adding two unit test case for UefiSortLib. One is a test on
sorting an array of UINT32 by using PerformQuickSort, another
is a test on comparing the same buffer by using StringCompare.
Add 'main' function name to ECC exception list to avoid ECC
error.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Signed-off-by: Wenyi Xie <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-08-12 08:34:04 +00:00
Grzegorz Bernacki 2b47aaecef MdeModulePkg: Add BootDiscoveryPolicyUiLib.
This library extends Boot Maintenance Menu and allows to select
Boot Discovery Policy. When choice is made BootDiscoveryPolicy
variable is set. Platform code can use this variable to decide
which class of device shall be connected.

Signed-off-by: Grzegorz Bernacki <[email protected]>
Reviewed-by: Zhichao Gao <[email protected]>
Reviewed-by: Sunny Wang <[email protected]>
2021-08-03 04:59:12 +00:00
Zhiguang Liu 1ad794b627 MdeModulePkg: Fix device path when boot manager menu is from different FV
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3441

When the boot manager menu is from different FV, the current logic still
use the device path of the FV as the module links to this library

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Zhichao Gao <[email protected]>
Cc: Ray Ni <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Acked-by: Hao A Wu <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
2021-06-15 08:08:15 +00:00
Zhiguang Liu 42ec0a315b MdeModulePkg: Retrieve boot manager menu from any fv
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3384

Currently, UefiBootManagerLib has the below assumption:
  Assume the BootManagerMenuFile is in the same FV as the module links to this library.
It has some limitation now, so remove the assumption.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Zhichao Gao <[email protected]>
Cc: Ray Ni <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
Reviewed-by: Ray Ni <[email protected]>
Signed-off-by: Zhiguang Liu <[email protected]>
2021-05-18 13:52:06 +00:00
Rebecca Cran e0cb5e1814 MdeModulePkg: Fix various typos
Fix various typos throughout MdeModulePkg.

Signed-off-by: Rebecca Cran <[email protected]>
Reviewed-by: Michael D Kinney <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-05-17 02:10:31 +00:00
Bret Barkelew f8e6bcb6e7 MdeModulePkg: Initialize temp variable in VarCheckPolicyLib
DumpVariablePolicy() will return EFI_INVALID_PARAMETER if the Buffer
pointer is NULL and the indirect Size is anything but 0. Since this
TempSize was not being initialized it is very likely that this sequence
would not return the total buffer size as expected.

Bugzilla: https://bugzilla.tianocore.org/show_bug.cgi?id=3310

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Signed-off-by: Bret Barkelew <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-04-13 01:24:13 +00:00
Michael D Kinney 9c08b3e7d5 MdeModulePkg/PiDxeS3BootScriptLib: Rename mAcpiS3Enable to avoid dup symbol
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3297

Rename the global variable mAcpiS3Enable to mS3BootScriptAcpiS3Enable
to avoid duplicate symbol errors from CLANGPDB tool change when
PiDxeS3BootScriptLib from the MdeModulePkg is linked with PiSmmCpuDxeSmm
from the UefiCpuPkg.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Eric Dong <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-04-07 16:10:59 +00:00
Liming Gao aa75965349 MdeModulePkg: Initialize local variable value before they are used
BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3228
This change is to fix the false compiler error on GCC49 release build.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Signed-off-by: Liming Gao <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
2021-03-25 01:54:46 +00:00
Li, Walon 7f34681c48 MdeModulePkg/UefiBootManagerLib: Put BootMenu at the end of BootOrder
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3135

When Boot Menu does not exist in the BootOrder, BmRegisterBootManagerMenu
will create one into list. However, it should be put at the "end" of
BootOrder instead of "start" of BootOrder. Replace 0 by -1 to adjust
order of load options.

Signed-off-by: Walon Li <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-02-25 15:57:50 +00:00
Abner Chang 0d96664df3 MdeModulePkg/Library: Add HiiGetStringEx to UefiHiiLib for EDK2 Redfish
Add HiiGetStringEx and leveraged by HiiGetString function to support
getting string with the best language in optionally. This avoids the
string in x-uefi language is misled to the language defined by
"PlatformLang" or the "Supported Languages". This change is introduced
to support x-uefi keyword language for configuring BIOS setting.

Signed-off-by: Jiaxin Wu <[email protected]>
Signed-off-by: Siyuan Fu <[email protected]>
Signed-off-by: Fan Wang <[email protected]>
Signed-off-by: Abner Chang <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Nickle Wang <[email protected]>
Reviewed-by: Dandan Bi <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-02-05 05:10:44 +00:00
Kun Qin 1f0fa9187b MdeModulePkg: SmmSmiHandlerProfileLib: Support StandaloneMm Instance
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3185

This change added support of SMI handler profile library router under
StandaloneMm. This change replaces gSmst with gMmst. It also abstracts
standalone and traditional MM driver entrypoints into separate files to
allow maximal common implementations.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Eric Dong <[email protected]>
Cc: Ray Ni <[email protected]>

Signed-off-by: Kun Qin <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-02-01 10:03:14 -08:00
Kun Qin 5625c1fdf7 MdeModulePkg: SmmReportStatusCodeLib: ReportStatusCodeLib in StandaloneMm
This change added support of StandaloneMm for ReportStatusCodeLib. It
adds a new instance of ReportStatusCodeLib for MM_STANDALONE type, and
abstracts the references of gMmst and gSmst functionalities into separate
files in order to link in proper Service Table for SMM core/drivers.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Jiewen Yao <[email protected]>

Signed-off-by: Kun Qin <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-02-01 10:01:03 -08:00
Kun Qin e35fce8ada MdeModulePkg: SmmLockBoxSmmLib: Support StandaloneMm for SmmLockBoxLib
This change added support of StandaloneMm for SmmLockBoxLib. It replaces
gSmst with gMmst to support both traditional MM and standalone MM. The
contructor and desctructor functions are abstracted to support different
function prototype definitions.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Eric Dong <[email protected]>

Signed-off-by: Kun Qin <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-02-01 10:01:03 -08:00
wenyi,xie via groups.io 014b9850f2 MdeModulePkg/FileExplorerLib: Add return value check
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3113
According to FAT specification, the length of file path
should not larger than 260. When the length exceed 260,
function FatLocateOFile will return EFI_INVALID_PARAMETER
and the parameter FileHandle will be NULL. Then on the
top-level function?an exception happens when the NULL
pointer is passed and be used.
So adding return value check after calling
LibGetFileHandleFromMenu, if return value is not success,
stop calling LibFindFiles.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Eric Dong <[email protected]>
Signed-off-by: Wenyi Xie <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Dandan Bi <[email protected]>
2021-01-15 01:08:45 +00:00
Liu, WeiX C 7e6776deaf MdeModulePkg Lzma: Update LZMA SDK version to 19.00
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3101
New formal release in https://www.7-zip.org/sdk.html is 19.00.

Cc: Liming Gao <[email protected]>
Signed-off-by: Wei Liu <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2021-01-08 10:03:53 +00:00
Michael D Kinney 248d08c598 MdeModulePkg/Library/VarCheckLib: Allow SetVariable from SMM
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3154

Update VarCheckLibSetVariableCheck() to allow locked variables
to be updated if the RequestSource is VarCheckFromTrusted even
if one or more variable check handlers return EFI_WRITE_PROTECTED.
RequestSource is only set to VarCheckFromTrusted if the request
is through the EFI_SMM_VARAIBLE_PROTOCOL.

Cc: Bret Barkelew <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Liming Gao <[email protected]>
Signed-off-by: Michael D Kinney <[email protected]>
Reviewed-by: Bret Barkelew <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-01-07 03:48:10 +00:00
gaoliming 67e0e4caa5 MdeModulePkg BrotliCustomDecompressLib: Remove the duplicated functions
The same functions have been defined in BrotliDecUefiSupport.c.

Signed-off-by: Liming Gao <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Dandan Bi <[email protected]>
Reviewed-by: Hao A Wu <[email protected]>
2021-01-06 07:15:09 +00:00
Masahisa KojimaandKun Qin e2747dbb5a MdeModulePkg/VarCheckPolicyLib: implement standalone MM version
This commit adds the VarCheckPolicyLib that will be able to
execute in the context of standalone MM.

Signed-off-by: Masahisa Kojima <[email protected]>
Co-authored-by: Kun Qin <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Ard Biesheuvel <[email protected]>
Cc: Sami Mujawar <[email protected]>
Cc: Jiewen Yao <[email protected]>
Cc: Supreeth Venkatesh <[email protected]>
Cc: Bret Barkelew <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2020-12-23 09:13:58 +00:00
wenyi xie c02bdb276b MdeModulePkg/FileExplorerLib: remove redundant null pointer check
If "Info" is a valid pointer to an EFI_FILE_SYSTEM_VOLUME_LABEL
structure, then "Info->VolumeLabel" denotes a valid array object.
When the "Info->VolumeLabel" expression is evaluated, as seen in
the LibFindFileSystem(), it is implicitly converted to
(&Info->VolumeLabel[0]). Because the object described by the
expression (Info->VolumeLabel[0]) is a valid CHAR16 object, its
address can never compare equal to NULL. Therefore, the condition
(Info->VolumeLabel == NULL) will always evaluate to FALSE.
Substitute the constant FALSE into the "if" statement, and
simplify the resultant code (eliminate the dead branch).

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Dandan Bi <[email protected]>
Cc: Eric Dong <[email protected]>
Signed-off-by: Wenyi Xie <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
2020-12-04 05:56:09 +00:00
James Bottomley 872f953262 MdeModulePkg/VariablePolicyLib: Fix runtime panic in ValidateSetVariable()
The current variable policy is allocated by AllocatePool(), which is
boot time only.  This means that if you do any variable setting in the
runtime, the policy has been freed.  Ordinarily this isn't detected
because freed memory is still there, but when you boot the Linux
kernel, it's been remapped so the actual memory no longer exists in
the memory map causing a page fault.

Fix this by making it AllocateRuntimePool().  For SMM drivers, the
platform DSC is responsible for resolving the MemoryAllocationLib
class to the SmmMemoryAllocationLib instance. In the
SmmMemoryAllocationLib instance, AllocatePool() and
AllocateRuntimePool() are implemented identically. Therefore this
change is a no-op when the RegisterVariablePolicy() function is built
into an SMM driver. The fix affects runtime DXE drivers only.

Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3092
Signed-off-by: James Bottomley <[email protected]>
Reviewed-by: Laszlo Ersek <[email protected]>
Tested-by: Laszlo Ersek <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
2020-11-27 01:19:34 +00:00
Laszlo Ersek e7bd0dd26d MdeModulePkg/LzmaCustomDecompressLib: catch 4GB+ uncompressed buffer sizes
The LzmaUefiDecompressGetInfo() function
[MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompress.c] currently
silently truncates the UINT64 "DecodedSize" property of the compressed
blob to the UINT32 "DestinationSize" output parameter.

If "DecodedSize" is 0x1_0000_0100, for example, then the subsequent memory
allocation (for decompression) will likely succeed (allocating 0x100 bytes
only), but then the LzmaUefiDecompress() function (which re-fetches the
uncompressed buffer size from the same LZMA header into a "SizeT"
variable) will overwrite the buffer.

Catch (DecodedSize > MAX_UINT32) in LzmaUefiDecompressGetInfo() at once.
This should not be a practical limitation. (The issue cannot be fixed for
32-bit systems without spec modifications anyway, given that the
"OutputSize" output parameter of
EFI_GUIDED_SECTION_EXTRACTION_PROTOCOL.ExtractSection() has type UINTN,
not UINT64.)

Cc: Dandan Bi <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Jian J Wang <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Philippe Mathieu-Daudé <[email protected]>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=1816
Signed-off-by: Laszlo Ersek <[email protected]>
Reviewed-by: Liming Gao <[email protected]>
Reviewed-by: Philippe Mathieu-Daudé <[email protected]>
Message-Id: <[email protected]>
2020-11-21 02:04:40 +00:00
Bret Barkelew 483449c9da MdeModulePkg: Define the VarCheckPolicyLib and SMM interface
https://bugzilla.tianocore.org/show_bug.cgi?id=2522

VariablePolicy is an updated interface to
replace VarLock and VarCheckProtocol.

This is an instance of a VarCheckLib that is backed by the
VariablePolicyLib business logic. It also publishes the SMM
calling interface for messages from the DXE protocol.

Cc: Jian J Wang <[email protected]>
Cc: Hao A Wu <[email protected]>
Cc: Liming Gao <[email protected]>
Cc: Bret Barkelew <[email protected]>
Signed-off-by: Bret Barkelew <[email protected]>
Reviewed-by: Dandan Bi <[email protected]>
Acked-by: Jian J Wang <[email protected]>
2020-11-17 01:03:43 +00:00