aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/drivers/firmware/efi/libstub/efi-stub-helper.c
diff options
context:
space:
mode:
authorArvind Sankar <nivedita@alum.mit.edu>2020-05-18 15:06:56 -0400
committerArd Biesheuvel <ardb@kernel.org>2020-05-19 10:30:31 +0200
commit2c7d1e30e5884dc6f6727ecd9417491c9f321b59 (patch)
tree3ce8ad0faa361e2c04dcbbc7fda3ae867747b14c /drivers/firmware/efi/libstub/efi-stub-helper.c
parentefi/libstub: Buffer output of efi_puts (diff)
downloadwireguard-linux-2c7d1e30e5884dc6f6727ecd9417491c9f321b59.tar.xz
wireguard-linux-2c7d1e30e5884dc6f6727ecd9417491c9f321b59.zip
efi/libstub: Add a basic printf implementation
Copy vsprintf from arch/x86/boot/printf.c to get a simple printf implementation. Signed-off-by: Arvind Sankar <nivedita@alum.mit.edu> Link: https://lore.kernel.org/r/20200518190716.751506-5-nivedita@alum.mit.edu [ardb: add some missing braces in if...else clauses] Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/efi-stub-helper.c')
-rw-r--r--drivers/firmware/efi/libstub/efi-stub-helper.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/drivers/firmware/efi/libstub/efi-stub-helper.c b/drivers/firmware/efi/libstub/efi-stub-helper.c
index 3cf506ab9ead..56b3b84fd3bd 100644
--- a/drivers/firmware/efi/libstub/efi-stub-helper.c
+++ b/drivers/firmware/efi/libstub/efi-stub-helper.c
@@ -7,6 +7,8 @@
* Copyright 2011 Intel Corporation; author Matt Fleming
*/
+#include <stdarg.h>
+
#include <linux/efi.h>
#include <linux/kernel.h>
#include <asm/efi.h>
@@ -51,6 +53,21 @@ void efi_puts(const char *str)
}
}
+int efi_printk(const char *fmt, ...)
+{
+ char printf_buf[256];
+ va_list args;
+ int printed;
+
+ va_start(args, fmt);
+ printed = vsprintf(printf_buf, fmt, args);
+ va_end(args);
+
+ efi_puts(printf_buf);
+
+ return printed;
+}
+
/*
* Parse the ASCII string 'cmdline' for EFI options, denoted by the efi=
* option, e.g. efi=nochunk.