Commit Graph

2868 Commits

Author SHA1 Message Date
Yang Gang e02c7848af MdeModulePkg SmbiosMeasurementDxe: Release TableAddress after use
Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2024-12-11 09:51:45 +08:00
Yang Gang 58c7517228 MdeModulePkg DriverHealthManagerDxe: Display HealthStatus as TextTwo
When PcdBrowserGrayOutTextStatement is TRUE, TextOpCode will be GrayOut.
HealthStatus cannot be displayed in help area, use TextTwo to display it.

Signed-off-by: Yang Gang <yanggang@byosoft.com.cn>
2024-12-11 09:02:08 +08:00
Mike Maslenkin f6422011e5 MdeModulePkg/PlatformDriOverrideDxe: fix HiiOpCodeHandle leak
Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-12-06 17:13:17 +00:00
Dandan Bi 9112fb0ecc MdeModulePkg/HiiDatabase: Return default value for BIT VarStore as UNIT32
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4874

Question CheckBox, OneOf and Numeric can refer to Bit EFI VarStore.
CheckBox: data type is Boolean (1 byte),
Numeric/Oneof: data type is always UNIT32 for BIT VarStore,
When get default value for BIT VarStore, should return default value
with sizeof (UINT32) rather than the byte the bit width occupied.
Or incorrect default value will be used due to the size mismatch.

Signed-off-by: Dandan Bi <dandan.bi@intel.com>
2024-12-02 13:38:48 +00:00
nikhil p sheshagiri acce74762b MdeModulePkg: Adding support for authenticated variable
storage data format

REF:https://bugzilla.tianocore.org/show_bug.cgi?id=4857

NVS needs to support both authenticated and non-authenticated
header for NV region. PcdNvStoreDefaultValueBuffer can have
variables with data format of the type Authenticated variable storage
and this change provides the support to differentiate between
the normal variable storage and authenticated variable storage
for the hii database to consume and update the setup variables
accordingly

Signed-off-by: nikhil p sheshagiri <nikhil.p.sheshagiri@intel.com>
2024-10-30 03:36:56 +00:00
Hua Ma 1a3d4b33b6 MdeModulePkg/TerminalDxe: Return success if device not support SetControl
Some serial device may not support SetControl. Ignore the error from
SetControl if EFI_UNSUPPORTED is return.

Signed-off-by: Hua Ma <hua.ma@intel.com>
2024-10-28 04:18:53 +00:00
Phil Noh 21e8a85653 MdeModulePkg/TerminalDxe: Add VTUTF8 to Putty function key map
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4848

This patch is to support VTUTF8 type for Putty function key map.
In Putty, it is required for translating a stream of Unicode characters
for function keys on UTF8 correctly.

Signed-off-by: Phil Noh <Phil.Noh@amd.com>
2024-09-18 03:42:47 +00:00
Ken Lautner babccb841d MdeModulePkg: Enable Data Terminal at end of serial
When a Serial device resets, the Modem Control Register Data Terminal
Ready and Request to Send need to be cleared also. Otherwise the
registers will be left in their previous state, and the connected device
will not be able to transmit data.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-12 05:44:38 +00:00
Mike Beaton 1328938560 MdeModulePkg/VariableRuntimeDxe: Fix VariablePolicyProtocol PRODUCES
If we search the codebase for &gEdkiiVariablePolicyProtocolGuid
we can find two drivers which install this policy:
VariableRuntimeDxe (installed in VariableDxe.c) and
VariableSmmRuntimeDxe (installed in VariablePolicySmmDxe.c).

The .inf file for VariableRuntimeDxe incorrectly lists the protocol
as CONSUMES in the comment, so change this to PRODUCES.

Signed-off-by: Mike Beaton <mjsbeaton@gmail.com>
2024-09-11 01:35:18 +00:00
Ken Lautner 559affab2e MdeModulePkg: Fix redundant call to RestoreTpl()
Comments out a redundant call to RestoreTpl(). While this does not
technically violate spec on raise/restore TPL, TPL should already be at
the specified level. This extra call introduces an asymmetry between
RaiseTpl and RestoreTpl calls, which makes analysis of TPL correctness
more difficult and hampers certain non-standard TPL usages that some
platforms require.  Additionally, the two TPL variables were renamed to
provide context for each of them.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-04 00:53:54 +00:00
Ken Lautner b17ac09cc4 MdeModulePkg: Add extra RestoreTpl() call in DiskIo
Adds a call to RestoreTpl() in DiskIo2ReadWriteDisk(). While the current
implementation does not technically violate spec on raise/restore TPL,
this extra call ensures symmetry between RaiseTpl and RestoreTpl calls,
which makes analysis of TPL correctness simpler and permits certain
non-standard TPL usages that some platforms require.

