Chameleon

Chameleon Commit Details

Date:2010-02-21 23:36:50 (10 years 7 months ago)
Author:Rekursor
Commit:104
Parents: 103
Message:Added defined constant instead of literals, reverted ascii interpretation of serial numbers despites the docs seems to say it used the format mostly used.
Changes:
M/trunk/i386/libsaio/spd.c
M/trunk/i386/libsaio/platform.h

File differences

trunk/i386/libsaio/spd.c
7373
7474
7575
76
76
7777
7878
7979
8080
8181
8282
83
83
8484
8585
8686
......
101101
102102
103103
104
104
105105
106106
107107
......
114114
115115
116116
117
117
118118
119119
120120
......
139139
140140
141141
142
143
144
145
146
147
148
149
150
142
143
151144
152
153
154
155
156
157
158
159
160
145
146
161147
162148
163149
......
173159
174160
175161
176
162
177163
178
164
179165
180166
181167
int i = 0;
const char * spd = slot->spd;
if (spd[2]==0x0b) { // DDR3
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) { // DDR3
bank = spd[0x75];
code = spd[0x76];
for (i=0; i < VEN_MAP_SIZE; i++)
if (bank==vendorMap[i].bank && code==vendorMap[i].code)
return vendorMap[i].name;
}
else if (spd[2]==0x08 || spd[2]==0x07) { // DDR2 or DDR
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) {
if(spd[0x40]==0x7f) {
for (i=0x40; i<0x48 && spd[i]==0x7f;i++) bank++;
code = spd[i];
/** Get Default Memory Module Speed (no overclocking handled) */
int getDDRspeedMhz(const char * spd)
{
if (spd[2]==0x0b) { // DDR3
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) {
switch(spd[12]) {
case 0x0f:
return 1066;
return 800;
}
}
else if (spd[2]==0x08) { // DDR2
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) {
switch(spd[9]) {
case 0x50:
return 400;
static uint8_t serialnum=0;
uint32_t ret=0,i;
if (spd[2]==0x0b) {// DDR3
if ( isascii(spd[122]) && isascii(spd[123]) &&
isascii(spd[124]) && isascii(spd[125]) ) {
for(i=0; i<4; i++) asciiSerial[i] = spd[122+i];
asciiSerial[4] = 0;
return asciiSerial;
}
else // assume it is lsb to msb
ret = UIS(122) | (UIS(123)<<8) | (UIS(124)<<16) | ((UIS(125)&0x7f)<<24);
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3) {// DDR3
ret = UIS(122) | (UIS(123)<<8) | (UIS(124)<<16) | ((UIS(125)&0x7f)<<24);
}
else if (spd[2]==0x08 || spd[2]==0x07) { // DDR2 or DDR
if ( isascii(spd[95]) && isascii(spd[96]) &&
isascii(spd[97]) && isascii(spd[98]) ) {
for (i=0; i<4; i++) asciiSerial[i] = spd[95+i];
asciiSerial[4] = 0;
return asciiSerial;
}
else
ret = UIS(95) | (UIS(96)<<8) | (UIS(97)<<16) | ((UIS(98)&0x7f)<<24);
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2) { // DDR2 or DDR
ret = UIS(95) | (UIS(96)<<8) | (UIS(97)<<16) | ((UIS(98)&0x7f)<<24);
}
if (!ret) sprintf(asciiSerial, "10000000%d", serialnum++);
int i;
bool bZero = false;
if (spd[2]==0x0b) // DDR3
if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR3)
sPart = &spd[128];
else if (spd[2]==0x08 || spd[2]==0x07) // DDR2 or DDR
else if (spd[SPD_MEMORY_TYPE]==SPD_MEMORY_TYPE_SDRAM_DDR2)
sPart = &spd[73];
if (sPart) { // Check that the spd part name is zero terminated and that it is ascii:
for (i=0; i<32; i++) {
trunk/i386/libsaio/platform.h
6565
6666
6767
68
68
6969
7070
7171
#define SMB_MEM_CHANNEL_TRIPLE3
/* Maximum number of ram slots */
#define MAX_RAM_SLOTS12
#define MAX_RAM_SLOTS8
#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
/* Maximum number of SPD bytes */

Archive Download the corresponding diff file

Revision: 104