Index: trunk/i386/libsaio/smbios.c =================================================================== --- trunk/i386/libsaio/smbios.c (revision 2360) +++ trunk/i386/libsaio/smbios.c (revision 2361) @@ -105,6 +105,8 @@ #define kSMBMemoryDeviceManufacturerKey "SMmemmanufacturer" // #define kSMBMemoryDeviceSerialNumberKey "SMmemserial" // #define kSMBMemoryDevicePartNumberKey "SMmempart" // +// Bungo: +#define kSMBMemoryDeviceAssetTagKey "SMmemassettag" // /* =========================================== Memory SPD Data (Apple Specific - Type 130) @@ -120,6 +122,10 @@ =================================================== */ #define kSMBOemProcessorBusSpeedKey "SMoemcpubusspeed" // Bungo: renamed from SMbusspeed +/* ============================================== + OEM Platform Feature (Apple Specific - Type 133) + ================================================ */ +//#define kSMBOemPlatformFeatureKey /* ==================================================*/ #define getFieldOffset(struct, field) ((uint8_t)(uint32_t)&(((struct *)0)->field)) @@ -181,6 +187,7 @@ char *version; char *serialNumber; char *assetTag; // Bungo: renamed folowing convention + //char *skuNumber; } defaultChassis_t; defaultChassis_t defaultChassis; @@ -227,13 +234,13 @@ {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, serialNumber), kSMBSystemInformationSerialNumberKey, NULL, &defaultSystemInfo.serialNumber }, // SMserial - Serial number + /* Bungo: + {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, uuid), + kSMBSystemInformationUUIDKey, NULL, NULL}, // SMsystemuuid -/* {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, uuid[16]), - NULL, NULL, NULL}, // SmUUID/ - {kSMBTypeSystemInformation, kSMBByte, getFieldOffset(SMBSystemInformation, wakeupReason), NULL, NULL, NULL}, // reason for system wakeup -*/ + */ // Bungo {kSMBTypeSystemInformation, kSMBString, getFieldOffset(SMBSystemInformation, skuNumber), @@ -292,6 +299,11 @@ {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, assetTag), kSMBSystemEnclosureAssetTagKey, NULL, &defaultChassis.assetTag }, // SMchassisassettag - Pro Enclosure + /* + {kSMBTypeSystemEnclosure, kSMBString, getFieldOffset(SMBSystemEnclosure, skuNumber), + NULL, NULL, &defaultChassis.skuNumber }, + */ + /* ============================ Processor Information (Type 4) ============================== */ @@ -308,25 +320,21 @@ kSMBProcessorInformationExternalClockKey, getProcessorInformationExternalClock, NULL}, // SMcpuexternalclock {kSMBTypeProcessorInformation, kSMBWord, getFieldOffset(SMBProcessorInformation, maximumClock), - kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock, NULL}, // SMcpumaxspeed - + kSMBProcessorInformationMaximumClockKey, getProcessorInformationMaximumClock, NULL}, // SMcpumaximumclock // Bungo {kSMBTypeProcessorInformation, kSMBWord, getFieldOffset(SMBProcessorInformation, currentClock), - kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentspeed + kSMBProcessorInformationCurrentClockKey, NULL, NULL}, // SMcpucurrentclock {kSMBTypeProcessorInformation, kSMBByte, getFieldOffset(SMBProcessorInformation, processorUpgrade), kSMBProcessorInformationUpgradeKey, NULL, NULL}, // SMcpuupgrade // - {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, serialNumber), kSMBProcessorInformationSerialNumberKey, NULL, NULL}, // Bungo {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, assetTag), kSMBProcessorInformationAssetTagKey, NULL, NULL}, // SMcpuassettag - // - {kSMBTypeProcessorInformation, kSMBString, getFieldOffset(SMBProcessorInformation, partNumber), kSMBProcessorInformationPartNumberKey, NULL, NULL}, @@ -352,14 +360,13 @@ kSMBMemoryDeviceSerialNumberKey, getSMBMemoryDeviceSerialNumber, NULL}, {kSMBTypeMemoryDevice, kSMBString, getFieldOffset(SMBMemoryDevice, assetTag), - NULL, NULL, NULL}, + kSMBMemoryDeviceAssetTagKey, NULL, NULL}, {kSMBTypeMemoryDevice, kSMBWord, getFieldOffset(SMBMemoryDevice, errorHandle), NULL, getSMBMemoryDeviceMemoryErrorHandle, NULL}, {kSMBTypeMemoryDevice, kSMBString, getFieldOffset(SMBMemoryDevice, partNumber), kSMBMemoryDevicePartNumberKey, getSMBMemoryDevicePartNumber, NULL}, - // //------------------------------------------------------------------------------------------------------------------------- // Apple Specific @@ -371,6 +378,12 @@ // OEM Processor Bus Speed (Apple Specific - Type 132) {kSMBTypeOemProcessorBusSpeed, kSMBWord, getFieldOffset(SMBOemProcessorBusSpeed, ProcessorBusSpeed), kSMBOemProcessorBusSpeedKey, getSMBOemProcessorBusSpeed, NULL} + + // OEM Platform Feature (Apple Specific - Type 133) + /* + {kSMBTypeOemPlatformFeature, kSMBWord, getFieldOffset(SMBOemPlatformFeature, PlatformFeature), kSMBOemPlatformFeatureKey, + getSMBOemPlatformFeature, NULL} + */ }; int numOfSetters = sizeof(SMBSetters) / sizeof(SMBValueSetter); @@ -502,12 +515,18 @@ #define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B00.1102091756" #define kDefaultiMacSandyBIOSReleaseDate "01/02/08" #define kDefaultiMacSandyBoardProduct "Mac-942B5BF58194151B" + // iMac12,2 Mac-942B59F58194171B //#define kDefaultiMacSandy "iMac12,2" //#define kDefaultiMacSandyBIOSVersion " IM121.88Z.0047.B1D.1110171110" //#define kDefaultiMacSandyBIOSReleaseDate "10/17/11" //#define kDefaultiMacSandyBoardProduct "Mac-942B59F58194171B" +// iMac13,1 +// Bios: IM131.88Z.010A.B05.1211151146 +// Data: 11/15/2012 +// Board: Mac-00BE6ED71E35EB86 + // iMac13,2 //#define kDefaultiMacIvy "iMac13,2" //#define kDefaultiMacIvyBIOSVersion " IM131.88Z.00CE.B00.1203281326" @@ -520,8 +539,8 @@ //#define kDefaultMacProBoardType "0xB" // 11 #define kDefaultMacPro "MacPro3,1" -#define kDefaultMacProBIOSVersion " MP31.88Z.006C.B02.0801021250" -#define kDefaultMacProBIOSReleaseDate "01/02/08" +#define kDefaultMacProBIOSVersion " MP31.88Z.006C.B05.0903051113" +#define kDefaultMacProBIOSReleaseDate "08/03/2010" //#define kDefaultMacProSystemVersion "1.3" #define kDefaultMacProBoardProduct "Mac-F42C88C8" //#define KDefaultMacProBoardSerialNumber "J593902RA4MFE" @@ -585,9 +604,10 @@ defaultChassis.manufacturer = kDefaultVendorManufacturer; defaultChassis.serialNumber = kDefaultSerialNumber; defaultChassis.assetTag = kDefaultAssetTag; +// defaultChassis.skuNumber = kDefaultSkuNumber; - // if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly - if (PlatformType == 2) // this method works + // if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing + if (PlatformType == 2) // this method works but it's a substitute { if (Platform.CPU.NoCores > 1) { defaultSystemInfo.productName = kDefaultMacBookPro; @@ -767,11 +787,12 @@ strSize = strlen(string); + /* Bungo: What was this for? // remove any spaces found at the end while ((strSize != 0) && (string[strSize - 1] == ' ')) { strSize--; } - + */ if (strSize == 0) { *field = 0; return; @@ -847,6 +868,9 @@ case kSMBWord: value->word = (uint16_t)val; break; + //case kSMBQWord: + // value->qword = (uint64_t)val; + // break; case kSMBDWord: default: value->dword = (uint32_t)val; @@ -862,26 +886,28 @@ } } // #if 0 Bungo: enables code below - // if (*(SMBSetters[idx].defaultValue)) Bungo - if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) - { - // value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo - switch (SMBSetters[idx].valueType) { - case kSMBByte: - value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue); - break; - case kSMBWord: - value->word = *(uint16_t *)(SMBSetters[idx].defaultValue); - break; - case kSMBDWord: - default: - value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); - break; - } - return true; + // if (*(SMBSetters[idx].defaultValue)) Bungo + if (useSMBIOSdefaults && SMBSetters[idx].defaultValue && *(SMBSetters[idx].defaultValue)) { + // value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); Bungo + switch (SMBSetters[idx].valueType) { + case kSMBByte: + value->byte = *(uint8_t *)(SMBSetters[idx].defaultValue); + break; + case kSMBWord: + value->word = *(uint16_t *)(SMBSetters[idx].defaultValue); + break; + //case kSMBQWord: + // value->qword = *(uint32_t *)(SMBSetters[idx].defaultValue); + // break; + case kSMBDWord: + default: + value->dword = *(uint32_t *)(SMBSetters[idx].defaultValue); + break; } + return true; + } // #endif Bungo - break; + break; } // if (SMBSetters[idx].valueType == kSMBString && string) Bungo: use null string too -> "Not Specified" @@ -894,17 +920,27 @@ //------------------------------------------------------------------------------------------------------------------------- // Apple Specific //------------------------------------------------------------------------------------------------------------------------- + +/* =========================================== + Firmware Volume (Apple Specific - Type 128) + ============================================= */ void addSMBFirmwareVolume(SMBStructPtrs *structPtr) { return; } +/* =========================================== + Memory SPD Data (Apple Specific - Type 130) + ============================================= */ void addSMBMemorySPD(SMBStructPtrs *structPtr) { /* SPD data from Platform.RAM.spd */ return; } +/* ============================================ + OEM Processor Type (Apple Specific - Type 131) + ============================================== */ void addSMBOemProcessorType(SMBStructPtrs *structPtr) { SMBOemProcessorType *p = (SMBOemProcessorType *)structPtr->new; @@ -920,6 +956,9 @@ structureCount++; } +/* ================================================= + OEM Processor Bus Speed (Apple Specific - Type 132) + =================================================== */ void addSMBOemProcessorBusSpeed(SMBStructPtrs *structPtr) { SMBOemProcessorBusSpeed *p = (SMBOemProcessorBusSpeed *)structPtr->new; @@ -966,6 +1005,11 @@ structureCount++; } +/* ============================================== + OEM Platform Feature (Apple Specific - Type 133) + ================================================ */ + /*void addSMBOemPlatformFeature(SMBStructPtrs *structPtr) { }*/ + //------------------------------------------------------------------------------------------------------------------------- // EndOfTable //------------------------------------------------------------------------------------------------------------------------- @@ -988,7 +1032,8 @@ SMBWord structSize; int i; - /* http://forge.voodooprojects.org/p/chameleon/issues/361/ */ + /* Bungo: not needed because of tables lengths fix in next lines + // http://forge.voodooprojects.org/p/chameleon/issues/361/ bool forceFullMemInfo = false; if (structPtr->orig->type == kSMBTypeMemoryDevice) { @@ -996,7 +1041,7 @@ if (forceFullMemInfo) { structPtr->orig->length = 27; } - } + }*/ stringIndex = 1; stringsSize = 0; @@ -1004,18 +1049,53 @@ if (handle < structPtr->orig->handle) { handle = structPtr->orig->handle; } + // Bungo: fix unsuported tables lengths from original smbios: extend smaller or truncate bigger - we use SMBIOS rev. 2.4 like Apple uses + switch (structPtr->orig->type) { + case kSMBTypeBIOSInformation: + structSize = sizeof(SMBBIOSInformation); + break; + case kSMBTypeSystemInformation: + structSize = sizeof(SMBSystemInformation); + break; + case kSMBTypeBaseBoard: + structSize = sizeof(SMBBaseBoard); + break; + case kSMBTypeSystemEnclosure: + structSize = sizeof(SMBSystemEnclosure); + break; + case kSMBTypeProcessorInformation: + structSize = sizeof(SMBProcessorInformation); + break; + case kSMBTypeMemoryDevice: + structSize = sizeof(SMBMemoryDevice); + break; + default: + structSize = structPtr->orig->length; // don't change if not to patch + break; + } - memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); + // memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); + if (structPtr->orig->length <= structSize) { + memcpy((void *)structPtr->new, structPtr->orig, structPtr->orig->length); + } else { + memcpy((void *)structPtr->new, structPtr->orig, structSize); + } + structPtr->new->length = structSize; + for (i = 0; i < numOfSetters; i++) { - if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) { + // Bungo: + //if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structPtr->orig->length)) { + if ((structPtr->orig->type == SMBSetters[i].type) && (SMBSetters[i].fieldOffset < structSize)) { setterFound = true; setSMBValue(structPtr, i, (returnType *)((uint8_t *)structPtr->new + SMBSetters[i].fieldOffset)); } } if (setterFound) { - ptr = (uint8_t *)structPtr->new + structPtr->orig->length; + // Bungo: + // ptr = (uint8_t *)structPtr->new + structPtr->orig->length; + ptr = (uint8_t *)structPtr->new + structPtr->new->length; for (; ((uint16_t *)ptr)[0] != 0; ptr++); if (((uint16_t *)ptr)[0] == 0) { @@ -1140,7 +1220,7 @@ { SMBStructPtrs *structPtr; uint8_t *buffer; - // bool setSMB = true; Bungo + // bool setSMB = true; Bungo: now we use useSMBIOSdefaults if (!origeps) { return; Index: trunk/i386/libsaio/smbios_decode.c =================================================================== --- trunk/i386/libsaio/smbios_decode.c (revision 2360) +++ trunk/i386/libsaio/smbios_decode.c (revision 2361) @@ -21,35 +21,19 @@ #define DBG(x...) msglog(x) #endif -static SMBByte minorVersion; // SMBIOS rev. minor -// Bungo: -static SMBByte majorVersion; // SMBIOS rev. major -static SMBByte bcdRevisionLo; // DMI rev. minor -static SMBByte bcdRevisionHi; // DMI rev. major - extern char *getSMBStringForField(SMBStructHeader *structHeader, uint8_t field); - // Bungo: #define NotSpecifiedStr "Not Specified" // no string #define OutOfSpecStr "" // value out of smbios spec. range #define PrivateStr "** PRIVATE **" // masking private data -#define alwaysMask true #define neverMask false + static bool privateData = true; +static SMBByte minorVersion; // SMBIOS rev. minor +static SMBByte majorVersion; // SMBIOS rev. major +static SMBByte bcdRevisionLo; // DMI rev. minor +static SMBByte bcdRevisionHi; // DMI rev. major -char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask) // Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays -{ - char *str = NULL; - str = getSMBStringForField(structHeader, field); - if (!field) { - str = NotSpecifiedStr; - } else if (mask) { - str = PrivateStr; - } - - return str; -}; - /*==== 7.2.2 ===*/ @@ -123,55 +107,68 @@ }; /*==== + 7.5.1 + ===*/ +static const char *SMBProcessorTypes[] = // Bungo: strings for processor type (Table Type 4 - Processor Information) +{ + "Other", /* 01h */ + "Unknown", /* 02h */ + "Central Processor", /* 03h */ + "Math Processor", /* 04h */ + "DSP Processor", /* 05h */ + "Video Processor" /* 06h */ +}; + +/*==== 7.5.5 ===*/ -/*static const char *SMBCpuSocket[] = // ErmaC: strings for (Table Type 4 - Processor Information ) +static const char *SMBProcessorUpgrades[] = // ErmaC: strings for processor upgrade (Table Type 4 - Processor Information) { - "Other", // 01h - "Unknown", - "Daughter Board", - "ZIF Socket", - "Replaceable Piggy Back", - "None", - "LIF Socket", - "Slot 1", - "Slot 2", - "370-pin Socket", - "Slot A", - "Slot M", - "Socket 423", - "Socket A (Socket 462)", - "Socket 478", - "Socket 754", - "Socket 940", - "Socket 939", - "Socket mPGA604", - "Socket LGA771", - "Socket LGA775", - "Socket S1", - "Socket AM2", - "Socket F (1207)", - "Socket LGA1366", - "Socket G34", - "Socket AM3", - "Socket C32", - "Socket LGA1156", - "Socket LGA1567", - "Socket PGA988A", - "Socket BGA1288", - "Socket rPGA988B", - "Socket BGA1023", - "Socket BGA1224", - "Socket BGA1155", - "Socket LGA1356", - "Socket LGA2011", - "Socket FS1", - "Socket FS2", - "Socket FM1", - "Socket FM2", - "Socket LGA2011-3", - "Socket LGA1356-3" // 2Ch -};*/ + "Other", /* 01h */ + "Unknown", /* 02h */ + "Daughter Board", + "ZIF Socket", + "Replaceable Piggy Back", + "None", + "LIF Socket", + "Slot 1", + "Slot 2", + "370-pin Socket", + "Slot A", + "Slot M", + "Socket 423", + "Socket A (Socket 462)", + "Socket 478", + "Socket 754", + "Socket 940", + "Socket 939", + "Socket mPGA604", + "Socket LGA771", + "Socket LGA775", + "Socket S1", + "Socket AM2", + "Socket F (1207)", + "Socket LGA1366", + "Socket G34", + "Socket AM3", + "Socket C32", + "Socket LGA1156", + "Socket LGA1567", + "Socket PGA988A", + "Socket BGA1288", + "Socket rPGA988B", + "Socket BGA1023", + "Socket BGA1224", + "Socket BGA1155", + "Socket LGA1356", + "Socket LGA2011", + "Socket FS1", + "Socket FS2", + "Socket FM1", + "Socket FM2", + "Socket LGA2011-3", + "Socket LGA1356-3" /* 2Ch */ +}; /*===== 7.18.2 @@ -210,162 +207,190 @@ static const int kSMBMemoryDeviceTypeCount = sizeof(SMBMemoryDeviceTypes) / sizeof(SMBMemoryDeviceTypes[0]); +// Bungo: fixes random string readout if null in smbios to "Not Specified" as dmidecode displays +char *SMBStringForField(SMBStructHeader *structHeader, uint8_t field, const bool mask) +{ + char *str = NULL; + str = getSMBStringForField(structHeader, field); + if (!field) { + str = NotSpecifiedStr; + } + else if (mask) { + str = PrivateStr; + } + + return str; +}; + +void printHeader(SMBStructHeader *structHeader) +{ + DBG("Handle: 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length); +} + //------------------------------------------------------------------------------------------------------------------------- // BIOS Information (Type 0) //------------------------------------------------------------------------------------------------------------------------- -void decodeBIOSInformation(SMBBIOSInformation *structHeader) +void decodeBIOSInformation(SMBStructHeader *structHeader) { - DBG("BIOS Information:\n"); - DBG("\tVendor: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->vendor, neverMask)); - DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask)); - // Address Segment - DBG("\tRelease Date: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->releaseDate, neverMask)); - DBG("\tBIOS Revision: %d.%d\n", structHeader->releaseMajor, structHeader->releaseMinor); - // ROM Size - //DBG("\tSupported BIOS functions: (0x%llX) %s\n", structHeader->characteristics, SMBBIOSInfoChar0[structHeader->characteristics]); - // Major Release - // Minor Release - // Firmware Major Release - // Firmware Minor Release - //SMBByte characteristicsExt1; - //SMBByte characteristicsExt2; + printHeader(structHeader); + DBG("BIOS Information\n"); + DBG("\tVendor: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->vendor, neverMask)); + DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->version, neverMask)); + DBG("\tRelease Date: %s\n", SMBStringForField(structHeader, ((SMBBIOSInformation *)structHeader)->releaseDate, neverMask)); +// Address: +// Runtime Size: +// ROM Size: +// DBG("\tSupported BIOS functions: (0x%llX) %s\n", ((SMBBIOSInformation *)structHeader)->characteristics, SMBBIOSInfoChar0[((SMBBIOSInformation *)structHeader)->characteristics]); + DBG("\tBIOS Revision: %d.%d\n", ((SMBBIOSInformation *)structHeader)->releaseMajor, ((SMBBIOSInformation *)structHeader)->releaseMinor); +// Firmware Major Release +// Firmware Minor Release +// SMBByte characteristicsExt1; +// SMBByte characteristicsExt2; DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- // System Information (Type 1) //------------------------------------------------------------------------------------------------------------------------- -void decodeSystemInformation(SMBSystemInformation *structHeader) +void decodeSystemInformation(SMBStructHeader *structHeader) { - DBG("System Information:\n"); - DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask)); - DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->productName, neverMask)); - DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask)); - DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); - - if (minorVersion < 0x01 || structHeader->header.length < 0x19) { - return; + printHeader(structHeader); + DBG("System Information\n"); + DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->manufacturer, neverMask)); + DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->productName, neverMask)); + DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->version, neverMask)); + DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->serialNumber, privateData)); + uint8_t *uuid = ((SMBSystemInformation *)structHeader)->uuid; + if (privateData) { + DBG("\tUUID: %s\n", PrivateStr); + } else { + DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n", + uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], + uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); } - - uint8_t *uuid = structHeader->uuid; - if (uuid) { - if (privateData) { - DBG("\tUUID: %s\n", PrivateStr); - } else { - DBG("\tUUID: %02X%02X%02X%02X-%02X%02X-%02X%02X-%02x%02X-%02X%02X%02X%02X%02X%02X\n", - uuid[0], uuid[1], uuid[2], uuid[3], uuid[4], uuid[5], uuid[6], uuid[7], - uuid[8], uuid[9], uuid[10], uuid[11], uuid[12], uuid[13], uuid[14], uuid[15]); - } - } - - if (structHeader->wakeupReason > 8) { + if (((SMBSystemInformation *)structHeader)->wakeupReason > 8) { DBG("\tWake-up Type: %s\n", OutOfSpecStr); } else { - DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[structHeader->wakeupReason]); + DBG("\tWake-up Type: %s\n", SMBWakeUpTypes[((SMBSystemInformation *)structHeader)->wakeupReason]); } - if (minorVersion < 0x04 || structHeader->header.length < 0x1B) { - return; - } - - DBG("\tSKU Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->skuNumber, neverMask)); // System SKU# - DBG("\tFamily: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->family, neverMask)); + DBG("\tSKU Number: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->skuNumber, neverMask)); // System SKU# + DBG("\tFamily: %s\n", SMBStringForField(structHeader, ((SMBSystemInformation *)structHeader)->family, neverMask)); DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- // Base Board (or Module) Information (Type 2) //------------------------------------------------------------------------------------------------------------------------- -void decodeBaseBoard(SMBBaseBoard *structHeader) +void decodeBaseBoard(SMBStructHeader *structHeader) { - DBG("Base Board Information:\n"); - DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask)); - DBG("\tProduct Name: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->product, neverMask)); - DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask)); - DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); - DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask)); - // Feature Flags (BYTE) - DBG("\tLocation In Chassis: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->locationInChassis, neverMask)); // Part Component - // Chassis Handle (WORD) - if ((structHeader->boardType < kSMBBaseBoardUnknown) || (structHeader->boardType > kSMBBaseBoardInterconnect)) { + printHeader(structHeader); + DBG("Base Board Information\n"); + DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->manufacturer, neverMask)); + DBG("\tProduct Name: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->product, neverMask)); + DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->version, neverMask)); + DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->serialNumber, privateData)); + DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->assetTag, neverMask)); +// Feature Flags (BYTE) + DBG("\tLocation In Chassis: %s\n", SMBStringForField(structHeader, ((SMBBaseBoard *)structHeader)->locationInChassis, neverMask)); // Part Component +// Chassis Handle (WORD) + if ((((SMBBaseBoard *)structHeader)->boardType < kSMBBaseBoardUnknown) || (((SMBBaseBoard *)structHeader)->boardType > kSMBBaseBoardInterconnect)) { DBG("\tType: %s\n", OutOfSpecStr); } else { - DBG("\tType: %s\n", SMBBaseBoardTypes[(structHeader->boardType - 1)]); + DBG("\tType: %s\n", SMBBaseBoardTypes[(((SMBBaseBoard *)structHeader)->boardType - 1)]); } - // Number of Contained Object Handles (n) (BYTE) - // Contained Object Handles n(WORDs) +// Number of Contained Object Handles (n) (BYTE) +// Contained Object Handles n(WORDs) DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- // System Enclosure or Chassis (Type 3) //------------------------------------------------------------------------------------------------------------------------- -void decodeSystemEnclosure(SMBSystemEnclosure *structHeader) +void decodeSystemEnclosure(SMBStructHeader *structHeader) { - DBG("Chassis Information:\n"); - DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask)); - // DBG("\tType: 0x%X\n", structHeader->chassisType); - if ((structHeader->chassisType < kSMBchassisOther) || (structHeader->chassisType > kSMBchassisBladeEnclosing)) { + printHeader(structHeader); + DBG("Chassis Information\n"); + DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->manufacturer, neverMask)); + if ((((SMBSystemEnclosure *)structHeader)->chassisType < kSMBchassisOther) || (((SMBSystemEnclosure *)structHeader)->chassisType > kSMBchassisBladeEnclosing)) { DBG("\tType: %s\n", OutOfSpecStr); } else { - DBG("\tType: %s\n", SMBChassisTypes[(structHeader->chassisType - 1)]); + DBG("\tType: %s\n", SMBChassisTypes[(((SMBSystemEnclosure *)structHeader)->chassisType - 1)]); } - DBG("\tVersion: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->version, neverMask)); - DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); - DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask)); - // Boot-up State: - // Power Supply State - // Thermal State - // Security Status: - // OEM Information: - // Height; - // Cords; - // ElementsCount; - // ElementLen; - // Elements[1]; // open array of ElementsCount*ElementLen BYTEs +// Lock: + DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->version, neverMask)); + DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->serialNumber, privateData)); + DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBSystemEnclosure *)structHeader)->assetTag, neverMask)); +// Boot-up State: +// Power Supply State +// Thermal State +// Security Status: +// OEM Information: +// Height; +// Number Of Power Cords: Cords; +// Contained Elements: ElementsCount; +// SKU Number: +// ElementLen; +// Elements[1]; // open array of ElementsCount*ElementLen BYTEs DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- // Processor Information (Type 4) //------------------------------------------------------------------------------------------------------------------------- -void decodeProcessorInformation(SMBProcessorInformation *structHeader) +void decodeProcessorInformation(SMBStructHeader *structHeader) { - DBG("Processor Information:\n"); - DBG("\tSocket Designation: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation, neverMask)); - DBG("\tType: %d\n", structHeader->processorType); - DBG("\tFamily: 0x%X\n", structHeader->processorFamily); - DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask)); - DBG("\tID: 0x%llX\n", structHeader->processorID); - DBG("\tProcessor Version: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->processorVersion, neverMask)); -// DBG("\tVoltage: 0.%xV\n", structHeader->voltage); - DBG("\tExternal Clock: %dMHz\n", structHeader->externalClock); - DBG("\tMaximum Clock: %dMHz\n", structHeader->maximumClock); - DBG("\tCurrent Clock: %dMHz\n", structHeader->currentClock); - - if (minorVersion < 3 || structHeader->header.length < 35) { - return; + printHeader(structHeader); + DBG("Processor Information\n"); + DBG("\tSocket Designation: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->socketDesignation, neverMask)); + if ((((SMBProcessorInformation *)structHeader)->processorType < kSMBprocessorTypeOther) || (((SMBProcessorInformation *)structHeader)->processorType > kSMBprocessorTypeGPU)) { + DBG("\tType: %s\n", OutOfSpecStr); + } else { + DBG("\tType: %s\n", SMBProcessorTypes[((SMBProcessorInformation *)structHeader)->processorType - 1]); } - - DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); - DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask)); - DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber, neverMask)); -// DBG("\tCore Count: %d\n", structHeader->coreCount); -// DBG("\tCore Enabled: %d\n", structHeader->coreEnabled); -// DBG("\tThread Count: %d\n", structHeader->threadCount); -// DBG("\tProcessor Family 2: %d\n", structHeader->processorFamily2); + DBG("\tFamily: 0x%X\n", ((SMBProcessorInformation *)structHeader)->processorFamily); + DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->manufacturer, neverMask)); + DBG("\tID: 0x%llX\n", ((SMBProcessorInformation *)structHeader)->processorID); +// DBG("\tSignature: Type %u, Family %u, Model %u, Stepping %u\n", (eax >> 12) & 0x3, ((eax >> 20) & 0xFF) + ((eax >> 8) & 0x0F), ((eax >> 12) & 0xF0) + ((eax >> 4) & 0x0F), eax & 0xF); +// Flags: + DBG("\tVersion: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->processorVersion, neverMask)); +// DBG("\tVoltage: 0.%xV\n", ((SMBProcessorInformation *)structHeader)->voltage); + DBG("\tExternal Clock: %d MHz\n", ((SMBProcessorInformation *)structHeader)->externalClock); + DBG("\tMax Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->maximumClock); + DBG("\tCurrent Speed: %d MHz\n", ((SMBProcessorInformation *)structHeader)->currentClock); +// Status: Populated/Unpopulated + if ((((SMBProcessorInformation *)structHeader)->processorUpgrade < 1) || (((SMBProcessorInformation *)structHeader)->processorUpgrade > 0x2C)) { + DBG("\tUpgrade: %s\n", OutOfSpecStr); + } else { + DBG("\tUpgrade: %s\n", SMBProcessorUpgrades[((SMBProcessorInformation *)structHeader)->processorUpgrade - 1]); + } +// L1 Cache Handle: +// L2 Cache Handle: +// L3 Cache Handle: + DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->serialNumber, privateData)); + DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->assetTag, neverMask)); + DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBProcessorInformation *)structHeader)->partNumber, neverMask)); + if(((SMBProcessorInformation *)structHeader)->coreCount != 0) { + DBG("\tCore Count: %d\n", ((SMBProcessorInformation *)structHeader)->coreCount);} + if(((SMBProcessorInformation *)structHeader)->coreEnabled != 0) { + DBG("\tCore Enabled: %d\n", ((SMBProcessorInformation *)structHeader)->coreEnabled);} + if(((SMBProcessorInformation *)structHeader)->threadCount != 0) { + DBG("\tThread Count: %d\n", ((SMBProcessorInformation *)structHeader)->threadCount); + } +// Characteristics: +// DBG("\tProcessor Family 2: %d\n", ((SMBProcessorInformation *)structHeader)->processorFamily2); DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- // Memory Module Information (Type 6) //------------------------------------------------------------------------------------------------------------------------- -//void decodeMemoryModule(SMBMemoryModule *structHeader) +//void decodeMemoryModule(SMBStructHeader *structHeader) //{ -// DBG("Memory Module Information:\n"); +// DBG("Memory Module Information\n"); // DBG("\tSocket Designation: %s\n", getSMBStringForField((SMBStructHeader *)structHeader, structHeader->socketDesignation)); // DBG("\tBank Connections: Type: %d\n", structHeader->bankConnections); // DBG("\tCurrent Speed: %X\n", structHeader->currentSpeed); -// DBG("\tCurrent Memory Type: %llX\n", structHeader->currentMemoryType); +// DBG("\tType: %llX\n", structHeader->currentMemoryType); // DBG("\tInstalled Size: %d\n", structHeader->installedSize); // DBG("\tEnabled Size: %d\n", structHeader->enabledSize); // DBG("\tError Status: %x\n", structHeader->errorStatus); @@ -375,61 +400,99 @@ //------------------------------------------------------------------------------------------------------------------------- // OEM Strings (Type 11) //------------------------------------------------------------------------------------------------------------------------- -//void decodeSMBOEMStrings(SMBOEMStrings *structHeader) -//{ -// DBG("OEM Strings:\n"); -// DBG("\tString 1: %d\n"); //, structHeader->string1); -// DBG("\tString 2: %d\n"); //, structHeader->string1); -// DBG("\tString 3: %d\n"); //, structHeader->string1); -// DBG("\n"); -//} +void decodeSMBOEMStrings(SMBStructHeader *structHeader) +{ + char *stringPtr = (char *)structHeader + structHeader->length; + printHeader(structHeader); + DBG("OEM Strings\n"); + SMBByte i; + for (i = 1; i <= ((SMBOEMStrings *)structHeader)->count; i++) { + DBG("\tString %d: %s\n", i, stringPtr); + stringPtr = stringPtr + strlen(stringPtr) + 1; + } + DBG("\n"); +} //------------------------------------------------------------------------------------------------------------------------- // MemoryDevice (Type 17) //------------------------------------------------------------------------------------------------------------------------- -void decodeMemoryDevice(SMBMemoryDevice *structHeader) +void decodeMemoryDevice(SMBStructHeader *structHeader) { - DBG("Memory Device:\n"); - DBG("\tDevice Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->deviceLocator, neverMask)); - DBG("\tBank Locator: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->bankLocator, neverMask)); - if (structHeader->memoryType > kSMBMemoryDeviceTypeCount) { + printHeader(structHeader); + DBG("Memory Device\n"); +// Aray Handle + DBG("\tError Information Handle: 0x%x\n", ((SMBMemoryDevice *)structHeader)->errorHandle); +// Total Width: +// Data Width: +// Size: +// Form Factor: +// Set: + DBG("\tLocator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->deviceLocator, neverMask)); + DBG("\tBank Locator: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->bankLocator, neverMask)); + if (((SMBMemoryDevice *)structHeader)->memoryType > kSMBMemoryDeviceTypeCount) { DBG("\tMemory Type: %s\n", OutOfSpecStr); } else { - DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[structHeader->memoryType]); + DBG("\tMemory Type: %s\n", SMBMemoryDeviceTypes[((SMBMemoryDevice *)structHeader)->memoryType]); } - if (minorVersion < 0x03 || structHeader->header.length < 0x1B) { - return; - } - DBG("\tSpeed: %d MHz\n", structHeader->memorySpeed); - DBG("\tError Handle: %x\n", structHeader->errorHandle); - DBG("\tManufacturer: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->manufacturer, neverMask)); - DBG("\tSerial Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->serialNumber, privateData)); - DBG("\tAsset Tag: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->assetTag, neverMask)); - DBG("\tPart Number: %s\n", SMBStringForField((SMBStructHeader *)structHeader, structHeader->partNumber, neverMask)); +// Type Detail: + DBG("\tSpeed: %d MHz\n", ((SMBMemoryDevice *)structHeader)->memorySpeed); + DBG("\tManufacturer: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->manufacturer, neverMask)); + DBG("\tSerial Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->serialNumber, privateData)); + DBG("\tAsset Tag: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->assetTag, neverMask)); + DBG("\tPart Number: %s\n", SMBStringForField(structHeader, ((SMBMemoryDevice *)structHeader)->partNumber, neverMask)); +// Rank: +// Configured Clock Speed: DBG("\n"); } //------------------------------------------------------------------------------------------------------------------------- -// Apple Specific +// Apple Specific (Type 131) //------------------------------------------------------------------------------------------------------------------------- -void decodeOemProcessorType(SMBOemProcessorType *structHeader) +void decodeOemProcessorType(SMBStructHeader *structHeader) { - DBG("Apple specific Processor Type:\n"); + printHeader(structHeader); + DBG("Apple specific Processor Type\n"); DBG("\tCpu-type: 0x%x\n", ((SMBOemProcessorType *)structHeader)->ProcessorType); DBG("\n"); } -void decodeOemProcessorBusSpeed(SMBOemProcessorBusSpeed *structHeader) +//------------------------------------------------------------------------------------------------------------------------- +// Apple Specific (Type 132) +//------------------------------------------------------------------------------------------------------------------------- +void decodeOemProcessorBusSpeed(SMBStructHeader *structHeader) { - DBG("Apple specific Processor Interconnect Speed:\n"); - DBG("\tQPI = %d.%dGT/s\n", - ((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 1000, - (((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed / 100) % 10); + printHeader(structHeader); + DBG("Apple specific Processor Interconnect Speed\n"); + DBG("\tQPI = %d MT/s\n", ((SMBOemProcessorBusSpeed *)structHeader)->ProcessorBusSpeed); DBG("\n"); } + +// Info for the Table Above: dmi 2.7+ https://wiki.debian.org/InstallingDebianOn/Thinkpad/T42/lenny?action=AttachFile&do=get&target=dmidecode.Lenny_Thinkpad_T42_2373.txt //------------------------------------------------------------------------------------------------------------------------- +// Apple Specific (Type 133) +//------------------------------------------------------------------------------------------------------------------------- +//void decodeOemPlatformFeature(SMBStructHeader *structHeader) +//{ +// printHeader(structHeader); +// DBG("Apple specific Platform Feature\n"); +// DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->PlatformFeature); +// DBG("\n"); +//} +//------------------------------------------------------------------------------------------------------------------------- +// Specific (Type 134) +//------------------------------------------------------------------------------------------------------------------------- +//void decodeOem(SMBStructHeader *structHeader) +//{ +// printHeader(structHeader); +// DBG("Apple specific Feature\n"); +// DBG("\t%s\n", ((SMBOemPlatformFeature *)structHeader)->Feature); +// DBG("\n"); +//} +//------------------------------------------------------------------------------------------------------------------------- + + void decodeSMBIOSTable(SMBEntryPoint *eps) { uint8_t *ptr = (uint8_t *)eps->dmi.tableAddress; @@ -443,73 +506,71 @@ getBoolForKey(kPrivateData, &privateData, &bootInfo->chameleonConfig); // Bungo: chek if mask some data DBG("\n"); - DBG("SMBIOS rev. %d.%d, DMI rev. %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo); + DBG("SMBIOS rev.: %d.%d, DMI rev.: %d.%d\n", majorVersion, minorVersion, bcdRevisionHi, bcdRevisionLo); DBG("\n"); for (;((eps->dmi.tableAddress + eps->dmi.tableLength) > ((uint32_t)(uint8_t *)structHeader + sizeof(SMBStructHeader)));) { - DBG("Type: %d, Length: %d, Handle: 0x%04x\n", - structHeader->type, structHeader->length, structHeader->handle); - switch (structHeader->type) { case kSMBTypeBIOSInformation: // Type 0 - decodeBIOSInformation((SMBBIOSInformation *)structHeader); + decodeBIOSInformation(structHeader); break; case kSMBTypeSystemInformation: // Type 1 - decodeSystemInformation((SMBSystemInformation *)structHeader); + decodeSystemInformation(structHeader); break; case kSMBTypeBaseBoard: // Type 2 - decodeBaseBoard((SMBBaseBoard *)structHeader); + decodeBaseBoard(structHeader); break; case kSMBTypeSystemEnclosure: // Type 3 - decodeSystemEnclosure((SMBSystemEnclosure *)structHeader); + decodeSystemEnclosure(structHeader); break; case kSMBTypeProcessorInformation: // Type 4 - decodeProcessorInformation((SMBProcessorInformation *)structHeader); + decodeProcessorInformation(structHeader); break; //case kSMBTypeMemoryModule: // Type 6 - // decodeMemoryModule((SMBMemoryModule *)structHeader); + // decodeMemoryModule(structHeader); // break; //case kSMBTypeSystemSlot: // Type 9 - // decodeSMBTypeSystemSlot((SMBOEMStrings *)structHeader); + // decodeSMBTypeSystemSlot(structHeader); // break; - //case kSMBOEMStrings: // Type 11 - // decodeSMBOEMStrings((SMBOEMStrings *)structHeader); - // break; + case kSMBOEMStrings: // Type 11 + decodeSMBOEMStrings(structHeader); + break; case kSMBTypeMemoryDevice: // Type 17 - decodeMemoryDevice((SMBMemoryDevice *)structHeader); + decodeMemoryDevice(structHeader); break; //kSMBTypeMemoryArrayMappedAddress: // Type 19 // break; /* Skip all Apple Specific Structures */ - case kSMBTypeFirmwareVolume: // Type 128 - case kSMBTypeMemorySPD: // Type 130 - break; + // case kSMBTypeFirmwareVolume: // Type 128 + // case kSMBTypeMemorySPD: // Type 130 + // break; case kSMBTypeOemProcessorType: // Type 131 - decodeOemProcessorType((SMBOemProcessorType *)structHeader); + decodeOemProcessorType(structHeader); break; case kSMBTypeOemProcessorBusSpeed: // Type 132 - decodeOemProcessorBusSpeed((SMBOemProcessorBusSpeed *)structHeader); + decodeOemProcessorBusSpeed(structHeader); break; //kSMBTypeOemPlatformFeature: // Type 133 - + // decodeOemPlatformFeature(structHeader); // break; case kSMBTypeEndOfTable: // Type 127 - /* Skip, to be added at the end */ + DBG("Handle 0x%04x, DMI type %d, %d bytes\n", structHeader->handle, structHeader->type, structHeader->length); + DBG("End of Table\n"); break; default: Index: trunk/i386/libsaio/smbios.h =================================================================== --- trunk/i386/libsaio/smbios.h (revision 2360) +++ trunk/i386/libsaio/smbios.h (revision 2361) @@ -98,7 +98,7 @@ // Port Connector Information (Type 8) kSMBTypeSystemSlot = 9, // System Slots (Type 9) // On Board Devices Information (Type 10) Obsolete - // kSMBOEMStrings = 11 ,// OEM Strings (Type 11) + kSMBOEMStrings = 11 ,// OEM Strings (Type 11) // System Configuration Options (Type 12) // BIOS Language Information (Type 13) // Group Associations (Type 14) @@ -138,7 +138,8 @@ kSMBTypeFirmwareVolume = 128, // FirmwareVolume (TYPE 128) kSMBTypeMemorySPD = 130, // MemorySPD (TYPE 130) kSMBTypeOemProcessorType = 131, // Processor Type (Type 131) - kSMBTypeOemProcessorBusSpeed = 132 //Processor Bus Speed (Type 132) + kSMBTypeOemProcessorBusSpeed = 132 // Processor Bus Speed (Type 132) + //kSMBTypeOemPlatformFeature = 133 // Platform Feature (Type 133) }; /* ======================= @@ -240,11 +241,11 @@ SMBByte thermalState; // Thermal state of the enclosure when last booted SMBByte securityStatus; // Physical security status of the enclosure when last booted SMBDWord oemDefined; // OEM- or BIOS vendor-specific information -// SMBByte height; // Height of the enclosure, in 'U's -// SMBByte numberOfPowerCords; // Number of power cords associated with the enclosure or chassis -// SMBByte containedElementCount; // Number of Contained Element record that follow, in the range 0 to 255 + SMBByte height; // Height of the enclosure, in 'U's + SMBByte numberOfPowerCords; // Number of power cords associated with the enclosure or chassis + SMBByte containedElementCount; // Number of Contained Element record that follow, in the range 0 to 255 // SMBByte containedElementRecord; // Byte leght of each Contained Element record that follow, in the range 0 to 255 -// SMBByte containedElements; // Elements, possibly defined by other SMBIOS structures present in chassis +// SMBByte containedElements; // Elements, possibly defined by other SMBIOS structures present in chassis // SMBString skuNumber; // Number of null-terminated string describing the chassis or enclosure SKU number (2.7+) } __attribute__((packed)) SMBSystemEnclosure; @@ -298,9 +299,9 @@ SMBString assetTag; SMBString partNumber; // 2.5+ spec (40 bytes) -// SMBByte coreCount; -// SMBByte coreEnabled; -// SMBByte threadCount; + SMBByte coreCount; + SMBByte coreEnabled; + SMBByte threadCount; // SMBWord processorFuncSupport; // 2.6+ spec (42 bytes) // SMBWord processorFamily2; @@ -308,26 +309,38 @@ #define kSMBProcessorInformationMinSize 26 -/* ======================================================================= - Memory Controller Information (Type 5) Obsoleted since SMBIOS version 2.1 - ========================================================================= */ +/* ======================================== + Values for processorType in Type 4 records + ======================================== */ +enum +{ + kSMBprocessorTypeOther = 0x01, + kSMBprocessorTypeUnknown = 0x02, + kSMBprocessorTypeCPU = 0x03, + kSMBprocessorTypeMPU = 0x04, + kSMBprocessorTypeDSP = 0x05, + kSMBprocessorTypeGPU = 0x06 +}; -//typedef struct SMBMemoryControllerInfo { -// SMB_STRUCT_HEADER -// SMBByte errorDetectingMethod; -// SMBByte errorCorrectingCapability; -// SMBByte supportedInterleave; -// SMBByte currentInterleave; -// SMBByte maxMemoryModuleSize; -// SMBWord supportedSpeeds; -// SMBWord supportedMemoryTypes; -// SMBByte memoryModuleVoltage; -// SMBByte numberOfMemorySlots; -//} __attribute__((packed)) SMBMemoryControllerInfo; +/* ====================================================================== + Memory Controller Information (Type 5) Obsolete since SMBIOS version 2.1 + ======================================================================== */ +typedef struct SMBMemoryControllerInfo { + SMB_STRUCT_HEADER + SMBByte errorDetectingMethod; + SMBByte errorCorrectingCapability; + SMBByte supportedInterleave; + SMBByte currentInterleave; + SMBByte maxMemoryModuleSize; + SMBWord supportedSpeeds; + SMBWord supportedMemoryTypes; + SMBByte memoryModuleVoltage; + SMBByte numberOfMemorySlots; +} __attribute__((packed)) SMBMemoryControllerInfo; -/* =================================================================== - Memory Module Information (Type 6) Obsoleted since SMBIOS version 2.1 - ===================================================================== */ +/* ================================================================== + Memory Module Information (Type 6) Obsolete since SMBIOS version 2.1 + ==================================================================== */ typedef struct SMBMemoryModule { SMB_STRUCT_HEADER // Type 6 @@ -387,11 +400,11 @@ /* =================== OEM Strings (Type 11) ===================== */ -//typedef struct SMBOEMStrings -//{ -// SMB_STRUCT_HEADER // Type 11 -// SMBByte count; // number of strings -//} __attribute__((packed)) SMBOEMStrings; +typedef struct SMBOEMStrings +{ + SMB_STRUCT_HEADER // Type 11 + SMBByte count; // number of strings +} __attribute__((packed)) SMBOEMStrings; /* ============================= Physical Memory Array (Type 16) @@ -577,7 +590,7 @@ ================================================ */ struct SMBOemPlatformFeature { - SMB_STRUCT_HEADER + SMB_STRUCT_HEADER // Type 133 SMBWord PlatformFeature; } __attribute__((packed)) SMBOemPlatformFeature; Index: trunk/i386/libsaio/smbios_getters.c =================================================================== --- trunk/i386/libsaio/smbios_getters.c (revision 2360) +++ trunk/i386/libsaio/smbios_getters.c (revision 2361) @@ -136,12 +136,12 @@ uint16_t simpleGetSMBOemProcessorType(void) { if (Platform.CPU.NoCores >= 4) { - return 0x0501; // Quad-Core Xeon + return 0x501; // 1281 - Quad-Core Xeon } else if (Platform.CPU.NoCores == 1) { - return 0x0201; // Core Solo + return 0x201; // 513 - Core Solo }; - return 0x0301; // Core 2 Duo + return 0x301; // 769 - Core 2 Duo } bool getSMBOemProcessorType(returnType *value) @@ -162,22 +162,22 @@ switch (Platform.CPU.Model) { case CPU_MODEL_DOTHAN: // 0x0D - Intel Pentium M model D - value->word = 0x101; + value->word = 0x101; // 257 return true; case CPU_MODEL_YONAH: // 0x0E - Intel Mobile Core Solo, Duo case CPU_MODEL_CELERON: - value->word = 0x201; + value->word = 0x201; // 513 return true; case CPU_MODEL_XEON_MP: // 0x1D - Six-Core Xeon 7400, "Dunnington", 45nm - value->word = 0x401; + value->word = 0x401; // 1025 return true; case CPU_MODEL_MEROM: // 0x0F - Intel Mobile Core 2 Solo, Duo, Xeon 30xx, Xeon 51xx, Xeon X53xx, Xeon E53xx, Xeon X32xx case CPU_MODEL_PENRYN: // 0x17 - Intel Core 2 Solo, Duo, Quad, Extreme, Xeon X54xx, Xeon X33xx if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x402; // Xeon + value->word = 0x402; // 1026 - Xeon } case CPU_MODEL_PENTIUM_M: // 0x09 - Banias case CPU_MODEL_LINCROFT: // 0x27 - Intel Atom, "Lincroft", 45nm @@ -186,132 +186,134 @@ case CPU_MODEL_NEHALEM_EX: // 0x2E - Nehalem-ex, "Beckton", 45nm case CPU_MODEL_NEHALEM: // 0x1A - Intel Core i7, Xeon W35xx, Xeon X55xx, Xeon E55xx LGA1366 (45nm) - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x501; // Xeon - } - if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x701; // Core i7 - } - return true; - case CPU_MODEL_FIELDS: // 0x1E - Intel Core i5, i7, Xeon X34xx LGA1156 (45nm) + case CPU_MODEL_DALES: // 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale) if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x501; // Lynnfiled Quad-Core Xeon + value->word = 0x501; // 1281 - Lynnfiled Quad-Core Xeon + return true; } - if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x701; // Core i7 + if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { + value->word = 0x901; // 2305 - Core i3 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { value->word = 0x601; // Core i5 + return true; } - return true; - - case CPU_MODEL_DALES: // 0x1F - Intel Core i5, i7 LGA1156 (45nm) (Havendale, Auburndale) - if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x901; // Core i3 - } - if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x602; // Core i5 - } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x702; // Core i7 + value->word = 0x701; // 1793 - Core i7 + return true; } if (Platform.CPU.NoCores <= 2) { - value->word = 0x602; // Core i5 + value->word = 0x601; // 1537 - Core i5 } return true; case CPU_MODEL_DALES_32NM: // 0x25 - Intel Core i3, i5 LGA1156 (32nm) (Clarkdale, Arrandale) + case CPU_MODEL_WESTMERE: // 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core + case CPU_MODEL_WESTMERE_EX: // 0x2F - Intel Xeon E7 + if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + value->word = 0x501; // 1281 - Xeon + return true; + } if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x901; // Core i3 + value->word = 0x901; // 2305 - Core i3 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x601; // Core i5 + value->word = 0x602; // 1538 - Core i5 + return true; } - if(strstr(Platform.CPU.BrandString, "Core(TM) i5 CPU M 540")) { - value->word = 0x602; // Core i5 - } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x701; // Core i7 + value->word = 0x702; // 1794 -Core i7 + return true; } if (Platform.CPU.NoCores <= 2) { - value->word = 0x602; // Core i5 + value->word = 0x602; // 1538 - Core i5 } return true; - case CPU_MODEL_WESTMERE: // 0x2C - Intel Core i7, Xeon X56xx, Xeon E56xx, Xeon W36xx LGA1366 (32nm) 6 Core - case CPU_MODEL_WESTMERE_EX: // 0x2F - Intel Xeon E7 - if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x501; // Xeon - } - if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x701; // Core i7 - } - return true; - case CPU_MODEL_JAKETOWN: // 0x2D - Intel Core i7, Xeon E5-xxxx LGA2011 (32nm) case CPU_MODEL_SANDYBRIDGE: // 0x2A - Intel Core i3, i5, i7 LGA1155 (32nm) if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { - value->word = 0x501; // Xeon + value->word = 0x501; // 1281 - Xeon + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x903; // Core i3 + value->word = 0x902; // 2306 -Core i3 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x603; // Core i5 + value->word = 0x603; // 1539 - Core i5 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x703; // Core i7 + value->word = 0x703; // 1795 - Core i7 + return true; } if (Platform.CPU.NoCores <= 2) { - value->word = 0x603; // Core i5 + value->word = 0x603; // 1539 - Core i5 } return true; case CPU_MODEL_IVYBRIDGE: // 0x3A - Intel Core i3, i5, i7 LGA1155 (22nm) + if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + value->word = 0xA01; // 2561 - Xeon + return true; + } if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x903; // Core i3 - Apple doesn't use it + value->word = 0x903; // 2307 - Core i3 - Apple doesn't use it + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x604; // Core i5 + value->word = 0x604; // 1540 - Core i5 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x704; // Core i7 + value->word = 0x704; // 1796 - Core i7 + return true; } if (Platform.CPU.NoCores <= 2) { - value->word = 0x604; // Core i5 + value->word = 0x604; // 1540 - Core i5 } return true; - case CPU_MODEL_IVYBRIDGE_XEON: // 0x3E - Mac Pro 6,1 - shouldn't be Sandy Bridge EP refering to intel spec.? - value->word = 0xA01; + case CPU_MODEL_IVYBRIDGE_XEON: // 0x3E - Mac Pro 6,1 + value->word = 0xA01; // 2561 return true; case CPU_MODEL_HASWELL: // 0x3C - case CPU_MODEL_HASWELL_SVR: // 0x3F - case CPU_MODEL_HASWELL_ULT: // 0x45 - case CPU_MODEL_CRYSTALWELL: // 0x46 + if (strstr(Platform.CPU.BrandString, "Xeon(R)")) { + value->word = 0xA01; // 2561 - Xeon + return true; + } if (strstr(Platform.CPU.BrandString, "Core(TM) i3")) { - value->word = 0x905; // Core i3 - Apple doesn't use it + value->word = 0x904; // 2308 - Core i3 - Apple doesn't use it - but we yes:-) + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i5")) { - value->word = 0x605; // Core i5 + value->word = 0x605; // 1541 - Core i5 + return true; } if (strstr(Platform.CPU.BrandString, "Core(TM) i7")) { - value->word = 0x705; // Core i7 + value->word = 0x705; // 1797 - Core i7 + return true; } if (Platform.CPU.NoCores <= 2) { - value->word = 0x605; // Core i5 + value->word = 0x605; // 1541 - Core i5 } return true; case 0x15: // EP80579 integrated processor - value->word = 0x301; // + value->word = 0x301; // 769 return true; case 0x13: // Core i5, Xeon MP, "Havendale", "Auburndale", 45nm case 0x19: // Intel Core i5 650 @3.20 Ghz - value->word = 0x601; // Core i5 + value->word = 0x601; // 1537 - Core i5 return true; default: break; //Unsupported CPU type