barebox as EFI payload may have direct device access over PCI. These devices may be doing DMA and need to be quiesced before barebox returns control to the EFI loader. Therefore start calling shutdown_barebox() in the efiexit path. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/efi/payload/init.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c index e2f763853fed..bb4c156d686d 100644 --- a/common/efi/payload/init.c +++ b/common/efi/payload/init.c @@ -429,16 +429,23 @@ late_initcall(efi_late_init); static int do_efiexit(int argc, char *argv[]) { + console_flush(); + + if (!streq_ptr(argv[1], "-f")) + shutdown_barebox(); + return BS->exit(efi_parent_image, EFI_SUCCESS, 0, NULL); } BAREBOX_CMD_HELP_START(efiexit) -BAREBOX_CMD_HELP_TEXT("Leave barebox and return to the calling EFI process\n") +BAREBOX_CMD_HELP_TEXT("Options:") +BAREBOX_CMD_HELP_OPT("-f", "force exit, don't call barebox shutdown") BAREBOX_CMD_HELP_END BAREBOX_CMD_START(efiexit) .cmd = do_efiexit, - BAREBOX_CMD_DESC("Usage: efiexit") + BAREBOX_CMD_DESC("Leave barebox and return to the calling EFI process") + BAREBOX_CMD_OPTS("[-flrw]") BAREBOX_CMD_GROUP(CMD_GRP_MISC) BAREBOX_CMD_HELP(cmd_efiexit_help) BAREBOX_CMD_END -- 2.39.2