Chameleon

Chameleon Commit Details

Date:2010-09-22 18:17:59 (13 years 6 months ago)
Author:Evan Lojewski
Commit:540
Parents: 539
Message:Removed kernel patcher message. Added a timeout for spd detection, was looping indefinately on my dell mini 10v.
Changes:
M/branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c
M/branches/meklort/i386/modules/Memory/spd.c
M/branches/meklort/i386/modules/Memory/Memory.c

File differences

branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c
676676
677677
678678
679
679
680680
681681
682682
kernSymbols_t *symbol = lookup_kernel_symbol("_commpage_stuff_routine");
if(symbol == 0 || symbol->addr == 0)
{
printf("Unable to locate %s\n", "_commpage_stuff_routine");
//printf("Unable to locate %s\n", "_commpage_stuff_routine");
return;
}
branches/meklort/i386/modules/Memory/spd.c
7171
7272
7373
74
7475
7576
7677
7778
7879
7980
80
81
82
83
84
85
86
8187
8288
8389
......
261267
262268
263269
270
264271
265272
266273
267274
268
275
269276
270277
271278
......
331338
332339
333340
334
335341
336342
337343
......
367373
368374
369375
370
376
371377
372378
373379
/** Read one byte from the intel i2c, used for reading SPD on intel chipsets only. */
unsigned char smb_read_byte_intel(uint32_t base, uint8_t adr, uint8_t cmd)
{
printf("smb_read_byte_intel\n");
int l1, h1, l2, h2;
unsigned long long t;
outb(base + SMBHSTSTS, 0x1f);// reset SMBus Controller
outb(base + SMBHSTDAT, 0xff);
while( inb(base + SMBHSTSTS) & 0x01);// wait until ready
while( inb(base + SMBHSTSTS) & 0x01)
{
rdtsc(l2, h2);
t = ((h2 - h1) * 0xffffffff + (l2 - l1)) / (Platform.CPU.TSCFrequency / 100);
if(t > 50) return 0xFF;// hack, exit if unresponsive.
}
outb(base + SMBHSTCMD, cmd);
outb(base + SMBHSTADD, (adr << 1) | 0x01 );
char spdbuf[256];
for (i = 0; i < MAX_RAM_SLOTS; i++){
DBG("Scanning slot %d\n", i);
slot = &Platform.RAM.DIMM[i];
spd_size = smb_read_byte_intel(base, 0x50 + i, 0);
// Check spd is present
if (spd_size && (spd_size != 0xff) ) {
printf("SPD is present\n");
slot->spd = spdbuf;
slot->InUse = true;
getc();
}
}
// laptops sometimes show slot 0 and 2 with slot 1 empty when only 2 slots are presents so:
Platform.DMI.DIMM[i]=
i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.MaxMemorySlots==2 ?
int i;
while (current) {
#if 0
#if DEBUG_SPD
printf("%02x:%02x.%x [%04x] [%04x:%04x] :: %s\n",
current->dev.bits.bus, current->dev.bits.dev, current->dev.bits.func,
current->class_id, current->vendor_id, current->device_id,
branches/meklort/i386/modules/Memory/Memory.c
4343
4444
4545
46
4647
}
scan_memory(&Platform); // unfortunately still necesary for some comp where spd cant read correct speed
scan_spd(&Platform);
}

Archive Download the corresponding diff file

Revision: 540