qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH qtestfix for-1.5] libqos: Convert fw_cfg values to host endianness
@ 2013-04-28 16:45 Andreas Färber
  2013-04-29 22:04 ` Anthony Liguori
  0 siblings, 1 reply; 2+ messages in thread
From: Andreas Färber @ 2013-04-28 16:45 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, qemu-ppc, Andreas Färber, anthony

The fw_cfg ABI is Little Endian, so byte-swap the generically read
byte array to host endianness.

This unbreaks the fw_cfg tests on ppc.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 tests/libqos/fw_cfg.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tests/libqos/fw_cfg.c b/tests/libqos/fw_cfg.c
index 799139e..e386ff7 100644
--- a/tests/libqos/fw_cfg.c
+++ b/tests/libqos/fw_cfg.c
@@ -11,6 +11,7 @@
  */
 
 #include "libqos/fw_cfg.h"
+#include "qemu/bswap.h"
 
 void qfw_cfg_select(QFWCFG *fw_cfg, uint16_t key)
 {
@@ -32,20 +33,20 @@ uint16_t qfw_cfg_get_u16(QFWCFG *fw_cfg, uint16_t key)
 {
     uint16_t value;
     qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
-    return value;
+    return le16_to_cpu(value);
 }
 
 uint32_t qfw_cfg_get_u32(QFWCFG *fw_cfg, uint16_t key)
 {
     uint32_t value;
     qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
-    return value;
+    return le32_to_cpu(value);
 }
 
 uint64_t qfw_cfg_get_u64(QFWCFG *fw_cfg, uint16_t key)
 {
     uint64_t value;
     qfw_cfg_get(fw_cfg, key, &value, sizeof(value));
-    return value;
+    return le64_to_cpu(value);
 }
 
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH qtestfix for-1.5] libqos: Convert fw_cfg values to host endianness
  2013-04-28 16:45 [Qemu-devel] [PATCH qtestfix for-1.5] libqos: Convert fw_cfg values to host endianness Andreas Färber
@ 2013-04-29 22:04 ` Anthony Liguori
  0 siblings, 0 replies; 2+ messages in thread
From: Anthony Liguori @ 2013-04-29 22:04 UTC (permalink / raw)
  To: None, qemu-devel; +Cc: blauwirbel, qemu-ppc, anthony

Applied.  Thanks.

Regards,

Anthony Liguori

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-04-29 22:04 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-28 16:45 [Qemu-devel] [PATCH qtestfix for-1.5] libqos: Convert fw_cfg values to host endianness Andreas Färber
2013-04-29 22:04 ` Anthony Liguori

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).