Module Name:    src
Committed By:   jmcneill
Date:           Fri May 21 21:53:15 UTC 2021

Modified Files:
        src/sys/stand/efiboot: efiacpi.c efiacpi.h efifdt.c exec.c version

Log Message:
Disable ACPI support when booting big endian kernels.


To generate a diff of this commit:
cvs rdiff -u -r1.8 -r1.9 src/sys/stand/efiboot/efiacpi.c
cvs rdiff -u -r1.1 -r1.2 src/sys/stand/efiboot/efiacpi.h
cvs rdiff -u -r1.28 -r1.29 src/sys/stand/efiboot/efifdt.c
cvs rdiff -u -r1.20 -r1.21 src/sys/stand/efiboot/exec.c
cvs rdiff -u -r1.22 -r1.23 src/sys/stand/efiboot/version

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/stand/efiboot/efiacpi.c
diff -u src/sys/stand/efiboot/efiacpi.c:1.8 src/sys/stand/efiboot/efiacpi.c:1.9
--- src/sys/stand/efiboot/efiacpi.c:1.8	Sat Oct 10 19:17:39 2020
+++ src/sys/stand/efiboot/efiacpi.c	Fri May 21 21:53:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.c,v 1.8 2020/10/10 19:17:39 jmcneill Exp $ */
+/* $NetBSD: efiacpi.c,v 1.9 2021/05/21 21:53:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -53,6 +53,7 @@ struct acpi_rdsp {
 static EFI_GUID Acpi20TableGuid = ACPI_20_TABLE_GUID;
 static EFI_GUID Smbios3TableGuid = SMBIOS3_TABLE_GUID;
 
+static int acpi_enable = 1;
 static void *acpi_root = NULL;
 static void *smbios3_table = NULL;
 
@@ -78,6 +79,18 @@ efi_acpi_available(void)
 	return acpi_root != NULL;
 }
 
+int
+efi_acpi_enabled(void)
+{
+	return acpi_enable;
+}
+
+void
+efi_acpi_enable(int enable)
+{
+	acpi_enable = enable;
+}
+
 static char model_buf[128];
 
 static const char *

Index: src/sys/stand/efiboot/efiacpi.h
diff -u src/sys/stand/efiboot/efiacpi.h:1.1 src/sys/stand/efiboot/efiacpi.h:1.2
--- src/sys/stand/efiboot/efiacpi.h:1.1	Fri Oct 12 22:08:04 2018
+++ src/sys/stand/efiboot/efiacpi.h	Fri May 21 21:53:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: efiacpi.h,v 1.1 2018/10/12 22:08:04 jmcneill Exp $ */
+/* $NetBSD: efiacpi.h,v 1.2 2021/05/21 21:53:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2018 The NetBSD Foundation, Inc.
@@ -32,4 +32,6 @@
 int efi_acpi_probe(void);
 void efi_acpi_show(void);
 int efi_acpi_available(void);
+int efi_acpi_enabled(void);
+void efi_acpi_enable(int);
 int efi_acpi_create_fdt(void);

Index: src/sys/stand/efiboot/efifdt.c
diff -u src/sys/stand/efiboot/efifdt.c:1.28 src/sys/stand/efiboot/efifdt.c:1.29
--- src/sys/stand/efiboot/efifdt.c:1.28	Sat Dec 19 08:09:31 2020
+++ src/sys/stand/efiboot/efifdt.c	Fri May 21 21:53:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: efifdt.c,v 1.28 2020/12/19 08:09:31 skrll Exp $ */
+/* $NetBSD: efifdt.c,v 1.29 2021/05/21 21:53:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -370,7 +370,7 @@ efi_fdt_gop(void)
 		/*
 		 * In ACPI mode, use GOP as console.
 		 */
-		if (efi_acpi_available()) {
+		if (efi_acpi_available() && efi_acpi_enabled()) {
 			snprintf(buf, sizeof(buf), "/chosen/framebuffer@%" PRIx64, mode->FrameBufferBase);
 			fdt_setprop_string(fdt_data, chosen, "stdout-path", buf);
 		}

Index: src/sys/stand/efiboot/exec.c
diff -u src/sys/stand/efiboot/exec.c:1.20 src/sys/stand/efiboot/exec.c:1.21
--- src/sys/stand/efiboot/exec.c:1.20	Tue May 11 07:15:10 2021
+++ src/sys/stand/efiboot/exec.c	Fri May 21 21:53:15 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.20 2021/05/11 07:15:10 skrll Exp $ */
+/* $NetBSD: exec.c,v 1.21 2021/05/21 21:53:15 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jason R. Thorpe
@@ -289,7 +289,10 @@ exec_netbsd(const char *fname, const cha
 	load_offset = 0;
 
 #ifdef EFIBOOT_ACPI
-	if (efi_acpi_available()) {
+	/* ACPI support only works for little endian kernels */
+	efi_acpi_enable(netbsd_elf_data == ELFDATA2LSB);
+
+	if (efi_acpi_available() && efi_acpi_enabled()) {
 		efi_acpi_create_fdt();
 	} else
 #endif

Index: src/sys/stand/efiboot/version
diff -u src/sys/stand/efiboot/version:1.22 src/sys/stand/efiboot/version:1.23
--- src/sys/stand/efiboot/version:1.22	Sun Oct 18 18:09:32 2020
+++ src/sys/stand/efiboot/version	Fri May 21 21:53:15 2021
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.22 2020/10/18 18:09:32 tnn Exp $
+$NetBSD: version,v 1.23 2021/05/21 21:53:15 jmcneill Exp $
 
 NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE.  The format of this
 file is important - make sure the entries are appended on end, last item
@@ -26,3 +26,4 @@ is taken as the current.
 2.3:	EFI RT and GOP support for devicetree mode.
 2.4:	Add ISO9660 support.
 2.5:	Recognize the EFI system partion as fstype MSDOS.
+2.6:	Disable ACPI support when booting big endian kernels.

Reply via email to