From 27c22a82e3e82dc8d799d12a41f3e131f787fcda Mon Sep 17 00:00:00 2001 From: Sergey Isakov Date: Fri, 15 Nov 2019 15:50:12 +0300 Subject: [PATCH] add a possibility to set custom SmbiosVersion Signed-off-by: Sergey Isakov --- .../CloverV2/EFI/CLOVER/config-sample.plist | 2 ++ rEFIt_UEFI/Platform/Platform.h | 3 ++- rEFIt_UEFI/Platform/Settings.c | 3 +++ rEFIt_UEFI/Platform/smbios.c | 18 +++++++++++++----- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist b/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist index 9c636e80b..f0c9a1140 100644 --- a/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist +++ b/CloverPackage/CloverV2/EFI/CLOVER/config-sample.plist @@ -932,6 +932,8 @@ SMBIOS + #SmbiosVersion + 0x0206 #Slots diff --git a/rEFIt_UEFI/Platform/Platform.h b/rEFIt_UEFI/Platform/Platform.h index 9428fcefa..4ed8f548e 100644 --- a/rEFIt_UEFI/Platform/Platform.h +++ b/rEFIt_UEFI/Platform/Platform.h @@ -922,8 +922,9 @@ typedef struct { BOOLEAN UserChange; BOOLEAN QEMU; // SMBIOS TYPE17 + UINT16 SmbiosVersion; INT8 Attribute; - INT8 Pad17[3]; + INT8 Pad17[1]; CHAR8 MemoryManufacturer[64]; CHAR8 MemorySerialNumber[64]; CHAR8 MemoryPartNumber[64]; diff --git a/rEFIt_UEFI/Platform/Settings.c b/rEFIt_UEFI/Platform/Settings.c index 4f123c7e4..ca1ebacad 100644 --- a/rEFIt_UEFI/Platform/Settings.c +++ b/rEFIt_UEFI/Platform/Settings.c @@ -4464,6 +4464,9 @@ ParseSMBIOSSettings( 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 Prop = GetProperty (DictPointer, "BiosVersion"); if (Prop != NULL) { diff --git a/rEFIt_UEFI/Platform/smbios.c b/rEFIt_UEFI/Platform/smbios.c index bd75a75ff..c605a1653 100644 --- a/rEFIt_UEFI/Platform/smbios.c +++ b/rEFIt_UEFI/Platform/smbios.c @@ -1086,7 +1086,7 @@ VOID PatchTableType11() AsciiStrnCatS(OEMString, MAX_OEM_STRING, gSettings.RomVersion, iStrLen(gSettings.RomVersion, 64)); AsciiStrCatS(OEMString, MAX_OEM_STRING, "\n EFI Version:"); 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)); AsciiSPrint(TempRev, MAX_OEM_STRING, "\n⌘ Powered by Clover v2.5k %s\n", gFirmwareRevision); AsciiStrCatS(OEMString, MAX_OEM_STRING, TempRev); @@ -1156,7 +1156,7 @@ VOID PatchTableType16() ZeroMem((VOID*)newSmbiosTable.Type16, MAX_TABLE_SIZE); CopyMem((VOID*)newSmbiosTable.Type16, (VOID*)SmbiosTable.Type16, TableSize); 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->Use = MemoryArrayUseSystemMemory; // newSmbiosTable.Type16->MemoryErrorCorrection = MemoryErrorCorrectionMultiBitEcc; @@ -1992,9 +1992,17 @@ EFI_STATUS PrepatchSmbios() Current = (UINT8*)Smbios; //begin fill tables from here SmbiosEpsNew->TableAddress = (UINT32)(UINTN)Current; SmbiosEpsNew->EntryPointLength = sizeof(SMBIOS_TABLE_ENTRY_POINT); // no matter on other versions - SmbiosEpsNew->MajorVersion = 2; - SmbiosEpsNew->MinorVersion = 4; - SmbiosEpsNew->SmbiosBcdRevision = 0x24; //Slice - we want to have v2.6 but Apple still uses 2.4 + if (gSettings.SmbiosVersion != 0) { + SmbiosEpsNew->MajorVersion = (UINT8)(gSettings.SmbiosVersion >> 8); + 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 //gRAM = AllocateZeroPool(sizeof(MEM_STRUCTURE));