git: e99255c8a6ca - main - amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI

Konstantin Belousov kib at FreeBSD.org
Mon Sep 13 16:56:03 UTC 2021


The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=e99255c8a6cae324aeede7f5013d080a2d361e3f

commit e99255c8a6cae324aeede7f5013d080a2d361e3f
Author:     Konstantin Belousov <kib at FreeBSD.org>
AuthorDate: 2021-09-11 18:19:27 +0000
Commit:     Konstantin Belousov <kib at FreeBSD.org>
CommitDate: 2021-09-13 16:51:52 +0000

    amd64: do not touch low memory in acpi_wakeup_ap() if booted by UEFI
    
    Reviewed by:    markj
    Sponsored by:   The FreeBSD Foundation
    MFC after:      1 week
    Differential revision:  https://reviews.freebsd.org/D31916
---
 sys/x86/acpica/acpi_wakeup.c | 40 ++++++++++++++++++++++++++--------------
 1 file changed, 26 insertions(+), 14 deletions(-)

diff --git a/sys/x86/acpica/acpi_wakeup.c b/sys/x86/acpica/acpi_wakeup.c
index b4bbe660bea4..ef52ccc3aef6 100644
--- a/sys/x86/acpica/acpi_wakeup.c
+++ b/sys/x86/acpica/acpi_wakeup.c
@@ -164,16 +164,22 @@ acpi_wakeup_cpus(struct acpi_softc *sc)
 	int		cpu;
 	u_char		mpbiosreason;
 
-	/* save the current value of the warm-start vector */
-	mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF);
-	outb(CMOS_REG, BIOS_RESET);
-	mpbiosreason = inb(CMOS_DATA);
-
-	/* setup a vector to our boot code */
-	*((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET;
-	*((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4;
-	outb(CMOS_REG, BIOS_RESET);
-	outb(CMOS_DATA, BIOS_WARM);	/* 'warm-start' */
+#ifdef __amd64__
+	if (!efi_boot) {
+#endif
+		/* save the current value of the warm-start vector */
+		mpbioswarmvec = *((uint32_t *)WARMBOOT_OFF);
+		outb(CMOS_REG, BIOS_RESET);
+		mpbiosreason = inb(CMOS_DATA);
+
+		/* setup a vector to our boot code */
+		*((volatile u_short *)WARMBOOT_OFF) = WARMBOOT_TARGET;
+		*((volatile u_short *)WARMBOOT_SEG) = sc->acpi_wakephys >> 4;
+		outb(CMOS_REG, BIOS_RESET);
+		outb(CMOS_DATA, BIOS_WARM);	/* 'warm-start' */
+#ifdef __amd64__
+	}
+#endif
 
 	/* Wake up each AP. */
 	for (cpu = 1; cpu < mp_ncpus; cpu++) {
@@ -197,11 +203,17 @@ acpi_wakeup_cpus(struct acpi_softc *sc)
 	pmap_remap_lowptdi(false);
 #endif
 
-	/* restore the warmstart vector */
-	*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
+#ifdef __amd64__
+	if (!efi_boot) {
+#endif
+		/* restore the warmstart vector */
+		*(uint32_t *)WARMBOOT_OFF = mpbioswarmvec;
 
-	outb(CMOS_REG, BIOS_RESET);
-	outb(CMOS_DATA, mpbiosreason);
+		outb(CMOS_REG, BIOS_RESET);
+		outb(CMOS_DATA, mpbiosreason);
+#ifdef __amd64__
+	}
+#endif
 }
 #endif
 


More information about the dev-commits-src-all mailing list