summaryrefslogtreecommitdiff
path: root/include/console.h
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2018-03-12 16:03:38 +0100
committerPeter Jones <pjones@redhat.com>2018-03-12 18:00:41 -0400
commit1fe31ee1b4ebf2f177d512d0301e11de0689a275 (patch)
tree50f082d81f6cab93b9394328c40f005e79e0f256 /include/console.h
parentd3b7ba1b09e64c0c17afc48270e38c364ded2cb0 (diff)
downloadefi-boot-shim-1fe31ee1b4ebf2f177d512d0301e11de0689a275.tar.gz
efi-boot-shim-1fe31ee1b4ebf2f177d512d0301e11de0689a275.zip
console: Add console_print and console_print_at helpers
This is a preparation commit for removing the setup_console(1) calls from MokManager and shim so that we don't force the EFI console to switch to text-mode. This commit replaces all direct calls to Print / PrintAt with calls to the new helpers (no functional changes) so that we can delay calling setup_console(1) till the first Print call in a follow-up patch. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Diffstat (limited to 'include/console.h')
-rw-r--r--include/console.h22
1 files changed, 16 insertions, 6 deletions
diff --git a/include/console.h b/include/console.h
index 5d9cd64d..62e8d6ec 100644
--- a/include/console.h
+++ b/include/console.h
@@ -1,8 +1,18 @@
#ifndef SHIM_CONSOLE_H
#define SHIM_CONSOLE_H
+#define Print(fmt, ...) \
+ ({"Do not directly call Print() use console_print() instead" = 1;});
+
+#define PrintAt(fmt, ...) \
+ ({"Do not directly call PrintAt() use console_print_at() instead" = 1;});
+
EFI_STATUS
console_get_keystroke(EFI_INPUT_KEY *key);
+UINTN
+console_print(const CHAR16 *fmt, ...);
+UINTN
+console_print_at(UINTN col, UINTN row, const CHAR16 *fmt, ...);
void
console_print_box_at(CHAR16 *str_arr[], int highlight,
int start_col, int start_row,
@@ -66,11 +76,11 @@ struct _EFI_CONSOLE_CONTROL_PROTOCOL {
extern VOID setup_console (int text);
extern VOID setup_verbosity(VOID);
extern UINT8 verbose;
-#define dprint(fmt, ...) ({ \
- UINTN __dprint_ret = 0; \
- if (verbose) \
- __dprint_ret = Print((fmt), ##__VA_ARGS__); \
- __dprint_ret; \
+#define dprint(fmt, ...) ({ \
+ UINTN __dprint_ret = 0; \
+ if (verbose) \
+ __dprint_ret = console_print((fmt), ##__VA_ARGS__); \
+ __dprint_ret; \
})
#define dprinta(fmt, ...) ({ \
UINTN __dprinta_ret = 0; \
@@ -79,7 +89,7 @@ extern UINT8 verbose;
CHAR16 *__dprinta_str = AllocateZeroPool((strlena(fmt) + 1) * 2); \
for (__dprinta_i = 0; fmt[__dprinta_i] != '\0'; __dprinta_i++) \
__dprinta_str[__dprinta_i] = fmt[__dprinta_i]; \
- __dprinta_ret = Print((__dprinta_str), ##__VA_ARGS__); \
+ __dprinta_ret = console_print((__dprinta_str), ##__VA_ARGS__); \
FreePool(__dprinta_str); \
} \
__dprinta_ret; \