add a possibility to set custom SmbiosVersion

Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
Sergey Isakov 2019-11-15 15:50:12 +03:00
parent 6221b7560f
commit 27c22a82e3
4 changed files with 20 additions and 6 deletions

View File

@ -932,6 +932,8 @@
</array> </array>
<key>SMBIOS</key> <key>SMBIOS</key>
<dict> <dict>
<key>#SmbiosVersion</key>
<integer>0x0206</integer>
<key>#Slots</key> <key>#Slots</key>
<array> <array>
<dict> <dict>

View File

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

View File

@ -4464,6 +4464,9 @@ ParseSMBIOSSettings(
DBG ("Using ProductName from clover: %a\n", gSettings.ProductName); DBG ("Using ProductName from clover: %a\n", gSettings.ProductName);
} }
Prop = GetProperty(DictPointer, "SmbiosVersion");
gSettings.SmbiosVersion = (UINT16)GetPropertyInteger(Prop, 0x204);
// Check for BiosVersion and BiosReleaseDate by Sherlocks // Check for BiosVersion and BiosReleaseDate by Sherlocks
Prop = GetProperty (DictPointer, "BiosVersion"); Prop = GetProperty (DictPointer, "BiosVersion");
if (Prop != NULL) { if (Prop != NULL) {

View File

@ -1086,7 +1086,7 @@ VOID PatchTableType11()
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64)); AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64));
AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:"); AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:");
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64)); AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.EfiVersion, iStrLen(gSettings.EfiVersion, 64));
AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n Board-ID : "); AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n Board-ID : ");
AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64)); AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.BoardNumber, iStrLen(gSettings.BoardNumber, 64));
AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover v2.5k %s\n", gFirmwareRevision); AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover v2.5k %s\n", gFirmwareRevision);
AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev); AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev);
@ -1156,7 +1156,7 @@ VOID PatchTableType16()
ZeroMem((VOID*)newSmbiosTable.Type16, MAX_TABLE_SIZE); ZeroMem((VOID*)newSmbiosTable.Type16, MAX_TABLE_SIZE);
CopyMem((VOID*)newSmbiosTable.Type16, (VOID*)SmbiosTable.Type16, TableSize); CopyMem((VOID*)newSmbiosTable.Type16, (VOID*)SmbiosTable.Type16, TableSize);
newSmbiosTable.Type16->Hdr.Handle = mHandle16; newSmbiosTable.Type16->Hdr.Handle = mHandle16;
// Slice - I am not sure I want these values // Slice - I am not sure if I want these values
// newSmbiosTable.Type16->Location = MemoryArrayLocationProprietaryAddonCard; // newSmbiosTable.Type16->Location = MemoryArrayLocationProprietaryAddonCard;
// newSmbiosTable.Type16->Use = MemoryArrayUseSystemMemory; // newSmbiosTable.Type16->Use = MemoryArrayUseSystemMemory;
// newSmbiosTable.Type16->MemoryErrorCorrection = MemoryErrorCorrectionMultiBitEcc; // newSmbiosTable.Type16->MemoryErrorCorrection = MemoryErrorCorrectionMultiBitEcc;
@ -1992,9 +1992,17 @@ EFI_STATUS PrepatchSmbios()
Current = (UINT8*)Smbios; //begin fill tables from here Current = (UINT8*)Smbios; //begin fill tables from here
SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current; SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current;
SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions
SmbiosEpsNew->MajorVersion = 2; if (gSettings.SmbiosVersion != 0) {
SmbiosEpsNew->MinorVersion = 4; SmbiosEpsNew->MajorVersion = (UINT8)(gSettings.SmbiosVersion >> 8);
SmbiosEpsNew->SmbiosBcdRevision = 0x24; //Slice - we want to have v2.6 but Apple still uses 2.4 SmbiosEpsNew->MinorVersion = (UINT8)(gSettings.SmbiosVersion & 0xFF);
SmbiosEpsNew->SmbiosBcdRevision = (SmbiosEpsNew->MajorVersion << 4) + SmbiosEpsNew->MinorVersion;
}
else {
//old behavior
SmbiosEpsNew->MajorVersion = 2;
SmbiosEpsNew->MinorVersion = 4;
SmbiosEpsNew->SmbiosBcdRevision = 0x24; //Slice - we want to have v2.6 but Apple still uses 2.4, let it be default value
}
//Create space for SPD //Create space for SPD
//gRAM = AllocateZeroPool(sizeof(MEM_STRUCTURE)); //gRAM = AllocateZeroPool(sizeof(MEM_STRUCTURE));