>From 311be2fd346b75c296856299250ada7c5ffbf207 Mon Sep 17 00:00:00 2001
From: Gerd Hoffmann <kraxel@redhat.com>
Date: Thu, 19 Jan 2012 11:46:55 +0100
Subject: [PATCH] enable s3-resume-vga-init

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 hw/fw_cfg.c |    9 +++++++++
 hw/fw_cfg.h |    1 +
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index f953532..87ae272 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -460,6 +460,14 @@ int fw_cfg_add_file(FWCfgState *s,  const char *filename, uint8_t *data,
     return 1;
 }
 
+/* see romfile_loadint() in src/paravirt.c in seabios */
+void fw_cfg_romfile_storeint(FWCfgState *s, const char *fn, uint64_t val)
+{
+    uint64_t *st = g_malloc(sizeof(*st));
+    *st = val;
+    fw_cfg_add_file(s, fn, (void *)st, sizeof(*st));
+}
+
 static void fw_cfg_machine_ready(struct Notifier *n, void *data)
 {
     uint32_t len;
@@ -467,6 +475,7 @@ static void fw_cfg_machine_ready(struct Notifier *n, void *data)
     char *bootindex = get_boot_devices_list(&len);
 
     fw_cfg_add_file(s, "bootorder", (uint8_t*)bootindex, len);
+    fw_cfg_romfile_storeint(s, "etc/s3-resume-vga-init", 1);
 }
 
 FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
index 856bf91..f2ba50d 100644
--- a/hw/fw_cfg.h
+++ b/hw/fw_cfg.h
@@ -62,6 +62,7 @@ int fw_cfg_add_callback(FWCfgState *s, uint16_t key, FWCfgCallback callback,
                         void *callback_opaque, uint8_t *data, size_t len);
 int fw_cfg_add_file(FWCfgState *s, const char *filename, uint8_t *data,
                     uint32_t len);
+void fw_cfg_romfile_storeint(FWCfgState *s, const char *fn, uint64_t val);
 FWCfgState *fw_cfg_init(uint32_t ctl_port, uint32_t data_port,
                         target_phys_addr_t crl_addr, target_phys_addr_t data_addr);
 
-- 
1.7.1

