Blob Blame Raw
From c5760d0c0f29b8ae540b3ca553f461874447c32f Mon Sep 17 00:00:00 2001
From: Marcel Apfelbaum <marcel.a@redhat.com>
Date: Wed, 6 Nov 2013 16:32:32 +0100
Subject: [PATCH 73/81] pvpanic: fix fwcfg for big endian hosts

RH-Author: Marcel Apfelbaum <marcel.a@redhat.com>
Message-id: <1383755557-21590-5-git-send-email-marcel.a@redhat.com>
Patchwork-id: 55549
O-Subject: [RHEL-7 qemu-kvm PATCH v3 4/9] pvpanic: fix fwcfg for big endian hosts
Bugzilla: 990601
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
RH-Acked-by: Alex Williamson <alex.williamson@redhat.com>

From: "Michael S. Tsirkin" <mst@redhat.com>

Convert port number to little endian when
exposing it in fw cfg.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit fea7d5966a54a5e5400cd38897a95ea576b5af4d)
Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
---
 hw/misc/pvpanic.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
---
 hw/misc/pvpanic.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/hw/misc/pvpanic.c b/hw/misc/pvpanic.c
index 8263225..1aab787 100644
--- a/hw/misc/pvpanic.c
+++ b/hw/misc/pvpanic.c
@@ -99,10 +99,11 @@ static int pvpanic_isa_initfn(ISADevice *dev)
 static void pvpanic_fw_cfg(ISADevice *dev, FWCfgState *fw_cfg)
 {
     PVPanicState *s = ISA_PVPANIC_DEVICE(dev);
+    uint16_t *pvpanic_port = g_malloc(sizeof(*pvpanic_port));
+    *pvpanic_port = cpu_to_le16(s->ioport);
 
-    fw_cfg_add_file(fw_cfg, "etc/pvpanic-port",
-                    g_memdup(&s->ioport, sizeof(s->ioport)),
-                    sizeof(s->ioport));
+    fw_cfg_add_file(fw_cfg, "etc/pvpanic-port", pvpanic_port,
+                    sizeof(*pvpanic_port));
 }
 
 void pvpanic_init(ISABus *bus)
-- 
1.7.1