Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions rEFIt_UEFI/Platform/AcpiPatcher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -687,9 +687,7 @@ void PreCleanupRSDT()
}

//REVIEW: really?
// Если адрес RSDT < адреса XSDT и хвост RSDT наползает на XSDT, то подрезаем хвост RSDT до начала XSDT
// English: If the RSDT address of the XSDT address and the tail of the RSDT crawls onto the XSDT, then we
// trim the RSDT tail before the XSDT starts
// If RSDT address < XSDT address and RSDT tail overlaps with XSDT, then trim RSDT tail to the start of XSDT
if ((UINTN)Rsdt < (UINTN)Xsdt && (UINTN)Rsdt + Rsdt->Header.Length > (UINTN)Xsdt) {
UINTN v = ((UINTN)Xsdt - (UINTN)Rsdt) & ~3;
Rsdt->Header.Length = (UINT32)v;
Expand Down
4 changes: 2 additions & 2 deletions rEFIt_UEFI/Platform/Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -472,10 +472,10 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData)

if ( settingsData.RtVariables.RtROMAsString.isEqualIC("UseMacAddr0") ) {
if ( gConf.LanCardArray.size() > 0 ) GlobalConfig.RtROM.ncpy(&gConf.LanCardArray[0].MacAddress[0], 6);
else GlobalConfig.RtROM.memset(0, 6);
else GlobalConfig.RtROM.setEmpty();
} else if ( settingsData.RtVariables.RtROMAsString.isEqualIC("UseMacAddr1") ) {
if ( gConf.LanCardArray.size() > 1 ) GlobalConfig.RtROM.ncpy(&gConf.LanCardArray[1].MacAddress[0], 6);
else GlobalConfig.RtROM.memset(0, 6);
else GlobalConfig.RtROM.setEmpty();
}else{
GlobalConfig.RtROM = settingsData.RtVariables.RtROMAsData;
}
Expand Down
25 changes: 18 additions & 7 deletions rEFIt_UEFI/Platform/cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1159,12 +1159,13 @@ void GetCPUProperties (void)
tmpU = gCPUStructure.FSBFrequency;
DBG("Corrected FSBFrequency = %llu MHz\n", DivU64x32(tmpU, Mega));

if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) && (gCPUStructure.Model == CPU_MODEL_NEHALEM)) {
if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) &&
((gCPUStructure.Model == CPU_MODEL_NEHALEM) || (gCPUStructure.Model == CPU_MODEL_NEHALEM_EX) ||
(gCPUStructure.Model == CPU_MODEL_WESTMERE) || (gCPUStructure.Model == CPU_MODEL_WESTMERE_EX))) {
//Slice - for Nehalem we can do more calculation as in Cham
// but this algo almost always wrong
//
// thanks to dgobe for i3/i5/i7 bus speed detection
// TODO: consider more Nehalem based CPU(?) ex. CPU_MODEL_NEHALEM_EX, CPU_MODEL_WESTMERE, CPU_MODEL_WESTMERE_EX
// info: https://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors#Nehalem-based_Xeons
qpimult = 2; //init
/* Scan PCI BUS For QPI Frequency */
Expand Down Expand Up @@ -1612,7 +1613,11 @@ MacModel GetDefaultModel()
case CPU_MODEL_ICELAKE_A:
case CPU_MODEL_ICELAKE_C:
case CPU_MODEL_ICELAKE_D:
case CPU_MODEL_ALDERLAKE_ULT: //???
case CPU_MODEL_TIGERLAKE_C:
case CPU_MODEL_TIGERLAKE_D:
case CPU_MODEL_ALDERLAKE_ULT:
case CPU_MODEL_RAPTORLAKE_B:
case CPU_MODEL_METEORLAKE:
case CPU_MODEL_ARROWLAKE_U:
DefaultType = MacBookPro161;
break;
Expand Down Expand Up @@ -1725,16 +1730,22 @@ MacModel GetDefaultModel()
case CPU_MODEL_BROADWELL_E5:
DefaultType = MacPro61;
break;
case CPU_MODEL_ALDERLAKE:

case CPU_MODEL_RAPTORLAKE_B:
case CPU_MODEL_COMETLAKE_S:
if ( gCPUStructure.BrandString.contains("i9") ) {
DefaultType = iMac202;
break;
}
DefaultType = iMac201;
break;
case CPU_MODEL_ROCKETLAKE:
DefaultType = iMac201;
break;
case CPU_MODEL_ALDERLAKE:
case CPU_MODEL_RAPTORLAKE:
case CPU_MODEL_METEORLAKE:
case CPU_MODEL_ARROWLAKE:
case CPU_MODEL_ARROWLAKE_X:

case CPU_MODEL_RAPTORLAKE_B:
DefaultType = MacPro71;
break;
default:
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/device_inject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
return NULL;
}

