Separate ATI and NVIDIA card list.

Move MMIOWhiteList, ocBooterQuirks and QuirksMask in Quirks.
Remove MaxSlide as it already exist in ocBooterQuirks as
ProvideMaxSlide.
This commit is contained in:
jief666 2021-03-28 23:13:43 +03:00
parent e143fe8abd
commit 773f9bdaf7
8 changed files with 167 additions and 143 deletions

View File

@ -9,6 +9,7 @@
#include "../include/OSFlags.h"
#include "../include/OSTypes.h"
#include "../include/BootTypes.h"
#include "../include/QuirksCodes.h"
#include "../entry_scan/loader.h"
#include "../Platform/BootLog.h"
#include "../entry_scan/secureboot.h"
@ -2451,6 +2452,7 @@ GetEDIDSettings(const TagDict* DictPointer, SETTINGS_DATA& gSettings)
}
}
// Jief : GetEarlyUserSettings is ready to disappear...
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
EFI_STATUS GetEarlyUserSettings (
@ -3208,15 +3210,7 @@ EFI_STATUS GetEarlyUserSettings (
}
}
//done until here
gSettings.mmioWhiteListArray.setEmpty();
gSettings.Quirks.mmioWhiteListArray.setEmpty();
// const TagDict* OcQuirksDict = CfgDict->dictPropertyForKey("OcQuirks");
//if ( OcQuirksDict ) panic("config.plist/OcQuirks has been renamed Quirks. Update your config.plist");
@ -3226,59 +3220,59 @@ EFI_STATUS GetEarlyUserSettings (
const TagStruct* Prop;
Prop = OcQuirksDict->propertyForKey("AvoidRuntimeDefrag");
//if ( !Prop ) panic("Cannot find AvoidRuntimeDefrag in OcQuirks under root (OC booter quirks)");
gSettings.ocBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic
gSettings.QuirksMask |= gSettings.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag = !IsPropertyNotNullAndFalse(Prop); //true if absent so no panic
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag? QUIRK_DEFRAG:0;
Prop = OcQuirksDict->propertyForKey( "DevirtualiseMmio");
gSettings.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0;
gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio? QUIRK_MMIO:0;
Prop = OcQuirksDict->propertyForKey( "DisableSingleUser");
gSettings.ocBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.DisableSingleUser? QUIRK_SU:0;
gSettings.Quirks.ocBooterQuirks.DisableSingleUser = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableSingleUser? QUIRK_SU:0;
Prop = OcQuirksDict->propertyForKey( "DisableVariableWrite");
gSettings.ocBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.DisableVariableWrite? QUIRK_VAR:0;
gSettings.Quirks.ocBooterQuirks.DisableVariableWrite = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DisableVariableWrite? QUIRK_VAR:0;
Prop = OcQuirksDict->propertyForKey( "DiscardHibernateMap");
gSettings.ocBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0;
gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap? QUIRK_HIBER:0;
Prop = OcQuirksDict->propertyForKey( "EnableSafeModeSlide");
gSettings.ocBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0;
gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide? QUIRK_SAFE:0;
Prop = OcQuirksDict->propertyForKey( "EnableWriteUnprotector");
gSettings.ocBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0;
gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector? QUIRK_UNPROT:0;
Prop = OcQuirksDict->propertyForKey( "ForceExitBootServices");
gSettings.ocBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0;
gSettings.Quirks.ocBooterQuirks.ForceExitBootServices = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ForceExitBootServices? QUIRK_EXIT:0;
Prop = OcQuirksDict->propertyForKey( "ProtectMemoryRegions");
gSettings.ocBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0;
gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions? QUIRK_REGION:0;
Prop = OcQuirksDict->propertyForKey( "ProtectSecureBoot");
gSettings.ocBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0;
gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot? QUIRK_SECURE:0;
Prop = OcQuirksDict->propertyForKey( "ProtectUefiServices");
gSettings.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0;
gSettings.Quirks.ocBooterQuirks.ProtectUefiServices = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProtectUefiServices? QUIRK_UEFI:0;
//it is in GUI section
// Prop = OcQuirksDict->propertyForKey( "ProvideConsoleGopEnable");
// settingsData.ProvideConsoleGop = !IsPropertyNotNullAndFalse(Prop);
Prop = OcQuirksDict->propertyForKey( "ProvideCustomSlide");
gSettings.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide? QUIRK_CUSTOM:0;
Prop = OcQuirksDict->propertyForKey( "ProvideMaxSlide");
gSettings.ocBooterQuirks.ProvideMaxSlide = (UINT8)GetPropertyAsInteger(Prop, 0); // cast will be safe when the new parser will ensure that the value is UINT8
gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide = (UINT8)GetPropertyAsInteger(Prop, 0); // cast will be safe when the new parser will ensure that the value is UINT8
Prop = OcQuirksDict->propertyForKey( "RebuildAppleMemoryMap");
gSettings.ocBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0;
gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap? QUIRK_MAP:0;
Prop = OcQuirksDict->propertyForKey( "SetupVirtualMap");
gSettings.ocBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0;
gSettings.Quirks.ocBooterQuirks.SetupVirtualMap = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SetupVirtualMap? QUIRK_VIRT:0;
Prop = OcQuirksDict->propertyForKey( "SignalAppleOS");
gSettings.ocBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.SignalAppleOS? QUIRK_OS:0;
gSettings.Quirks.ocBooterQuirks.SignalAppleOS = IsPropertyNotNullAndTrue(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SignalAppleOS? QUIRK_OS:0;
Prop = OcQuirksDict->propertyForKey( "SyncRuntimePermissions");
gSettings.ocBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop);
gSettings.QuirksMask |= gSettings.ocBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0;
gSettings.mmioWhiteListArray.setEmpty();
gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions = !IsPropertyNotNullAndFalse(Prop);
gSettings.Quirks.QuirksMask |= gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions? QUIRK_PERM:0;
gSettings.Quirks.mmioWhiteListArray.setEmpty();
const TagArray* Dict2 = OcQuirksDict->arrayPropertyForKey("MmioWhitelist"); // array of dict
if (Dict2 != NULL) {
@ -3290,8 +3284,8 @@ EFI_STATUS GetEarlyUserSettings (
for (INTN i = 0; i < Count; i++)
{
const TagDict* Dict3 = Dict2->dictElementAt(i, "MmioWhitelist"_XS8);
MMIOWhiteList* mmioWhiteListPtr = new MMIOWhiteList();
MMIOWhiteList& mmioWhiteList = *mmioWhiteListPtr;
SETTINGS_DATA::QuirksClass::MMIOWhiteList* mmioWhiteListPtr = new SETTINGS_DATA::QuirksClass::MMIOWhiteList();
SETTINGS_DATA::QuirksClass::MMIOWhiteList& mmioWhiteList = *mmioWhiteListPtr;
const TagStruct* Prop2 = Dict3->propertyForKey("Comment");
if (Prop2 != NULL && Prop2->isString() && Prop2->getString()->stringValue().notEmpty()) {
@ -3306,7 +3300,7 @@ EFI_STATUS GetEarlyUserSettings (
Prop2 = Dict3->propertyForKey("Enabled");
mmioWhiteList.enabled = IsPropertyNotNullAndTrue(Prop2);
}
gSettings.mmioWhiteListArray.AddReference(mmioWhiteListPtr, true);
gSettings.Quirks.mmioWhiteListArray.AddReference(mmioWhiteListPtr, true);
}
}
}
@ -4418,7 +4412,6 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
gSettings.Boot.NeverDoRecovery = IsPropertyNotNullAndTrue(Prop);
}
//Graphics
const TagDict* GraphicsDict = CfgDict->dictPropertyForKey("Graphics");
@ -4427,11 +4420,10 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
const TagStruct* Prop = GraphicsDict->propertyForKey("Inject");
if (Prop != NULL) {
if (IsPropertyNotNullAndTrue(Prop)) {
gSettings.Graphics.InjectAsBool = true;
// gSettings.GraphicsInjector = TRUE;
// gSettings.InjectIntel = TRUE;
// gSettings.InjectATI = TRUE;
// gSettings.InjectNVidia = TRUE;
gSettings.Graphics.InjectAsDict.GraphicsInjector = TRUE;
gSettings.Graphics.InjectAsDict.InjectIntel = TRUE;
gSettings.Graphics.InjectAsDict.InjectATI = TRUE;
gSettings.Graphics.InjectAsDict.InjectNVidia = TRUE;
} else if (Prop->isDict()) {
const TagDict* Dict2 = Prop->getDict();
const TagStruct* Prop2 = Dict2->propertyForKey("Intel");
@ -4449,10 +4441,10 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
gSettings.Graphics.InjectAsDict.InjectNVidia = IsPropertyNotNullAndTrue(Prop2);
}
} else {
// gSettings.GraphicsInjector = FALSE;
// gSettings.InjectIntel = FALSE;
// gSettings.InjectATI = FALSE;
// gSettings.InjectNVidia = FALSE;
gSettings.Graphics.InjectAsDict.GraphicsInjector = FALSE;
gSettings.Graphics.InjectAsDict.InjectIntel = FALSE;
gSettings.Graphics.InjectAsDict.InjectATI = FALSE;
gSettings.Graphics.InjectAsDict.InjectNVidia = FALSE;
}
}
@ -4536,8 +4528,18 @@ EFI_STATUS GetUserSettings(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
Prop = GraphicsDict->propertyForKey("snb-platform-id");
gSettings.Graphics.IgPlatform = (UINT32)GetPropertyAsInteger(Prop, gSettings.Graphics.IgPlatform);
FillCardList(GraphicsDict); //#@ Getcardslist
FillCardList(GraphicsDict, gSettings); //#@ Getcardslist
}
//done until here
const TagDict* DevicesDict = CfgDict->dictPropertyForKey("Devices");
if (DevicesDict != NULL) {

View File

@ -18,24 +18,6 @@
#define CLOVER_SIGN SIGNATURE_32('C','l','v','r')
#define QUIRK_DEFRAG bit(0)
#define QUIRK_MMIO bit(1)
#define QUIRK_SU bit(2)
#define QUIRK_VAR bit(3)
#define QUIRK_HIBER bit(4)
#define QUIRK_SAFE bit(5)
#define QUIRK_UNPROT bit(6)
#define QUIRK_EXIT bit(7)
#define QUIRK_REGION bit(8)
#define QUIRK_SECURE bit(9)
#define QUIRK_UEFI bit(10)
#define QUIRK_CUSTOM bit(11)
#define QUIRK_MAP bit(12)
#define QUIRK_VIRT bit(13)
#define QUIRK_OS bit(14)
#define QUIRK_PERM bit(15)
//// SysVariables
//typedef struct SYSVARIABLES SYSVARIABLES;
//struct SYSVARIABLES
@ -408,21 +390,6 @@ public:
DEV_PROPERTY& operator=(const DEV_PROPERTY&) = delete;
};
class MMIOWhiteList
{
public :
UINTN address;
XString8 comment;
bool enabled;
MMIOWhiteList() : address(0), comment(), enabled(false) { }
// Not sure if default are valid. Delete them. If needed, proper ones can be created
MMIOWhiteList(const MMIOWhiteList&) = delete;
MMIOWhiteList& operator=(const MMIOWhiteList&) = delete;
};
/**
Set of Search & replace bytes for VideoBiosPatchBytes().
this is supposed to be a replacement of VBIOS_PATCH_BYTES, but that would need VbiosPatchLibrary to be update to C++. Quite easy, but need cpp_fundation to become a library. TODO
@ -674,6 +641,7 @@ public:
class InjectAsDictClass {
public:
bool GraphicsInjector = bool();
bool InjectIntel = bool();
bool InjectATI = bool();
bool InjectNVidia = bool();
@ -692,7 +660,7 @@ public:
bool PatchVBios = bool();
PatchVBiosBytesNewClass PatchVBiosBytes = PatchVBiosBytesNewClass();
undefinable_bool InjectAsBool = undefinable_bool();
// undefinable_bool InjectAsBool = undefinable_bool();
bool RadeonDeInit = bool();
bool LoadVBios = bool();
UINT64 VRAM = bool();
@ -709,13 +677,14 @@ public:
UINT32 IgPlatform = UINT32(); //could also be snb-platform-id
EDIDClass EDID = EDIDClass();
InjectAsDictClass InjectAsDict = InjectAsDictClass();
XObjArray<GRAPHIC_CARD> gCardList = XObjArray<GRAPHIC_CARD>();
XObjArray<GRAPHIC_CARD> ATICardList = XObjArray<GRAPHIC_CARD>();
XObjArray<GRAPHIC_CARD> NVIDIACardList = XObjArray<GRAPHIC_CARD>();
//bool getGraphicsInjector() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.GraphicsInjector; }
bool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; }
bool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; }
bool InjectNVidia() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectNVidia; }
//bool InjectIntel() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectIntel; }
//bool InjectATI() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectATI; }
//bool InjectNVidia() const { return InjectAsBool.isDefined() ? InjectAsBool.value() : InjectAsDict.InjectNVidia; }
};
@ -731,11 +700,23 @@ public:
class QuirksClass {
public:
class MMIOWhiteList
{
public :
UINTN address = 0;
XString8 comment = XString8();
bool enabled = 0;
};
bool FuzzyMatch = bool();
XString8 OcKernelCache = XString8();
// UINTN MaxSlide;
OC_KERNEL_QUIRKS OcKernelQuirks = OC_KERNEL_QUIRKS();
OC_BOOTER_QUIRKS ocBooterQuirks = OC_BOOTER_QUIRKS();
XObjArray<MMIOWhiteList> mmioWhiteListArray = XObjArray<MMIOWhiteList>();
UINT32 QuirksMask;
};
class RtVariablesClass {
public:
class RT_VARIABLES
@ -947,12 +928,6 @@ public:
DEV_PROPERTY *ArbProperties;
UINT32 QuirksMask;
UINTN MaxSlide;
OC_BOOTER_QUIRKS ocBooterQuirks;
XObjArray<MMIOWhiteList> mmioWhiteListArray;
SETTINGS_DATA() : VendorName(), RomVersion(), EfiVersion(), ReleaseDate(), ManufactureName(), ProductName(), VersionNr(), SerialNr(), SmUUID(),
@ -973,7 +948,7 @@ public:
ForceHPET(0), DisableFunctions(0), SlpWak(0), UseIntelHDMI(0),
AFGLowPowerState(0), NrAddProperties(0), AddProperties(0), BlockKexts{0},
IntelMaxValue(0), OptionsBits(0), FlagsBits(0), UIScale(0), EFILoginHiDPI(0), flagstate{0},
ArbProperties(0), QuirksMask(0), MaxSlide(0), ocBooterQuirks{0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0}, mmioWhiteListArray()
ArbProperties(0)
{};
SETTINGS_DATA(const SETTINGS_DATA& other) = delete; // Can be defined if needed
const SETTINGS_DATA& operator = ( const SETTINGS_DATA & ) = delete; // Can be defined if needed

View File

@ -82,8 +82,14 @@
const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD* FindCardWithIds(UINT32 Id, UINT32 SubId)
{
for ( size_t idx = 0; idx < gSettings.Graphics.gCardList.size(); ++idx ) {
const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD& entry = gSettings.Graphics.gCardList[idx];
for ( size_t idx = 0; idx < gSettings.Graphics.ATICardList.size(); ++idx ) {
const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD& entry = gSettings.Graphics.ATICardList[idx];
if(entry.Id == Id) {
return &entry;
}
}
for ( size_t idx = 0; idx < gSettings.Graphics.NVIDIACardList.size(); ++idx ) {
const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD& entry = gSettings.Graphics.NVIDIACardList[idx];
if(entry.Id == Id) {
return &entry;
}
@ -91,10 +97,19 @@ const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD* FindCardWithIds(UINT32 Id, UIN
return NULL;
}
void FillCardList(const TagDict* CfgDict)
/*
* To ease copy/paste and text replacement from GetUserSettings, the parameter has the same name as the global
* and is passed by non-const reference.
* This temporary during the refactoring
*/
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wshadow"
void FillCardList(const TagDict* CfgDict, SETTINGS_DATA& gSettings)
{
if (gSettings.Graphics.gCardList.isEmpty() && (CfgDict != NULL)) {
CONST CHAR8 *VEN[] = { "NVIDIA", "ATI" };
#pragma GCC diagnostic pop
if (gSettings.Graphics.ATICardList.isEmpty() && gSettings.Graphics.NVIDIACardList.isEmpty() && (CfgDict != NULL)) {
CONST CHAR8 *VEN[] = { "ATI", "NVIDIA" };
XObjArray<SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD>* cardlist[] = { &gSettings.Graphics.ATICardList, &gSettings.Graphics.NVIDIACardList };
size_t Count = sizeof(VEN) / sizeof(VEN[0]);
for (size_t Index = 0; Index < Count; Index++) {
@ -120,13 +135,13 @@ void FillCardList(const TagDict* CfgDict)
// BOOLEAN LoadVBios = FALSE;
element = &prop->arrayContent()[i];
if ( !element->isDict()) {
MsgLog("MALFORMED PLIST in FillCardList() : element is not a dict");
MsgLog("MALFORMED PLIST in FillCardList() : element[%lld] is not a dict\n", i);
continue;
}
const TagDict* dictElement = element->getDict();
prop2 = dictElement->propertyForKey("Model");
if ( prop2->isString() && prop2->getString()->stringValue().notEmpty() ) {
if ( prop2 && prop2->isString() && prop2->getString()->stringValue().notEmpty() ) {
new_card->Model = prop2->getString()->stringValue();
} else {
new_card->Model = "VideoCard"_XS8;
@ -159,7 +174,7 @@ void FillCardList(const TagDict* CfgDict)
// new_card->VideoPorts = VideoPorts;
// new_card->LoadVBios = LoadVBios;
// new_card->Model.takeValueFrom(model_name);
gSettings.Graphics.gCardList.AddReference(new_card, true);
cardlist[Index]->AddReference(new_card, true);
}
}
}

View File

@ -14,10 +14,7 @@
#define CARDLIST_SIGNATURE SIGNATURE_32('C','A','R','D')
void
FillCardList (
const TagDict* CfgDict
);
void FillCardList(const TagDict* CfgDict, SETTINGS_DATA& gSettings);
const SETTINGS_DATA::GraphicsClass::GRAPHIC_CARD*
FindCardWithIds (

View File

@ -0,0 +1,33 @@
/*
* QuirksCodes.h
*
* Created on: Mar 28, 2021
* Author: jief
*/
#ifndef INCLUDE_QUIRKSCODES_H_
#define INCLUDE_QUIRKSCODES_H_
#define QUIRK_DEFRAG bit(0)
#define QUIRK_MMIO bit(1)
#define QUIRK_SU bit(2)
#define QUIRK_VAR bit(3)
#define QUIRK_HIBER bit(4)
#define QUIRK_SAFE bit(5)
#define QUIRK_UNPROT bit(6)
#define QUIRK_EXIT bit(7)
#define QUIRK_REGION bit(8)
#define QUIRK_SECURE bit(9)
#define QUIRK_UEFI bit(10)
#define QUIRK_CUSTOM bit(11)
#define QUIRK_MAP bit(12)
#define QUIRK_VIRT bit(13)
#define QUIRK_OS bit(14)
#define QUIRK_PERM bit(15)
#endif /* INCLUDE_QUIRKSCODES_H_ */

View File

@ -47,6 +47,7 @@
include/XToolsConf.h
include/OC.h
include/printf_lite-test-cpp_conf.h
include/QuirksCodes.h
include/BootTypes.h
include/OSTypes.h
include/OSFlags.h

View File

@ -976,7 +976,7 @@ void LOADER_ENTRY::StartLoader()
#ifndef USE_OC_SECTION_Booter
mOpenCoreConfiguration.Booter.MmioWhitelist.Count = (UINT32)gSettings.mmioWhiteListArray.size();
mOpenCoreConfiguration.Booter.MmioWhitelist.Count = (UINT32)gSettings.Quirks.mmioWhiteListArray.size();
mOpenCoreConfiguration.Booter.MmioWhitelist.AllocCount = mOpenCoreConfiguration.Booter.MmioWhitelist.Count;
mOpenCoreConfiguration.Booter.MmioWhitelist.ValueSize = sizeof(__typeof_am__(**mOpenCoreConfiguration.Booter.MmioWhitelist.Values)); // sizeof(OC_KERNEL_ADD_ENTRY) == 680
if ( mOpenCoreConfiguration.Booter.MmioWhitelist.Count > 0 ) {
@ -984,8 +984,8 @@ void LOADER_ENTRY::StartLoader()
}else{
mOpenCoreConfiguration.Booter.MmioWhitelist.Values = NULL;
}
for ( size_t idx = 0 ; idx < gSettings.mmioWhiteListArray.size() ; idx++ ) {
const MMIOWhiteList& entry = gSettings.mmioWhiteListArray[idx];
for ( size_t idx = 0 ; idx < gSettings.Quirks.mmioWhiteListArray.size() ; idx++ ) {
const SETTINGS_DATA::QuirksClass::MMIOWhiteList& entry = gSettings.Quirks.mmioWhiteListArray[idx];
DBG("Bridge mmioWhiteList[%zu] to OC : comment=%s\n", idx, entry.comment.c_str());
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx] = (__typeof_am__(*mOpenCoreConfiguration.Booter.MmioWhitelist.Values))AllocatePool(mOpenCoreConfiguration.Booter.MmioWhitelist.ValueSize);
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Address = entry.address;
@ -993,8 +993,8 @@ void LOADER_ENTRY::StartLoader()
mOpenCoreConfiguration.Booter.MmioWhitelist.Values[idx]->Enabled = entry.enabled;
}
static_assert(sizeof(gSettings.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks), "sizeof(gSettings.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks)");
memcpy(&mOpenCoreConfiguration.Booter.Quirks, &gSettings.ocBooterQuirks, sizeof(mOpenCoreConfiguration.Booter.Quirks));
static_assert(sizeof(gSettings.Quirks.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks), "sizeof(gSettings.Quirks.ocBooterQuirks) == sizeof(mOpenCoreConfiguration.Booter.Quirks)");
memcpy(&mOpenCoreConfiguration.Booter.Quirks, &gSettings.Quirks.ocBooterQuirks, sizeof(mOpenCoreConfiguration.Booter.Quirks));
#endif

View File

@ -56,6 +56,7 @@
#include "../Platform/Nvram.h"
#include "../include/DsdtFixList.h"
#include "../include/Devices.h"
#include "../include/QuirksCodes.h"
#include "../Platform/boot.h"
#include "../Platform/Injectors.h"
#include "../Platform/KextList.h"
@ -389,7 +390,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = Hex; //100
InputItems[InputItemsCount++].SValue.SWPrintf("0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101 - Quirks
InputItems[InputItemsCount++].IValue = gSettings.QuirksMask; //
InputItems[InputItemsCount++].IValue = gSettings.Quirks.QuirksMask; //
InputItems[InputItemsCount].ItemType = BoolValue; //102
InputItems[InputItemsCount++].BValue = gSettings.ACPI.DSDT.DebugDSDT;
@ -442,7 +443,7 @@ void FillInputs(BOOLEAN New)
InputItems[InputItemsCount].ItemType = BoolValue; //121
InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump;
InputItems[InputItemsCount].ItemType = Decimal; //122
InputItems[InputItemsCount++].SValue.SWPrintf("%04lld", gSettings.MaxSlide);
InputItems[InputItemsCount++].SValue.SWPrintf("%04hhu", gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide);
InputItems[InputItemsCount].ItemType = BoolValue; //123
InputItems[InputItemsCount++].BValue = gSettings.GUI.ProvideConsoleGop;
@ -907,24 +908,24 @@ void ApplyInputs(void)
i++; //101 - Quirks
if (InputItems[i].Valid) {
gSettings.QuirksMask = InputItems[i].IValue;
gSettings.ocBooterQuirks.AvoidRuntimeDefrag = ((gSettings.QuirksMask & QUIRK_DEFRAG) != 0); //1
gSettings.ocBooterQuirks.DevirtualiseMmio = ((gSettings.QuirksMask & QUIRK_MMIO) != 0); //0
gSettings.ocBooterQuirks.DisableSingleUser = ((gSettings.QuirksMask & QUIRK_SU) != 0); //0
gSettings.ocBooterQuirks.DisableVariableWrite = ((gSettings.QuirksMask & QUIRK_VAR) != 0); //0
gSettings.ocBooterQuirks.DiscardHibernateMap = ((gSettings.QuirksMask & QUIRK_HIBER) != 0); //0
gSettings.ocBooterQuirks.EnableSafeModeSlide = ((gSettings.QuirksMask & QUIRK_SAFE) != 0); //1
gSettings.ocBooterQuirks.EnableWriteUnprotector = ((gSettings.QuirksMask & QUIRK_UNPROT) != 0); //1
gSettings.ocBooterQuirks.ForceExitBootServices = ((gSettings.QuirksMask & QUIRK_EXIT) != 0); //0
gSettings.ocBooterQuirks.ProtectMemoryRegions = ((gSettings.QuirksMask & QUIRK_REGION) != 0); //0
gSettings.ocBooterQuirks.ProtectSecureBoot = ((gSettings.QuirksMask & QUIRK_SECURE) != 0); //0
gSettings.ocBooterQuirks.ProtectUefiServices = ((gSettings.QuirksMask & QUIRK_UEFI) != 0); //0
gSettings.ocBooterQuirks.ProvideCustomSlide = ((gSettings.QuirksMask & QUIRK_CUSTOM) != 0); //1
gSettings.ocBooterQuirks.RebuildAppleMemoryMap = ((gSettings.QuirksMask & QUIRK_MAP) != 0); //0
gSettings.ocBooterQuirks.SetupVirtualMap = ((gSettings.QuirksMask & QUIRK_VIRT) != 0); //1
gSettings.ocBooterQuirks.SignalAppleOS = ((gSettings.QuirksMask & QUIRK_OS) != 0); //0
gSettings.ocBooterQuirks.SyncRuntimePermissions = ((gSettings.QuirksMask & QUIRK_PERM) != 0); //1
DBG("applied Quirks mask:%x\n", gSettings.QuirksMask); //default is 0xA861
gSettings.Quirks.QuirksMask = InputItems[i].IValue;
gSettings.Quirks.ocBooterQuirks.AvoidRuntimeDefrag = ((gSettings.Quirks.QuirksMask & QUIRK_DEFRAG) != 0); //1
gSettings.Quirks.ocBooterQuirks.DevirtualiseMmio = ((gSettings.Quirks.QuirksMask & QUIRK_MMIO) != 0); //0
gSettings.Quirks.ocBooterQuirks.DisableSingleUser = ((gSettings.Quirks.QuirksMask & QUIRK_SU) != 0); //0
gSettings.Quirks.ocBooterQuirks.DisableVariableWrite = ((gSettings.Quirks.QuirksMask & QUIRK_VAR) != 0); //0
gSettings.Quirks.ocBooterQuirks.DiscardHibernateMap = ((gSettings.Quirks.QuirksMask & QUIRK_HIBER) != 0); //0
gSettings.Quirks.ocBooterQuirks.EnableSafeModeSlide = ((gSettings.Quirks.QuirksMask & QUIRK_SAFE) != 0); //1
gSettings.Quirks.ocBooterQuirks.EnableWriteUnprotector = ((gSettings.Quirks.QuirksMask & QUIRK_UNPROT) != 0); //1
gSettings.Quirks.ocBooterQuirks.ForceExitBootServices = ((gSettings.Quirks.QuirksMask & QUIRK_EXIT) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectMemoryRegions = ((gSettings.Quirks.QuirksMask & QUIRK_REGION) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectSecureBoot = ((gSettings.Quirks.QuirksMask & QUIRK_SECURE) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProtectUefiServices = ((gSettings.Quirks.QuirksMask & QUIRK_UEFI) != 0); //0
gSettings.Quirks.ocBooterQuirks.ProvideCustomSlide = ((gSettings.Quirks.QuirksMask & QUIRK_CUSTOM) != 0); //1
gSettings.Quirks.ocBooterQuirks.RebuildAppleMemoryMap = ((gSettings.Quirks.QuirksMask & QUIRK_MAP) != 0); //0
gSettings.Quirks.ocBooterQuirks.SetupVirtualMap = ((gSettings.Quirks.QuirksMask & QUIRK_VIRT) != 0); //1
gSettings.Quirks.ocBooterQuirks.SignalAppleOS = ((gSettings.Quirks.QuirksMask & QUIRK_OS) != 0); //0
gSettings.Quirks.ocBooterQuirks.SyncRuntimePermissions = ((gSettings.Quirks.QuirksMask & QUIRK_PERM) != 0); //1
DBG("applied Quirks mask:%x\n", gSettings.Quirks.QuirksMask); //default is 0xA861
}
i++; //102
if (InputItems[i].Valid) {
@ -1056,8 +1057,8 @@ void ApplyInputs(void)
}
i++; //122
if (InputItems[i].Valid) {
gSettings.MaxSlide = (UINTN)StrDecimalToUintn(InputItems[i].SValue.wc_str());
DBG(" set MaxSlide = %lld\n", gSettings.MaxSlide);
gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide = (UINTN)StrDecimalToUintn(InputItems[i].SValue.wc_str());
DBG(" set MaxSlide = %hhu\n", gSettings.Quirks.ocBooterQuirks.ProvideMaxSlide);
}
i++; //123
if (InputItems[i].Valid) {
@ -2445,7 +2446,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuQuirks()
// create the entry in the main menu
Entry = newREFIT_MENU_ITEM_OPTIONS(&SubScreen, ActionEnter, SCREEN_QUIRKS, NullXString8);
Entry->Title.SWPrintf("Quirks mask [0x%04x]->", gSettings.QuirksMask);
Entry->Title.SWPrintf("Quirks mask [0x%04x]->", gSettings.Quirks.QuirksMask);
// submenu description
SubScreen->AddMenuInfoLine_f("Choose options to fix memory");