aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--hw/cirrus_vga.c8
-rw-r--r--hw/pc.c26
-rw-r--r--hw/pc.h14
-rw-r--r--hw/pc_piix.c6
-rw-r--r--hw/vga-pci.c5
-rw-r--r--hw/vmware_vga.h6
6 files changed, 38 insertions, 27 deletions
diff --git a/hw/cirrus_vga.c b/hw/cirrus_vga.c
index 1b216e8813..1388a203eb 100644
--- a/hw/cirrus_vga.c
+++ b/hw/cirrus_vga.c
@@ -2899,7 +2899,7 @@ static void cirrus_init_common(CirrusVGAState * s, int device_id, int is_pci,
*
***************************************/
-void isa_cirrus_vga_init(MemoryRegion *system_memory)
+DeviceState *isa_cirrus_vga_init(MemoryRegion *system_memory)
{
CirrusVGAState *s;
@@ -2913,6 +2913,8 @@ void isa_cirrus_vga_init(MemoryRegion *system_memory)
vmstate_register(NULL, 0, &vmstate_cirrus_vga, s);
rom_add_vga(VGABIOS_CIRRUS_FILENAME);
/* XXX ISA-LFB support */
+ /* FIXME not qdev yet */
+ return NULL;
}
/***************************************
@@ -2955,9 +2957,9 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
return 0;
}
-void pci_cirrus_vga_init(PCIBus *bus)
+DeviceState *pci_cirrus_vga_init(PCIBus *bus)
{
- pci_create_simple(bus, -1, "cirrus-vga");
+ return &pci_create_simple(bus, -1, "cirrus-vga")->qdev;
}
static PCIDeviceInfo cirrus_vga_info = {
diff --git a/hw/pc.c b/hw/pc.c
index b6dcba2067..03466ec8d1 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -1069,38 +1069,44 @@ qemu_irq *pc_allocate_cpu_irq(void)
return qemu_allocate_irqs(pic_irq_request, NULL, 1);
}
-void pc_vga_init(PCIBus *pci_bus)
+DeviceState *pc_vga_init(PCIBus *pci_bus)
{
+ DeviceState *dev = NULL;
+
if (cirrus_vga_enabled) {
if (pci_bus) {
- pci_cirrus_vga_init(pci_bus);
+ dev = pci_cirrus_vga_init(pci_bus);
} else {
- isa_cirrus_vga_init(get_system_memory());
+ dev = isa_cirrus_vga_init(get_system_memory());
}
} else if (vmsvga_enabled) {
if (pci_bus) {
- if (!pci_vmsvga_init(pci_bus)) {
+ dev = pci_vmsvga_init(pci_bus);
+ if (!dev) {
fprintf(stderr, "Warning: vmware_vga not available,"
" using standard VGA instead\n");
- pci_vga_init(pci_bus);
+ dev = 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)
- pci_create_simple(pci_bus, -1, "qxl-vga");
- else
+ if (pci_bus) {
+ dev = &pci_create_simple(pci_bus, -1, "qxl-vga")->qdev;
+ } else {
fprintf(stderr, "%s: qxl: no PCI bus\n", __FUNCTION__);
+ }
#endif
} else if (std_vga_enabled) {
if (pci_bus) {
- pci_vga_init(pci_bus);
+ dev = pci_vga_init(pci_bus);
} else {
- isa_vga_init();
+ dev = isa_vga_init();
}
}
+
+ return dev;
}
static void cpu_request_exit(void *opaque, int irq, int level)
diff --git a/hw/pc.h b/hw/pc.h
index b7b7e40ce7..b2000e7873 100644
--- a/hw/pc.h
+++ b/hw/pc.h
@@ -140,7 +140,7 @@ void pc_memory_init(MemoryRegion *system_memory,
MemoryRegion *rom_memory,
MemoryRegion **ram_memory);
qemu_irq *pc_allocate_cpu_irq(void);
-void pc_vga_init(PCIBus *pci_bus);
+DeviceState *pc_vga_init(PCIBus *pci_bus);
void pc_basic_device_init(qemu_irq *gsi,
ISADevice **rtc_state,
ISADevice **floppy,
@@ -205,27 +205,27 @@ enum vga_retrace_method {
extern enum vga_retrace_method vga_retrace_method;
-static inline int isa_vga_init(void)
+static inline DeviceState *isa_vga_init(void)
{
ISADevice *dev;
dev = isa_try_create("isa-vga");
if (!dev) {
fprintf(stderr, "Warning: isa-vga not available\n");
- return 0;
+ return NULL;
}
qdev_init_nofail(&dev->qdev);
- return 1;
+ return &dev->qdev;
}
-int pci_vga_init(PCIBus *bus);
+DeviceState *pci_vga_init(PCIBus *bus);
int isa_vga_mm_init(target_phys_addr_t vram_base,
target_phys_addr_t ctrl_base, int it_shift,
MemoryRegion *address_space);
/* cirrus_vga.c */
-void pci_cirrus_vga_init(PCIBus *bus);
-void isa_cirrus_vga_init(MemoryRegion *address_space);
+DeviceState *pci_cirrus_vga_init(PCIBus *bus);
+DeviceState *isa_cirrus_vga_init(MemoryRegion *address_space);
/* ne2000.c */
static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 2d5ea2c5ad..166c2fc25a 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -99,6 +99,7 @@ static void pc_init1(MemoryRegion *system_memory,
MemoryRegion *ram_memory;
MemoryRegion *pci_memory;
MemoryRegion *rom_memory;
+ DeviceState *dev;
pc_cpus_init(cpu_model);
@@ -168,7 +169,10 @@ static void pc_init1(MemoryRegion *system_memory,
pc_register_ferr_irq(gsi[13]);
- pc_vga_init(pci_enabled? pci_bus: NULL);
+ dev = pc_vga_init(pci_enabled? pci_bus: NULL);
+ if (dev) {
+ qdev_property_add_child(qdev_get_root(), "vga", dev, NULL);
+ }
if (xen_enabled()) {
pci_create_simple(pci_bus, -1, "xen-platform");
diff --git a/hw/vga-pci.c b/hw/vga-pci.c
index 14bfadbfcf..a75dbf3974 100644
--- a/hw/vga-pci.c
+++ b/hw/vga-pci.c
@@ -70,10 +70,9 @@ static int pci_vga_initfn(PCIDevice *dev)
return 0;
}
-int pci_vga_init(PCIBus *bus)
+DeviceState *pci_vga_init(PCIBus *bus)
{
- pci_create_simple(bus, -1, "VGA");
- return 0;
+ return &pci_create_simple(bus, -1, "VGA")->qdev;
}
static PCIDeviceInfo vga_info = {
diff --git a/hw/vmware_vga.h b/hw/vmware_vga.h
index 5132573a56..db11cbfac8 100644
--- a/hw/vmware_vga.h
+++ b/hw/vmware_vga.h
@@ -4,15 +4,15 @@
#include "qemu-common.h"
/* vmware_vga.c */
-static inline bool pci_vmsvga_init(PCIBus *bus)
+static inline DeviceState *pci_vmsvga_init(PCIBus *bus)
{
PCIDevice *dev;
dev = pci_try_create(bus, -1, "vmware-svga");
if (!dev || qdev_init(&dev->qdev) < 0) {
- return false;
+ return NULL;
} else {
- return true;
+ return &dev->qdev;
}
}