//просмотреть StringBuf->entries[] в поисках такого же девайса
// scan StringBuf->entries[] for the same device
//SameDevice(DevPropDevice* D1, DevPropDevice* D2)

if (!DevicePath && (PciDt != 0)) {
Expand Down
2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/platformdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ UINT64 GetPlatformFeature(MacModel Model)
case MacBookAir82:
case MacBookAir91:
return 0x1A; //3A;
// It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
// It is nonsense, ASCII code character "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
default:
return 0xFFFF; // disabled
}
Expand Down
72 changes: 56 additions & 16 deletions rEFIt_UEFI/Platform/smbios.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1278,14 +1278,26 @@ void PatchTableType16(const SmbiosInjectedSettings& smbiosSettings)
ZeroMem((void*)newSmbiosTable.Type16, MAX_TABLE_SIZE);
CopyMem((void*)newSmbiosTable.Type16, (void*)SmbiosTable.Type16, TableSize);
newSmbiosTable.Type16->Hdr.Handle = mHandle16;
MacModel Model = GetModelFromString(smbiosSettings.ProductName);

if (Model == MacPro71) {
newSmbiosTable.Type16->MemoryErrorCorrection = MemoryErrorCorrectionMultiBitEcc;
newSmbiosTable.Type16->MaximumCapacity = 0x60000000; // 1.5 TB in KB
newSmbiosTable.Type16->ExtendedMaximumCapacity = 0;
}

// Slice - I am not sure if I want these values
// newSmbiosTable.Type16->Location = MemoryArrayLocationProprietaryAddonCard;
// newSmbiosTable.Type16->Use = MemoryArrayUseSystemMemory;
// newSmbiosTable.Type16->MemoryErrorCorrection = MemoryErrorCorrectionMultiBitEcc;
// MemoryErrorInformationHandle
newSmbiosTable.Type16->MemoryErrorInformationHandle = 0xFFFF;
newSmbiosTable.Type16->NumberOfMemoryDevices = smbiosSettings.RamSlotCount; // RamSlotCount is <= MAX_RAM_SLOTS), see GetTableType16()
DBG("NumberOfMemoryDevices = %d\n", smbiosSettings.RamSlotCount);
UINT16 DeviceCount = smbiosSettings.RamSlotCount; // RamSlotCount is <= MAX_RAM_SLOTS), see GetTableType16()
if (Model == MacPro71 && DeviceCount < 12) {
DeviceCount = 12;
}
newSmbiosTable.Type16->NumberOfMemoryDevices = DeviceCount;
DBG("NumberOfMemoryDevices = %d\n", DeviceCount);
LogSmbiosTable(newSmbiosTable);
}

