2 * Copyright (c) 2008-2010 Rui Paulo
3 * Copyright (c) 2006 Marcel Moolenaar
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #include <sys/cdefs.h>
29 __FBSDID("$FreeBSD$");
31 #include <sys/param.h>
32 #include <sys/reboot.h>
44 #include <bootstrap.h>
51 #include "loader_efi.h"
53 extern char bootprog_name[];
54 extern char bootprog_rev[];
55 extern char bootprog_date[];
56 extern char bootprog_maker[];
58 struct arch_switch archsw; /* MI/MD interface boundary */
60 EFI_GUID acpi = ACPI_TABLE_GUID;
61 EFI_GUID acpi20 = ACPI_20_TABLE_GUID;
62 EFI_GUID devid = DEVICE_PATH_PROTOCOL;
63 EFI_GUID imgid = LOADED_IMAGE_PROTOCOL;
64 EFI_GUID mps = MPS_TABLE_GUID;
65 EFI_GUID netid = EFI_SIMPLE_NETWORK_PROTOCOL;
66 EFI_GUID smbios = SMBIOS_TABLE_GUID;
67 EFI_GUID dxe = DXE_SERVICES_TABLE_GUID;
68 EFI_GUID hoblist = HOB_LIST_TABLE_GUID;
69 EFI_GUID memtype = MEMORY_TYPE_INFORMATION_TABLE_GUID;
70 EFI_GUID debugimg = DEBUG_IMAGE_INFO_TABLE_GUID;
71 EFI_GUID fdtdtb = FDT_TABLE_GUID;
72 EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL;
75 static void efi_zfs_probe(void);
79 * cpy8to16 copies a traditional C string into a CHAR16 string and
80 * 0 terminates it. len is the size of *dst in bytes.
83 cpy8to16(const char *src, CHAR16 *dst, size_t len)
85 len <<= 1; /* Assume CHAR16 is 2 bytes */
86 while (len > 0 && *src) {
94 cpy16to8(const CHAR16 *src, char *dst, size_t len)
98 for (i = 0; i < len && src[i]; i++)
99 dst[i] = (char)src[i];
108 EFI_DEVICE_PATH *path;
109 EFI_HANDLE *hin, *hin_end, *walker;
114 * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and
115 * do the typical dance to get the right sized buffer.
119 status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz, 0);
120 if (status == EFI_BUFFER_TOO_SMALL) {
121 hin = (EFI_HANDLE *)malloc(sz);
122 status = BS->LocateHandle(ByProtocol, &inputid, 0, &sz,
124 if (EFI_ERROR(status))
127 if (EFI_ERROR(status))
131 * Look at each of the handles. If it supports the device path protocol,
132 * use it to get the device path for this handle. Then see if that
133 * device path matches either the USB device path for keyboards or the
134 * legacy device path for keyboards.
136 hin_end = &hin[sz / sizeof(*hin)];
137 for (walker = hin; walker < hin_end; walker++) {
138 status = BS->HandleProtocol(*walker, &devid, (VOID **)&path);
139 if (EFI_ERROR(status))
142 while (!IsDevicePathEnd(path)) {
144 * Check for the ACPI keyboard node. All PNP3xx nodes
145 * are keyboards of different flavors. Note: It is
146 * unclear of there's always a keyboard node when
147 * there's a keyboard controller, or if there's only one
148 * when a keyboard is detected at boot.
150 if (DevicePathType(path) == ACPI_DEVICE_PATH &&
151 (DevicePathSubType(path) == ACPI_DP ||
152 DevicePathSubType(path) == ACPI_EXTENDED_DP)) {
153 ACPI_HID_DEVICE_PATH *acpi;
155 acpi = (ACPI_HID_DEVICE_PATH *)(void *)path;
156 if ((EISA_ID_TO_NUM(acpi->HID) & 0xff00) == 0x300 &&
157 (acpi->HID & 0xffff) == PNP_EISA_ID_CONST) {
162 * Check for USB keyboard node, if present. Unlike a
163 * PS/2 keyboard, these definitely only appear when
164 * connected to the system.
166 } else if (DevicePathType(path) == MESSAGING_DEVICE_PATH &&
167 DevicePathSubType(path) == MSG_USB_CLASS_DP) {
168 USB_CLASS_DEVICE_PATH *usb;
170 usb = (USB_CLASS_DEVICE_PATH *)(void *)path;
171 if (usb->DeviceClass == 3 && /* HID */
172 usb->DeviceSubClass == 1 && /* Boot devices */
173 usb->DeviceProtocol == 1) { /* Boot keyboards */
178 path = NextDevicePathNode(path);
187 find_currdev(EFI_LOADED_IMAGE *img, struct devsw **dev, int *unit,
190 EFI_DEVICE_PATH *devpath, *copy;
194 * Try the device handle from our loaded image first. If that
195 * fails, use the device path from the loaded image and see if
196 * any of the nodes in that path match one of the enumerated
199 if (efi_handle_lookup(img->DeviceHandle, dev, unit, extra) == 0)
203 devpath = efi_lookup_image_devpath(IH);
204 while (devpath != NULL) {
205 h = efi_devpath_handle(devpath);
209 if (efi_handle_lookup(h, dev, unit, extra) == 0) {
217 devpath = efi_lookup_devpath(h);
218 if (devpath != NULL) {
219 copy = efi_devpath_trim(devpath);
228 main(int argc, CHAR16 *argv[])
231 EFI_LOADED_IMAGE *img;
233 int i, j, vargood, unit, howto;
239 archsw.arch_autoload = efi_autoload;
240 archsw.arch_getdev = efi_getdev;
241 archsw.arch_copyin = efi_copyin;
242 archsw.arch_copyout = efi_copyout;
243 archsw.arch_readin = efi_readin;
245 /* Note this needs to be set before ZFS init. */
246 archsw.arch_zfs_probe = efi_zfs_probe;
249 /* Init the time source */
252 has_kbd = has_keyboard();
255 * XXX Chicken-and-egg problem; we want to have console output
256 * early, but some console attributes may depend on reading from
257 * eg. the boot device, which we can't do yet. We can use
258 * printf() etc. once this is done.
263 * Initialise the block cache. Set the upper limit.
265 bcache_init(32768, 512);
268 * Parse the args to set the console settings, etc
269 * boot1.efi passes these in, if it can read /boot.config or /boot/config
270 * or iPXE may be setup to pass these in.
272 * Loop through the args, and for each one that contains an '=' that is
273 * not the first character, add it to the environment. This allows
274 * loader and kernel env vars to be passed on the command line. Convert
275 * args from UCS-2 to ASCII (16 to 8 bit) as they are copied.
278 for (i = 1; i < argc; i++) {
279 if (argv[i][0] == '-') {
280 for (j = 1; argv[i][j] != 0; j++) {
292 howto |= RB_MULTIPLE;
305 howto |= RB_SERIAL | RB_MULTIPLE;
308 howto |= RB_DFLTROOT;
314 if (argv[i][j + 1] == 0) {
316 setenv("comconsole_speed", "115200", 1);
318 cpy16to8(&argv[i + 1][0], var,
320 setenv("comconsole_speedspeed", var, 1);
325 cpy16to8(&argv[i][j + 1], var,
327 setenv("comconsole_speed", var, 1);
337 for (j = 0; argv[i][j] != 0; j++) {
338 if (j == sizeof(var)) {
342 if (j > 0 && argv[i][j] == '=')
344 var[j] = (char)argv[i][j];
352 for (i = 0; howto_names[i].ev != NULL; i++)
353 if (howto & howto_names[i].mask)
354 setenv(howto_names[i].ev, "YES", 1);
355 if (howto & RB_MULTIPLE) {
356 if (howto & RB_SERIAL)
357 setenv("console", "comconsole efi" , 1);
359 setenv("console", "efi comconsole" , 1);
360 } else if (howto & RB_SERIAL) {
361 setenv("console", "comconsole" , 1);
364 if (efi_copy_init()) {
365 printf("failed to allocate staging area\n");
366 return (EFI_BUFFER_TOO_SMALL);
370 * March through the device switch probing for things.
372 for (i = 0; devsw[i] != NULL; i++)
373 if (devsw[i]->dv_init != NULL)
374 (devsw[i]->dv_init)();
376 /* Get our loaded image protocol interface structure. */
377 BS->HandleProtocol(IH, &imgid, (VOID**)&img);
379 printf("Command line arguments:");
380 for (i = 0; i < argc; i++)
381 printf(" %S", argv[i]);
384 printf("Image base: 0x%lx\n", (u_long)img->ImageBase);
385 printf("EFI version: %d.%02d\n", ST->Hdr.Revision >> 16,
386 ST->Hdr.Revision & 0xffff);
387 printf("EFI Firmware: %S (rev %d.%02d)\n", ST->FirmwareVendor,
388 ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff);
391 printf("%s, Revision %s\n", bootprog_name, bootprog_rev);
392 printf("(%s, %s)\n", bootprog_maker, bootprog_date);
395 * Disable the watchdog timer. By default the boot manager sets
396 * the timer to 5 minutes before invoking a boot option. If we
397 * want to return to the boot manager, we have to disable the
398 * watchdog timer and since we're an interactive program, we don't
399 * want to wait until the user types "quit". The timer may have
400 * fired by then. We don't care if this fails. It does not prevent
401 * normal functioning in any way...
403 BS->SetWatchdogTimer(0, 0, 0, NULL);
405 if (find_currdev(img, &dev, &unit, &pool_guid) != 0)
406 return (EFI_NOT_FOUND);
408 switch (dev->dv_type) {
411 struct zfs_devdesc currdev;
414 currdev.d_unit = unit;
415 currdev.d_type = currdev.d_dev->dv_type;
416 currdev.d_opendata = NULL;
417 currdev.pool_guid = pool_guid;
418 currdev.root_guid = 0;
419 env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
420 efi_setcurrdev, env_nounset);
421 env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
423 init_zfs_bootenv(zfs_fmtdev(&currdev));
428 struct devdesc currdev;
431 currdev.d_unit = unit;
432 currdev.d_opendata = NULL;
433 currdev.d_type = currdev.d_dev->dv_type;
434 env_setenv("currdev", EV_VOLATILE, efi_fmtdev(&currdev),
435 efi_setcurrdev, env_nounset);
436 env_setenv("loaddev", EV_VOLATILE, efi_fmtdev(&currdev), env_noset,
442 snprintf(var, sizeof(var), "%d.%02d", ST->Hdr.Revision >> 16,
443 ST->Hdr.Revision & 0xffff);
444 env_setenv("efi-version", EV_VOLATILE, var, env_noset, env_nounset);
445 setenv("LINES", "24", 1); /* optional */
447 for (k = 0; k < ST->NumberOfTableEntries; k++) {
448 guid = &ST->ConfigurationTable[k].VendorGuid;
449 if (!memcmp(guid, &smbios, sizeof(EFI_GUID))) {
450 smbios_detect(ST->ConfigurationTable[k].VendorTable);
455 interact(NULL); /* doesn't return */
457 return (EFI_SUCCESS); /* keep compiler happy */
460 /* XXX move to lib stand ? */
462 wcscmp(CHAR16 *a, CHAR16 *b)
465 while (*a && *b && *a == *b) {
473 COMMAND_SET(reboot, "reboot", "reboot the system", command_reboot);
476 command_reboot(int argc, char *argv[])
480 for (i = 0; devsw[i] != NULL; ++i)
481 if (devsw[i]->dv_cleanup != NULL)
482 (devsw[i]->dv_cleanup)();
484 RS->ResetSystem(EfiResetCold, EFI_SUCCESS, 23,
485 (CHAR16 *)"Reboot from the loader");
491 COMMAND_SET(quit, "quit", "exit the loader", command_quit);
494 command_quit(int argc, char *argv[])
500 COMMAND_SET(memmap, "memmap", "print memory map", command_memmap);
503 command_memmap(int argc, char *argv[])
506 EFI_MEMORY_DESCRIPTOR *map, *p;
511 static char *types[] = {
517 "RuntimeServicesCode",
518 "RuntimeServicesData",
519 "ConventionalMemory",
524 "MemoryMappedIOPortSpace",
529 status = BS->GetMemoryMap(&sz, 0, &key, &dsz, &dver);
530 if (status != EFI_BUFFER_TOO_SMALL) {
531 printf("Can't determine memory map size\n");
535 status = BS->GetMemoryMap(&sz, map, &key, &dsz, &dver);
536 if (EFI_ERROR(status)) {
537 printf("Can't read memory map\n");
542 printf("%23s %12s %12s %8s %4s\n",
543 "Type", "Physical", "Virtual", "#Pages", "Attr");
545 for (i = 0, p = map; i < ndesc;
546 i++, p = NextMemoryDescriptor(p, dsz)) {
547 printf("%23s %012jx %012jx %08jx ", types[p->Type],
548 (uintmax_t)p->PhysicalStart, (uintmax_t)p->VirtualStart,
549 (uintmax_t)p->NumberOfPages);
550 if (p->Attribute & EFI_MEMORY_UC)
552 if (p->Attribute & EFI_MEMORY_WC)
554 if (p->Attribute & EFI_MEMORY_WT)
556 if (p->Attribute & EFI_MEMORY_WB)
558 if (p->Attribute & EFI_MEMORY_UCE)
560 if (p->Attribute & EFI_MEMORY_WP)
562 if (p->Attribute & EFI_MEMORY_RP)
564 if (p->Attribute & EFI_MEMORY_XP)
572 COMMAND_SET(configuration, "configuration", "print configuration tables",
573 command_configuration);
576 guid_to_string(EFI_GUID *guid)
580 sprintf(buf, "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x",
581 guid->Data1, guid->Data2, guid->Data3, guid->Data4[0],
582 guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4],
583 guid->Data4[5], guid->Data4[6], guid->Data4[7]);
588 command_configuration(int argc, char *argv[])
592 printf("NumberOfTableEntries=%lu\n",
593 (unsigned long)ST->NumberOfTableEntries);
594 for (i = 0; i < ST->NumberOfTableEntries; i++) {
598 guid = &ST->ConfigurationTable[i].VendorGuid;
599 if (!memcmp(guid, &mps, sizeof(EFI_GUID)))
601 else if (!memcmp(guid, &acpi, sizeof(EFI_GUID)))
602 printf("ACPI Table");
603 else if (!memcmp(guid, &acpi20, sizeof(EFI_GUID)))
604 printf("ACPI 2.0 Table");
605 else if (!memcmp(guid, &smbios, sizeof(EFI_GUID)))
606 printf("SMBIOS Table");
607 else if (!memcmp(guid, &dxe, sizeof(EFI_GUID)))
609 else if (!memcmp(guid, &hoblist, sizeof(EFI_GUID)))
610 printf("HOB List Table");
611 else if (!memcmp(guid, &memtype, sizeof(EFI_GUID)))
612 printf("Memory Type Information Table");
613 else if (!memcmp(guid, &debugimg, sizeof(EFI_GUID)))
614 printf("Debug Image Info Table");
615 else if (!memcmp(guid, &fdtdtb, sizeof(EFI_GUID)))
618 printf("Unknown Table (%s)", guid_to_string(guid));
619 printf(" at %p\n", ST->ConfigurationTable[i].VendorTable);
626 COMMAND_SET(mode, "mode", "change or display EFI text modes", command_mode);
629 command_mode(int argc, char *argv[])
637 SIMPLE_TEXT_OUTPUT_INTERFACE *conout;
638 extern void HO(void);
643 mode = strtol(argv[1], &cp, 0);
645 printf("Invalid mode\n");
648 status = conout->QueryMode(conout, mode, &cols, &rows);
649 if (EFI_ERROR(status)) {
650 printf("invalid mode %d\n", mode);
653 status = conout->SetMode(conout, mode);
654 if (EFI_ERROR(status)) {
655 printf("couldn't set mode %d\n", mode);
658 sprintf(rowenv, "%u", (unsigned)rows);
659 setenv("LINES", rowenv, 1);
660 HO(); /* set cursor */
664 printf("Current mode: %d\n", conout->Mode->Mode);
665 for (i = 0; i <= conout->Mode->MaxMode; i++) {
666 status = conout->QueryMode(conout, i, &cols, &rows);
667 if (EFI_ERROR(status))
669 printf("Mode %d: %u columns, %u rows\n", i, (unsigned)cols,
674 printf("Select a mode with the command \"mode <number>\"\n");
680 COMMAND_SET(lszfs, "lszfs", "list child datasets of a zfs dataset",
684 command_lszfs(int argc, char *argv[])
689 command_errmsg = "wrong number of arguments";
693 err = zfs_list(argv[1]);
695 command_errmsg = strerror(err);
701 COMMAND_SET(reloadbe, "reloadbe", "refresh the list of ZFS Boot Environments",
705 command_reloadbe(int argc, char *argv[])
711 command_errmsg = "wrong number of arguments";
716 err = zfs_bootenv(argv[1]);
718 root = getenv("zfs_be_root");
722 err = zfs_bootenv(root);
726 command_errmsg = strerror(err);
734 COMMAND_SET(efishow, "efi-show", "print some or all EFI variables", command_efi_show);
737 efi_print_var(CHAR16 *varnamearg, EFI_GUID *matchguid, int lflag)
744 uint32_t uuid_status;
748 status = RS->GetVariable(varnamearg, matchguid, &attr,
750 if (status != EFI_BUFFER_TOO_SMALL) {
751 printf("Can't get the variable: error %#lx\n", status);
754 data = malloc(datasz);
755 status = RS->GetVariable(varnamearg, matchguid, &attr,
757 if (status != EFI_SUCCESS) {
758 printf("Can't get the variable: error %#lx\n", status);
761 uuid_to_string((uuid_t *)matchguid, &str, &uuid_status);
763 printf("%s 0x%x %S", str, attr, varnamearg);
765 printf("%s 0x%x %S=", str, attr, varnamearg);
769 for (i = 0; i < datasz - 1; i++) {
770 /* Quick hack to see if this ascii-ish string printable range plus tab, cr and lf */
771 if ((str[i] < 32 || str[i] > 126) && str[i] != 9 && str[i] != 10 && str[i] != 13) {
776 if (str[datasz - 1] != '\0')
781 for (i = 0; i < datasz / 2; i++) {
782 if (isalnum(data[i]) || isspace(data[i]))
783 printf("%c", data[i]);
785 printf("\\x%02x", data[i]);
790 if (pager_output("\n"))
796 command_efi_show(int argc, char *argv[])
802 * print all the env vars tagged with UUID
804 * search all the env vars and print the ones matching var
805 * eif-show -u UUID -v var
807 * print all the env vars that match UUID and var
809 /* NB: We assume EFI_GUID is the same as uuid_t */
810 int aflag = 0, gflag = 0, lflag = 0, vflag = 0;
814 EFI_GUID varguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
815 EFI_GUID matchguid = { 0,0,0,{0,0,0,0,0,0,0,0} };
816 uint32_t uuid_status;
818 CHAR16 varnamearg[128];
821 while ((ch = getopt(argc, argv, "ag:lv:")) != -1) {
828 uuid_from_string(optarg, (uuid_t *)&matchguid,
830 if (uuid_status != uuid_s_ok) {
831 printf("uid %s could not be parsed\n", optarg);
840 if (strlen(optarg) >= nitems(varnamearg)) {
841 printf("Variable %s is longer than %zd characters\n",
842 optarg, nitems(varnamearg));
845 for (i = 0; i < strlen(optarg); i++)
846 varnamearg[i] = optarg[i];
850 printf("Invalid argument %c\n", ch);
855 if (aflag && (gflag || vflag)) {
856 printf("-a isn't compatible with -v or -u\n");
860 if (aflag && optind < argc) {
861 printf("-a doesn't take any args");
872 if (vflag && gflag) {
873 rv = efi_print_var(varnamearg, &matchguid, lflag);
880 if (strlen(optarg) >= nitems(varnamearg)) {
881 printf("Variable %s is longer than %zd characters\n",
882 optarg, nitems(varnamearg));
886 for (i = 0; i < strlen(optarg); i++)
887 varnamearg[i] = optarg[i];
890 uuid_from_string(optarg, (uuid_t *)&matchguid,
892 if (uuid_status != uuid_s_ok) {
893 printf("uid %s could not be parsed\n", optarg);
897 rv = efi_print_var(varnamearg, &matchguid, lflag);
903 printf("Too many args\n");
909 * Initiate the search -- note the standard takes pain
910 * to specify the initial call must be a poiner to a NULL
913 varsz = nitems(varname);
915 while ((status = RS->GetNextVariableName(&varsz, varname, &varguid)) !=
918 if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
923 if (wcscmp(varnamearg, varname) == 0) {
924 if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
930 if (memcmp(&varguid, &matchguid, sizeof(varguid)) == 0) {
931 if (efi_print_var(varname, &varguid, lflag) != CMD_OK)
942 COMMAND_SET(efiset, "efi-set", "set EFI variables", command_efi_set);
945 command_efi_set(int argc, char *argv[])
947 char *uuid, *var, *val;
954 printf("efi-set uuid var new-value\n");
960 uuid_from_string(uuid, (uuid_t *)&guid, &status);
961 if (status != uuid_s_ok) {
962 printf("Invalid uuid %s %d\n", uuid, status);
965 cpy8to16(var, wvar, sizeof(wvar));
966 err = RS->SetVariable(wvar, &guid,
967 EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_RUNTIME_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS,
968 strlen(val) + 1, val);
969 if (EFI_ERROR(err)) {
970 printf("Failed to set variable: error %lu\n", EFI_ERROR_CODE(err));
976 COMMAND_SET(efiunset, "efi-unset", "delete / unset EFI variables", command_efi_unset);
979 command_efi_unset(int argc, char *argv[])
988 printf("efi-unset uuid var\n");
993 uuid_from_string(uuid, (uuid_t *)&guid, &status);
994 if (status != uuid_s_ok) {
995 printf("Invalid uuid %s\n", uuid);
998 cpy8to16(var, wvar, sizeof(wvar));
999 err = RS->SetVariable(wvar, &guid, 0, 0, NULL);
1000 if (EFI_ERROR(err)) {
1001 printf("Failed to unset variable: error %lu\n", EFI_ERROR_CODE(err));
1007 #ifdef LOADER_FDT_SUPPORT
1008 extern int command_fdt_internal(int argc, char *argv[]);
1011 * Since proper fdt command handling function is defined in fdt_loader_cmd.c,
1012 * and declaring it as extern is in contradiction with COMMAND_SET() macro
1013 * (which uses static pointer), we're defining wrapper function, which
1014 * calls the proper fdt handling routine.
1017 command_fdt(int argc, char *argv[])
1020 return (command_fdt_internal(argc, argv));
1023 COMMAND_SET(fdt, "fdt", "flattened device tree handling", command_fdt);
1033 char dname[SPECNAMELEN + 1];
1037 h = efi_find_handle(&efipart_dev, 0);
1038 for (i = 0; h != NULL; h = efi_find_handle(&efipart_dev, ++i)) {
1039 snprintf(dname, sizeof(dname), "%s%d:", efipart_dev.dv_name, i);
1040 if (zfs_probe_dev(dname, &guid) == 0)
1041 (void)efi_handle_update_dev(h, &zfs_dev, unit++, guid);