summaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorSascha Hauer <s.hauer@pengutronix.de>2021-12-13 20:56:08 +0100
committerSascha Hauer <s.hauer@pengutronix.de>2021-12-13 23:37:32 +0100
commitf68a547deebdf6f63f2c89bf5097195f59dc4e7a (patch)
tree8fb42c953bf1d71d5439b3a0e2938caf98559fd6 /common
parent2640f8973a068f0c14145835926271aaada618a3 (diff)
downloadbarebox-f68a547deebdf6f63f2c89bf5097195f59dc4e7a.tar.gz
barebox-f68a547deebdf6f63f2c89bf5097195f59dc4e7a.tar.xz
efi: add efi_device hook to be called before an image is started
boot_services::open_protocol supports opening protocols exclusively. A protocol that is opened exclusively can not be used anymore by an application that is called via boot_services::start_image. We want to open the SNP protocol exclusively in the next step. That would mean a chainloaded barebox could no longer use the SNP protocol because it's exclusively opened by the current barebox already. To work around this a efi_drv::dev_pause and efi_drv::dev_continue is introduced. The former is called before an application is started and the latter right after an application has exited. This will be used by the SNP network driver to enter/leave exclusive mode. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'common')
-rw-r--r--common/efi/payload/image.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/common/efi/payload/image.c b/common/efi/payload/image.c
index c1206cd6e2..e63da9ddf0 100644
--- a/common/efi/payload/image.c
+++ b/common/efi/payload/image.c
@@ -139,10 +139,14 @@ static int efi_execute_image(const char *file)
shutdown_barebox();
}
+ efi_pause_devices();
+
efiret = BS->start_image(handle, NULL, NULL);
if (EFI_ERROR(efiret))
pr_err("failed to StartImage: %s\n", efi_strerror(efiret));
+ efi_continue_devices();
+
if (!is_driver)
BS->unload_image(handle);