aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWarner Losh <imp@FreeBSD.org>2022-09-01 16:39:20 +0000
committerWarner Losh <imp@FreeBSD.org>2022-09-01 16:39:20 +0000
commita14b26a6bd3f34f27960e02948385993962e32d0 (patch)
treef1dbcd8eaa9703c3bc7aa276ed502bb29b51a7f8
parent195f794318a33ec5bfd109d0e45f34ab583b1f38 (diff)
downloadsrc-a14b26a6bd3f34f27960e02948385993962e32d0.tar.gz
src-a14b26a6bd3f34f27960e02948385993962e32d0.zip
acpi: Unmap RSDP in more error cases
Add missing pmap_unmapbios() calls for when we return 0. Otherwise we can leave the table mapped when it is of no use. Sponsored by: Netflix Reviewed by: andrew Differential Revision: https://reviews.freebsd.org/D36405
-rw-r--r--sys/amd64/acpica/acpi_machdep.c6
-rw-r--r--sys/arm64/acpica/acpi_machdep.c2
2 files changed, 8 insertions, 0 deletions
diff --git a/sys/amd64/acpica/acpi_machdep.c b/sys/amd64/acpica/acpi_machdep.c
index bbeb7cef44c5..1a9f44969d03 100644
--- a/sys/amd64/acpica/acpi_machdep.c
+++ b/sys/amd64/acpica/acpi_machdep.c
@@ -203,12 +203,16 @@ acpi_find_table(const char *sig)
if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
if (bootverbose)
printf("ACPI: RSDP failed extended checksum\n");
+ pmap_unmapbios((vm_offset_t)rsdp,
+ sizeof(ACPI_TABLE_RSDP));
return (0);
}
xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);
if (xsdt == NULL) {
if (bootverbose)
printf("ACPI: Failed to map XSDT\n");
+ pmap_unmapbios((vm_offset_t)rsdp,
+ sizeof(ACPI_TABLE_RSDP));
return (0);
}
count = (xsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
@@ -224,6 +228,8 @@ acpi_find_table(const char *sig)
if (rsdt == NULL) {
if (bootverbose)
printf("ACPI: Failed to map RSDT\n");
+ pmap_unmapbios((vm_offset_t)rsdp,
+ sizeof(ACPI_TABLE_RSDP));
return (0);
}
count = (rsdt->Header.Length - sizeof(ACPI_TABLE_HEADER)) /
diff --git a/sys/arm64/acpica/acpi_machdep.c b/sys/arm64/acpica/acpi_machdep.c
index 8ce4e521860b..6145dfbbc78b 100644
--- a/sys/arm64/acpica/acpi_machdep.c
+++ b/sys/arm64/acpica/acpi_machdep.c
@@ -176,6 +176,8 @@ acpi_find_table(const char *sig)
if (AcpiTbChecksum((UINT8 *)rsdp, ACPI_RSDP_XCHECKSUM_LENGTH)) {
if (bootverbose)
printf("ACPI: RSDP failed extended checksum\n");
+ pmap_unmapbios((vm_offset_t)rsdp,
+ sizeof(ACPI_TABLE_RSDP));
return (0);
}
xsdt = map_table(rsdp->XsdtPhysicalAddress, ACPI_SIG_XSDT);