Expand Down Expand Up @@ -1392,6 +1404,7 @@ void GetTableType17(SmbiosDiscoveredSettings* smbiosSettings)
if (SmbiosTable.Type17->Size == 0x7FFF) {
rsi.ModuleSize = SmbiosTable.Type17->ExtendedSize;
}
rsi.Type = SmbiosTable.Type17->MemoryType;
}
// Determine if module frequency is sane value
if ((SmbiosTable.Type17->Speed > 0) && (SmbiosTable.Type17->Speed <= MAX_RAM_FREQUENCY)) {
Expand Down Expand Up @@ -1464,12 +1477,8 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
XBool insertingEmpty = true;
XBool trustSMBIOS = ( gRAM.SPD.size() == 0 || smbiosSettings.TrustSMBIOS);
XBool wrongSMBIOSBanks = false;
XBool isMacPro = false;

MacModel Model = GetModelFromString(smbiosSettings.ProductName);
if ((Model == MacPro31) || (Model == MacPro41) || (Model == MacPro51) || (Model == MacPro61) || (Model == MacPro71)) {
isMacPro = true;
}
XBool isOldMacPro = (Model == MacPro31) || (Model == MacPro41) || (Model == MacPro51) || (Model == MacPro61);
// Inject user memory tables
if (smbiosSettings.InjectMemoryTables)
{
Expand All @@ -1485,7 +1494,7 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
}
DBG("Channels: %d\n", UserChannels);
// Setup interleaved channel map
if (channels >= 2) {
if (channels >= 2 && Model != MacPro71) {
UINT8 doubleChannels = (UINT8)UserChannels << 1;
for (size_t Index = 0; Index < mMemory17.size(); ++Index) {
channelMap[Index] = (UINT8)(((Index / doubleChannels) * doubleChannels) +
Expand Down Expand Up @@ -1535,8 +1544,14 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
newSmbiosTable.Type17->TypeDetail.Synchronous = true;
newSmbiosTable.Type17->DeviceSet = bank + 1;
newSmbiosTable.Type17->MemoryArrayHandle = mHandle16;
if (isMacPro) {
if (isOldMacPro) {
deviceLocator.S8Printf("DIMM%zd", Index + 1);
} else if (Model == MacPro71) {
newSmbiosTable.Type17->TotalWidth = 72;
newSmbiosTable.Type17->DataWidth = 64;
deviceLocator.S8Printf("DIMM%zu", Index + 1);
bankLocator.S8Printf("BANK %d", bank);
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator);
} else {
deviceLocator.S8Printf("DIMM%d", bank);
bankLocator.S8Printf("BANK %zu", Index % channels);
Expand Down Expand Up @@ -1672,7 +1687,7 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
}
}
// Check for interleaved channels
if (channels >= 2) {
if (channels >= 2 && Model != MacPro71) {
wrongSMBIOSBanks = ((gRAM.SMBIOS.doesSlotForIndexExist(1) != gRAM.SPD.doesSlotForIndexExist(1)) ||
(gRAM.SMBIOS.getSlotInfoForSlotIndex(1).ModuleSize != gRAM.SPD.getSlotInfoForSlotIndex(1).ModuleSize));
}
Expand Down Expand Up @@ -1749,7 +1764,7 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
}
DBG("Channels: %d\n", channels);
// Setup interleaved channel map
if (channels >= 2) {
if (channels >= 2 && Model != MacPro71) {
UINT8 doubleChannels = (UINT8)channels << 1;
for (size_t Index = 0; Index < mMemory17.size(); ++Index) {
channelMap[Index] = (UINT8)(((Index / doubleChannels) * doubleChannels) +
Expand All @@ -1765,6 +1780,10 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
DBG(" %d", channelMap[Index]);
}
DBG("\n");
if (Model == MacPro71 && expectedCount < 12) {
expectedCount = 12;
}

// Memory Device
//
for (size_t Index = 0; Index < mMemory17.size(); Index++) {
Expand Down Expand Up @@ -1886,23 +1905,42 @@ void PatchTableType17(const SmbiosInjectedSettings& smbiosSettings, XArray<UINT1
}

//now I want to update deviceLocator and bankLocator
if (isMacPro) {
if (Model == MacPro71) {
deviceLocator.setEmpty();
bankLocator.setEmpty();
if (trustSMBIOS && (SmbiosTable.Raw != NULL)) {
deviceLocator = GetSmbiosString(SmbiosTable, SmbiosTable.Type17->DeviceLocator);
bankLocator = GetSmbiosString(SmbiosTable, SmbiosTable.Type17->BankLocator);
}
newSmbiosTable.Type17->TotalWidth = 72;
newSmbiosTable.Type17->DataWidth = 64;
if (deviceLocator.isEmpty()) {
deviceLocator.S8Printf("DIMM%zu", Index + 1);
}
if (bankLocator.isEmpty()) {
bankLocator.S8Printf("BANK %d", bank);
}
} else if (isOldMacPro) {
deviceLocator.S8Printf("DIMM%zd", Index + 1);
bankLocator.setEmpty();
} else {
deviceLocator.S8Printf("DIMM%d", bank);
bankLocator.S8Printf("BANK %zu", Index % channels);
}
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->DeviceLocator, deviceLocator);
if (isMacPro) {
if (isOldMacPro) {
newSmbiosTable.Type17->BankLocator = 0; //like in MacPro5,1
} else {
UpdateSmbiosString(newSmbiosTable, &newSmbiosTable.Type17->BankLocator, bankLocator);
}
DBG(" SMBIOS Type 17 Index = %zd => SMBIOSIndex=%zu SPDIndex=%zu:\n", Index, SMBIOSIndex, SPDIndex);
if (newSmbiosTable.Type17->Size == 0) {
DBG("%s %s EMPTY\n", bankLocator.c_str(), deviceLocator.c_str());
newSmbiosTable.Type17->MemoryType = 0; //MemoryTypeUnknown;
if (Model == MacPro71) {
newSmbiosTable.Type17->MemoryType = MemoryTypeDdr4;
} else {
newSmbiosTable.Type17->MemoryType = 0; //MemoryTypeUnknown;
}
} else {
insertingEmpty = false;
DBG("%s %s %dMHz %dMB(Ext:%dMB)\n", bankLocator.c_str(), deviceLocator.c_str(), newSmbiosTable.Type17->Speed,
Expand Down Expand Up @@ -2278,6 +2316,10 @@ void PatchSmbios(const SmbiosInjectedSettings& smbiosSettings) //continue
}
PatchTableTypeSome();
auto SlotCounts = smbiosSettings.RamSlotCount;
MacModel Model = GetModelFromString(smbiosSettings.ProductName);
if (Model == MacPro71 && SlotCounts < 12) {
SlotCounts = 12;
}
if ( SlotCounts > MAX_RAM_SLOTS ) {
// log_technical_bug("GetTableType16() assign smbiosSettings.RamSlotCount a value bigger than MAX_RAM_SLOTS");
SlotCounts = MAX_RAM_SLOTS;
Expand Down Expand Up @@ -2416,5 +2458,3 @@ void FinalizeSmbios(const SmbiosInjectedSettings& smbiosSettings) //continue
// egSaveFile(NULL, SWPrintf("%ls\\misc\\smbios.bin", self.getCloverDirFullPath().wc_str()).wc_str(), (UINT8*)(UINTN)SmbiosEpsNew, SmbiosEpsNew->TableLength);
return;
}


2 changes: 1 addition & 1 deletion rEFIt_UEFI/Platform/usbfix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ DBG("FixOwnership() -> begin\n");
//
DBG("USB XHCI reset for device %04hX\n", Pci.Hdr.DeviceId);
if (Pci.Hdr.VendorId != 0x8086) {
//ну ее нах эту ВИА, да и прочих, кроме Интел
// forget about VIA and others, except Intel
DBG("skip XHCI controller Vendor=%04X\n", Pci.Hdr.VendorId);
break;
}
Expand Down
32 changes: 22 additions & 10 deletions rEFIt_UEFI/Settings/ConfigManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -596,7 +596,7 @@ EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName)
return Status;
}

void ConfigManager::ReloadSmbios(XStringW& str) // ищет смбиос по имени системы
void ConfigManager::ReloadSmbios(XStringW& str) // searches for SMBIOS by system name
{
size_t N = SmbiosList.size();
if (OldChosenSmbios == 0) { // this is auto fill by OSName
Expand Down Expand Up @@ -669,21 +669,33 @@ void ConfigManager::applySettings() const
{
if ( !configPlist.Graphics.Inject.isInjectIntelDefined() )
{
gSettings.Graphics.InjectAsDict.InjectIntel =
(gConf.GfxPropertiesArray.size() > 0 && gConf.GfxPropertiesArray[0].Vendor == Intel) ||
(gConf.GfxPropertiesArray.size() > 1 && gConf.GfxPropertiesArray[1].Vendor == Intel);
gSettings.Graphics.InjectAsDict.InjectIntel = false;
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
if (gConf.GfxPropertiesArray[i].Vendor == Intel) {
gSettings.Graphics.InjectAsDict.InjectIntel = true;
break;
}
}
}
if ( !configPlist.Graphics.Inject.isInjectATIDefined() )
{
gSettings.Graphics.InjectAsDict.InjectATI =
(gConf.GfxPropertiesArray.size() > 0 && gConf.GfxPropertiesArray[0].Vendor == Ati && (gConf.GfxPropertiesArray[0].DeviceID & 0xF000) != 0x6000 ) ||
(gConf.GfxPropertiesArray.size() > 1 && gConf.GfxPropertiesArray[1].Vendor == Ati && (gConf.GfxPropertiesArray[1].DeviceID & 0xF000) != 0x6000 );
gSettings.Graphics.InjectAsDict.InjectATI = false;
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
if (gConf.GfxPropertiesArray[i].Vendor == Ati && (gConf.GfxPropertiesArray[i].DeviceID & 0xF000) != 0x6000) {
gSettings.Graphics.InjectAsDict.InjectATI = true;
break;
}
}
}
if ( !configPlist.Graphics.Inject.isInjectNVidiaDefined() )
{
gSettings.Graphics.InjectAsDict.InjectNVidia =
( gConf.GfxPropertiesArray.isCardAtPosNvidia(0) && gConf.GfxPropertiesArray[0].Family < 0xE0) ||
( gConf.GfxPropertiesArray.isCardAtPosNvidia(1) && gConf.GfxPropertiesArray[1].Family < 0xE0);
gSettings.Graphics.InjectAsDict.InjectNVidia = false;
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
if (gConf.GfxPropertiesArray.isCardAtPosNvidia(i) && gConf.GfxPropertiesArray[i].Family < 0xE0) {
gSettings.Graphics.InjectAsDict.InjectNVidia = true;
break;
}
}
}
if ( configPlist.RtVariables.dgetBooterCfgStr().isEmpty() )
{
Expand Down
4 changes: 2 additions & 2 deletions rEFIt_UEFI/libeg/load_bmp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ EFI_STATUS XImage::FromBMP(UINT8 *FileData, IN UINTN FileDataLength)
PixelPtr->Reserved = AlphaValue;
PixelPtr++;
}
if ((RealPixelWidth & 1) == 1) { // для нечетных
if ((RealPixelWidth & 1) == 1) { // for odd numbers
ImageValue = *ImagePtr++;

Index = ImageValue >> 4;
Expand Down Expand Up @@ -247,7 +247,7 @@ EFI_STATUS XImage::FromBMP(UINT8 *FileData, IN UINTN FileDataLength)

}
}
DBG("sucсess\n");
DBG("success\n");
return EFI_SUCCESS;
}

Expand Down
Loading