[coreboot] New patch to review for coreboot: 372d459 libpayload: Separate video initialization and the video console.

Stefan Reinauer (stefan.reinauer@coreboot.org) gerrit at coreboot.org
Wed Nov 7 00:22:05 CET 2012


Stefan Reinauer (stefan.reinauer at coreboot.org) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/1733

-gerrit

commit 372d4591a69043d454b7f892f8d837f1450aa5f9
Author: Gabe Black <gabeblack at google.com>
Date:   Fri Oct 5 23:35:04 2012 -0700

    libpayload: Separate video initialization and the video console.
    
    It's possible to want to display text on the display without using it as a
    console. This change separates the initialization of the video code from
    setting up the video console by pulling out everything but installing the
    console into a new function called video_init.
    
    Change-Id: Ie07654ca13f79489c0e9b3a4998b96f598ab8513
    Signed-off-by: Gabe Black <gabeblack at google.com>
---
 payloads/libpayload/drivers/video/video.c | 39 ++++++++++++++++++-------------
 payloads/libpayload/include/libpayload.h  |  1 +
 2 files changed, 24 insertions(+), 16 deletions(-)

diff --git a/payloads/libpayload/drivers/video/video.c b/payloads/libpayload/drivers/video/video.c
index 13606d5..d7fc8de 100644
--- a/payloads/libpayload/drivers/video/video.c
+++ b/payloads/libpayload/drivers/video/video.c
@@ -183,29 +183,36 @@ static struct console_output_driver cons = {
 	.putchar = video_console_putchar
 };
 
-int video_console_init(void)
+int video_init(void)
 {
-		int i;
-
-		for(i = 0; i < ARRAY_SIZE(console_list); i++) {
-			if (console_list[i]->init())
-				continue;
+	int i;
 
-			console = console_list[i];
+	for (i = 0; i < ARRAY_SIZE(console_list); i++) {
+		if (console_list[i]->init())
+			continue;
 
-			if (console->get_cursor)
-				console->get_cursor((unsigned int*)&cursorx, (unsigned int*)&cursory, &cursor_enabled);
+		console = console_list[i];
 
-			if (cursorx) {
-				cursorx = 0;
-				cursory++;
-			}
+		if (console->get_cursor)
+			console->get_cursor((unsigned int*)&cursorx,
+					    (unsigned int*)&cursory,
+					    &cursor_enabled);
 
-			video_console_fixup_cursor();
-			console_add_output_driver(&cons);
-			return 0;
+		if (cursorx) {
+			cursorx = 0;
+			cursory++;
 		}
 
+		video_console_fixup_cursor();
 		return 0;
+	}
+}
+
+int video_console_init(void)
+{
+	video_init();
+	if (console)
+		console_add_output_driver(&cons);
+	return 0;
 }
 
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h
index 3a91cbc..c7e17d8 100644
--- a/payloads/libpayload/include/libpayload.h
+++ b/payloads/libpayload/include/libpayload.h
@@ -192,6 +192,7 @@ void speaker_tone(u16 freq, unsigned int duration);
  * @ingroup input
  * @{
  */
+int video_init(void);
 int video_console_init(void);
 void video_console_putchar(unsigned int ch);
 void video_console_putc(u8 row, u8 col, unsigned int ch);




More information about the coreboot mailing list