qom: add vga node to the pc composition tree
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
This commit is contained in:
parent
b2b6c39a79
commit
ad6d45fa08
@ -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;
|
CirrusVGAState *s;
|
||||||
|
|
||||||
@ -2913,6 +2913,8 @@ void isa_cirrus_vga_init(MemoryRegion *system_memory)
|
|||||||
vmstate_register(NULL, 0, &vmstate_cirrus_vga, s);
|
vmstate_register(NULL, 0, &vmstate_cirrus_vga, s);
|
||||||
rom_add_vga(VGABIOS_CIRRUS_FILENAME);
|
rom_add_vga(VGABIOS_CIRRUS_FILENAME);
|
||||||
/* XXX ISA-LFB support */
|
/* XXX ISA-LFB support */
|
||||||
|
/* FIXME not qdev yet */
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************
|
/***************************************
|
||||||
@ -2955,9 +2957,9 @@ static int pci_cirrus_vga_initfn(PCIDevice *dev)
|
|||||||
return 0;
|
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 = {
|
static PCIDeviceInfo cirrus_vga_info = {
|
||||||
|
26
hw/pc.c
26
hw/pc.c
@ -1069,38 +1069,44 @@ qemu_irq *pc_allocate_cpu_irq(void)
|
|||||||
return qemu_allocate_irqs(pic_irq_request, NULL, 1);
|
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 (cirrus_vga_enabled) {
|
||||||
if (pci_bus) {
|
if (pci_bus) {
|
||||||
pci_cirrus_vga_init(pci_bus);
|
dev = pci_cirrus_vga_init(pci_bus);
|
||||||
} else {
|
} else {
|
||||||
isa_cirrus_vga_init(get_system_memory());
|
dev = isa_cirrus_vga_init(get_system_memory());
|
||||||
}
|
}
|
||||||
} else if (vmsvga_enabled) {
|
} else if (vmsvga_enabled) {
|
||||||
if (pci_bus) {
|
if (pci_bus) {
|
||||||
if (!pci_vmsvga_init(pci_bus)) {
|
dev = pci_vmsvga_init(pci_bus);
|
||||||
|
if (!dev) {
|
||||||
fprintf(stderr, "Warning: vmware_vga not available,"
|
fprintf(stderr, "Warning: vmware_vga not available,"
|
||||||
" using standard VGA instead\n");
|
" using standard VGA instead\n");
|
||||||
pci_vga_init(pci_bus);
|
dev = pci_vga_init(pci_bus);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
|
fprintf(stderr, "%s: vmware_vga: no PCI bus\n", __FUNCTION__);
|
||||||
}
|
}
|
||||||
#ifdef CONFIG_SPICE
|
#ifdef CONFIG_SPICE
|
||||||
} else if (qxl_enabled) {
|
} else if (qxl_enabled) {
|
||||||
if (pci_bus)
|
if (pci_bus) {
|
||||||
pci_create_simple(pci_bus, -1, "qxl-vga");
|
dev = &pci_create_simple(pci_bus, -1, "qxl-vga")->qdev;
|
||||||
else
|
} else {
|
||||||
fprintf(stderr, "%s: qxl: no PCI bus\n", __FUNCTION__);
|
fprintf(stderr, "%s: qxl: no PCI bus\n", __FUNCTION__);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
} else if (std_vga_enabled) {
|
} else if (std_vga_enabled) {
|
||||||
if (pci_bus) {
|
if (pci_bus) {
|
||||||
pci_vga_init(pci_bus);
|
dev = pci_vga_init(pci_bus);
|
||||||
} else {
|
} else {
|
||||||
isa_vga_init();
|
dev = isa_vga_init();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return dev;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void cpu_request_exit(void *opaque, int irq, int level)
|
static void cpu_request_exit(void *opaque, int irq, int level)
|
||||||
|
14
hw/pc.h
14
hw/pc.h
@ -140,7 +140,7 @@ void pc_memory_init(MemoryRegion *system_memory,
|
|||||||
MemoryRegion *rom_memory,
|
MemoryRegion *rom_memory,
|
||||||
MemoryRegion **ram_memory);
|
MemoryRegion **ram_memory);
|
||||||
qemu_irq *pc_allocate_cpu_irq(void);
|
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,
|
void pc_basic_device_init(qemu_irq *gsi,
|
||||||
ISADevice **rtc_state,
|
ISADevice **rtc_state,
|
||||||
ISADevice **floppy,
|
ISADevice **floppy,
|
||||||
@ -205,27 +205,27 @@ enum vga_retrace_method {
|
|||||||
|
|
||||||
extern enum vga_retrace_method 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;
|
ISADevice *dev;
|
||||||
|
|
||||||
dev = isa_try_create("isa-vga");
|
dev = isa_try_create("isa-vga");
|
||||||
if (!dev) {
|
if (!dev) {
|
||||||
fprintf(stderr, "Warning: isa-vga not available\n");
|
fprintf(stderr, "Warning: isa-vga not available\n");
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
qdev_init_nofail(&dev->qdev);
|
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,
|
int isa_vga_mm_init(target_phys_addr_t vram_base,
|
||||||
target_phys_addr_t ctrl_base, int it_shift,
|
target_phys_addr_t ctrl_base, int it_shift,
|
||||||
MemoryRegion *address_space);
|
MemoryRegion *address_space);
|
||||||
|
|
||||||
/* cirrus_vga.c */
|
/* cirrus_vga.c */
|
||||||
void pci_cirrus_vga_init(PCIBus *bus);
|
DeviceState *pci_cirrus_vga_init(PCIBus *bus);
|
||||||
void isa_cirrus_vga_init(MemoryRegion *address_space);
|
DeviceState *isa_cirrus_vga_init(MemoryRegion *address_space);
|
||||||
|
|
||||||
/* ne2000.c */
|
/* ne2000.c */
|
||||||
static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd)
|
static inline bool isa_ne2000_init(int base, int irq, NICInfo *nd)
|
||||||
|
@ -99,6 +99,7 @@ static void pc_init1(MemoryRegion *system_memory,
|
|||||||
MemoryRegion *ram_memory;
|
MemoryRegion *ram_memory;
|
||||||
MemoryRegion *pci_memory;
|
MemoryRegion *pci_memory;
|
||||||
MemoryRegion *rom_memory;
|
MemoryRegion *rom_memory;
|
||||||
|
DeviceState *dev;
|
||||||
|
|
||||||
pc_cpus_init(cpu_model);
|
pc_cpus_init(cpu_model);
|
||||||
|
|
||||||
@ -168,7 +169,10 @@ static void pc_init1(MemoryRegion *system_memory,
|
|||||||
|
|
||||||
pc_register_ferr_irq(gsi[13]);
|
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()) {
|
if (xen_enabled()) {
|
||||||
pci_create_simple(pci_bus, -1, "xen-platform");
|
pci_create_simple(pci_bus, -1, "xen-platform");
|
||||||
|
@ -70,10 +70,9 @@ static int pci_vga_initfn(PCIDevice *dev)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
int pci_vga_init(PCIBus *bus)
|
DeviceState *pci_vga_init(PCIBus *bus)
|
||||||
{
|
{
|
||||||
pci_create_simple(bus, -1, "VGA");
|
return &pci_create_simple(bus, -1, "VGA")->qdev;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static PCIDeviceInfo vga_info = {
|
static PCIDeviceInfo vga_info = {
|
||||||
|
@ -4,15 +4,15 @@
|
|||||||
#include "qemu-common.h"
|
#include "qemu-common.h"
|
||||||
|
|
||||||
/* vmware_vga.c */
|
/* vmware_vga.c */
|
||||||
static inline bool pci_vmsvga_init(PCIBus *bus)
|
static inline DeviceState *pci_vmsvga_init(PCIBus *bus)
|
||||||
{
|
{
|
||||||
PCIDevice *dev;
|
PCIDevice *dev;
|
||||||
|
|
||||||
dev = pci_try_create(bus, -1, "vmware-svga");
|
dev = pci_try_create(bus, -1, "vmware-svga");
|
||||||
if (!dev || qdev_init(&dev->qdev) < 0) {
|
if (!dev || qdev_init(&dev->qdev) < 0) {
|
||||||
return false;
|
return NULL;
|
||||||
} else {
|
} else {
|
||||||
return true;
|
return &dev->qdev;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user