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>
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>
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>
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>
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>
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>
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>
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>
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>
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>