]> Git Repo - u-boot.git/blobdiff - lib/efi_loader/efi_console.c
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
[u-boot.git] / lib / efi_loader / efi_console.c
index 6d4784e1408c62197c9eac6dc673b1737b62fa51..03dece51aeaa8ed7d45a2d3408690b6701a0d077 100644 (file)
@@ -8,7 +8,6 @@
 #define LOG_CATEGORY LOGC_EFI
 
 #include <ansi.h>
-#include <common.h>
 #include <charset.h>
 #include <malloc.h>
 #include <time.h>
@@ -77,6 +76,14 @@ static struct simple_text_output_mode efi_con_mode = {
        .cursor_visible = 1,
 };
 
+/**
+ * term_get_char() - read a character from the console
+ *
+ * Wait for up to 100 ms to read a character from the console.
+ *
+ * @c:         pointer to the buffer to receive the character
+ * Return:     0 on success, 1 otherwise
+ */
 static int term_get_char(s32 *c)
 {
        u64 timeout;
@@ -353,7 +360,7 @@ void efi_setup_console_size(void)
        int rows = 25, cols = 80;
        int ret = -ENODEV;
 
-       if (IS_ENABLED(CONFIG_DM_VIDEO))
+       if (IS_ENABLED(CONFIG_VIDEO))
                ret = query_vidconsole(&rows, &cols);
        if (ret)
                ret = query_console_serial(&rows, &cols);
@@ -461,10 +468,21 @@ static efi_status_t EFIAPI efi_cout_set_attribute(
 }
 
 /**
- * efi_cout_clear_screen() - clear screen
+ * efi_clear_screen() - clear screen
  */
 static void efi_clear_screen(void)
 {
+       if (CONFIG_IS_ENABLED(EFI_SCROLL_ON_CLEAR_SCREEN)) {
+               unsigned int row, screen_rows, screen_columns;
+
+               /* Avoid overwriting previous outputs on streaming consoles */
+               screen_rows = efi_cout_modes[efi_con_mode.mode].rows;
+               screen_columns = efi_cout_modes[efi_con_mode.mode].columns;
+               printf(ESC "[%u;%uH", screen_rows, screen_columns);
+               for (row = 1; row < screen_rows; row++)
+                       printf("\n");
+       }
+
        /*
         * The Linux console wants both a clear and a home command. The video
         * uclass does not support <ESC>[H without coordinates, yet.
@@ -489,6 +507,12 @@ static efi_status_t EFIAPI efi_cout_clear_screen(
 {
        EFI_ENTRY("%p", this);
 
+       /* Set default colors if not done yet */
+       if (efi_con_mode.attribute == 0) {
+               efi_con_mode.attribute = 0x07;
+               printf(ESC "[0;37;40m");
+       }
+
        efi_clear_screen();
 
        return EFI_EXIT(EFI_SUCCESS);
@@ -652,7 +676,7 @@ static LIST_HEAD(cin_notify_functions);
  * @mod:       Xterm shift mask
  * @key_state:  receives the state of the shift, alt, control, and logo keys
  */
-void set_shift_mask(int mod, struct efi_key_state *key_state)
+static void set_shift_mask(int mod, struct efi_key_state *key_state)
 {
        key_state->key_shift_state = EFI_SHIFT_STATE_VALID;
        if (mod) {
@@ -1359,9 +1383,7 @@ efi_status_t efi_console_get_u16_string(struct efi_simple_text_input_protocol *c
               ANSI_CLEAR_LINE_TO_END
               ANSI_CURSOR_SHOW, row, col);
 
-       ret = EFI_CALL(cin->reset(cin, false));
-       if (ret != EFI_SUCCESS)
-               return ret;
+       efi_cin_empty_buffer();
 
        for (;;) {
                do {
This page took 0.030915 seconds and 4 git commands to generate.