efi_loader: efi variable support
[oweals/u-boot.git] / lib / efi_loader / efi_boottime.c
index f01b80598c627947a705f4e04719a978b668cb7b..90f005148472a331fdee7042d2234c099aa4c751 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <common.h>
 #include <efi_loader.h>
+#include <environment.h>
 #include <malloc.h>
 #include <asm/global_data.h>
 #include <libfdt_env.h>
@@ -1013,6 +1014,11 @@ static efi_status_t EFIAPI efi_exit_boot_services(void *image_handle,
        /* Make sure that notification functions are not called anymore */
        efi_tpl = TPL_HIGH_LEVEL;
 
+#if defined(CONFIG_CMD_SAVEENV) && !defined(CONFIG_ENV_IS_NOWHERE)
+       /* save any EFI variables that have been written: */
+       env_save();
+#endif
+
        board_quiesce_devices();
 
        /* Fix up caches for EFI payloads if necessary */