Patchwork [33/35] target-alpha: Properly select the VGA controler to use.

login
register
mail settings
Submitter Richard Henderson
Date May 9, 2011, 9:34 p.m.
Message ID <1304976889-29675-34-git-send-email-rth@twiddle.net>
Download mbox | patch
Permalink /patch/94878/
State New
Headers show

Comments

Richard Henderson - May 9, 2011, 9:34 p.m.
The existing code for this really shouldn't be in pc.c.

Signed-off-by: Richard Henderson <rth@twiddle.net>
---
 hw/alpha_dp264.c |    2 +-
 hw/alpha_pci.c   |   33 ++++++++++++++++++++++++++++++++-
 hw/alpha_sys.h   |    2 ++
 3 files changed, 35 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/alpha_dp264.c b/hw/alpha_dp264.c
index c061b0a..dea0ef6 100644
--- a/hw/alpha_dp264.c
+++ b/hw/alpha_dp264.c
@@ -83,7 +83,7 @@  static void clipper_init(ram_addr_t ram_size,
     pit_init(0x40, 0);
 
     /* VGA setup.  Don't bother loading the bios.  */
-    pci_vga_init(pci_bus);
+    alpha_pci_vga_setup(pci_bus);
 
     /* Serial code setup.  */
     for (i = 0; i < MAX_SERIAL_PORTS; ++i) {
diff --git a/hw/alpha_pci.c b/hw/alpha_pci.c
index d0d727c..b321772 100644
--- a/hw/alpha_pci.c
+++ b/hw/alpha_pci.c
@@ -1,8 +1,15 @@ 
-/* There's nothing in here that's Alpha specific, really.  */
+/*
+ * QEMU Alpha PCI support functions.
+ *
+ * Some of this isn't very Alpha specific at all.  Some of this is specific
+ * to sparse PCI access support for older Alpha systems.
+ */
 
 #include "config.h"
 #include "alpha_sys.h"
 #include "qemu-log.h"
+#include "sysemu.h"
+#include "vmware_vga.h"
 
 
 /* PCI IO reads, to byte-word addressable memory.  */
@@ -325,3 +332,27 @@  CPUWriteMemoryFunc * const alpha_pci_special_writes[] = {
     unassigned_mem_writew,
     special_writel,
 };
+
+void alpha_pci_vga_setup(PCIBus *pci_bus)
+{
+    switch (vga_interface_type) {
+#ifdef CONFIG_SPICE
+    case VGA_QXL:
+        pci_create_simple(pci_bus, -1, "qxl-vga");
+        return;
+#endif
+    case VGA_CIRRUS:
+        pci_cirrus_vga_init(pci_bus);
+        return;
+    case VGA_VMWARE:
+        if (pci_vmsvga_init(pci_bus)) {
+            return;
+        }
+        break;
+    }
+    /* If VGA is enabled at all, and one of the above didn't work, then
+       fallback to Standard VGA.  */
+    if (vga_interface_type != VGA_NONE) {
+        pci_vga_init(pci_bus);
+    }
+}
diff --git a/hw/alpha_sys.h b/hw/alpha_sys.h
index 272a107..98e5351 100644
--- a/hw/alpha_sys.h
+++ b/hw/alpha_sys.h
@@ -39,4 +39,6 @@  extern void alpha_sparse_mem_write(PCIBus *, target_phys_addr_t, uint32_t);
 extern uint32_t alpha_sparse_conf1_read(PCIBus *, target_phys_addr_t);
 extern void alpha_sparse_conf1_write(PCIBus *, target_phys_addr_t, uint32_t);
 
+void alpha_pci_vga_setup(PCIBus *pci_bus);
+
 #endif