Skip to content
oandras.hu
Magyar nyelv
  • Home
  • Blog
  • Web
  • About me
oandras.hu
  • Home
  • Blog
  • Web
  • About me
Magyar nyelv

Clover EFI ver3322 with corrected DDR4 RAM size detection

I patched the Clover EFI bootloader, to get recognize the DDR4 RAM module size correctly, from the SPD datas.
diff --git a/rEFIt_UEFI/Platform/spd.c b/rEFIt_UEFI/Platform/spd.c
index 04c66d8..a7d389d 100644
--- a/rEFIt_UEFI/Platform/spd.c
+++ b/rEFIt_UEFI/Platform/spd.c

@@ -585,9 +585,24 @@ VOID read_smb(EFI_PCI_IO_PROTOCOL *PciIo)

case SPD_MEMORY_TYPE_SDRAM_DDR4:

+ DBG("SPD[%d]: spdbuf[4]: @0x%x n", i, spdbuf[4]);
+ DBG("SPD[%d]: spdbuf[5]: @0x%x n", i, spdbuf[5]);
+ DBG("SPD[%d]: spdbuf[12]: @0x%x n", i, spdbuf[12]);
gRAM.SPD[i].Type = MemoryTypeDdr4;
- gRAM.SPD[i].ModuleSize = spdbuf[4] & 0x0f;
- gRAM.SPD[i].ModuleSize = (1 << gRAM.SPD[i].ModuleSize) * 256;
+ // size = ((u64)rows * cols * banks * ranks) * bit;
+ // (spdbuf[4] & 0x30) >> 4 : bank address bits
+ // (spdbuf[4] & 0xC0) >> 6 : bank group bits
+ // banks = (4 << addressbits) * (1 << bank group bits)
+ // ((spdbuf[12] & 0x38) >> 3) :ranks
+ // (((spdbuf[5] & 0x38) >> 3)+12) :rows
+ // ((spdbuf[5] & 0x7)+9) : cols
+ gRAM.SPD[i].ModuleSize = (
+ (((UINT64)1 << (12 + ((spdbuf[ 5] & 0x38) >> 3))) *
+ (1 << (9 + ( spdbuf[ 5] & 0x07))) *
+ (1 + ((spdbuf[12] & 0x38) >> 3)) *
+ (4 << ((spdbuf[ 4] & 0x30) >> 4)) *
+ (1 << ((spdbuf[ 4] & 0xC0) >> 6))) >> (20 - 3)
+ );

break;

Posted: 2015.11.22.

Category: hackintosh, mac, prog

Tags: clover, efi, hackintosh, mac

András Oravecz 2019-09-06 2015-11-22

« Previous

Next »

GitHub
E-mail: [email protected]
Tel.: +36303822495
RSS
© 2010 - 2023 oandras.hu