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