Chameleon

Chameleon Commit Details

Date:2011-05-17 22:54:58 (8 years 6 months ago)
Author:Kabyl
Commit:828
Parents: 827
Message:Fixed a bug in the SMBIOS patcher where an empty string could mark the end of a record prematurely
Changes:
M/trunk/i386/libsaio/spd.c
M/trunk/i386/libsaio/fake_efi.c
M/trunk/i386/libsaio/smbios_getters.c
M/trunk/i386/libsaio/smbios.c
M/trunk/i386/libsaio/smbios_getters.h

File differences

trunk/i386/libsaio/smbios_getters.h
1010
1111
1212
13
14
1315
1416
1517
#define SMBIOS_RANGE_START 0x000F0000
#define SMBIOS_RANGE_END 0x000FFFFF
#define NOT_AVAILABLE"N/A"
typedef enum {
kSMBString,
kSMBByte,
trunk/i386/libsaio/spd.c
244244
245245
246246
247
248247
249248
250249
}
return strdup(asciiPartNo);
return NULL;
}
int mapping []= {0,2,1,3,4,6,5,7,8,10,9,11};
trunk/i386/libsaio/smbios.c
374374
375375
376376
377
377
378378
379379
380380
......
427427
428428
429429
430
430
431431
432432
433
434
435
436
437
438
433439
434440
435441
}
}
/* Used for SM*_N smbios.plist keys */
/* Used for SM*n smbios.plist keys */
bool getSMBValueForKey(SMBStructHeader *structHeader, const char *keyString, const char **string, returnType *value)
{
static int idx = -1;
strSize = strlen(string);
// remove any spaces found at the end
while (string[strSize - 1] == ' ')
while ((string[strSize - 1] == ' ') && strSize != 0)
strSize--;
if (strSize == 0)
{
*field = 0;
return;
}
memcpy((uint8_t *)structHeader + structHeader->length + stringsSize, string, strSize);
*field = stringIndex;
trunk/i386/libsaio/fake_efi.c
697697
698698
699699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
700729
701730
702731
......
707736
708737
709738
710
739
711740
712741
713742
......
726755
727756
728757
758
759
729760
730761
731762
}
}
void saveOriginalSMBIOS(void)
{
Node *node;
SMBEntryPoint *origeps;
void *tableAddress;
node = DT__FindNode("/efi/platform", false);
if (!node)
{
verbose("/efi/platform node not found\n");
return;
}
origeps = getSmbios(SMBIOS_ORIGINAL);
if (!origeps)
{
return;
}
tableAddress = (void *)AllocateKernelMemory(origeps->dmi.tableLength);
if (!tableAddress)
{
return;
}
memcpy(tableAddress, (void *)origeps->dmi.tableAddress, origeps->dmi.tableLength);
DT__AddProperty(node, "SMBIOS", origeps->dmi.tableLength, tableAddress);
}
/*
* Entrypoint from boot.c
*/
setup_pci_devs(root_pci_dev);
readSMBIOSInfo(getSmbios(SMBIOS_ORIGINAL));
// load smbios.plist file if any
setupSmbiosConfigFile("smbios.plist");
// Initialize the device tree
setupEfiDeviceTree();
saveOriginalSMBIOS();
// Add configuration table entries to both the services table and the device tree
setupEfiConfigurationTable();
}
trunk/i386/libsaio/smbios_getters.c
245245
246246
247247
248
249
250
248
249
250
251251
252252
253253
......
261261
262262
263263
264
265
264
266265
267266
268267
269268
270269
271
272
273
270
271
272
274273
275274
276275
......
284283
285284
286285
287
286
288287
289288
290289
291290
292291
293
294
295
292
293
294
296295
297296
298297
}
}
return false;
//value->string = "N/A";
//return true;
//return false;
value->string = NOT_AVAILABLE;
return true;
}
bool getSMBMemoryDeviceSerialNumber(returnType *value)
map = Platform.DMI.DIMM[idx];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].SerialNo) > 0)
{
DBG("name = %s, map=%d, RAM Detected SerialNo[%d]='%s'\n", name ? name : "",
map, idx, Platform.RAM.DIMM[map].SerialNo);
DBG("map=%d, RAM Detected SerialNo[%d]='%s'\n", map, idx, Platform.RAM.DIMM[map].SerialNo);
value->string = Platform.RAM.DIMM[map].SerialNo;
return true;
}
}
return false;
//value->string = "N/A";
//return true;
//return false;
value->string = NOT_AVAILABLE;
return true;
}
bool getSMBMemoryDevicePartNumber(returnType *value)
map = Platform.DMI.DIMM[idx];
if (Platform.RAM.DIMM[map].InUse && strlen(Platform.RAM.DIMM[map].PartNo) > 0)
{
DBG("Ram Detected PartNo[%d]='%s'\n", idx, Platform.RAM.DIMM[map].PartNo);
DBG("map=%d, RAM Detected PartNo[%d]='%s'\n", map, idx, Platform.RAM.DIMM[map].PartNo);
value->string = Platform.RAM.DIMM[map].PartNo;
return true;
}
}
return false;
//value->string = "N/A";
//return true;
//return false;
value->string = NOT_AVAILABLE;
return true;
}

Archive Download the corresponding diff file

Revision: 828