[SeaBIOS] [RFC PATCH 3/4] vga: add isa hardware detection
Gerd Hoffmann
kraxel at redhat.com
Tue Jan 24 15:46:07 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 | 7 +++++++
vgasrc/bochsvga.h | 1 +
vgasrc/clext.c | 6 ++++++
vgasrc/clext.h | 1 +
vgasrc/vgahw.c | 20 +++++++++++++++++++-
5 files changed, 34 insertions(+), 1 deletions(-)
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 82629b9..107bb70 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -140,6 +140,13 @@ 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;
+}
+
static int mode_valid(struct vgamode_s *vmode_g)
{
u16 max_xres = dispi_get_max_xres();
diff --git a/vgasrc/bochsvga.h b/vgasrc/bochsvga.h
index 81fb8f7..cf358b4 100644
--- a/vgasrc/bochsvga.h
+++ b/vgasrc/bochsvga.h
@@ -53,6 +53,7 @@ static inline void dispi_write(u16 reg, u16 val)
}
int bochsvga_init(void);
+int bochsvga_isa_probe(void);
void bochsvga_list_modes(u16 seg, u16 *dest, u16 *last);
struct vgamode_s *bochsvga_find_mode(int mode);
int bochsvga_set_mode(int mode, int flags);
diff --git a/vgasrc/clext.c b/vgasrc/clext.c
index f08294a..e74e8c5 100644
--- a/vgasrc/clext.c
+++ b/vgasrc/clext.c
@@ -755,3 +755,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 a14cf13..3b03298 100644
--- a/vgasrc/clext.h
+++ b/vgasrc/clext.h
@@ -7,6 +7,7 @@ struct vgamode_s *clext_find_mode(int mode);
int clext_set_mode(int mode, int flags);
void clext_list_modes(u16 seg, u16 *dest, u16 *last);
int clext_init(void);
+int clext_isa_probe(void);
struct bregs;
void clext_1012(struct bregs *regs);
diff --git a/vgasrc/vgahw.c b/vgasrc/vgahw.c
index 7620d59..31d53bb 100644
--- a/vgasrc/vgahw.c
+++ b/vgasrc/vgahw.c
@@ -89,7 +89,25 @@ int vgahw_init(void) {
break;
}
}
- } else {
+ }
+
+ 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)
--
1.7.1
More information about the SeaBIOS
mailing list