OcAcpiLib: Fix ACPI patch failure after first missed base lookup
@@ -1181,19 +1181,21 @@ AcpiApplyPatch (
&BaseOffset,
Context->Dsdt->Length
);
- if (EFI_ERROR (Status)) {
+ if (!EFI_ERROR (Status)) {
+ ReplaceLimit = MIN (ReplaceLimit, Context->Dsdt->Length - BaseOffset);
+ } else {
DEBUG ((
DEBUG_INFO,
"OCA: Patching DSDT of %u bytes failed to find base %a\n",
Context->Dsdt->Length,
Patch->Base
));
- return Status;
}
-
- ReplaceLimit = MIN (ReplaceLimit, Context->Dsdt->Length - BaseOffset);
+ } else {
+ Status = EFI_SUCCESS;
}
+ if (!EFI_ERROR (Status)) {
if (!AcpiIsTableWritable ((EFI_ACPI_COMMON_HEADER *) Context->Dsdt)) {
Status = AcpiAllocateCopyDsdt (Context, NULL);
if (EFI_ERROR (Status)) {
@@ -1226,6 +1228,7 @@ AcpiApplyPatch (
AcpiRefreshTableChecksum (Context->Dsdt);
}
}
+ }
for (Index = 0; Index < Context->NumberOfTables; ++Index) {
if ((Patch->TableSignature == 0 || Context->Tables[Index]->Signature == Patch->TableSignature)
@@ -1246,6 +1249,8 @@ AcpiApplyPatch (
ReplaceLimit = MIN (ReplaceLimit, Patch->Limit);
}
+ TablePrintSignature = AcpiReadSignature (Context->Tables[Index]);
+
BaseOffset = 0;
if (Patch->Base != NULL && Patch->Base[0] != '\0') {
Status = AcpiFindEntryInMemory (
@@ -1266,7 +1271,7 @@ AcpiApplyPatch (
CurrOemTableId,
Patch->Base
));
- return Status;
+ continue;
}
ReplaceLimit = MIN (ReplaceLimit, Context->Tables[Index]->Length - BaseOffset);
@@ -1292,8 +1297,6 @@ AcpiApplyPatch (
Patch->Skip
);
- TablePrintSignature = AcpiReadSignature (Context->Tables[Index]);
-
DEBUG ((
ReplaceCount > 0 ? DEBUG_INFO : DEBUG_BULK_INFO,
"OCA: Patching %.4a (%08x) (OEM %016Lx) of %u bytes with %016Lx ID at %u replaced %u of %u\n",
