summaryrefslogtreecommitdiff
path: root/vgaio.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2011-06-03 17:12:52 -0500
committerRichard Henderson <rth@twiddle.net>2011-06-03 17:12:52 -0500
commit7abb12f60eb3069019e9497e193733d77d8f0722 (patch)
tree23eb9e1e2a2df99e8f0a8475cac48499d212cbca /vgaio.c
parentdb3b5b6935eed9a229bf5c11b4db0b7d2a812940 (diff)
downloadqemu-palcode-7abb12f60eb3069019e9497e193733d77d8f0722.zip
qemu-palcode-7abb12f60eb3069019e9497e193733d77d8f0722.tar.gz
qemu-palcode-7abb12f60eb3069019e9497e193733d77d8f0722.tar.bz2
Properly detect the presence of a vga device.
Diffstat (limited to 'vgaio.c')
-rw-r--r--vgaio.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/vgaio.c b/vgaio.c
index c6a488c..2dd7eb7 100644
--- a/vgaio.c
+++ b/vgaio.c
@@ -7,6 +7,9 @@
#include "protos.h"
#include "ioport.h"
+#include "pci.h"
+#include "pci_regs.h"
+#include "pci_ids.h"
#include "vgatables.h"
#define GET_FARVAR(seg, ofs) (ofs)
@@ -554,7 +557,21 @@ vgahw_enable_video_addressing(u8 disable)
void
vgahw_init(void)
{
- struct vgamode_s *vmode_g = find_vga_entry(3);
+ struct vgamode_s *vmode_g;
+ int bdf, max;
+
+ foreachpci(bdf, max)
+ {
+ uint16_t class = pci_config_readw(bdf, PCI_CLASS_DEVICE);
+ if (class == PCI_CLASS_DISPLAY_VGA)
+ goto found;
+ }
+ return;
+
+ found:
+ have_vga = 1;
+
+ vmode_g = find_vga_entry(3);
vgahw_sequ_write(0, 1); // Assert sync reset