iPXE
efi_console.c
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008 Michael Brown <mbrown@fensystems.co.uk>.
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public License as
6  * published by the Free Software Foundation; either version 2 of the
7  * License, or any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
17  * 02110-1301, USA.
18  */
19 
20 FILE_LICENCE ( GPL2_OR_LATER );
21 
22 #include <stddef.h>
23 #include <string.h>
24 #include <errno.h>
25 #include <assert.h>
26 #include <ipxe/efi/efi.h>
28 #include <ipxe/ansiesc.h>
29 #include <ipxe/utf8.h>
30 #include <ipxe/console.h>
31 #include <ipxe/keymap.h>
32 #include <ipxe/init.h>
33 #include <config/console.h>
34 
35 #define ATTR_BOLD 0x08
36 
37 #define ATTR_FCOL_MASK 0x07
38 #define ATTR_FCOL_BLACK 0x00
39 #define ATTR_FCOL_BLUE 0x01
40 #define ATTR_FCOL_GREEN 0x02
41 #define ATTR_FCOL_CYAN 0x03
42 #define ATTR_FCOL_RED 0x04
43 #define ATTR_FCOL_MAGENTA 0x05
44 #define ATTR_FCOL_YELLOW 0x06
45 #define ATTR_FCOL_WHITE 0x07
46 
47 #define ATTR_BCOL_MASK 0x70
48 #define ATTR_BCOL_BLACK 0x00
49 #define ATTR_BCOL_BLUE 0x10
50 #define ATTR_BCOL_GREEN 0x20
51 #define ATTR_BCOL_CYAN 0x30
52 #define ATTR_BCOL_RED 0x40
53 #define ATTR_BCOL_MAGENTA 0x50
54 #define ATTR_BCOL_YELLOW 0x60
55 #define ATTR_BCOL_WHITE 0x70
56 
57 #define ATTR_DEFAULT ATTR_FCOL_WHITE
58 
59 /* Set default console usage if applicable */
60 #if ! ( defined ( CONSOLE_EFI ) && CONSOLE_EXPLICIT ( CONSOLE_EFI ) )
61 #undef CONSOLE_EFI
62 #define CONSOLE_EFI ( CONSOLE_USAGE_ALL & ~CONSOLE_USAGE_LOG )
63 #endif
64 
65 /** Current character attribute */
66 static unsigned int efi_attr = ATTR_DEFAULT;
67 
68 /** Console control protocol */
71 
72 /** Extended simple text input protocol, if present */
74 
75 /**
76  * Handle ANSI CUP (cursor position)
77  *
78  * @v ctx ANSI escape sequence context
79  * @v count Parameter count
80  * @v params[0] Row (1 is top)
81  * @v params[1] Column (1 is left)
82  */
84  unsigned int count __unused, int params[] ) {
86  int cx = ( params[1] - 1 );
87  int cy = ( params[0] - 1 );
88 
89  if ( cx < 0 )
90  cx = 0;
91  if ( cy < 0 )
92  cy = 0;
93 
94  conout->SetCursorPosition ( conout, cx, cy );
95 }
96 
97 /**
98  * Handle ANSI ED (erase in page)
99  *
100  * @v ctx ANSI escape sequence context
101  * @v count Parameter count
102  * @v params[0] Region to erase
103  */
105  unsigned int count __unused,
106  int params[] __unused ) {
108 
109  /* We assume that we always clear the whole screen */
110  assert ( params[0] == ANSIESC_ED_ALL );
111 
112  conout->ClearScreen ( conout );
113 }
114 
115 /**
116  * Handle ANSI SGR (set graphics rendition)
117  *
118  * @v ctx ANSI escape sequence context
119  * @v count Parameter count
120  * @v params List of graphic rendition aspects
121  */
123  unsigned int count, int params[] ) {
125  static const uint8_t efi_attr_fcols[10] = {
129  ATTR_FCOL_WHITE, ATTR_FCOL_WHITE /* defaults */
130  };
131  static const uint8_t efi_attr_bcols[10] = {
135  ATTR_BCOL_BLACK, ATTR_BCOL_BLACK /* defaults */
136  };
137  unsigned int i;
138  int aspect;
139 
140  for ( i = 0 ; i < count ; i++ ) {
141  aspect = params[i];
142  if ( aspect == 0 ) {
144  } else if ( aspect == 1 ) {
145  efi_attr |= ATTR_BOLD;
146  } else if ( aspect == 22 ) {
147  efi_attr &= ~ATTR_BOLD;
148  } else if ( ( aspect >= 30 ) && ( aspect <= 39 ) ) {
150  efi_attr |= efi_attr_fcols[ aspect - 30 ];
151  } else if ( ( aspect >= 40 ) && ( aspect <= 49 ) ) {
153  efi_attr |= efi_attr_bcols[ aspect - 40 ];
154  }
155  }
156 
157  conout->SetAttribute ( conout, efi_attr );
158 }
159 
160 /**
161  * Handle ANSI DECTCEM set (show cursor)
162  *
163  * @v ctx ANSI escape sequence context
164  * @v count Parameter count
165  * @v params List of graphic rendition aspects
166  */
168  unsigned int count __unused,
169  int params[] __unused ) {
171 
172  conout->EnableCursor ( conout, TRUE );
173 }
174 
175 /**
176  * Handle ANSI DECTCEM reset (hide cursor)
177  *
178  * @v ctx ANSI escape sequence context
179  * @v count Parameter count
180  * @v params List of graphic rendition aspects
181  */
183  unsigned int count __unused,
184  int params[] __unused ) {
186 
187  conout->EnableCursor ( conout, FALSE );
188 }
189 
190 /** EFI console ANSI escape sequence handlers */
197  { 0, NULL }
198 };
199 
200 /** EFI console ANSI escape sequence context */
203 };
204 
205 /** EFI console UTF-8 accumulator */
207 
208 /**
209  * Print a character to EFI console
210  *
211  * @v character Character to be printed
212  */
213 static void efi_putchar ( int character ) {
215  wchar_t wstr[2];
216 
217  /* Intercept ANSI escape sequences */
219  if ( character < 0 )
220  return;
221 
222  /* Accumulate Unicode characters */
224  if ( character == 0 )
225  return;
226 
227  /* Treat unrepresentable (non-UCS2) characters as invalid */
228  if ( character & ~( ( wchar_t ) -1UL ) )
230 
231  /* Output character */
232  wstr[0] = character;
233  wstr[1] = L'\0';
234  conout->OutputString ( conout, wstr );
235 }
236 
237 /**
238  * Pointer to current ANSI output sequence
239  *
240  * While we are in the middle of returning an ANSI sequence for a
241  * special key, this will point to the next character to return. When
242  * not in the middle of such a sequence, this will point to a NUL
243  * (note: not "will be NULL").
244  */
245 static const char *ansi_input = "";
246 
247 /** Mapping from EFI scan codes to ANSI escape sequences */
248 static const char *ansi_sequences[] = {
249  [SCAN_UP] = "[A",
250  [SCAN_DOWN] = "[B",
251  [SCAN_RIGHT] = "[C",
252  [SCAN_LEFT] = "[D",
253  [SCAN_HOME] = "[H",
254  [SCAN_END] = "[F",
255  [SCAN_INSERT] = "[2~",
256  /* EFI translates an incoming backspace via the serial console
257  * into a SCAN_DELETE. There's not much we can do about this.
258  */
259  [SCAN_DELETE] = "[3~",
260  [SCAN_PAGE_UP] = "[5~",
261  [SCAN_PAGE_DOWN] = "[6~",
262  [SCAN_F5] = "[15~",
263  [SCAN_F6] = "[17~",
264  [SCAN_F7] = "[18~",
265  [SCAN_F8] = "[19~",
266  [SCAN_F9] = "[20~",
267  [SCAN_F10] = "[21~",
268  [SCAN_F11] = "[23~",
269  [SCAN_F12] = "[24~",
270  /* EFI translates some (but not all) incoming escape sequences
271  * via the serial console into equivalent scancodes. When it
272  * doesn't recognise a sequence, it helpfully(!) translates
273  * the initial ESC and passes the remainder through verbatim.
274  * Treating SCAN_ESC as equivalent to an empty escape sequence
275  * works around this bug.
276  */
277  [SCAN_ESC] = "",
278 };
279 
280 /**
281  * Get ANSI escape sequence corresponding to EFI scancode
282  *
283  * @v scancode EFI scancode
284  * @ret ansi_seq ANSI escape sequence, if any, otherwise NULL
285  */
286 static const char * scancode_to_ansi_seq ( unsigned int scancode ) {
287  if ( scancode < ( sizeof ( ansi_sequences ) /
288  sizeof ( ansi_sequences[0] ) ) ) {
289  return ansi_sequences[scancode];
290  }
291  return NULL;
292 }
293 
294 /**
295  * Get character from EFI console
296  *
297  * @ret character Character read from console
298  */
299 static int efi_getchar ( void ) {
302  const char *ansi_seq;
303  unsigned int character;
304  unsigned int shift;
305  unsigned int toggle;
307  EFI_STATUS efirc;
308  int rc;
309 
310  /* If we are mid-sequence, pass out the next byte */
311  if ( *ansi_input )
312  return *(ansi_input++);
313 
314  /* Read key from real EFI console */
315  memset ( &key, 0, sizeof ( key ) );
316  if ( conin_ex ) {
317  if ( ( efirc = conin_ex->ReadKeyStrokeEx ( conin_ex,
318  &key ) ) != 0 ) {
319  rc = -EEFI ( efirc );
320  DBG ( "EFI could not read extended keystroke: %s\n",
321  strerror ( rc ) );
322  return 0;
323  }
324  } else {
325  if ( ( efirc = conin->ReadKeyStroke ( conin,
326  &key.Key ) ) != 0 ) {
327  rc = -EEFI ( efirc );
328  DBG ( "EFI could not read keystroke: %s\n",
329  strerror ( rc ) );
330  return 0;
331  }
332  }
333  DBG2 ( "EFI read key stroke shift %08x toggle %02x unicode %04x "
334  "scancode %04x\n", key.KeyState.KeyShiftState,
335  key.KeyState.KeyToggleState, key.Key.UnicodeChar,
336  key.Key.ScanCode );
337 
338  /* If key has a Unicode representation, remap and return it.
339  * There is unfortunately no way to avoid remapping the
340  * numeric keypad, since EFI destroys the scan code
341  * information that would allow us to differentiate between
342  * main keyboard and numeric keypad.
343  */
344  if ( ( character = key.Key.UnicodeChar ) != 0 ) {
345 
346  /* Apply shift state */
347  shift = key.KeyState.KeyShiftState;
348  if ( shift & EFI_SHIFT_STATE_VALID ) {
349  if ( shift & ( EFI_LEFT_CONTROL_PRESSED |
352  }
353  if ( shift & EFI_RIGHT_ALT_PRESSED ) {
355  }
356  }
357 
358  /* Apply toggle state */
359  toggle = key.KeyState.KeyToggleState;
360  if ( toggle & EFI_TOGGLE_STATE_VALID ) {
361  if ( toggle & EFI_CAPS_LOCK_ACTIVE ) {
363  }
364  }
365 
366  /* Remap and return key */
367  return key_remap ( character );
368  }
369 
370  /* Otherwise, check for a special key that we know about */
371  if ( ( ansi_seq = scancode_to_ansi_seq ( key.Key.ScanCode ) ) ) {
372  /* Start of escape sequence: return ESC (0x1b) */
373  ansi_input = ansi_seq;
374  return 0x1b;
375  }
376 
377  return 0;
378 }
379 
380 /**
381  * Check for character ready to read from EFI console
382  *
383  * @ret True Character available to read
384  * @ret False No character available to read
385  */
386 static int efi_iskey ( void ) {
390  EFI_EVENT *event;
391  EFI_STATUS efirc;
392 
393  /* If we are mid-sequence, we are always ready */
394  if ( *ansi_input )
395  return 1;
396 
397  /* Check to see if the WaitForKey event has fired */
398  event = ( conin_ex ? conin_ex->WaitForKeyEx : conin->WaitForKey );
399  if ( ( efirc = bs->CheckEvent ( event ) ) == 0 )
400  return 1;
401 
402  return 0;
403 }
404 
405 /** EFI console driver */
407  .putchar = efi_putchar,
408  .getchar = efi_getchar,
409  .iskey = efi_iskey,
410  .usage = CONSOLE_EFI,
411 };
412 
413 /**
414  * Initialise EFI console
415  *
416  */
417 static void efi_console_init ( void ) {
420  union {
421  void *interface;
423  } u;
424  EFI_STATUS efirc;
425  int rc;
426 
427  /* On some older EFI 1.10 implementations, we must use the
428  * (now obsolete) EFI_CONSOLE_CONTROL_PROTOCOL to switch the
429  * console into text mode.
430  */
431  if ( conctrl ) {
432  conctrl->GetMode ( conctrl, &mode, NULL, NULL );
433  if ( mode != EfiConsoleControlScreenText ) {
436  }
437  }
438 
439  /* Attempt to open the Simple Text Input Ex protocol on the
440  * console input handle. This is provably unsafe, but is
441  * apparently the expected behaviour for all UEFI
442  * applications. Don't ask.
443  */
444  if ( ( efirc = bs->OpenProtocol ( efi_systab->ConsoleInHandle,
446  &u.interface, efi_image_handle,
448  EFI_OPEN_PROTOCOL_GET_PROTOCOL ) ) == 0 ) {
449  efi_conin_ex = u.wtf;
450  DBG ( "EFI using SimpleTextInputEx\n" );
451  } else {
452  rc = -EEFI ( efirc );
453  DBG ( "EFI has no SimpleTextInputEx: %s\n", strerror ( rc ) );
454  }
455 }
456 
457 /**
458  * EFI console initialisation function
459  */
460 struct init_fn efi_console_init_fn __init_fn ( INIT_EARLY ) = {
462 };
#define ATTR_FCOL_MAGENTA
Definition: efi_console.c:43
struct console_driver efi_console __console_driver
EFI console driver.
Definition: efi_console.c:406
static const char * scancode_to_ansi_seq(unsigned int scancode)
Get ANSI escape sequence corresponding to EFI scancode.
Definition: efi_console.c:286
EFI_BOOT_SERVICES * BootServices
A pointer to the EFI Boot Services Table.
Definition: UefiSpec.h:2000
struct arbelprm_rc_send_wqe rc
Definition: arbel.h:14
A handler for an escape sequence.
Definition: ansiesc.h:34
Keyboard mappings.
#define EFI_TOGGLE_STATE_VALID
#define EEFI(efirc)
Convert an EFI status code to an iPXE status code.
Definition: efi.h:162
struct ansiesc_handler * handlers
Array of handlers.
Definition: ansiesc.h:79
EFI_TEXT_SET_CURSOR_POSITION SetCursorPosition
void(* initialise)(void)
Definition: init.h:15
#define SCAN_ESC
Definition: SimpleTextIn.h:80
static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL * efi_conin_ex
Extended simple text input protocol, if present.
Definition: efi_console.c:73
#define ATTR_BCOL_GREEN
Definition: efi_console.c:50
#define EFI_RIGHT_ALT_PRESSED
EFI_CONSOLE_CONTROL_SCREEN_MODE
Error codes.
The EFI_SIMPLE_TEXT_INPUT_PROTOCOL is used on the ConsoleIn device.
Definition: SimpleTextIn.h:124
#define INIT_EARLY
Early initialisation.
Definition: init.h:28
#define ATTR_FCOL_CYAN
Definition: efi_console.c:41
#define KEYMAP_CTRL
Ctrl key flag.
Definition: keymap.h:55
VOID * EFI_EVENT
Handle to an event structure.
Definition: UefiBaseType.h:43
static unsigned int efi_attr
Current character attribute.
Definition: efi_console.c:66
EFI_HANDLE ConsoleInHandle
The handle for the active console input device.
Definition: UefiSpec.h:1968
ANSI escape sequence context.
Definition: ansiesc.h:73
struct golan_eq_context ctx
Definition: CIB_PRM.h:28
#define SCAN_LEFT
Definition: SimpleTextIn.h:63
#define CONSOLE_EFI
Definition: efi_console.c:62
#define ATTR_FCOL_GREEN
Definition: efi_console.c:40
#define EFI_RIGHT_CONTROL_PRESSED
#define ATTR_FCOL_MASK
Definition: efi_console.c:37
uint16_t cx
Definition: registers.h:51
static void efi_handle_dectcem_reset(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM reset (hide cursor)
Definition: efi_console.c:182
#define SCAN_DOWN
Definition: SimpleTextIn.h:61
EFI_CONSOLE_CONTROL_PROTOCOL_GET_MODE GetMode
EFI_EVENT WaitForKey
Event to use with WaitForEvent() to wait for a key to be available.
Definition: SimpleTextIn.h:130
static EFI_CONSOLE_CONTROL_PROTOCOL * conctrl
Console control protocol.
Definition: efi_console.c:69
The SIMPLE_TEXT_OUTPUT protocol is used to control text-based output devices.
#define UTF8_INVALID
Invalid character returned when decoding fails.
Definition: utf8.h:54
UTF-8 Unicode encoding.
#define ANSIESC_ED
Erase in page.
Definition: ansiesc.h:106
int ansiesc_process(struct ansiesc_context *ctx, int c)
Process character that may be part of ANSI escape sequence.
Definition: ansiesc.c:74
#define ANSIESC_ED_ALL
Erase whole page.
Definition: ansiesc.h:115
#define ATTR_BOLD
Definition: efi_console.c:35
#define ATTR_BCOL_BLUE
Definition: efi_console.c:49
EFI_EVENT WaitForKeyEx
Event to use with WaitForEvent() to wait for a key to be available.
EFI_TEXT_SET_ATTRIBUTE SetAttribute
#define ANSIESC_CUP
Cursor position.
Definition: ansiesc.h:103
#define SCAN_F12
EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL * ConOut
A pointer to the EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL interface that is associated with ConsoleOutHandle.
Definition: UefiSpec.h:1982
An initialisation function.
Definition: init.h:14
void(* putchar)(int character)
Write a character to the console.
Definition: console.h:68
#define SCAN_HOME
Definition: SimpleTextIn.h:64
static int efi_getchar(void)
Get character from EFI console.
Definition: efi_console.c:299
Assertions.
#define ATTR_BCOL_MAGENTA
Definition: efi_console.c:53
assert((readw(&hdr->flags) &(GTF_reading|GTF_writing))==0)
An object interface.
Definition: interface.h:124
#define SCAN_F6
Definition: SimpleTextIn.h:75
#define KEYMAP_ALTGR
AltGr key flag.
Definition: keymap.h:73
#define SCAN_F10
Definition: SimpleTextIn.h:79
EFI_INPUT_READ_KEY ReadKeyStroke
Definition: SimpleTextIn.h:126
#define ATTR_BCOL_YELLOW
Definition: efi_console.c:54
ANSI escape sequences.
EFI_SIMPLE_TEXT_INPUT_PROTOCOL * ConIn
A pointer to the EFI_SIMPLE_TEXT_INPUT_PROTOCOL interface that is associated with ConsoleInHandle.
Definition: UefiSpec.h:1973
#define ATTR_FCOL_WHITE
Definition: efi_console.c:45
#define ANSIESC_SGR
Select graphic rendition.
Definition: ansiesc.h:118
#define EFI_LEFT_CONTROL_PRESSED
The EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL is used on the ConsoleIn device.
#define SCAN_DELETE
Definition: SimpleTextIn.h:67
#define SCAN_F7
Definition: SimpleTextIn.h:76
struct console_driver efi_console
Definition: efi_fbcon.c:51
static struct utf8_accumulator efi_utf8_acc
EFI console UTF-8 accumulator.
Definition: efi_console.c:206
User interaction.
#define EFI_OPEN_PROTOCOL_GET_PROTOCOL
Definition: UefiSpec.h:1271
#define ATTR_FCOL_YELLOW
Definition: efi_console.c:44
#define SCAN_PAGE_DOWN
Definition: SimpleTextIn.h:69
unsigned int key_remap(unsigned int character)
Remap a key.
Definition: keymap.c:61
char * strerror(int errno)
Retrieve string representation of error number.
Definition: strerror.c:78
#define SCAN_F9
Definition: SimpleTextIn.h:78
#define EFI_SHIFT_STATE_VALID
EFI Boot Services Table.
Definition: UefiSpec.h:1836
EFI_HANDLE efi_image_handle
Image handle passed to entry point.
Definition: efi_init.c:33
static void efi_console_init(void)
Initialise EFI console.
Definition: efi_console.c:417
static void efi_handle_dectcem_set(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI DECTCEM set (show cursor)
Definition: efi_console.c:167
EFI_TEXT_CLEAR_SCREEN ClearScreen
unsigned char uint8_t
Definition: stdint.h:10
static void efi_handle_sgr(struct ansiesc_context *ctx __unused, unsigned int count, int params[])
Handle ANSI SGR (set graphics rendition)
Definition: efi_console.c:122
#define KEYMAP_CAPSLOCK_REDO
Undo and redo CapsLock key flags.
Definition: keymap.h:70
#define SCAN_UP
Definition: SimpleTextIn.h:60
struct init_fn efi_console_init_fn __init_fn(INIT_EARLY)
EFI console initialisation function.
#define SCAN_F11
EFI_GUID efi_simple_text_input_ex_protocol_guid
Simple text input extension protocol GUID.
Definition: efi_guid.c:248
EFI_TEXT_ENABLE_CURSOR EnableCursor
Console configuration.
#define TRUE
Definition: tlan.h:46
#define ATTR_BCOL_RED
Definition: efi_console.c:52
EFI API.
#define ATTR_BCOL_MASK
Definition: efi_console.c:47
#define ANSIESC_DECTCEM_RESET
Hide cursor.
Definition: ansiesc.h:131
#define __unused
Declare a variable or data structure as unused.
Definition: compiler.h:573
#define SCAN_INSERT
Definition: SimpleTextIn.h:66
#define ANSIESC_DECTCEM_SET
Show cursor.
Definition: ansiesc.h:128
A UTF-8 character accumulator.
Definition: utf8.h:57
FILE_LICENCE(GPL2_OR_LATER)
#define ATTR_FCOL_BLACK
Definition: efi_console.c:38
#define EFI_CAPS_LOCK_ACTIVE
static void efi_putchar(int character)
Print a character to EFI console.
Definition: efi_console.c:213
EFI_CHECK_EVENT CheckEvent
Definition: UefiSpec.h:1865
#define ATTR_FCOL_BLUE
Definition: efi_console.c:39
RETURN_STATUS EFI_STATUS
Function return status for EFI API.
Definition: UefiBaseType.h:35
#define ATTR_BCOL_WHITE
Definition: efi_console.c:55
uint16_t count
Number of entries.
Definition: ena.h:22
#define SCAN_END
Definition: SimpleTextIn.h:65
#define SCAN_RIGHT
Definition: SimpleTextIn.h:62
EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx
union @17 u
unsigned int utf8_accumulate(struct utf8_accumulator *utf8, uint8_t byte)
Accumulate Unicode character from UTF-8 byte sequence.
Definition: utf8.c:43
#define FALSE
Definition: tlan.h:45
static struct ansiesc_handler efi_ansiesc_handlers[]
EFI console ANSI escape sequence handlers.
Definition: efi_console.c:191
static struct ansiesc_context efi_ansiesc_ctx
EFI console ANSI escape sequence context.
Definition: efi_console.c:201
static int efi_iskey(void)
Check for character ready to read from EFI console.
Definition: efi_console.c:386
EFI_REQUEST_PROTOCOL(EFI_CONSOLE_CONTROL_PROTOCOL, &conctrl)
EFI_SYSTEM_TABLE * efi_systab
EFI_OPEN_PROTOCOL OpenProtocol
Definition: UefiSpec.h:1905
static const char * ansi_input
Pointer to current ANSI output sequence.
Definition: efi_console.c:245
A console driver.
Definition: console.h:55
unsigned int character
Character in progress.
Definition: utf8.h:59
#define ATTR_BCOL_CYAN
Definition: efi_console.c:51
#define DBG(...)
Print a debugging message.
Definition: compiler.h:498
EFI_CONSOLE_CONTROL_PROTOCOL_SET_MODE SetMode
#define ATTR_DEFAULT
Definition: efi_console.c:57
#define SCAN_PAGE_UP
Definition: SimpleTextIn.h:68
static void efi_handle_ed(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[] __unused)
Handle ANSI ED (erase in page)
Definition: efi_console.c:104
#define NULL
NULL pointer (VOID *)
Definition: Base.h:362
String functions.
static const char * ansi_sequences[]
Mapping from EFI scan codes to ANSI escape sequences.
Definition: efi_console.c:248
#define SCAN_F5
Definition: SimpleTextIn.h:74
#define ATTR_BCOL_BLACK
Definition: efi_console.c:48
union @382 key
Sense key.
Definition: scsi.h:18
#define ATTR_FCOL_RED
Definition: efi_console.c:42
static void efi_handle_cup(struct ansiesc_context *ctx __unused, unsigned int count __unused, int params[])
Handle ANSI CUP (cursor position)
Definition: efi_console.c:83
#define DBG2(...)
Definition: compiler.h:515
#define SCAN_F8
Definition: SimpleTextIn.h:77
void * memset(void *dest, int character, size_t len) __nonnull