diff options
author | Blue Swirl <blauwirbel@gmail.com> | 2011-02-05 14:34:37 +0000 |
---|---|---|
committer | Blue Swirl <blauwirbel@gmail.com> | 2011-02-12 08:28:22 +0000 |
commit | 7ba7e49e6a7493e1cd0fe07cc67403846d642fc5 (patch) | |
tree | 56175042ccf012b1dd1caa71f95ad7ab49ee3d17 | |
parent | 7cc050b1659545d0c87108c17f0bf78561efcf9a (diff) |
x86,MIPS: make vmware_vga optional
Allow failure with vmware_vga device creation and use standard
VGA instead.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
-rw-r--r-- | hw/mips_malta.c | 6 | ||||
-rw-r--r-- | hw/pc.c | 11 | ||||
-rw-r--r-- | hw/vmware_vga.h | 11 |
3 files changed, 22 insertions, 6 deletions
diff --git a/hw/mips_malta.c b/hw/mips_malta.c index 2d3f242cc8..930c51c74d 100644 --- a/hw/mips_malta.c +++ b/hw/mips_malta.c @@ -957,7 +957,11 @@ void mips_malta_init (ram_addr_t ram_size, if (cirrus_vga_enabled) { pci_cirrus_vga_init(pci_bus); } else if (vmsvga_enabled) { - pci_vmsvga_init(pci_bus); + if (!pci_vmsvga_init(pci_bus)) { + fprintf(stderr, "Warning: vmware_vga not available," + " using standard VGA instead\n"); + pci_vga_init(pci_bus); + } } else if (std_vga_enabled) { pci_vga_init(pci_bus); } @@ -1053,10 +1053,15 @@ void pc_vga_init(PCIBus *pci_bus) isa_cirrus_vga_init(); } } else if (vmsvga_enabled) { - if (pci_bus) - pci_vmsvga_init(pci_bus); - else + if (pci_bus) { + if (!pci_vmsvga_init(pci_bus)) { + fprintf(stderr, "Warning: vmware_vga not available," + " using standard VGA instead\n"); + pci_vga_init(pci_bus); + } + } else { fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__); + } #ifdef CONFIG_SPICE } else if (qxl_enabled) { if (pci_bus) diff --git a/hw/vmware_vga.h b/hw/vmware_vga.h index e7bcb22146..5132573a56 100644 --- a/hw/vmware_vga.h +++ b/hw/vmware_vga.h @@ -4,9 +4,16 @@ #include "qemu-common.h" /* vmware_vga.c */ -static inline void pci_vmsvga_init(PCIBus *bus) +static inline bool pci_vmsvga_init(PCIBus *bus) { - pci_create_simple(bus, -1, "vmware-svga"); + PCIDevice *dev; + + dev = pci_try_create(bus, -1, "vmware-svga"); + if (!dev || qdev_init(&dev->qdev) < 0) { + return false; + } else { + return true; + } } #endif |