/** Get Vendor Name from spd, 2 cases handled DDR3 and DDR2, have different formats, always return a valid ptr.*/ CHAR8* getVendorName(RAM_SLOT_INFO* slot, UINT8 *spd, UINT32 base, UINT8 slot_num) { UINT8 bank = 0; UINT8 code = 0; INTN i = 0; //UINT8 * spd = (UINT8 *) slot->spd; if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3 bank = (spd[SPD_DDR3_MEMORY_BANK] & 0x07f); // constructors like Patriot use b7=1 code = spd[SPD_DDR3_MEMORY_CODE]; for (i=0; i < VEN_MAP_SIZE; i++) if (bank==vendorMap[i].bank && code==vendorMap[i].code) return vendorMap[i].name; } else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2 || spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR) { if(spd[64]==0x7f) { for (i=64; i<72 && spd[i]==0x7f;i++) { bank++; READ_SPD(spd, base, slot_num, (UINT8)(i+1)); // prefetch next spd byte to read for next loop } READ_SPD(spd, base, slot_num, (UINT8)i); code = spd[i]; } else { code = spd[64]; bank = 0; } for (i=0; i < VEN_MAP_SIZE; i++) if (bank==vendorMap[i].bank && code==vendorMap[i].code) return vendorMap[i].name; } /* OK there is no vendor id here lets try to match the partnum if it exists */ if (AsciiStrStr(slot->PartNo,"GU332") == slot->PartNo) // Unifosa fingerprint return "Unifosa"; return "NoName"; }
/** Read from spd *used* values only*/ VOID init_spd(UINT8* spd, UINT32 base, UINT8 slot) { INTN i; for (i=0; i< SPD_INDEXES_SIZE; i++) { READ_SPD(spd, base, slot, spd_indexes[i]); } if (spd[SPD_MEMORY_TYPE] == SPD_MEMORY_TYPE_SDRAM_DDR4) { for (i = SPD_DDR4_MANUFACTURER_ID_CODE; i < SPD_DDR4_REVISION_CODE; i++) { READ_SPD(spd, base, slot, (UINT16)i); } } }
/** Read from spd *used* values only*/ VOID init_spd(UINT8* spd, UINT32 base, UINT8 slot) { INTN i; for (i=0; i< SPD_INDEXES_SIZE; i++) READ_SPD(spd, base, slot, spd_indexes[i]); }