This fixes "SecurityPkg: measure Dasharo variables before boot".
gRT->GetNextVariableName() doesn't return variables in any fixed order.
Seems like the order matches order in SMMSTORE. This means that
measuring variables while enumerating them will produce different
results depending on which variables were update last (setting a
variable in SMMSTORE is marking old entry as deleted and appending of a
new one). Sort list of variables that share the same GUID before
measuring any of them to impose a fixed order.
Also fix spacing in several places.
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>
Use disableif, which is more convenient for turning off the options
entirely, as it will disable the IFR logic for everything nested under
the disableif. Unlike supressif, disableif is evaluated only once. It
saves time for the processing and will prevent some undesired behavior
from occurring, such as a default value not correctly set for the
hidden option and causing an IFR logic to fail in bounds check, etc.
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>
Combination of `RESET_REQUIRED` flag and set `questionid` isn't enough
to get callback call, `INTERACTIVE` flag is required as well.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
From now on default values are maintained only in DasharoVariablesLib
and can be queried from it to avoid code duplication and bugs which
arise from it.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
Create a separate library for managing values of variables and create
them in the constructor of the new library. This gets rid of the
defaults in Library/DasharoSystemFeaturesUiLib/DasharoSystemFeatures.c
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
1. Remove excessive indentation from some fields of
DASHARO_FEATURES_DATA.
2. Add a comment explaining question IDs.
3. Drop gDasharoSystemFeaturesGuid declaration which should be provided
by build system.
4. Fix formatting of WATCHDOG_ENABLE_QUESTION_ID.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
To have all of them collected in one place and have no need to reach
into HII-related header from unrelated parts of the code.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>
This is somewhat then using string literals as making a typo in a macro
name will cause a compilation error.
Signed-off-by: Sergii Dmytruk <sergii.dmytruk@3mdeb.com>