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