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>
31 #include <sys/param.h>
32 #include <sys/reboot.h>
46 #include <bootstrap.h>
52 #include "loader_efi.h"
54 extern char bootprog_info
[];
56 struct arch_switch archsw
; /* MI/MD interface boundary */
58 EFI_GUID devid
= DEVICE_PATH_PROTOCOL
;
59 EFI_GUID imgid
= LOADED_IMAGE_PROTOCOL
;
60 EFI_GUID smbios
= SMBIOS_TABLE_GUID
;
61 EFI_GUID smbios3
= SMBIOS3_TABLE_GUID
;
62 EFI_GUID inputid
= SIMPLE_TEXT_INPUT_PROTOCOL
;
64 extern void acpi_detect(void);
65 extern void efi_getsmap(void);
67 static EFI_LOADED_IMAGE
*img
;
70 efi_zfs_is_preferred(EFI_HANDLE
*h
)
72 return (h
== img
->DeviceHandle
);
79 EFI_DEVICE_PATH
*path
;
80 EFI_HANDLE
*hin
, *hin_end
, *walker
;
85 * Find all the handles that support the SIMPLE_TEXT_INPUT_PROTOCOL and
86 * do the typical dance to get the right sized buffer.
90 status
= BS
->LocateHandle(ByProtocol
, &inputid
, 0, &sz
, 0);
91 if (status
== EFI_BUFFER_TOO_SMALL
) {
92 hin
= (EFI_HANDLE
*)malloc(sz
);
93 status
= BS
->LocateHandle(ByProtocol
, &inputid
, 0, &sz
,
95 if (EFI_ERROR(status
))
98 if (EFI_ERROR(status
))
102 * Look at each of the handles. If it supports the device path protocol,
103 * use it to get the device path for this handle. Then see if that
104 * device path matches either the USB device path for keyboards or the
105 * legacy device path for keyboards.
107 hin_end
= &hin
[sz
/ sizeof(*hin
)];
108 for (walker
= hin
; walker
< hin_end
; walker
++) {
109 status
= BS
->HandleProtocol(*walker
, &devid
, (VOID
**)&path
);
110 if (EFI_ERROR(status
))
113 while (!IsDevicePathEnd(path
)) {
115 * Check for the ACPI keyboard node. All PNP3xx nodes
116 * are keyboards of different flavors. Note: It is
117 * unclear of there's always a keyboard node when
118 * there's a keyboard controller, or if there's only one
119 * when a keyboard is detected at boot.
121 if (DevicePathType(path
) == ACPI_DEVICE_PATH
&&
122 (DevicePathSubType(path
) == ACPI_DP
||
123 DevicePathSubType(path
) == ACPI_EXTENDED_DP
)) {
124 ACPI_HID_DEVICE_PATH
*acpi
;
126 acpi
= (ACPI_HID_DEVICE_PATH
*)(void *)path
;
127 if ((EISA_ID_TO_NUM(acpi
->HID
) & 0xff00) == 0x300 &&
128 (acpi
->HID
& 0xffff) == PNP_EISA_ID_CONST
) {
133 * Check for USB keyboard node, if present. Unlike a
134 * PS/2 keyboard, these definitely only appear when
135 * connected to the system.
137 } else if (DevicePathType(path
) == MESSAGING_DEVICE_PATH
&&
138 DevicePathSubType(path
) == MSG_USB_CLASS_DP
) {
139 USB_CLASS_DEVICE_PATH
*usb
;
141 usb
= (USB_CLASS_DEVICE_PATH
*)(void *)path
;
142 if (usb
->DeviceClass
== 3 && /* HID */
143 usb
->DeviceSubClass
== 1 && /* Boot devices */
144 usb
->DeviceProtocol
== 1) { /* Boot keyboards */
149 path
= NextDevicePathNode(path
);
158 set_devdesc_currdev(struct devsw
*dev
, int unit
)
160 struct devdesc currdev
;
164 currdev
.d_type
= currdev
.d_dev
->dv_type
;
165 currdev
.d_unit
= unit
;
166 currdev
.d_opendata
= NULL
;
167 devname
= efi_fmtdev(&currdev
);
169 env_setenv("currdev", EV_VOLATILE
, devname
, efi_setcurrdev
,
171 env_setenv("loaddev", EV_VOLATILE
, devname
, env_noset
, env_nounset
);
175 find_currdev(EFI_LOADED_IMAGE
*img
)
177 pdinfo_list_t
*pdi_list
;
179 EFI_DEVICE_PATH
*devpath
, *copy
;
186 /* Did efi_zfs_probe() detect the boot pool? */
187 if (pool_guid
!= 0) {
188 struct zfs_devdesc currdev
;
190 currdev
.d_dev
= &zfs_dev
;
192 currdev
.d_type
= currdev
.d_dev
->dv_type
;
193 currdev
.d_opendata
= NULL
;
194 currdev
.pool_guid
= pool_guid
;
195 currdev
.root_guid
= 0;
196 devname
= efi_fmtdev(&currdev
);
198 env_setenv("currdev", EV_VOLATILE
, devname
, efi_setcurrdev
,
200 env_setenv("loaddev", EV_VOLATILE
, devname
, env_noset
,
205 /* We have device lists for hd, cd, fd, walk them all. */
206 pdi_list
= efiblk_get_pdinfo_list(&efipart_hddev
);
207 STAILQ_FOREACH(dp
, pdi_list
, pd_link
) {
208 struct disk_devdesc currdev
;
210 currdev
.d_dev
= &efipart_hddev
;
211 currdev
.d_type
= currdev
.d_dev
->dv_type
;
212 currdev
.d_unit
= dp
->pd_unit
;
213 currdev
.d_opendata
= NULL
;
214 currdev
.d_slice
= -1;
215 currdev
.d_partition
= -1;
217 if (dp
->pd_handle
== img
->DeviceHandle
) {
218 devname
= efi_fmtdev(&currdev
);
220 env_setenv("currdev", EV_VOLATILE
, devname
,
221 efi_setcurrdev
, env_nounset
);
222 env_setenv("loaddev", EV_VOLATILE
, devname
,
223 env_noset
, env_nounset
);
226 /* Assuming GPT partitioning. */
227 STAILQ_FOREACH(pp
, &dp
->pd_part
, pd_link
) {
228 if (pp
->pd_handle
== img
->DeviceHandle
) {
229 currdev
.d_slice
= pp
->pd_unit
;
230 currdev
.d_partition
= 255;
231 devname
= efi_fmtdev(&currdev
);
233 env_setenv("currdev", EV_VOLATILE
, devname
,
234 efi_setcurrdev
, env_nounset
);
235 env_setenv("loaddev", EV_VOLATILE
, devname
,
236 env_noset
, env_nounset
);
242 pdi_list
= efiblk_get_pdinfo_list(&efipart_cddev
);
243 STAILQ_FOREACH(dp
, pdi_list
, pd_link
) {
244 if (dp
->pd_handle
== img
->DeviceHandle
||
245 dp
->pd_alias
== img
->DeviceHandle
) {
246 set_devdesc_currdev(&efipart_cddev
, dp
->pd_unit
);
251 pdi_list
= efiblk_get_pdinfo_list(&efipart_fddev
);
252 STAILQ_FOREACH(dp
, pdi_list
, pd_link
) {
253 if (dp
->pd_handle
== img
->DeviceHandle
) {
254 set_devdesc_currdev(&efipart_fddev
, dp
->pd_unit
);
260 * Try the device handle from our loaded image first. If that
261 * fails, use the device path from the loaded image and see if
262 * any of the nodes in that path match one of the enumerated
265 if (efi_handle_lookup(img
->DeviceHandle
, &dev
, &unit
, &extra
) == 0) {
266 set_devdesc_currdev(dev
, unit
);
271 devpath
= efi_lookup_image_devpath(IH
);
272 while (devpath
!= NULL
) {
273 h
= efi_devpath_handle(devpath
);
280 if (efi_handle_lookup(h
, &dev
, &unit
, &extra
) == 0) {
281 set_devdesc_currdev(dev
, unit
);
285 devpath
= efi_lookup_devpath(h
);
286 if (devpath
!= NULL
) {
287 copy
= efi_devpath_trim(devpath
);
297 main(int argc
, CHAR16
*argv
[])
301 int i
, j
, vargood
, howto
;
306 archsw
.arch_autoload
= efi_autoload
;
307 archsw
.arch_getdev
= efi_getdev
;
308 archsw
.arch_copyin
= efi_copyin
;
309 archsw
.arch_copyout
= efi_copyout
;
310 archsw
.arch_readin
= efi_readin
;
311 archsw
.arch_loadaddr
= efi_loadaddr
;
312 archsw
.arch_free_loadaddr
= efi_free_loadaddr
;
313 /* Note this needs to be set before ZFS init. */
314 archsw
.arch_zfs_probe
= efi_zfs_probe
;
316 /* Get our loaded image protocol interface structure. */
317 BS
->HandleProtocol(IH
, &imgid
, (VOID
**)&img
);
319 /* Init the time source */
322 has_kbd
= has_keyboard();
325 * XXX Chicken-and-egg problem; we want to have console output
326 * early, but some console attributes may depend on reading from
327 * eg. the boot device, which we can't do yet. We can use
328 * printf() etc. once this is done.
334 * Initialise the block cache. Set the upper limit.
336 bcache_init(32768, 512);
339 * Parse the args to set the console settings, etc
340 * boot1.efi passes these in, if it can read /boot.config or /boot/config
341 * or iPXE may be setup to pass these in.
343 * Loop through the args, and for each one that contains an '=' that is
344 * not the first character, add it to the environment. This allows
345 * loader and kernel env vars to be passed on the command line. Convert
346 * args from UCS-2 to ASCII (16 to 8 bit) as they are copied.
349 for (i
= 1; i
< argc
; i
++) {
350 if (argv
[i
][0] == '-') {
351 for (j
= 1; argv
[i
][j
] != 0; j
++) {
363 howto
|= RB_MULTIPLE
;
376 howto
|= RB_SERIAL
| RB_MULTIPLE
;
379 howto
|= RB_DFLTROOT
;
385 if (argv
[i
][j
+ 1] == 0) {
387 strncpy(var
, "115200",
391 ptr
= &argv
[i
+ 1][0];
397 cpy16to8(&argv
[i
][j
+ 1], var
,
400 strncat(var
, ",8,n,1,-", sizeof(var
));
401 setenv("ttya-mode", var
, 1);
410 for (j
= 0; argv
[i
][j
] != 0; j
++) {
411 if (j
== sizeof(var
)) {
415 if (j
> 0 && argv
[i
][j
] == '=')
417 var
[j
] = (char)argv
[i
][j
];
425 for (i
= 0; howto_names
[i
].ev
!= NULL
; i
++)
426 if (howto
& howto_names
[i
].mask
)
427 setenv(howto_names
[i
].ev
, "YES", 1);
428 if (howto
& RB_MULTIPLE
) {
429 if (howto
& RB_SERIAL
)
430 setenv("console", "ttya text" , 1);
432 setenv("console", "text ttya" , 1);
433 } else if (howto
& RB_SERIAL
) {
434 setenv("console", "ttya" , 1);
438 * March through the device switch probing for things.
440 for (i
= 0; devsw
[i
] != NULL
; i
++)
441 if (devsw
[i
]->dv_init
!= NULL
)
442 (devsw
[i
]->dv_init
)();
444 printf("Command line arguments:");
445 for (i
= 0; i
< argc
; i
++) {
446 printf(" %S", argv
[i
]);
450 printf("Image base: 0x%lx\n", (u_long
)img
->ImageBase
);
451 printf("EFI version: %d.%02d\n", ST
->Hdr
.Revision
>> 16,
452 ST
->Hdr
.Revision
& 0xffff);
453 printf("EFI Firmware: %S (rev %d.%02d)\n", ST
->FirmwareVendor
,
454 ST
->FirmwareRevision
>> 16, ST
->FirmwareRevision
& 0xffff);
456 printf("\n%s", bootprog_info
);
459 * Disable the watchdog timer. By default the boot manager sets
460 * the timer to 5 minutes before invoking a boot option. If we
461 * want to return to the boot manager, we have to disable the
462 * watchdog timer and since we're an interactive program, we don't
463 * want to wait until the user types "quit". The timer may have
464 * fired by then. We don't care if this fails. It does not prevent
465 * normal functioning in any way...
467 BS
->SetWatchdogTimer(0, 0, 0, NULL
);
469 if (find_currdev(img
) != 0)
470 return (EFI_NOT_FOUND
);
472 efi_init_environment();
473 setenv("ISADIR", "amd64", 1); /* we only build 64bit */
476 if ((ptr
= efi_get_table(&smbios3
)) == NULL
)
477 ptr
= efi_get_table(&smbios
);
480 interact(NULL
); /* doesn't return */
482 return (EFI_SUCCESS
); /* keep compiler happy */
485 COMMAND_SET(reboot
, "reboot", "reboot the system", command_reboot
);
488 command_reboot(int argc __unused
, char *argv
[] __unused
)
492 for (i
= 0; devsw
[i
] != NULL
; ++i
)
493 if (devsw
[i
]->dv_cleanup
!= NULL
)
494 (devsw
[i
]->dv_cleanup
)();
496 RS
->ResetSystem(EfiResetCold
, EFI_SUCCESS
, 0, NULL
);
502 COMMAND_SET(memmap
, "memmap", "print memory map", command_memmap
);
505 command_memmap(int argc __unused
, char *argv
[] __unused
)
508 EFI_MEMORY_DESCRIPTOR
*map
, *p
;
517 status
= BS
->GetMemoryMap(&sz
, 0, &key
, &dsz
, &dver
);
518 if (status
!= EFI_BUFFER_TOO_SMALL
) {
519 printf("Can't determine memory map size\n");
523 status
= BS
->GetMemoryMap(&sz
, map
, &key
, &dsz
, &dver
);
524 if (EFI_ERROR(status
)) {
525 printf("Can't read memory map\n");
530 snprintf(line
, 80, "%23s %12s %12s %8s %4s\n",
531 "Type", "Physical", "Virtual", "#Pages", "Attr");
533 rv
= pager_output(line
);
539 for (i
= 0, p
= map
; i
< ndesc
;
540 i
++, p
= NextMemoryDescriptor(p
, dsz
)) {
541 snprintf(line
, 80, "%23s %012lx %012lx %08lx ",
542 efi_memory_type(p
->Type
),
546 rv
= pager_output(line
);
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
)
566 if (p
->Attribute
& EFI_MEMORY_NV
)
568 if (p
->Attribute
& EFI_MEMORY_MORE_RELIABLE
)
570 if (p
->Attribute
& EFI_MEMORY_RO
)
572 rv
= pager_output("\n");
581 COMMAND_SET(configuration
, "configuration", "print configuration tables",
582 command_configuration
);
585 command_configuration(int argc __unused
, char *argv
[] __unused
)
590 printf("NumberOfTableEntries=%lu\n",
591 (unsigned long)ST
->NumberOfTableEntries
);
592 for (i
= 0; i
< ST
->NumberOfTableEntries
; i
++) {
596 guid
= &ST
->ConfigurationTable
[i
].VendorGuid
;
598 if (efi_guid_to_name(guid
, &name
) == true) {
602 printf("Error while translating UUID to name");
604 printf(" at %p\n", ST
->ConfigurationTable
[i
].VendorTable
);
611 COMMAND_SET(mode
, "mode", "change or display EFI text modes", command_mode
);
614 command_mode(int argc
, char *argv
[])
622 SIMPLE_TEXT_OUTPUT_INTERFACE
*conout
;
623 extern void HO(void);
628 mode
= strtol(argv
[1], &cp
, 0);
630 printf("Invalid mode\n");
633 status
= conout
->QueryMode(conout
, mode
, &cols
, &rows
);
634 if (EFI_ERROR(status
)) {
635 printf("invalid mode %d\n", mode
);
638 status
= conout
->SetMode(conout
, mode
);
639 if (EFI_ERROR(status
)) {
640 printf("couldn't set mode %d\n", mode
);
643 sprintf(rowenv
, "%u", (unsigned)rows
);
644 setenv("LINES", rowenv
, 1);
645 sprintf(rowenv
, "%u", (unsigned)cols
);
646 setenv("COLUMNS", rowenv
, 1);
647 HO(); /* set cursor */
651 printf("Current mode: %d\n", conout
->Mode
->Mode
);
652 for (i
= 0; i
<= conout
->Mode
->MaxMode
; i
++) {
653 status
= conout
->QueryMode(conout
, i
, &cols
, &rows
);
654 if (EFI_ERROR(status
))
656 printf("Mode %d: %u columns, %u rows\n", i
, (unsigned)cols
,
661 printf("Select a mode with the command \"mode <number>\"\n");
666 COMMAND_SET(lsefi
, "lsefi", "list EFI handles", command_lsefi
);
669 command_lsefi(int argc __unused
, char *argv
[] __unused
)
672 EFI_HANDLE
*buffer
= NULL
;
674 UINTN bufsz
= 0, i
, j
;
678 status
= BS
->LocateHandle(AllHandles
, NULL
, NULL
, &bufsz
, buffer
);
679 if (status
!= EFI_BUFFER_TOO_SMALL
) {
680 snprintf(command_errbuf
, sizeof (command_errbuf
),
681 "unexpected error: %lld", (long long)status
);
684 if ((buffer
= malloc(bufsz
)) == NULL
) {
685 sprintf(command_errbuf
, "out of memory");
689 status
= BS
->LocateHandle(AllHandles
, NULL
, NULL
, &bufsz
, buffer
);
690 if (EFI_ERROR(status
)) {
692 snprintf(command_errbuf
, sizeof (command_errbuf
),
693 "LocateHandle() error: %lld", (long long)status
);
698 for (i
= 0; i
< (bufsz
/ sizeof (EFI_HANDLE
)); i
++) {
700 EFI_GUID
**protocols
= NULL
;
703 printf("Handle %p", handle
);
704 if (pager_output("\n"))
708 status
= BS
->ProtocolsPerHandle(handle
, &protocols
, &nproto
);
709 if (EFI_ERROR(status
)) {
710 snprintf(command_errbuf
, sizeof (command_errbuf
),
711 "ProtocolsPerHandle() error: %lld",
716 for (j
= 0; j
< nproto
; j
++) {
717 if (efi_guid_to_name(protocols
[j
], &name
) == true) {
721 printf("Error while translating UUID to name");
723 if ((ret
= pager_output("\n")) != 0)
726 BS
->FreePool(protocols
);
735 COMMAND_SET(lszfs
, "lszfs", "list child datasets of a zfs dataset",
739 command_lszfs(int argc
, char *argv
[])
744 command_errmsg
= "wrong number of arguments";
748 err
= zfs_list(argv
[1]);
750 command_errmsg
= strerror(err
);
757 COMMAND_SET(reloadbe
, "reloadbe", "refresh the list of ZFS Boot Environments",
761 command_reloadbe(int argc
, char *argv
[])
767 command_errmsg
= "wrong number of arguments";
772 err
= zfs_bootenv(argv
[1]);
774 root
= getenv("zfs_be_root");
778 err
= zfs_bootenv(root
);
782 command_errmsg
= strerror(err
);
788 #endif /* __FreeBSD__ */
790 #ifdef LOADER_FDT_SUPPORT
791 extern int command_fdt_internal(int argc
, char *argv
[]);
794 * Since proper fdt command handling function is defined in fdt_loader_cmd.c,
795 * and declaring it as extern is in contradiction with COMMAND_SET() macro
796 * (which uses static pointer), we're defining wrapper function, which
797 * calls the proper fdt handling routine.
800 command_fdt(int argc
, char *argv
[])
802 return (command_fdt_internal(argc
, argv
));
805 COMMAND_SET(fdt
, "fdt", "flattened device tree handling", command_fdt
);
809 * Chain load another efi loader.
812 command_chain(int argc
, char *argv
[])
814 EFI_GUID LoadedImageGUID
= LOADED_IMAGE_PROTOCOL
;
815 EFI_HANDLE loaderhandle
;
816 EFI_LOADED_IMAGE
*loaded_image
;
825 command_errmsg
= "wrong number of arguments";
831 if ((fd
= open(name
, O_RDONLY
)) < 0) {
832 command_errmsg
= "no such file";
836 if (fstat(fd
, &st
) < -1) {
837 command_errmsg
= "stat failed";
842 status
= BS
->AllocatePool(EfiLoaderCode
, (UINTN
)st
.st_size
, &buf
);
843 if (status
!= EFI_SUCCESS
) {
844 command_errmsg
= "failed to allocate buffer";
848 if (read(fd
, buf
, st
.st_size
) != st
.st_size
) {
849 command_errmsg
= "error while reading the file";
850 (void)BS
->FreePool(buf
);
855 status
= BS
->LoadImage(FALSE
, IH
, NULL
, buf
, st
.st_size
, &loaderhandle
);
856 (void)BS
->FreePool(buf
);
857 if (status
!= EFI_SUCCESS
) {
858 command_errmsg
= "LoadImage failed";
861 status
= BS
->HandleProtocol(loaderhandle
, &LoadedImageGUID
,
862 (void **)&loaded_image
);
868 for (i
= 2; i
< argc
; i
++)
869 len
+= strlen(argv
[i
]) + 1;
871 len
*= sizeof (*argp
);
872 loaded_image
->LoadOptions
= argp
= malloc (len
);
873 if (loaded_image
->LoadOptions
== NULL
) {
874 (void) BS
->UnloadImage(loaded_image
);
877 loaded_image
->LoadOptionsSize
= len
;
878 for (i
= 2; i
< argc
; i
++) {
881 *(argp
++) = *(ptr
++);
887 if (efi_getdev((void **)&dev
, name
, (const char **)&path
) == 0) {
888 struct zfs_devdesc
*z_dev
;
889 struct disk_devdesc
*d_dev
;
892 switch (dev
->d_type
) {
894 z_dev
= (struct zfs_devdesc
*)dev
;
895 loaded_image
->DeviceHandle
=
896 efizfs_get_handle_by_guid(z_dev
->pool_guid
);
899 loaded_image
->DeviceHandle
=
900 efi_find_handle(dev
->d_dev
, dev
->d_unit
);
903 hd
= efiblk_get_pdinfo(dev
);
904 if (STAILQ_EMPTY(&hd
->pd_part
)) {
905 loaded_image
->DeviceHandle
= hd
->pd_handle
;
908 d_dev
= (struct disk_devdesc
*)dev
;
909 STAILQ_FOREACH(pd
, &hd
->pd_part
, pd_link
) {
911 * d_partition should be 255
913 if (pd
->pd_unit
== d_dev
->d_slice
) {
914 loaded_image
->DeviceHandle
=
924 status
= BS
->StartImage(loaderhandle
, NULL
, NULL
);
925 if (status
!= EFI_SUCCESS
) {
926 command_errmsg
= "StartImage failed";
927 free(loaded_image
->LoadOptions
);
928 loaded_image
->LoadOptions
= NULL
;
929 status
= BS
->UnloadImage(loaded_image
);
933 return (CMD_ERROR
); /* not reached */
936 COMMAND_SET(chain
, "chain", "chain load file", command_chain
);