vgabios: handle vmware vga in bochsvga.

The vmware vga emulated by qemu has a I/O region in pci bar 0.
The framebuffer is in pci bar 1.  Handle that by checking the
type of bar 0 in case it is a I/O bar use bar 1 instead.

Also make bochsbios report lfb size in debug output.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c
index 5770e10..e40a1fd 100644
--- a/vgasrc/bochsvga.c
+++ b/vgasrc/bochsvga.c
@@ -139,16 +139,25 @@
 
     u32 lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
     int bdf = GET_GLOBAL(VgaBDF);
-    if (CONFIG_VGA_PCI && bdf >= 0)
-        lfb_addr = (pci_config_readl(bdf, PCI_BASE_ADDRESS_0)
-                    & PCI_BASE_ADDRESS_MEM_MASK);
+    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) {
+            barid = 1;
+            bar = pci_config_readl(bdf, PCI_BASE_ADDRESS_1);
+        }
+        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);
+    }
 
     SET_VGA(VBE_framebuffer, lfb_addr);
     u16 totalmem = dispi_read(VBE_DISPI_INDEX_VIDEO_MEMORY_64K);
     SET_VGA(VBE_total_memory, totalmem * 64 * 1024);
     SET_VGA(VBE_capabilities, VBE_CAPABILITY_8BIT_DAC);
 
-    dprintf(1, "VBE DISPI detected. lfb_addr=%x\n", lfb_addr);
+    dprintf(1, "VBE DISPI: lfb_addr=%x, size %d MB\n",
+            lfb_addr, totalmem / 16);
 
     return 0;
 }