Patchwork [RFC,v15,6/6] pvpanic: pass configurable ioport to seabios

login
register
mail settings
Submitter Hu Tao
Date March 21, 2013, 8:35 a.m.
Message ID <b82059369efd5ba9bb2b2bed230c4d32e308cf7c.1363847790.git.hutao@cn.fujitsu.com>
Download mbox | patch
Permalink /patch/229582/
State New
Headers show

Comments

Hu Tao - March 21, 2013, 8:35 a.m.
This lets seabios patch the corresponding SSDT entry.

Signed-off-by: Hu Tao <hutao@cn.fujitsu.com>
---
 hw/fw_cfg.h  |  2 ++
 hw/pvpanic.c | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

Patch

diff --git a/hw/fw_cfg.h b/hw/fw_cfg.h
index 05c8df1..07cc941 100644
--- a/hw/fw_cfg.h
+++ b/hw/fw_cfg.h
@@ -1,6 +1,8 @@ 
 #ifndef FW_CFG_H
 #define FW_CFG_H
 
+#include "exec/hwaddr.h"
+
 #define FW_CFG_SIGNATURE        0x00
 #define FW_CFG_ID               0x01
 #define FW_CFG_UUID             0x02
diff --git a/hw/pvpanic.c b/hw/pvpanic.c
index ff0a116..94c3b25 100644
--- a/hw/pvpanic.c
+++ b/hw/pvpanic.c
@@ -17,6 +17,8 @@ 
 #include <monitor/monitor.h>
 #include <sysemu/sysemu.h>
 #include <sysemu/kvm.h>
+#include "hw/fw_cfg.h"
+#include "hw/pc.h"
 
 /* The bit of supported pv event */
 #define PVPANIC_F_PANICKED      0
@@ -83,6 +85,18 @@  static int pvpanic_isa_initfn(ISADevice *dev)
     memory_region_init_io(&s->io, &pvpanic_ops, s, "pvpanic", 1);
     isa_register_ioport(dev, &s->io, s->ioport);
 
+    if (fw_cfg_piix) {
+        fw_cfg_add_file(fw_cfg_piix, "etc/pvpanic-port",
+                        g_memdup(&s->ioport, sizeof(s->ioport)),
+                        sizeof(s->ioport));
+    }
+
+    if (fw_cfg_q35) {
+        fw_cfg_add_file(fw_cfg_q35, "etc/pvpanic-port",
+                        g_memdup(&s->ioport, sizeof(s->ioport)),
+                        sizeof(s->ioport));
+    }
+
     return 0;
 }