Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F160794068
D57802.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D57802.diff
View Options
diff --git a/stand/efi/loader/main.c b/stand/efi/loader/main.c
--- a/stand/efi/loader/main.c
+++ b/stand/efi/loader/main.c
@@ -375,6 +375,29 @@
return (sanity_check_currdev());
}
+/*
+ * Given a disk, try each of its partitions as the boot device.
+ */
+static int
+try_disk_and_partitions(pdinfo_t *disk, EFI_HANDLE skip_handle)
+{
+ pdinfo_t *pp;
+
+ if (disk == NULL)
+ return (ENOENT);
+
+ if (try_as_currdev(disk, true))
+ return (0);
+
+ STAILQ_FOREACH(pp, &disk->pd_part, pd_link) {
+ if (pp->pd_handle == skip_handle)
+ continue;
+ if (try_as_currdev(pp, true))
+ return (0);
+ }
+ return (ENOENT);
+}
+
/*
* Search the boot device first (i.e. the ESP and any sibling partitions).
* Per the UEFI specification, filesystems on other devices must not be
@@ -383,7 +406,7 @@
static int
try_boot_device_partitions(void)
{
- pdinfo_t *dp, *pp, *espdp;
+ pdinfo_t *dp;
CHAR16 *text;
dp = efiblk_get_pdinfo_by_handle(boot_img->DeviceHandle);
@@ -392,30 +415,11 @@
text = efi_devpath_name(dp->pd_devpath);
if (text != NULL) {
- printf("Trying ESP: %S\n", text);
+ printf("Trying ESP device: %S\n", text);
efi_free_devpath_name(text);
}
- set_currdev_pdinfo(dp);
- if (sanity_check_currdev())
- return (0);
- if (dp->pd_parent == NULL)
- return (ENOENT);
-
- espdp = dp;
- dp = dp->pd_parent;
- STAILQ_FOREACH(pp, &dp->pd_part, pd_link) {
- if (espdp == pp)
- continue;
- text = efi_devpath_name(pp->pd_devpath);
- if (text != NULL) {
- printf("Trying: %S\n", text);
- efi_free_devpath_name(text);
- }
- if (try_as_currdev(dp, pp))
- return (0);
- }
- return (ENOENT);
+ return (try_disk_and_partitions(dp->pd_parent, dp->pd_handle));
}
/*
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Jun 28, 10:42 PM (19 h, 28 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
34304388
Default Alt Text
D57802.diff (1 KB)
Attached To
Mode
D57802: loader.efi: Refactor try_boot_device_partitions
Attached
Detach File
Event Timeline
Log In to Comment