implemented setting for MemoryRank,

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2019-11-15 15:17:19 +03:00
parent 5864939127
commit b816917205
4 changed files with 31 additions and 18 deletions

View File

@ -989,6 +989,8 @@
<string>MacBook1,1</string>
<key>#LocationInChassis</key>
<string>MLB</string>
<key>#MemoryRank</key>
<integer>2</integer>
<key>#Memory</key>
<dict>
<key>Modules</key>

View File

@ -922,6 +922,8 @@ typedef struct {
BOOLEAN UserChange;
BOOLEAN QEMU;
// SMBIOS TYPE17
INT8 Attribute;
INT8 Pad17[3];
CHAR8 MemoryManufacturer[64];
CHAR8 MemorySerialNumber[64];
CHAR8 MemoryPartNumber[64];

View File

@ -1077,30 +1077,30 @@ FillinKextPatches (IN OUT KERNEL_AND_KEXT_PATCHES *Patches,
INTN i, Count = GetTagCount (Prop);
//delete old and create new
if (Patches->KextPatches) {
for (i = 0; i < Patches->NrKexts; i++) {
if (Patches->KextPatches[i].Name) {
FreePool(Patches->KextPatches[i].Name);
}
if (Patches->KextPatches[i].Label) {
FreePool(Patches->KextPatches[i].Label);
for (i = 0; i < Patches->NrKexts; i++) {
if (Patches->KextPatches[i].Name) {
FreePool(Patches->KextPatches[i].Name);
}
if (Patches->KextPatches[i].Data) {
FreePool(Patches->KextPatches[i].Data);
if (Patches->KextPatches[i].Label) {
FreePool(Patches->KextPatches[i].Label);
}
if (Patches->KextPatches[i].Patch) {
FreePool(Patches->KextPatches[i].Patch);
if (Patches->KextPatches[i].Data) {
FreePool(Patches->KextPatches[i].Data);
}
if (Patches->KextPatches[i].MaskFind) {
FreePool(Patches->KextPatches[i].MaskFind);
if (Patches->KextPatches[i].Patch) {
FreePool(Patches->KextPatches[i].Patch);
}
if (Patches->KextPatches[i].MaskReplace) {
FreePool(Patches->KextPatches[i].MaskReplace);
if (Patches->KextPatches[i].MaskFind) {
FreePool(Patches->KextPatches[i].MaskFind);
}
if (Patches->KextPatches[i].MatchOS) {
FreePool(Patches->KextPatches[i].MatchOS);
if (Patches->KextPatches[i].MaskReplace) {
FreePool(Patches->KextPatches[i].MaskReplace);
}
if (Patches->KextPatches[i].MatchBuild) {
FreePool(Patches->KextPatches[i].MatchBuild);
if (Patches->KextPatches[i].MatchOS) {
FreePool(Patches->KextPatches[i].MatchOS);
}
if (Patches->KextPatches[i].MatchBuild) {
FreePool(Patches->KextPatches[i].MatchBuild);
}
}
Patches->NrKexts = 0;
@ -5985,6 +5985,9 @@ GetUserSettings(
gSettings.TrustSMBIOS = TRUE;
}
}
Prop = GetProperty(DictPointer, "MemoryRank");
gSettings.Attribute = GetPropertyInteger(Prop, -1); //1==Single Rank, 2 == Dual Rank, 0==undefined -1 == keep as is
// Inject memory tables into SMBIOS
Prop = GetProperty (DictPointer, "Memory");
if (Prop != NULL){

View File

@ -1227,6 +1227,9 @@ VOID GetTableType17()
if (SmbiosTable.Type17->Size > 0) {
gRAM.SMBIOS[Index].InUse = TRUE;
gRAM.SMBIOS[Index].ModuleSize = SmbiosTable.Type17->Size;
if (SmbiosTable.Type17->Size == 0x7FFF) {
gRAM.SMBIOS[Index].ModuleSize = SmbiosTable.Type17->ExtendedSize;
}
}
// Determine if module frequency is sane value
if ((SmbiosTable.Type17->Speed > 0) && (SmbiosTable.Type17->Speed <= MAX_RAM_FREQUENCY)) {
@ -1668,6 +1671,9 @@ VOID PatchTableType17()
// DBG("mTotalSystemMemory = %d\n", mTotalSystemMemory);
}
newSmbiosTable.Type17->MemoryErrorInformationHandle = 0xFFFF;
if (gSettings.Attribute != -1) {
newSmbiosTable.Type17->Attributes = gSettings.Attribute;
}
mHandle17[gRAMCount++] = LogSmbiosTable(newSmbiosTable);
}
if (mTotalSystemMemory > 0) {