summaryrefslogtreecommitdiff
path: root/vgasrc
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2013-12-12 14:55:14 +0100
committerGerd Hoffmann <kraxel@redhat.com>2014-03-06 10:53:14 +0100
commit5d598779b0d9b07e21b529e8495d2229245bfd5f (patch)
treee75fa32dcea3b40582f4f98bb2222ffac8301f3d /vgasrc
parente8436b5bade4887cd4edb2ca39e6b9014a410154 (diff)
downloadqemu-seabios-5d598779b0d9b07e21b529e8495d2229245bfd5f.tar.gz
vga: rework bar detection, add virtio-vga
Replace the heuristic which checks the bar 0 attributes to figure whenever bar 0 or bar 1 has the linear framebuffer with a vendor id check. Add support for virtio-vga which uses bar 2 for the linear framebuffer. Cc: Dave Airlie <airlied@redhat.com> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'vgasrc')
-rw-r--r--vgasrc/bochsvga.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index eae20ae..5313f54 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -386,12 +386,20 @@ bochsvga_setup(void)
u32 lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
int bdf = GET_GLOBAL(VgaBDF);
if (CONFIG_VGA_PCI && bdf >= 0) {
- int barid = 0;
- u32 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0);
- if ((bar & PCI_BASE_ADDRESS_SPACE) != PCI_BASE_ADDRESS_SPACE_MEMORY) {
+ u16 vendor = pci_config_readw(bdf, PCI_VENDOR_ID);
+ int barid;
+ switch (vendor) {
+ case 0x15ad: /* qemu vmware vga */
barid = 1;
- bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_1);
+ break;
+ case 0x1af4: /* virtio-vga */
+ barid = 2;
+ break;
+ default: /* stdvga, qxl */
+ barid = 0;
+ break;
}
+ u32 bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_0 + barid * 4);
lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK;
dprintf(1, "VBE DISPI: bdf %02x:%02x.%x, bar %d\n", pci_bdf_to_bus(bdf)
, pci_bdf_to_dev(bdf), pci_bdf_to_fn(bdf), barid);