qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] sga: stop using sgabios rom for 2.11+
@ 2017-11-15 10:29 Gerd Hoffmann
  0 siblings, 0 replies; only message in thread
From: Gerd Hoffmann @ 2017-11-15 10:29 UTC (permalink / raw)
  To: qemu-devel; +Cc: Gerd Hoffmann, Michael S. Tsirkin

seabios 1.11 got builtin serial console support, so we don't need
sgabios any more.  "-machine graphics=off" should be used instead.
update sga.c accordingly.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 include/hw/compat.h |  4 ++++
 hw/misc/sga.c       | 26 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/include/hw/compat.h b/include/hw/compat.h
index f96212c49c..1e3ad895db 100644
--- a/include/hw/compat.h
+++ b/include/hw/compat.h
@@ -14,6 +14,10 @@
         .driver   = "i82559a",\
         .property = "x-use-alt-device-id",\
         .value    = "false",\
+    },{\
+        .driver   = "sga",\
+        .property = "use-sgabios",\
+        .value    = "true",\
     },
 
 #define HW_COMPAT_2_9 \
diff --git a/hw/misc/sga.c b/hw/misc/sga.c
index 03b006d6f0..bcb4c98554 100644
--- a/hw/misc/sga.c
+++ b/hw/misc/sga.c
@@ -25,6 +25,7 @@
  *
  */
 #include "qemu/osdep.h"
+#include "qemu/error-report.h"
 #include "hw/pci/pci.h"
 #include "hw/i386/pc.h"
 #include "hw/loader.h"
@@ -37,18 +38,41 @@
 
 typedef struct ISASGAState {
     ISADevice parent_obj;
+    bool use_sgabios;
 } ISASGAState;
 
 static void sga_realizefn(DeviceState *dev, Error **errp)
 {
-    rom_add_vga(SGABIOS_FILENAME);
+    MachineState *machine = MACHINE(qdev_get_machine());
+    ISASGAState *sga = SGA(dev);
+
+    if (sga->use_sgabios) {
+        rom_add_vga(SGABIOS_FILENAME);
+    } else if (machine->enable_graphics) {
+        warn_report("sgabios is deprecated for your machine type, "
+                    "please use -machine graphics=off instead of "
+                    "-device sga");
+        rom_add_vga(SGABIOS_FILENAME);
+    } else {
+        /*
+         * For this machine type we expect SeaBIOS to provide a
+         * serial console for -machine graphics=off.  No need to
+         * do anything here.
+         */
+    }
 }
 
+static Property sga_properties[] = {
+    DEFINE_PROP_BOOL("use-sgabios", ISASGAState, use_sgabios, false),
+    DEFINE_PROP_END_OF_LIST(),
+};
+
 static void sga_class_initfn(ObjectClass *klass, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(klass);
 
     set_bit(DEVICE_CATEGORY_DISPLAY, dc->categories);
+    dc->props = sga_properties;
     dc->realize = sga_realizefn;
     dc->desc = "Serial Graphics Adapter";
 }
-- 
2.9.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-11-15 10:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-15 10:29 [Qemu-devel] [PATCH] sga: stop using sgabios rom for 2.11+ Gerd Hoffmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).