Chameleon

Chameleon Commit Details

Date:2010-02-19 08:38:25 (9 years 5 months ago)
Author:Rekursor
Commit:91
Parents: 90
Message:Fixed DDR2 ram would not detect correctly ven and part names
Changes:
M/trunk/i386/libsaio/spd.c

File differences

trunk/i386/libsaio/spd.c
8282
8383
8484
85
8586
8687
8788
8889
89
90
91
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
92105
93106
94107
......
136149
137150
138151
152
153
154
155
156
157
158
159
139160
140161
141162
......
175196
176197
177198
178
199
179200
180201
181202
......
185206
186207
187208
188
209
189210
190211
191212
......
216237
217238
218239
219
240
220241
221242
222243
......
228249
229250
230251
231
252
253
232254
233255
234256
......
237259
238260
239261
240
241262
242263
243264
244265
245266
267
268
269
270
246271
247272
248273
249274
250
251275
252276
253277
......
258282
259283
260284
261
285
286
262287
263288
264289
#define SMBHSTADD 4
#define SMBHSTDAT 5
const char * getVendorName(const char * spd)
{
uint16_t code = *((uint16_t*) &spd[0x75]);
int i;
for (i=0; i < VEN_MAP_SIZE; i++)
if (code==vendorMap[i].code)
return vendorMap[i].name;
uint16_t bank=0;
if (spd[2]==0x0b) { // DDR3
for (i=0; i < VEN_MAP_SIZE; i++)
if (code==vendorMap[i].code)
return vendorMap[i].name;
}
else if (spd[2]==0x08 || spd[2]==0x07) { // DDR2 or DDR
for (i=64; i<72 && spd[i]==0x7f;i++) bank++;
code = bank+((uint16_t)spd[i])*256;
for (i=0; i < VEN_MAP_SIZE; i++)
if (code==vendorMap[i].code)
return vendorMap[i].name;
}
return "No Name";
}
return ret;
}
char * getDDRPartNum(const char* spd)
{
if (spd[2]==0x0b) // DDR3
return &spd[128];
else if (spd[2]==0x08 || spd[2]==0x07) // DDR2 or DDR
return &spd[73];
return "";
}
unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd)
{
int l1, h1, l2, h2;
base = pci_config_read16(smbus_dev->dev.addr, 0x20) & 0xFFFE;
DBG("Scanning smbus_dev <%04x, %04x> ...\n",smbus_dev->vendor_id, smbus_dev->device_id);
getBoolForKey("DumpSPD", &dump, &bootInfo->bootConfig);
// Search MAX_RAM_SLOTS slots
spd_size = smb_read_byte_intel(base, 0x50 + i, 0);
// Check spd is present
if (spd_size != 0xff)
if (spd_size && spd_size != 0xff)
{
slot->InUse = true;
spd_type = (slot->spd[SPD_MEMORY_TYPE] < ((char) 12) ? slot->spd[SPD_MEMORY_TYPE] : 0);
slot->Type = spd_mem_to_smbios[spd_type];
strncpy(slot->PartNo, &slot->spd[0x80], 64);
strncpy(slot->PartNo, getDDRPartNum(slot->spd), 64);
strncpy(slot->Vendor, getVendorName(slot->spd), 64);
ser = getDDRSerial(slot->spd);
sprintf(slot->SerialNo, "%d", ser);
// determine speed
slot->Frequency = getDDRspeedMhz(slot->spd);
verbose("Slot %d Type %d %dMB (%s) %dMHz Vendor=%s, PartNo=%s SerialNo=%s\n",
if(dump) {
printf("Slot %d Type %d %dMB (%s) %dMHz Vendor=%s, PartNo=%s SerialNo=%s\n",
i,
(int)slot->Type,
slot->ModuleSize,
slot->Vendor,
slot->PartNo,
slot->SerialNo);
if(dump) {
dumpPhysAddr("spd content: ",slot->spd, spd_size);
getc();
}
}
}
#if DEBUG_SPD
printf("Press a key to continue\n");
getc();
#endif
}
static struct smbus_controllers_t smbus_controllers[] = {
{0x8086, 0x5032, "EP80579", read_smb_intel },
{0x8086, 0x269B, "ESB2", read_smb_intel },
{0x8086, 0x25A4, "6300ESB", read_smb_intel },
{0x8086, 0x24C3, "ICH4", read_smb_intel },
{0x8086, 0x2930, "ICH9", read_smb_intel },
{0x8086, 0x3A30, "ICH10R", read_smb_intel },
{0x8086, 0x3A60, "ICH10B", read_smb_intel },
{0x8086, 0x3B30, "P55", read_smb_intel }
{0x8086, 0x3B30, "P55", read_smb_intel },
{0x8086, 0x5032, "EP80579", read_smb_intel }
};

Archive Download the corresponding diff file

Revision: 91