Signed-off-by: Kenneth Lautner <kenlautner3@gmail.com>
2024-09-04 00:53:54 +00:00
Sureshkumar Ponnusamy 8504d2be17 MdeModulePkg/FaultTolerantWriteDxe: Fix buffer overrun issue
- This PR aims to  prevent a buffer overrun issue found in FtwGetLastWriteHeader
function.As per the current code, when there is a malformed blocks (with all bytes as 0s)
then `Offset += FTW_WRITE_TOTAL_SIZE (FtwHeader->NumberOfWrites,
FtwHeader->PrivateDataSize)` would access beyond FtwWorkSpaceSize.

- Also added the signature check to validate work space

Signed-off-by: Sureshkumar Ponnusamy <sponnusamy@microsoft.com>
2024-09-03 20:29:02 +00:00
Wei6 Xu 91853ca6a5 MdeModulePkg/VariableStandaloneMm: Notify variable write ready in MM
In Standalone MM, there is no notification to MM drivers that variable
write is ready. Install gSmmVariableWriteGuid into MM handle database
for the notification.

Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-09-02 12:43:49 +08:00
Wei6 Xu 5aa6842715 MdeModulePkg/VariableStandaloneMm: Fix TCG MOR secure feature issue
According to TCG's Platform Reset Attack Mitigation spec, the OS should
never create the MOR variable, only read and write it.
But some OSes (Fedora 24 and 25) don't follow the TCG's Platform Reset
Attack Mitigation spec and unintentionally create MOR variable.

The commit fda8f631ed added function
VariableHaveTcgProtocols() to check against Tcg/Tcg2 protocol to infer
whether the MOR variable is created by platform firmware or not. If not,
delete the variable created by OS and lock the variable to avoid OS to
create it.

But in VariableStandaloneMm, VariableHaveTcgProtocols() always returns
FALSE, it causes TCG MOR secure feature does not work in standalone MM
environment.

As Fedora 24 and 25 are EOL today, directly returns TRUE in the function
VariableHaveTcgProtocols() for VariableStandaloneMm, and rename the
function to VariableIsMorVariableLegitimate() to make it more obvious
what the narrow use-case is for which it exists.

Signed-off-by: Wei6 Xu <wei6.xu@intel.com>
2024-08-30 13:18:08 +00:00
Zhang Hongbin 82d2f6b3c3 MdeModulePkg/SmmCommunicationBufferDxe: Re-use FixedCommBuffer
SmmCommunicationBufferDxe need to re-use FixedCommBuffer from
MmCommBuffer HOB which created under PEI stage.

Signed-off-by: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Jiaxin Wu <jiaxin.wu@intel.com>
2024-08-28 15:25:27 +00:00
Mike Maslenkin 1cc0fae8d9 MdeModulePkg/RamDiskDxe: fix memory leak on error path.
This patch fixes a leak of memory allocated for the RAM disk in cases
when an error occurred while reading contents of a file from disk
or RamDiskRegister() returned some error condition.

