summaryrefslogtreecommitdiff
path: root/lib/efi_loader
diff options
context:
space:
mode:
authorRob Clark <robdclark@gmail.com>2017-07-27 12:04:19 (GMT)
committerAlexander Graf <agraf@suse.de>2017-07-28 22:18:46 (GMT)
commitaf65db85b82b161f037e0889ae58bf461217b3f1 (patch)
tree38125833e0dff4160adc88ac9627f66badd9da8a /lib/efi_loader
parentc160d2f5ec9298d545a6e0fab0a68cc1a3e93759 (diff)
downloadu-boot-fsl-qoriq-af65db85b82b161f037e0889ae58bf461217b3f1.tar.xz
efi_loader: indent entry/exit prints to show nesting level
This should make it easier to see when a callback back to UEFI world calls back in to the u-boot world, and generally match up EFI_ENTRY() and EFI_EXIT() calls. Signed-off-by: Rob Clark <robdclark@gmail.com> [agraf: remove static from const var] Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'lib/efi_loader')
-rw-r--r--lib/efi_loader/efi_boottime.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/efi_loader/efi_boottime.c b/lib/efi_loader/efi_boottime.c
index aa8d0d1..59479ed 100644
--- a/lib/efi_loader/efi_boottime.c
+++ b/lib/efi_loader/efi_boottime.c
@@ -50,6 +50,7 @@ static volatile void *efi_gd, *app_gd;
#endif
static int entry_count;
+static int nesting_level;
/* Called on every callback entry */
int __efi_entry_check(void)
@@ -96,6 +97,28 @@ void efi_restore_gd(void)
#endif
}
+/*
+ * Two spaces per indent level, maxing out at 10.. which ought to be
+ * enough for anyone ;-)
+ */
+static const char *indent_string(int level)
+{
+ const char *indent = " ";
+ const int max = strlen(indent);
+ level = min(max, level * 2);
+ return &indent[max - level];
+}
+
+const char *__efi_nesting_inc(void)
+{
+ return indent_string(nesting_level++);
+}
+
+const char *__efi_nesting_dec(void)
+{
+ return indent_string(--nesting_level);
+}
+
/* Low 32 bit */
#define EFI_LOW32(a) (a & 0xFFFFFFFFULL)
/* High 32 bit */
@@ -748,9 +771,11 @@ static efi_status_t EFIAPI efi_start_image(efi_handle_t image_handle,
return EFI_EXIT(info->exit_status);
}
+ __efi_nesting_dec();
__efi_exit_check();
entry(image_handle, &systab);
__efi_entry_check();
+ __efi_nesting_inc();
/* Should usually never get here */
return EFI_EXIT(EFI_SUCCESS);