diff options
author | Arvind Sankar <nivedita@alum.mit.edu> | 2020-05-18 21:06:56 +0200 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2020-05-19 10:30:31 +0200 |
commit | 2c7d1e30e5884dc6f6727ecd9417491c9f321b59 (patch) | |
tree | 3ce8ad0faa361e2c04dcbbc7fda3ae867747b14c /drivers/firmware/efi/libstub/efi-stub-helper.c | |
parent | efi/libstub: Buffer output of efi_puts (diff) | |
download | linux-2c7d1e30e5884dc6f6727ecd9417491c9f321b59.tar.xz 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.c | 17 |
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. |