MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / getDDRSerial

Function getDDRSerial

rEFIt_UEFI/Platform/spd.cpp:540–556  ·  view source on GitHub ↗

Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */

Source from the content-addressed store, hash-verified

538
539/** Get DDR3 or DDR2 serial number, 0 most of the times, always return a valid ptr */
540CHAR8* getDDRSerial(UINT8* spd)
541{
542 CHAR8* asciiSerial; //[16];
543 asciiSerial = (__typeof__(asciiSerial))AllocatePool(17);
544 if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR4) { // DDR4
545 snprintf(asciiSerial, 17, "%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX", SMST(325) /*& 0x7*/, SLST(325), SMST(326), SLST(326), SMST(327), SLST(327), SMST(328), SLST(328));
546 } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
547 snprintf(asciiSerial, 17, "%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX", SMST(122) /*& 0x7*/, SLST(122), SMST(123), SLST(123), SMST(124), SLST(124), SMST(125), SLST(125));
548 } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 ||
549 spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { // DDR2 or DDR
550 snprintf(asciiSerial, 17, "%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX%01hhX", SMST(95) /*& 0x7*/, SLST(95), SMST(96), SLST(96), SMST(97), SLST(97), SMST(98), SLST(98));
551 } else {
552 AsciiStrCpyS(asciiSerial, 17, "0000000000000000");
553 }
554
555 return asciiSerial;
556}
557
558/** Get DDR2 or DDR3 or DDR4 Part Number, always return a valid ptr */
559CHAR8* getDDRPartNum(UINT8* spd, UINT32 base, UINT8 slot)

Callers 1

read_smbFunction · 0.85

Calls 3

snprintfFunction · 0.85
AsciiStrCpySFunction · 0.85
AllocatePoolFunction · 0.50

Tested by

no test coverage detected