38#define ATTR_FCOL_MASK 0x07
39#define ATTR_FCOL_BLACK 0x00
40#define ATTR_FCOL_BLUE 0x01
41#define ATTR_FCOL_GREEN 0x02
42#define ATTR_FCOL_CYAN 0x03
43#define ATTR_FCOL_RED 0x04
44#define ATTR_FCOL_MAGENTA 0x05
45#define ATTR_FCOL_YELLOW 0x06
46#define ATTR_FCOL_WHITE 0x07
48#define ATTR_BCOL_MASK 0x70
49#define ATTR_BCOL_BLACK 0x00
50#define ATTR_BCOL_BLUE 0x10
51#define ATTR_BCOL_GREEN 0x20
52#define ATTR_BCOL_CYAN 0x30
53#define ATTR_BCOL_RED 0x40
54#define ATTR_BCOL_MAGENTA 0x50
55#define ATTR_BCOL_YELLOW 0x60
56#define ATTR_BCOL_WHITE 0x70
58#define ATTR_DEFAULT ATTR_FCOL_WHITE
61#if ! ( defined ( CONSOLE_EFI ) && CONSOLE_EXPLICIT ( CONSOLE_EFI ) )
63#define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
87 int cx = ( params[1] - 1 );
88 int cy = ( params[0] - 1 );
124 unsigned int count,
int params[] ) {
126 static const uint8_t efi_attr_fcols[10] = {
132 static const uint8_t efi_attr_bcols[10] = {
141 for ( i = 0 ; i <
count ; i++ ) {
145 }
else if ( aspect == 1 ) {
147 }
else if ( aspect == 22 ) {
149 }
else if ( ( aspect >= 30 ) && ( aspect <= 39 ) ) {
151 efi_attr |= efi_attr_fcols[ aspect - 30 ];
152 }
else if ( ( aspect >= 40 ) && ( aspect <= 49 ) ) {
154 efi_attr |= efi_attr_bcols[ aspect - 40 ];
303 const char *ansi_seq;
321 DBG (
"EFI could not read extended keystroke: %s\n",
327 &
key.Key ) ) != 0 ) {
329 DBG (
"EFI could not read keystroke: %s\n",
334 DBG2 (
"EFI read key stroke shift %08x toggle %02x unicode %04x "
335 "scancode %04x\n",
key.KeyState.KeyShiftState,
336 key.KeyState.KeyToggleState,
key.Key.UnicodeChar,
348 shift =
key.KeyState.KeyShiftState;
360 toggle =
key.KeyState.KeyToggleState;
439 DBG (
"EFI using SimpleTextInputEx\n" );
441 DBG (
"EFI has no SimpleTextInputEx: %s\n",
strerror (
rc ) );
449 .name =
"eficonsole",
#define NULL
NULL pointer (VOID *)
union @162305117151260234136356364136041353210355154177 key
Sense key.
struct golan_eq_context ctx
EFI_CONSOLE_CONTROL_SCREEN_MODE
@ EfiConsoleControlScreenText
struct _EFI_CONSOLE_CONTROL_PROTOCOL EFI_CONSOLE_CONTROL_PROTOCOL
#define EFI_SHIFT_STATE_VALID
#define EFI_RIGHT_ALT_PRESSED
#define EFI_CAPS_LOCK_ACTIVE
struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL
#define EFI_LEFT_CONTROL_PRESSED
#define EFI_RIGHT_CONTROL_PRESSED
#define EFI_TOGGLE_STATE_VALID
struct _EFI_SIMPLE_TEXT_INPUT_PROTOCOL EFI_SIMPLE_TEXT_INPUT_PROTOCOL
struct _EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
int ansiesc_process(struct ansiesc_context *ctx, int c)
Process character that may be part of ANSI escape sequence.
struct arbelprm_rc_send_wqe rc
#define assert(condition)
Assert a condition at run-time.
static struct utf8_accumulator efi_utf8_acc
EFI console UTF-8 accumulator.
static const char * scancode_to_ansi_seq(unsigned int scancode)
Get ANSI escape sequence corresponding to EFI scancode.
static void efi_console_init(void)
Initialise EFI console.
static void efi_handle_dectcem_set(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM set (show cursor)
static int efi_iskey(void)
Check for character ready to read from EFI console.
static struct ansiesc_handler efi_ansiesc_handlers[]
EFI console ANSI escape sequence handlers.
static int efi_getchar(void)
Get character from EFI console.
static EFI_CONSOLE_CONTROL_PROTOCOL * conctrl
Console control protocol.
#define ATTR_FCOL_MAGENTA
#define ATTR_BCOL_MAGENTA
static unsigned int efi_attr
Current character attribute.
static struct ansiesc_context efi_ansiesc_ctx
EFI console ANSI escape sequence context.
static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL * efi_conin_ex
Extended simple text input protocol, if present.
static void efi_handle_ed(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI ED (erase in page)
static const char * ansi_input
Pointer to current ANSI output sequence.
static void efi_handle_dectcem_reset(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM reset (hide cursor)
static void efi_handle_cup(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[])
Handle ANSI CUP (cursor position)
static const char * ansi_sequences[]
Mapping from EFI scan codes to ANSI escape sequences.
static void efi_handle_sgr(struct ansiesc_context *ctx __unused, unsigned int count, int params[])
Handle ANSI SGR (set graphics rendition)
static void efi_putchar(int character)
Print a character to EFI console.
struct console_driver efi_console
EFI_GUID efi_simple_text_input_ex_protocol_guid
Simple text input extension protocol GUID.
uint16_t mode
Acceleration mode.
#define ANSIESC_DECTCEM_SET
Show cursor.
#define ANSIESC_ED
Erase in page.
#define ANSIESC_DECTCEM_RESET
Hide cursor.
#define ANSIESC_SGR
Select graphic rendition.
#define ANSIESC_CUP
Cursor position.
#define ANSIESC_ED_ALL
Erase whole page.
#define __unused
Declare a variable or data structure as unused.
#define DBG(...)
Print a debugging message.
#define INIT_EARLY
Early initialisation.
static unsigned int count
Number of entries.
#define FILE_LICENCE(_licence)
Declare a particular licence as applying to a file.
#define FILE_SECBOOT(_status)
Declare a file's UEFI Secure Boot permission status.
#define __console_driver
Mark a struct console_driver as being part of the console drivers table.
#define EFI_REQUEST_PROTOCOL(_protocol, _ptr)
Declare an EFI protocol to be requested by iPXE.
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
#define efi_open_unsafe(handle, protocol, interface)
Open protocol for unsafe persistent use.
EFI_SYSTEM_TABLE * efi_systab
void * memset(void *dest, int character, size_t len) __nonnull
#define __init_fn(init_order)
Declare an initialisation functon.
unsigned int key_remap(unsigned int character)
Remap a key.
#define KEYMAP_ALTGR
AltGr key flag.
#define KEYMAP_CTRL
Ctrl key flag.
#define KEYMAP_CAPSLOCK_REDO
Undo and redo CapsLock key flags.
char * strerror(int errno)
Retrieve string representation of error number.
EFI_CHECK_EVENT CheckEvent
EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
EFI_INPUT_READ_KEY ReadKeyStroke
EFI_EVENT WaitForKey
Event to use with WaitForEvent() to wait for a key to be available.
EFI_TEXT_ENABLE_CURSOR EnableCursor
EFI_TEXT_CLEAR_SCREEN ClearScreen
EFI_TEXT_STRING OutputString
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition
EFI_TEXT_SET_ATTRIBUTE SetAttribute
ANSI escape sequence context.
A handler for an escape sequence.
An initialisation function.
A UTF-8 character accumulator.
unsigned int character
Character in progress.
unsigned int utf8_accumulate(struct utf8_accumulator *utf8, uint8_t byte)
Accumulate Unicode character from UTF-8 byte sequence.
#define UTF8_INVALID
Invalid character returned when decoding fails.