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

Gerd Hoffmann kraxel at redhat.com
Wed Feb 8 17:38:59 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    |   11 +++++++++++
 5 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 2a8aeb1..f44588f 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -391,3 +391,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 1c98203..f946e9f 100644
--- a/vgasrc/bochsvga.h
+++ b/vgasrc/bochsvga.h
@@ -67,5 +67,6 @@ int bochsvga_save_state(u16 seg, void *data, int states);
 int bochsvga_restore_state(u16 seg, void *data, int states);
 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 7d1a604..ad6f471 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -637,3 +637,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 78dba01..185e1d5 100644
--- a/vgasrc/clext.h
+++ b/vgasrc/clext.h
@@ -18,5 +18,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 03d8757..a91a47c 100644
--- a/vgasrc/vgahw.c
+++ b/vgasrc/vgahw.c
@@ -78,9 +78,20 @@ int vgahw_init(void)
         }
 
         if (GET_GLOBAL(qemu_vga_type) == VGA_TYPE_UNDEFINED) {
+            if (clext_isa_probe()) {
+                SET_VGA(qemu_vga_type, VGA_TYPE_CIRRUS);
+                dprintf(1, "vgahw: detected qemu cirrus vga [isa]\n");
+            } else if (bochsvga_isa_probe()) {
+                SET_VGA(qemu_vga_type, VGA_TYPE_BOCHS);
+                dprintf(1, "vgahw: detected qemu bochs vga [isa]\n");
+            }
+        }
+
+        if (GET_GLOBAL(qemu_vga_type) == VGA_TYPE_UNDEFINED) {
             SET_VGA(qemu_vga_type, VGA_TYPE_STDVGA);
             dprintf(1, "vgahw: no known hardware 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