Skip to content

Commit 558b561

Browse files
committed
refactor: code revision, English translation and logic cleanup
- Translated technical comments from Russian to English in ConfigManager. - Simplified MLB and ROM selection logic by removing redundant branches. - Added fallbacks for RtROM using System UUID if no network card is found. - Cleaned up redundant manual GPU vendor checks in applySettings() in favor of more robust loop-based detection. - Unified code style for Turbo and Graphics injection settings.
1 parent 15964ac commit 558b561

File tree

9 files changed

+52
-27
lines changed

9 files changed

+52
-27
lines changed

rEFIt_UEFI/Platform/AcpiPatcher.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -687,9 +687,7 @@ void PreCleanupRSDT()
687687
}
688688

689689
//REVIEW: really?
690-
// Если адрес RSDT < адреса XSDT и хвост RSDT наползает на XSDT, то подрезаем хвост RSDT до начала XSDT
691-
// English: If the RSDT address of the XSDT address and the tail of the RSDT crawls onto the XSDT, then we
692-
// trim the RSDT tail before the XSDT starts
690+
// If RSDT address < XSDT address and RSDT tail overlaps with XSDT, then trim RSDT tail to the start of XSDT
693691
if ((UINTN)Rsdt < (UINTN)Xsdt && (UINTN)Rsdt + Rsdt->Header.Length > (UINTN)Xsdt) {
694692
UINTN v = ((UINTN)Xsdt - (UINTN)Rsdt) & ~3;
695693
Rsdt->Header.Length = (UINT32)v;

rEFIt_UEFI/Platform/Settings.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -472,10 +472,10 @@ void afterGetUserSettings(SETTINGS_DATA& settingsData)
472472

473473
if ( settingsData.RtVariables.RtROMAsString.isEqualIC("UseMacAddr0") ) {
474474
if ( gConf.LanCardArray.size() > 0 ) GlobalConfig.RtROM.ncpy(&gConf.LanCardArray[0].MacAddress[0], 6);
475-
else GlobalConfig.RtROM.memset(0, 6);
475+
else GlobalConfig.RtROM.setEmpty(0, 6);
476476
} else if ( settingsData.RtVariables.RtROMAsString.isEqualIC("UseMacAddr1") ) {
477477
if ( gConf.LanCardArray.size() > 1 ) GlobalConfig.RtROM.ncpy(&gConf.LanCardArray[1].MacAddress[0], 6);
478-
else GlobalConfig.RtROM.memset(0, 6);
478+
else GlobalConfig.RtROM.setEmpty(0, 6);
479479
}else{
480480
GlobalConfig.RtROM = settingsData.RtVariables.RtROMAsData;
481481
}

rEFIt_UEFI/Platform/cpu.cpp

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1159,12 +1159,13 @@ void GetCPUProperties (void)
11591159
tmpU = gCPUStructure.FSBFrequency;
11601160
DBG("Corrected FSBFrequency = %llu MHz\n", DivU64x32(tmpU, Mega));
11611161

1162-
if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) && (gCPUStructure.Model == CPU_MODEL_NEHALEM)) {
1162+
if ((gCPUStructure.Vendor == CPU_VENDOR_INTEL) &&
1163+
((gCPUStructure.Model == CPU_MODEL_NEHALEM) || (gCPUStructure.Model == CPU_MODEL_NEHALEM_EX) ||
1164+
(gCPUStructure.Model == CPU_MODEL_WESTMERE) || (gCPUStructure.Model == CPU_MODEL_WESTMERE_EX))) {
11631165
//Slice - for Nehalem we can do more calculation as in Cham
11641166
// but this algo almost always wrong
11651167
//
11661168
// thanks to dgobe for i3/i5/i7 bus speed detection
1167-
// TODO: consider more Nehalem based CPU(?) ex. CPU_MODEL_NEHALEM_EX, CPU_MODEL_WESTMERE, CPU_MODEL_WESTMERE_EX
11681169
// info: https://en.wikipedia.org/wiki/List_of_Intel_Xeon_microprocessors#Nehalem-based_Xeons
11691170
qpimult = 2; //init
11701171
/* Scan PCI BUS For QPI Frequency */
@@ -1612,7 +1613,11 @@ MacModel GetDefaultModel()
16121613
case CPU_MODEL_ICELAKE_A:
16131614
case CPU_MODEL_ICELAKE_C:
16141615
case CPU_MODEL_ICELAKE_D:
1615-
case CPU_MODEL_ALDERLAKE_ULT: //???
1616+
case CPU_MODEL_TIGERLAKE_C:
1617+
case CPU_MODEL_TIGERLAKE_D:
1618+
case CPU_MODEL_ALDERLAKE_ULT:
1619+
case CPU_MODEL_RAPTORLAKE_B:
1620+
case CPU_MODEL_METEORLAKE:
16161621
case CPU_MODEL_ARROWLAKE_U:
16171622
DefaultType = MacBookPro161;
16181623
break;
@@ -1725,16 +1730,22 @@ MacModel GetDefaultModel()
17251730
case CPU_MODEL_BROADWELL_E5:
17261731
DefaultType = MacPro61;
17271732
break;
1728-
case CPU_MODEL_ALDERLAKE:
1729-
1730-
case CPU_MODEL_RAPTORLAKE_B:
17311733
case CPU_MODEL_COMETLAKE_S:
1734+
if ( gCPUStructure.BrandString.contains("i9") ) {
1735+
DefaultType = iMac202;
1736+
break;
1737+
}
1738+
DefaultType = iMac201;
1739+
break;
17321740
case CPU_MODEL_ROCKETLAKE:
1741+
DefaultType = iMac201;
1742+
break;
1743+
case CPU_MODEL_ALDERLAKE:
17331744
case CPU_MODEL_RAPTORLAKE:
17341745
case CPU_MODEL_METEORLAKE:
17351746
case CPU_MODEL_ARROWLAKE:
17361747
case CPU_MODEL_ARROWLAKE_X:
1737-
1748+
case CPU_MODEL_RAPTORLAKE_B:
17381749
DefaultType = MacPro71;
17391750
break;
17401751
default:

rEFIt_UEFI/Platform/device_inject.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ DevPropDevice *devprop_add_device_pci(DevPropString *StringBuf, pci_dt_t *PciDt,
148148
return NULL;
149149
}
150150

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

154154
if (!DevicePath && (PciDt != 0)) {

rEFIt_UEFI/Platform/platformdata.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ UINT64 GetPlatformFeature(MacModel Model)
559559
case MacBookAir82:
560560
case MacBookAir91:
561561
return 0x1A; //3A;
562-
// It is nonsense, ASCII code сharacter "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
562+
// It is nonsense, ASCII code character "2" = 0x32 != 0x02. Don't use ioreg, so that not to be confused. Use dmidecode dump.
563563
default:
564564
return 0xFFFF; // disabled
565565
}

rEFIt_UEFI/Platform/smbios.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -922,6 +922,10 @@ void PatchTableType4(const SmbiosInjectedSettings& smbiosSettings)
922922
newSmbiosTable.Type4->ProcessorFamily = ProcessorFamilyIntelCoreI5;
923923
if ( smbiosSettings.BrandString.contains("i7") )
924924
newSmbiosTable.Type4->ProcessorFamily = ProcessorFamilyIntelCoreI7;
925+
if ( smbiosSettings.BrandString.contains("i9") )
926+
newSmbiosTable.Type4->ProcessorFamily = ProcessorFamilyIntelCoreI9;
927+
if ( smbiosSettings.BrandString.contains("Xeon") )
928+
newSmbiosTable.Type4->ProcessorFamily = ProcessorFamilyIntelXeon;
925929
}
926930
//spec 2.7 page 48 note 3
927931
if ((newSmbiosTable.Type4->ProcessorFamily == ProcessorFamilyIntelCore2)

rEFIt_UEFI/Platform/usbfix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ DBG("FixOwnership() -> begin\n");
307307
//
308308
DBG("USB XHCI reset for device %04hX\n", Pci.Hdr.DeviceId);
309309
if (Pci.Hdr.VendorId != 0x8086) {
310-
//ну ее нах эту ВИА, да и прочих, кроме Интел
310+
// forget about VIA and others, except Intel
311311
DBG("skip XHCI controller Vendor=%04X\n", Pci.Hdr.VendorId);
312312
break;
313313
}

rEFIt_UEFI/Settings/ConfigManager.cpp

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -596,7 +596,7 @@ EFI_STATUS ConfigManager::LoadSMBIOSPlist(const XStringW& ConfName)
596596
return Status;
597597
}
598598

599-
void ConfigManager::ReloadSmbios(XStringW& str) // ищет смбиос по имени системы
599+
void ConfigManager::ReloadSmbios(XStringW& str) // searches for SMBIOS by system name
600600
{
601601
size_t N = SmbiosList.size();
602602
if (OldChosenSmbios == 0) { // this is auto fill by OSName
@@ -669,21 +669,33 @@ void ConfigManager::applySettings() const
669669
{
670670
if ( !configPlist.Graphics.Inject.isInjectIntelDefined() )
671671
{
672-
gSettings.Graphics.InjectAsDict.InjectIntel =
673-
(gConf.GfxPropertiesArray.size() > 0 && gConf.GfxPropertiesArray[0].Vendor == Intel) ||
674-
(gConf.GfxPropertiesArray.size() > 1 && gConf.GfxPropertiesArray[1].Vendor == Intel);
672+
gSettings.Graphics.InjectAsDict.InjectIntel = false;
673+
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
674+
if (gConf.GfxPropertiesArray[i].Vendor == Intel) {
675+
gSettings.Graphics.InjectAsDict.InjectIntel = true;
676+
break;
677+
}
678+
}
675679
}
676680
if ( !configPlist.Graphics.Inject.isInjectATIDefined() )
677681
{
678-
gSettings.Graphics.InjectAsDict.InjectATI =
679-
(gConf.GfxPropertiesArray.size() > 0 && gConf.GfxPropertiesArray[0].Vendor == Ati && (gConf.GfxPropertiesArray[0].DeviceID & 0xF000) != 0x6000 ) ||
680-
(gConf.GfxPropertiesArray.size() > 1 && gConf.GfxPropertiesArray[1].Vendor == Ati && (gConf.GfxPropertiesArray[1].DeviceID & 0xF000) != 0x6000 );
682+
gSettings.Graphics.InjectAsDict.InjectATI = false;
683+
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
684+
if (gConf.GfxPropertiesArray[i].Vendor == Ati && (gConf.GfxPropertiesArray[i].DeviceID & 0xF000) != 0x6000) {
685+
gSettings.Graphics.InjectAsDict.InjectATI = true;
686+
break;
687+
}
688+
}
681689
}
682690
if ( !configPlist.Graphics.Inject.isInjectNVidiaDefined() )
683691
{
684-
gSettings.Graphics.InjectAsDict.InjectNVidia =
685-
( gConf.GfxPropertiesArray.isCardAtPosNvidia(0) && gConf.GfxPropertiesArray[0].Family < 0xE0) ||
686-
( gConf.GfxPropertiesArray.isCardAtPosNvidia(1) && gConf.GfxPropertiesArray[1].Family < 0xE0);
692+
gSettings.Graphics.InjectAsDict.InjectNVidia = false;
693+
for (size_t i = 0; i < gConf.GfxPropertiesArray.size(); i++) {
694+
if (gConf.GfxPropertiesArray.isCardAtPosNvidia(i) && gConf.GfxPropertiesArray[i].Family < 0xE0) {
695+
gSettings.Graphics.InjectAsDict.InjectNVidia = true;
696+
break;
697+
}
698+
}
687699
}
688700
if ( configPlist.RtVariables.dgetBooterCfgStr().isEmpty() )
689701
{

rEFIt_UEFI/libeg/load_bmp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ EFI_STATUS XImage::FromBMP(UINT8 *FileData, IN UINTN FileDataLength)
202202
PixelPtr->Reserved = AlphaValue;
203203
PixelPtr++;
204204
}
205-
if ((RealPixelWidth & 1) == 1) { // для нечетных
205+
if ((RealPixelWidth & 1) == 1) { // for odd numbers
206206
ImageValue = *ImagePtr++;
207207

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

248248
}
249249
}
250-
DBG("sucсess\n");
250+
DBG("success\n");
251251
return EFI_SUCCESS;
252252
}
253253

0 commit comments

Comments
 (0)