Add missing TgtBridge check in AcpiPatcher::PatchAllTables(), fix unexpected rename in OEM SSDTs when TgtBridge is set

This commit is contained in:
Steve 2020-06-30 08:56:16 -04:00
parent 90588855bd
commit 3281303260
3 changed files with 27 additions and 9 deletions

View File

@ -456,10 +456,18 @@ VOID PatchAllTables()
DBG(" disabled\n");
continue;
}
Len = FixAny((UINT8*)NewTable, Len,
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
//DBG(" OK\n");
if (!gSettings.PatchDsdtTgt[i]) {
Len = FixAny((UINT8*)NewTable, Len,
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
//DBG(" OK\n");
}else{
//DBG("Patching: renaming in bridge\n");
Len = FixRenameByBridge2((UINT8*)NewTable, Len,
gSettings.PatchDsdtTgt[i],
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
}
}
}
// fixup length and checksum

View File

@ -1790,7 +1790,7 @@ UINT32 FixAny (UINT8* dsdt, UINT32 len, const UINT8* ToFind, UINT32 LenTF, const
}
//new method. by goodwin_c
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, CHAR8* TgtBrgName, const UINT8* ToFind, UINT32 LenTF, UINT8* ToReplace, UINT32 LenTR)
UINT32 FixRenameByBridge2 (UINT8* dsdt, UINT32 len, CHAR8* TgtBrgName, const UINT8* ToFind, UINT32 LenTF, const UINT8* ToReplace, UINT32 LenTR)
{
INT32 adr;
BOOLEAN found = FALSE;
@ -5352,10 +5352,8 @@ VOID FixBiosDsdt(UINT8* temp, EFI_ACPI_2_0_FIXED_ACPI_DESCRIPTION_TABLE* fadt, C
// DBG("Patching: renaming in bridge\n");
DsdtLen = FixRenameByBridge2(temp, DsdtLen,
gSettings.PatchDsdtTgt[i],
(const UINT8*)gSettings.PatchDsdtFind[i],
gSettings.LenToFind[i],
gSettings.PatchDsdtReplace[i],
gSettings.LenToReplace[i]);
(const UINT8*)gSettings.PatchDsdtFind[i], gSettings.LenToFind[i],
(const UINT8*)gSettings.PatchDsdtReplace[i], gSettings.LenToReplace[i]);
}
} else {

View File

@ -92,5 +92,17 @@ FixAny (
);
UINT32
FixRenameByBridge2 (
UINT8* dsdt,
UINT32 len,
CHAR8* TgtBrgName,
const UINT8* ToFind,
UINT32 LenTF,
const UINT8* ToReplace,
UINT32 LenTR
);
#endif /* PLATFORM_FIXBIOSDSDT_H_ */