Chameleon

Chameleon Commit Details

Date:2010-08-29 10:12:46 (9 years 1 month ago)
Author:Kabyl
Commit:443
Parents: 442
Message:In some cases the SMBIOS reports a wrong number of memory slots, fix that by counting memory devices found in the SMBIOS table. Search for up to 12 slots (6 per CPU in a DP system). Merged changes from trunk@438
Changes:
M/branches/Kabyl/i386/boot2/graphics.c
M/branches/Kabyl
M/branches/Kabyl/i386/libsaio/spd.c
M/branches/Kabyl/i386/libsaio/platform.h
M/branches/Kabyl/i386/libsaio/disk.c
M/branches/Kabyl/i386/libsaio/smbios.c

File differences

branches/Kabyl/i386/libsaio/spd.c
1010
1111
1212
13
1314
1415
1516
......
256257
257258
258259
259
260
261
260
262261
262
263
263264
264265
265266
......
334335
335336
336337
337
338
338339
339340
340341
#include "pci.h"
#include "platform.h"
#include "spd.h"
#include "cpu.h"
#include "saio_internal.h"
#include "bootstruct.h"
#include "memvendors.h"
getBoolForKey("DumpSPD", &dump, &bootInfo->bootConfig);
bool fullBanks = // needed at least for laptops
Platform.DMI.MemoryModules == Platform.DMI.MaxMemorySlots;
// Search MAX_RAM_SLOTS slots
char spdbuf[256];
Platform.DMI.MemoryModules == Platform.DMI.CntMemorySlots;
char spdbuf[MAX_SPD_SIZE];
// Search MAX_RAM_SLOTS slots
for (i = 0; i < MAX_RAM_SLOTS; i++){
slot = &Platform.RAM.DIMM[i];
spd_size = smb_read_byte_intel(base, 0x50 + i, 0);
// 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 ?
i>0 && Platform.RAM.DIMM[1].InUse==false && fullBanks && Platform.DMI.CntMemorySlots == 2 ?
mapping[i] : i; // for laptops case, mapping setup would need to be more generic than this
slot->spd = NULL;
branches/Kabyl/i386/libsaio/platform.h
7878
7979
8080
81
81
8282
8383
8484
#define SMB_MEM_CHANNEL_TRIPLE3
/* Maximum number of ram slots */
#define MAX_RAM_SLOTS8
#define MAX_RAM_SLOTS12
#define RAM_SLOT_ENUMERATOR{0, 2, 4, 1, 3, 5, 6, 8, 10, 7, 9, 11}
/* Maximum number of SPD bytes */
branches/Kabyl/i386/libsaio/disk.c
17671767
17681768
17691769
1770
17701771
17711772
17721773
if ( matchVolumeToString(bvr, volStart, volLen) )
{
strncpy(str, aliasStart, min(strMaxLen, aliasLen));
str[min(strMaxLen, aliasLen)] = '\0';
free(aliasList);
return true;
branches/Kabyl/i386/libsaio/smbios.c
726726
727727
728728
729
729
730
731
730732
731733
732734
......
741743
742744
743745
746
744747
745748
746749
SMBStructHeader *structHeader = (SMBStructHeader *)structPtr;
int dimmnbr = 0;
Platform.DMI.MemoryModules = 0;
Platform.DMI.MaxMemorySlots= 0;
Platform.DMI.CntMemorySlots= 0;
Platform.DMI.MemoryModules= 0;
for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));)
{
break;
case kSMBTypeMemoryDevice:
Platform.DMI.CntMemorySlots++;
if (((SMBMemoryDevice *)structHeader)->memorySize != 0)
Platform.DMI.MemoryModules++;
if (((SMBMemoryDevice *)structHeader)->memorySpeed > 0)
branches/Kabyl/i386/boot2/graphics.c
12091209
12101210
12111211
1212
1212
1213
12131214
12141215
12151216
......
12181219
12191220
12201221
1221
1222
1223
12221224
12231225
12241226
{
currentIndicator = 0;
}
printf("%c\b", indicator[currentIndicator++]);
putc(indicator[currentIndicator++]);
putc('\b');
}
}
{
if ( getVideoMode() == VGA_TEXT_MODE )
{
printf(" \b");
putc(' ');
putc('\b');
}
}

Archive Download the corresponding diff file

Revision: 443