[coreboot] SeaVGABIOS with native vga init (Need testers)

Kevin O'Connor kevin at koconnor.net
Mon Feb 17 08:54:06 CET 2014


On Wed, Feb 12, 2014 at 07:23:14PM -0500, Kevin O'Connor wrote:
> On Wed, Feb 12, 2014 at 10:35:08PM +0100, Paul Menzel wrote:
> > Am Mittwoch, den 12.02.2014, 12:58 -0500 schrieb Kevin O'Connor:
> > > I've run some basic tests on this version of SeaVGABIOS on my
> > > hardware.  However, I don't have one of the boards where coreboot
> > > supports native vga init.  It would be great if someone with the
> > > hardware (looks like stout, x60, and maybe others) could run tests.
> > 
> > Thanks to Luc, the VIA K8x890 based boards like Asus M2V-MX SE have had
> > native graphics init for a long time.
> > 
> >         commit aeb6c9870f0b1af8c0b55b2034f881da6757c4a4
> >         Author: Luc Verhaegen <libv at skynet.be>
> >         Date:   Thu Jul 23 16:04:58 2009 +0000
> >         
> >             sb/via/k8t890: add vga textmode code for k8m890 chrome igp.
> >             
> >             Add initialisation for the VIA Chrome 9 IGP on the k8m890 through native code
> >             and through the general vga infrastructure i committed a month or two ago.
> >             Add videoram_size option for k8m890 and the Asus M2V-MX SE.
> > 
> > Looking through the output of
> > 
> > 	$ git grep k8t890 src/mainboard/
> > 
> > the boards Asus A8V-E Deluxe, Asus A8V-E SE, Asus K8V-X, Asus M2V-MX SE
> > and Asus M2V should theoretically support that.
> 
> Okay.  The SeaVGABIOS implementation is expecting a coreboot table
> (LB_TAG_FRAMEBUFFER).  So, as long as that is present it should work.

FYI, I updated the test vgabios code to also support "EGA style" text
buffers.  If the LB_TAG_FRAMEBUFFER table isn't found, then SeaVGABIOS
will assume there is an EGA style text buffer.

If anyone wants to give one of the above boards a try, the updated
code is at:

https://github.com/KevinOConnor/seabios/tree/testing

Please see my previous email in this thread for directions on how to
compile and use this branch.

-Kevin


Subject: [PATCH] vgabios: Add support for native coreboot EGA style text
 consoles.
To: seabios at seabios.org

If a CB_TAG_FRAMEBUFFER coreboot table isn't found, assume there is a
standard text mode console mapped at 0xB8000.

Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 vgasrc/Kconfig |  3 ++-
 vgasrc/cbvga.c | 50 ++++++++++++++++++++++++++++++++++----------------
 2 files changed, 36 insertions(+), 17 deletions(-)

diff --git a/vgasrc/Kconfig b/vgasrc/Kconfig
index 20ac2ce..00c5000 100644
--- a/vgasrc/Kconfig
+++ b/vgasrc/Kconfig
@@ -55,6 +55,7 @@ menu "VGA ROM"
         config VGA_COREBOOT
             depends on COREBOOT
             bool "coreboot linear framebuffer"
+            select VGA_STDVGA_FRAMEBUFFER
             select VGA_HIGH_FRAMEBUFFER
             help
                 Build support for a vgabios wrapper around video
@@ -116,7 +117,7 @@ menu "VGA ROM"
             Support VBE.
 
     config VGA_PCI
-        depends on BUILD_VGABIOS
+        depends on BUILD_VGABIOS && !VGA_COREBOOT
         bool "PCI ROM Headers"
         default y
         help
diff --git a/vgasrc/cbvga.c b/vgasrc/cbvga.c
index d3dc2a4..305c798 100644
--- a/vgasrc/cbvga.c
+++ b/vgasrc/cbvga.c
@@ -7,19 +7,19 @@
 #include "biosvar.h" // GET_BDA
 #include "cbvga.h" // cbvga_setup
 #include "output.h" // dprintf
+#include "stdvga.h" // SEG_CTEXT
+#include "string.h" // memset16_far
 #include "util.h" // find_cb_table
 #include "vgabios.h" // VGAREG_*
 
