Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Clover r2703: [PATCH] reduce code redundancy in Settings
From b9b70bc0df4f385c280ce32c71f6ddc5153e7bad Mon Sep 17 00:00:00 2001
From: Shikumo <shikumo@local.domain>
Date: Mon, 9 Jun 2014 11:13:28 +0200
Subject: [PATCH] reduce code redundancy in Settings
---
rEFIt_UEFI/Platform/Settings.c | 505 +++++++++++------------------------------
1 file changed, 138 insertions(+), 367 deletions(-)
diff --git a/rEFIt_UEFI/Platform/Settings.c b/rEFIt_UEFI/Platform/Settings.c
index 7a8800b..50076c0 100644
--- a/rEFIt_UEFI/Platform/Settings.c
+++ b/rEFIt_UEFI/Platform/Settings.c
@@ -97,6 +97,20 @@ UINT32 GetCrc32(UINT8 *Buffer, UINTN Size)
return x;
}
+BOOLEAN IsPropertyTrue(TagPtr prop)
+{
+ return (prop->type == kTagTypeTrue) ||
+ ((prop->type == kTagTypeString) && prop->string &&
+ ((prop->string[0] == 'y') || (prop->string[0] == 'Y')));
+}
+
+BOOLEAN IsPropertyFalse(TagPtr prop)
+{
+ return (prop->type == kTagTypeFalse) ||
+ ((prop->type == kTagTypeString) && prop->string &&
+ ((prop->string[0] == 'N') || (prop->string[0] == 'n')));
+}
+
VOID ParseLoadOptions(OUT CHAR16** conf, OUT TagPtr* dict)
{
CHAR8* start = (CHAR8*)SelfLoadedImage->LoadOptions;
@@ -491,9 +505,7 @@ static BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY *Entry, TagPtr dictP
}
prop = GetProperty(dictPointer, "Hidden");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_HIDDEN);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_HIDDEN);
@@ -501,9 +513,7 @@ static BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY *Entry, TagPtr dictP
}
prop = GetProperty(dictPointer, "Disabled");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_DISABLED);
@@ -597,9 +607,7 @@ static BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY *Entry, TagPtr dictP
if (OSTYPE_IS_OSX(Entry->Type) || OSTYPE_IS_OSX_RECOVERY(Entry->Type) || OSTYPE_IS_OSX_INSTALLER(Entry->Type)) {
prop = GetProperty(dictPointer, "InjectKexts");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_WITHKEXTS);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_WITHKEXTS);
@@ -607,9 +615,7 @@ static BOOLEAN FillinCustomEntry(IN OUT CUSTOM_LOADER_ENTRY *Entry, TagPtr dictP
}
prop = GetProperty(dictPointer, "NoCaches");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_NOCACHES);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_NOCACHES);
@@ -771,9 +777,7 @@ static BOOLEAN FillinCustomLegacy(IN OUT CUSTOM_LEGACY_ENTRY *Entry, TagPtr dict
}
prop = GetProperty(dictPointer, "Hidden");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_HIDDEN);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_HIDDEN);
@@ -781,9 +785,7 @@ static BOOLEAN FillinCustomLegacy(IN OUT CUSTOM_LEGACY_ENTRY *Entry, TagPtr dict
}
prop = GetProperty(dictPointer, "Disabled");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_DISABLED);
@@ -920,9 +922,7 @@ static BOOLEAN FillinCustomTool(IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr dictPoin
}
prop = GetProperty(dictPointer, "Hidden");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_HIDDEN);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_HIDDEN);
@@ -930,9 +930,7 @@ static BOOLEAN FillinCustomTool(IN OUT CUSTOM_TOOL_ENTRY *Entry, TagPtr dictPoin
}
prop = GetProperty(dictPointer, "Disabled");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
Entry->Flags = OSFLAG_SET(Entry->Flags, OSFLAG_DISABLED);
} else {
Entry->Flags = OSFLAG_UNSET(Entry->Flags, OSFLAG_DISABLED);
@@ -1027,35 +1025,27 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "Log");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.DebugLog = TRUE;
}
}
prop = GetProperty(dictPointer, "Fast");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.FastBoot = TRUE;
}
}
prop = GetProperty(dictPointer, "NeverHibernate");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.NeverHibernate = TRUE;
}
}
prop = GetProperty(dictPointer, "IgnoreNVRAMBoot");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.IgnoreNVRAMBoot = TRUE;
}
}
@@ -1203,18 +1193,14 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
//CustomIcons
prop = GetProperty(dictPointer, "CustomIcons");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.CustomIcons = TRUE;
}
}
prop = GetProperty(dictPointer, "TextOnly");
if (prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'Y') || (prop->string[0] == 'y')))) {
+ if (IsPropertyTrue(prop)) {
GlobalConfig.TextOnly = TRUE;
}
}
@@ -1300,17 +1286,13 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
//but we can disable mouse even if there was positive speed
dict2 = GetProperty(prop, "Enabled");
if (dict2) {
- if ((dict2->type == kTagTypeFalse) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'N') || (dict2->string[0] == 'n')))) {
+ if (IsPropertyFalse(dict2)) {
gSettings.PointerEnabled = FALSE;
}
}
dict2 = GetProperty(prop, "Mirror");
if (dict2) {
- if ((dict2->type == kTagTypeTrue) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'Y') || (dict2->string[0] == 'y')))) {
+ if (IsPropertyTrue(dict2)) {
gSettings.PointerMirror = TRUE;
}
}
@@ -1352,26 +1334,20 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
// Disable loader scan
prop = GetProperty(dictPointer, "Scan");
if (prop) {
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) && prop->string &&
- ((prop->string[0] == 'N') || (prop->string[0] == 'n')))) {
+ if (IsPropertyFalse(prop)) {
gSettings.DisableEntryScan = TRUE;
gSettings.DisableToolScan = TRUE;
GlobalConfig.NoLegacy = TRUE;
} else if (prop->type == kTagTypeDict) {
dict2 = GetProperty(prop, "Entries");
if (dict2) {
- if ((dict2->type == kTagTypeFalse) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'N') || (dict2->string[0] == 'n')))) {
+ if (IsPropertyFalse(dict2)) {
gSettings.DisableEntryScan = TRUE;
}
}
dict2 = GetProperty(prop, "Tool");
if (dict2) {
- if ((dict2->type == kTagTypeFalse) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'N') || (dict2->string[0] == 'n')))) {
+ if (IsPropertyFalse(dict2)) {
gSettings.DisableToolScan = TRUE;
}
}
@@ -1493,8 +1469,7 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "PatchVBios");
gSettings.PatchVBios = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- (prop->string[0] == 'y') || (prop->string[0] == 'Y'))
+ if (IsPropertyTrue(prop))
gSettings.PatchVBios = TRUE;
}
@@ -1566,8 +1541,7 @@ EFI_STATUS GetEarlyUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "InjectEDID");
gSettings.InjectEDID = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- (prop->string[0] == 'y') || (prop->string[0] == 'Y'))
+ if (IsPropertyTrue(prop))
gSettings.InjectEDID = TRUE;
}
prop = GetProperty(dictPointer, "CustomEDID");
@@ -1980,9 +1954,7 @@ STATIC EFI_STATUS GetThemeTagSettings(TagPtr dictPointer)
}
dict2 = GetProperty(dict, "OnTop");
if (dict2) {
- if ((dict2->type == kTagTypeTrue) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'Y') || (dict2->string[0] == 'y')))) {
+ if (IsPropertyTrue(dict2)) {
GlobalConfig.SelectionOnTop = TRUE;
}
}
@@ -2155,9 +2127,7 @@ STATIC EFI_STATUS GetThemeTagSettings(TagPtr dictPointer)
dict2 = GetProperty(dictPointer, "Once");
if (dict2) {
- if ((dict2->type == kTagTypeTrue) ||
- ((dict2->type == kTagTypeString) && dict2->string &&
- ((dict2->string[0] == 'Y') || (dict2->string[0] == 'y')))) {
+ if (IsPropertyTrue(dict2)) {
Anime->Once = TRUE;
}
}
@@ -2485,13 +2455,9 @@ VOID ParseSMBIOSSettings(TagPtr dictPointer)
}
prop = GetProperty(dictPointer,"Mobile");
if(prop) {
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop))
gSettings.Mobile = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ else if (IsPropertyTrue(prop))
gSettings.Mobile = TRUE;
}
prop = GetProperty(dictPointer,"LocationInChassis");
@@ -2548,9 +2514,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
// Inject kexts
prop = GetProperty(dictPointer, "InjectKexts");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop))
{
gSettings.WithKexts = TRUE;
} else if ((prop->type == kTagTypeString) &&
@@ -2567,9 +2531,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
// No caches
prop = GetProperty(dictPointer, "NoCaches");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.NoCaches = TRUE;
}
}
@@ -2583,9 +2545,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
if (dictPointer) {
dict2 = GetProperty(dictPointer, "Inject");
if(dict2) {
- if ((dict2->type == kTagTypeTrue) ||
- ((dict2->type == kTagTypeString) &&
- ((dict2->string[0] == 'y') || (dict2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(dict2)) {
gSettings.GraphicsInjector = TRUE;
gSettings.InjectIntel = TRUE;
gSettings.InjectATI = TRUE;
@@ -2593,9 +2553,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
} else if (dict2->type == kTagTypeDict) {
prop = GetProperty(dict2, "Intel");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.InjectIntel = TRUE;
} else {
gSettings.InjectIntel = FALSE;
@@ -2603,9 +2561,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "ATI");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.InjectATI = TRUE;
} else {
gSettings.InjectATI = FALSE;
@@ -2613,9 +2569,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "NVidia");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.InjectNVidia = TRUE;
} else {
gSettings.InjectNVidia = FALSE;
@@ -2651,9 +2605,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "LoadVBios");
gSettings.LoadVBios = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop))
gSettings.LoadVBios = TRUE;
}
for (i=0; i<NGFX; i++) {
@@ -2712,9 +2664,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "Inject");
gSettings.StringInjector = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop))
gSettings.StringInjector = TRUE;
}
prop = GetProperty(dictPointer, "Properties");
@@ -2741,9 +2691,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "NoDefaultProperties");
gSettings.NoDefaultProperties = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop))
gSettings.NoDefaultProperties = TRUE;
}
@@ -2862,9 +2810,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
if(prop) {
gSettings.UseIntelHDMI = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop))
gSettings.UseIntelHDMI = TRUE;
}
}
@@ -2909,9 +2855,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
if(prop) {
// enabled by default
// syntax: USBInjection=Yes/No
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N')))) {
+ if (IsPropertyFalse(prop)) {
gSettings.USBInjection = FALSE;
}
}
@@ -2919,13 +2863,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
if(prop) {
// disabled by default
// syntax: InjectClockID=Yes/No
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop))
gSettings.InjectClockID = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ else if (IsPropertyTrue(prop))
gSettings.InjectClockID = TRUE;
}
// enabled by default for CloverEFI or Duet
@@ -2933,13 +2873,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
gSettings.USBFixOwnership = gFirmwareClover || (StrCmp(gST->FirmwareVendor, L"EDK II") == 0);
prop = GetProperty(prop2, "FixOwnership");
if(prop) {
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop))
gSettings.USBFixOwnership = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ else if (IsPropertyTrue(prop)) {
gSettings.USBFixOwnership = TRUE;
DBG("USB FixOwnership: true\n");
}
@@ -2947,13 +2883,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(prop2, "HighCurrent");
if(prop) {
// disabled by default
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop))
gSettings.HighCurrent = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ else if (IsPropertyTrue(prop))
gSettings.HighCurrent = TRUE;
}
}
@@ -3068,17 +3000,13 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "Debug");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.DebugDSDT = TRUE;
}
}
prop = GetProperty(dict2, "Rtc8Allowed");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.Rtc8Allowed = TRUE;
}
}
@@ -3099,241 +3027,181 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
gSettings.FixDsdt = 0;
prop2 = GetProperty(prop, "AddDTGP_0001");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_DTGP;
}
}
prop2 = GetProperty(prop, "FixDarwin_0002");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_WARNING;
}
}
prop2 = GetProperty(prop, "FixShutdown_0004");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_SHUTDOWN;
}
}
prop2 = GetProperty(prop, "AddMCHC_0008");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_MCHC;
}
}
prop2 = GetProperty(prop, "FixHPET_0010");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_HPET;
}
}
prop2 = GetProperty(prop, "FakeLPC_0020");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_LPC;
}
}
prop2 = GetProperty(prop, "FixIPIC_0040");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_IPIC;
}
}
prop2 = GetProperty(prop, "FixSBUS_0080");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_SBUS;
}
}
prop2 = GetProperty(prop, "FixDisplay_0100");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_DISPLAY;
}
}
prop2 = GetProperty(prop, "FixIDE_0200");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_IDE;
}
}
prop2 = GetProperty(prop, "FixSATA_0400");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_SATA;
}
}
prop2 = GetProperty(prop, "FixFirewire_0800");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_FIREWIRE;
}
}
prop2 = GetProperty(prop, "FixUSB_1000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_USB;
}
}
prop2 = GetProperty(prop, "FixLAN_2000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_LAN;
}
}
prop2 = GetProperty(prop, "FixAirport_4000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_WIFI;
}
}
prop2 = GetProperty(prop, "FixHDA_8000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_HDA;
}
}
prop2 = GetProperty(prop, "FIX_DARWIN_10000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_WARNING;
}
}
prop2 = GetProperty(prop, "FIX_RTC_20000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_RTC;
}
}
prop2 = GetProperty(prop, "FIX_TMR_40000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_TMR;
}
}
prop2 = GetProperty(prop, "AddIMEI_80000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_IMEI;
}
}
prop2 = GetProperty(prop, "FIX_INTELGFX_100000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_INTELGFX;
}
}
prop2 = GetProperty(prop, "FIX_WAK_200000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_WAK;
}
}
prop2 = GetProperty(prop, "DeleteUnused_400000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_UNUSED;
}
}
prop2 = GetProperty(prop, "FIX_ADP1_800000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_ADP1;
}
}
prop2 = GetProperty(prop, "AddPNLF_1000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_PNLF;
}
}
prop2 = GetProperty(prop, "FIX_S3D_2000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_S3D;
}
}
prop2 = GetProperty(prop, "FIX_ACST_4000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_ACST;
}
}
prop2 = GetProperty(prop, "AddHDMI_8000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_HDMI;
}
}
prop2 = GetProperty(prop, "FixRegions_10000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_REGIONS;
}
}
prop2 = GetProperty(prop, "NewWay_80000000");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.FixDsdt |= FIX_NEW_WAY;
}
}
@@ -3374,26 +3242,20 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
} //if prop PatchesDSDT
prop = GetProperty(dict2, "ReuseFFFF");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.ReuseFFFF = TRUE;
}
}
prop = GetProperty(dict2, "SuspendOverride");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.SuspendOverride = TRUE;
}
}
/*
prop = GetProperty(dict2, "SlpSmiAtWake");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.SlpWak = TRUE;
}
}
@@ -3402,118 +3264,88 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
defDSM = FALSE;
if(prop) {
defDSM = TRUE;
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.DropOEM_DSM = 0xFFFF;
- } else if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N')))) {
+ } else if (IsPropertyFalse(prop)) {
gSettings.DropOEM_DSM = 0;
} else if (prop->type == kTagTypeInteger) {
gSettings.DropOEM_DSM = (UINT16)(UINTN)prop->string;
} else if (prop->type == kTagTypeDict) {
prop2 = GetProperty(prop, "ATI");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_ATI;
}
}
prop2 = GetProperty(prop, "NVidia");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_NVIDIA;
}
}
prop2 = GetProperty(prop, "IntelGFX");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_INTEL;
}
}
prop2 = GetProperty(prop, "HDA");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_HDA;
}
}
prop2 = GetProperty(prop, "HDMI");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_HDMI;
}
}
prop2 = GetProperty(prop, "SATA");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_SATA;
}
}
prop2 = GetProperty(prop, "LAN");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_LAN;
}
}
prop2 = GetProperty(prop, "WIFI");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_WIFI;
}
}
prop2 = GetProperty(prop, "USB");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_USB;
}
}
prop2 = GetProperty(prop, "LPC");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_LPC;
}
}
prop2 = GetProperty(prop, "SmBUS");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_SMBUS;
}
}
prop2 = GetProperty(prop, "Firewire");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_FIREWIRE;
}
}
prop2 = GetProperty(prop, "IDE");
if(prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.DropOEM_DSM |= DEV_IDE;
}
}
@@ -3525,22 +3357,16 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
if (dict2) {
prop2 = GetProperty(dict2, "Generate");
if (prop2) {
- if ((prop2->type == kTagTypeTrue) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'y') || (prop2->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop2)) {
gSettings.GeneratePStates = TRUE;
gSettings.GenerateCStates = TRUE;
- } else if ((prop2->type == kTagTypeFalse) ||
- ((prop2->type == kTagTypeString) &&
- ((prop2->string[0] == 'n') || (prop2->string[0] == 'N')))) {
+ } else if (IsPropertyFalse(prop2)) {
gSettings.GeneratePStates = FALSE;
gSettings.GenerateCStates = FALSE;
} else if (prop2->type == kTagTypeDict) {
prop = GetProperty(prop2, "PStates");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.GeneratePStates = TRUE;
} else {
gSettings.GeneratePStates = FALSE;
@@ -3548,9 +3374,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(prop2, "CStates");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.GenerateCStates = TRUE;
} else {
gSettings.GenerateCStates = FALSE;
@@ -3560,9 +3384,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "DropOem");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.DropSSDT = TRUE;
} else {
gSettings.DropSSDT = FALSE;
@@ -3570,9 +3392,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "UseSystemIO");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableISS = TRUE;
} else {
gSettings.EnableISS = FALSE;
@@ -3580,9 +3400,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "EnableC7");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC7 = TRUE;
} else {
gSettings.EnableC7 = FALSE;
@@ -3591,9 +3409,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "EnableC6");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC6 = TRUE;
} else {
gSettings.EnableC6 = FALSE;
@@ -3602,9 +3418,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "EnableC4");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC4 = TRUE;
} else {
gSettings.EnableC4 = FALSE;
@@ -3613,9 +3427,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "EnableC2");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC2 = TRUE;
} else {
gSettings.EnableC2 = FALSE;
@@ -3650,13 +3462,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dict2, "DoubleFirstState");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.DoubleFirstState = TRUE;
- } else if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N')))) {
+ } else if (IsPropertyFalse(prop)) {
gSettings.DoubleFirstState = FALSE;
}
}
@@ -3690,9 +3498,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dictPointer, "DropMCFG");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.DropMCFG = TRUE;
} else {
gSettings.DropMCFG = FALSE;
@@ -3730,9 +3536,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "HaltEnabler");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.SlpSmiEnable = TRUE;
}
}
@@ -3740,9 +3544,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "smartUPS");
gSettings.smartUPS = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.smartUPS = TRUE;
DBG("Config set smartUPS present\n");
}
@@ -3750,12 +3552,11 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "PatchAPIC");
// gSettings.PatchNMI = FALSE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ if (IsPropertyTrue(prop)) {
gSettings.PatchNMI = TRUE;
}
}
+ }
//*** SMBIOS ***//
dictPointer = GetProperty(dict,"SMBIOS");
@@ -3763,13 +3564,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
ParseSMBIOSSettings(dictPointer);
prop = GetProperty(dictPointer, "Trust");
if (prop) {
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop)) {
gSettings.TrustSMBIOS = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ } else if (IsPropertyTrue(prop)) {
gSettings.TrustSMBIOS = TRUE;
}
}
@@ -4022,9 +3819,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "C6");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC6 = TRUE;
} else {
gSettings.EnableC6 = FALSE;
@@ -4033,9 +3828,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "C4");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC4 = TRUE;
} else {
gSettings.EnableC4 = FALSE;
@@ -4044,9 +3837,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "C2");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.EnableC2 = TRUE;
DBG(" C2 enabled\n");
} else {
@@ -4096,34 +3887,26 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
gSettings.KPDebug = FALSE;
prop = GetProperty(dictPointer,"Debug");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))){
+ if (IsPropertyTrue(prop)){
gSettings.KPDebug = TRUE;
}
}
prop = GetProperty(dictPointer,"KernelCpu");
if(prop) {
gSettings.KPKernelCpu = FALSE; // disabled here because user set false and enabled by default
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))){
+ if (IsPropertyTrue(prop)){
gSettings.KPKernelCpu = TRUE;
}
}
prop = GetProperty(dictPointer,"KernelPm");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))){
+ if (IsPropertyTrue(prop)){
gSettings.KPKernelPm = TRUE;
}
}
prop = GetProperty(dictPointer,"KernelLapic");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))){
+ if (IsPropertyTrue(prop)){
gSettings.KPLapicPanic = TRUE;
}
}
@@ -4158,9 +3941,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
}
prop = GetProperty(dictPointer,"AsusAICPUPM");
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))){
+ if (IsPropertyTrue(prop)){
gSettings.KPAsusAICPUPM = TRUE;
}
}
@@ -4169,13 +3950,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer,"AppleRTC");
gSettings.KPAppleRTC = TRUE;
if(prop) {
- if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y')))) {
+ if (IsPropertyTrue(prop)) {
gSettings.KPAppleRTC = TRUE;
- } else if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N')))){
+ } else if (IsPropertyFalse(prop)){
gSettings.KPAppleRTC = FALSE;
}
}
@@ -4219,9 +3996,7 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
gSettings.KextPatches[gSettings.NrKexts].IsPlistPatch = FALSE;
dict2 = GetProperty(dictPointer, "InfoPlistPatch");
if(dict2) {
- if ((dict2->type == kTagTypeTrue) ||
- (dict2->string[0] == 'y') ||
- (dict2->string[0] == 'Y'))
+ if (IsPropertyTrue(dict2))
gSettings.KextPatches[gSettings.NrKexts].IsPlistPatch = TRUE;
}
@@ -4382,13 +4157,9 @@ EFI_STATUS GetUserSettings(IN EFI_FILE *RootDir, TagPtr CfgDict)
prop = GetProperty(dictPointer, "InjectSystemID");
if(prop) {
- if ((prop->type == kTagTypeFalse) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'n') || (prop->string[0] == 'N'))))
+ if (IsPropertyFalse(prop))
gSettings.InjectSystemID = FALSE;
- else if ((prop->type == kTagTypeTrue) ||
- ((prop->type == kTagTypeString) &&
- ((prop->string[0] == 'y') || (prop->string[0] == 'Y'))))
+ else if (IsPropertyTrue(prop))
gSettings.InjectSystemID = TRUE;
}
--
2.0.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.