[SeaBIOS] [PATCH 3/7] vga: add isa hardware detection

Gerd Hoffmann kraxel at redhat.com
Mon Feb 6 15:51:39 CET 2012


Try to find isa vga cards in case pci probe found nothing.

Signed-off-by: Gerd Hoffmann <kraxel at redhat.com>
---
 vgasrc/bochsvga.c |    8 ++++++++
 vgasrc/bochsvga.h |    1 +
 vgasrc/clext.c    |    6 ++++++
 vgasrc/clext.h    |    1 +
 vgasrc/vgahw.c    |   19 +++++++++++++++++++
 5 files changed, 35 insertions(+), 0 deletions(-)

diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index e6ab794..e92186a 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -302,3 +302,11 @@ bochsvga_init(void)
 
     return 0;
 }
+
+int
+bochsvga_isa_probe(void)
+{
+    dispi_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID0);
+    return dispi_read(VBE_DISPI_INDEX_ID) == VBE_DISPI_ID0;
+}
+
diff --git a/vgasrc/bochsvga.h b/vgasrc/bochsvga.h
index 57b2b69..3f72bf0 100644
--- a/vgasrc/bochsvga.h
+++ b/vgasrc/bochsvga.h
@@ -62,5 +62,6 @@ int bochsvga_get_displaystart(struct vgamode_s *vmode_g);
 int bochsvga_set_displaystart(struct vgamode_s *vmode_g, int val);
 int bochsvga_set_mode(struct vgamode_s *vmode_g, int flags);
 int bochsvga_init(void);
+int bochsvga_isa_probe(void);
 
 #endif // bochsvga.h
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index 26b34e0..2e32e61 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -610,3 +610,9 @@ clext_init(void)
 
     return 0;
 }
+
+int
+clext_isa_probe(void)
+{
+    return cirrus_check();
+}
diff --git a/vgasrc/clext.h b/vgasrc/clext.h
index 3d83507..e6aa3f9 100644
--- a/vgasrc/clext.h
+++ b/vgasrc/clext.h
@@ -15,5 +15,6 @@ int clext_set_mode(struct vgamode_s *vmode_g, int flags);
 struct bregs;
 void clext_1012(struct bregs *regs);
 int clext_init(void);
+int clext_isa_probe(void);
 
 #endif // clext.h
diff --git a/vgasrc/vgahw.c b/vgasrc/vgahw.c
index 77b8e77..1401fba 100644
--- a/vgasrc/vgahw.c
+++ b/vgasrc/vgahw.c
@@ -96,6 +96,25 @@ int vgahw_init(void)
         }
     }
 
+    if (GET_GLOBAL(vga_type) == VGA_TYPE_UNDEFINED) {
+        if (CONFIG_VGA_CIRRUS) {
+            if (clext_isa_probe()) {
+                SET_VGA(vga_type, VGA_TYPE_CIRRUS);
+                dprintf(1, "vgahw: detected Cirrus VGA [isa]\n");
+            }
+        } else if (CONFIG_VGA_BOCHS) {
+            if (bochsvga_isa_probe()) {
+                SET_VGA(vga_type, VGA_TYPE_BOCHS);
+                dprintf(1, "vgahw: detected bochs svga [isa]\n");
+            }
+        }
+    }
+
+    if (GET_GLOBAL(vga_type) == VGA_TYPE_UNDEFINED) {
+        SET_VGA(vga_type, VGA_TYPE_STDVGA);
+        dprintf(1, "vgahw: no hw found, using stdvga\n");
+    }
+
     if (HAVE_VGA_CIRRUS)
         return clext_init();
     if (HAVE_VGA_BOCHS)
-- 
1.7.1




More information about the SeaBIOS mailing list