diff options
| author | Toomas Soome <tsoome@FreeBSD.org> | 2017-09-10 13:53:42 +0000 |
|---|---|---|
| committer | Toomas Soome <tsoome@FreeBSD.org> | 2017-09-10 13:53:42 +0000 |
| commit | 44832ad99d57e2660ccdd2818145a578151bbbda (patch) | |
| tree | 6fa9bc5446893bfb6dc489ebc0b8b94743ee6b27 /sys/boot/efi/loader | |
| parent | 263f801fef15e0fee1f7a5cb6b3062bc93b664cd (diff) | |
Notes
Diffstat (limited to 'sys/boot/efi/loader')
| -rw-r--r-- | sys/boot/efi/loader/main.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/sys/boot/efi/loader/main.c b/sys/boot/efi/loader/main.c index 895bb18752ccc..00c185cf96553 100644 --- a/sys/boot/efi/loader/main.c +++ b/sys/boot/efi/loader/main.c @@ -871,9 +871,41 @@ command_chain(int argc, char *argv[]) *(--argv) = 0; } - if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) - loaded_image->DeviceHandle = - efi_find_handle(dev->d_dev, dev->d_unit); + if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) { + struct zfs_devdesc *z_dev; + struct disk_devdesc *d_dev; + pdinfo_t *hd, *pd; + + switch (dev->d_type) { + case DEVT_ZFS: + z_dev = (struct zfs_devdesc *)dev; + loaded_image->DeviceHandle = + efizfs_get_handle_by_guid(z_dev->pool_guid); + break; + case DEVT_NET: + loaded_image->DeviceHandle = + efi_find_handle(dev->d_dev, dev->d_unit); + break; + default: + hd = efiblk_get_pdinfo(dev); + if (STAILQ_EMPTY(&hd->pd_part)) { + loaded_image->DeviceHandle = hd->pd_handle; + break; + } + d_dev = (struct disk_devdesc *)dev; + STAILQ_FOREACH(pd, &hd->pd_part, pd_link) { + /* + * d_partition should be 255 + */ + if (pd->pd_unit == d_dev->d_slice) { + loaded_image->DeviceHandle = + pd->pd_handle; + break; + } + } + break; + } + } dev_cleanup(); status = BS->StartImage(loaderhandle, NULL, NULL); |
