Implement possibility to drop tables for any OS

This commit is contained in:
asava 2020-04-20 19:33:42 +03:00
parent e37d782aad
commit d7a38dce3e
4 changed files with 27 additions and 0 deletions

View File

@ -74,6 +74,12 @@
<key>Signature</key>
<string>SSDT</string>
</dict>
<dict>
<key>Signature</key>
<string>BGRT</string>
<key>DropForAllOS</key>
<true/>
</dict>
</array>
<key>FixHeaders</key>
<true/>

View File

@ -2524,6 +2524,19 @@ EFI_STATUS PatchACPI_OtherOS(CONST CHAR16* OsSubdir, BOOLEAN DropSSDT)
DropTableFromRSDT(EFI_ACPI_4_0_SECONDARY_SYSTEM_DESCRIPTION_TABLE_SIGNATURE, 0, 0);
}
*/
if (gSettings.ACPIDropTables) {
ACPI_DROP_TABLE *DropTable;
DbgHeader("ACPIDropTables");
for (DropTable = gSettings.ACPIDropTables; DropTable; DropTable = DropTable->Next) {
// only for tables that have OtherOS true
if (DropTable->OtherOS && DropTable->MenuItem.BValue) {
//DBG("Attempting to drop \"%4.4a\" (%8.8X) \"%8.8a\" (%16.16lX) L=%d\n", &(DropTable->Signature), DropTable->Signature, &(DropTable->TableId), DropTable->TableId, DropTable->Length);
DropTableFromXSDT(DropTable->Signature, DropTable->TableId, DropTable->Length);
DropTableFromRSDT(DropTable->Signature, DropTable->TableId, DropTable->Length);
}
}
}
//
// find and inject other ACPI tables
//

View File

@ -5109,6 +5109,7 @@ GetUserSettings(
UINT32 Signature = 0;
UINT32 TabLength = 0;
UINT64 TableId = 0;
BOOLEAN OtherOS = FALSE;
if (EFI_ERROR (GetElement (Prop, i, &Dict2))) {
DBG (" - [%02lld]: Drop table continue\n", i);
@ -5171,6 +5172,11 @@ GetUserSettings(
TabLength = (UINT32)GetPropertyInteger (Prop2, 0);
DBG (" length=%d(0x%X)", TabLength, TabLength);
}
// Check if to drop for other OS as well
Prop = GetProperty (Dict2, "DropForAllOS");
if (Prop != NULL) {
OtherOS = IsPropertyTrue (Prop);
}
DBG ("\n");
//set to drop
@ -5184,6 +5190,7 @@ GetUserSettings(
(!TabLength || (DropTable->Length == TabLength))) ||
(!Signature && (DropTable->TableId == TableId))) {
DropTable->MenuItem.BValue = TRUE;
DropTable->OtherOS = OtherOS;
gSettings.DropSSDT = FALSE; //if one item=true then dropAll=false by default
//DBG (" true");
Dropped = TRUE;

View File

@ -86,6 +86,7 @@ struct ACPI_DROP_TABLE
UINT32 Length;
UINT64 TableId;
INPUT_ITEM MenuItem;
BOOLEAN OtherOS;
};
typedef struct CUSTOM_LOADER_ENTRY CUSTOM_LOADER_ENTRY;