no more drop DSM method, it is not universal

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-05-09 12:15:03 +03:00
parent d5305c8cc8
commit 0b7eed38f1
7 changed files with 22 additions and 113 deletions

View File

@ -151,35 +151,6 @@
<data>SU1FSQ==</data> <data>SU1FSQ==</data>
</dict> </dict>
</array> </array>
<key>#DropOEM_DSM</key>
<dict>
<key>USB</key>
<true/>
<key>SmBUS</key>
<false/>
<key>ATI</key>
<true/>
<key>HDMI</key>
<true/>
<key>LAN</key>
<true/>
<key>IntelGFX</key>
<true/>
<key>WIFI</key>
<true/>
<key>LPC</key>
<false/>
<key>Firewire</key>
<true/>
<key>IDE</key>
<true/>
<key>NVidia</key>
<true/>
<key>HDA</key>
<true/>
<key>SATA</key>
<true/>
</dict>
<key>Debug</key> <key>Debug</key>
<false/> <false/>
<key>#Rtc8Allowed</key> <key>#Rtc8Allowed</key>

View File

@ -2051,9 +2051,9 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
} }
} }
dropDSM = 0xFFFF; //by default we drop all OEM _DSM. They have no sense for us. dropDSM = 0xFFFF; //by default we drop all OEM _DSM. They have no sense for us.
if (defDSM) { // if (defDSM) {
dropDSM = gSettings.DropOEM_DSM; //if set by user // dropDSM = gSettings.DropOEM_DSM; //if set by user
} // }
if (gSettings.DebugDSDT) { if (gSettings.DebugDSDT) {
DBG("Output DSDT before patch to /EFI/CLOVER/ACPI/origin/DSDT-or.aml\n"); DBG("Output DSDT before patch to /EFI/CLOVER/ACPI/origin/DSDT-or.aml\n");
@ -2063,7 +2063,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion)
//native DSDT or loaded we want to apply autoFix to this //native DSDT or loaded we want to apply autoFix to this
// if (gSettings.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?) // if (gSettings.FixDsdt) { //fix even with zero mask because we want to know PCIRootUID and count(?)
DBG("Apply DsdtFixMask=0x%08X\n", gSettings.FixDsdt); DBG("Apply DsdtFixMask=0x%08X\n", gSettings.FixDsdt);
DBG(" drop _DSM mask=0x%04hX\n", dropDSM); // DBG(" drop _DSM mask=0x%04hX\n", dropDSM);
FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion); FixBiosDsdt((UINT8*)(UINTN)FadtPointer->XDsdt, FadtPointer, OSVersion);
if (gSettings.DebugDSDT) { if (gSettings.DebugDSDT) {
for (Index=0; Index < 60; Index++) { for (Index=0; Index < 60; Index++) {

View File

@ -2423,7 +2423,6 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_LPC) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
if(!Size) { if(!Size) {
return len; return len;
@ -2433,10 +2432,6 @@ UINT32 FIXLPCB (UINT8 *dsdt, UINT32 len)
//to correct outers we have to calculate offset //to correct outers we have to calculate offset
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
MsgLog("_DSM in LPC already exists, dropped\n"); MsgLog("_DSM in LPC already exists, dropped\n");
} else {
MsgLog("_DSM already exists, patch LPC will not be applied\n");
return len;
}
} }
} }
@ -2580,20 +2575,11 @@ UINT32 FIXDisplay (UINT8 *dsdt, UINT32 len, INT32 VCard)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((((dropDSM & DEV_ATI) != 0) && (DisplayVendor[VCard] == 0x1002)) ||
(((dropDSM & DEV_NVIDIA)!= 0) && (DisplayVendor[VCard] == 0x10DE)) ||
(((dropDSM & DEV_INTEL) != 0) && (DisplayVendor[VCard] == 0x8086))) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); //kill _DSM len = move_data(k - 1, dsdt, len, sizeoffset); //kill _DSM
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
MsgLog("_DSM in display already exists, dropped\n"); MsgLog("_DSM in display already exists, dropped\n");
} else {
MsgLog("_DSM already exists, patch display will not be applied\n");
// return len;
DisplayADR1[VCard] = 0; //xxx
DsmFound = TRUE;
}
} }
} }
} }
@ -2852,16 +2838,11 @@ UINT32 AddHDMI (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_HDMI) != 0) { Size = get_size(dsdt, k);
Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in HDAU already exists, dropped\n"); DBG("_DSM in HDAU already exists, dropped\n");
} else {
DBG("_DSM already exists, patch HDAU will not be applied\n");
return len;
}
} }
} }
root = aml_create_node(NULL); root = aml_create_node(NULL);
@ -3027,16 +3008,11 @@ UINT32 FIXNetwork (UINT8 *dsdt, UINT32 len, UINT32 card)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_LAN) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in LAN already exists, dropped\n"); DBG("_DSM in LAN already exists, dropped\n");
} else {
DBG("_DSM already exists, patch LAN will not be applied\n");
return len;
}
} }
root = aml_create_node(NULL); root = aml_create_node(NULL);
} else { } else {
@ -3221,16 +3197,11 @@ UINT32 FIXAirport (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_WIFI) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in ARPT already exists, dropped\n"); DBG("_DSM in ARPT already exists, dropped\n");
} else {
DBG("_DSM already exists, patch ARPT will not be applied\n");
return len;
}
} }
root = aml_create_node(NULL); root = aml_create_node(NULL);
} }
@ -3375,16 +3346,11 @@ UINT32 FIXSBUS (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_SMBUS) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in SBUS already exists, dropped\n"); DBG("_DSM in SBUS already exists, dropped\n");
} else {
DBG("_DSM already exists, patch SBUS will not be applied\n");
return len;
}
} }
Size = get_size(dsdt, SBUSADR); Size = get_size(dsdt, SBUSADR);
if (ReplaceName(dsdt + SBUSADR, Size, NULL, "BUS0") < 0) { if (ReplaceName(dsdt + SBUSADR, Size, NULL, "BUS0") < 0) {
@ -3672,16 +3638,11 @@ UINT32 FIXFirewire (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_FIREWIRE) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in FRWR already exists, dropped\n"); DBG("_DSM in FRWR already exists, dropped\n");
} else {
DBG("_DSM already exists, patch FRWR will not be applied\n");
return len;
}
} }
root = aml_create_node(NULL); root = aml_create_node(NULL);
@ -3803,16 +3764,11 @@ UINT32 AddHDEF (UINT8 *dsdt, UINT32 len, CHAR8* OSVersion)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_HDA) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in HDA already exists, dropped\n"); DBG("_DSM in HDA already exists, dropped\n");
} else {
DBG("_DSM already exists, patch HDA will not be applied\n");
return len;
}
} }
} }
@ -4119,7 +4075,6 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
//here we want to check who is the master of the _DSM //here we want to check who is the master of the _DSM
adr1 = devFind(dsdt, k); adr1 = devFind(dsdt, k);
if (adr1 == adr) { if (adr1 == adr) {
if ((dropDSM & DEV_USB) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
if (!Size) { if (!Size) {
continue; continue;
@ -4128,10 +4083,6 @@ UINT32 FIXUSB (UINT8 *dsdt, UINT32 len)
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in USB already exists, dropped by 0x%X\n", sizeoffset); DBG("_DSM in USB already exists, dropped by 0x%X\n", sizeoffset);
} else {
DBG("_DSM already exists, patch USB will not be applied\n");
continue;
}
} else { } else {
DBG(" found slave _DSM, skip\n"); DBG(" found slave _DSM, skip\n");
continue; continue;
@ -4325,16 +4276,11 @@ UINT32 FIXIDE (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_IDE) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in IDE already exists, dropped\n"); DBG("_DSM in IDE already exists, dropped\n");
} else {
DBG("_DSM already exists, patch IDE will not be applied\n");
return len;
}
} }
} }
@ -4477,16 +4423,11 @@ UINT32 FIXSATAAHCI (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_SATA) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in SATA already exists, dropped\n"); DBG("_DSM in SATA already exists, dropped\n");
} else {
DBG("_DSM already exists, patch SATA will not be applied\n");
return len;
}
} }
} }
@ -4574,16 +4515,11 @@ UINT32 FIXSATA (UINT8 *dsdt, UINT32 len)
k = FindMethod(dsdt + i, Size, "_DSM"); k = FindMethod(dsdt + i, Size, "_DSM");
if (k != 0) { if (k != 0) {
k += i; k += i;
if ((dropDSM & DEV_SATA) != 0) {
Size = get_size(dsdt, k); Size = get_size(dsdt, k);
sizeoffset = - 1 - Size; sizeoffset = - 1 - Size;
len = move_data(k - 1, dsdt, len, sizeoffset); len = move_data(k - 1, dsdt, len, sizeoffset);
len = CorrectOuters(dsdt, len, k - 2, sizeoffset); len = CorrectOuters(dsdt, len, k - 2, sizeoffset);
DBG("_DSM in SATA already exists, dropped\n"); DBG("_DSM in SATA already exists, dropped\n");
} else {
DBG("_DSM already exists, patch SATA will not be applied\n");
return len;
}
} }
} }

