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