0a122b
From 1f08d3fe2b08289b3cae10dc91a96b793272801b Mon Sep 17 00:00:00 2001
0a122b
Message-Id: <1f08d3fe2b08289b3cae10dc91a96b793272801b.1387298827.git.minovotn@redhat.com>
0a122b
In-Reply-To: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
References: <3ed0fb61a3dc912ef036d7ef450bed192090709e.1387298827.git.minovotn@redhat.com>
0a122b
From: "Michael S. Tsirkin" <mst@redhat.com>
0a122b
Date: Tue, 17 Dec 2013 15:18:54 +0100
0a122b
Subject: [PATCH 43/56] pvpanic: add API to access io port
0a122b
0a122b
RH-Author: Michael S. Tsirkin <mst@redhat.com>
0a122b
Message-id: <1387293161-4085-44-git-send-email-mst@redhat.com>
0a122b
Patchwork-id: 56349
0a122b
O-Subject: [PATCH qemu-kvm RHEL7.0 v2 43/57] pvpanic: add API to access io port
0a122b
Bugzilla: 1034876
0a122b
RH-Acked-by: Igor Mammedov <imammedo@redhat.com>
0a122b
RH-Acked-by: Marcel Apfelbaum <marcel.a@redhat.com>
0a122b
RH-Acked-by: Laszlo Ersek <lersek@redhat.com>
0a122b
0a122b
Add API to find pvpanic device and get its io port.
0a122b
Will be used to fill in guest info structure.
0a122b
0a122b
Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Tested-by: Gerd Hoffmann <kraxel@redhat.com>
0a122b
Reviewed-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Tested-by: Igor Mammedov <imammedo@redhat.com>
0a122b
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
0a122b
(cherry picked from commit 309cd62d6b2628b4f0e2850b42011077f40956c7)
0a122b
0a122b
Conflicts:
0a122b
	include/hw/i386/pc.h
0a122b
---
0a122b
 include/hw/i386/pc.h |  1 +
0a122b
 hw/misc/pvpanic.c    | 14 +++++++++++++-
0a122b
 2 files changed, 14 insertions(+), 1 deletion(-)
0a122b
0a122b
Signed-off-by: Michal Novotny <minovotn@redhat.com>
0a122b
---
0a122b
 hw/misc/pvpanic.c    | 14 +++++++++++++-
0a122b
 include/hw/i386/pc.h |  1 +
0a122b
 2 files changed, 14 insertions(+), 1 deletion(-)
0a122b
0a122b
diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
0a122b
index 1838bc7..1377fde 100644
0a122b
--- a/hw/misc/pvpanic.c
0a122b
+++ b/hw/misc/pvpanic.c
0a122b
@@ -19,6 +19,7 @@
0a122b
 #include "qemu/log.h"
0a122b
 
0a122b
 #include "hw/nvram/fw_cfg.h"
0a122b
+#include "hw/i386/pc.h"
0a122b
 
0a122b
 /* The bit of supported pv event */
0a122b
 #define PVPANIC_F_PANICKED      0
0a122b
@@ -107,8 +108,19 @@ static int pvpanic_isa_initfn(ISADevice *dev)
0a122b
     return 0;
0a122b
 }
0a122b
 
0a122b
+#define PVPANIC_IOPORT_PROP "ioport"
0a122b
+
0a122b
+uint16_t pvpanic_port(void)
0a122b
+{
0a122b
+    Object *o = object_resolve_path_type("", TYPE_ISA_PVPANIC_DEVICE, NULL);
0a122b
+    if (!o) {
0a122b
+        return 0;
0a122b
+    }
0a122b
+    return object_property_get_int(o, PVPANIC_IOPORT_PROP, NULL);
0a122b
+}
0a122b
+
0a122b
 static Property pvpanic_isa_properties[] = {
0a122b
-    DEFINE_PROP_UINT16("ioport", PVPanicState, ioport, 0x505),
0a122b
+    DEFINE_PROP_UINT16(PVPANIC_IOPORT_PROP, PVPanicState, ioport, 0x505),
0a122b
     DEFINE_PROP_END_OF_LIST(),
0a122b
 };
0a122b
 
0a122b
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
0a122b
index d78e45b..8793715 100644
0a122b
--- a/include/hw/i386/pc.h
0a122b
+++ b/include/hw/i386/pc.h
0a122b
@@ -231,6 +231,7 @@ void pc_system_firmware_init(MemoryRegion *rom_memory);
0a122b
 
0a122b
 /* pvpanic.c */
0a122b
 void pvpanic_init(ISABus *bus);
0a122b
+uint16_t pvpanic_port(void);
0a122b
 
0a122b
 /* e820 types */
0a122b
 #define E820_RAM        1
0a122b
-- 
0a122b
1.7.11.7
0a122b