View File

@ -5431,7 +5431,7 @@ GetUserSettings(
if (IsPropertyTrue (Prop)) { if (IsPropertyTrue (Prop)) {
gSettings.SuspendOverride = TRUE; gSettings.SuspendOverride = TRUE;
} }
/*
Prop = GetProperty(Dict2, "DropOEM_DSM"); Prop = GetProperty(Dict2, "DropOEM_DSM");
defDSM = FALSE; defDSM = FALSE;
@ -5510,6 +5510,7 @@ GetUserSettings(
} }
} }
} }
*/
} }
Dict2 = GetProperty(DictPointer, "SSDT"); Dict2 = GetProperty(DictPointer, "SSDT");

View File

@ -348,7 +348,7 @@ typedef struct {
UINTN PatchVBiosBytesCount; UINTN PatchVBiosBytesCount;
BOOLEAN InjectEDID; BOOLEAN InjectEDID;
BOOLEAN LpcTune; BOOLEAN LpcTune;
UINT16 DropOEM_DSM; UINT16 DropOEM_DSM; //vacant
UINT8 *CustomEDID; UINT8 *CustomEDID;
UINT16 CustomEDIDsize; UINT16 CustomEDIDsize;
UINT16 EdidFixHorizontalSyncPulseWidth; UINT16 EdidFixHorizontalSyncPulseWidth;

View File

@ -2322,10 +2322,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
gCPUStructure.ExternalClock = (UINT32)DivU64x32(gCPUStructure.FSBFrequency + kilo - 1, kilo); gCPUStructure.ExternalClock = (UINT32)DivU64x32(gCPUStructure.FSBFrequency + kilo - 1, kilo);
} }
dropDSM = 0xFFFF; //by default we drop all OEM _DSM. They have no sense for us. // dropDSM = 0xFFFF; //by default we drop all OEM _DSM. They have no sense for us.
if (defDSM) { // if (defDSM) {
dropDSM = gSettings.DropOEM_DSM; //if set by user // dropDSM = gSettings.DropOEM_DSM; //if set by user
} // }
// Load any extra SMBIOS information // Load any extra SMBIOS information
if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios", &smbiosTags)) && (smbiosTags != NULL)) { if (!EFI_ERROR(LoadUserSettings(SelfRootDir, L"smbios", &smbiosTags)) && (smbiosTags != NULL)) {
TagPtr dictPointer = GetProperty(smbiosTags,"SMBIOS"); TagPtr dictPointer = GetProperty(smbiosTags,"SMBIOS");