-#define CBMODENUM 0x140
-static struct vgamode_s CBmode VAR16 = {
-    MM_DIRECT, 0, 0, 0, 8, 16, 0
-};
+static int CBmode VAR16;
+static struct vgamode_s CBmodeinfo VAR16;
 static u32 CBlinelength VAR16;
 
 struct vgamode_s *cbvga_find_mode(int mode)
 {
-    if (mode == CBMODENUM)
-        return &CBmode;
+    if (mode == GET_GLOBAL(CBmode))
+        return &CBmodeinfo;
     return NULL;
 }
 
@@ -27,7 +27,7 @@ void
 cbvga_list_modes(u16 seg, u16 *dest, u16 *last)
 {
     if (dest<last) {
-        SET_FARVAR(seg, *dest, CBMODENUM);
+        SET_FARVAR(seg, *dest, GET_GLOBAL(CBmode));
         dest++;
     }
     SET_FARVAR(seg, *dest, 0xffff);
@@ -93,7 +93,11 @@ int
 cbvga_set_mode(struct vgamode_s *vmode_g, int flags)
 {
     if (!(flags & MF_NOCLEARMEM)) {
-        int i, lines = GET_GLOBAL(CBmode.height);
+        if (GET_GLOBAL(CBmodeinfo.memmodel) == MM_TEXT) {
+            memset16_far(SEG_CTEXT, (void*)0, 0x0720, 80*25*2);
+            return 0;
+        }
+        int i, lines = GET_GLOBAL(CBmodeinfo.height);
         u32 stride = GET_GLOBAL(CBlinelength);
         void *dest = (void*)GET_GLOBAL(VBE_framebuffer);
         for (i=0; i<lines; i++, dest+=stride)
@@ -137,8 +141,18 @@ cbvga_setup(void)
     }
     struct cb_framebuffer *cbfb = find_cb_subtable(cbh, CB_TAG_FRAMEBUFFER);
     if (!cbfb) {
-        dprintf(1, "Unable to find coreboot framebuffer table\n");
-        return -1;
+        // Assume there is an EGA text framebuffer.
+        dprintf(1, "Did not find coreboot framebuffer - assuming EGA text\n");
+        SET_VGA(CBmode, 0x03);
+        SET_VGA(CBlinelength, 80*2);
+        SET_VGA(CBmodeinfo.memmodel, MM_TEXT);
+        SET_VGA(CBmodeinfo.width, 80);
+        SET_VGA(CBmodeinfo.height, 25);
+        SET_VGA(CBmodeinfo.depth, 4);
+        SET_VGA(CBmodeinfo.cwidth, 9);
+        SET_VGA(CBmodeinfo.cheight, 16);
+        SET_VGA(CBmodeinfo.sstart, SEG_CTEXT);
+        return 0;
     }
 
     u64 addr = GET_FARVAR(0, cbfb->physical_address);
@@ -155,15 +169,19 @@ cbvga_setup(void)
         return -1;
     }
 
+    SET_VGA(CBmode, 0x140);
     SET_VGA(VBE_framebuffer, addr);
     SET_VGA(VBE_total_memory, linelength * ylines);
     SET_VGA(CBlinelength, linelength);
-    SET_VGA(CBmode.width, xlines);
-    SET_VGA(CBmode.height, ylines);
-    SET_VGA(CBmode.depth, bpp);
-
-    // Setup BDA
-    vga_set_mode(CBMODENUM, MF_NOCLEARMEM);
+    SET_VGA(CBmodeinfo.memmodel, MM_DIRECT);
+    SET_VGA(CBmodeinfo.width, xlines);
+    SET_VGA(CBmodeinfo.height, ylines);
+    SET_VGA(CBmodeinfo.depth, bpp);
+    SET_VGA(CBmodeinfo.cwidth, 8);
+    SET_VGA(CBmodeinfo.cheight, 16);
+
+    // Setup BDA and clear screen.
+    vga_set_mode(GET_GLOBAL(CBmode), MF_NOCLEARMEM);
 
     return 0;
 }
-- 
1.8.5.3




More information about the coreboot mailing list