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 --- vgasrc/bochsvga.c | 18 +++++++++++++----- 1 files changed, 13 insertions(+), 5 deletions(-)
diff --git a/vgasrc/bochsvga.c b/vgasrc/bochsvga.c index 82629b9..274c93b 100644 --- a/vgasrc/bochsvga.c +++ b/vgasrc/bochsvga.c @@ -124,10 +124,17 @@ bochsvga_init(void) dispi_write(VBE_DISPI_INDEX_ID, VBE_DISPI_ID5);
u32 lfb_addr; - if (CONFIG_VGA_PCI) - lfb_addr = (pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0) - & PCI_BASE_ADDRESS_MEM_MASK); - else + if (CONFIG_VGA_PCI) { + u32 bar = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_0); + if ((bar & PCI_BASE_ADDRESS_SPACE) == PCI_BASE_ADDRESS_SPACE_MEMORY) { + lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK; + dprintf(1, "VBE DISPI: bdf %x, bar 0\n", GET_GLOBAL(VgaBDF)); + } else { + bar = pci_config_readl(GET_GLOBAL(VgaBDF), PCI_BASE_ADDRESS_1); + lfb_addr = bar & PCI_BASE_ADDRESS_MEM_MASK; + dprintf(1, "VBE DISPI: bdf %x, bar 1\n", GET_GLOBAL(VgaBDF)); + } + } else lfb_addr = VBE_DISPI_LFB_PHYSICAL_ADDRESS;
SET_VGA(VBE_framebuffer, lfb_addr); @@ -135,7 +142,8 @@ bochsvga_init(void) 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; }