View File

@ -517,7 +517,7 @@ VOID FillInputs(BOOLEAN New)
InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26);
} }
snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI); snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI);
InputItems[InputItemsCount].ItemType = CheckBit; //101 InputItems[InputItemsCount].ItemType = CheckBit; //101 - vacant
InputItems[InputItemsCount++].IValue = dropDSM; InputItems[InputItemsCount++].IValue = dropDSM;
InputItems[InputItemsCount].ItemType = BoolValue; //102 InputItems[InputItemsCount].ItemType = BoolValue; //102
@ -1071,11 +1071,11 @@ VOID ApplyInputs(VOID)
gSettings.FakeXHCI = (UINT32)StrHexToUint64(InputItems[i].SValue); gSettings.FakeXHCI = (UINT32)StrHexToUint64(InputItems[i].SValue);
} }
i++; //101 i++; //101 - vacant
if (InputItems[i].Valid) { if (InputItems[i].Valid) {
// gSettings.DropOEM_DSM = (UINT16)StrHexToUint64(InputItems[i].SValue); // gSettings.DropOEM_DSM = (UINT16)StrHexToUint64(InputItems[i].SValue);
gSettings.DropOEM_DSM = (UINT16)InputItems[i].IValue; // gSettings.DropOEM_DSM = (UINT16)InputItems[i].IValue;
dropDSM = gSettings.DropOEM_DSM; //? // dropDSM = gSettings.DropOEM_DSM; //?
// defDSM = TRUE; // defDSM = TRUE;
} }
i++; //102 i++; //102
@ -1697,9 +1697,10 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry)
} else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) { } else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) {
ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.BooterConfig); ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04hx]->", gSettings.BooterConfig);
} else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) {
ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04hx]->", dropDSM);
} }
/*else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) {
ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04hx]->", dropDSM);
} */
} }
REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics() REFIT_ABSTRACT_MENU_ENTRY *SubMenuGraphics()
@ -2250,7 +2251,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuSmbios()
SubScreen->AddMenuEntry(&MenuEntryReturn, false); SubScreen->AddMenuEntry(&MenuEntryReturn, false);
return Entry; return Entry;
} }
/*
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM() REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
{ {
// init // init
@ -2284,7 +2285,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuDropDSM()
return Entry; return Entry;
} }
*/
REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix() REFIT_ABSTRACT_MENU_ENTRY* SubMenuDsdtFix()
{ {
REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry; REFIT_MENU_ITEM_OPTIONS *Entry; //, *SubEntry;
@ -2405,7 +2406,7 @@ REFIT_ABSTRACT_MENU_ENTRY* SubMenuACPI()
SubScreen->AddMenuEntry(SubMenuDsdts(), true); SubScreen->AddMenuEntry(SubMenuDsdts(), true);
SubScreen->AddMenuEntry(SubMenuDropTables(), true); SubScreen->AddMenuEntry(SubMenuDropTables(), true);
SubScreen->AddMenuEntry(SubMenuDropDSM(), true); // SubScreen->AddMenuEntry(SubMenuDropDSM(), true);
SubScreen->AddMenuEntry(SubMenuDsdtFix(), true); SubScreen->AddMenuEntry(SubMenuDsdtFix(), true);
SubScreen->AddMenuEntry(SubMenuDSDTPatches(), true); SubScreen->AddMenuEntry(SubMenuDSDTPatches(), true);
SubScreen->AddMenuItemInput(49, "Fix MCFG", FALSE); SubScreen->AddMenuItemInput(49, "Fix MCFG", FALSE);