Changeset View
Changeset View
Standalone View
Standalone View
head/sys/boot/efi/loader/main.c
Show First 20 Lines • Show All 865 Lines • ▼ Show 20 Lines | for (i = 2; i < argc; i++) { | ||||
char *ptr = argv[i]; | char *ptr = argv[i]; | ||||
while (*ptr) | while (*ptr) | ||||
*(argp++) = *(ptr++); | *(argp++) = *(ptr++); | ||||
*(argp++) = ' '; | *(argp++) = ' '; | ||||
} | } | ||||
*(--argv) = 0; | *(--argv) = 0; | ||||
} | } | ||||
if (efi_getdev((void **)&dev, name, (const char **)&path) == 0) | 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 = | 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); | 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(); | dev_cleanup(); | ||||
status = BS->StartImage(loaderhandle, NULL, NULL); | status = BS->StartImage(loaderhandle, NULL, NULL); | ||||
if (status != EFI_SUCCESS) { | if (status != EFI_SUCCESS) { | ||||
command_errmsg = "StartImage failed"; | command_errmsg = "StartImage failed"; | ||||
free(loaded_image->LoadOptions); | free(loaded_image->LoadOptions); | ||||
loaded_image->LoadOptions = NULL; | loaded_image->LoadOptions = NULL; | ||||
status = BS->UnloadImage(loaded_image); | status = BS->UnloadImage(loaded_image); | ||||
return (CMD_ERROR); | return (CMD_ERROR); | ||||
} | } | ||||
return (CMD_ERROR); /* not reached */ | return (CMD_ERROR); /* not reached */ | ||||
} | } | ||||
COMMAND_SET(chain, "chain", "chain load file", command_chain); | COMMAND_SET(chain, "chain", "chain load file", command_chain); |