Commit Graph

27 Commits

Author SHA1 Message Date
Michał Kopeć 3b3b2edb2a Firmware Update Mode: Add separate variable for FUM Request
Fixes an issue where entering FUM twice in a row is prevented by the
Request variable being the same as the Active variable, being volatile
and without runtime write access.

Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2026-02-09 14:30:28 +01:00
Michał Kopeć 1c50dad8d6 DasharoModulePkg/Library/DasharoVariablesLib/DasharoVariablesLib.c: Recreate variables whose attributes don't match
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-09-12 19:23:12 +02:00
Michał Kopeć e8894bed1b DasharoModulePkg/Library: Use correct GUID for DescriptorWriteable EFI var
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-09-02 11:30:19 +02:00
Michał Kopeć af85ff649a DasharoModulePkg: Add define for DescriptorWriteable EFI variable
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-09-02 11:30:19 +02:00
Michał Kopeć 4d28c9a94d DasharoVariablesLib/DasharoVariablesLib.c: Always allow capsule if descriptor is locked
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-09-02 11:30:12 +02:00
Michał Kopeć 009e00db4c DasharoVariablesLib/DasharoVariablesLib.c: Always allow capsule if descriptor is locked
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-09-01 17:59:15 +02:00
Sergii Dmytruk ac25544f92 DasharoModulePkg/DasharoVariablesLib: runtime access to ME mode variable
The variable is being checked in DasharoCapsulesCanPersistAcrossReset().
An error from gRT->GetVariable() about missing variable is effectively
ignored (ASSERT_EFI_ERROR() does nothing) and default assumption of ME
is enabled which ended up preventing use of capsules even after
HAP-disabling ME.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-08-13 01:09:44 +03:00
Sergii Dmytruk 87c0c539c8 DasharoModulePkg/DasharoVariablesLib: don't call Print() without ConOut
This causes crash on writing capsule to /dev/efi_capsule_loader in
Linux.  The Print() function is asserting in this case and apparently
ends up accessing a pointer memory that was not updated on
SetVirtualAddressMap().

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-08-13 01:09:43 +03:00
Michał Kopeć 04b1ed1b56 DasharoVariablesLib: warn if ME is in wrong mode for capsule
Signed-off-by: Michał Kopeć <michal.kopec@3mdeb.com>
2025-07-24 16:47:50 +02:00
Michał Żygowski 244b28fddf DasharoModulePkg: Add IBECC option support
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-06-13 16:39:41 +02:00
Michał Żygowski f54d791b4a DMP/Library/DasharoVariablesLib: Add mising USB port power var
Fixes the assert happenning in OVMF when attempting to enter
setup:

GetVariableInfo(): Unknown variable: UsbPortPower.
ASSERT DasharoVariablesLib.c(198):
   (0 && "No default value set for a variable.")

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-06-13 12:19:33 +02:00
Filip Lewiński c3fc85d27c DasharoModulePkg/: disable dGPU only option for non-MTL
Signed-off-by: Filip Lewi¿ski <filip.lewinski@3mdeb.com>
2025-04-01 12:40:31 +02:00
Filip Lewiński 5c1929aa46 DasharoModulePkg: rename DGPUEnabled to more generic DGPUState
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2025-04-01 12:40:30 +02:00
kamay 2fc0e16a84 Added DGPUEnabled EFI variable
Signed-off-by: Filip Lewiński <filip.lewinski@3mdeb.com>
2025-03-28 16:16:26 +02:00
Michał Żygowski 0961f9f31f Add PCDs to control quiet and fast boot in the project
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:34 +02:00
Michał Żygowski 28aef22366 DasharoModulePkg/DasharoVariablesLib: Add quiet and fast boot variables
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:32 +02:00
Krystian Hebel 5b027f0f36 DasharoModulePkg/DasharoVariablesLib: add runtime attribute to FUM
This is required for initializing capsule update process from Linux's
capsule_loader.

It also fixes the possibility for putting the device in infinite FUM
loop by creating the variable with runtime access. SetVariable() in
WarnIfFirmwareUpdateMode() used to remove the variable failed because
of mismatched attributes.

According to UEFI specification,

> If a preexisting variable is rewritten with no access attributes
> specified, the variable will be deleted.

This is exactly what is needed. The other way to delete a variable is
to specify matching attributes and set the size of a variable as 0.

Signed-off-by: Krystian Hebel <krystian.hebel@3mdeb.com>
2025-03-10 20:16:32 +02:00
Sergii Dmytruk 96a094d553 MdeModulePkg/Universal/CapsuleRuntimeDxe: Reject capsules unless ME is HAP-disabled
HAP-disabled ME doesn't do anything, including writing to system flash,
which is what we need for a firmware update that relies on a warm reset.
coreboot assumes that HECI/soft-disabled state of ME isn't as good as
HMRFPO and switches to HMRFPO doing a global reset which loses in-RAM
capsules.

Checking variable's value should be enough, if somebody manually set it to
an invalid value, the update there will be a reboot without a capsule
update.  A more reliable solution would be to pass this information from
coreboot.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-03-10 20:16:31 +02:00
Sergii Dmytruk 62e05eec81 DasharoModulePkg: Extract DasharoEnableFUM()
It will be used elsewhere.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-03-10 20:16:30 +02:00
Michał Żygowski da62e4d2da DasharoSystemFeaturesUiLib,DasharoVariablesLib: Use FixedPcdGetBool
Use FixedPcdGetBool to emphasize the use of immutable FixedAtBuild PCD.
It will also prevent changing the PCD type later and possibly alter the
behavior of the menu by other modules if something was to change the
PCD type.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:28 +02:00
Michał Żygowski 10f3f14a0f DasharoModulePkg/DasharoVariablesLib: Autocreate variables only for enabled options
Add list of conditions under which the variable should be created.
We only want to create variables for options that are enabled in the
given project/build.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:28 +02:00
Michał Żygowski a5b3b31da5 Rework the CPU throttling variables and setup UI management
The CPU throttling used an excessive number of variables. The allowed
range of values should be fixed at build, saving it as a NV variable
makes no sense.

Simplify the logic of the CPU throttling range, gaining a better UX
than some error popups. Instead of setting the temperature, set the
offset which has a fixed allowed range. Display the current threshold
temperatue as grayed out fields instead.

Also add PCD to control the default value of the throttling offset.

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:28 +02:00
Michał Żygowski 487cff4180 DasharoSystemFeaturesUiLib: Add options for downcoring and HT
Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
2025-03-10 20:16:28 +02:00
Sergii Dmytruk 0bceb4df2a SecurityPkg: measure Dasharo variables before boot
DasharoModulePkg/DasharoVariablesLib got an API for measuring Dasharo
variables which is invoked by Tcg[2]Dxe.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-03-10 20:16:27 +02:00
Sergii Dmytruk 255e4abe90 DasharoSystemFeaturesUiLib: reduce boilerplate in RouteConfig
The code is highly repetitive, use a macro to shorten it by a lot.

Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
2025-03-10 20:16:27 +02:00