Signed-off-by: Mike Maslenkin <mike.maslenkin@gmail.com>
2024-08-26 05:32:42 +00:00
John Schock 472be4d139 MdeModulePkg ConPlatform: Support IAD-style USB input devices.
Some multi-function input devices (e.g. combo keyboard and mouse)
present as IAD-style devices (https://www.usb.org/defined-class-codes,
https://learn.microsoft.com/en-us/windows-hardware/drivers/usbcon/usb-interface-association-descriptor).
Historically, multi-function devices would report a DeviceClass of 0,
indicating that interface matching should be done on the interface
descriptor rather than the global device descriptor.

IAD-style devices us DeviceClass of 0xEF, so they don't match
MatchUsbClass() for keyboard (DeviceClass=3, SubClass=1, Proto=1). If
they are treated as if they had a DeviceClass of zero, which is more
traditional for legacy multi-function devices, then the interface
descriptors are used instead and these types of devices will "just work"
without needing to add a custom USB device path to ConIn.

Signed-off-by: Aaron Pop <aaronpop@microsoft.com>
2024-08-06 03:24:40 +00:00
Dun Tan 43e2395c1b MdeModulePkg: fix issue caused by uninitialized variable
This patch is to fix issue caused by uninitialized local
variable in Pei/Variable.c.

In the fucntion CalculateHobVariableCacheSize(), the local
variable VARIABLE_STORE_INFO StoreInfo is used without
initialization. When the uninitialized variable is passed
to CalculateAuthVarStorageSize() and GetNextVariablePtr(),
the field StoreInfo->FtwLastWriteData might be a uninitialized
non-zero value. Then the code execution will access the
invalid address StoreInfo->FtwLastWriteData->TargetAddress.
This might cause issue.

So in this commit, the local variable VARIABLE_STORE_INFO
StoreInfo is initialized by a ZeroMem() before use.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-07-29 06:43:27 +00:00
George Liao 03ad59e631 MdeModulePkg: Consume SOC related ACPI table from ACPI Silicon HOB
REF : https://bugzilla.tianocore.org/show_bug.cgi?id=4787

If ACPI Silicon Hob has been found from entry of AcpiTableDxe driver,
that means SOC related ACPI tables been pass to the DXE phase by HOB.
Each SOC related ACPI tables will be install.

Signed-off-by: George Liao <george.liao@intel.com>
2024-07-26 17:12:18 +00:00
Jiaxin Wu 0986faad97 MdeModulePkg/VariableSmm: Fix NonPrimary Buffer check issue
VariableSmmIsBufferOutsideSmmValid function is to check the buffer
is outside SMM or not. This patch fix the issue that always return
true for MM.

Meanwhile, this patch renames VariableSmmIsBufferOutsideSmmValid
to VariableSmmIsNonPrimaryBufferValid.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-07-07 08:40:03 +00:00
Jiaxin Wu 8befdb1441 MdeModulePkg/VariableSmm: Add func for Primary Buffer valid check
Add a new function (VariableSmmIsPrimaryBufferValid) to check
Primary Buffer valid or not.

original function (VariableSmmIsBufferOutsideSmmValid) is used to
check the buffer outside MMRAM.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-07-07 08:40:03 +00:00
Jiaxin Wu 67d3be644f MdeModulePkg/FaultTolerantWriteSmm: Update buffer valid check func name
In the MdeModulePkg/FaultTolerantWriteSmm, the Primary Buffer
(CommBuffer) check function has been updated to match the buffer
validation behavior:

For SMM, the SMM Handlers is to validate the buffer outside MMRAM.

For MM, the MM Handlers do not need to validate the buffer if it is
the CommBuffer passed from MmCore through the MmiHandler() parameter.
Return TRUE directly in this case.

There is no function impact.

Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Star Zeng <star.zeng@intel.com>
Cc: Hongbin1 Zhang <hongbin1.zhang@intel.com>
Cc: Wei6 Xu <wei6.xu@intel.com>
Cc: Dun Tan <dun.tan@intel.com>
Cc: Yuanhao Xie <yuanhao.xie@intel.com>
2024-07-07 08:40:03 +00:00
Gaurav Pandya ae09721a65 MdeModulePkg/DisplayEngineDxe: Support "^" and "V" key on pop-up form
BZ #4790
Support "^" and "V" key stokes on the pop-up form. Align the
implementation with key support on the regular HII form.

Signed-off-by: Gaurav Pandya <gaurav.pandya@amd.com>
2024-06-26 16:21:24 +00:00
Dun Tan 128513afcd MdeModulePkg:Add global variable mVariableRtCacheInfo
Add global variable mVariableRtCacheInfo to save the
content in gEdkiiVariableRuntimeCacheInfoHobGuid. With
this new global variable, 7 global variables can be
removed.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan 081df0ec20 MdeModulePkg: Refine InitVariableCache()
Refine the code logic in InitVariableCache().
In this commit, three times calling of
InitVariableCache() for different type cache are
merged into one calling. This commit is to make
the code looks cleaner and doesn't change any
code functionality.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan 92974e3d18 MdeModulePkg:Remove the usage of PcdEnableVariableRuntimeCache
Remove the usage of PcdEnableVariableRuntimeCache. We can
use the existence of gEdkiiVariableRuntimeCacheInfoHobGuid
to indicate if variable runtime cache is enabled or not.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan 689f415a49 MdeModulePkg:Consume gEdkiiVariableRuntimeCacheInfoHobGuid
Consume gEdkiiVariableRuntimeCacheInfoHobGuid in

VariableSmmRuntimeDxe driver to initialize the following

variable cache related buffer:
  *mVariableRuntimeHobCacheBuffer
  *mVariableRuntimeNvCacheBuffer
  *mVariableRuntimeVolatileCacheBuffer
  *mVariableRuntimeCachePendingUpdate
  *mVariableRuntimeCacheReadLock
  *mHobFlushComplete

The code to to allocate 
and unblock the buffer for
different type cache in VariableSmmRuntimeDxe is also
removed in this commit.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan c1c2e474a2 MdeModulePkg:Remove unneed FreePages for RuntimeHobCacheBuffer
Remove unneed FreePages() for RuntimeHobCacheBuffer which is
allocated in PEI phase.
So the global variable mVariableRuntimeHobCacheBufferSize
also can be removed.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan 645d9f6f8d MdeModulePkg:Remove unnecessary global variables
Remove the two unnecessary global variables and
replace them by two local variables:
  mVariableRuntimeNvCacheBufferSize
  mVariableRuntimeVolatileCacheBufferSize

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Dun Tan d8f513de3e MdeModulePkg:Create gEdkiiVariableRuntimeCacheInfoHobGuid
Install the callback of gEfiPeiMemoryDiscoveredPpiGuid
to create gEdkiiVariableRuntimeCacheInfoHobGuid in
VariablePei module. When PcdEnableVariableRuntimeCache
is TRUE, the callback will be installed to allocate
the needed buffer for different type variable runtime
cache, unblock the buffer and build this HOB. Then the
runtime cache buffer address and size will be saved in
the HOB content.

Signed-off-by: Dun Tan <dun.tan@intel.com>
2024-06-17 13:42:43 +00:00
Rebecca Cran 8c826be35c MdeModulePkg: In RemoveTableFromRsdt don't read from unallocated memory
Instead of copying from unallocated memory in RemoveTableFromRsdt, do a
CopyMem followed by ZeroMem.

Signed-off-by: Rebecca Cran <rebecca@bsdio.com>
2024-06-07 11:35:47 +00:00
Oliver Steffen 80b59ff832 MdeModulePkg: Warn if out of flash space when writing variables
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>
2024-06-07 03:57:02 +00:00
Jeff Brasen 65b0d08786 MdeModulePkg/HiiDatabaseDxe: Remove assert for VarStoreId = 0
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>
2024-06-06 05:41:00 +00:00
Ard Biesheuvel de4cc40b8c MdeModulePkg/HiiDatabaseDxe: Avoid struct assignment
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>
2024-06-04 19:06:24 +00:00
Shanmugavel Pakkirisamy 284dbac43d MdeModulePkg: Potential UINT32 overflow in S3 ResumeCount
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>
2024-05-17 05:33:52 +00:00
Wenxing Hou d8e4c4b000 MdeModulePkg/Variable: Add TCG SPDM device measurement update
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>
2024-04-30 02:21:13 +00:00
Dhaval 98f150a954 MdeModulePkg/AcpiTableDxe: Prefer xDSDT over DSDT when installing tables
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>
2024-04-11 16:04:45 +08:00
Aaron Li 932db9df0c MdeModulePkg/AcpiTableDxe: PCD switch to avoid using ACPI reclaim memory
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>
2024-04-09 07:03:08 +00:00
Qingyu e043e3e3bf MdeModulePkg: Update the comments of ReadKeyStroke and ReadKeyStrokeEx
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>
2024-04-03 10:25:06 +08:00
Suqiang Ren ef4d35d4ed MdeModulePkg: Align RuntimeDxe function headers with UEFI return values
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>
2024-02-09 22:16:32 +00:00
Ming Tan ff52277e37 MdeModulePkg/DriverSampleDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY
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>
2024-01-24 15:57:35 +00:00
Ming Tan 588cfc63d2 MdeModulePkg/SetupBrowserDxe: EFI_BROWSER_ACTION_REQUEST_QUESTION_APPLY
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>
2024-01-24 15:57:35 +00:00
Ashish Singhal 1063665fa5 MdeModulePkg/ResetSystemRuntimeDxe: Print Reset Data
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>
2024-01-24 01:32:27 +00:00
Gao Cheng 88580a79d4 MdeModulePkg/Variable: Merge variable header + data update into one step
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>
2023-11-29 01:45:25 +00:00
Jake Garver via groups.io c9cce5a005 MdeModulePkg/RegularExpressinoDxe: Fix clang error
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>
2023-11-13 05:21:09 +00:00
Michael Kubacki f3b2187d55 MdeModulePkg/VariablePolicy: Add more granular variable policy querying
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>
2023-10-31 14:40:50 +00:00
HoraceX Lien be971fc302 MdeModulePkg/SmbiosDxe: Fix BcdRevision is not match with SMBIOS version
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>
2023-09-26 23:56:43 +00:00
Mike Beaton 0bcc503595 MdeModulePkg/HiiDatabase: Fix incorrect AllocateCopyPool size
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>
2023-09-11 01:17:33 +00:00
Dandan Bi 7672d1cca5 MdeModulePkg/SetupBrowser: Load storage via GetVariable for EfiVarStore
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>
2023-08-03 12:12:27 +00:00
Abhi Singh 63923a5642 MdeModulePkg/Variable: TcgMorLockSmm Key Mismatch changes lock state
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>
2023-07-10 12:24:59 +00:00