Module Name:    src
Committed By:   rin
Date:           Mon May 31 11:12:42 UTC 2021

Modified Files:
        src/sys/stand/efiboot: boot.c

Log Message:
Generalize boot.cfg workaround for ISO9660; fallback to default_device
whenever efi_file_path() fails (due to broken firmware), in addition to
the case of ISO9660 (for which efi_file_path() succeeds but does not
work correctly).


To generate a diff of this commit:
cvs rdiff -u -r1.29 -r1.30 src/sys/stand/efiboot/boot.c

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/boot.c
diff -u src/sys/stand/efiboot/boot.c:1.29 src/sys/stand/efiboot/boot.c:1.30
--- src/sys/stand/efiboot/boot.c:1.29	Sat Nov 28 14:02:09 2020
+++ src/sys/stand/efiboot/boot.c	Mon May 31 11:12:42 2021
@@ -1,4 +1,4 @@
-/*	$NetBSD: boot.c,v 1.29 2020/11/28 14:02:09 jmcneill Exp $	*/
+/*	$NetBSD: boot.c,v 1.30 2021/05/31 11:12:42 rin Exp $	*/
 
 /*-
  * Copyright (c) 2016 Kimihiro Nonaka <non...@netbsd.org>
@@ -132,22 +132,18 @@ const struct boot_command commands[] = {
 static int
 bootcfg_path(char *pathbuf, size_t pathbuflen)
 {
-	/*
-	 * Special handling of boot.cfg on ISO9660 because fs protocol doesn't
-	 * seem to work.
-	 */
-	if (default_fstype == FS_ISO9660) {
-		snprintf(pathbuf, pathbuflen, "%s:%s", default_device, BOOTCFG_FILENAME);
-		return 0;
-	}
 
 	/*
-	 * Fall back to fs protocol for loading boot.cfg
+	 * Fallback to default_device
+	 * - for ISO9660 (efi_file_path() succeeds but does not work correctly)
+	 * - or whenever efi_file_path() fails (due to broken firmware)
 	 */
-	if (efi_bootdp == NULL)
-		return ENXIO;
+	if (default_fstype == FS_ISO9660 || efi_bootdp == NULL ||
+	    efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen))
+		snprintf(pathbuf, pathbuflen, "%s:%s", default_device,
+		    BOOTCFG_FILENAME);
 
-	return efi_file_path(efi_bootdp, BOOTCFG_FILENAME, pathbuf, pathbuflen);
+	return 0;
 }
 
 void

Reply via email to