Index: trunk/i386/libsaio/smbios_getters.h =================================================================== --- trunk/i386/libsaio/smbios_getters.h (revision 827) +++ trunk/i386/libsaio/smbios_getters.h (revision 828) @@ -10,6 +10,8 @@ #define SMBIOS_RANGE_START 0x000F0000 #define SMBIOS_RANGE_END 0x000FFFFF +#define NOT_AVAILABLE "N/A" + typedef enum { kSMBString, kSMBByte, Index: trunk/i386/libsaio/spd.c =================================================================== --- trunk/i386/libsaio/spd.c (revision 827) +++ trunk/i386/libsaio/spd.c (revision 828) @@ -244,7 +244,6 @@ } return strdup(asciiPartNo); - return NULL; } int mapping []= {0,2,1,3,4,6,5,7,8,10,9,11}; Index: trunk/i386/libsaio/smbios.c =================================================================== --- trunk/i386/libsaio/smbios.c (revision 827) +++ trunk/i386/libsaio/smbios.c (revision 828) @@ -374,7 +374,7 @@ } } -/* 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; @@ -427,9 +427,15 @@ 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; Index: trunk/i386/libsaio/fake_efi.c =================================================================== --- trunk/i386/libsaio/fake_efi.c (revision 827) +++ trunk/i386/libsaio/fake_efi.c (revision 828) @@ -697,6 +697,35 @@ } } +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 */ @@ -707,7 +736,7 @@ setup_pci_devs(root_pci_dev); readSMBIOSInfo(getSmbios(SMBIOS_ORIGINAL)); - + // load smbios.plist file if any setupSmbiosConfigFile("smbios.plist"); @@ -726,6 +755,8 @@ // Initialize the device tree setupEfiDeviceTree(); + saveOriginalSMBIOS(); + // Add configuration table entries to both the services table and the device tree setupEfiConfigurationTable(); } Index: trunk/i386/libsaio/smbios_getters.c =================================================================== --- trunk/i386/libsaio/smbios_getters.c (revision 827) +++ trunk/i386/libsaio/smbios_getters.c (revision 828) @@ -245,9 +245,9 @@ } } - return false; -// value->string = "N/A"; -// return true; +// return false; + value->string = NOT_AVAILABLE; + return true; } bool getSMBMemoryDeviceSerialNumber(returnType *value) @@ -261,16 +261,15 @@ 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) @@ -284,15 +283,15 @@ 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; }