diff options
author | Tom Rini <trini@konsulko.com> | 2018-01-23 07:59:43 -0500 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2018-01-23 07:59:43 -0500 |
commit | a516416d75a9b0f52e9d63d47f8a7bd53239767c (patch) | |
tree | 25c580d1b723821f5f1ddf4a0f4f681141720de8 /lib/efi_selftest/efi_selftest_console.c | |
parent | c761a7e29d703d60208585bb7d8415e00aa22556 (diff) | |
parent | 003876d4694f1bfdfe6ff9ff0799fda9257cb652 (diff) |
Merge tag 'signed-efi-next' of git://github.com/agraf/u-boot
Patch queue for efi - 2018-01-23
This time around we have a lot of EFI patches from Heinrich.
Highlights are:
- Allow EFI applications to register as drivers
- Allow exposure of U-Boot block devices from an EFI payload
- Compatibility improvements
Diffstat (limited to 'lib/efi_selftest/efi_selftest_console.c')
-rw-r--r-- | lib/efi_selftest/efi_selftest_console.c | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lib/efi_selftest/efi_selftest_console.c b/lib/efi_selftest/efi_selftest_console.c index 6a7fd20da5..e1649f48bc 100644 --- a/lib/efi_selftest/efi_selftest_console.c +++ b/lib/efi_selftest/efi_selftest_console.c @@ -130,22 +130,25 @@ static void int2dec(s32 value, u16 **buf) } /* - * Print a formatted string to the EFI console + * Print a colored formatted string to the EFI console * - * @fmt: format string - * @...: optional arguments + * @color color, see constants in efi_api.h, use -1 for no color + * @fmt format string + * @... optional arguments */ -void efi_st_printf(const char *fmt, ...) +void efi_st_printc(int color, const char *fmt, ...) { va_list args; u16 buf[160]; const char *c; u16 *pos = buf; const char *s; - const u16 *u; + u16 *u; va_start(args, fmt); + if (color >= 0) + con_out->set_attribute(con_out, (unsigned long)color); c = fmt; for (; *c; ++c) { switch (*c) { @@ -188,9 +191,13 @@ void efi_st_printf(const char *fmt, ...) /* u16 string */ case 's': u = va_arg(args, u16*); - /* Ensure string fits into buffer */ - for (; *u && pos < buf + 120; ++u) - *pos++ = *u; + if (pos > buf) { + *pos = 0; + con_out->output_string(con_out, + buf); + } + con_out->output_string(con_out, u); + pos = buf; break; default: --c; @@ -216,6 +223,8 @@ void efi_st_printf(const char *fmt, ...) va_end(args); *pos = 0; con_out->output_string(con_out, buf); + if (color >= 0) + con_out->set_attribute(con_out, EFI_LIGHTGRAY); } /* |