|
@@ -24,8 +24,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
24
|
24
|
#include <errno.h>
|
25
|
25
|
#include <assert.h>
|
26
|
26
|
#include <ipxe/efi/efi.h>
|
|
27
|
+#include <ipxe/efi/Protocol/ConsoleControl/ConsoleControl.h>
|
27
|
28
|
#include <ipxe/ansiesc.h>
|
28
|
29
|
#include <ipxe/console.h>
|
|
30
|
+#include <ipxe/init.h>
|
29
|
31
|
#include <config/console.h>
|
30
|
32
|
|
31
|
33
|
#define ATTR_BOLD 0x08
|
|
@@ -61,6 +63,10 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
61
|
63
|
/** Current character attribute */
|
62
|
64
|
static unsigned int efi_attr = ATTR_DEFAULT;
|
63
|
65
|
|
|
66
|
+/** Console control protocol */
|
|
67
|
+static EFI_CONSOLE_CONTROL_PROTOCOL *conctrl;
|
|
68
|
+EFI_REQUEST_PROTOCOL ( EFI_CONSOLE_CONTROL_PROTOCOL, &conctrl );
|
|
69
|
+
|
64
|
70
|
/**
|
65
|
71
|
* Handle ANSI CUP (cursor position)
|
66
|
72
|
*
|
|
@@ -286,9 +292,37 @@ static int efi_iskey ( void ) {
|
286
|
292
|
return 0;
|
287
|
293
|
}
|
288
|
294
|
|
|
295
|
+/** EFI console driver */
|
289
|
296
|
struct console_driver efi_console __console_driver = {
|
290
|
297
|
.putchar = efi_putchar,
|
291
|
298
|
.getchar = efi_getchar,
|
292
|
299
|
.iskey = efi_iskey,
|
293
|
300
|
.usage = CONSOLE_EFI,
|
294
|
301
|
};
|
|
302
|
+
|
|
303
|
+/**
|
|
304
|
+ * Initialise EFI console
|
|
305
|
+ *
|
|
306
|
+ */
|
|
307
|
+static void efi_console_init ( void ) {
|
|
308
|
+ EFI_CONSOLE_CONTROL_SCREEN_MODE mode;
|
|
309
|
+
|
|
310
|
+ /* On some older EFI 1.10 implementations, we must use the
|
|
311
|
+ * (now obsolete) EFI_CONSOLE_CONTROL_PROTOCOL to switch the
|
|
312
|
+ * console into text mode.
|
|
313
|
+ */
|
|
314
|
+ if ( conctrl ) {
|
|
315
|
+ conctrl->GetMode ( conctrl, &mode, NULL, NULL );
|
|
316
|
+ if ( mode != EfiConsoleControlScreenText ) {
|
|
317
|
+ conctrl->SetMode ( conctrl,
|
|
318
|
+ EfiConsoleControlScreenText );
|
|
319
|
+ }
|
|
320
|
+ }
|
|
321
|
+}
|
|
322
|
+
|
|
323
|
+/**
|
|
324
|
+ * EFI console initialisation function
|
|
325
|
+ */
|
|
326
|
+struct init_fn efi_console_init_fn __init_fn ( INIT_EARLY ) = {
|
|
327
|
+ .initialise = efi_console_init,
|
|
328
|
+};
|