diff options
Diffstat (limited to 'include/console.h')
-rw-r--r-- | include/console.h | 56 |
1 files changed, 30 insertions, 26 deletions
diff --git a/include/console.h b/include/console.h index d59e3b4f..deb4fa3d 100644 --- a/include/console.h +++ b/include/console.h @@ -1,8 +1,18 @@ -#ifndef _SHIM_LIB_CONSOLE_H -#define _SHIM_LIB_CONSOLE_H 1 +#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, @@ -26,9 +36,6 @@ void console_reset(void); #define NOSEL 0x7fffffff -#define EFI_CONSOLE_CONTROL_PROTOCOL_GUID \ - { 0xf42f7782, 0x12e, 0x4c12, {0x99, 0x56, 0x49, 0xf9, 0x43, 0x4, 0xf7, 0x21} } - typedef struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL; typedef enum { @@ -42,7 +49,7 @@ EFI_STATUS (EFIAPI *EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE) ( IN EFI_CONSOLE_CONTROL_PROTOCOL *This, OUT EFI_CONSOLE_CONTROL_SCREEN_MODE *Mode, - OUT BOOLEAN *GopUgaExists, OPTIONAL + OUT BOOLEAN *GopUgaExists, OPTIONAL OUT BOOLEAN *StdInLocked OPTIONAL ); @@ -66,26 +73,23 @@ struct _EFI_CONSOLE_CONTROL_PROTOCOL { EFI_CONSOLE_CONTROL_PROTOCOL_LOCK_STD_IN LockStdIn; }; -extern VOID setup_console (int text); +extern VOID console_fini(VOID); 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 dprinta(fmt, ...) ({ \ - UINTN __dprinta_ret = 0; \ - if (verbose) { \ - UINTN __dprinta_i; \ - 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__); \ - FreePool(__dprinta_str); \ - } \ - __dprinta_ret; \ +extern UINT32 verbose; +#define dprint(fmt, ...) ({ \ + UINTN __dprint_ret = 0; \ + if (verbose) \ + __dprint_ret = console_print((fmt), ##__VA_ARGS__); \ + __dprint_ret; \ }) -#endif /* _SHIM_LIB_CONSOLE_H */ +extern EFI_STATUS print_crypto_errors(EFI_STATUS rc, char *file, const char *func, int line); +#define crypterr(rc) print_crypto_errors((rc), __FILE__, __func__, __LINE__) + +extern VOID msleep(unsigned long msecs); + +/* This is used in various things to determine if we should print to the + * console */ +extern UINT8 in_protocol; + +#endif /* SHIM_CONSOLE_H */ |