Chameleon

Chameleon Commit Details

Date:2018-10-14 20:25:05 (10 months 9 days ago)
Author:ErmaC
Commit:2917
Parents: 2916
Message:SMBIOS update (Credits to MinusZwei)
Changes:
M/branches/ErmaC/Enoch/i386/libsaio/smbios.c
M/trunk/i386/libsaio/smbios.c

File differences

trunk/i386/libsaio/smbios.c
200200
201201
202202
203
204
205
206203
207204
208
209
210
211
212
213
214
215
216205
217206
218207
......
394383
395384
396385
397
386
398387
399
388
400389
401390
402391
......
453442
454443
455444
456
457
458445
459446
460447
......
565552
566553
567554
568
569
570
571
572
573555
574556
575557
......
927909
928910
929911
930
912
913
914
915
916
917
918
919
920
921
922
931923
932
933
924
925
934926
935
936
937
938
927
928
929
930
939931
940
941
932
933
942934
943
944
945
946
935
936
937
938
947939
948
949
950
940
941
942
943
951944
952945
953946
defaultChassis_t defaultChassis;
/* =====================================================
Firmware Volume Description (Apple Specific - Type 128)
===================================================== */
typedef struct
{
uint32_t firmwareFeatures;
uint32_t firmwareFeaturesMask;
} defaultFirmwareVolume_t;
defaultFirmwareVolume_t defaultFirmwareVolume;
typedef struct
{
uint8_ttype;
SMBValueTypevalueType;
uint8_tfieldOffset;
// Firmware Volume Description (Apple Specific - Type 128)
// kSMBTypeFirmwareVolume
{kSMBTypeFirmwareVolume, kSMBDWord, getFieldOffset(SMBFirmwareVolume, FirmwareFeatures),
kSMBFirmwareVolumeFirmwareFeaturesKey, NULL, (char **)&defaultFirmwareVolume.firmwareFeatures},
kSMBFirmwareVolumeFirmwareFeaturesKey, NULL, NULL},
{kSMBTypeFirmwareVolume, kSMBDWord, getFieldOffset(SMBFirmwareVolume, FirmwareFeaturesMask),
kSMBFirmwareVolumeFirmwareFeaturesMaskKey, NULL, (char **)&defaultFirmwareVolume.firmwareFeaturesMask},
kSMBFirmwareVolumeFirmwareFeaturesMaskKey, NULL, NULL},
// Memory SPD Data (Apple Specific - Type 130)
// kSMBTypeMemorySPD
//#define kDefaultBoardProcessorType"11" // 0xB
#define kDefaultSystemVersion"1.0"
#define kDefaultBIOSRelease256 // 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0)
#define kDefaultFirmwareFeatures0xE907F537; //unknown - use oem SMBIOS value to be default
#define kDefaultFirmwareFeaturesMask0xFFFFFFFF; //unknown - use oem SMBIOS value to be default
//=========== Mac mini ===========
defaultChassis.assetTag = kDefaultAssetTag;
defaultChassis.skuNumber = kDefaultSkuNumber;
// set default firmware features and mask values
// those values will be used whenever no valid key values are found in smbios.plist
defaultFirmwareVolume.firmwareFeatures = kDefaultFirmwareFeatures;
defaultFirmwareVolume.firmwareFeaturesMask = kDefaultFirmwareFeaturesMask;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing
if (PlatformType == 2) // this works but it's a substitute
{
============================================= */
void addSMBFirmwareVolume(SMBStructPtrs *structPtr)
{
SMBFirmwareVolume *p = (SMBFirmwareVolume *)structPtr->new;
int val;
//
// Several old Macs don't have a firmware volume block in their SMBIOS.
// Therefore, the block will only be added if the keys are set in the plist
// file.
//
if (getIntForKey(kSMBFirmwareVolumeFirmwareFeaturesKey, &val, SMBPlist) &&
getIntForKey(kSMBFirmwareVolumeFirmwareFeaturesMaskKey, &val, SMBPlist))
{
SMBFirmwareVolume *p = (SMBFirmwareVolume *)structPtr->new;
// initialise new table
bzero(p, sizeof(SMBFirmwareVolume));
// initialize new table
bzero(p, sizeof(SMBFirmwareVolume));
// common rules
p->header.type = kSMBTypeFirmwareVolume;
p->header.length = sizeof(SMBFirmwareVolume);
p->header.handle = 0x8000;
// common rules
p->header.type = kSMBTypeFirmwareVolume;
p->header.length = sizeof(SMBFirmwareVolume);
p->header.handle = 0x8000;
setSMBValue(structPtr, numOfSetters - 4 , (returnType *)(void *)&(p->FirmwareFeatures));
setSMBValue(structPtr, numOfSetters - 3 , (returnType *)(void *)&(p->FirmwareFeaturesMask));
setSMBValue(structPtr, numOfSetters - 4 , (returnType *)(void *)&(p->FirmwareFeatures));
setSMBValue(structPtr, numOfSetters - 3 , (returnType *)(void *)&(p->FirmwareFeaturesMask));
p->RegionCount = 1;
p->RegionType[0] = FW_REGION_MAIN;
p->FlashMap[0].StartAddress = 0xFFE00000;
p->FlashMap[0].EndAddress = 0xFFEFFFFF;
p->RegionCount = 1;
p->RegionType[0] = FW_REGION_MAIN;
p->FlashMap[0].StartAddress = 0xFFE00000;
p->FlashMap[0].EndAddress = 0xFFEFFFFF;
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBFirmwareVolume) + 2);
tableLength += sizeof(SMBFirmwareVolume) + 2;
structureCount++;
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBFirmwareVolume) + 2);
tableLength += sizeof(SMBFirmwareVolume) + 2;
structureCount++;
}
return;
}
branches/ErmaC/Enoch/i386/libsaio/smbios.c
200200
201201
202202
203
204
205
206203
207204
208
209
210
211
212
213
214
215
216205
217206
218207
......
394383
395384
396385
397
386
398387
399
388
400389
401390
402391
......
453442
454443
455444
456
457
458445
459446
460447
......
565552
566553
567554
568
569
570
571
572
573555
574556
575557
......
927909
928910
929911
930
912
913
914
915
916
917
918
919
920
921
922
931923
932
933
924
925
934926
935
936
937
938
927
928
929
930
939931
940
941
932
933
942934
943
944
945
946
935
936
937
938
947939
948
949
950
940
941
942
943
951944
952945
953946
defaultChassis_t defaultChassis;
/* =====================================================
Firmware Volume Description (Apple Specific - Type 128)
===================================================== */
typedef struct
{
uint32_t firmwareFeatures;
uint32_t firmwareFeaturesMask;
} defaultFirmwareVolume_t;
defaultFirmwareVolume_t defaultFirmwareVolume;
typedef struct
{
uint8_ttype;
SMBValueTypevalueType;
uint8_tfieldOffset;
// Firmware Volume Description (Apple Specific - Type 128)
// kSMBTypeFirmwareVolume
{kSMBTypeFirmwareVolume, kSMBDWord, getFieldOffset(SMBFirmwareVolume, FirmwareFeatures),
kSMBFirmwareVolumeFirmwareFeaturesKey, NULL, (char **)&defaultFirmwareVolume.firmwareFeatures},
kSMBFirmwareVolumeFirmwareFeaturesKey, NULL, NULL},
{kSMBTypeFirmwareVolume, kSMBDWord, getFieldOffset(SMBFirmwareVolume, FirmwareFeaturesMask),
kSMBFirmwareVolumeFirmwareFeaturesMaskKey, NULL, (char **)&defaultFirmwareVolume.firmwareFeaturesMask},
kSMBFirmwareVolumeFirmwareFeaturesMaskKey, NULL, NULL},
// Memory SPD Data (Apple Specific - Type 130)
// kSMBTypeMemorySPD
//#define kDefaultBoardProcessorType"11" // 0xB
#define kDefaultSystemVersion"1.0"
#define kDefaultBIOSRelease256 // 256 = 0x0100 -> swap bytes: 0x0001 -> Release: 0.1 (see SMBIOS spec. table Type 0)
#define kDefaultFirmwareFeatures0xE907F537; //unknown - use oem SMBIOS value to be default
#define kDefaultFirmwareFeaturesMask0xFFFFFFFF; //unknown - use oem SMBIOS value to be default
//=========== Mac mini ===========
defaultChassis.assetTag = kDefaultAssetTag;
defaultChassis.skuNumber = kDefaultSkuNumber;
// set default firmware features and mask values
// those values will be used whenever no valid key values are found in smbios.plist
defaultFirmwareVolume.firmwareFeatures = kDefaultFirmwareFeatures;
defaultFirmwareVolume.firmwareFeaturesMask = kDefaultFirmwareFeaturesMask;
// if (platformCPUFeature(CPU_FEATURE_MOBILE)) Bungo: doesn't recognise correctly, need fixing
if (PlatformType == 2) // this works but it's a substitute
{
============================================= */
void addSMBFirmwareVolume(SMBStructPtrs *structPtr)
{
SMBFirmwareVolume *p = (SMBFirmwareVolume *)structPtr->new;
int val;
//
// Several old Macs don't have a firmware volume block in their SMBIOS.
// Therefore, the block will only be added if the keys are set in the plist
// file.
//
if (getIntForKey(kSMBFirmwareVolumeFirmwareFeaturesKey, &val, SMBPlist) &&
getIntForKey(kSMBFirmwareVolumeFirmwareFeaturesMaskKey, &val, SMBPlist))
{
SMBFirmwareVolume *p = (SMBFirmwareVolume *)structPtr->new;
// initialise new table
bzero(p, sizeof(SMBFirmwareVolume));
// initialize new table
bzero(p, sizeof(SMBFirmwareVolume));
// common rules
p->header.type = kSMBTypeFirmwareVolume;
p->header.length = sizeof(SMBFirmwareVolume);
p->header.handle = 0x8000;
// common rules
p->header.type = kSMBTypeFirmwareVolume;
p->header.length = sizeof(SMBFirmwareVolume);
p->header.handle = 0x8000;
setSMBValue(structPtr, numOfSetters - 4 , (returnType *)(void *)&(p->FirmwareFeatures));
setSMBValue(structPtr, numOfSetters - 3 , (returnType *)(void *)&(p->FirmwareFeaturesMask));
setSMBValue(structPtr, numOfSetters - 4 , (returnType *)(void *)&(p->FirmwareFeatures));
setSMBValue(structPtr, numOfSetters - 3 , (returnType *)(void *)&(p->FirmwareFeaturesMask));
p->RegionCount = 1;
p->RegionType[0] = FW_REGION_MAIN;
p->FlashMap[0].StartAddress = 0xFFE00000;
p->FlashMap[0].EndAddress = 0xFFEFFFFF;
p->RegionCount = 1;
p->RegionType[0] = FW_REGION_MAIN;
p->FlashMap[0].StartAddress = 0xFFE00000;
p->FlashMap[0].EndAddress = 0xFFEFFFFF;
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBFirmwareVolume) + 2);
tableLength += sizeof(SMBFirmwareVolume) + 2;
structureCount++;
structPtr->new = (SMBStructHeader *)((uint8_t *)structPtr->new + sizeof(SMBFirmwareVolume) + 2);
tableLength += sizeof(SMBFirmwareVolume) + 2;
structureCount++;
}
return;
}

Archive Download the corresponding diff file

Revision: 2917