55 * Copyright (c) 2016 Alexander Graf
66 */
77
8+ #define LOG_CATEGORY LOGC_EFI
9+
810#include <common.h>
911#include <charset.h>
1012#include <malloc.h>
1113#include <time.h>
1214#include <dm/device.h>
1315#include <efi_loader.h>
1416#include <env.h>
17+ #include <log.h>
1518#include <stdio_dev.h>
1619#include <video_console.h>
1720#include <linux/delay.h>
@@ -58,7 +61,12 @@ const efi_guid_t efi_guid_text_output_protocol =
5861#define cESC '\x1b'
5962#define ESC "\x1b"
6063
61- /* Default to mode 0 */
64+ /*
65+ * efi_con_mode - mode information of the Simple Text Output Protocol
66+ *
67+ * Use safe settings before efi_setup_console_size() is called.
68+ * By default enable only the 80x25 mode which must always exist.
69+ */
6270static struct simple_text_output_mode efi_con_mode = {
6371 .max_mode = 1 ,
6472 .mode = 0 ,
@@ -333,13 +341,13 @@ static int __maybe_unused query_vidconsole(int *rows, int *cols)
333341}
334342
335343/**
336- * query_console_size () - update the mode table.
344+ * efi_setup_console_size () - update the mode table.
337345 *
338346 * By default the only mode available is 80x25. If the console has at least 50
339347 * lines, enable mode 80x50. If we can query the console size and it is neither
340348 * 80x25 nor 80x50, set it as an additional mode.
341349 */
342- static void query_console_size (void )
350+ void efi_setup_console_size (void )
343351{
344352 int rows = 25 , cols = 80 ;
345353 int ret = - ENODEV ;
@@ -351,6 +359,8 @@ static void query_console_size(void)
351359 if (ret )
352360 return ;
353361
362+ log_debug ("Console size %dx%d\n" , rows , cols );
363+
354364 /* Test if we can have Mode 1 */
355365 if (cols >= 80 && rows >= 50 ) {
356366 efi_cout_modes [1 ].present = 1 ;
@@ -371,7 +381,6 @@ static void query_console_size(void)
371381 }
372382}
373383
374-
375384/**
376385 * efi_cout_query_mode() - get terminal size for a text mode
377386 *
@@ -1262,9 +1271,6 @@ efi_status_t efi_console_register(void)
12621271 efi_status_t r ;
12631272 struct efi_device_path * dp ;
12641273
1265- /* Set up mode information */
1266- query_console_size ();
1267-
12681274 /* Install protocols on root node */
12691275 r = EFI_CALL (efi_install_multiple_protocol_interfaces
12701276 (& efi_root ,
0 commit comments