[syslinux:firmware] ansi: Improve EFI console support

syslinux-bot for Chandramouli Narayanan chandramouli.narayanan at intel.com
Fri Nov 9 09:06:18 PST 2012


Commit-ID:  937f816addb214ca4c8c1ce977e0357eafa8c617
Gitweb:     http://www.syslinux.org/commit/937f816addb214ca4c8c1ce977e0357eafa8c617
Author:     Chandramouli Narayanan <chandramouli.narayanan at intel.com>
AuthorDate: Fri, 16 Mar 2012 18:53:51 +0000
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 28 Mar 2012 14:38:42 +0100

ansi: Improve EFI console support

This commit fixes a number of bugs when displaying text on the console
under EFI, such as not clearing the screen when we've reached the last
row, and writing one character on each line.

Signed-off-by: Chandramouli Narayanan <chandramouli.narayanan at intel.com>
Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/lib/sys/ansi.c          |    8 ++++++++
 com32/lib/sys/ansicon_write.c |    6 +++++-
 efi/main.c                    |    5 ++++-
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/com32/lib/sys/ansi.c b/com32/lib/sys/ansi.c
index f73c03e..db47ea4 100644
--- a/com32/lib/sys/ansi.c
+++ b/com32/lib/sys/ansi.c
@@ -438,6 +438,14 @@ void __ansi_putchar(const struct term_info *ti, uint8_t ch)
 	op->scroll_up(st);
     }
 
+    /*
+     * Testing on EFI shows that from (rows-1)th line newline does not
+     * advance anymore.  All further output is always on the same
+     * (rows-1)th line.  Resetting the row to 0 does work.
+     */
+    if (xy.y == rows-1)
+	xy.y = 0;
+
     /* Update cursor position */
     op->set_cursor(xy.x, xy.y, st->cursor);
     st->xy = xy;
diff --git a/com32/lib/sys/ansicon_write.c b/com32/lib/sys/ansicon_write.c
index 7358015..a963923 100644
--- a/com32/lib/sys/ansicon_write.c
+++ b/com32/lib/sys/ansicon_write.c
@@ -273,7 +273,11 @@ static void ansicon_scroll_up(const struct term_state *st)
 {
     uint8_t rows, cols, attribute;
 
-    cols = ti.cols = 1;
+    /*
+     * Earlier code set ti.cols to 1 causing console output one char
+     * per line.
+     */
+    cols = 1;
     rows = ti.rows - 1;
     attribute = ansicon_attribute(st);
 
diff --git a/efi/main.c b/efi/main.c
index 5467415..ca09891 100644
--- a/efi/main.c
+++ b/efi/main.c
@@ -110,7 +110,10 @@ static UINTN cursor_x, cursor_y;
 static void efi_erase(const struct term_state *st,
 		       int x0, int y0, int x1, int y1)
 {
+	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
 	cursor_x = cursor_y = 0;
+	/* Really clear the screen */
+	uefi_call_wrapper(out->ClearScreen, 1, out);
 }
 
 static void efi_write_char(uint8_t ch, uint8_t attribute)
@@ -146,7 +149,7 @@ static void efi_scroll_up(uint8_t cols, uint8_t rows, uint8_t attribute)
 }
 
 
-static void efi_get_mode(int *rows, int *cols)
+static void efi_get_mode(int *cols, int *rows)
 {
 	SIMPLE_TEXT_OUTPUT_INTERFACE *out = ST->ConOut;
 	UINTN c, r;


More information about the Syslinux-commits mailing list