DasharoModulePkg: Add more switches to hide features

Signed-off-by: Michał Żygowski <michal.zygowski@3mdeb.com>
This commit is contained in:
Michał Żygowski
2025-03-10 20:16:19 +02:00
committed by Sergii Dmytruk
parent 13ac55a177
commit ba0ddab5b1
5 changed files with 69 additions and 22 deletions
+4
View File
@@ -65,6 +65,10 @@
gDasharoSystemFeaturesTokenSpaceGuid.PcdIntelMeDefaultState|0|UINT8|0x000000018
gDasharoSystemFeaturesTokenSpaceGuid.PcdIntelMeHapAvailable|TRUE|BOOLEAN|0x000000019
gDasharoSystemFeaturesTokenSpaceGuid.PcdS3SupportExperimental|FALSE|BOOLEAN|0x000000020
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowLockBios|FALSE|BOOLEAN|0x00000001A
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowSmmBwp|FALSE|BOOLEAN|0x00000001B
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowFum|TRUE|BOOLEAN|0x00000001C
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowPs2Option|FALSE|BOOLEAN|0x00000001D
[PcdsFixedAtBuild,PcdsPatchableInModule,PcdsDynamic,PcdsDynamicEx]
## Indicate whether the password is cleared.
@@ -236,6 +236,29 @@ DasharoSystemFeaturesUiLibConstructor (
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.SecurityMenuShowCamera = PcdGetBool (PcdSecurityShowCameraOption);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.MeHapAvailable = PcdGetBool (PcdIntelMeHapAvailable);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.S3SupportExperimental = PcdGetBool (PcdS3SupportExperimental);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowLockBios = PcdGetBool (PcdShowLockBios);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowSmmBwp = PcdGetBool (PcdShowSmmBwp);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowFum = PcdGetBool (PcdShowFum);
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowPs2Option = PcdGetBool (PcdShowPs2Option);
// Ensure at least one option is visible in given menu (if enabled), otherwise hide it
if (mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowSecurityMenu)
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowSecurityMenu = PcdGetBool (PcdDasharoEnterprise) ||
PcdGetBool (PcdShowIommuOptions) ||
PcdGetBool (PcdSecurityShowWiFiBtOption) ||
PcdGetBool (PcdSecurityShowCameraOption) ||
PcdGetBool (PcdShowLockBios) ||
PcdGetBool (PcdShowSmmBwp) ||
PcdGetBool (PcdShowFum);
if (mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowChipsetMenu)
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowChipsetMenu = PcdGetBool (PcdShowOcWdtOptions) ||
PcdGetBool (PcdShowPs2Option);
if (mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowPowerMenu)
mDasharoSystemFeaturesPrivate.DasharoFeaturesData.ShowPowerMenu = PcdGetBool (PcdPowerMenuShowFanCurve) ||
PcdGetBool (PcdPowerMenuShowSleepType) ||
PcdGetBool (PcdPowerMenuShowBatteryThresholds) ||
(FixedPcdGet8 (PcdDefaultPowerFailureState) != POWER_FAILURE_STATE_HIDDEN);
// Setup feature state
BufferSize = sizeof (mDasharoSystemFeaturesPrivate.DasharoFeaturesData.LockBios);
@@ -1273,6 +1296,9 @@ DasharoSystemFeaturesCallback (
case EFI_BROWSER_ACTION_CHANGED:
{
if (QuestionId == FIRMWARE_UPDATE_MODE_QUESTION_ID) {
if (!PcdGetBool(PcdShowFum))
return EFI_UNSUPPORTED;
do {
CreatePopUp (
EFI_BLACK | EFI_BACKGROUND_RED,
@@ -58,6 +58,10 @@ typedef struct {
BOOLEAN ShowPciMenu;
BOOLEAN ShowMemoryMenu;
BOOLEAN ShowSerialPortMenu;
BOOLEAN ShowLockBios;
BOOLEAN ShowSmmBwp;
BOOLEAN ShowFum;
BOOLEAN ShowPs2Option;
BOOLEAN PowerMenuShowFanCurve;
BOOLEAN PowerMenuShowSleepType;
BOOLEAN PowerMenuShowBatteryThresholds;
@@ -85,4 +85,9 @@
gDasharoSystemFeaturesTokenSpaceGuid.PcdIntelMeDefaultState
gDasharoSystemFeaturesTokenSpaceGuid.PcdIntelMeHapAvailable
gDasharoSystemFeaturesTokenSpaceGuid.PcdS3SupportExperimental
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowLockBios
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowSmmBwp
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowFum
gDasharoSystemFeaturesTokenSpaceGuid.PcdShowPs2Option
gDasharoPayloadPkgTokenSpaceGuid.PcdLoadOptionRoms
@@ -86,17 +86,21 @@ formset
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
checkbox varid = FeaturesData.LockBios,
prompt = STRING_TOKEN(STR_LOCK_BIOS_PROMPT),
help = STRING_TOKEN(STR_LOCK_BIOS_HELP),
flags = CHECKBOX_DEFAULT | RESET_REQUIRED,
endcheckbox;
suppressif ideqval FeaturesData.ShowLockBios == 0;
checkbox varid = FeaturesData.LockBios,
prompt = STRING_TOKEN(STR_LOCK_BIOS_PROMPT),
help = STRING_TOKEN(STR_LOCK_BIOS_HELP),
flags = CHECKBOX_DEFAULT | RESET_REQUIRED,
endcheckbox;
endif;
checkbox varid = FeaturesData.SmmBwp,
prompt = STRING_TOKEN(STR_SMM_BWP_PROMPT),
help = STRING_TOKEN(STR_SMM_BWP_HELP),
flags = RESET_REQUIRED,
endcheckbox;
suppressif ideqval FeaturesData.ShowSmmBwp == 0;
checkbox varid = FeaturesData.SmmBwp,
prompt = STRING_TOKEN(STR_SMM_BWP_PROMPT),
help = STRING_TOKEN(STR_SMM_BWP_HELP),
flags = RESET_REQUIRED,
endcheckbox;
endif;
suppressif ideqval FeaturesData.SecurityMenuShowIommu == 0;
checkbox name = IommuEnable,
@@ -139,14 +143,16 @@ formset
endcheckbox;
endif;
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
suppressif ideqval FeaturesData.ShowFum == 0;
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
text
help = STRING_TOKEN(STR_FUM_HELP),
text = STRING_TOKEN(STR_FUM_PROMPT),
flags = INTERACTIVE,
key = FIRMWARE_UPDATE_MODE_QUESTION_ID;
text
help = STRING_TOKEN(STR_FUM_HELP),
text = STRING_TOKEN(STR_FUM_PROMPT),
flags = INTERACTIVE,
key = FIRMWARE_UPDATE_MODE_QUESTION_ID;
endif;
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
@@ -224,11 +230,13 @@ formset
subtitle text = STRING_TOKEN(STR_EMPTY_STRING);
checkbox varid = FeaturesData.Ps2Controller,
prompt = STRING_TOKEN(STR_PS2_CONTROLLER_ENABLE_PROMPT),
help = STRING_TOKEN(STR_PS2_CONTROLLER_ENABLE_HELP),
flags = CHECKBOX_DEFAULT | RESET_REQUIRED,
endcheckbox;
suppressif ideqval FeaturesData.ShowPs2Option == 0;
checkbox varid = FeaturesData.Ps2Controller,
prompt = STRING_TOKEN(STR_PS2_CONTROLLER_ENABLE_PROMPT),
help = STRING_TOKEN(STR_PS2_CONTROLLER_ENABLE_HELP),
flags = CHECKBOX_DEFAULT | RESET_REQUIRED,
endcheckbox;
endif;
suppressif ideqval FeaturesData.WatchdogState == 0;
checkbox varid = FeaturesData.WatchdogConfig.WatchdogEnable,