The branch main has been updated by imp:

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

commit 69d1595ded957137ee103a385ca4056cc1d30d5a
Author:     Warner Losh <[email protected]>
AuthorDate: 2026-09-11 04:13:19 +0000
Commit:     Warner Losh <[email protected]>
CommitDate: 2026-09-11 04:15:27 +0000

    loader.efi: Move probing the md up to before doing bootmgr
    
    When someone has loaded a ram disk, that's a stronger hint about what to
    boot than the UEFI boot manager. Prefer it and rework a little the #ifdefs
    to reduce their number.
    
    Sponsored by:           Netflix
    Differential Revision:  https://reviews.freebsd.org/D59419
---
 stand/efi/loader/conf.c |  6 +-----
 stand/efi/loader/main.c | 25 +++++++++++--------------
 2 files changed, 12 insertions(+), 19 deletions(-)

diff --git a/stand/efi/loader/conf.c b/stand/efi/loader/conf.c
index 30d9b95739e8..f0183c9861f1 100644
--- a/stand/efi/loader/conf.c
+++ b/stand/efi/loader/conf.c
@@ -32,10 +32,6 @@
 
 extern struct devsw vdisk_dev;
 
-#ifdef MD_IMAGE_SIZE
-extern struct devsw md_dev;
-#endif
-
 struct devsw *devsw[] = {
        &efipart_fddev,
        &efipart_cddev,
@@ -48,7 +44,7 @@ struct devsw *devsw[] = {
 #ifdef EFI_ZFS_BOOT
        &zfs_dev,
 #endif
-#ifdef MD_IMAGE_SIZE
+#if defined(LOADER_MD_SUPPORT)
        &md_dev,
 #endif
        NULL
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
index 891ae198a13f..fa551e6fb742 100644
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -324,12 +324,10 @@ probe_zfs_currdev(uint64_t guid)
 }
 #endif
 
-#ifdef MD_IMAGE_SIZE
-extern struct devsw md_dev;
-
 static bool
 probe_md_currdev(void)
 {
+#ifdef LOADER_MD_SUPPORT
        bool rv;
 
        set_currdev_devsw(&md_dev, 0);
@@ -337,8 +335,10 @@ probe_md_currdev(void)
        if (!rv)
                printf("MD not present\n");
        return (rv);
-}
+#else
+       return (false);
 #endif
+}
 
 /*
  * Try the passed in partition or entire disk to see if we can find a bootable
@@ -646,7 +646,13 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t 
boot_info_sz)
        } while (0);
 
        /*
-        * Third choice: If we can find out image boot_info, and there's
+        * Third choice: If there is an MD device, try to use that.
+        */
+       if (probe_md_currdev())
+               return (0);
+
+       /*
+        * Forth choice: If we can find out image boot_info, and there's
         * a follow-on boot image in that boot_info, use that. In this
         * case root will be the partition specified in that image and
         * we'll load the kernel specified by the file path. Should there
@@ -664,15 +670,6 @@ find_currdev(bool do_bootmgr, char *boot_info, size_t 
boot_info_sz)
                } /* Nothing specified, try normal match */
        }
 
-#ifdef MD_IMAGE_SIZE
-       /*
-        * Forth choice: If there is an embedded MD, try to use that.
-        */
-       printf("Trying configured MD\n");
-       if (probe_md_currdev())
-               return (0);
-#endif /* MD_IMAGE_SIZE */
-
        /*
         * Fifth choice: try all the partitions on the boot device.
         */

Reply via email to