Index: sys/stand/efiboot/boot.c =================================================================== RCS file: /cvsroot/src/sys/stand/efiboot/boot.c,v retrieving revision 1.40 diff -u -p -r1.40 boot.c --- sys/stand/efiboot/boot.c 17 Oct 2021 14:12:54 -0000 1.40 +++ sys/stand/efiboot/boot.c 3 Nov 2021 08:59:46 -0000 @@ -93,6 +93,7 @@ static char rndseed_path[255]; int set_bootfile(const char *); int set_bootargs(const char *); +void command_acpi(char *); void command_boot(char *); void command_dev(char *); void command_initrd(char *); @@ -115,6 +116,7 @@ void command_version(char *); void command_quit(char *); const struct boot_command commands[] = { + { "acpi", command_acpi, "acpi [{on|off}]" }, { "boot", command_boot, "boot [dev:][filename] [args]\n (ex. \"hd0a:\\netbsd.old -s\"" }, { "dev", command_dev, "dev" }, #ifdef EFIBOOT_FDT @@ -173,6 +175,23 @@ command_help(char *arg) } void +command_acpi(char *arg) +{ + if (arg && *arg) { + if (strcmp(arg, "on") == 0) + efi_acpi_enable(1); + else if (strcmp(arg, "off") == 0) + efi_acpi_enable(0); + else { + command_help(""); + return; + } + } else { + printf("ACPI support is %sabled\n", + efi_acpi_enabled() ? "en" : "dis"); + } +} +void command_boot(char *arg) { char *fname = arg; Index: sys/stand/efiboot/efiacpi.c =================================================================== RCS file: /cvsroot/src/sys/stand/efiboot/efiacpi.c,v retrieving revision 1.11 diff -u -p -r1.11 efiacpi.c --- sys/stand/efiboot/efiacpi.c 6 Oct 2021 10:13:19 -0000 1.11 +++ sys/stand/efiboot/efiacpi.c 3 Nov 2021 08:59:46 -0000 @@ -49,10 +49,11 @@ static EFI_GUID Acpi20TableGuid = ACPI_2 static EFI_GUID Smbios3TableGuid = SMBIOS3_TABLE_GUID; static EFI_GUID SmbiosTableGuid = SMBIOS_TABLE_GUID; -static int acpi_enable = 1; static void *acpi_root = NULL; static void *smbios_table = NULL; +static int acpi_enabled = 1; + int efi_acpi_probe(void) { @@ -76,19 +77,13 @@ efi_acpi_probe(void) int efi_acpi_available(void) { - return acpi_root != NULL; + return acpi_root != NULL && acpi_enabled; } int efi_acpi_enabled(void) { - return acpi_enable; -} - -void -efi_acpi_enable(int enable) -{ - acpi_enable = enable; + return acpi_enabled; } void * @@ -105,6 +100,15 @@ efi_acpi_smbios(void) static char model_buf[128]; +void +efi_acpi_enable(int val) +{ + if (acpi_root == NULL) { + printf("No ACPI node\n"); + } else + acpi_enabled = val; +} + const char * efi_acpi_get_model(void) { Index: sys/stand/efiboot/efifdt.c =================================================================== RCS file: /cvsroot/src/sys/stand/efiboot/efifdt.c,v retrieving revision 1.31 diff -u -p -r1.31 efifdt.c --- sys/stand/efiboot/efifdt.c 6 Oct 2021 10:15:20 -0000 1.31 +++ sys/stand/efiboot/efifdt.c 3 Nov 2021 08:59:47 -0000 @@ -391,7 +391,7 @@ efi_fdt_gop(void) /* * In ACPI mode, use GOP as console. */ - if (efi_acpi_available() && efi_acpi_enabled()) { + if (efi_acpi_available()) { snprintf(buf, sizeof(buf), "/chosen/framebuffer@%" PRIx64, mode->FrameBufferBase); fdt_setprop_string(fdt_data, chosen, "stdout-path", buf); } @@ -587,17 +587,18 @@ arch_prepare_boot(const char *fname, con #ifdef EFIBOOT_ACPI /* ACPI support only works for little endian kernels */ - efi_acpi_enable(netbsd_elf_data == ELFDATA2LSB); - - if (efi_acpi_available() && efi_acpi_enabled()) { + if (efi_acpi_available() && netbsd_elf_data == ELFDATA2LSB) { int error = efi_fdt_create_acpifdt(); if (error != 0) { return error; } } else #endif - if (dtb_addr && efi_fdt_set_data((void *)(uintptr_t)dtb_addr) != 0) { - printf("boot: invalid DTB data\n"); + if (!dtb_addr || efi_fdt_set_data((void *)(uintptr_t)dtb_addr) != 0) { + if (!dtb_addr) + printf("boot: no DTB provided\n"); + else + printf("boot: invalid DTB data\n"); return EINVAL; }