diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2024-03-04 19:58:47 +0100 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2024-03-05 16:28:04 +0100 |
commit | d4a47c5f147758fac0ebe4d76b8a530b74fca154 (patch) | |
tree | 49e3a34bf03ea787d61fda84d797f4349645350c /common/efi | |
parent | ab6b3b6b43a7e9f91a99fb8c1ff1c3a7c666fcd9 (diff) | |
download | barebox-d4a47c5f147758fac0ebe4d76b8a530b74fca154.tar.gz barebox-d4a47c5f147758fac0ebe4d76b8a530b74fca154.tar.xz |
commands: efiexit: flush console and shutdown barebox
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@pengutronix.de>
Link: https://lore.barebox.org/20240304190038.3486881-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common/efi')
-rw-r--r-- | common/efi/payload/init.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/common/efi/payload/init.c b/common/efi/payload/init.c index e2f763853f..bb4c156d68 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 |