mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2025-01-31 22:31:31 +01:00
fix trust smbios
Signed-off-by: Slice <sergey.slice@gmail.com>
This commit is contained in:
parent
1947d48706
commit
fa55f15b4f
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>ACPI</key>
|
<key>ACPI</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>AutoMerge</key>
|
<key>AutoMerge</key>
|
||||||
@ -926,7 +926,7 @@
|
|||||||
</dict>
|
</dict>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Comment</key>
|
<key>Comment</key>
|
||||||
<string>ATI name HD xxxx -> HD6450</string>
|
<string>ATI name HD xxxx -> HD6450</string>
|
||||||
<key>Disabled</key>
|
<key>Disabled</key>
|
||||||
<true/>
|
<true/>
|
||||||
<key>Find</key>
|
<key>Find</key>
|
||||||
@ -1118,11 +1118,11 @@
|
|||||||
<string>Part Component</string>
|
<string>Part Component</string>
|
||||||
<key>Manufacturer?</key>
|
<key>Manufacturer?</key>
|
||||||
<string>Apple Inc.</string>
|
<string>Apple Inc.</string>
|
||||||
<key>Memory?</key>
|
<key>Memory</key>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Channels</key>
|
<key>Channels</key>
|
||||||
<integer>2</integer>
|
<integer>2</integer>
|
||||||
<key>Modules</key>
|
<key>Modules?</key>
|
||||||
<array>
|
<array>
|
||||||
<dict>
|
<dict>
|
||||||
<key>Frequency</key>
|
<key>Frequency</key>
|
||||||
@ -1157,7 +1157,7 @@
|
|||||||
<string>Kingston</string>
|
<string>Kingston</string>
|
||||||
</dict>
|
</dict>
|
||||||
</array>
|
</array>
|
||||||
<key>SlotCount</key>
|
<key>SlotCount?</key>
|
||||||
<integer>4</integer>
|
<integer>4</integer>
|
||||||
</dict>
|
</dict>
|
||||||
<key>MemoryRank?</key>
|
<key>MemoryRank?</key>
|
||||||
@ -1327,5 +1327,5 @@
|
|||||||
<key>NvidiaWeb?</key>
|
<key>NvidiaWeb?</key>
|
||||||
<false/>
|
<false/>
|
||||||
</dict>
|
</dict>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
@ -41,7 +41,37 @@ const card_config_t card_configs[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const radeon_card_info_t radeon_cards[] = {
|
const radeon_card_info_t radeon_cards[] = {
|
||||||
|
/* Vega 20 */
|
||||||
|
{ 0x66AF, CHIP_FAMILY_VEGA20, "AMD Radeon VII", kNull },
|
||||||
|
// Polaris 10
|
||||||
{ 0x67DF, CHIP_FAMILY_ELLESMERE, "AMD Radeon RX 480/570/580", kNull },
|
{ 0x67DF, CHIP_FAMILY_ELLESMERE, "AMD Radeon RX 480/570/580", kNull },
|
||||||
|
// Polaris 11
|
||||||
|
{ 0x67E0, CHIP_FAMILY_BAFFIN, "AMD Radeon RX 460", kNull },
|
||||||
|
{ 0x67E3, CHIP_FAMILY_BAFFIN, "AMD Radeon Pro WX4100", kNull },
|
||||||
|
{ 0x67EF, CHIP_FAMILY_BAFFIN, "AMD Radeon Pro 555", kNull },
|
||||||
|
{ 0x67FF, CHIP_FAMILY_BAFFIN, "AMD Radeon RX 560", kNull },
|
||||||
|
/* Vega 10 */
|
||||||
|
{ 0x6863, CHIP_FAMILY_VEGA10, "AMD Radeon Vega Frontier", kNull },
|
||||||
|
{ 0x6867, CHIP_FAMILY_VEGA10, "AMD Radeon Pro Vega 56", kNull },
|
||||||
|
{ 0x687F, CHIP_FAMILY_VEGA10, "AMD Radeon Vega 64", kNull },
|
||||||
|
/* Polaris12 */
|
||||||
|
{ 0x6987, CHIP_FAMILY_GREENLAND, "AMD Radeon RX640", kNull },
|
||||||
|
{ 0x699F, CHIP_FAMILY_GREENLAND, "AMD Radeon RX550", kNull },
|
||||||
|
// Fiji
|
||||||
|
{ 0x7300, CHIP_FAMILY_FIJI, "AMD Radeon R9 Fury", kNull },
|
||||||
|
// Navi10
|
||||||
|
{ 0x731F, CHIP_FAMILY_NAVI10, "AMD Radeon RX5700", kNull },
|
||||||
|
// Navi15
|
||||||
|
{ 0x7340, CHIP_FAMILY_NAVI10, "AMD Radeon RX5500", kNull },
|
||||||
|
{ 0x7360, CHIP_FAMILY_NAVI10, "AMD Radeon Pro RX5600M", kNull }, // found in MacBookPro16,4
|
||||||
|
// Navi2x
|
||||||
|
{ 0x73A5, CHIP_FAMILY_NAVI20, "AMD Radeon RX6950XT", kNull },
|
||||||
|
{ 0x73AF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6900XT", kNull },
|
||||||
|
{ 0x73BF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6800XT", kNull },
|
||||||
|
{ 0x73DF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6700XT", kNull },
|
||||||
|
{ 0x73EF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6650XT", kNull },
|
||||||
|
{ 0x73FF, CHIP_FAMILY_NAVI20, "AMD Radeon RX6600XT", kNull },
|
||||||
|
|
||||||
{ 0x0000, CHIP_FAMILY_UNKNOW, "AMD Unknown", kNull }
|
{ 0x0000, CHIP_FAMILY_UNKNOW, "AMD Unknown", kNull }
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1205,7 +1235,7 @@ Lexa-based WX 2100, WX 3100 and WX 3200 do NOT work.
|
|||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if ATI_LESS
|
#if 0 //ATI_LESS
|
||||||
const CHAR8 *chip_family_name[] = {
|
const CHAR8 *chip_family_name[] = {
|
||||||
"UNKNOW",
|
"UNKNOW",
|
||||||
"Ellesmere",
|
"Ellesmere",
|
||||||
@ -1281,6 +1311,9 @@ const CHAR8 *chip_family_name[] = {
|
|||||||
"Baffin",
|
"Baffin",
|
||||||
"Greenland",
|
"Greenland",
|
||||||
"Vega10",
|
"Vega10",
|
||||||
|
"Vega20",
|
||||||
|
"Navi10",
|
||||||
|
"Navi20",
|
||||||
// Vega11
|
// Vega11
|
||||||
// Navi
|
// Navi
|
||||||
""
|
""
|
||||||
@ -1806,7 +1839,7 @@ XBool load_vbios_file(UINT16 vendor_id, UINT16 device_id)
|
|||||||
void get_vram_size(void)
|
void get_vram_size(void)
|
||||||
{
|
{
|
||||||
//check card->vram_size in bytes!
|
//check card->vram_size in bytes!
|
||||||
ati_chip_family_t chip_family = card->info->chip_family;
|
ati_chip_family_t chip_family = CHIP_FAMILY_UNKNOW; //card->info->chip_family;
|
||||||
|
|
||||||
card->vram_size = 128 << 20; //default 128Mb, this is minimum for OS
|
card->vram_size = 128 << 20; //default 128Mb, this is minimum for OS
|
||||||
if (gSettings.Graphics.VRAM != 0) {
|
if (gSettings.Graphics.VRAM != 0) {
|
||||||
|
@ -160,7 +160,6 @@ SMBIOS_TABLE_STRING SMBIOS_TABLE_TYPE4_STR_IDX[] = {
|
|||||||
// validate the SMBIOS entry point structure
|
// validate the SMBIOS entry point structure
|
||||||
XBool IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure)
|
XBool IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructure)
|
||||||
{
|
{
|
||||||
UINTN I;
|
|
||||||
UINT8 Length;
|
UINT8 Length;
|
||||||
UINT8 Checksum = 0;
|
UINT8 Checksum = 0;
|
||||||
UINT8 *BytePtr;
|
UINT8 *BytePtr;
|
||||||
@ -171,7 +170,7 @@ XBool IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructu
|
|||||||
BytePtr = (UINT8*) EntryPointStructure;
|
BytePtr = (UINT8*) EntryPointStructure;
|
||||||
Length = EntryPointStructure->EntryPointLength;
|
Length = EntryPointStructure->EntryPointLength;
|
||||||
|
|
||||||
for (I = 0; I < Length; I++) {
|
for (UINTN I = 0; I < Length; I++) {
|
||||||
Checksum = Checksum + (UINT8) BytePtr[I];
|
Checksum = Checksum + (UINT8) BytePtr[I];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,10 +180,8 @@ XBool IsEntryPointStructureValid (IN SMBIOS_TABLE_ENTRY_POINT *EntryPointStructu
|
|||||||
|
|
||||||
void* FindOemSMBIOSPtr (void)
|
void* FindOemSMBIOSPtr (void)
|
||||||
{
|
{
|
||||||
UINTN Address;
|
|
||||||
|
|
||||||
// Search 0x0f0000 - 0x0fffff for SMBIOS Ptr
|
// Search 0x0f0000 - 0x0fffff for SMBIOS Ptr
|
||||||
for (Address = 0xf0000; Address < 0xfffff; Address += 0x10) {
|
for (UINTN Address = 0xf0000; Address < 0xfffff; Address += 0x10) {
|
||||||
if (*(UINT32 *)(Address) == SMBIOS_PTR && IsEntryPointStructureValid((SMBIOS_TABLE_ENTRY_POINT*)Address)) {
|
if (*(UINT32 *)(Address) == SMBIOS_PTR && IsEntryPointStructureValid((SMBIOS_TABLE_ENTRY_POINT*)Address)) {
|
||||||
return (void *)Address;
|
return (void *)Address;
|
||||||
}
|
}
|
||||||
@ -217,7 +214,7 @@ void* GetSmbiosTablesFromHob (void)
|
|||||||
void* GetSmbiosTablesFromConfigTables (void)
|
void* GetSmbiosTablesFromConfigTables (void)
|
||||||
{
|
{
|
||||||
EFI_STATUS Status;
|
EFI_STATUS Status;
|
||||||
EFI_PHYSICAL_ADDRESS *Table;
|
EFI_PHYSICAL_ADDRESS *Table = NULL;
|
||||||
|
|
||||||
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (void **)&Table);
|
Status = EfiGetSystemConfigurationTable (&gEfiSmbiosTableGuid, (void **)&Table);
|
||||||
if (EFI_ERROR(Status) || Table == NULL) {
|
if (EFI_ERROR(Status) || Table == NULL) {
|
||||||
@ -1604,41 +1601,42 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
|
|||||||
// Detect whether the SMBIOS is trusted information
|
// Detect whether the SMBIOS is trusted information
|
||||||
if (trustSMBIOS) {
|
if (trustSMBIOS) {
|
||||||
if (gRAM.SMBIOS.size() != 0) {
|
if (gRAM.SMBIOS.size() != 0) {
|
||||||
if (gRAM.SPD.size() != 0) {
|
// if (gRAM.SPD.size() != 0) {
|
||||||
if (gRAM.SPD.size() != gRAM.SMBIOS.size()) {
|
// if (gRAM.SPD.size() != gRAM.SMBIOS.size()) {
|
||||||
// Prefer the SPD information
|
// // Prefer the SPD information -- no, we trust SMBIOS!
|
||||||
if (gRAM.SPD.size() > gRAM.SMBIOS.size()) {
|
// if (gRAM.SPD.size() > gRAM.SMBIOS.size()) {
|
||||||
DBG("Not trusting SMBIOS because SPD reports more modules...\n");
|
// DBG("Not trusting SMBIOS because SPD reports more modules...\n");
|
||||||
trustSMBIOS = false;
|
// trustSMBIOS = false;
|
||||||
} else if (gRAM.SPD.doesSlotForIndexExist(0) || !gRAM.SMBIOS.doesSlotForIndexExist(0)) {
|
// } else if (gRAM.SPD.doesSlotForIndexExist(0) || !gRAM.SMBIOS.doesSlotForIndexExist(0)) {
|
||||||
if (gRAM.SPD.size() > 1) {
|
// if (gRAM.SPD.size() > 1) {
|
||||||
DBG("Not trusting SMBIOS because SPD reports different modules...\n");
|
// DBG("Not trusting SMBIOS because SPD reports different modules...\n");
|
||||||
trustSMBIOS = false;
|
// trustSMBIOS = false;
|
||||||
} else if (gRAM.SMBIOS.size() == 1) {
|
// } else if (gRAM.SMBIOS.size() == 1) {
|
||||||
channels = 1;
|
// channels = 1;
|
||||||
}
|
// }
|
||||||
} else if (gRAM.SPD.size() == 1) {
|
// } else if (gRAM.SPD.size() == 1) {
|
||||||
// The SMBIOS may contain table for built-in module
|
// // The SMBIOS may contain table for built-in module
|
||||||
if (gRAM.SMBIOS.size() <= 2) {
|
// if (gRAM.SMBIOS.size() <= 2) {
|
||||||
if (!gRAM.SMBIOS.doesSlotForIndexExist(0) || !gRAM.SPD.doesSlotForIndexExist(2) ||
|
// if (!gRAM.SMBIOS.doesSlotForIndexExist(0) || !gRAM.SPD.doesSlotForIndexExist(2) ||
|
||||||
(gRAM.SMBIOS.getSlotInfoForSlotIndex(0).Frequency != gRAM.SPD.getSlotInfoForSlotIndex(2).Frequency) ||
|
// (gRAM.SMBIOS.getSlotInfoForSlotIndex(0).Frequency != gRAM.SPD.getSlotInfoForSlotIndex(2).Frequency) ||
|
||||||
(gRAM.SMBIOS.getSlotInfoForSlotIndex(0).ModuleSize != gRAM.SPD.getSlotInfoForSlotIndex(2).ModuleSize)) {
|
// (gRAM.SMBIOS.getSlotInfoForSlotIndex(0).ModuleSize != gRAM.SPD.getSlotInfoForSlotIndex(2).ModuleSize)) {
|
||||||
channels = 1;
|
// channels = 1;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
DBG("Not trusting SMBIOS because SPD reports only one module...\n");
|
// DBG("Not trusting SMBIOS because SPD reports only one module...\n");
|
||||||
trustSMBIOS = false;
|
// trustSMBIOS = false;
|
||||||
}
|
// }
|
||||||
} else {
|
// } else {
|
||||||
DBG("Not trusting SMBIOS because SPD reports less modules...\n");
|
// DBG("Not trusting SMBIOS because SPD reports less modules...\n");
|
||||||
trustSMBIOS = false;
|
// trustSMBIOS = false;
|
||||||
}
|
// }
|
||||||
} else if (gRAM.SPD.doesSlotForIndexExist(0) != gRAM.SMBIOS.doesSlotForIndexExist(0)) {
|
// } else if (gRAM.SPD.doesSlotForIndexExist(0) != gRAM.SMBIOS.doesSlotForIndexExist(0)) {
|
||||||
// Never trust a sneaky SMBIOS!
|
// // Never trust a sneaky SMBIOS!
|
||||||
DBG("Not trusting SMBIOS because it's being sneaky...\n");
|
// DBG("Not trusting SMBIOS because it's being sneaky...\n");
|
||||||
trustSMBIOS = false;
|
// trustSMBIOS = false;
|
||||||
}
|
// }
|
||||||
} else if (gRAM.SMBIOS.size() == 1) {
|
// } else
|
||||||
|
if (gRAM.SMBIOS.size() == 1) {
|
||||||
channels = 1;
|
channels = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1656,7 +1654,7 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
|
|||||||
// Check if smbios has a good total count
|
// Check if smbios has a good total count
|
||||||
if ( (!gMobile || smbiosSettings.RamSlotCount == 2) && expectedCount < smbiosSettings.RamSlotCount ) {
|
if ( (!gMobile || smbiosSettings.RamSlotCount == 2) && expectedCount < smbiosSettings.RamSlotCount ) {
|
||||||
if ( smbiosSettings.RamSlotCount > MAX_UINT8 ) {
|
if ( smbiosSettings.RamSlotCount > MAX_UINT8 ) {
|
||||||
log_technical_bug("smbiosSettings.RamSlotCount > MAX_UINT8");
|
// log_technical_bug("smbiosSettings.RamSlotCount > MAX_UINT8");
|
||||||
expectedCount = MAX_RAM_SLOTS;
|
expectedCount = MAX_RAM_SLOTS;
|
||||||
}else{
|
}else{
|
||||||
expectedCount = (UINT8)smbiosSettings.RamSlotCount;
|
expectedCount = (UINT8)smbiosSettings.RamSlotCount;
|
||||||
@ -2279,7 +2277,7 @@ void PatchSmbios(const SmbiosInjectedSettings& smbiosSettings) //continue
|
|||||||
PatchTableTypeSome();
|
PatchTableTypeSome();
|
||||||
auto SlotCounts = smbiosSettings.RamSlotCount;
|
auto SlotCounts = smbiosSettings.RamSlotCount;
|
||||||
if ( SlotCounts > MAX_RAM_SLOTS ) {
|
if ( SlotCounts > MAX_RAM_SLOTS ) {
|
||||||
log_technical_bug("GetTableType16() assign smbiosSettings.RamSlotCount a value bigger than MAX_RAM_SLOTS");
|
// log_technical_bug("GetTableType16() assign smbiosSettings.RamSlotCount a value bigger than MAX_RAM_SLOTS");
|
||||||
SlotCounts = MAX_RAM_SLOTS;
|
SlotCounts = MAX_RAM_SLOTS;
|
||||||
}
|
}
|
||||||
XArray<UINT16> mMemory17;
|
XArray<UINT16> mMemory17;
|
||||||
|
@ -3520,7 +3520,7 @@ displayFreeMemory("Before RunMainMenu"_XS8);
|
|||||||
AfterTool = true;
|
AfterTool = true;
|
||||||
}
|
}
|
||||||
#ifdef ENABLE_SECURE_BOOT
|
#ifdef ENABLE_SECURE_BOOT
|
||||||
log_technical_bug("not done yet");
|
//log_technical_bug("not done yet");
|
||||||
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
|
// if ( ChosenEntry->getREFIT_MENU_ENTRY_SECURE_BOOT() ) { // Try to enable secure boot
|
||||||
// EnableSecureBoot();
|
// EnableSecureBoot();
|
||||||
// MainLoopRunning = false;
|
// MainLoopRunning = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user